Hi all,
I'm using latest libavcodec (updated 10 dec. 2009) on iPhone, but I've some
problems using decoder.
This is code that I use:
decoder initialization:
-(void) decoderInit
{
av_register_all();
int iCodecID = CODEC_ID_H263;
m_codec = avcodec_find_decoder((enum CodecID)iCodecID);
if (m_codec == NULL) return;
m_c = avcodec_alloc_context();
avcodec_get_context_defaults(m_c);
m_c->codec_id = CODEC_ID_H263;
m_c->codec_type = CODEC_TYPE_VIDEO;
m_c->strict_std_compliance = 0;
m_c->width = 176;
m_c->height = 144;
m_c->gop_size = 12;
m_c->pix_fmt = PIX_FMT_YUVJ420P;
avcodec_get_frame_defaults(&m_picture);
if (avcodec_open(m_c, m_codec) < 0) return;
m_pFrameRGB=avcodec_alloc_frame();
if(m_pFrameRGB==NULL) return;
int numBytes=avpicture_get_size(PIX_FMT_RGBA, m_c->width, m_c->height);
m_buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));
avpicture_fill((AVPicture *)m_pFrameRGB, m_buffer, PIX_FMT_RGBA,
m_c->width,
m_c->height);
av_init_packet(&avpkt);
NSLog(@"LIBAVCODEC Init: OK");
}
and to decode frames:
int ret = avcodec_decode_video2(m_c, &m_picture, &m_got_picture, &avpkt);
m_picture return not corrects decoded frames.
I've verified that source frames are corrects, so I think I've miss something
during init procedure.
Can someone help me. Thanks.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user