Skip to content

VideoEssenceTransform: add verbose #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 5, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/AvTranscoder/CodedStructures/CodedDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" );
}
}

Expand Down
56 changes: 56 additions & 0 deletions src/AvTranscoder/EssenceTransform/VideoEssenceTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ VideoEssenceTransform::VideoEssenceTransform()
, _srcOffsets ( MAX_SWS_PLANE, 0 )
, _dstOffsets ( MAX_SWS_PLANE, 0 )
, _isInit ( false )
, _verbose( false )
{
}

Expand All @@ -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;

Expand Down Expand Up @@ -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] );
Expand Down
4 changes: 4 additions & 0 deletions src/AvTranscoder/EssenceTransform/VideoEssenceTransform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand All @@ -32,6 +34,8 @@ class AvExport VideoEssenceTransform : public EssenceTransform
std::vector<size_t> _dstOffsets;

bool _isInit;

bool _verbose;
};

}
Expand Down