FFmpeg
Functions
imf_cpl.c File Reference

Implements IMP CPL processing. More...

#include "imf.h"
#include "libavutil/bprint.h"
#include "libavutil/error.h"
#include "libavutil/mem.h"
#include <libxml/parser.h>

Go to the source code of this file.

Functions

xmlNodePtr ff_imf_xml_get_child_element_by_name (xmlNodePtr parent, const char *name_utf8)
 Returns the first child element with the specified local name. More...
 
int ff_imf_xml_read_uuid (xmlNodePtr element, AVUUID uuid)
 Reads a UUID from an XML element. More...
 
int ff_imf_xml_read_rational (xmlNodePtr element, AVRational *rational)
 Reads an AVRational from an XML element. More...
 
int ff_imf_xml_read_uint32 (xmlNodePtr element, uint32_t *number)
 Reads an unsigned 32-bit integer from an XML element. More...
 
static int ff_imf_xml_read_boolean (xmlNodePtr element, int *value)
 
static void imf_base_virtual_track_init (FFIMFBaseVirtualTrack *track)
 
static void imf_marker_virtual_track_init (FFIMFMarkerVirtualTrack *track)
 
static void imf_trackfile_virtual_track_init (FFIMFTrackFileVirtualTrack *track)
 
static void imf_base_resource_init (FFIMFBaseResource *rsrc)
 
static void imf_marker_resource_init (FFIMFMarkerResource *rsrc)
 
static void imf_marker_init (FFIMFMarker *marker)
 
static void imf_trackfile_resource_init (FFIMFTrackFileResource *rsrc)
 
static int fill_content_title (xmlNodePtr cpl_element, FFIMFCPL *cpl)
 
static int digit_to_int (char digit)
 
static int parse_cpl_tc_type (const char *s, int *tc_comps)
 Parses a string that conform to the TimecodeType used in IMF CPL and defined in SMPTE ST 2067-3. More...
 
static int fill_timecode (xmlNodePtr cpl_element, FFIMFCPL *cpl)
 
static int fill_edit_rate (xmlNodePtr cpl_element, FFIMFCPL *cpl)
 
static int fill_id (xmlNodePtr cpl_element, FFIMFCPL *cpl)
 
static int fill_marker (xmlNodePtr marker_elem, FFIMFMarker *marker)
 
static int fill_base_resource (void *log_ctx, xmlNodePtr resource_elem, FFIMFBaseResource *resource, FFIMFCPL *cpl)
 
static int fill_trackfile_resource (void *log_ctx, xmlNodePtr tf_resource_elem, FFIMFTrackFileResource *tf_resource, FFIMFCPL *cpl)
 
static int fill_marker_resource (void *log_ctx, xmlNodePtr marker_resource_elem, FFIMFMarkerResource *marker_resource, FFIMFCPL *cpl)
 
static int push_marker_sequence (void *log_ctx, xmlNodePtr marker_sequence_elem, FFIMFCPL *cpl)
 
static int has_stereo_resources (xmlNodePtr element)
 
static int push_main_audio_sequence (void *log_ctx, xmlNodePtr audio_sequence_elem, FFIMFCPL *cpl)
 
static int push_main_image_2d_sequence (void *log_ctx, xmlNodePtr image_sequence_elem, FFIMFCPL *cpl)
 
static int fill_virtual_tracks (void *log_ctx, xmlNodePtr cpl_element, FFIMFCPL *cpl)
 
int ff_imf_parse_cpl_from_xml_dom (void *log_ctx, xmlDocPtr doc, FFIMFCPL **cpl)
 Parse an IMF CompositionPlaylist element into the FFIMFCPL data structure. More...
 
static void imf_marker_free (FFIMFMarker *marker)
 
static void imf_marker_resource_free (FFIMFMarkerResource *rsrc)
 
static void imf_marker_virtual_track_free (FFIMFMarkerVirtualTrack *vt)
 
static void imf_trackfile_virtual_track_free (FFIMFTrackFileVirtualTrack *vt)
 
static void imf_cpl_init (FFIMFCPL *cpl)
 
