Go to the documentation of this file.
57 #include <libxml/parser.h>
61 xmlNodePtr cur_element;
63 cur_element = xmlFirstElementChild(parent);
65 if (xmlStrcmp(cur_element->name, name_utf8) == 0)
68 cur_element = xmlNextElementSibling(cur_element);
77 xmlChar *element_text = xmlNodeListGetString(element->doc, element->xmlChildrenNode, 1);
81 xmlFree(element_text);
90 xmlChar *element_text = xmlNodeListGetString(element->doc, element->xmlChildrenNode, 1);
91 if (sscanf(element_text,
"%i %i", &rational->
num, &rational->
den) != 2)
93 xmlFree(element_text);
102 xmlChar *element_text = xmlNodeListGetString(element->doc, element->xmlChildrenNode, 1);
103 if (sscanf(element_text,
"%" PRIu32, number) != 1)
105 xmlFree(element_text);
114 xmlChar *element_text = xmlNodeListGetString(element->doc, element->xmlChildrenNode, 1);
115 if (xmlStrcmp(element_text,
"true") == 0 || xmlStrcmp(element_text,
"1") == 0)
117 else if (xmlStrcmp(element_text,
"false") == 0 || xmlStrcmp(element_text,
"0") == 0)
121 xmlFree(element_text);
134 track->resource_count = 0;
135 track->resources =
NULL;
141 track->resource_count = 0;
142 track->resources_alloc_sz = 0;
143 track->resources =
NULL;
157 rsrc->marker_count = 0;
158 rsrc->markers =
NULL;
171 memset(rsrc->track_file_uuid, 0,
sizeof(rsrc->track_file_uuid));
176 xmlNodePtr element =
NULL;
181 element->xmlChildrenNode,
189 if (digit >=
'0' && digit <=
'9')
207 for (
int i = 0;
i < 4;
i++) {
214 if (hi == -1 || lo == -1)
217 tc_comps[
i] = 10 * hi + lo;
225 xmlNodePtr tc_element =
NULL;
226 xmlNodePtr element =
NULL;
227 xmlChar *tc_str =
NULL;
247 tc_str = xmlNodeListGetString(element->doc, element->xmlChildrenNode, 1);
258 comps[0], comps[1], comps[2], comps[3],
266 xmlNodePtr element =
NULL;
276 xmlNodePtr element =
NULL;
286 xmlNodePtr element =
NULL;
300 if (!(marker->
label_utf8 = xmlNodeListGetString(element->doc, element->xmlChildrenNode, 1)))
303 if (!(marker->
scope_utf8 = xmlGetNoNsProp(element,
"scope"))) {
305 = xmlCharStrdup(
"http://www.smpte-ra.org/schemas/2067-3/2013#standard-markers");
318 xmlNodePtr element =
NULL;
345 av_log(log_ctx,
AV_LOG_ERROR,
"Invalid IntrinsicDuration element found in a Resource\n");
369 xmlNodePtr element =
NULL;
393 xmlNodePtr element =
NULL;
400 element = xmlFirstElementChild(marker_resource_elem);
402 if (xmlStrcmp(element->name,
"Marker") == 0) {
405 if (marker_resource->marker_count == UINT32_MAX)
408 marker_resource->marker_count + 1,
412 marker_resource->markers =
tmp;
414 imf_marker_init(&marker_resource->markers[marker_resource->marker_count]);
416 &marker_resource->markers[marker_resource->marker_count]);
417 marker_resource->marker_count++;
424 element = xmlNextElementSibling(element);
434 xmlNodePtr resource_list_elem =
NULL;
435 xmlNodePtr resource_elem =
NULL;
436 xmlNodePtr track_id_elem =
NULL;
437 unsigned long resource_elem_count;
451 "Processing IMF CPL Marker Sequence for Virtual Track " AV_PRI_UUID "\n",
469 if (!resource_list_elem)
472 resource_elem_count = xmlChildElementCount(resource_list_elem);
473 if (resource_elem_count > UINT32_MAX
485 resource_elem = xmlFirstElementChild(resource_list_elem);
486 while (resource_elem) {
495 resource_elem = xmlNextElementSibling(resource_elem);
503 if (xmlStrcmp(element->name,
"Left") == 0 || xmlStrcmp(element->name,
"Right") == 0)
506 element = xmlFirstElementChild(element);
511 element = xmlNextElementSibling(element);
521 xmlNodePtr resource_list_elem =
NULL;
522 xmlNodePtr resource_elem =
NULL;
523 xmlNodePtr track_id_elem =
NULL;
524 unsigned long resource_elem_count;
539 "Processing IMF CPL Audio Sequence for Virtual Track " AV_PRI_UUID "\n",
569 if (!resource_list_elem)
572 resource_elem_count = xmlChildElementCount(resource_list_elem);
573 if (resource_elem_count > UINT32_MAX
586 resource_elem = xmlFirstElementChild(resource_list_elem);
587 while (resource_elem) {
597 resource_elem = xmlNextElementSibling(resource_elem);
607 xmlNodePtr resource_list_elem =
NULL;
608 xmlNodePtr resource_elem =
NULL;
609 xmlNodePtr track_id_elem =
NULL;
611 unsigned long resource_elem_count;
615 av_log(log_ctx,
AV_LOG_ERROR,
"Stereoscopic 3D image virtual tracks not supported\n");
643 "Processing IMF CPL Main Image Sequence for Virtual Track " AV_PRI_UUID "\n",
648 if (!resource_list_elem)
651 resource_elem_count = xmlChildElementCount(resource_list_elem);
652 if (resource_elem_count > UINT32_MAX
667 resource_elem = xmlFirstElementChild(resource_list_elem);
668 while (resource_elem) {
679 resource_elem = xmlNextElementSibling(resource_elem);
688 xmlNodePtr segment_list_elem =
NULL;
689 xmlNodePtr segment_elem =
NULL;
690 xmlNodePtr sequence_list_elem =
NULL;
691 xmlNodePtr sequence_elem =
NULL;
699 segment_elem = xmlFirstElementChild(segment_list_elem);
700 while (segment_elem) {
704 if (!sequence_list_elem)
707 sequence_elem = xmlFirstElementChild(sequence_list_elem);
708 while (sequence_elem) {
709 if (xmlStrcmp(sequence_elem->name,
"MarkerSequence") == 0)
712 else if (xmlStrcmp(sequence_elem->name,
"MainImageSequence") == 0)
715 else if (xmlStrcmp(sequence_elem->name,
"MainAudioSequence") == 0)
721 "The following Sequence is not supported and is ignored: %s\n",
722 sequence_elem->name);
728 sequence_elem = xmlNextElementSibling(sequence_elem);
731 segment_elem = xmlNextElementSibling(segment_elem);
740 xmlNodePtr cpl_element =
NULL;
748 cpl_element = xmlDocGetRootElement(doc);
749 if (!cpl_element || xmlStrcmp(cpl_element->name,
"CompositionPlaylist")) {
750 av_log(log_ctx,
AV_LOG_ERROR,
"The root element of the CPL is not CompositionPlaylist\n");
756 av_log(log_ctx,
AV_LOG_ERROR,
"Cannot read the ContentTitle element from the IMF CPL\n");
768 av_log(log_ctx,
AV_LOG_ERROR,
"Invalid CompositionTimecode element found in the IMF CPL\n");
885 doc = xmlReadMemory(buf.str, buf.len,
NULL,
NULL, 0);
889 "XML parsing failed when reading the IMF CPL\n");
899 "IMF CPL ContentTitle: %s\n",
900 (*cpl)->content_title_utf8);
static void imf_base_virtual_track_init(FFIMFBaseVirtualTrack *track)
FFIMFTrackFileResource * resources
Resource elements of the Virtual Track.
AVUUID id_uuid
CompositionPlaylist/Id element.
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.
int ff_imf_parse_cpl(void *log_ctx, AVIOContext *in, FFIMFCPL **cpl)
Parse an IMF Composition Playlist document into the FFIMFCPL data structure.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
uint8_t AVUUID[AV_UUID_LEN]
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
void ff_imf_cpl_free(FFIMFCPL *cpl)
Deletes an FFIMFCPL data structure previously instantiated with ff_imf_cpl_alloc().
static void imf_marker_free(FFIMFMarker *marker)
FFIMFMarkerResource * resources
Resource elements of the Virtual Track.
FFIMFCPL * ff_imf_cpl_alloc(void)
Allocates and initializes an FFIMFCPL data structure.
static av_cold void cleanup(FlashSV2Context *s)
uint32_t resource_count
Number of Resource elements present in the Virtual Track.
static void imf_trackfile_virtual_track_init(FFIMFTrackFileVirtualTrack *track)
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.
static int digit_to_int(char digit)
IMF Composition Playlist Virtual Track that consists of Marker Resources.
xmlChar * content_title_utf8
CompositionPlaylist/ContentTitle element.
FFIMFTrackFileVirtualTrack * main_audio_tracks
Main Audio Virtual Tracks.
static void imf_cpl_init(FFIMFCPL *cpl)
static int fill_marker_resource(void *log_ctx, xmlNodePtr marker_resource_elem, FFIMFMarkerResource *marker_resource, FFIMFCPL *cpl)
uint32_t duration
BaseResourceType/Duration.
FFIMFMarkerVirtualTrack * main_markers_track
Main Marker Virtual Track.
AVTimecode * tc
CompositionPlaylist/CompositionTimecode element.
static void imf_marker_virtual_track_free(FFIMFMarkerVirtualTrack *vt)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
IMF Composition Playlist Virtual Track that consists of Track File Resources.
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given buffer if it is not large enough, otherwise do nothing.
static void imf_base_resource_init(FFIMFBaseResource *rsrc)
int avio_read_to_bprint(AVIOContext *h, struct AVBPrint *pb, size_t max_size)
Read contents of h into print buffer, up to max_size bytes, or up to EOF.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
static void imf_marker_virtual_track_init(FFIMFMarkerVirtualTrack *track)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static void imf_trackfile_resource_init(FFIMFTrackFileResource *rsrc)
int ff_imf_xml_read_uint32(xmlNodePtr element, uint32_t *number)
Reads an unsigned 32-bit integer from an XML element.
AVRational edit_rate
CompositionPlaylist/EditRate element.
unsigned int resources_alloc_sz
Size of the resources buffer.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
IMF Composition Playlist Virtual Track.
IMF Composition Playlist Base Resource.
Rational number (pair of numerator and denominator).
size_t static size_t av_strnlen(const char *s, size_t len)
Get the count of continuous non zero chars starting from the beginning.
static int fill_timecode(xmlNodePtr cpl_element, FFIMFCPL *cpl)
FFIMFBaseVirtualTrack base
static int fill_trackfile_resource(void *log_ctx, xmlNodePtr tf_resource_elem, FFIMFTrackFileResource *tf_resource, FFIMFCPL *cpl)
static int push_main_image_2d_sequence(void *log_ctx, xmlNodePtr image_sequence_elem, FFIMFCPL *cpl)
FFIMFBaseVirtualTrack base
static int has_stereo_resources(xmlNodePtr element)
int av_timecode_init_from_components(AVTimecode *tc, AVRational rate, int flags, int hh, int mm, int ss, int ff, void *log_ctx)
Init a timecode struct from the passed timecode components.
AVRational edit_rate
BaseResourceType/EditRate.
static int push_marker_sequence(void *log_ctx, xmlNodePtr marker_sequence_elem, FFIMFCPL *cpl)
static int fill_content_title(xmlNodePtr cpl_element, FFIMFCPL *cpl)
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
static int fill_virtual_tracks(void *log_ctx, xmlNodePtr cpl_element, FFIMFCPL *cpl)
int ff_imf_xml_read_uuid(xmlNodePtr element, AVUUID uuid)
Reads a UUID from an XML element.
static int fill_marker(xmlNodePtr marker_elem, FFIMFMarker *marker)
static AVRational av_make_q(int num, int den)
Create an AVRational.
static void imf_marker_resource_free(FFIMFMarkerResource *rsrc)
static int push_main_audio_sequence(void *log_ctx, xmlNodePtr audio_sequence_elem, FFIMFCPL *cpl)
static int fill_base_resource(void *log_ctx, xmlNodePtr resource_elem, FFIMFBaseResource *resource, FFIMFCPL *cpl)
static int fill_id(xmlNodePtr cpl_element, FFIMFCPL *cpl)
static void av_uuid_nil(AVUUID uu)
Sets a UUID to the nil UUID, i.e.
uint32_t repeat_count
BaseResourceType/RepeatCount.
#define AV_LOG_INFO
Standard information.
static int av_uuid_equal(const AVUUID uu1, const AVUUID uu2)
Compares two UUIDs for equality.
#define i(width, name, range_min, range_max)
AVUUID id_uuid
TrackId associated with the Virtual Track.
uint32_t entry_point
BaseResourceType/EntryPoint.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
@ AV_TIMECODE_FLAG_DROPFRAME
timecode is drop frame
static int ff_imf_xml_read_boolean(xmlNodePtr element, int *value)
IMF Composition Playlist Marker Resource.
FFIMFMarker * markers
Marker elements.
int ff_imf_xml_read_rational(xmlNodePtr element, AVRational *rational)
Reads an AVRational from an XML element.
IMF Composition Playlist Track File Resource.
uint32_t offset
Marker/Offset.
static void imf_marker_resource_init(FFIMFMarkerResource *rsrc)
static void imf_marker_init(FFIMFMarker *marker)
uint32_t main_audio_track_count
Number of Main Audio Virtual Tracks.
uint32_t resource_count
Number of Resource elements present in the Virtual Track.
static void imf_trackfile_virtual_track_free(FFIMFTrackFileVirtualTrack *vt)
FFIMFTrackFileVirtualTrack * main_image_2d_track
Main Image Virtual Track.
uint32_t marker_count
Number of Marker elements.
static void av_uuid_copy(AVUUID dest, const AVUUID src)
Copies the bytes of src into dest.
IMF Composition Playlist.
Public header file for the processing of Interoperable Master Format (IMF) packages.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
xmlChar * label_utf8
Marker/Label.
xmlChar * scope_utf8
Marker/Label/@scope.
int av_uuid_urn_parse(const char *in, AVUUID uu)
Parses a URN representation of a UUID, as specified at IETF RFC 4122, into an AVUUID.
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.
static int fill_edit_rate(xmlNodePtr cpl_element, FFIMFCPL *cpl)
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.