FFmpeg
Data Structures | Macros | Functions | Variables
imfdec.c File Reference

Demuxes an IMF Composition. More...

#include "avio_internal.h"
#include "demux.h"
#include "imf.h"
#include "internal.h"
#include "libavcodec/packet.h"
#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "mxf.h"
#include <inttypes.h>
#include <libxml/parser.h>

Go to the source code of this file.

Data Structures

struct  IMFAssetLocator
 IMF Asset locator. More...
 
struct  IMFAssetLocatorMap
 IMF Asset locator map Results from the parsing of one or more ASSETMAP XML files. More...
 
struct  IMFVirtualTrackResourcePlaybackCtx
 
struct  IMFVirtualTrackPlaybackCtx
 
struct  IMFContext
 

Macros

#define AVRATIONAL_FORMAT   "%d/%d"
 
#define AVRATIONAL_ARG(rational)   rational.num, rational.den
 

Functions

static int imf_uri_is_url (const char *string)
 
static int imf_uri_is_unix_abs_path (const char *string)
 
static int imf_uri_is_dos_abs_path (const char *string)
 
static int imf_time_to_ts (int64_t *ts, AVRational t, AVRational time_base)
 
static int parse_imf_asset_map_from_xml_dom (AVFormatContext *s, xmlDocPtr doc, IMFAssetLocatorMap *asset_map, const char *base_url)
 Parse a ASSETMAP XML file to extract the UUID-URI mapping of assets. More...
 
static void imf_asset_locator_map_init (IMFAssetLocatorMap *asset_map)
 Initializes an IMFAssetLocatorMap structure. More...
 
static void imf_asset_locator_map_deinit (IMFAssetLocatorMap *asset_map)
 Free a IMFAssetLocatorMap pointer. More...
 
static int parse_assetmap (AVFormatContext *s, const char *url)
 
static IMFAssetLocatorfind_asset_map_locator (IMFAssetLocatorMap *asset_map, AVUUID uuid)
 
static int open_track_resource_context (AVFormatContext *s, IMFVirtualTrackPlaybackCtx *track, int32_t resource_index)
 
static int open_track_file_resource (AVFormatContext *s, FFIMFTrackFileResource *track_file_resource, IMFVirtualTrackPlaybackCtx *track)
 
static void imf_virtual_track_playback_context_deinit (IMFVirtualTrackPlaybackCtx *track)
 
static int open_virtual_track (AVFormatContext *s, FFIMFTrackFileVirtualTrack *virtual_track, int32_t track_index)
 
static int set_context_streams_from_tracks (AVFormatContext *s)
 
static int open_cpl_tracks (AVFormatContext *s)
 
static int imf_read_header (AVFormatContext *s)
 
static IMFVirtualTrackPlaybackCtxget_next_track_with_minimum_timestamp (AVFormatContext *s)
 
static int get_resource_context_for_timestamp (AVFormatContext *s, IMFVirtualTrackPlaybackCtx *track, IMFVirtualTrackResourcePlaybackCtx **resource)
 
static int imf_read_packet (AVFormatContext *s, AVPacket *pkt)
 
static int imf_close (AVFormatContext *s)
 
static int imf_probe (const AVProbeData *p)
 
static int coherent_ts (int64_t ts, AVRational in_tb, AVRational out_tb)
 