FFIMFCPLff_imf_cpl_alloc (void)
 Allocates and initializes an FFIMFCPL data structure. More...
 
void ff_imf_cpl_free (FFIMFCPL *cpl)
 Deletes an FFIMFCPL data structure previously instantiated with ff_imf_cpl_alloc(). More...
 
int ff_imf_parse_cpl (void *log_ctx, AVIOContext *in, FFIMFCPL **cpl)
 Parse an IMF Composition Playlist document into the FFIMFCPL data structure. More...
 

Detailed Description

Implements IMP CPL processing.

Author
Pierre-Anthony Lemieux

Definition in file imf_cpl.c.

Function Documentation

◆ ff_imf_xml_get_child_element_by_name()

xmlNodePtr ff_imf_xml_get_child_element_by_name ( xmlNodePtr  parent,
const char *  name_utf8 
)

Returns the first child element with the specified local name.

Returns
A pointer to the child element, or NULL if no such child element exists.

Definition at line 59 of file imf_cpl.c.

Referenced by fill_base_resource(), fill_content_title(), fill_edit_rate(), fill_id(), fill_marker(), fill_timecode(), fill_trackfile_resource(), fill_virtual_tracks(), parse_imf_asset_map_from_xml_dom(), push_main_audio_sequence(), push_main_image_2d_sequence(), and push_marker_sequence().

◆ ff_imf_xml_read_uuid()

int ff_imf_xml_read_uuid ( xmlNodePtr  element,
AVUUID  uuid 
)

Reads a UUID from an XML element.

Returns
0 on success, < 0 AVERROR code on error.

Definition at line 73 of file imf_cpl.c.

Referenced by fill_id(), fill_trackfile_resource(), parse_imf_asset_map_from_xml_dom(), push_main_audio_sequence(), push_main_image_2d_sequence(), and push_marker_sequence().

◆ ff_imf_xml_read_rational()

int ff_imf_xml_read_rational ( xmlNodePtr  element,
AVRational rational 
)

Reads an AVRational from an XML element.

Returns
0 on success, < 0 AVERROR code on error.

Definition at line 88 of file imf_cpl.c.

Referenced by fill_base_resource(), and fill_edit_rate().

◆ ff_imf_xml_read_uint32()

int ff_imf_xml_read_uint32 ( xmlNodePtr  element,
uint32_t *  number 
)

Reads an unsigned 32-bit integer from an XML element.

Returns
0 on success, < 0 AVERROR code on error.

Definition at line 100 of file imf_cpl.c.

Referenced by fill_base_resource(), and fill_marker().

◆ ff_imf_xml_read_boolean()

static int ff_imf_xml_read_boolean ( xmlNodePtr  element,
int *  value 
)
static

Definition at line 112 of file imf_cpl.c.

Referenced by fill_timecode().

◆ imf_base_virtual_track_init()

static void imf_base_virtual_track_init ( FFIMFBaseVirtualTrack track)
static

Definition at line 128 of file imf_cpl.c.

Referenced by imf_marker_virtual_track_init(), and imf_trackfile_virtual_track_init().

◆ imf_marker_virtual_track_init()

static void imf_marker_virtual_track_init ( FFIMFMarkerVirtualTrack track)
static

Definition at line 133 of file imf_cpl.c.

Referenced by push_marker_sequence().

◆ imf_trackfile_virtual_track_init()

static void imf_trackfile_virtual_track_init ( FFIMFTrackFileVirtualTrack track)
static

Definition at line 140 of file imf_cpl.c.

Referenced by push_main_audio_sequence(), and push_main_image_2d_sequence().

◆ imf_base_resource_init()

static void imf_base_resource_init ( FFIMFBaseResource rsrc)
static

Definition at line 148 of file imf_cpl.c.

Referenced by imf_marker_resource_init(), and imf_trackfile_resource_init().

◆ imf_marker_resource_init()

static void imf_marker_resource_init ( FFIMFMarkerResource rsrc)
static

Definition at line 156 of file imf_cpl.c.

Referenced by push_marker_sequence().

◆ imf_marker_init()

static void imf_marker_init ( FFIMFMarker marker)
static

Definition at line 163 of file imf_cpl.c.

