FFmpeg
Functions
imf_cpl.c File Reference

Implements IMP CPL processing. More...

#include "imf.h"
#include "libavformat/mxf.h"
#include "libavutil/bprint.h"
#include "libavutil/error.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, uint8_t uuid[16])
 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 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 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 (xmlNodePtr resource_elem, FFIMFBaseResource *resource, FFIMFCPL *cpl)
 
static int fill_trackfile_resource (xmlNodePtr tf_resource_elem, FFIMFTrackFileResource *tf_resource, FFIMFCPL *cpl)
 
static int fill_marker_resource (xmlNodePtr marker_resource_elem, FFIMFMarkerResource *marker_resource, FFIMFCPL *cpl)
 
static int push_marker_sequence (xmlNodePtr marker_sequence_elem, FFIMFCPL *cpl)
 
static int has_stereo_resources (xmlNodePtr element)
 
static int push_main_audio_sequence (xmlNodePtr audio_sequence_elem, FFIMFCPL *cpl)
 
static int push_main_image_2d_sequence (xmlNodePtr image_sequence_elem, FFIMFCPL *cpl)
 
static int fill_virtual_tracks (xmlNodePtr cpl_element, FFIMFCPL *cpl)
 
int ff_imf_parse_cpl_from_xml_dom (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 (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_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,
uint8_t  uuid[16] 
)

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 107 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 122 of file imf_cpl.c.

Referenced by fill_base_resource(), and fill_marker().

◆ imf_base_virtual_track_init()

static void imf_base_virtual_track_init ( FFIMFBaseVirtualTrack track)
static

Definition at line 137 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 142 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 149 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 157 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 165 of file imf_cpl.c.

Referenced by push_marker_sequence().

◆ imf_marker_init()

static void imf_marker_init ( FFIMFMarker marker)
static

Definition at line 172 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 179 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 185 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 200 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 212 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 224 of file imf_cpl.c.

Referenced by fill_marker_resource().

◆ fill_base_resource()

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

Definition at line 258 of file imf_cpl.c.

Referenced by fill_marker_resource(), and fill_trackfile_resource().

◆ fill_trackfile_resource()

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

Definition at line 307 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 ( xmlNodePtr  marker_resource_elem,
FFIMFMarkerResource marker_resource,
FFIMFCPL cpl 
)
static

Definition at line 331 of file imf_cpl.c.

Referenced by push_marker_sequence().

◆ push_marker_sequence()

static int push_marker_sequence ( xmlNodePtr  marker_sequence_elem,
FFIMFCPL cpl 
)
static

Definition at line 370 of file imf_cpl.c.

Referenced by fill_virtual_tracks().

◆ has_stereo_resources()

static int has_stereo_resources ( xmlNodePtr  element)
static

Definition at line 441 of file imf_cpl.c.

Referenced by push_main_image_2d_sequence().

◆ push_main_audio_sequence()

static int push_main_audio_sequence ( xmlNodePtr  audio_sequence_elem,
FFIMFCPL cpl 
)
static

Definition at line 457 of file imf_cpl.c.

Referenced by fill_virtual_tracks().

◆ push_main_image_2d_sequence()

static int push_main_image_2d_sequence ( xmlNodePtr  image_sequence_elem,
FFIMFCPL cpl 
)
static

Definition at line 544 of file imf_cpl.c.

Referenced by fill_virtual_tracks().

◆ fill_virtual_tracks()

static int fill_virtual_tracks ( xmlNodePtr  cpl_element,
FFIMFCPL cpl 
)
static

Definition at line 627 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 ( xmlDocPtr  doc,
FFIMFCPL **  cpl 
)

Parse an IMF CompositionPlaylist element into the FFIMFCPL data structure.

Parameters
[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 679 of file imf_cpl.c.

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

◆ imf_marker_free()

static void imf_marker_free ( FFIMFMarker marker)
static

Definition at line 714 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 722 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 731 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 740 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 747 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 758 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 769 of file imf_cpl.c.

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

◆ ff_imf_parse_cpl()

int ff_imf_parse_cpl ( AVIOContext in,
FFIMFCPL **  cpl 
)

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

Parameters
[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 795 of file imf_cpl.c.

Referenced by imf_read_header().