|
AvTranscoder
0.9.4
C++APIforLibav/FFmpeg
|
Wrapper of an AVFormatContext. More...
#include <FormatContext.hpp>
Public Member Functions | |
| FormatContext (const std::string &filename, int req_flags=0, AVDictionary **options=NULL) | |
| Allocate an AVFormatContext by opening an input file. More... | |
| FormatContext (int req_flags=0) | |
| Allocate an AVFormatContext with default values. More... | |
| ~FormatContext () | |
| void | findStreamInfo (AVDictionary **options=NULL) |
| Read packets of a media file to get stream information. More... | |
| void | openRessource (const std::string &url, int flags) |
| Create and initialize a AVIOContext for accessing the resource indicated by url. More... | |
| void | closeRessource () |
| Close the resource accessed by the AVIOContext and free it. More... | |
| void | writeHeader (AVDictionary **options=NULL) |
| Write the stream header to an output media file. More... | |
| void | writeFrame (AVPacket &packet, bool interleaved=true) |
| Write a packet to an output media file. More... | |
| void | writeTrailer () |
| Write the stream trailer to an output media file. More... | |
| void | addMetaData (const std::string &key, const std::string &value) |
| AVStream & | addAVStream (const AVCodec &avCodec) |
| bool | seek (const uint64_t position, const int flag) |
| Seek at a specific position. More... | |
| size_t | getNbStreams () const |
| size_t | getDuration () const |
| Get duration of the program, in seconds. More... | |
| size_t | getStartTime () const |
| OptionArray | getOptions () |
| Get options as array. More... | |
| OptionMap & | getOptionsMap () |
| Get options as map. More... | |
| Option & | getOption (const std::string &optionName) |
| void | setOutputFormat (const std::string &filename, const std::string &shortName="", const std::string &mimeType="") |
| void | setFilename (const std::string &filename) |
| AVFormatContext & | getAVFormatContext () const |
| AVOutputFormat & | getAVOutputFormat () const |
| AVInputFormat & | getAVInputFormat () const |
| AVIOContext & | getAVIOContext () const |
| AVDictionary & | getAVMetaData () const |
| AVStream & | getAVStream (size_t index) const |
Private Member Functions | |
| FormatContext (const FormatContext &formatContext) | |
| FormatContext & | operator= (const FormatContext &formatContext) |
Private Attributes | |
| AVFormatContext * | _avFormatContext |
| Has ownership. More... | |
| const int | _flags |
| Flags with which the options are loaded (see AV_OPT_FLAG_xxx) More... | |
| OptionMap | _options |
| bool | _isOpen |
| Is the AVFormatContext open (in constructor with a filename) More... | |
Wrapper of an AVFormatContext.
Definition at line 17 of file FormatContext.hpp.
|
private |
| avtranscoder::FormatContext::FormatContext | ( | const std::string & | filename, |
| int | req_flags = 0, |
||
| AVDictionary ** | options = NULL |
||
| ) |
Allocate an AVFormatContext by opening an input file.
Definition at line 9 of file FormatContext.cpp.
References _avFormatContext, _isOpen, _options, avtranscoder::getDescriptionFromErrorCode(), and avtranscoder::loadOptions().
| avtranscoder::FormatContext::FormatContext | ( | int | req_flags = 0 | ) |
Allocate an AVFormatContext with default values.
Definition at line 32 of file FormatContext.cpp.
References _avFormatContext, _options, and avtranscoder::loadOptions().
| avtranscoder::FormatContext::~FormatContext | ( | ) |
Definition at line 42 of file FormatContext.cpp.
References _avFormatContext, and _isOpen.
| AVStream & avtranscoder::FormatContext::addAVStream | ( | const AVCodec & | avCodec | ) |
Definition at line 134 of file FormatContext.cpp.
References _avFormatContext.
Referenced by avtranscoder::OutputFile::addAudioStream(), avtranscoder::OutputFile::addDataStream(), and avtranscoder::OutputFile::addVideoStream().
| void avtranscoder::FormatContext::addMetaData | ( | const std::string & | key, |
| const std::string & | value | ||
| ) |
Definition at line 125 of file FormatContext.cpp.
References _avFormatContext, avtranscoder::getDescriptionFromErrorCode(), and LOG_ERROR.
Referenced by avtranscoder::OutputFile::addMetadata().
| void avtranscoder::FormatContext::closeRessource | ( | ) |
Close the resource accessed by the AVIOContext and free it.
Definition at line 75 of file FormatContext.cpp.
References _avFormatContext, and avtranscoder::getDescriptionFromErrorCode().
Referenced by avtranscoder::OutputFile::endWrap().
| void avtranscoder::FormatContext::findStreamInfo | ( | AVDictionary ** | options = NULL | ) |
Read packets of a media file to get stream information.
Definition at line 54 of file FormatContext.cpp.
References _avFormatContext, and avtranscoder::getDescriptionFromErrorCode().
Referenced by avtranscoder::InputFile::InputFile().
|
inline |
Definition at line 112 of file FormatContext.hpp.
Referenced by avtranscoder::OutputFile::getFilename(), and avtranscoder::InputFile::readNextPacket().
|
inline |
Definition at line 114 of file FormatContext.hpp.
|
inline |
Definition at line 115 of file FormatContext.hpp.
|
inline |
Definition at line 116 of file FormatContext.hpp.
|
inline |
Definition at line 113 of file FormatContext.hpp.
Referenced by avtranscoder::OutputFile::getFormatLongName(), avtranscoder::OutputFile::getFormatMimeType(), and avtranscoder::OutputFile::getFormatName().
| AVStream & avtranscoder::FormatContext::getAVStream | ( | size_t | index | ) | const |
Definition at line 168 of file FormatContext.cpp.
References _avFormatContext, and getNbStreams().
Referenced by avtranscoder::FileProperties::extractStreamProperties(), avtranscoder::InputStream::InputStream(), avtranscoder::InputFile::readNextPacket(), and avtranscoder::OutputFile::wrap().
|
inline |
Get duration of the program, in seconds.
Definition at line 88 of file FormatContext.hpp.
|
inline |
Definition at line 86 of file FormatContext.hpp.
Referenced by avtranscoder::OutputFile::addAudioStream(), avtranscoder::OutputFile::addDataStream(), avtranscoder::OutputFile::addVideoStream(), avtranscoder::FileProperties::extractStreamProperties(), getAVStream(), and avtranscoder::InputFile::InputFile().
|
inline |
Definition at line 95 of file FormatContext.hpp.
Referenced by avtranscoder::OutputFile::setupRemainingWrappingOptions(), avtranscoder::InputFile::setupUnwrapping(), and avtranscoder::OutputFile::setupWrappingOptions().
| std::vector< Option > avtranscoder::FormatContext::getOptions | ( | ) |
|
inline |
Get options as map.
Definition at line 93 of file FormatContext.hpp.
|
inline |
Definition at line 89 of file FormatContext.hpp.
| void avtranscoder::FormatContext::openRessource | ( | const std::string & | url, |
| int | flags | ||
| ) |
Create and initialize a AVIOContext for accessing the resource indicated by url.
| url | url of ressource |
| flags | AVIO_FLAG_READ / AVIO_FLAG_WRITE / AVIO_FLAG_READ_WRITE |
Definition at line 63 of file FormatContext.cpp.
References _avFormatContext, and avtranscoder::getDescriptionFromErrorCode().
Referenced by avtranscoder::OutputFile::beginWrap().
|
private |
| bool avtranscoder::FormatContext::seek | ( | const uint64_t | position, |
| const int | flag | ||
| ) |
Seek at a specific position.
| position | can be in AV_TIME_BASE units, in frames... depending on the flag value |
| flag | seeking mode (AVSEEK_FLAG_xxx) |
Definition at line 145 of file FormatContext.cpp.
References _avFormatContext, avtranscoder::getDescriptionFromErrorCode(), LOG_ERROR, and LOG_INFO.
Referenced by avtranscoder::InputFile::seekAtFrame(), and avtranscoder::InputFile::seekAtTime().
| void avtranscoder::FormatContext::setFilename | ( | const std::string & | filename | ) |
Set filename of AVFormatContext.
Definition at line 180 of file FormatContext.cpp.
References _avFormatContext.
Referenced by avtranscoder::OutputFile::OutputFile().
| void avtranscoder::FormatContext::setOutputFormat | ( | const std::string & | filename, |
| const std::string & | shortName = "", |
||
| const std::string & | mimeType = "" |
||
| ) |
Guess format from arguments. Set the AVOutputFormat of AVFormatContext.
| filename | checks if it terminates with the extensions of the registered formats |
| shortName | checks if it matches with the names of the registered formats |
| mimeType | checks if it matches with the MIME type of the registered formats |
Definition at line 185 of file FormatContext.cpp.
References _avFormatContext.
Referenced by avtranscoder::OutputFile::OutputFile(), and avtranscoder::OutputFile::setupWrapping().
| void avtranscoder::FormatContext::writeFrame | ( | AVPacket & | packet, |
| bool | interleaved = true |
||
| ) |
Write a packet to an output media file.
| packet | packet to write (must be allocate and free by the caller |
| interleaved | to ensuring correct interleaving (available by default) |
Definition at line 99 of file FormatContext.cpp.
References _avFormatContext, and avtranscoder::getDescriptionFromErrorCode().
Referenced by avtranscoder::OutputFile::wrap().
| void avtranscoder::FormatContext::writeHeader | ( | AVDictionary ** | options = NULL | ) |
Write the stream header to an output media file.
Definition at line 87 of file FormatContext.cpp.
References _avFormatContext, _flags, _options, avtranscoder::getDescriptionFromErrorCode(), and avtranscoder::loadOptions().
Referenced by avtranscoder::OutputFile::beginWrap().
| void avtranscoder::FormatContext::writeTrailer | ( | ) |
Write the stream trailer to an output media file.
Definition at line 116 of file FormatContext.cpp.
References _avFormatContext, and avtranscoder::getDescriptionFromErrorCode().
Referenced by avtranscoder::OutputFile::endWrap().
|
private |
Has ownership.
Definition at line 121 of file FormatContext.hpp.
Referenced by addAVStream(), addMetaData(), closeRessource(), findStreamInfo(), FormatContext(), getAVStream(), openRessource(), seek(), setFilename(), setOutputFormat(), writeFrame(), writeHeader(), writeTrailer(), and ~FormatContext().
|
private |
Flags with which the options are loaded (see AV_OPT_FLAG_xxx)
Definition at line 122 of file FormatContext.hpp.
Referenced by writeHeader().
|
private |
Is the AVFormatContext open (in constructor with a filename)
Definition at line 124 of file FormatContext.hpp.
Referenced by FormatContext(), and ~FormatContext().
|
private |
Definition at line 123 of file FormatContext.hpp.
Referenced by FormatContext(), getOptions(), and writeHeader().