mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
gst/mxf/: Set the correct MPEG video version if possible and add support for MPEG4 video, including codec_data.
Original commit message from CVS: * gst/mxf/mxfjpeg2000.c: (mxf_jpeg2000_create_caps): * gst/mxf/mxfmpeg.c: (mxf_mpeg_video_create_caps): Set the correct MPEG video version if possible and add support for MPEG4 video, including codec_data.
This commit is contained in:
parent
70281aa4e4
commit
8128aef461
3 changed files with 69 additions and 6 deletions
|
@ -1,3 +1,10 @@
|
|||
2008-11-30 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
||||
|
||||
* gst/mxf/mxfjpeg2000.c: (mxf_jpeg2000_create_caps):
|
||||
* gst/mxf/mxfmpeg.c: (mxf_mpeg_video_create_caps):
|
||||
Set the correct MPEG video version if possible and add support
|
||||
for MPEG4 video, including codec_data.
|
||||
|
||||
2008-11-29 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
||||
|
||||
* gst/mxf/Makefile.am:
|
||||
|
|
|
@ -106,8 +106,8 @@ mxf_jpeg2000_create_caps (MXFMetadataGenericPackage * package,
|
|||
p = (MXFMetadataGenericPictureEssenceDescriptor *) track->descriptor[i];
|
||||
f = track->descriptor[i];
|
||||
break;
|
||||
} else if (((MXFMetadataGenericDescriptor *) track->descriptor[i])->
|
||||
is_file_descriptor
|
||||
} else if (((MXFMetadataGenericDescriptor *) track->
|
||||
descriptor[i])->is_file_descriptor
|
||||
&& ((MXFMetadataGenericDescriptor *) track->descriptor[i])->type !=
|
||||
MXF_METADATA_MULTIPLE_DESCRIPTOR) {
|
||||
f = track->descriptor[i];
|
||||
|
@ -121,7 +121,8 @@ mxf_jpeg2000_create_caps (MXFMetadataGenericPackage * package,
|
|||
|
||||
*handler = mxf_jpeg2000_handle_essence_element;
|
||||
|
||||
caps = gst_caps_new_simple ("image/jp2", NULL);
|
||||
/* TODO: What about other field values? */
|
||||
caps = gst_caps_new_simple ("image/x-j2c", "fields", G_TYPE_INT, 1, NULL);
|
||||
if (p) {
|
||||
mxf_metadata_generic_picture_essence_descriptor_set_caps (p, caps);
|
||||
} else {
|
||||
|
|
|
@ -236,6 +236,12 @@ mxf_mpeg_video_handle_essence_element (const MXFUL * key, GstBuffer * buffer,
|
|||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
/* Private uid used by SONY C0023S01.mxf,
|
||||
* taken from the ffmpeg mxf demuxer */
|
||||
static const guint8 sony_mpeg4_extradata[] = {
|
||||
0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x01, 0x0e, 0x06, 0x06, 0x02, 0x02,
|
||||
0x01, 0x00, 0x00
|
||||
};
|
||||
|
||||
GstCaps *
|
||||
mxf_mpeg_video_create_caps (MXFMetadataGenericPackage * package,
|
||||
|
@ -284,10 +290,59 @@ mxf_mpeg_video_create_caps (MXFMetadataGenericPackage * package,
|
|||
*handler = mxf_mpeg_video_handle_essence_element;
|
||||
/* SMPTE 381M 7 */
|
||||
if (f->essence_container.u[13] == 0x04) {
|
||||
/* FIXME: get mpeg version somehow */
|
||||
GST_DEBUG ("Found MPEG ES stream");
|
||||
caps = gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 1,
|
||||
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
|
||||
|
||||
/* SMPTE RP224 */
|
||||
if (!p || mxf_ul_is_zero (&p->picture_essence_coding)) {
|
||||
GST_WARNING
|
||||
("No picture essence descriptor or no picture essence coding defined");
|
||||
caps =
|
||||
gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 2,
|
||||
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
|
||||
} else if (p->picture_essence_coding.u[0] != 0x06
|
||||
|| p->picture_essence_coding.u[1] != 0x0e
|
||||
|| p->picture_essence_coding.u[2] != 0x2b
|
||||
|| p->picture_essence_coding.u[3] != 0x34
|
||||
|| p->picture_essence_coding.u[4] != 0x04
|
||||
|| p->picture_essence_coding.u[5] != 0x01
|
||||
|| p->picture_essence_coding.u[6] != 0x01
|
||||
|| p->picture_essence_coding.u[8] != 0x04
|
||||
|| p->picture_essence_coding.u[9] != 0x01
|
||||
|| p->picture_essence_coding.u[10] != 0x02
|
||||
|| p->picture_essence_coding.u[11] != 0x02
|
||||
|| p->picture_essence_coding.u[12] != 0x01) {
|
||||
GST_ERROR ("No MPEG picture essence coding");
|
||||
caps = NULL;
|
||||
} else if (p->picture_essence_coding.u[13] >= 0x01 &&
|
||||
p->picture_essence_coding.u[13] <= 0x08) {
|
||||
caps = gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 2,
|
||||
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
|
||||
} else if (p->picture_essence_coding.u[13] == 0x10) {
|
||||
caps = gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 1,
|
||||
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
|
||||
} else if (p->picture_essence_coding.u[13] == 0x20) {
|
||||
MXFLocalTag *local_tag =
|
||||
(((MXFMetadataGenericDescriptor *) f)->
|
||||
other_tags) ? g_hash_table_lookup (((MXFMetadataGenericDescriptor *)
|
||||
f)->other_tags, &sony_mpeg4_extradata) : NULL;
|
||||
|
||||
caps = gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 4,
|
||||
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
|
||||
|
||||
if (local_tag) {
|
||||
GstBuffer *codec_data = NULL;
|
||||
codec_data = gst_buffer_new_and_alloc (local_tag->size);
|
||||
memcpy (GST_BUFFER_DATA (codec_data), local_tag->data, local_tag->size);
|
||||
gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, codec_data,
|
||||
NULL);
|
||||
gst_buffer_unref (codec_data);
|
||||
}
|
||||
|
||||
} else {
|
||||
GST_ERROR ("Unsupported MPEG picture essence coding 0x%02x",
|
||||
p->picture_essence_coding.u[13]);
|
||||
caps = NULL;
|
||||
}
|
||||
} else if (f->essence_container.u[13] == 0x07) {
|
||||
GST_ERROR ("MPEG PES streams not supported yet");
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in a new issue