|
AvTranscoder
0.9.4
C++APIforLibav/FFmpeg
|
#include <InputFile.hpp>
Public Member Functions | |
| InputFile (const std::string &filename) | |
| Open a media file. More... | |
| virtual | ~InputFile () |
| void | analyse (IProgress &progress, const EAnalyseLevel level=eAnalyseLevelFirstGop) |
| Run the analyse on the file after a setup. call this function before getProperties(). More... | |
| bool | readNextPacket (CodedData &data, const size_t streamIndex) |
| Read the next packet of the specified stream. More... | |
| bool | seekAtFrame (const size_t frame, const int flag=AVSEEK_FLAG_ANY) |
| Seek at a specific frame / time (in seconds) More... | |
| bool | seekAtTime (const double time, const int flag=AVSEEK_FLAG_ANY) |
| void | activateStream (const size_t streamIndex, const bool activate=true) |
| Activate the indicated stream. More... | |
| const FileProperties & | getProperties () const |
| Return media properties on the current InputFile. More... | |
| InputStream & | getStream (size_t index) |
| Get stream type: video, audio, subtitle, etc. More... | |
| std::string | getFilename () const |
| FormatContext & | getFormatContext () |
| virtual void | setupUnwrapping (const ProfileLoader::Profile &profile) |
| Set the format of the input file. More... | |
Static Public Member Functions | |
| static FileProperties | analyseFile (const std::string &filename, IProgress &progress, const EAnalyseLevel level=eAnalyseLevelFirstGop) |
| Get media file properties using static method. More... | |
Protected Attributes | |
| FormatContext | _formatContext |
| FileProperties * | _properties |
| std::string | _filename |
| std::vector< InputStream * > | _inputStreams |
| Has ownership. More... | |
Private Member Functions | |
| InputFile (const InputFile &inputFile) | |
| InputFile & | operator= (const InputFile &inputFile) |
| double | getFps () |
| Get Fps from first video stream. More... | |
Definition at line 18 of file InputFile.hpp.
|
private |
| avtranscoder::InputFile::InputFile | ( | const std::string & | filename | ) |
Open a media file.
| filename | resource to access |
| ios_base::failure | launched if unable to open file |
Definition at line 23 of file InputFile.cpp.
References _formatContext, _inputStreams, _properties, avtranscoder::FormatContext::findStreamInfo(), and avtranscoder::FormatContext::getNbStreams().
|
virtual |
Definition at line 42 of file InputFile.cpp.
References _inputStreams, and _properties.
| void avtranscoder::InputFile::activateStream | ( | const size_t | streamIndex, |
| const bool | activate = true |
||
| ) |
Activate the indicated stream.
Definition at line 108 of file InputFile.cpp.
References avtranscoder::InputStream::activate(), and getStream().
Referenced by avtranscoder::Transcoder::addInputFile(), avtranscoder::AudioReader::init(), and avtranscoder::VideoReader::init().
| void avtranscoder::InputFile::analyse | ( | IProgress & | progress, |
| const EAnalyseLevel | level = eAnalyseLevelFirstGop |
||
| ) |
Run the analyse on the file after a setup. call this function before getProperties().
| progress | callback to get analysis progression |
| level | by default eAnalyseLevelFirstGop |
Definition at line 51 of file InputFile.cpp.
References _properties, and avtranscoder::FileProperties::extractStreamProperties().
Referenced by analyseFile(), avtranscoder::AudioReader::init(), avtranscoder::VideoReader::init(), and main().
|
static |
Get media file properties using static method.
| filename | input filename |
| progress | callback to get analysis progression |
Definition at line 56 of file InputFile.cpp.
References analyse(), and getProperties().
|
inline |
Definition at line 80 of file InputFile.hpp.
Referenced by getStream(), and avtranscoder::InputStream::readNextPacket().
|
inline |
Definition at line 82 of file InputFile.hpp.
Referenced by avtranscoder::InputStream::InputStream().
|
private |
Get Fps from first video stream.
Definition at line 129 of file InputFile.cpp.
References _properties, avtranscoder::FileProperties::getNbVideoStreams(), and avtranscoder::FileProperties::getVideoProperties().
Referenced by seekAtFrame().
|
inline |
Return media properties on the current InputFile.
Definition at line 71 of file InputFile.hpp.
Referenced by avtranscoder::Transcoder::add(), avtranscoder::Transcoder::addInputFile(), analyseFile(), avtranscoder::Transcoder::getProfileFromFile(), avtranscoder::InputStream::getProperties(), avtranscoder::AudioReader::init(), avtranscoder::VideoReader::init(), main(), and avtranscoder::operator<<().
| InputStream & avtranscoder::InputFile::getStream | ( | size_t | index | ) |
Get stream type: video, audio, subtitle, etc.
| index | stream index |
Definition at line 113 of file InputFile.cpp.
References _inputStreams, and getFilename().
Referenced by activateStream(), avtranscoder::Transcoder::addRewrapStream(), avtranscoder::Transcoder::getProfileFromFile(), avtranscoder::AudioReader::init(), and avtranscoder::VideoReader::init().
| bool avtranscoder::InputFile::readNextPacket | ( | CodedData & | data, |
| const size_t | streamIndex | ||
| ) |
Read the next packet of the specified stream.
| data | data of next packet read |
Definition at line 63 of file InputFile.cpp.
References _filename, _formatContext, _inputStreams, avtranscoder::CodedData::clear(), avtranscoder::FormatContext::getAVFormatContext(), avtranscoder::CodedData::getAVPacket(), avtranscoder::FormatContext::getAVStream(), avtranscoder::getDescriptionFromErrorCode(), LOG_DEBUG, LOG_INFO, and avtranscoder::CodedData::refAVStream().
Referenced by avtranscoder::InputStream::readNextPacket().
| bool avtranscoder::InputFile::seekAtFrame | ( | const size_t | frame, |
| const int | flag = AVSEEK_FLAG_ANY |
||
| ) |
Seek at a specific frame / time (in seconds)
| flag | ffmpeg seek flag (by default seek to any frame, even non-keyframes) |
Definition at line 96 of file InputFile.cpp.
References _formatContext, getFps(), and avtranscoder::FormatContext::seek().
Referenced by avtranscoder::IReader::readFrameAt().
| bool avtranscoder::InputFile::seekAtTime | ( | const double | time, |
| const int | flag = AVSEEK_FLAG_ANY |
||
| ) |
Definition at line 102 of file InputFile.cpp.
References _formatContext, and avtranscoder::FormatContext::seek().
Referenced by avtranscoder::Transcoder::addInputFile().
|
virtual |
Set the format of the input file.
| profile | the profile of the input format |
Definition at line 137 of file InputFile.cpp.
References _formatContext, avtranscoder::constants::avProfileIdentificator, avtranscoder::constants::avProfileIdentificatorHuman, avtranscoder::constants::avProfileType, avtranscoder::ProfileLoader::checkFormatProfile(), avtranscoder::FormatContext::getOption(), LOG_ERROR, LOG_INFO, LOG_WARN, and avtranscoder::Option::setString().
|
protected |
Definition at line 110 of file InputFile.hpp.
Referenced by readNextPacket().
|
protected |
Definition at line 108 of file InputFile.hpp.
Referenced by InputFile(), readNextPacket(), seekAtFrame(), seekAtTime(), and setupUnwrapping().
|
protected |
Has ownership.
Definition at line 111 of file InputFile.hpp.
Referenced by getStream(), InputFile(), readNextPacket(), and ~InputFile().
|
protected |
Definition at line 109 of file InputFile.hpp.
Referenced by analyse(), getFps(), InputFile(), and ~InputFile().