[Ffmpeg-devel] Re: Using avcodec.dll and avformat.dll means thatoutput_example.c would not work?

Lars Blumberg Lars.Blumberg
Thu Dec 8 21:55:27 CET 2005


"Michel Bardiaux" <mbardiaux at mediaxim.be> schrieb im Newsbeitrag 
news:438AD4E2.5090708 at mediaxim.be...
> Lars Blumberg wrote:
>> Hello newsgroup!
>>
>> I am using ffmpeg functionality via the libraries "avcodec.dll" and 
>> "avformat.dll", which  i have built before. To examine how to use both 
>> DLLs (in Delphi) I am translating the example code "output_example.c" 
>> given with the ffmpeg distribution.
>>
>> The first code which is run is "av_register_all" to register all 
>> necessary things. When I have a look into the implementation of this 
>> method, I see that "avcodec_register_all" is called there at first.
>>
>> But as you know, both methods are in different DLLs. That means, that 
>> "av_register_all" cannot call "avcodec_register_all".
>
> Why?

I thougt, that for my needs avformat.dll needs to have access to the methods 
located in avcodec.dll. Otherwise it could not call methods located in 
avcodec.dll.

>
>> When I only call the first function I cannot use any codec. That's why I 
>> have to call "avcodec_register_all" by myself after calling 
>> "av_register_all".
>>
>> output_example.c:
>>
>>
>> int main(int argc, char **argv)
>> {
>>     const char *filename;
>>     AVOutputFormat *fmt;
>>     AVFormatContext *oc;
>>     AVStream *audio_st, *video_st;
>>     double audio_pts, video_pts;
>>     int i;
>>
>>     /* initialize libavcodec, and register all codecs and formats */
>>     av_register_all();
>>
>>     if (argc != 2) {
>>         printf("usage: %s output_file\n"
>>                "API example program to output a media file with 
>> libavformat.\n"
>>                "The output format is automatically guessed according to 
>> the file extension.\n"
>>                "Raw images can also be output by using '%%d' in the 
>> filename\n"
>>                "\n", argv[0]);
>>         exit(1);
>>     }
>> ....
>> <<<<<
>>
>> My Delphi variant:
>> (Don't worry about the data type names, I introduces them to have likely 
>> c++ names)
>>
>>
>> function main(filename: PChar): T_int;
>> var
>>   fmt: PAVOutputFormat;
>>   oc: PAVFormatContext;
>>   audio_st, video_st: PAVStream;
>>   audio_pts, video_pts: T_double;
>>   i: T_int;
>> begin
>> // initialize libavcodec, and register all codecs and formats
>>   av_register_all;
>>   avcodec_register_all;
>> ....
>> <<<<<
>>
>> I now have the fears, that are any problems, too, when using both DLLs. 
>> Because any code assumes, that other code can be called which isn't 
>> located in the same library.
>>
>> Is that right or is that the only thing where I have to be careful. 
>> Thanks for everyone who gives help!
>>
>> Best regards
>>
>> Lars
>
>
> -- 
> Michel Bardiaux
> R&D Director
> T +32 [0] 2 790 29 41
> F +32 [0] 2 790 29 02
> E mailto:mbardiaux at mediaxim.be
>
> Mediaxim NV/SA
> Vorstlaan 191 Boulevard du Souverain
> Brussel 1160 Bruxelles
> http://www.mediaxim.com/ 







More information about the ffmpeg-devel mailing list