Referenced by fill_marker_resource().

◆ imf_trackfile_resource_init()

static void imf_trackfile_resource_init ( FFIMFTrackFileResource rsrc)
static

Definition at line 170 of file imf_cpl.c.

Referenced by push_main_audio_sequence(), and push_main_image_2d_sequence().

◆ fill_content_title()

static int fill_content_title ( xmlNodePtr  cpl_element,
FFIMFCPL cpl 
)
static

Definition at line 176 of file imf_cpl.c.

Referenced by ff_imf_parse_cpl_from_xml_dom().

◆ digit_to_int()

static int digit_to_int ( char  digit)
static

Definition at line 193 of file imf_cpl.c.

Referenced by parse_cpl_tc_type().

◆ parse_cpl_tc_type()

static int parse_cpl_tc_type ( const char *  s,
int *  tc_comps 
)
static

Parses a string that conform to the TimecodeType used in IMF CPL and defined in SMPTE ST 2067-3.

Parameters
[in]sstring to parse
[out]tc_compspointer to an array of 4 integers where the parsed HH, MM, SS and FF fields of the timecode are returned.
Returns
0 on success, < 0 AVERROR code on error.

Definition at line 208 of file imf_cpl.c.

Referenced by fill_timecode().

◆ fill_timecode()

static int fill_timecode ( xmlNodePtr  cpl_element,
FFIMFCPL cpl 
)
static

Definition at line 229 of file imf_cpl.c.

Referenced by ff_imf_parse_cpl_from_xml_dom().

◆ fill_edit_rate()

static int fill_edit_rate ( xmlNodePtr  cpl_element,
FFIMFCPL cpl 
)
static

Definition at line 272 of file imf_cpl.c.

Referenced by ff_imf_parse_cpl_from_xml_dom().

◆ fill_id()

static int fill_id ( xmlNodePtr  cpl_element,
FFIMFCPL cpl 
)
static

Definition at line 282 of file imf_cpl.c.

Referenced by ff_imf_parse_cpl_from_xml_dom().

◆ fill_marker()

static int fill_marker ( xmlNodePtr  marker_elem,
FFIMFMarker marker 
)
static

Definition at line 292 of file imf_cpl.c.

Referenced by fill_marker_resource().

◆ fill_base_resource()

static int fill_base_resource ( void *  log_ctx,
xmlNodePtr  resource_elem,
FFIMFBaseResource resource,
FFIMFCPL cpl 
)
static

Definition at line 323 of file imf_cpl.c.

Referenced by fill_marker_resource(), and fill_trackfile_resource().

◆ fill_trackfile_resource()

static int fill_trackfile_resource ( void *  log_ctx,
xmlNodePtr  tf_resource_elem,
FFIMFTrackFileResource tf_resource,
FFIMFCPL cpl 
)
static

Definition at line 373 of file imf_cpl.c.

Referenced by push_main_audio_sequence(), and push_main_image_2d_sequence().

◆ fill_marker_resource()

static int fill_marker_resource ( void *  log_ctx,
xmlNodePtr  marker_resource_elem,
FFIMFMarkerResource marker_resource,
FFIMFCPL cpl 
)
static

Definition at line 397 of file imf_cpl.c.

Referenced by push_marker_sequence().

◆ push_marker_sequence()

static int push_marker_sequence ( void *  log_ctx,
xmlNodePtr  marker_sequence_elem,
FFIMFCPL cpl 
)
static

Definition at line 438 of file imf_cpl.c.

Referenced by fill_virtual_tracks().

◆ has_stereo_resources()

static int has_stereo_resources ( xmlNodePtr  element)
static

Definition at line 509 of file imf_cpl.c.

Referenced by push_main_image_2d_sequence().

◆ push_main_audio_sequence()

static int push_main_audio_sequence ( void *  log_ctx,
xmlNodePtr  audio_sequence_elem,
FFIMFCPL cpl 
)
static

Definition at line 525 of file imf_cpl.c.

Referenced by fill_virtual_tracks().

◆ push_main_image_2d_sequence()

static int push_main_image_2d_sequence ( void *  log_ctx,
xmlNodePtr  image_sequence_elem,
FFIMFCPL cpl 
)
static

