8 #include <libavcodec/avcodec.h>
9 #include <libavformat/avformat.h>
10 #include <libavutil/avutil.h>
11 #include <libavutil/pixdesc.h>
20 : _inputStream(&inputStream)
33 if(!isValid && !profile.empty())
35 const std::string msg(
"Invalid video profile to setup decoder.");
37 throw std::runtime_error(msg);
42 LOG_INFO(
"Setup video decoder with:\n" << profile)
54 for(ProfileLoader::Profile::const_iterator it = profile.begin(); it != profile.end(); ++it)
65 catch(std::exception& e)
67 LOG_WARN(
"VideoDecoder - can't set option " << (*it).first <<
" to " << (*it).second <<
": " << e.what())
102 if(!nextPacketRead && ret == 0 && got_frame == 0)
103 decodeNextFrame =
false;
105 decodeNextFrame =
true;
108 if(!nextPacketRead && !decodeNextFrame)
void setString(const std::string &value)
void clear()
Clear existing data and set size to 0.
void setInt(const int value)
std::string getDescriptionFromErrorCode(const int code)
Get the string description corresponding to the error code provided by ffmpeg/libav.
std::map< std::string, std::string > Profile
const std::string avProfileIdentificator
const std::string avProfileIdentificatorHuman
Option & getOption(const std::string &optionName)
Wrapper of AVOption. Get its type to know what the option is about: Int, Double, Ratio, Choice... Parse its array of options to get the potential childs (Choice and Group).
This class describes decoded (raw) audio or video data.
InputStream * _inputStream
Stream from which we read next frames (no ownership, has link)
void openCodec()
Initialize the codec context.
AVCodecContext & getAVCodecContext()
This class describes coded data.
void flushDecoder()
Reset the internal decoder state / flush internal buffers.
const std::string avProfileThreads
bool decodeNextFrame(Frame &frameBuffer)
Decode next frame.
VideoDecoder(InputStream &inputStream)
const std::string avProfileType
void setupDecoder(const ProfileLoader::Profile &profile=ProfileLoader::Profile())
Setup the decoder.
static bool checkVideoProfile(const Profile &profileToCheck)