The metadata API allows libavformat to export metadata tags to a client application when demuxing. More...

The metadata API allows libavformat to export metadata tags to a client application when demuxing.

Conversely it allows a client application to set metadata when muxing.

Metadata is exported or set as pairs of key/value strings in the 'metadata' fields of the AVFormatContext, AVStream, AVChapter and AVProgram structs using the AVDictionary API. Like all strings in Libav, metadata is assumed to be UTF-8 encoded Unicode. Note that metadata exported by demuxers isn't checked to be valid UTF-8 in most cases.

Important concepts to keep in mind:

album        -- name of the set this work belongs to
album_artist -- main creator of the set/album, if different from artist.
                e.g. "Various Artists" for compilation albums.
artist       -- main creator of the work
comment      -- any additional description of the file.
composer     -- who composed the work, if different from artist.
copyright    -- name of copyright holder.
creation_time-- date when the file was created, preferably in ISO 8601.
date         -- date when the work was created, preferably in ISO 8601.
disc         -- number of a subset, e.g. disc in a multi-disc collection.
encoder      -- name/settings of the software/hardware that produced the file.
encoded_by   -- person/group who created the file.
filename     -- original name of the file.
genre        -- <self-evident>.
language     -- main language in which the work is performed, preferably
                in ISO 639-2 format. Multiple languages can be specified by
                separating them with commas.
performer    -- artist who performed the work, if different from artist.
                E.g for "Also sprach Zarathustra", artist would be "Richard
                Strauss" and performer "London Philharmonic Orchestra".
publisher    -- name of the label/publisher.
service_name     -- name of the service in broadcasting (channel name).
service_provider -- name of the service provider in broadcasting.
title        -- name of the work.
track        -- number of this work in the set, can be in form current/total.
variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of

Look in the examples section for an application example how to use the Metadata API.

Use non-blocking mode. If this flag is set, operations on the context will return AVERROR(EAGAIN) if they can not be performed immediately. If this flag is not set, operations on the context will never return AVERROR(EAGAIN). Note that this flag does not affect the opening/connecting of the context. Connecting a protocol will always block if necessary (e.g. on network protocols) but never hang (e.g. on busy devices). Warning: non-blocking protocols is work-in-progress; this flag may be silently ignored.

Create and initialize a AVIOContext for accessing the resource indicated by url.

Note
When the resource indicated by url has been opened in read+write mode, the AVIOContext can be used only for writing.
Parameters
sUsed to return the pointer to the created AVIOContext. In case of failure the pointed to value is set to NULL.
flagsflags which control how the resource indicated by url is to be opened
Returns
0 in case of success, a negative value corresponding to an AVERROR code in case of failure

Create and initialize a AVIOContext for accessing the resource indicated by url.

Note
When the resource indicated by url has been opened in read+write mode, the AVIOContext can be used only for writing.
Parameters
sUsed to return the pointer to the created AVIOContext. In case of failure the pointed to value is set to NULL.
flagsflags which control how the resource indicated by url is to be opened
int_cban interrupt callback to be used at the protocols level
optionsA dictionary filled with protocol-private options. On return this parameter will be destroyed and replaced with a dict containing options that were not found. May be NULL.
Returns
0 in case of success, a negative value corresponding to an AVERROR code in case of failure

Close the resource accessed by the AVIOContext s and free it. This function can only be used if s was opened by avio_open().

The internal buffer is automatically flushed before closing the resource.

Returns
0 on success, an AVERROR < 0 on error.
See Also
avio_closep

Close the resource accessed by the AVIOContext *s, free it and set the pointer pointing to it to NULL. This function can only be used if s was opened by avio_open().

The internal buffer is automatically flushed before closing the resource.

Returns
0 on success, an AVERROR < 0 on error.
See Also
avio_close

Open a write only memory stream.

Parameters
snew IO context
Returns
zero if no error.

Return the written size and a pointer to the buffer. The buffer must be freed with av_free(). Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer.

Parameters
sIO context
pbufferpointer to a byte buffer
Returns
the length of the byte buffer

Iterate through names of available protocols.

Parameters
opaqueA private pointer representing current protocol. It must be a pointer to NULL on first iteration and will be updated by successive calls to avio_enum_protocols.
outputIf set to 1, iterate over output protocols, otherwise over input protocols.
Returns
A static string containing the name of current protocol or NULL

Pause and resume playing - only meaningful if using a network streaming protocol (e.g. MMS).

Parameters
pause1 for pause, 0 for resume

Seek to a given timestamp relative to some component stream. Only meaningful if using a network streaming protocol (e.g. MMS.).

Parameters
stream_indexThe stream index that the timestamp is relative to. If stream_index is (-1) the timestamp should be in AV_TIME_BASE units from the beginning of the presentation. If a stream_index >= 0 is used and the protocol does not support seeking based on component streams, the call will fail with ENOTSUP.
timestamptimestamp in AVStream.time_base units or if there is no stream specified then in AV_TIME_BASE units.
flagsOptional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE and AVSEEK_FLAG_ANY. The protocol may silently ignore AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will fail with ENOTSUP if used and not supported.
Returns
>= 0 on success
See Also
AVInputFormat::read_seek

Get the current time in microseconds.

Sleep for a period of time. Although the duration is expressed in microseconds, the actual delay may be rounded to the precision of the system timer.

Parameters
usecNumber of microseconds to sleep.
Returns
zero on success or (negative) error code.

The metadata API allows libavformat to export metadata tags to a client application when demuxing. Conversely it allows a client application to set metadata when muxing.

Metadata is exported or set as pairs of key/value strings in the 'metadata' fields of the AVFormatContext, AVStream, AVChapter and AVProgram structs using the AVDictionary API. Like all strings in Libav, metadata is assumed to be UTF-8 encoded Unicode. Note that metadata exported by demuxers isn't checked to be valid UTF-8 in most cases.

Important concepts to keep in mind:

album        -- name of the set this work belongs to
album_artist -- main creator of the set/album, if different from artist.
                e.g. "Various Artists" for compilation albums.
artist       -- main creator of the work
comment      -- any additional description of the file.
composer     -- who composed the work, if different from artist.
copyright    -- name of copyright holder.
creation_time-- date when the file was created, preferably in ISO 8601.
date         -- date when the work was created, preferably in ISO 8601.
disc         -- number of a subset, e.g. disc in a multi-disc collection.
encoder      -- name/settings of the software/hardware that produced the file.
encoded_by   -- person/group who created the file.
filename     -- original name of the file.
genre        -- <self-evident>.
language     -- main language in which the work is performed, preferably
                in ISO 639-2 format. Multiple languages can be specified by
                separating them with commas.
performer    -- artist who performed the work, if different from artist.
                E.g for "Also sprach Zarathustra", artist would be "Richard
                Strauss" and performer "London Philharmonic Orchestra".
publisher    -- name of the label/publisher.
service_name     -- name of the service in broadcasting (channel name).
service_provider -- name of the service provider in broadcasting.
title        -- name of the work.
track        -- number of this work in the set, can be in form current/total.
variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of

Look in the examples section for an application example how to use the Metadata API.