mxfdemux: Add function to get the essence track wrapping

This commit is contained in:
Sebastian Dröge 2012-12-05 15:27:02 +01:00
parent 28c11b2762
commit 76ca3c77d7
9 changed files with 281 additions and 0 deletions

View file

@ -1124,6 +1124,45 @@ mxf_is_aes_bwf_essence_track (const MXFMetadataTimelineTrack * track)
return FALSE;
}
static MXFEssenceWrapping
mxf_aes_bwf_get_track_wrapping (const MXFMetadataTimelineTrack * track)
{
guint i;
g_return_val_if_fail (track != NULL, MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING);
if (track->parent.descriptor == NULL) {
GST_ERROR ("No descriptor found for this track");
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
}
for (i = 0; i < track->parent.n_descriptor; i++) {
if (!track->parent.descriptor[i])
continue;
if (!MXF_IS_METADATA_GENERIC_SOUND_ESSENCE_DESCRIPTOR (track->
parent.descriptor[i]))
continue;
switch (track->parent.descriptor[i]->essence_container.u[14]) {
case 0x01:
case 0x03:
return MXF_ESSENCE_WRAPPING_FRAME_WRAPPING;
break;
case 0x02:
case 0x04:
return MXF_ESSENCE_WRAPPING_CLIP_WRAPPING;
break;
case 0x08:
case 0x09:
default:
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
break;
}
}
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
}
static GstFlowReturn
mxf_bwf_handle_essence_element (const MXFUL * key, GstBuffer * buffer,
GstCaps * caps,
@ -1409,6 +1448,7 @@ mxf_aes_bwf_create_caps (MXFMetadataTimelineTrack * track, GstTagList ** tags,
static const MXFEssenceElementHandler mxf_aes_bwf_essence_handler = {
mxf_is_aes_bwf_essence_track,
mxf_aes_bwf_get_track_wrapping,
mxf_aes_bwf_create_caps
};

View file

@ -80,6 +80,42 @@ mxf_alaw_handle_essence_element (const MXFUL * key, GstBuffer * buffer,
return GST_FLOW_OK;
}
static MXFEssenceWrapping
mxf_alaw_get_track_wrapping (const MXFMetadataTimelineTrack * track)
{
guint i;
g_return_val_if_fail (track != NULL, MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING);
if (track->parent.descriptor == NULL) {
GST_ERROR ("No descriptor found for this track");
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
}
for (i = 0; i < track->parent.n_descriptor; i++) {
if (!track->parent.descriptor[i])
continue;
if (!MXF_IS_METADATA_GENERIC_SOUND_ESSENCE_DESCRIPTOR (track->parent.
descriptor[i]))
continue;
switch (track->parent.descriptor[i]->essence_container.u[14]) {
case 0x01:
return MXF_ESSENCE_WRAPPING_FRAME_WRAPPING;
break;
case 0x02:
return MXF_ESSENCE_WRAPPING_CLIP_WRAPPING;
break;
case 0x03:
default:
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
break;
}
}
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
}
static GstCaps *
mxf_alaw_create_caps (MXFMetadataTimelineTrack * track, GstTagList ** tags,
@ -136,6 +172,7 @@ mxf_alaw_create_caps (MXFMetadataTimelineTrack * track, GstTagList ** tags,
static const MXFEssenceElementHandler mxf_alaw_essence_element_handler = {
mxf_is_alaw_essence_track,
mxf_alaw_get_track_wrapping,
mxf_alaw_create_caps
};

View file

@ -166,6 +166,12 @@ mxf_d10_sound_handle_essence_element (const MXFUL * key, GstBuffer * buffer,
return GST_FLOW_OK;
}
static MXFEssenceWrapping
mxf_d10_get_track_wrapping (const MXFMetadataTimelineTrack * track)
{
return MXF_ESSENCE_WRAPPING_FRAME_WRAPPING;
}
static GstCaps *
mxf_d10_create_caps (MXFMetadataTimelineTrack * track, GstTagList ** tags,
MXFEssenceElementHandleFunc * handler, gpointer * mapping_data)
@ -257,6 +263,7 @@ mxf_d10_create_caps (MXFMetadataTimelineTrack * track, GstTagList ** tags,
static const MXFEssenceElementHandler mxf_d10_essence_element_handler = {
mxf_is_d10_essence_track,
mxf_d10_get_track_wrapping,
mxf_d10_create_caps
};

View file

@ -102,6 +102,41 @@ mxf_dv_dif_handle_essence_element (const MXFUL * key, GstBuffer * buffer,
return GST_FLOW_OK;
}
static MXFEssenceWrapping
mxf_dv_dif_get_track_wrapping (const MXFMetadataTimelineTrack * track)
{
guint i;
g_return_val_if_fail (track != NULL, MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING);
if (track->parent.descriptor == NULL) {
GST_ERROR ("No descriptor found for this track");
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
}
for (i = 0; i < track->parent.n_descriptor; i++) {
if (!track->parent.descriptor[i])
continue;
if (!MXF_IS_METADATA_GENERIC_PICTURE_ESSENCE_DESCRIPTOR (track->
parent.descriptor[i]))
continue;
switch (track->parent.descriptor[i]->essence_container.u[15]) {
case 0x01:
return MXF_ESSENCE_WRAPPING_FRAME_WRAPPING;
break;
case 0x02:
return MXF_ESSENCE_WRAPPING_CLIP_WRAPPING;
break;
default:
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
break;
}
}
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
}
static GstCaps *
mxf_dv_dif_create_caps (MXFMetadataTimelineTrack * track, GstTagList ** tags,
@ -151,6 +186,7 @@ mxf_dv_dif_create_caps (MXFMetadataTimelineTrack * track, GstTagList ** tags,
static const MXFEssenceElementHandler mxf_dv_dif_essence_element_handler = {
mxf_is_dv_dif_essence_track,
mxf_dv_dif_get_track_wrapping,
mxf_dv_dif_create_caps
};

View file

@ -26,10 +26,17 @@
#include "mxftypes.h"
#include "mxfmetadata.h"
typedef enum {
MXF_ESSENCE_WRAPPING_FRAME_WRAPPING,
MXF_ESSENCE_WRAPPING_CLIP_WRAPPING,
MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING
} MXFEssenceWrapping;
typedef GstFlowReturn (*MXFEssenceElementHandleFunc) (const MXFUL *key, GstBuffer *buffer, GstCaps *caps, MXFMetadataTimelineTrack *track, gpointer mapping_data, GstBuffer **outbuf);
typedef struct {
gboolean (*handles_track) (const MXFMetadataTimelineTrack *track);
MXFEssenceWrapping (*get_track_wrapping) (const MXFMetadataTimelineTrack *track);
GstCaps * (*create_caps) (MXFMetadataTimelineTrack *track, GstTagList **tags, MXFEssenceElementHandleFunc *handler, gpointer *mapping_data);
} MXFEssenceElementHandler;

View file

@ -85,6 +85,44 @@ mxf_jpeg2000_handle_essence_element (const MXFUL * key, GstBuffer * buffer,
return GST_FLOW_OK;
}
static MXFEssenceWrapping
mxf_jpeg2000_get_track_wrapping (const MXFMetadataTimelineTrack * track)
{
guint i;
g_return_val_if_fail (track != NULL, MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING);
if (track->parent.descriptor == NULL) {
GST_ERROR ("No descriptor found for this track");
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
}
for (i = 0; i < track->parent.n_descriptor; i++) {
if (!track->parent.descriptor[i])
continue;
if (!MXF_IS_METADATA_GENERIC_PICTURE_ESSENCE_DESCRIPTOR (track->
parent.descriptor[i])
&& !(MXF_IS_METADATA_FILE_DESCRIPTOR (track->parent.descriptor[i])
&& !MXF_IS_METADATA_MULTIPLE_DESCRIPTOR (track->
parent.descriptor[i])))
continue;
switch (track->parent.descriptor[i]->essence_container.u[14]) {
case 0x01:
return MXF_ESSENCE_WRAPPING_FRAME_WRAPPING;
break;
case 0x02:
return MXF_ESSENCE_WRAPPING_CLIP_WRAPPING;
break;
default:
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
break;
}
}
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
}
static GstCaps *
mxf_jpeg2000_create_caps (MXFMetadataTimelineTrack * track, GstTagList ** tags,
@ -201,6 +239,7 @@ mxf_jpeg2000_create_caps (MXFMetadataTimelineTrack * track, GstTagList ** tags,
static const MXFEssenceElementHandler mxf_jpeg2000_essence_element_handler = {
mxf_is_jpeg2000_essence_track,
mxf_jpeg2000_get_track_wrapping,
mxf_jpeg2000_create_caps
};

View file

@ -782,6 +782,44 @@ mxf_mpeg_es_create_caps (MXFMetadataTimelineTrack * track, GstTagList ** tags,
return caps;
}
static MXFEssenceWrapping
mxf_mpeg_get_track_wrapping (const MXFMetadataTimelineTrack * track)
{
guint i;
g_return_val_if_fail (track != NULL, MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING);
if (track->parent.descriptor == NULL) {
GST_ERROR ("No descriptor found for this track");
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
}
for (i = 0; i < track->parent.n_descriptor; i++) {
if (!track->parent.descriptor[i])
continue;
if (!MXF_IS_METADATA_GENERIC_PICTURE_ESSENCE_DESCRIPTOR (track->
parent.descriptor[i])
&& !MXF_IS_METADATA_GENERIC_SOUND_ESSENCE_DESCRIPTOR (track->
parent.descriptor[i]))
continue;
switch (track->parent.descriptor[i]->essence_container.u[15]) {
case 0x01:
return MXF_ESSENCE_WRAPPING_FRAME_WRAPPING;
break;
case 0x02:
return MXF_ESSENCE_WRAPPING_CLIP_WRAPPING;
break;
default:
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
break;
}
}
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
}
static GstCaps *
mxf_mpeg_create_caps (MXFMetadataTimelineTrack * track, GstTagList ** tags,
MXFEssenceElementHandleFunc * handler, gpointer * mapping_data)
@ -882,6 +920,7 @@ mxf_mpeg_create_caps (MXFMetadataTimelineTrack * track, GstTagList ** tags,
static const MXFEssenceElementHandler mxf_mpeg_essence_element_handler = {
mxf_is_mpeg_essence_track,
mxf_mpeg_get_track_wrapping,
mxf_mpeg_create_caps
};

View file

@ -193,6 +193,42 @@ mxf_up_handle_essence_element (const MXFUL * key, GstBuffer * buffer,
return GST_FLOW_OK;
}
static MXFEssenceWrapping
mxf_up_get_track_wrapping (const MXFMetadataTimelineTrack * track)
{
guint i;
g_return_val_if_fail (track != NULL, MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING);
if (track->parent.descriptor == NULL) {
GST_ERROR ("No descriptor found for this track");
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
}
for (i = 0; i < track->parent.n_descriptor; i++) {
if (!track->parent.descriptor[i])
continue;
if (!MXF_IS_METADATA_GENERIC_PICTURE_ESSENCE_DESCRIPTOR (track->
parent.descriptor[i]))
continue;
switch (track->parent.descriptor[i]->essence_container.u[15]) {
case 0x01:
return MXF_ESSENCE_WRAPPING_FRAME_WRAPPING;
break;
case 0x02:
return MXF_ESSENCE_WRAPPING_CLIP_WRAPPING;
break;
default:
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
break;
}
}
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
}
static GstCaps *
mxf_up_rgba_create_caps (MXFMetadataTimelineTrack * track,
MXFMetadataRGBAPictureEssenceDescriptor * d, GstTagList ** tags,
@ -346,6 +382,7 @@ mxf_up_create_caps (MXFMetadataTimelineTrack * track, GstTagList ** tags,
static const MXFEssenceElementHandler mxf_up_essence_element_handler = {
mxf_is_up_essence_track,
mxf_up_get_track_wrapping,
mxf_up_create_caps
};

View file

@ -97,6 +97,44 @@ mxf_vc3_handle_essence_element (const MXFUL * key, GstBuffer * buffer,
return GST_FLOW_OK;
}
static MXFEssenceWrapping
mxf_vc3_get_track_wrapping (const MXFMetadataTimelineTrack * track)
{
guint i;
g_return_val_if_fail (track != NULL, MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING);
if (track->parent.descriptor == NULL) {
GST_ERROR ("No descriptor found for this track");
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
}
for (i = 0; i < track->parent.n_descriptor; i++) {
if (!track->parent.descriptor[i])
continue;
if (!MXF_IS_METADATA_GENERIC_PICTURE_ESSENCE_DESCRIPTOR (track->
parent.descriptor[i])
&& !(MXF_IS_METADATA_FILE_DESCRIPTOR (track->parent.descriptor[i])
&& !MXF_IS_METADATA_MULTIPLE_DESCRIPTOR (track->
parent.descriptor[i])))
continue;
switch (track->parent.descriptor[i]->essence_container.u[15]) {
case 0x01:
return MXF_ESSENCE_WRAPPING_FRAME_WRAPPING;
break;
case 0x02:
return MXF_ESSENCE_WRAPPING_CLIP_WRAPPING;
break;
default:
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
break;
}
}
return MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING;
}
static GstCaps *
mxf_vc3_create_caps (MXFMetadataTimelineTrack * track, GstTagList ** tags,
@ -154,6 +192,7 @@ mxf_vc3_create_caps (MXFMetadataTimelineTrack * track, GstTagList ** tags,
static const MXFEssenceElementHandler mxf_vc3_essence_element_handler = {
mxf_is_vc3_essence_track,
mxf_vc3_get_track_wrapping,
mxf_vc3_create_caps
};