1 #ifndef _AV_TRANSCODER_FORMAT_CONTEXT_HPP_
2 #define _AV_TRANSCODER_FORMAT_CONTEXT_HPP_
8 #include <libavformat/avformat.h>
27 FormatContext(
const std::string& filename,
int req_flags = 0, AVDictionary** options = NULL);
39 void findStreamInfo(AVDictionary** options = NULL);
46 void openRessource(
const std::string& url,
int flags);
52 void closeRessource();
58 void writeHeader(AVDictionary** options = NULL);
65 void writeFrame(AVPacket& packet,
bool interleaved =
true);
73 void addMetaData(
const std::string& key,
const std::string& value);
74 AVStream& addAVStream(
const AVCodec& avCodec);
84 bool seek(
const uint64_t position,
const int flag);
86 size_t getNbStreams()
const {
return _avFormatContext->nb_streams; }
88 size_t getDuration()
const {
return _avFormatContext->duration; }
89 size_t getStartTime()
const {
return _avFormatContext->start_time; }
95 Option&
getOption(
const std::string& optionName) {
return _options.at(optionName); }
104 void setOutputFormat(
const std::string& filename,
const std::string& shortName =
"",
const std::string& mimeType =
"");
109 void setFilename(
const std::string& filename);
117 AVStream& getAVStream(
size_t index)
const;
size_t getNbStreams() const
const int _flags
Flags with which the options are loaded (see AV_OPT_FLAG_xxx)
std::map< std::string, Option > OptionMap
Key: option name / value: option.
std::vector< Option > OptionArray
AVOutputFormat & getAVOutputFormat() const
AVIOContext & getAVIOContext() const
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).
AVDictionary & getAVMetaData() const
Option & getOption(const std::string &optionName)
AVInputFormat & getAVInputFormat() const
OptionMap & getOptionsMap()
Get options as map.
Wrapper of an AVFormatContext.
bool _isOpen
Is the AVFormatContext open (in constructor with a filename)
AVFormatContext * _avFormatContext
Has ownership.
size_t getDuration() const
Get duration of the program, in seconds.
size_t getStartTime() const
AVFormatContext & getAVFormatContext() const