Libav libavformat HOWTO

From MultimediaWiki
Jump to navigation Jump to search
please make this page more complete if you can, thanks

wiring in the demuxer

In order to make available the new demuxer you have to edit libavformat/allformats.c and libavformat/Makefile. The former holds a list of available demuxers and protocol and is parsed by configure to generate build system variables for it, the latter keeps the actual build directives.


The convention regarding the file structure is to use, for a format named name, nameenc.c for muxer code and namedec.c for demuxer code, common code should go in name.c


OBJS-$(CONFIG_NAME_MUXER)      += nameenc.o name.o
OBJS-$(CONFIG_NAME_DEMUXER)    += namedec.o name.o

to the Makefile in order to build the additional code.


In order to add a demuxer:


In order to add a muxer:


In order to add muxer and demuxer in a single line:


The macro will register ff_name_demuxer or/and ff_name_muxer to the available formats.

Modifying allformats.c will trigger a build system warning:

Run configure in the top level directory and make clean, as config.h will be automatically modified.

It is advised to run:

make clean
make configure

In order to build the new code. Make sure you properly edited Makefile and allformats.c .

Example code

This section is merely an overview; please look at an actual demuxer for a more in depth and up to date example. libavformat/avformat.h shows the different structure of a muxer (AVOutputFormat) and a demuxer (AVInputFormat)