Hello,
I have a problem when trying to decode a rawvideo BGR24 format video : my
frame->linesize is always negative, so I can't scale my frame using sws_scale
because it crashes.
Here is the dump_format output :
Duration: 00:00:40.0, start: 0.000000, bitrate: 66360 kb/s
Stream #0.0: Video: rawvideo, bgr24, 384x288 [PAR 0:1 DAR 0:1], 25.00 tb(r)
Here is a bit of code :
void init()
{
...
p_codecCtx = p_formatCtx->streams[ m_videoStream ]->codec;
p_SWSCtx = sws_getContext( p_codecCtx->width, p_codecCtx->height,
p_codecCtx->pix_fmt, p_codecCtx->width,
p_codecCtx->height, PIX_FMT_RGB32, SWS_BICUBIC, NULL, NULL, NULL );
...
p_frame = avcodec_alloc_frame();
p_frameRGB = avcodec_alloc_frame();
m_frameSize = avpicture_get_size( PIX_FMT_RGB32, p_codecCtx->width,
p_codecCtx->height );
...
}
int decodePacket( AVPacket& packet )
{
int frameFinished;
// returns p_frame->linesize < 0
int ret = avcodec_decode_video( p_codecCtx, p_frame, &frameFinished,
packet.data, packet.size );
if ( !frameFinished )
{
// ...
return 0;
}
return ret;
}
void scale()
{
// crashes because p_frame->lineseize < 0
sws_scale( p_SWSCtx, p_frame->data, p_frame->linesize, 0,
p_codecCtx->height,
p_frameRGB->data, p_frameRGB->linesize);
}
I can play videos with others formats with this code without any problem.
Do you have an idea ? What do I do wrong ?
Thanks in advance.
ps : I'm using SVN version, revision 11213.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user