[FFmpeg-user] Which function calls libvorbis.c::oggvorbis_encode_frame()?

James Darnley james.darnley at gmail.com
Sun Feb 19 14:35:05 CET 2012


On 2012-02-19 14:26, Journeyer Jeonghum wrote:
> When I try a command below,
> 
> ffmpeg -i "winlogon.wav" -t 60 -ar 44100 -ab 128k -ac 2 -acodec
> libvorbis winlogon.ogg
> 
> I can see that oggvorbis_encode_frame() in libvorbis.c is executed!
> 
> Now I want to know which function calls oggvorbis_encode_frame().
> 
> The C source code level analysis about this call link is somewhat
> difficult for me. This is related function pointer and yasm I guess.
> 
> The structure below is the very end I can figure out...
> 
> AVCodec ff_libvorbis_encoder = {
>         .name           = "libvorbis",
>         .type           = AVMEDIA_TYPE_AUDIO,
>         .id             = CODEC_ID_VORBIS,
>         .priv_data_size = sizeof(OggVorbisContext),
>         .init           = oggvorbis_encode_init,
>         .encode         = oggvorbis_encode_frame,
>         .close          = oggvorbis_encode_close,
>         .capabilities   = CODEC_CAP_DELAY,
>         .sample_fmts    = (const enum
> AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
>         .long_name      = NULL_IF_CONFIG_SMALL("libvorbis Vorbis"),
>         .priv_class     = &class,
> };
> 
> "ff_libvorbis_encoder" is maybe used via some macro functions so that
> I can't find places that uses it...

No function directly calls oggvorbis_encode_frame, as can be seen by
searching for it.  The encoding is done by calling it through a function
pointer, which is what is setup by using the AVCodec structure.

An application will call the the "encode frame" function of libavcodec
and through some amount of indirection the computer will execute what is
in oggvorbis_encode_frame.

yasm has nothing to do with this.


More information about the ffmpeg-user mailing list