Hi,
I've a problem using CODEC_ID_WMV3 decode. On avcodec_open it fail. I can't
understand why. I use below function for other codec and work.
Thanks
Stefano
int CFFDecode::Init(int codec_id, int width, int height, int fps)
{
if ((width & 1) == 1) return E_INVALIDARG;
if ((height & 1) == 1) return E_INVALIDARG;
strcpy_s(m_fileNamePic, pFileNameThumbBmp);
DbgOut(m_fileNamePic);
m_codec = avcodec_find_decoder((CodecID)codec_id);
if (m_codec == NULL) {DbgOut("FFINIT OK");return E_FAIL;}
m_c = avcodec_alloc_context();
if (m_c == NULL) {DbgOut("avcodec_alloc_context error");return
E_OUTOFMEMORY;}
avcodec_get_context_defaults2(m_c, CODEC_TYPE_VIDEO);
avcodec_get_frame_defaults(&m_picture);
m_c->codec_id = (CodecID) codec_id;
m_c->codec_type = CODEC_TYPE_VIDEO;
m_c->strict_std_compliance = 0;
/* put sample parameters */
//m_c->bit_rate = bitrate;
/* resolution must be a multiple of two */
m_c->width = width;
m_c->height = height;
/* time base: this is the fundamental unit of time (in seconds) in
terms
of which frame timestamps are represented. for fixed-fps content,
timebase should be 1/framerate and timestamp increments should be
identically 1. */
m_c->time_base.den = fps;
m_c->time_base.num = 1;
m_c->gop_size = 12; /* emit one intra frame every twelve frames at
most */
m_c->pix_fmt = PIX_FMT_BGR24;
int iRetOpen = avcodec_open(m_c, m_codec);
if ( iRetOpen < 0) {
DbgOutInt("avcodec_open error:",iRetOpen);
return E_FAIL;
}
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user