diff --git a/src/AvTranscoder/DatasStructures/AudioDesc.cpp b/src/AvTranscoder/DatasStructures/AudioDesc.cpp index 02f812ec..11d15e9b 100644 --- a/src/AvTranscoder/DatasStructures/AudioDesc.cpp +++ b/src/AvTranscoder/DatasStructures/AudioDesc.cpp @@ -1,200 +1,38 @@ #include "AudioDesc.hpp" -#include "AudioFrame.hpp" -extern "C" { -#ifndef __STDC_CONSTANT_MACROS - #define __STDC_CONSTANT_MACROS -#endif -#include -#include -#include -#include -#include -#include -#include -#include -} -#include -#include -#include #include namespace avtranscoder { AudioDesc::AudioDesc( const std::string& codecName ) - : m_codec( NULL ) - , m_codecContext( NULL ) + : EssenceDesc( codecName ) { - if( codecName.size() ) - setAudioCodec( codecName ); } AudioDesc::AudioDesc( const AVCodecID codecId ) - : m_codec( NULL ) - , m_codecContext( NULL ) + : EssenceDesc( codecId ) { - setAudioCodec( codecId ); } -void AudioDesc::setAudioCodec( const std::string& codecName ) +AudioDesc::AudioDesc( const EssenceDesc& essenceDesc ) + : EssenceDesc( essenceDesc.getCodecId() ) { - avcodec_register_all(); // Warning: should be called only once - m_codec = avcodec_find_encoder_by_name( codecName.c_str() ); - initCodecContext(); + m_codec = essenceDesc.getCodec(); + m_codecContext = essenceDesc.getCodecContext(); } -void AudioDesc::setAudioCodec( const AVCodecID codecId ) -{ - avcodec_register_all(); // Warning: should be called only once - m_codec = avcodec_find_encoder( codecId ); - initCodecContext(); -} - -void AudioDesc::setAudioParameters( const size_t sampleRate, const size_t channels, const AVSampleFormat sampleFormat ) -{ - m_codecContext->sample_rate = sampleRate; - m_codecContext->channels = channels; - m_codecContext->sample_fmt = sampleFormat; -} - -void AudioDesc::initCodecContext( ) -{ - if( m_codec == NULL ) - { - throw std::runtime_error( "unknown audio codec" ); - } - - if( ( m_codecContext = avcodec_alloc_context3( m_codec ) ) == NULL ) - { - throw std::runtime_error( "unable to create context for audio context" ); - } - - // Set default codec parameters - if( avcodec_get_context_defaults3( m_codecContext, m_codec ) != 0 ) - { - throw std::runtime_error( "unable to find audio codec default values" ); - } -} - -void AudioDesc::set( const std::string& key, const std::string& flag, const bool enable ) +AudioFrameDesc AudioDesc::getFrameDesc() const { - int error = 0; - int64_t optVal; + assert( m_codecContext != NULL ); + AudioFrameDesc audioFrameDesc; - const AVOption* flagOpt = av_opt_find( m_codecContext, flag.c_str(), key.c_str(), 0, 0 ); - - if( ! flagOpt ) - { - std::cout << flag << std::endl << " : " << flagOpt->default_val.i64 << std::endl; - throw std::runtime_error( "unknown flag " + flag ); - } - - error = av_opt_get_int( m_codecContext, key.c_str(), AV_OPT_SEARCH_CHILDREN, &optVal ); - if( error != 0 ) - { - std::string err( "", AV_ERROR_MAX_STRING_SIZE ); - //av_make_error_string( const_cast(err.c_str()), err.size(), error ); - av_strerror( error, const_cast(err.c_str()), err.size() ); - throw std::runtime_error( "unknown key " + key + ": " + err ); - } - - if( enable ) - optVal = optVal | flagOpt->default_val.i64; - else - optVal = optVal &~ flagOpt->default_val.i64; + audioFrameDesc.setChannels( m_codecContext->channels ); + audioFrameDesc.setSampleRate( m_codecContext->sample_rate ); + audioFrameDesc.setSampleFormat( m_codecContext->sample_fmt ); + // audioFrameDesc.setFps( 25 ); - error = av_opt_set_int( m_codecContext, key.c_str(), optVal, AV_OPT_SEARCH_CHILDREN ); - if( error != 0 ) - { - std::string err( "", AV_ERROR_MAX_STRING_SIZE ); - //av_make_error_string( const_cast(err.c_str()), err.size(), error ); - av_strerror( error, const_cast(err.c_str()), err.size() ); - throw std::runtime_error( "setting " + key + " parameter to " + flag + ": " + err ); - } -} - -void AudioDesc::set( const std::string& key, const bool value ) -{ - int error = av_opt_set_int( m_codecContext, key.c_str(), value, AV_OPT_SEARCH_CHILDREN ); - if( error != 0 ) - { - std::string err( "", AV_ERROR_MAX_STRING_SIZE ); - //av_make_error_string( const_cast(err.c_str()), err.size(), error ); - av_strerror( error, const_cast(err.c_str()), err.size() ); - throw std::runtime_error( "setting " + key + " parameter to " + ( value ? "true" : "false" ) + ": " + err ); - } -} - -void AudioDesc::set( const std::string& key, const int value ) -{ - //const AVOption* flagOpt = av_opt_find( m_codecContext, key.c_str(), NULL, 0, AV_OPT_SEARCH_CHILDREN ); - - int error = av_opt_set_int( m_codecContext, key.c_str(), value, AV_OPT_SEARCH_CHILDREN ); - if( error != 0 ) - { - std::ostringstream os; - os << value; - std::string err( "", AV_ERROR_MAX_STRING_SIZE ); - //av_make_error_string( const_cast(err.c_str()), err.size(), error ); - av_strerror( error, const_cast(err.c_str()), err.size() ); - throw std::runtime_error( "setting " + key + " parameter to " + os.str() + ": " + err ); - } -} - -void AudioDesc::set( const std::string& key, const int num, const int den ) -{ - AVRational ratio; - ratio.num = num; - ratio.den = den; - int error = av_opt_set_q( m_codecContext, key.c_str(), ratio, AV_OPT_SEARCH_CHILDREN ); - if( error != 0 ) - { - std::ostringstream os; - os << num << "/" << den; - std::string err( "", AV_ERROR_MAX_STRING_SIZE ); - //av_make_error_string( const_cast(err.c_str()), err.size(), error ); - av_strerror( error, const_cast(err.c_str()), err.size() ); - throw std::runtime_error( "setting " + key + " parameter to " + os.str() + ": " + err ); - } -} - -void AudioDesc::set( const std::string& key, const double value ) -{ - int error = av_opt_set_double( m_codecContext, key.c_str(), value, AV_OPT_SEARCH_CHILDREN ); - if( error != 0 ) - { - std::ostringstream os; - os << value; - std::string err( "", AV_ERROR_MAX_STRING_SIZE ); - //av_make_error_string( const_cast(err.c_str()), err.size(), error ); - av_strerror( error, const_cast(err.c_str()), err.size() ); - throw std::runtime_error( "setting " + key + " parameter to " + os.str() + ": " + err ); - } -} - -void AudioDesc::set( const std::string& key, const std::string& value ) -{ - int error = av_opt_set( m_codecContext, key.c_str(), value.c_str(), AV_OPT_SEARCH_CHILDREN ); - if( error != 0 ) - { - std::string err( "", AV_ERROR_MAX_STRING_SIZE ); - //av_make_error_string( const_cast(err.c_str()), err.size(), error ); - av_strerror( error, const_cast(err.c_str()), err.size() ); - throw std::runtime_error( "setting " + key + " parameter to " + value + ": " + err ); - } -} - -std::string AudioDesc::getAudioCodec() const -{ - assert( m_codecContext != NULL ); - return avcodec_descriptor_get( m_codecContext->codec_id )->name; -} - -AVCodecID AudioDesc::getAudioCodecId() const -{ - assert( m_codecContext != NULL ); - return m_codecContext->codec_id; + return audioFrameDesc; } const size_t AudioDesc::getSampleRate() const @@ -215,18 +53,12 @@ const AVSampleFormat AudioDesc::getSampleFormat() const return m_codecContext->sample_fmt; } -AudioFrameDesc AudioDesc::getFrameDesc() const + +void AudioDesc::setAudioParameters( const size_t sampleRate, const size_t channels, const AVSampleFormat sampleFormat ) { - assert( m_codecContext != NULL ); - AudioFrameDesc audioFrameDesc; - - audioFrameDesc.setChannels( m_codecContext->channels ); - audioFrameDesc.setSampleRate( m_codecContext->sample_rate ); - audioFrameDesc.setSampleFormat( m_codecContext->sample_fmt ); - // audioFrameDesc.setFps( 25 ); - - return audioFrameDesc; + m_codecContext->sample_rate = sampleRate; + m_codecContext->channels = channels; + m_codecContext->sample_fmt = sampleFormat; } - } diff --git a/src/AvTranscoder/DatasStructures/AudioDesc.hpp b/src/AvTranscoder/DatasStructures/AudioDesc.hpp index d8f28abc..7663f07e 100644 --- a/src/AvTranscoder/DatasStructures/AudioDesc.hpp +++ b/src/AvTranscoder/DatasStructures/AudioDesc.hpp @@ -1,7 +1,6 @@ #ifndef _AV_TRANSCODER_DATA_AUDIO_DESC_HPP_ #define _AV_TRANSCODER_DATA_AUDIO_DESC_HPP_ -#include "Image.hpp" #include extern "C" { @@ -15,50 +14,26 @@ extern "C" { #include } +#include +#include #include namespace avtranscoder { -class AvExport AudioDesc +class AvExport AudioDesc : public EssenceDesc { public: AudioDesc( const std::string& codecName = "" ); AudioDesc( const AVCodecID codecId ); - - void setAudioCodec( const std::string& codecName ); - void setAudioCodec( const AVCodecID codecId ); - - void setAudioParameters( const size_t sampleRate, const size_t channels, const AVSampleFormat sampleFormat ); - - void set( const std::string& key, const std::string& flag, const bool enable ); - void set( const std::string& key, const bool value ); - void set( const std::string& key, const int value ); - void set( const std::string& key, const int num, const int den ); - void set( const std::string& key, const double value ); - void set( const std::string& key, const std::string& value ); + AudioDesc( const EssenceDesc& essenceDesc ); - std::string getAudioCodec() const; - AVCodecID getAudioCodecId() const; - + AudioFrameDesc getFrameDesc() const; const size_t getSampleRate() const; const size_t getChannels() const; const AVSampleFormat getSampleFormat() const; - -#ifndef SWIG - AVCodec* getCodec() const { return m_codec; } - AVCodecContext* getCodecContext() const { return m_codecContext; } -#endif - - AudioFrameDesc getFrameDesc() const; -private: - void initCodecContext( ); - - void checkError( int error ); - - AVCodec* m_codec; - AVCodecContext* m_codecContext; + void setAudioParameters( const size_t sampleRate, const size_t channels, const AVSampleFormat sampleFormat ); }; } diff --git a/src/AvTranscoder/DatasStructures/EssenceDesc.cpp b/src/AvTranscoder/DatasStructures/EssenceDesc.cpp new file mode 100644 index 00000000..c9851175 --- /dev/null +++ b/src/AvTranscoder/DatasStructures/EssenceDesc.cpp @@ -0,0 +1,186 @@ +#include "EssenceDesc.hpp" + +extern "C" { +#ifndef __STDC_CONSTANT_MACROS + #define __STDC_CONSTANT_MACROS +#endif +#include +#include +} + +#include +#include +#include +#include + +namespace avtranscoder { + +EssenceDesc::EssenceDesc( const std::string& codecName ) + : m_codec( NULL ) + , m_codecContext( NULL ) +{ + if( codecName.size() ) + setCodec( codecName ); +} + +EssenceDesc::EssenceDesc( const AVCodecID codecId ) + : m_codec( NULL ) + , m_codecContext( NULL ) +{ + setCodec( codecId ); +} + +std::string EssenceDesc::getCodecName() const +{ + assert( m_codecContext != NULL ); + return avcodec_descriptor_get( m_codecContext->codec_id )->name; +} + +AVCodecID EssenceDesc::getCodecId() const +{ + assert( m_codecContext != NULL ); + return m_codecContext->codec_id; +} + +void EssenceDesc::setCodec( const std::string& codecName ) +{ + avcodec_register_all(); // Warning: should be called only once + m_codec = avcodec_find_encoder_by_name( codecName.c_str() ); + initCodecContext(); +} + +void EssenceDesc::setCodec( const AVCodecID codecId ) +{ + avcodec_register_all(); // Warning: should be called only once + m_codec = avcodec_find_encoder( codecId ); + initCodecContext(); +} + +void EssenceDesc::initCodecContext( ) +{ + if( m_codec == NULL ) + { + throw std::runtime_error( "unknown audio codec" ); + } + + if( ( m_codecContext = avcodec_alloc_context3( m_codec ) ) == NULL ) + { + throw std::runtime_error( "unable to create context for audio context" ); + } + + // Set default codec parameters + if( avcodec_get_context_defaults3( m_codecContext, m_codec ) != 0 ) + { + throw std::runtime_error( "unable to find audio codec default values" ); + } +} + +void EssenceDesc::set( const std::string& key, const std::string& flag, const bool enable ) +{ + int error = 0; + int64_t optVal; + + const AVOption* flagOpt = av_opt_find( m_codecContext, flag.c_str(), key.c_str(), 0, 0 ); + + if( ! flagOpt ) + { + std::cout << flag << std::endl << " : " << flagOpt->default_val.i64 << std::endl; + throw std::runtime_error( "unknown flag " + flag ); + } + + error = av_opt_get_int( m_codecContext, key.c_str(), AV_OPT_SEARCH_CHILDREN, &optVal ); + if( error != 0 ) + { + std::string err( "", AV_ERROR_MAX_STRING_SIZE ); + //av_make_error_string( const_cast(err.c_str()), err.size(), error ); + av_strerror( error, const_cast(err.c_str()), err.size() ); + throw std::runtime_error( "unknown key " + key + ": " + err ); + } + + if( enable ) + optVal = optVal | flagOpt->default_val.i64; + else + optVal = optVal &~ flagOpt->default_val.i64; + + error = av_opt_set_int( m_codecContext, key.c_str(), optVal, AV_OPT_SEARCH_CHILDREN ); + if( error != 0 ) + { + std::string err( "", AV_ERROR_MAX_STRING_SIZE ); + //av_make_error_string( const_cast(err.c_str()), err.size(), error ); + av_strerror( error, const_cast(err.c_str()), err.size() ); + throw std::runtime_error( "setting " + key + " parameter to " + flag + ": " + err ); + } +} + +void EssenceDesc::set( const std::string& key, const bool value ) +{ + int error = av_opt_set_int( m_codecContext, key.c_str(), value, AV_OPT_SEARCH_CHILDREN ); + if( error != 0 ) + { + std::string err( "", AV_ERROR_MAX_STRING_SIZE ); + //av_make_error_string( const_cast(err.c_str()), err.size(), error ); + av_strerror( error, const_cast(err.c_str()), err.size() ); + throw std::runtime_error( "setting " + key + " parameter to " + ( value ? "true" : "false" ) + ": " + err ); + } +} + +void EssenceDesc::set( const std::string& key, const int value ) +{ + //const AVOption* flagOpt = av_opt_find( m_codecContext, key.c_str(), NULL, 0, AV_OPT_SEARCH_CHILDREN ); + + int error = av_opt_set_int( m_codecContext, key.c_str(), value, AV_OPT_SEARCH_CHILDREN ); + if( error != 0 ) + { + std::ostringstream os; + os << value; + std::string err( "", AV_ERROR_MAX_STRING_SIZE ); + //av_make_error_string( const_cast(err.c_str()), err.size(), error ); + av_strerror( error, const_cast(err.c_str()), err.size() ); + throw std::runtime_error( "setting " + key + " parameter to " + os.str() + ": " + err ); + } +} + +void EssenceDesc::set( const std::string& key, const int num, const int den ) +{ + AVRational ratio; + ratio.num = num; + ratio.den = den; + int error = av_opt_set_q( m_codecContext, key.c_str(), ratio, AV_OPT_SEARCH_CHILDREN ); + if( error != 0 ) + { + std::ostringstream os; + os << num << "/" << den; + std::string err( "", AV_ERROR_MAX_STRING_SIZE ); + //av_make_error_string( const_cast(err.c_str()), err.size(), error ); + av_strerror( error, const_cast(err.c_str()), err.size() ); + throw std::runtime_error( "setting " + key + " parameter to " + os.str() + ": " + err ); + } +} + +void EssenceDesc::set( const std::string& key, const double value ) +{ + int error = av_opt_set_double( m_codecContext, key.c_str(), value, AV_OPT_SEARCH_CHILDREN ); + if( error != 0 ) + { + std::ostringstream os; + os << value; + std::string err( "", AV_ERROR_MAX_STRING_SIZE ); + //av_make_error_string( const_cast(err.c_str()), err.size(), error ); + av_strerror( error, const_cast(err.c_str()), err.size() ); + throw std::runtime_error( "setting " + key + " parameter to " + os.str() + ": " + err ); + } +} + +void EssenceDesc::set( const std::string& key, const std::string& value ) +{ + int error = av_opt_set( m_codecContext, key.c_str(), value.c_str(), AV_OPT_SEARCH_CHILDREN ); + if( error != 0 ) + { + std::string err( "", AV_ERROR_MAX_STRING_SIZE ); + //av_make_error_string( const_cast(err.c_str()), err.size(), error ); + av_strerror( error, const_cast(err.c_str()), err.size() ); + throw std::runtime_error( "setting " + key + " parameter to " + value + ": " + err ); + } +} + +} diff --git a/src/AvTranscoder/DatasStructures/EssenceDesc.hpp b/src/AvTranscoder/DatasStructures/EssenceDesc.hpp new file mode 100644 index 00000000..c75c7588 --- /dev/null +++ b/src/AvTranscoder/DatasStructures/EssenceDesc.hpp @@ -0,0 +1,61 @@ +#ifndef _AV_TRANSCODER_DATA_ESSENCE_DESC_HPP_ +#define _AV_TRANSCODER_DATA_ESSENCE_DESC_HPP_ + +#include + +extern "C" { +#ifndef __STDC_CONSTANT_MACROS + #define __STDC_CONSTANT_MACROS +#endif +#ifndef INT64_C + #define INT64_C(c) (c ## LL) + #define UINT64_C(c) (c ## ULL) +#endif +#include +} + +#include + +namespace avtranscoder +{ + +class AvExport EssenceDesc +{ +public: + EssenceDesc( const std::string& codecName ); + EssenceDesc( const AVCodecID codecId ); + + virtual ~EssenceDesc() {} + + std::string getCodecName() const; + AVCodecID getCodecId() const; + + void setCodec( const std::string& codecName ); + void setCodec( const AVCodecID codecId ); + + void set( const std::string& key, const std::string& flag, const bool enable ); + void set( const std::string& key, const bool value ); + void set( const std::string& key, const int value ); + void set( const std::string& key, const int num, const int den ); + void set( const std::string& key, const double value ); + void set( const std::string& key, const std::string& value ); + +#ifndef SWIG + AVCodec* getCodec() const { return m_codec; } + AVCodecContext* getCodecContext() const { return m_codecContext; } +#endif + +private: + void initCodecContext( ); + + void checkError( int error ); + +protected: + AVCodec* m_codec; + AVCodecContext* m_codecContext; +}; + +} + +#endif + diff --git a/src/AvTranscoder/DatasStructures/VideoDesc.cpp b/src/AvTranscoder/DatasStructures/VideoDesc.cpp index c7dc4814..1060524c 100644 --- a/src/AvTranscoder/DatasStructures/VideoDesc.cpp +++ b/src/AvTranscoder/DatasStructures/VideoDesc.cpp @@ -1,53 +1,47 @@ #include "VideoDesc.hpp" -extern "C" { -#ifndef __STDC_CONSTANT_MACROS - #define __STDC_CONSTANT_MACROS -#endif -#include -#include -#include -#include -#include -#include -#include -#include -} -#include -#include -#include #include namespace avtranscoder { VideoDesc::VideoDesc( const std::string& codecName ) - : m_codec( NULL ) - , m_codecContext( NULL ) + : EssenceDesc( codecName ) { - if( codecName.size() ) - setVideoCodec( codecName ); } VideoDesc::VideoDesc( const AVCodecID codecId ) - : m_codec( NULL ) - , m_codecContext( NULL ) + : EssenceDesc( codecId ) { - setVideoCodec( codecId ); } -void VideoDesc::setVideoCodec( const std::string& codecName ) +VideoDesc::VideoDesc( const EssenceDesc& essenceDesc ) + : EssenceDesc( essenceDesc.getCodecId() ) +{ + m_codec = essenceDesc.getCodec(); + m_codecContext = essenceDesc.getCodecContext(); +} + +ImageDesc VideoDesc::getImageDesc() const { - avcodec_register_all(); // Warning: should be called only once - m_codec = avcodec_find_encoder_by_name( codecName.c_str() ); - initCodecContext(); + assert( m_codecContext != NULL ); + ImageDesc imageDesc; + Pixel pixel( m_codecContext->pix_fmt ); + + imageDesc.setWidth ( m_codecContext->width ); + imageDesc.setHeight( m_codecContext->height ); + imageDesc.setPixel ( pixel ); + imageDesc.setDar ( m_codecContext->height, m_codecContext->width ); + return imageDesc; } -void VideoDesc::setVideoCodec( const AVCodecID codecId ) +std::pair< size_t, size_t > VideoDesc::getTimeBase() const { - avcodec_register_all(); // Warning: should be called only once - m_codec = avcodec_find_encoder( codecId ); - initCodecContext(); + assert( m_codecContext != NULL ); + std::pair< size_t, size_t > timeBase; + timeBase.first = m_codecContext->time_base.num; + timeBase.second = m_codecContext->time_base.den; + return timeBase; } void VideoDesc::setImageParameters( const ImageDesc& imageDesc ) @@ -75,165 +69,4 @@ void VideoDesc::setTimeBase( const size_t num, const size_t den, const size_t ti m_codecContext->ticks_per_frame = ticksPerFrame; } -std::string VideoDesc::getVideoCodec() const -{ - assert( m_codecContext != NULL ); - return avcodec_descriptor_get( m_codecContext->codec_id )->name; -} - -AVCodecID VideoDesc::getVideoCodecId() const -{ - assert( m_codecContext != NULL ); - return m_codecContext->codec_id; -} - -std::pair< size_t, size_t > VideoDesc::getTimeBase() const -{ - assert( m_codecContext != NULL ); - std::pair< size_t, size_t > timeBase; - timeBase.first = m_codecContext->time_base.num; - timeBase.second = m_codecContext->time_base.den; - return timeBase; -} - -void VideoDesc::initCodecContext( ) -{ - if( m_codec == NULL ) - { - throw std::runtime_error( "unknown video codec" ); - } - - if( ( m_codecContext = avcodec_alloc_context3( m_codec ) ) == NULL ) - { - throw std::runtime_error( "unable to create context for video context" ); - } - - // Set default codec parameters - if( avcodec_get_context_defaults3( m_codecContext, m_codec ) != 0 ) - { - throw std::runtime_error( "unable to find video codec default values" ); - } -} - -void VideoDesc::set( const std::string& key, const std::string& flag, const bool enable ) -{ - int error = 0; - int64_t optVal; - - const AVOption* flagOpt = av_opt_find( m_codecContext, flag.c_str(), key.c_str(), 0, 0 ); - - if( ! flagOpt ) - { - std::cout << flag << std::endl << " : " << flagOpt->default_val.i64 << std::endl; - throw std::runtime_error( "unknown flag " + flag ); - } - - error = av_opt_get_int( m_codecContext, key.c_str(), AV_OPT_SEARCH_CHILDREN, &optVal ); - if( error != 0 ) - { - std::string err( "", AV_ERROR_MAX_STRING_SIZE ); - //av_make_error_string( const_cast(err.c_str()), err.size(), error ); - av_strerror( error, const_cast(err.c_str()), err.size() ); - throw std::runtime_error( "unknown key " + key + ": " + err ); - } - - if( enable ) - optVal = optVal | flagOpt->default_val.i64; - else - optVal = optVal &~ flagOpt->default_val.i64; - - error = av_opt_set_int( m_codecContext, key.c_str(), optVal, AV_OPT_SEARCH_CHILDREN ); - if( error != 0 ) - { - std::string err( "", AV_ERROR_MAX_STRING_SIZE ); - //av_make_error_string( const_cast(err.c_str()), err.size(), error ); - av_strerror( error, const_cast(err.c_str()), err.size() ); - throw std::runtime_error( "setting " + key + " parameter to " + flag + ": " + err ); - } -} - -void VideoDesc::set( const std::string& key, const bool value ) -{ - int error = av_opt_set_int( m_codecContext, key.c_str(), value, AV_OPT_SEARCH_CHILDREN ); - if( error != 0 ) - { - std::string err( "", AV_ERROR_MAX_STRING_SIZE ); - //av_make_error_string( const_cast(err.c_str()), err.size(), error ); - av_strerror( error, const_cast(err.c_str()), err.size() ); - throw std::runtime_error( "setting " + key + " parameter to " + ( value ? "true" : "false" ) + ": " + err ); - } -} - -void VideoDesc::set( const std::string& key, const int value ) -{ - //const AVOption* flagOpt = av_opt_find( m_codecContext, key.c_str(), NULL, 0, AV_OPT_SEARCH_CHILDREN ); - - int error = av_opt_set_int( m_codecContext, key.c_str(), value, AV_OPT_SEARCH_CHILDREN ); - if( error != 0 ) - { - std::ostringstream os; - os << value; - std::string err( "", AV_ERROR_MAX_STRING_SIZE ); - //av_make_error_string( const_cast(err.c_str()), err.size(), error ); - av_strerror( error, const_cast(err.c_str()), err.size() ); - throw std::runtime_error( "setting " + key + " parameter to " + os.str() + ": " + err ); - } -} - -void VideoDesc::set( const std::string& key, const int num, const int den ) -{ - AVRational ratio; - ratio.num = num; - ratio.den = den; - int error = av_opt_set_q( m_codecContext, key.c_str(), ratio, AV_OPT_SEARCH_CHILDREN ); - if( error != 0 ) - { - std::ostringstream os; - os << num << "/" << den; - std::string err( "", AV_ERROR_MAX_STRING_SIZE ); - //av_make_error_string( const_cast(err.c_str()), err.size(), error ); - av_strerror( error, const_cast(err.c_str()), err.size() ); - throw std::runtime_error( "setting " + key + " parameter to " + os.str() + ": " + err ); - } -} - -void VideoDesc::set( const std::string& key, const double value ) -{ - int error = av_opt_set_double( m_codecContext, key.c_str(), value, AV_OPT_SEARCH_CHILDREN ); - if( error != 0 ) - { - std::ostringstream os; - os << value; - std::string err( "", AV_ERROR_MAX_STRING_SIZE ); - //av_make_error_string( const_cast(err.c_str()), err.size(), error ); - av_strerror( error, const_cast(err.c_str()), err.size() ); - throw std::runtime_error( "setting " + key + " parameter to " + os.str() + ": " + err ); - } -} - -void VideoDesc::set( const std::string& key, const std::string& value ) -{ - int error = av_opt_set( m_codecContext, key.c_str(), value.c_str(), AV_OPT_SEARCH_CHILDREN ); - if( error != 0 ) - { - std::string err( "", AV_ERROR_MAX_STRING_SIZE ); - //av_make_error_string( const_cast(err.c_str()), err.size(), error ); - av_strerror( error, const_cast(err.c_str()), err.size() ); - throw std::runtime_error( "setting " + key + " parameter to " + value + ": " + err ); - } -} - -ImageDesc VideoDesc::getImageDesc() const -{ - assert( m_codecContext != NULL ); - ImageDesc imageDesc; - Pixel pixel( m_codecContext->pix_fmt ); - - imageDesc.setWidth ( m_codecContext->width ); - imageDesc.setHeight( m_codecContext->height ); - imageDesc.setPixel ( pixel ); - imageDesc.setDar ( m_codecContext->height, m_codecContext->width ); - return imageDesc; -} - } diff --git a/src/AvTranscoder/DatasStructures/VideoDesc.hpp b/src/AvTranscoder/DatasStructures/VideoDesc.hpp index 41239d3a..fe52c492 100644 --- a/src/AvTranscoder/DatasStructures/VideoDesc.hpp +++ b/src/AvTranscoder/DatasStructures/VideoDesc.hpp @@ -1,8 +1,6 @@ #ifndef _AV_TRANSCODER_DATA_VIDEO_DESC_HPP_ #define _AV_TRANSCODER_DATA_VIDEO_DESC_HPP_ - -#include "Image.hpp" #include extern "C" { @@ -16,51 +14,28 @@ extern "C" { #include } +#include +#include #include namespace avtranscoder { -class AvExport VideoDesc +class AvExport VideoDesc : public EssenceDesc { public: VideoDesc( const std::string& codecName = "" ); VideoDesc( const AVCodecID codecId ); - - void setVideoCodec( const std::string& codecName ); - void setVideoCodec( const AVCodecID codecId ); - + VideoDesc( const EssenceDesc& essenceDesc ); + + ImageDesc getImageDesc() const; + std::pair< size_t, size_t > getTimeBase() const; + void setImageParameters( const ImageDesc& imageDesc ); void setImageParameters( const size_t width, const size_t height, const Pixel& pixel ); void setImageParameters( const size_t width, const size_t height, const AVPixelFormat& pixel ); void setTimeBase( const size_t num, const size_t den, const size_t ticksPerFrame = 1 ); - - void set( const std::string& key, const std::string& flag, const bool enable ); - void set( const std::string& key, const bool value ); - void set( const std::string& key, const int value ); - void set( const std::string& key, const int num, const int den ); - void set( const std::string& key, const double value ); - void set( const std::string& key, const std::string& value ); - - std::string getVideoCodec() const; - AVCodecID getVideoCodecId() const; - std::pair< size_t, size_t > getTimeBase() const; - -#ifndef SWIG - AVCodec* getCodec() const { return m_codec; } - AVCodecContext* getCodecContext() const { return m_codecContext; } -#endif - - ImageDesc getImageDesc() const; - -private: - void initCodecContext( ); - - void checkError( int error ); - - AVCodec* m_codec; - AVCodecContext* m_codecContext; }; } diff --git a/src/AvTranscoder/EssenceStream/DummyVideo.cpp b/src/AvTranscoder/EssenceStream/DummyVideo.cpp index bb2d9723..0113dbcb 100644 --- a/src/AvTranscoder/EssenceStream/DummyVideo.cpp +++ b/src/AvTranscoder/EssenceStream/DummyVideo.cpp @@ -17,7 +17,7 @@ DummyVideo::~DummyVideo( ) { } -void DummyVideo::setVideoDesc( VideoDesc& videoDesc ) +void DummyVideo::setVideoDesc( const VideoDesc& videoDesc ) { _videoDesc = videoDesc; _imageDesc = _videoDesc.getImageDesc(); diff --git a/src/AvTranscoder/EssenceStream/DummyVideo.hpp b/src/AvTranscoder/EssenceStream/DummyVideo.hpp index 46acb596..5f123d01 100644 --- a/src/AvTranscoder/EssenceStream/DummyVideo.hpp +++ b/src/AvTranscoder/EssenceStream/DummyVideo.hpp @@ -17,7 +17,7 @@ class AvExport DummyVideo : public InputEssence ~DummyVideo( ); // Stream properties - void setVideoDesc( VideoDesc& videoDesc ); + void setVideoDesc( const VideoDesc& videoDesc ); VideoDesc getVideoDesc() const; diff --git a/src/AvTranscoder/EssenceStream/InputAudio.cpp b/src/AvTranscoder/EssenceStream/InputAudio.cpp index 3c0b954d..1b7c3c6d 100644 --- a/src/AvTranscoder/EssenceStream/InputAudio.cpp +++ b/src/AvTranscoder/EssenceStream/InputAudio.cpp @@ -57,7 +57,7 @@ void InputAudio::setup() { avcodec_register_all(); - _codec = avcodec_find_decoder( _inputStream->getAudioDesc().getAudioCodecId() ); + _codec = avcodec_find_decoder( _inputStream->getAudioDesc().getCodecId() ); if( _codec == NULL ) { throw std::runtime_error( "codec not supported" ); diff --git a/src/AvTranscoder/EssenceStream/InputVideo.cpp b/src/AvTranscoder/EssenceStream/InputVideo.cpp index 3dca6e79..6fe15edd 100644 --- a/src/AvTranscoder/EssenceStream/InputVideo.cpp +++ b/src/AvTranscoder/EssenceStream/InputVideo.cpp @@ -55,7 +55,7 @@ void InputVideo::setup() { av_register_all(); - _codec = avcodec_find_decoder( _inputStream->getVideoDesc().getVideoCodecId() ); + _codec = avcodec_find_decoder( _inputStream->getVideoDesc().getCodecId() ); if( _codec == NULL ) { throw std::runtime_error( "codec not supported" ); diff --git a/src/AvTranscoder/EssenceStream/OutputAudio.cpp b/src/AvTranscoder/EssenceStream/OutputAudio.cpp index b5dceacd..bcc3a726 100644 --- a/src/AvTranscoder/EssenceStream/OutputAudio.cpp +++ b/src/AvTranscoder/EssenceStream/OutputAudio.cpp @@ -176,23 +176,23 @@ bool OutputAudio::encodeFrame( DataStream& codedFrame ) #endif } -void OutputAudio::setProfile( Profile::ProfileDesc& desc, const AudioFrameDesc& frameDesc ) +void OutputAudio::setProfile( const Profile::ProfileDesc& desc, const AudioFrameDesc& frameDesc ) { if( ! desc.count( Profile::avProfileCodec ) || ! desc.count( Profile::avProfileSampleFormat ) || ! desc.count( Profile::avProfileSampleRate ) || ! desc.count( Profile::avProfileChannel ) ) { - throw std::runtime_error( "The profile " + desc[ Profile::avProfileIdentificatorHuman ] + " is invalid." ); + throw std::runtime_error( "The profile " + desc.find( Profile::avProfileIdentificatorHuman )->second + " is invalid." ); } - _audioDesc.setAudioCodec( desc[ Profile::avProfileCodec ] ); + _audioDesc.setCodec( desc.find( Profile::avProfileCodec )->second ); - size_t sample_rate = std::strtoul( desc[ Profile::avProfileSampleRate ].c_str(), NULL, 0 ); - size_t channels = std::strtoul( desc[ Profile::avProfileChannel ].c_str(), NULL, 0 ); - _audioDesc.setAudioParameters( sample_rate, channels, av_get_sample_fmt( desc[ Profile::avProfileSampleFormat ].c_str() ) ); + size_t sample_rate = std::strtoul( desc.find( Profile::avProfileSampleRate )->second.c_str(), NULL, 0 ); + size_t channels = std::strtoul( desc.find( Profile::avProfileChannel )->second.c_str(), NULL, 0 ); + _audioDesc.setAudioParameters( sample_rate, channels, av_get_sample_fmt( desc.find( Profile::avProfileSampleFormat )->second.c_str() ) ); - for( Profile::ProfileDesc::iterator it = desc.begin(); it != desc.end(); ++it ) + for( Profile::ProfileDesc::const_iterator it = desc.begin(); it != desc.end(); ++it ) { if( (*it).first == Profile::avProfileIdentificator || (*it).first == Profile::avProfileIdentificatorHuman || @@ -215,7 +215,7 @@ void OutputAudio::setProfile( Profile::ProfileDesc& desc, const AudioFrameDesc& setup(); - for( Profile::ProfileDesc::iterator it = desc.begin(); it != desc.end(); ++it ) + for( Profile::ProfileDesc::const_iterator it = desc.begin(); it != desc.end(); ++it ) { if( (*it).first == Profile::avProfileIdentificator || (*it).first == Profile::avProfileIdentificatorHuman || diff --git a/src/AvTranscoder/EssenceStream/OutputAudio.hpp b/src/AvTranscoder/EssenceStream/OutputAudio.hpp index aace4a58..4b3a4369 100644 --- a/src/AvTranscoder/EssenceStream/OutputAudio.hpp +++ b/src/AvTranscoder/EssenceStream/OutputAudio.hpp @@ -29,7 +29,7 @@ class OutputAudio : public OutputEssence */ bool encodeFrame( DataStream& codedFrame ); - void setProfile( Profile::ProfileDesc& desc, const AudioFrameDesc& frameDesc ); + void setProfile( const Profile::ProfileDesc& desc, const AudioFrameDesc& frameDesc ); AudioDesc& getAudioDesc() { return _audioDesc; } diff --git a/src/AvTranscoder/EssenceStream/OutputVideo.cpp b/src/AvTranscoder/EssenceStream/OutputVideo.cpp index 2c6b8397..5817408e 100644 --- a/src/AvTranscoder/EssenceStream/OutputVideo.cpp +++ b/src/AvTranscoder/EssenceStream/OutputVideo.cpp @@ -186,23 +186,23 @@ bool OutputVideo::encodeFrame( DataStream& codedFrame ) #endif } -void OutputVideo::setProfile( Profile::ProfileDesc& desc, const avtranscoder::ImageDesc& imageDesc ) +void OutputVideo::setProfile( const Profile::ProfileDesc& desc, const avtranscoder::ImageDesc& imageDesc ) { if( ! desc.count( Profile::avProfileCodec ) || ! desc.count( Profile::avProfilePixelFormat ) || ! desc.count( Profile::avProfileFrameRate ) ) { - throw std::runtime_error( "The profile " + desc[ Profile::avProfileIdentificatorHuman ] + " is invalid." ); + throw std::runtime_error( "The profile " + desc.find( Profile::avProfileIdentificatorHuman )->second + " is invalid." ); } - _videoDesc.setVideoCodec( desc[ Profile::avProfileCodec ] ); + _videoDesc.setCodec( desc.find( Profile::avProfileCodec )->second ); - const size_t frameRate = std::strtoul( desc[ Profile::avProfileFrameRate ].c_str(), NULL, 0 ); + const size_t frameRate = std::strtoul( desc.find( Profile::avProfileFrameRate )->second.c_str(), NULL, 0 ); _videoDesc.setTimeBase( 1, frameRate ); _videoDesc.setImageParameters( imageDesc ); - for( Profile::ProfileDesc::iterator it = desc.begin(); it != desc.end(); ++it ) + for( Profile::ProfileDesc::const_iterator it = desc.begin(); it != desc.end(); ++it ) { if( (*it).first == Profile::avProfileIdentificator || (*it).first == Profile::avProfileIdentificatorHuman || @@ -224,7 +224,7 @@ void OutputVideo::setProfile( Profile::ProfileDesc& desc, const avtranscoder::Im setup(); - for( Profile::ProfileDesc::iterator it = desc.begin(); it != desc.end(); ++it ) + for( Profile::ProfileDesc::const_iterator it = desc.begin(); it != desc.end(); ++it ) { if( (*it).first == Profile::avProfileIdentificator || (*it).first == Profile::avProfileIdentificatorHuman || diff --git a/src/AvTranscoder/EssenceStream/OutputVideo.hpp b/src/AvTranscoder/EssenceStream/OutputVideo.hpp index b7509088..c40add0c 100644 --- a/src/AvTranscoder/EssenceStream/OutputVideo.hpp +++ b/src/AvTranscoder/EssenceStream/OutputVideo.hpp @@ -44,7 +44,7 @@ class AvExport OutputVideo : public OutputEssence */ bool encodeFrame( DataStream& codedFrame ); - void setProfile( Profile::ProfileDesc& desc, const avtranscoder::ImageDesc& imageDesc ); + void setProfile( const Profile::ProfileDesc& desc, const avtranscoder::ImageDesc& imageDesc ); VideoDesc& getVideoDesc() { return _videoDesc; } diff --git a/src/AvTranscoder/Transcoder/StreamTranscoder.cpp b/src/AvTranscoder/Transcoder/StreamTranscoder.cpp index 8b035455..34c6d70a 100644 --- a/src/AvTranscoder/Transcoder/StreamTranscoder.cpp +++ b/src/AvTranscoder/Transcoder/StreamTranscoder.cpp @@ -50,7 +50,7 @@ StreamTranscoder::StreamTranscoder( StreamTranscoder::StreamTranscoder( InputStream& inputStream, OutputFile& outputFile, - Profile::ProfileDesc& profile, + const Profile::ProfileDesc& profile, const int subStreamIndex ) : _inputStream( &inputStream ) @@ -78,7 +78,7 @@ StreamTranscoder::StreamTranscoder( ImageDesc outputImageDesc = _inputStream->getVideoDesc().getImageDesc(); - outputImageDesc.setPixel( Pixel( profile[ Profile::avProfilePixelFormat ].c_str() ) ); + outputImageDesc.setPixel( Pixel( profile.find( Profile::avProfilePixelFormat )->second.c_str() ) ); outputVideo->setProfile( profile, outputImageDesc ); @@ -129,7 +129,7 @@ StreamTranscoder::StreamTranscoder( StreamTranscoder::StreamTranscoder( InputEssence& inputEssence, OutputFile& outputFile, - Profile::ProfileDesc& profile + const Profile::ProfileDesc& profile ) : _inputStream( NULL ) , _outputStream( NULL ) @@ -151,8 +151,8 @@ StreamTranscoder::StreamTranscoder( OutputAudio* outputAudio = new OutputAudio(); _outputEssence = outputAudio; - AudioFrameDesc srcAudioFrameDesc; // @todo better solution ? - outputAudio->setProfile( profile, srcAudioFrameDesc ); + AudioFrameDesc inputAudioFrameDesc = static_cast( _inputEssence )->getAudioDesc().getFrameDesc(); + outputAudio->setProfile( profile, inputAudioFrameDesc ); static_cast( _inputEssence )->setAudioDesc( outputAudio->getAudioDesc() ); diff --git a/src/AvTranscoder/Transcoder/StreamTranscoder.hpp b/src/AvTranscoder/Transcoder/StreamTranscoder.hpp index 74246c15..74858576 100644 --- a/src/AvTranscoder/Transcoder/StreamTranscoder.hpp +++ b/src/AvTranscoder/Transcoder/StreamTranscoder.hpp @@ -29,12 +29,12 @@ class StreamTranscoder /** * @brief transcode stream **/ - StreamTranscoder( InputStream& inputStream, OutputFile& outputFile, Profile::ProfileDesc& profile, const int subStreamIndex = -1 ); + StreamTranscoder( InputStream& inputStream, OutputFile& outputFile, const Profile::ProfileDesc& profile, const int subStreamIndex = -1 ); /** * @brief encode from dummy stream **/ - StreamTranscoder( InputEssence& inputEssence, OutputFile& outputFile, Profile::ProfileDesc& profile ); + StreamTranscoder( InputEssence& inputEssence, OutputFile& outputFile, const Profile::ProfileDesc& profile ); ~StreamTranscoder(); diff --git a/src/AvTranscoder/Transcoder/Transcoder.cpp b/src/AvTranscoder/Transcoder/Transcoder.cpp index 51269f21..47588fbd 100644 --- a/src/AvTranscoder/Transcoder/Transcoder.cpp +++ b/src/AvTranscoder/Transcoder/Transcoder.cpp @@ -24,14 +24,14 @@ Transcoder::~Transcoder() { delete (*it); } - // for( std::vector< DummyAudio* >::iterator it = _dummyAudio.begin(); it != _dummyAudio.end(); ++it ) - // { - // delete (*it); - // } - // for( std::vector< DummyVideo* >::iterator it = _dummyVideo.begin(); it != _dummyVideo.end(); ++it ) - // { - // delete (*it); - // } + for( std::vector< DummyAudio* >::iterator it = _dummyAudio.begin(); it != _dummyAudio.end(); ++it ) + { + delete (*it); + } + for( std::vector< DummyVideo* >::iterator it = _dummyVideo.begin(); it != _dummyVideo.end(); ++it ) + { + delete (*it); + } } void Transcoder::add( const std::string& filename, const size_t streamIndex, const std::string& profileName ) @@ -54,8 +54,7 @@ void Transcoder::add( const std::string& filename, const size_t streamIndex, Pro if( ! filename.length() ) { if( _verbose ) - std::cout << "add encoding stream for dummy input" << std::endl; - addDummyStream( profileDesc ); + std::cerr << "can't add a stream with no filename indicated" << std::endl; return; } @@ -64,6 +63,22 @@ void Transcoder::add( const std::string& filename, const size_t streamIndex, Pro addTranscodeStream( filename, streamIndex, profileDesc ); } +void Transcoder::add( const std::string& filename, const size_t streamIndex, Profile::ProfileDesc& profileDesc, EssenceDesc& essenceDesc ) +{ + _profile.update( profileDesc ); + if( ! filename.length() ) + { + if( _verbose ) + std::cout << "add dummy stream" << std::endl; + addDummyStream( profileDesc, essenceDesc ); + return; + } + + if( _verbose ) + std::cout << "add transcoding stream" << std::endl; + addTranscodeStream( filename, streamIndex, profileDesc ); +} + void Transcoder::add( const std::string& filename, const size_t streamIndex, const int subStreamIndex, const std::string& profileName ) { if( subStreamIndex < 0 ) @@ -87,18 +102,41 @@ void Transcoder::add( const std::string& filename, const size_t streamIndex, con void Transcoder::add( const std::string& filename, const size_t streamIndex, const int subStreamIndex, Profile::ProfileDesc& profileDesc ) { + _profile.update( profileDesc ); + if( subStreamIndex < 0 ) { add( filename, streamIndex, profileDesc ); return; } + + if( ! filename.length() ) + { + if( _verbose ) + std::cerr << "can't add a stream with no filename indicated" << std::endl; + return; + } + + if( _verbose ) + std::cout << "add transcoding stream for substream " << subStreamIndex << std::endl; + addTranscodeStream( filename, streamIndex, subStreamIndex, profileDesc ); +} +void Transcoder::add( const std::string& filename, const size_t streamIndex, const int subStreamIndex, Profile::ProfileDesc& profileDesc, EssenceDesc& essenceDesc ) +{ _profile.update( profileDesc ); + + if( subStreamIndex < 0 ) + { + add( filename, streamIndex, profileDesc ); + return; + } + if( ! filename.length() ) { if( _verbose ) - std::cout << "add encoding stream for dummy input" << std::endl; - addDummyStream( profileDesc ); + std::cout << "add dummy stream" << std::endl; + addDummyStream( profileDesc, essenceDesc ); return; } @@ -253,7 +291,7 @@ void Transcoder::addTranscodeStream( const std::string& filename, const size_t s } } -void Transcoder::addDummyStream( Profile::ProfileDesc& profile ) +void Transcoder::addDummyStream( const Profile::ProfileDesc& profile, const EssenceDesc& essenceDesc ) { if( ! profile.count( Profile::avProfileType ) ) throw std::runtime_error( "unable to found stream type (audio, video, etc.)" ); @@ -261,12 +299,16 @@ void Transcoder::addDummyStream( Profile::ProfileDesc& profile ) if( profile.find( Profile::avProfileType )->second == Profile::avProfileTypeAudio ) { _dummyAudio.push_back( new DummyAudio() ); + _dummyAudio.back()->setAudioDesc( static_cast( essenceDesc ) ); + _streamTranscoders.push_back( new StreamTranscoder( *_dummyAudio.back(), _outputFile, profile ) ); } if( profile.find( Profile::avProfileType )->second == Profile::avProfileTypeVideo ) { _dummyVideo.push_back( new DummyVideo() ); + _dummyVideo.back()->setVideoDesc( static_cast( essenceDesc ) ); + _streamTranscoders.push_back( new StreamTranscoder( *_dummyVideo.back(), _outputFile, profile ) ); } } diff --git a/src/AvTranscoder/Transcoder/Transcoder.hpp b/src/AvTranscoder/Transcoder/Transcoder.hpp index 4aa790bc..d5f8d05c 100644 --- a/src/AvTranscoder/Transcoder/Transcoder.hpp +++ b/src/AvTranscoder/Transcoder/Transcoder.hpp @@ -27,7 +27,7 @@ class Transcoder /** * @brief Add a stream and set a profile - * @note If profile is empty, add a dummy stream. + * @note If profileName is empty, rewrap. */ void add( const std::string& filename, const size_t streamIndex, const std::string& profileName = "" ); @@ -36,21 +36,33 @@ class Transcoder * @note Profile will be updated, be sure to pass unique profile name. */ void add( const std::string& filename, const size_t streamIndex, Profile::ProfileDesc& profileDesc ); - + /* + * @note If filename is empty, add a dummy stream. + */ + void add( const std::string& filename, const size_t streamIndex, Profile::ProfileDesc& profileDesc, EssenceDesc& essenceDesc ); + /** * @brief Add a stream and set a profile - * @note If profile is empty, add a dummy stream. - * @note If subStreamIndex is negative, no substream a selected it's the stream. + * @note If profileName is empty, rewrap. + * @note If subStreamIndex is negative, no substream is selected it's the stream. */ void add( const std::string& filename, const size_t streamIndex, const int subStreamIndex, const std::string& profileName = "" ); /** * @brief Add a stream and set a custom profile * @note Profile will be updated, be sure to pass unique profile name. - * @note If subStreamIndex is negative, no substream a selected it's the stream. + * @note If subStreamIndex is negative, no substream is selected it's the stream. */ void add( const std::string& filename, const size_t streamIndex, const int subStreamIndex, Profile::ProfileDesc& profileDesc ); + /** + * @note If filename is empty, add a dummy stream. + */ + void add( const std::string& filename, const size_t streamIndex, const int subStreamIndex, Profile::ProfileDesc& profileDesc, EssenceDesc& essenceDesc ); + /** + * @brief Add the stream + * @note The stream will be deleted in Transcoder's destructor. + */ void add( StreamTranscoder& stream ); bool processFrame(); @@ -67,7 +79,7 @@ class Transcoder void addTranscodeStream( const std::string& filename, const size_t streamIndex, const size_t subStreamIndex, Profile::ProfileDesc& profile ); - void addDummyStream( Profile::ProfileDesc& profile ); + void addDummyStream( const Profile::ProfileDesc& profile, const EssenceDesc& essenceDesc ); InputFile* addInputFile( const std::string& filename, const size_t streamIndex ); diff --git a/src/AvTranscoder/avTranscoder.i b/src/AvTranscoder/avTranscoder.i index ccf6e5a1..04715345 100644 --- a/src/AvTranscoder/avTranscoder.i +++ b/src/AvTranscoder/avTranscoder.i @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -67,6 +68,7 @@ namespace std { %include %include %include +%include %include %include %include pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy