Libav libavformat HOWTO: Difference between revisions

From MultimediaWiki
Jump to navigation Jump to search
m (Libav demuxer HOWTO moved to Libav libavformat HOWTO: Broaden the scope of the howto a little)
Line 9: Line 9:
=== libavformat/Makefile ===
=== libavformat/Makefile ===


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


Add  
Add  

Revision as of 20:20, 14 November 2011

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.

libavformat/Makefile

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

Add

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.

libavformat/allformats.c

In order to add a demuxer:

REGISTER_DEMUXER(DEMUXERNAME, demuxername)

In order to add a muxer:

REGISTER_MUXER(MUXERNAME, muxername)

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

REGISTER_MUXDEMU(NAME, name)

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
make

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)

WIP