Libav libavformat HOWTO: Difference between revisions
Line 20: | Line 20: | ||
In order to add a demuxer: | In order to add a demuxer: | ||
REGISTER_DEMUXER( | REGISTER_DEMUXER(NAME, '''name''') | ||
In order to add a muxer: | In order to add a muxer: | ||
REGISTER_MUXER( | REGISTER_MUXER(NAME, '''name''') | ||
In order to add muxer and demuxer in a single line: | In order to add muxer and demuxer in a single line: | ||
REGISTER_MUXDEMU(NAME, name) | REGISTER_MUXDEMU(NAME, '''name''') | ||
The macro will register | 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: | Modifying allformats.c will trigger a build system warning: |
Revision as of 19:21, 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(NAME, name)
In order to add a muxer:
REGISTER_MUXER(NAME, name)
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