[Ffmpeg-devel] Problem with returned AVCodecContext
Martin Boehme
boehme
Tue Oct 4 10:55:47 CEST 2005
Ahmad Zaidee bin Abu wrote:
> I'm quite beginner with ffmpeg. I have some problems with AVCodecContext.
>
> I'm using C++ .Net with libavcodec/libavformat CVS 09/29/05.
>
> In main() i do
[snip]
> AVCodecContext *CodecContext; //=NULL;
>
> AVFrame *Picture;
>
> CreateH263Decoder(CodecContext, Picture);
>
> ...
>
> I used 3 functions as below:
>
> int CreateH263Decoder(AVCodecContext *c, AVFrame *picture)
> {
> AVCodec *codec;
> /* find the h263 video decoder */
> codec = avcodec_find_decoder(CODEC_ID_H263);
> if (!codec) {
> // Codec NOT Found
> return H263_NOT_FOUND; //my own error / success detection macro
> }
>
> c = avcodec_alloc_context();
[snip]
> return H263_OK; // return ok if successful.
> }
[snip]
> When I call CreateH263Decoder, AVCodecContext reurn NULL (0). When i trace inside the function,
> the value of "c" before return H263_OK; are as expected, but value of "CodecContext" in main are not as I expected.
> What could be the problem? Did I miss anything.
This is a C problem. You need to use double pointers, i.e.
int CreateH263Decoder(AVCodecContext **c, AVFrame **picture);
otherwise, the values that you assign to "c" and "picture" inside the
function won't get returned up.
HTH
Martin
--
Martin B?hme
Inst. f. Neuro- and Bioinformatics
Ratzeburger Allee 160, D-23538 Luebeck
Phone: +49 451 500 5514
Fax: +49 451 500 5502
boehme at inb.uni-luebeck.de
More information about the ffmpeg-devel
mailing list