mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
mxfdemux: Check validity of interleaved File Package
As specified by the S377 MXF core specification, if a file package has interleaved content, then all tracks must be using the same Edit Rate Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2378>
This commit is contained in:
parent
65a78effdb
commit
49b061241e
3 changed files with 34 additions and 0 deletions
|
@ -677,6 +677,7 @@ gst_mxf_demux_update_essence_tracks (GstMXFDemux * demux)
|
||||||
i++) {
|
i++) {
|
||||||
MXFMetadataEssenceContainerData *edata;
|
MXFMetadataEssenceContainerData *edata;
|
||||||
MXFMetadataSourcePackage *package;
|
MXFMetadataSourcePackage *package;
|
||||||
|
MXFFraction common_rate = { 0, 0 };
|
||||||
|
|
||||||
if (demux->preface->content_storage->essence_container_data[i] == NULL)
|
if (demux->preface->content_storage->essence_container_data[i] == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
@ -714,6 +715,34 @@ gst_mxf_demux_update_essence_tracks (GstMXFDemux * demux)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (package->is_interleaved) {
|
||||||
|
/*
|
||||||
|
* S377-1:2019 "9.4.2 The MXF timing model"
|
||||||
|
*
|
||||||
|
* The value of Edit Rate shall be identical for every timeline Essence
|
||||||
|
* Track of the Top-Level File Package.
|
||||||
|
*
|
||||||
|
* The value of Edit Rate of the timeline Essence Tracks of one
|
||||||
|
* Top-Level File Package need not match the Edit Rate of the Essence
|
||||||
|
* Tracks of the other Top-Level File Packages.
|
||||||
|
*
|
||||||
|
* S377-1:2019 "9.5.5 Top-Level File Packages"
|
||||||
|
*
|
||||||
|
*12. All Essence Tracks of a Top-Level File Package **shall** have the
|
||||||
|
* same value of Edit Rate. All other Tracks of a Top-Level File
|
||||||
|
* Package **should** have the same value of Edit Rate as the
|
||||||
|
* Essence Tracks.
|
||||||
|
*/
|
||||||
|
if (common_rate.n == 0 && common_rate.d == 0) {
|
||||||
|
common_rate = track->edit_rate;
|
||||||
|
} else if (common_rate.n * track->edit_rate.d !=
|
||||||
|
common_rate.d * track->edit_rate.n) {
|
||||||
|
GST_ELEMENT_ERROR (demux, STREAM, WRONG_TYPE, (NULL),
|
||||||
|
("Interleaved File Package doesn't have identical edit rate on all tracks."));
|
||||||
|
return GST_FLOW_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (k = 0; k < demux->essence_tracks->len; k++) {
|
for (k = 0; k < demux->essence_tracks->len; k++) {
|
||||||
GstMXFDemuxEssenceTrack *tmp =
|
GstMXFDemuxEssenceTrack *tmp =
|
||||||
&g_array_index (demux->essence_tracks, GstMXFDemuxEssenceTrack,
|
&g_array_index (demux->essence_tracks, GstMXFDemuxEssenceTrack,
|
||||||
|
|
|
@ -2247,6 +2247,8 @@ mxf_metadata_source_package_resolve (MXFMetadataBase * m, GHashTable * metadata)
|
||||||
|
|
||||||
d = MXF_METADATA_FILE_DESCRIPTOR (current);
|
d = MXF_METADATA_FILE_DESCRIPTOR (current);
|
||||||
|
|
||||||
|
self->is_interleaved = MXF_IS_METADATA_MULTIPLE_DESCRIPTOR (self->descriptor);
|
||||||
|
|
||||||
for (i = 0; i < package->n_tracks; i++) {
|
for (i = 0; i < package->n_tracks; i++) {
|
||||||
if (!package->tracks[i])
|
if (!package->tracks[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -509,6 +509,9 @@ struct _MXFMetadataSourcePackage
|
||||||
MXFMetadataGenericDescriptor *descriptor;
|
MXFMetadataGenericDescriptor *descriptor;
|
||||||
|
|
||||||
gboolean top_level;
|
gboolean top_level;
|
||||||
|
|
||||||
|
/* TRUE if descriptor is multi-descriptor, i.e. content is interleaved */
|
||||||
|
gboolean is_interleaved;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
Loading…
Reference in a new issue