Definition at line 611 of file imf_cpl.c.

Referenced by fill_virtual_tracks().

◆ fill_virtual_tracks()

static int fill_virtual_tracks ( void *  log_ctx,
xmlNodePtr  cpl_element,
FFIMFCPL cpl 
)
static

Definition at line 693 of file imf_cpl.c.

Referenced by ff_imf_parse_cpl_from_xml_dom().

◆ ff_imf_parse_cpl_from_xml_dom()

int ff_imf_parse_cpl_from_xml_dom ( void *  log_ctx,
xmlDocPtr  doc,
FFIMFCPL **  cpl 
)

Parse an IMF CompositionPlaylist element into the FFIMFCPL data structure.

Parameters
[in]log_ctxLogging context (points to an instance of AVClass). May be NULL.
[in]docAn XML document from which the CPL is read.
[out]cplPointer to a memory area (allocated by the client), where the function writes a pointer to the newly constructed FFIMFCPL structure (or NULL if the CPL could not be parsed). The client is responsible for freeing the FFIMFCPL structure using ff_imf_cpl_free().
Returns
A non-zero value in case of an error.

Definition at line 745 of file imf_cpl.c.

Referenced by ff_imf_parse_cpl(), test_cpl_from_doc(), and test_cpl_parsing().

◆ imf_marker_free()

static void imf_marker_free ( FFIMFMarker marker)
static

Definition at line 790 of file imf_cpl.c.

Referenced by imf_marker_resource_free().

◆ imf_marker_resource_free()

static void imf_marker_resource_free ( FFIMFMarkerResource rsrc)
static

Definition at line 798 of file imf_cpl.c.

Referenced by imf_marker_virtual_track_free().

◆ imf_marker_virtual_track_free()

static void imf_marker_virtual_track_free ( FFIMFMarkerVirtualTrack vt)
static

Definition at line 807 of file imf_cpl.c.

Referenced by ff_imf_cpl_free().

◆ imf_trackfile_virtual_track_free()

static void imf_trackfile_virtual_track_free ( FFIMFTrackFileVirtualTrack vt)
static

Definition at line 816 of file imf_cpl.c.

Referenced by ff_imf_cpl_free().

◆ imf_cpl_init()

static void imf_cpl_init ( FFIMFCPL cpl)
static

Definition at line 823 of file imf_cpl.c.

Referenced by ff_imf_cpl_alloc().

◆ ff_imf_cpl_alloc()

FFIMFCPL* ff_imf_cpl_alloc ( void  )

Allocates and initializes an FFIMFCPL data structure.

Returns
A pointer to the newly constructed FFIMFCPL structure (or NULL if the structure could not be constructed). The client is responsible for freeing the FFIMFCPL structure using ff_imf_cpl_free().

Definition at line 835 of file imf_cpl.c.

Referenced by ff_imf_parse_cpl_from_xml_dom().

◆ ff_imf_cpl_free()

void ff_imf_cpl_free ( FFIMFCPL cpl)

Deletes an FFIMFCPL data structure previously instantiated with ff_imf_cpl_alloc().

Parameters
[in]cplThe FFIMFCPL structure to delete.

Definition at line 846 of file imf_cpl.c.

Referenced by ff_imf_parse_cpl_from_xml_dom(), imf_close(), test_cpl_from_doc(), and test_cpl_parsing().

◆ ff_imf_parse_cpl()

int ff_imf_parse_cpl ( void *  log_ctx,
AVIOContext in,
FFIMFCPL **  cpl 
)

Parse an IMF Composition Playlist document into the FFIMFCPL data structure.

Parameters
[in]log_ctxLogging context (points to an instance of AVClass). May be NULL.
[in]inThe context from which the CPL is read.
[out]cplPointer to a memory area (allocated by the client), where the function writes a pointer to the newly constructed FFIMFCPL structure (or NULL if the CPL could not be parsed). The client is responsible for freeing the FFIMFCPL structure using ff_imf_cpl_free().
Returns
A non-zero value in case of an error.

Definition at line 875 of file imf_cpl.c.

Referenced by imf_read_header().