static int imf_seek (AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
 

Variables

static const AVOption imf_options []
 
static const AVClass imf_class
 
const FFInputFormat ff_imf_demuxer
 

Detailed Description

Demuxes an IMF Composition.

References OV 2067-0:2018 - SMPTE Overview Document - Interoperable Master Format ST 2067-2:2020 - SMPTE Standard - Interoperable Master Format — Core Constraints ST 2067-3:2020 - SMPTE Standard - Interoperable Master Format — Composition Playlist ST 2067-5:2020 - SMPTE Standard - Interoperable Master Format — Essence Component ST 2067-20:2016 - SMPTE Standard - Interoperable Master Format — Application #2 ST 2067-21:2020 - SMPTE Standard - Interoperable Master Format — Application #2 Extended ST 2067-102:2017 - SMPTE Standard - Interoperable Master Format — Common Image Pixel Color Schemes ST 429-9:2007 - SMPTE Standard - D-Cinema Packaging — Asset Mapping and File Segmentation

Author
Marc-Antoine Arnaud
Valentin Noel
Nicholas Vanderzwet

Definition in file imfdec.c.

Macro Definition Documentation

◆ AVRATIONAL_FORMAT

#define AVRATIONAL_FORMAT   "%d/%d"

Definition at line 78 of file imfdec.c.

◆ AVRATIONAL_ARG

#define AVRATIONAL_ARG (   rational)    rational.num, rational.den

Definition at line 79 of file imfdec.c.

Function Documentation

◆ imf_uri_is_url()

static int imf_uri_is_url ( const char *  string)
static

Definition at line 130 of file imfdec.c.

Referenced by parse_imf_asset_map_from_xml_dom(), and test_path_type_functions().

◆ imf_uri_is_unix_abs_path()

static int imf_uri_is_unix_abs_path ( const char *  string)
static

Definition at line 135 of file imfdec.c.

Referenced by parse_imf_asset_map_from_xml_dom(), and test_path_type_functions().

◆ imf_uri_is_dos_abs_path()

static int imf_uri_is_dos_abs_path ( const char *  string)
static

Definition at line 140 of file imfdec.c.

Referenced by parse_imf_asset_map_from_xml_dom(), and test_path_type_functions().

◆ imf_time_to_ts()

static int imf_time_to_ts ( int64_t *  ts,
AVRational  t,
AVRational  time_base 
)
static

Definition at line 157 of file imfdec.c.

Referenced by imf_read_packet(), and open_track_resource_context().

◆ parse_imf_asset_map_from_xml_dom()

static int parse_imf_asset_map_from_xml_dom ( AVFormatContext s,
xmlDocPtr  doc,
IMFAssetLocatorMap asset_map,
const char *  base_url 
)
static

Parse a ASSETMAP XML file to extract the UUID-URI mapping of assets.

Parameters
sthe current format context, if any (can be NULL).
docthe XML document to be parsed.
asset_mappointer on the IMFAssetLocatorMap to fill.
base_urlthe url of the asset map XML file, if any (can be NULL).
Returns
a negative value in case of error, 0 otherwise.

Definition at line 184 of file imfdec.c.

Referenced by parse_assetmap(), and test_asset_map_parsing().

◆ imf_asset_locator_map_init()

static void imf_asset_locator_map_init ( IMFAssetLocatorMap asset_map)
static

Initializes an IMFAssetLocatorMap structure.

Definition at line 279 of file imfdec.c.

Referenced by imf_read_header(), and test_asset_map_parsing().

◆ imf_asset_locator_map_deinit()

static void imf_asset_locator_map_deinit ( IMFAssetLocatorMap asset_map)
static

Free a IMFAssetLocatorMap pointer.

Definition at line 288 of file imfdec.c.

Referenced by imf_close(), and test_asset_map_parsing().

◆ parse_assetmap()

static int parse_assetmap ( AVFormatContext s,
const char *  url 
)
static

Definition at line 296 of file imfdec.c.

Referenced by imf_read_header().

◆ find_asset_map_locator()

static IMFAssetLocator* find_asset_map_locator ( IMFAssetLocatorMap asset_map,
AVUUID  uuid 
)
static

Definition at line 351 of file imfdec.c.

Referenced by open_track_file_resource().

◆ open_track_resource_context()

static int open_track_resource_context ( AVFormatContext s,
IMFVirtualTrackPlaybackCtx track,
int32_t  resource_index 
)
static

◆ open_track_file_resource()

static int open_track_file_resource ( AVFormatContext s,
FFIMFTrackFileResource track_file_resource,
IMFVirtualTrackPlaybackCtx track 
)
static

Definition at line 450 of file imfdec.c.

Referenced by open_virtual_track().

◆ imf_virtual_track_playback_context_deinit()

static void imf_virtual_track_playback_context_deinit ( IMFVirtualTrackPlaybackCtx track)
static

Definition at line 504 of file imfdec.c.

Referenced by imf_close(), and open_virtual_track().

◆ open_virtual_track()

static int open_virtual_track ( AVFormatContext s,
FFIMFTrackFileVirtualTrack virtual_track,
int32_t  track_index 
)
static

Definition at line 512 of file imfdec.c.

Referenced by open_cpl_tracks().

◆ set_context_streams_from_tracks()

static int set_context_streams_from_tracks ( AVFormatContext s)
static

Definition at line 564 of file imfdec.c.

Referenced by open_cpl_tracks().

◆ open_cpl_tracks()

static int open_cpl_tracks ( AVFormatContext s)
static

Definition at line 599 of file imfdec.c.

Referenced by imf_read_header().

◆ imf_read_header()

static int imf_read_header ( AVFormatContext s)
static

Definition at line 624 of file imfdec.c.

◆ get_next_track_with_minimum_timestamp()

static IMFVirtualTrackPlaybackCtx* get_next_track_with_minimum_timestamp ( AVFormatContext s)
static

Definition at line 695 of file imfdec.c.

Referenced by imf_read_packet().

◆ get_resource_context_for_timestamp()

static int get_resource_context_for_timestamp ( AVFormatContext s,
IMFVirtualTrackPlaybackCtx track,
IMFVirtualTrackResourcePlaybackCtx **  resource 
)
static

Definition at line 721 of file imfdec.c.

Referenced by imf_read_packet().

◆ imf_read_packet()

static int imf_read_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 769 of file imfdec.c.

◆ imf_close()

static int imf_close ( AVFormatContext s)
static

Definition at line 893 of file imfdec.c.

◆ imf_probe()

static int imf_probe ( const AVProbeData p)
static

Definition at line 913 of file imfdec.c.

◆ coherent_ts()

static int coherent_ts ( int64_t  ts,
AVRational  in_tb,
AVRational  out_tb 
)
static

Definition at line 927 of file imfdec.c.

Referenced by imf_seek().

◆ imf_seek()

static int imf_seek ( AVFormatContext s,
int  stream_index,
int64_t  min_ts,
int64_t  ts,
int64_t  max_ts,
int  flags 
)
static

Definition at line 941 of file imfdec.c.

Variable Documentation

◆ imf_options

const AVOption imf_options[]
static
Initial value:
= {
{
.name = "assetmaps",
.help = "Comma-separated paths to ASSETMAP files."
"If not specified, the `ASSETMAP.xml` file in the same "
"directory as the CPL is used.",
.offset = 0x42,
.default_val = {.str = NULL},
},
{NULL},
}

Definition at line 996 of file imfdec.c.

◆ imf_class

const AVClass imf_class
static
Initial value:
= {
.class_name = "imf",
.item_name = av_default_item_name,
.option = imf_options,
}

Definition at line 1010 of file imfdec.c.

◆ ff_imf_demuxer

const FFInputFormat ff_imf_demuxer
Initial value:
= {
.p.name = "imf",
.p.long_name = NULL_IF_CONFIG_SMALL("IMF (Interoperable Master Format)"),
.p.flags = AVFMT_NO_BYTE_SEEK,
.p.priv_class = &imf_class,
.flags_internal = FF_INFMT_FLAG_INIT_CLEANUP,
.priv_data_size = sizeof(IMFContext),
.read_seek2 = imf_seek,
}

Definition at line 1017 of file imfdec.c.

AVFMT_NO_BYTE_SEEK
#define AVFMT_NO_BYTE_SEEK
Format does not allow seeking by bytes.
Definition: avformat.h:487
imf_close
static int imf_close(AVFormatContext *s)
Definition: imfdec.c:893
imf_probe
static int imf_probe(const AVProbeData *p)
Definition: imfdec.c:913
read_close
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:143
imf_seek
static int imf_seek(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
Definition: imfdec.c:941
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:41
imf_options
static const AVOption imf_options[]
Definition: imfdec.c:996
FF_INFMT_FLAG_INIT_CLEANUP
#define FF_INFMT_FLAG_INIT_CLEANUP
For an FFInputFormat with this flag set read_close() needs to be called by the caller upon read_heade...
Definition: demux.h:35
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:550
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
imf_read_packet
static int imf_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: imfdec.c:769
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:106
imf_read_header
static int imf_read_header(AVFormatContext *s)
Definition: imfdec.c:624
IMFContext
Definition: imfdec.c:118
imf_class
static const AVClass imf_class
Definition: imfdec.c:1010
AV_OPT_FLAG_DECODING_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
Definition: opt.h:273
read_probe
static int read_probe(const AVProbeData *p)
Definition: cdg.c:30
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:239