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

Demuxes an IMF Composition. More...

#include "avio_internal.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 "url.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 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, FFIMFUUID uuid)
 
static int open_track_resource_context (AVFormatContext *s, IMFVirtualTrackResourcePlaybackCtx *track_resource)
 
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_time_to_ts (int64_t *ts, AVRational t, AVRational time_base)
 
static int imf_read_packet (AVFormatContext *s, AVPacket *pkt)
 
static int imf_close (AVFormatContext *s)
 
static int imf_probe (const AVProbeData *p)
 

Variables

static const AVOption imf_options []
 
static const AVClass imf_class
 
const AVInputFormat 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().

◆ 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 165 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 258 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 267 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 275 of file imfdec.c.

Referenced by imf_read_header().

◆ find_asset_map_locator()

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

Definition at line 333 of file imfdec.c.

Referenced by open_track_file_resource().

◆ open_track_resource_context()

static int open_track_resource_context ( AVFormatContext s,
IMFVirtualTrackResourcePlaybackCtx track_resource 
)
static

◆ open_track_file_resource()

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

Definition at line 442 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 498 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 506 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 558 of file imfdec.c.

Referenced by open_cpl_tracks().

◆ open_cpl_tracks()

static int open_cpl_tracks ( AVFormatContext s)
static

Definition at line 597 of file imfdec.c.

Referenced by imf_read_header().

◆ imf_read_header()

static int imf_read_header ( AVFormatContext s)
static

Definition at line 626 of file imfdec.c.

◆ get_next_track_with_minimum_timestamp()

static IMFVirtualTrackPlaybackCtx* get_next_track_with_minimum_timestamp ( AVFormatContext s)
static

Definition at line 686 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 719 of file imfdec.c.

Referenced by imf_read_packet().

◆ imf_time_to_ts()

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

Definition at line 775 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 794 of file imfdec.c.

◆ imf_close()

static int imf_close ( AVFormatContext s)
static

Definition at line 911 of file imfdec.c.

◆ imf_probe()

static int imf_probe ( const AVProbeData p)
static

Definition at line 931 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 945 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 959 of file imfdec.c.

◆ ff_imf_demuxer

const AVInputFormat ff_imf_demuxer
Initial value:
= {
.name = "imf",
.long_name = NULL_IF_CONFIG_SMALL("IMF (Interoperable Master Format)"),
.flags_internal = FF_FMT_INIT_CLEANUP,
.priv_class = &imf_class,
.priv_data_size = sizeof(IMFContext),
}

Definition at line 966 of file imfdec.c.

FF_FMT_INIT_CLEANUP
#define FF_FMT_INIT_CLEANUP
For an AVInputFormat with this flag set read_close() needs to be called by the caller upon read_heade...
Definition: internal.h:49
imf_close
static int imf_close(AVFormatContext *s)
Definition: imfdec.c:911
imf_probe
static int imf_probe(const AVProbeData *p)
Definition: imfdec.c:931
read_close
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:141
imf_options
static const AVOption imf_options[]
Definition: imfdec.c:945
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:527
NULL
#define NULL
Definition: coverity.c:32
read_probe
static int read_probe(const AVProbeData *pd)
Definition: jvdec.c:55
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:235
imf_read_packet
static int imf_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: imfdec.c:794
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:117
imf_read_header
static int imf_read_header(AVFormatContext *s)
Definition: imfdec.c:626
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:278
AVFMT_EXPERIMENTAL
#define AVFMT_EXPERIMENTAL
The muxer/demuxer is experimental and should be used with caution.
Definition: avformat.h:472
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_reading.c:42
IMFContext
Definition: imfdec.c:118
imf_class
static const AVClass imf_class
Definition: imfdec.c:959
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:228