-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ign-common3' into ports/3_to_4
Signed-off-by: Michael Carroll <[email protected]>
- Loading branch information
Showing
292 changed files
with
11,460 additions
and
9,918 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
add_subdirectory(gz) | ||
install(DIRECTORY ignition DESTINATION ${IGN_INCLUDE_INSTALL_DIR_FULL}) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Copyright (C) 2016 Open Source Robotics Foundation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
#ifndef GZ_COMMON_AUDIO_DECODER_HH_ | ||
#define GZ_COMMON_AUDIO_DECODER_HH_ | ||
|
||
#include <stdint.h> | ||
#include <string> | ||
#include <memory> | ||
|
||
#include <gz/common/av/Export.hh> | ||
#include <gz/common/SuppressWarning.hh> | ||
|
||
namespace ignition | ||
{ | ||
namespace common | ||
{ | ||
/// \brief Forward declaration of private data class | ||
class AudioDecoderPrivate; | ||
|
||
/// \class AudioDecoder AudioDecoder.hh ignition/common/common.hh | ||
/// \brief An audio decoder based on FFMPEG. | ||
class IGNITION_COMMON_AV_VISIBLE AudioDecoder | ||
{ | ||
/// \brief Constructor. | ||
public: AudioDecoder(); | ||
|
||
/// \brief Destructor. | ||
public: virtual ~AudioDecoder(); | ||
|
||
/// \brief Set the file to decode. | ||
/// \param[in] _filename Path to an audio file. | ||
/// \return True if the file was successfull opened. | ||
public: bool SetFile(const std::string &_filename); | ||
|
||
/// \brief Get the audio filename that was set. | ||
/// \return The name of the set audio file. | ||
/// \sa AudioDecoder::SetFile | ||
public: std::string File() const; | ||
|
||
/// \brief Decode the loaded audio file. | ||
/// \sa AudioDecoder::SetFile | ||
/// \param[out] _outBuffer Buffer that holds the decoded audio data. | ||
/// \param[out] _outBufferSize Size of the _outBuffer. | ||
/// \return True if decoding was succesful. | ||
public: bool Decode(uint8_t **_outBuffer, unsigned int *_outBufferSize); | ||
|
||
/// \brief Get the sample rate from the latest decoded file. | ||
/// \return Integer sample rate, such as 44100. | ||
/// If no file is decoded, -1 is returned. | ||
public: int SampleRate(); | ||
|
||
/// \brief Free audio object, close files, streams. | ||
private: void Cleanup(); | ||
|
||
IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING | ||
/// \brief Private data pointer | ||
private: std::unique_ptr<AudioDecoderPrivate> data; | ||
IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING | ||
}; | ||
} | ||
} | ||
#endif |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright 2020 Martin Pecka | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#ifndef IGNITION_COMMON_HWVIDEO_HH | ||
#define IGNITION_COMMON_HWVIDEO_HH | ||
|
||
#include <gz/common/EnumIface.hh> | ||
|
||
namespace ignition::common | ||
{ | ||
enum class IGNITION_COMMON_AV_VISIBLE HWEncoderType | ||
{ | ||
NONE, | ||
NVENC, // Linux device is /dev/nvidia* | ||
// Windows is the same (even though such file doesn't exist) | ||
VAAPI, // Linux device /dev/dri/renderD* or display number (e.g. :0) | ||
VDPAU, // Not supported (probably only for decoding?) | ||
QSV, // Win device is 0-based GPU index, | ||
// Linux uses /dev/dri/renderD* or display number (e.g. :0) | ||
VIDEOTOOLBOX, // Not yet suported | ||
AMF, // Not yet suported | ||
OMX, // Not yet suported | ||
V4L2M2M, // Not yet suported | ||
DXVA2, // Not yet suported | ||
_ // For FlagSet to work. | ||
}; | ||
|
||
IGN_ENUM(HWEncoderTypeParser, HWEncoderType, | ||
HWEncoderType::NONE, HWEncoderType::_, | ||
"NONE", | ||
"NVENC", | ||
"VAAPI", | ||
"VDPAU", | ||
"QSV", | ||
"VIDEOTOOLBOX", | ||
"AMF", | ||
"OMX", | ||
"V4L2M2M", | ||
"DXVA2", | ||
"INVALID" | ||
) | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* Copyright (C) 2016 Open Source Robotics Foundation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
#ifndef GZ_COMMON_VIDEO_HH_ | ||
#define GZ_COMMON_VIDEO_HH_ | ||
|
||
#include <string> | ||
#include <memory> | ||
|
||
#include <gz/common/av/Export.hh> | ||
#include <gz/common/SuppressWarning.hh> | ||
|
||
struct AVFormatContext; | ||
struct AVCodecContext; | ||
struct AVFrame; | ||
struct AVPicture; | ||
struct SwsContext; | ||
|
||
namespace ignition | ||
{ | ||
namespace common | ||
{ | ||
// Forward declare private data class | ||
class VideoPrivate; | ||
|
||
/// \brief Handle video encoding and decoding using libavcodec | ||
class IGNITION_COMMON_AV_VISIBLE Video | ||
{ | ||
/// \brief Constructor | ||
public: Video(); | ||
|
||
/// \brief Destructor | ||
public: virtual ~Video(); | ||
|
||
/// \brief Load a video file | ||
/// \param[in] _filename Full path of the video file | ||
/// \return false if a video stream can't be found | ||
public: bool Load(const std::string &_filename); | ||
|
||
/// \brief Get the width of the video in pixels | ||
/// \return the width | ||
public: int Width() const; | ||
|
||
/// \brief Get the height of the video in pixels | ||
/// \return the height | ||
public: int Height() const; | ||
|
||
/// \brief Convenience type alias for duration | ||
/// where 1000000 is the same as AV_TIME_BASE fractional seconds | ||
public: | ||
using Length = std::chrono::duration<int64_t, std::ratio<1, 1000000>>; | ||
|
||
/// \brief Get the duration of the video | ||
/// \return the duration | ||
public: Length Duration() const; | ||
|
||
/// \brief Get the next frame of the video. | ||
/// \param[out] _buffer Allocated buffer in which the frame is stored | ||
/// (size has to be width * height * 3 bytes). | ||
/// \return false on error or end of file | ||
public: bool NextFrame(unsigned char **_buffer); | ||
|
||
/// \brief free up open Video object, close files, streams | ||
private: void Cleanup(); | ||
|
||
IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING | ||
/// \brief Private data pointer | ||
private: std::unique_ptr<VideoPrivate> dataPtr; | ||
IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING | ||
}; | ||
} | ||
} | ||
#endif |
Oops, something went wrong.