2828/**
2929 * @file
3030 * @ingroup lavu_imf
31- * Public header for processing of Interoperable Master Format packages
31+ * Public header for processing of Interoperable Master Format (IMF) packages.
32+ * IMF is specified in the SMPTE ST 2067 family of standards.
3233 */
3334
3435#ifndef AVFORMAT_IMF_H
3940#include "libavutil/rational.h"
4041#include <libxml/tree.h>
4142
43+ /**
44+ * UUID as defined in IETF RFC 422
45+ */
4246typedef uint8_t UUID [16 ];
4347
4448/**
4549 * IMF Composition Playlist Base Resource
4650 */
4751typedef struct IMFBaseResource {
48- AVRational edit_rate ;
49- unsigned long entry_point ;
50- unsigned long duration ;
51- unsigned long repeat_count ;
52+ AVRational edit_rate ; /**< BaseResourceType/EditRate */
53+ unsigned long entry_point ; /**< BaseResourceType/EntryPoint */
54+ unsigned long duration ; /**< BaseResourceType/Duration */
55+ unsigned long repeat_count ; /**< BaseResourceType/RepeatCount */
5256} IMFBaseResource ;
5357
5458/**
5559 * IMF Composition Playlist Track File Resource
5660 */
5761typedef struct IMFTrackFileResource {
5862 IMFBaseResource base ;
59- unsigned char track_file_uuid [16 ];
63+ unsigned char track_file_uuid [16 ]; /**< TrackFileResourceType/TrackFileId */
6064} IMFTrackFileResource ;
6165
6266/**
6367 * IMF Marker
6468 */
6569typedef struct IMFMarker {
66- xmlChar * label_utf8 ;
67- xmlChar * scope_utf8 ;
68- unsigned long offset ;
70+ xmlChar * label_utf8 ; /**< Marker/Label */
71+ xmlChar * scope_utf8 ; /**< Marker/Label/\@scope */
72+ unsigned long offset ; /**< Marker/Offset */
6973} IMFMarker ;
7074
7175/**
7276 * IMF Composition Playlist Marker Resource
7377 */
7478typedef struct IMFMarkerResource {
7579 IMFBaseResource base ;
76- unsigned long marker_count ;
77- IMFMarker * markers ;
80+ unsigned long marker_count ; /**< Number of Marker elements */
81+ IMFMarker * markers ; /**< Marker elements */
7882} IMFMarkerResource ;
7983
8084/**
8185 * IMF Composition Playlist Virtual Track
8286 */
8387typedef struct IMFBaseVirtualTrack {
84- unsigned char id_uuid [16 ];
88+ unsigned char id_uuid [16 ]; /**< TrackId associated with the Virtual Track */
8589} IMFBaseVirtualTrack ;
8690
8791/**
8892 * IMF Composition Playlist Virtual Track that consists of Track File Resources
8993 */
9094typedef struct IMFTrackFileVirtualTrack {
9195 IMFBaseVirtualTrack base ;
92- unsigned long resource_count ;
93- IMFTrackFileResource * resources ;
96+ unsigned long resource_count ; /**< Number of Resource elements present in the Virtual Track */
97+ IMFTrackFileResource * resources ; /**< Resource elements of the Virtual Track */
9498} IMFTrackFileVirtualTrack ;
9599
96100/**
97101 * IMF Composition Playlist Virtual Track that consists of Marker Resources
98102 */
99103typedef struct IMFMarkerVirtualTrack {
100104 IMFBaseVirtualTrack base ;
101- unsigned long resource_count ;
102- IMFMarkerResource * resources ;
105+ unsigned long resource_count ; /**< Number of Resource elements present in the Virtual Track */
106+ IMFMarkerResource * resources ; /**< Resource elements of the Virtual Track */
103107} IMFMarkerVirtualTrack ;
104108
105109/**
106110 * IMF Composition Playlist
107111 */
108112typedef struct IMFCPL {
109- uint8_t id_uuid [16 ];
110- xmlChar * content_title_utf8 ;
111- AVRational edit_rate ;
112- IMFMarkerVirtualTrack * main_markers_track ;
113- IMFTrackFileVirtualTrack * main_image_2d_track ;
114- unsigned long main_audio_track_count ;
115- IMFTrackFileVirtualTrack * main_audio_tracks ;
113+ uint8_t id_uuid [16 ]; /**< CompositionPlaylist/Id element */
114+ xmlChar * content_title_utf8 ; /**< CompositionPlaylist/ContentTitle element */
115+ AVRational edit_rate ; /**< CompositionPlaylist/EditRate element */
116+ IMFMarkerVirtualTrack * main_markers_track ; /**< Main Marker Virtual Track */
117+ IMFTrackFileVirtualTrack * main_image_2d_track ; /**< Main Image Virtual Track */
118+ unsigned long main_audio_track_count ; /**< Number of Main Audio Virtual Tracks */
119+ IMFTrackFileVirtualTrack * main_audio_tracks ; /**< Main Audio Virtual Tracks */
116120} IMFCPL ;
117121
118122/**
@@ -131,12 +135,37 @@ typedef struct IMFAssetMap {
131135 IMFAssetLocator * * assets ;
132136} IMFAssetMap ;
133137
138+ /**
139+ * Parse an IMF CompositionPlaylist element into the IMFCPL data structure.
140+ * @param[in] doc An XML document from which the CPL is read.
141+ * @param[out] cpl Pointer to a memory area (allocated by the client), where the function writes a pointer to the newly constructed
142+ * IMFCPL structure (or NULL if the CPL could not be parsed). The client is responsible for freeing the IMFCPL structure using
143+ * imf_cpl_free().
144+ * @return A non-zero value in case of an error.
145+ */
134146int parse_imf_cpl_from_xml_dom (xmlDocPtr doc , IMFCPL * * cpl );
135147
148+ /**
149+ * Parse an IMF Composition Playlist document into the IMFCPL data structure.
150+ * @param[in] in The context from which the CPL is read.
151+ * @param[out] cpl Pointer to a memory area (allocated by the client), where the function writes a pointer to the newly constructed
152+ * IMFCPL structure (or NULL if the CPL could not be parsed). The client is responsible for freeing the IMFCPL structure using
153+ * imf_cpl_free().
154+ * @return A non-zero value in case of an error.
155+ */
136156int parse_imf_cpl (AVIOContext * in , IMFCPL * * cpl );
137157
158+ /**
159+ * Allocates and initializes an IMFCPL data structure.
160+ * @return A pointer to the newly constructed IMFCPL structure (or NULL if the structure could not be constructed). The client is
161+ * responsible for freeing the IMFCPL structure using imf_cpl_free().
162+ */
138163IMFCPL * imf_cpl_alloc (void );
139164
165+ /**
166+ * Deletes an IMFCPL data structure previously instantiated with imf_cpl_alloc().
167+ * @param[in] cpl The IMFCPL structure to delete.
168+ */
140169void imf_cpl_free (IMFCPL * cpl );
141170
142171/**
0 commit comments