Libav libavformat HOWTO: Difference between revisions

From MultimediaWiki
Jump to navigation Jump to search
No edit summary
Line 41: Line 41:


In order to build the new code. Make sure you properly edited Makefile and allformats.c .
In order to build the new code. Make sure you properly edited Makefile and allformats.c .
== Introducing a new protocol ==
Protocols let you access container formats through any kind of storage or delivery system, being that a filesystem access (e.g. pipe, file), a low level network protocol (tcp, udp) or a application level protocol (rtmp, http, tls)
=== libavformat/Makefile ===
=== libavformat/allformats.c ===


== Example code ==
== Example code ==

Revision as of 20:24, 14 November 2011

please make this page more complete if you can, thanks

Introducing a new 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 .

Introducing a new protocol

Protocols let you access container formats through any kind of storage or delivery system, being that a filesystem access (e.g. pipe, file), a low level network protocol (tcp, udp) or a application level protocol (rtmp, http, tls)

libavformat/Makefile

libavformat/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