Skip to content

Commit 137e3c9

Browse files
Merge pull request #40 from cchampet/dev_verbose2
VideoEssenceTransform: add verbose
2 parents f784304 + ac46b1d commit 137e3c9

File tree

3 files changed

+63
-3
lines changed

3 files changed

+63
-3
lines changed

src/AvTranscoder/CodedStructures/CodedDesc.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,18 @@ void CodedDesc::initCodecContext( )
5757
{
5858
if( m_codec == NULL )
5959
{
60-
throw std::runtime_error( "unknown audio codec" );
60+
throw std::runtime_error( "unknown codec" );
6161
}
6262

6363
if( ( m_codecContext = avcodec_alloc_context3( m_codec ) ) == NULL )
6464
{
65-
throw std::runtime_error( "unable to create context for audio context" );
65+
throw std::runtime_error( "unable to create context for context" );
6666
}
6767

6868
// Set default codec parameters
6969
if( avcodec_get_context_defaults3( m_codecContext, m_codec ) != 0 )
7070
{
71-
throw std::runtime_error( "unable to find audio codec default values" );
71+
throw std::runtime_error( "unable to find codec default values" );
7272
}
7373
}
7474

src/AvTranscoder/EssenceTransform/VideoEssenceTransform.cpp

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ VideoEssenceTransform::VideoEssenceTransform()
3434
, _srcOffsets ( MAX_SWS_PLANE, 0 )
3535
, _dstOffsets ( MAX_SWS_PLANE, 0 )
3636
, _isInit ( false )
37+
, _verbose( false )
3738
{
3839
}
3940

@@ -60,6 +61,34 @@ bool VideoEssenceTransform::init( const Frame& srcFrame, const Frame& dstFrame )
6061
av_image_fill_linesizes( &_srcLineSize[0], src.desc().getPixelDesc().findPixel(), src.desc().getWidth() );
6162
av_image_fill_linesizes( &_dstLineSize[0], dst.desc().getPixelDesc().findPixel(), dst.desc().getWidth() );
6263

64+
if( _verbose )
65+
{
66+
std::clog << "video conversion from ";
67+
const char* pixFmt;
68+
pixFmt = av_get_pix_fmt_name( src.desc().getPixelDesc().findPixel() );
69+
std::clog << ( pixFmt != NULL ? pixFmt : "None" ) << " to ";
70+
pixFmt = av_get_pix_fmt_name( dst.desc().getPixelDesc().findPixel() );
71+
std::clog << ( pixFmt != NULL ? pixFmt : "None" ) << std::endl;
72+
73+
std::clog << "source, width = " << src.desc().getWidth() << std::endl;
74+
std::clog << "source, height = " << src.desc().getHeight() << std::endl;
75+
76+
std::clog << "source, lineSize:" << std::endl;
77+
std::clog << "[0] = " << _srcLineSize[0] << std::endl;
78+
std::clog << "[1] = " << _srcLineSize[1] << std::endl;
79+
std::clog << "[2] = " << _srcLineSize[2] << std::endl;
80+
std::clog << "[3] = " << _srcLineSize[3] << std::endl;
81+
82+
std::clog << "destination, width = " << dst.desc().getWidth() << std::endl;
83+
std::clog << "destination, height = " << dst.desc().getHeight() << std::endl;
84+
85+
std::clog << "destination, lineSize:" << std::endl;
86+
std::clog << "[0] = " << _dstLineSize[0] << std::endl;
87+
std::clog << "[1] = " << _dstLineSize[1] << std::endl;
88+
std::clog << "[2] = " << _dstLineSize[2] << std::endl;
89+
std::clog << "[3] = " << _dstLineSize[3] << std::endl;
90+
}
91+
6392
size_t cumulSrcOffset = 0;
6493
size_t cumulDstOffset = 0;
6594

@@ -108,6 +137,33 @@ void VideoEssenceTransform::convert( const Frame& srcFrame, Frame& dstFrame )
108137
throw std::runtime_error( "unknown color convert context" );
109138
}
110139

140+
if( _verbose )
141+
{
142+
std::clog << "source, offset:" << std::endl;
143+
std::clog << "[0] = " << &_srcOffsets[0] << std::endl;
144+
std::clog << "[1] = " << &_srcOffsets[1] << std::endl;
145+
std::clog << "[2] = " << &_srcOffsets[2] << std::endl;
146+
std::clog << "[3] = " << &_srcOffsets[3] << std::endl;
147+
148+
std::clog << "source, slice:" << std::endl;
149+
std::clog << "[0] = " << &_srcData[0] << std::endl;
150+
std::clog << "[1] = " << &_srcData[1] << std::endl;
151+
std::clog << "[2] = " << &_srcData[2] << std::endl;
152+
std::clog << "[3] = " << &_srcData[3] << std::endl;
153+
154+
std::clog << "destination, offset:" << std::endl;
155+
std::clog << "[0] = " << &_dstOffsets[0] << std::endl;
156+
std::clog << "[1] = " << &_dstOffsets[1] << std::endl;
157+
std::clog << "[2] = " << &_dstOffsets[2] << std::endl;
158+
std::clog << "[3] = " << &_dstOffsets[3] << std::endl;
159+
160+
std::clog << "destination, slice:" << std::endl;
161+
std::clog << "[0] = " << &_dstData[0] << std::endl;
162+
std::clog << "[1] = " << &_dstData[1] << std::endl;
163+
std::clog << "[2] = " << &_dstData[2] << std::endl;
164+
std::clog << "[3] = " << &_dstData[3] << std::endl;
165+
}
166+
111167
int ret = sws_scale( _imageConvertContext,
112168
&_srcData[0], &_srcLineSize[0], 0, src.desc().getHeight(),
113169
&_dstData[0], &_dstLineSize[0] );

src/AvTranscoder/EssenceTransform/VideoEssenceTransform.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class AvExport VideoEssenceTransform : public EssenceTransform
1919

2020
void convert( const Frame& srcFrame, Frame& dstFrame );
2121

22+
void setVerbose( bool verbose = false ){ _verbose = verbose; }
23+
2224
private:
2325
bool init( const Frame& srcFrame, const Frame& dstFrame );
2426

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

3436
bool _isInit;
37+
38+
bool _verbose;
3539
};
3640

3741
}

0 commit comments

Comments
 (0)