[Ffmpeg-devel] Re: Visual studio .net problem

Scott Field sfield
Fri Oct 14 21:45:30 CEST 2005


Ian McIntosh <ianm <at> cat.co.za> writes:

> > Hey everyone,
> >
> > I just wanted to join because I have the same exact problem.  I can link
> and
> > execute, but when it comes to avcodec_find_encoder or avcodec_find_decoder
> they
> > return NULL.
> >
> > If anyone has made any finding I would love to hear them.
> >
> >     I am working with:
> >
> > Visual Studio .NET 7.1.3088
> > Windows XP Pro SP2
> > minGW 3.2.3
> >
> > FFMPEG.exe Info:
> > ffmpeg version CVS, build 3276800, Copyright (c) 2000-2004 Fabrice Bellard
> >   configuration:  --enable-memalign-hack --enable-mingw32 --enable-mp3lame
> > --extra-cflags=-I/local/include --extra-ldflags=-L/local/lib
> >   built on Oct  4 2005 13:54:56, gcc: 3.2.3 (mingw special 20030504-1)
> >
> > ./configure settings for libraries:
> > --enable-memalign-hack --enable-mingw32 --enable-mp3lame --enable-shared
> > --extra-cflags=-I/local/include --extra-ldflags=-L/local/lib
> >
> > Scott
> >
> 
> Hi
> 
> On the 3rd of october Ahmad Zaidee bin Abu sent a mail (subject: Problem
> with returned AVCodecContext)
> that hinted at a possible solution to this problem.
> 
> Here's the gist of what was said (thats relevant, I think):
> "
> // Register all formats and codecs
> 
> av_register_all();
> 
> avcodec_init();
> 
> avcodec_register_all();
> 
> (have to do avcodec_init & avcodec_register_all, otherwise codec not found)
> "
> 
> Possibly try this out and see if it resolves your problem. If so, then maybe
> this
> is a bug with the Windows implementation??
> 
> Ian
> 
> (new to ffmpeg)
> 

Ian,

Thanks for the suggestion.  I did a lot of av_log likes like Michael suggested
and this is what I discovered.  This all has something to do with the variables
declared as 'extern', i.e. first_avcodec, first_oformat, first_iformat, ...  The
avformat.dll is referencing a different version of the extern variables then my
application.  The reason that a call to avcodec_find_decoder returns NULL is
because there is no codec list in the first_avcodec variable.  The call to
av_register_all() initializes the extern variables for itself.  By your
suggestion, avcodec_init() and avcodec_register_all() initialize the codec list
for my application.  

So by adding those function calls fixes one problem but not all of them.  Now if
 my application calls a function that references first_oformat through the
avcodec.dll, again the refernce is not initialized.

I am new to compiling with minGW so I am not sure how to resolve the issue of
getting everything to properly reference the same instance of the 'extern'
variables.

Scott






More information about the ffmpeg-devel mailing list