diff --git a/src/AvTranscoder/CodedStructures/CodedDesc.cpp b/src/AvTranscoder/CodedStructures/CodedDesc.cpp index 1f132282..6e369f07 100644 --- a/src/AvTranscoder/CodedStructures/CodedDesc.cpp +++ b/src/AvTranscoder/CodedStructures/CodedDesc.cpp @@ -57,18 +57,18 @@ void CodedDesc::initCodecContext( ) { if( m_codec == NULL ) { - throw std::runtime_error( "unknown audio codec" ); + throw std::runtime_error( "unknown codec" ); } if( ( m_codecContext = avcodec_alloc_context3( m_codec ) ) == NULL ) { - throw std::runtime_error( "unable to create context for audio context" ); + throw std::runtime_error( "unable to create context for 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" ); + throw std::runtime_error( "unable to find codec default values" ); } } diff --git a/src/AvTranscoder/EssenceTransform/VideoEssenceTransform.cpp b/src/AvTranscoder/EssenceTransform/VideoEssenceTransform.cpp index 6e23bf3f..683c5ab1 100644 --- a/src/AvTranscoder/EssenceTransform/VideoEssenceTransform.cpp +++ b/src/AvTranscoder/EssenceTransform/VideoEssenceTransform.cpp @@ -34,6 +34,7 @@ VideoEssenceTransform::VideoEssenceTransform() , _srcOffsets ( MAX_SWS_PLANE, 0 ) , _dstOffsets ( MAX_SWS_PLANE, 0 ) , _isInit ( false ) + , _verbose( false ) { } @@ -60,6 +61,34 @@ bool VideoEssenceTransform::init( const Frame& srcFrame, const Frame& dstFrame ) av_image_fill_linesizes( &_srcLineSize[0], src.desc().getPixelDesc().findPixel(), src.desc().getWidth() ); av_image_fill_linesizes( &_dstLineSize[0], dst.desc().getPixelDesc().findPixel(), dst.desc().getWidth() ); + if( _verbose ) + { + std::clog << "video conversion from "; + const char* pixFmt; + pixFmt = av_get_pix_fmt_name( src.desc().getPixelDesc().findPixel() ); + std::clog << ( pixFmt != NULL ? pixFmt : "None" ) << " to "; + pixFmt = av_get_pix_fmt_name( dst.desc().getPixelDesc().findPixel() ); + std::clog << ( pixFmt != NULL ? pixFmt : "None" ) << std::endl; + + std::clog << "source, width = " << src.desc().getWidth() << std::endl; + std::clog << "source, height = " << src.desc().getHeight() << std::endl; + + std::clog << "source, lineSize:" << std::endl; + std::clog << "[0] = " << _srcLineSize[0] << std::endl; + std::clog << "[1] = " << _srcLineSize[1] << std::endl; + std::clog << "[2] = " << _srcLineSize[2] << std::endl; + std::clog << "[3] = " << _srcLineSize[3] << std::endl; + + std::clog << "destination, width = " << dst.desc().getWidth() << std::endl; + std::clog << "destination, height = " << dst.desc().getHeight() << std::endl; + + std::clog << "destination, lineSize:" << std::endl; + std::clog << "[0] = " << _dstLineSize[0] << std::endl; + std::clog << "[1] = " << _dstLineSize[1] << std::endl; + std::clog << "[2] = " << _dstLineSize[2] << std::endl; + std::clog << "[3] = " << _dstLineSize[3] << std::endl; + } + size_t cumulSrcOffset = 0; size_t cumulDstOffset = 0; @@ -108,6 +137,33 @@ void VideoEssenceTransform::convert( const Frame& srcFrame, Frame& dstFrame ) throw std::runtime_error( "unknown color convert context" ); } + if( _verbose ) + { + std::clog << "source, offset:" << std::endl; + std::clog << "[0] = " << &_srcOffsets[0] << std::endl; + std::clog << "[1] = " << &_srcOffsets[1] << std::endl; + std::clog << "[2] = " << &_srcOffsets[2] << std::endl; + std::clog << "[3] = " << &_srcOffsets[3] << std::endl; + + std::clog << "source, slice:" << std::endl; + std::clog << "[0] = " << &_srcData[0] << std::endl; + std::clog << "[1] = " << &_srcData[1] << std::endl; + std::clog << "[2] = " << &_srcData[2] << std::endl; + std::clog << "[3] = " << &_srcData[3] << std::endl; + + std::clog << "destination, offset:" << std::endl; + std::clog << "[0] = " << &_dstOffsets[0] << std::endl; + std::clog << "[1] = " << &_dstOffsets[1] << std::endl; + std::clog << "[2] = " << &_dstOffsets[2] << std::endl; + std::clog << "[3] = " << &_dstOffsets[3] << std::endl; + + std::clog << "destination, slice:" << std::endl; + std::clog << "[0] = " << &_dstData[0] << std::endl; + std::clog << "[1] = " << &_dstData[1] << std::endl; + std::clog << "[2] = " << &_dstData[2] << std::endl; + std::clog << "[3] = " << &_dstData[3] << std::endl; + } + int ret = sws_scale( _imageConvertContext, &_srcData[0], &_srcLineSize[0], 0, src.desc().getHeight(), &_dstData[0], &_dstLineSize[0] ); diff --git a/src/AvTranscoder/EssenceTransform/VideoEssenceTransform.hpp b/src/AvTranscoder/EssenceTransform/VideoEssenceTransform.hpp index d56ab161..08f00c85 100644 --- a/src/AvTranscoder/EssenceTransform/VideoEssenceTransform.hpp +++ b/src/AvTranscoder/EssenceTransform/VideoEssenceTransform.hpp @@ -19,6 +19,8 @@ class AvExport VideoEssenceTransform : public EssenceTransform void convert( const Frame& srcFrame, Frame& dstFrame ); + void setVerbose( bool verbose = false ){ _verbose = verbose; } + private: bool init( const Frame& srcFrame, const Frame& dstFrame ); @@ -32,6 +34,8 @@ class AvExport VideoEssenceTransform : public EssenceTransform std::vector _dstOffsets; bool _isInit; + + bool _verbose; }; }