summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2008-11-30 17:42:30 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-11-30 17:42:30 +0000
commitd1242d04a1487f4db2e9b27643204332fd316b20 (patch)
tree705658c565f3283f02a6962d911b93c0a0d10e78
parentc6d653d945ff9527c0e9933f8fd92e0a965459d7 (diff)
downloadgst-plugins-bad-d1242d04a1487f4db2e9b27643204332fd316b20.tar.gz
gst-plugins-bad-d1242d04a1487f4db2e9b27643204332fd316b20.tar.bz2
gst-plugins-bad-d1242d04a1487f4db2e9b27643204332fd316b20.zip
gst/mxf/: Some random cleanup.
Original commit message from CVS: * gst/mxf/mxfalaw.c: (mxf_is_alaw_essence_track): * gst/mxf/mxfalaw.h: * gst/mxf/mxfdemux.c: (gst_mxf_demux_handle_header_metadata_update_streams): * gst/mxf/mxfjpeg2000.c: (mxf_is_jpeg2000_essence_track): * gst/mxf/mxfjpeg2000.h: * gst/mxf/mxfmpeg.c: (mxf_is_mpeg_essence_track), (mxf_mpeg_es_create_caps), (mxf_mpeg_create_caps): * gst/mxf/mxfmpeg.h: Some random cleanup.
-rw-r--r--ChangeLog13
-rw-r--r--gst/mxf/mxfalaw.c6
-rw-r--r--gst/mxf/mxfalaw.h2
-rw-r--r--gst/mxf/mxfdemux.c17
-rw-r--r--gst/mxf/mxfjpeg2000.c6
-rw-r--r--gst/mxf/mxfjpeg2000.h2
-rw-r--r--gst/mxf/mxfmpeg.c136
-rw-r--r--gst/mxf/mxfmpeg.h4
8 files changed, 114 insertions, 72 deletions
diff --git a/ChangeLog b/ChangeLog
index cc3e4234..d966da55 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2008-11-30 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ * gst/mxf/mxfalaw.c: (mxf_is_alaw_essence_track):
+ * gst/mxf/mxfalaw.h:
+ * gst/mxf/mxfdemux.c:
+ (gst_mxf_demux_handle_header_metadata_update_streams):
+ * gst/mxf/mxfjpeg2000.c: (mxf_is_jpeg2000_essence_track):
+ * gst/mxf/mxfjpeg2000.h:
+ * gst/mxf/mxfmpeg.c: (mxf_is_mpeg_essence_track),
+ (mxf_mpeg_es_create_caps), (mxf_mpeg_create_caps):
+ * gst/mxf/mxfmpeg.h:
+ Some random cleanup.
+
+2008-11-30 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
* gst/mxf/mxfdemux.c: (gst_mxf_demux_remove_pads),
(gst_mxf_demux_reset), (gst_mxf_demux_find_package),
(gst_mxf_demux_choose_package),
diff --git a/gst/mxf/mxfalaw.c b/gst/mxf/mxfalaw.c
index d0bb113f..b82ff7bb 100644
--- a/gst/mxf/mxfalaw.c
+++ b/gst/mxf/mxfalaw.c
@@ -34,7 +34,7 @@ GST_DEBUG_CATEGORY_EXTERN (mxf_debug);
#define GST_CAT_DEFAULT mxf_debug
gboolean
-mxf_is_alaw_audio_essence_track (const MXFMetadataTrack * track)
+mxf_is_alaw_essence_track (const MXFMetadataTrack * track)
{
guint i;
@@ -99,8 +99,8 @@ mxf_alaw_create_caps (MXFMetadataGenericPackage * package,
s = (MXFMetadataGenericSoundEssenceDescriptor *) 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];
diff --git a/gst/mxf/mxfalaw.h b/gst/mxf/mxfalaw.h
index 5c19a309..20883fdf 100644
--- a/gst/mxf/mxfalaw.h
+++ b/gst/mxf/mxfalaw.h
@@ -28,7 +28,7 @@
#include "mxfparse.h"
-gboolean mxf_is_alaw_audio_essence_track (const MXFMetadataTrack *track);
+gboolean mxf_is_alaw_essence_track (const MXFMetadataTrack *track);
GstCaps *
mxf_alaw_create_caps (MXFMetadataGenericPackage *package, MXFMetadataTrack *track, GstTagList **tags, MXFEssenceElementHandler *handler, gpointer *mapping_data);
diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c
index 75726888..6aebcf10 100644
--- a/gst/mxf/mxfdemux.c
+++ b/gst/mxf/mxfdemux.c
@@ -1305,9 +1305,8 @@ gst_mxf_demux_handle_header_metadata_resolve_references (GstMXFDemux * demux)
MXFMetadataEssenceContainerData, i);
for (j = 0; j < demux->content_storage.n_essence_container_data; j++) {
- if (mxf_ul_is_equal (&demux->
- content_storage.essence_container_data_uids[j],
- &data->instance_uid)) {
+ if (mxf_ul_is_equal (&demux->content_storage.
+ essence_container_data_uids[j], &data->instance_uid)) {
demux->content_storage.essence_container_data[j] = data;
break;
}
@@ -1865,15 +1864,15 @@ gst_mxf_demux_handle_header_metadata_update_streams (GstMXFDemux * demux)
switch (track_type) {
case MXF_METADATA_TRACK_PICTURE_ESSENCE:
- if (mxf_is_mpeg_video_essence_track (source_track))
+ if (mxf_is_mpeg_essence_track (source_track))
caps =
- mxf_mpeg_video_create_caps (source_package, source_track,
+ mxf_mpeg_create_caps (source_package, source_track,
&pad->tags, &pad->handle_essence_element, &pad->mapping_data);
else if (mxf_is_dv_dif_essence_track (source_track))
caps =
mxf_dv_dif_create_caps (source_package, source_track,
&pad->tags, &pad->handle_essence_element, &pad->mapping_data);
- else if (mxf_is_jpeg2000_video_essence_track (source_track))
+ else if (mxf_is_jpeg2000_essence_track (source_track))
caps =
mxf_jpeg2000_create_caps (source_package, source_track,
&pad->tags, &pad->handle_essence_element, &pad->mapping_data);
@@ -1887,10 +1886,14 @@ gst_mxf_demux_handle_header_metadata_update_streams (GstMXFDemux * demux)
caps =
mxf_dv_dif_create_caps (source_package, source_track,
&pad->tags, &pad->handle_essence_element, &pad->mapping_data);
- else if (mxf_is_alaw_audio_essence_track (source_track))
+ else if (mxf_is_alaw_essence_track (source_track))
caps =
mxf_alaw_create_caps (source_package, source_track,
&pad->tags, &pad->handle_essence_element, &pad->mapping_data);
+ else if (mxf_is_mpeg_essence_track (source_track))
+ caps =
+ mxf_mpeg_create_caps (source_package, source_track,
+ &pad->tags, &pad->handle_essence_element, &pad->mapping_data);
break;
case MXF_METADATA_TRACK_DATA_ESSENCE:
if (mxf_is_dv_dif_essence_track (source_track))
diff --git a/gst/mxf/mxfjpeg2000.c b/gst/mxf/mxfjpeg2000.c
index 31699ec4..e480f894 100644
--- a/gst/mxf/mxfjpeg2000.c
+++ b/gst/mxf/mxfjpeg2000.c
@@ -38,7 +38,7 @@ GST_DEBUG_CATEGORY_EXTERN (mxf_debug);
#define GST_CAT_DEFAULT mxf_debug
gboolean
-mxf_is_jpeg2000_video_essence_track (const MXFMetadataTrack * track)
+mxf_is_jpeg2000_essence_track (const MXFMetadataTrack * track)
{
guint i;
@@ -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];
diff --git a/gst/mxf/mxfjpeg2000.h b/gst/mxf/mxfjpeg2000.h
index 700736b4..784c19e8 100644
--- a/gst/mxf/mxfjpeg2000.h
+++ b/gst/mxf/mxfjpeg2000.h
@@ -28,7 +28,7 @@
#include "mxfparse.h"
-gboolean mxf_is_jpeg2000_video_essence_track (const MXFMetadataTrack *track);
+gboolean mxf_is_jpeg2000_essence_track (const MXFMetadataTrack *track);
GstCaps *
mxf_jpeg2000_create_caps (MXFMetadataGenericPackage *package, MXFMetadataTrack *track, GstTagList **tags, MXFEssenceElementHandler *handler, gpointer *mapping_data);
diff --git a/gst/mxf/mxfmpeg.c b/gst/mxf/mxfmpeg.c
index 9c734d62..10d0373f 100644
--- a/gst/mxf/mxfmpeg.c
+++ b/gst/mxf/mxfmpeg.c
@@ -24,6 +24,7 @@
/* TODO:
* - Handle PES streams
* - Fix TS/PS demuxers to forward timestamps
+ * - Handle sound/data somehow
*/
#ifdef HAVE_CONFIG_H
@@ -195,7 +196,7 @@ void mxf_metadata_mpeg_video_descriptor_reset
}
gboolean
-mxf_is_mpeg_video_essence_track (const MXFMetadataTrack * track)
+mxf_is_mpeg_essence_track (const MXFMetadataTrack * track)
{
guint i;
@@ -243,14 +244,84 @@ static const guint8 sony_mpeg4_extradata[] = {
0x01, 0x00, 0x00
};
+static GstCaps *
+mxf_mpeg_es_create_caps (MXFMetadataGenericPackage * package,
+ MXFMetadataTrack * track, GstTagList ** tags,
+ MXFEssenceElementHandler * handler, gpointer * mapping_data,
+ MXFMetadataFileDescriptor * f,
+ MXFMetadataGenericPictureEssenceDescriptor * p,
+ MXFMetadataGenericSoundEssenceDescriptor * s,
+ MXFMetadataMPEGVideoDescriptor * d)
+{
+ GstCaps *caps = 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;
+ }
+
+ if (caps)
+ *handler = mxf_mpeg_video_handle_essence_element;
+
+ return caps;
+}
+
GstCaps *
-mxf_mpeg_video_create_caps (MXFMetadataGenericPackage * package,
+mxf_mpeg_create_caps (MXFMetadataGenericPackage * package,
MXFMetadataTrack * track, GstTagList ** tags,
MXFEssenceElementHandler * handler, gpointer * mapping_data)
{
MXFMetadataMPEGVideoDescriptor *d = NULL;
MXFMetadataFileDescriptor *f = NULL;
MXFMetadataGenericPictureEssenceDescriptor *p = NULL;
+ MXFMetadataGenericSoundEssenceDescriptor *s = NULL;
guint i;
GstCaps *caps = NULL;
@@ -277,6 +348,11 @@ mxf_mpeg_video_create_caps (MXFMetadataGenericPackage * package,
p = (MXFMetadataGenericPictureEssenceDescriptor *) track->descriptor[i];
break;
} else if (((MXFMetadataGenericDescriptor *) track->descriptor[i])->type ==
+ MXF_METADATA_GENERIC_SOUND_ESSENCE_DESCRIPTOR) {
+ f = track->descriptor[i];
+ s = (MXFMetadataGenericSoundEssenceDescriptor *) track->descriptor[i];
+ break;
+ } else if (((MXFMetadataGenericDescriptor *) track->descriptor[i])->type ==
MXF_METADATA_FILE_DESCRIPTOR) {
f = track->descriptor[i];
}
@@ -287,62 +363,13 @@ mxf_mpeg_video_create_caps (MXFMetadataGenericPackage * package,
return NULL;
}
- *handler = mxf_mpeg_video_handle_essence_element;
/* SMPTE 381M 7 */
if (f->essence_container.u[13] == 0x04) {
GST_DEBUG ("Found MPEG ES stream");
- /* 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;
- }
+ caps =
+ mxf_mpeg_es_create_caps (package, track, tags, handler, mapping_data, f,
+ p, s, d);
} else if (f->essence_container.u[13] == 0x07) {
GST_ERROR ("MPEG PES streams not supported yet");
return NULL;
@@ -354,7 +381,6 @@ mxf_mpeg_video_create_caps (MXFMetadataGenericPackage * package,
} else if (f->essence_container.u[13] == 0x09) {
GST_DEBUG ("Found MPEG TS stream");
caps = gst_caps_new_simple ("video/mpegts", NULL);
-
}
if (p)
diff --git a/gst/mxf/mxfmpeg.h b/gst/mxf/mxfmpeg.h
index be3e765f..16258a55 100644
--- a/gst/mxf/mxfmpeg.h
+++ b/gst/mxf/mxfmpeg.h
@@ -52,9 +52,9 @@ typedef struct {
gboolean mxf_metadata_mpeg_video_descriptor_handle_tag (MXFMetadataGenericDescriptor *descriptor, const MXFPrimerPack *primer, guint16 tag, const guint8 *tag_data, guint16 tag_size);
void mxf_metadata_mpeg_video_descriptor_reset (MXFMetadataMPEGVideoDescriptor *descriptor);
-gboolean mxf_is_mpeg_video_essence_track (const MXFMetadataTrack *track);
+gboolean mxf_is_mpeg_essence_track (const MXFMetadataTrack *track);
GstCaps *
-mxf_mpeg_video_create_caps (MXFMetadataGenericPackage *package, MXFMetadataTrack *track, GstTagList **tags, MXFEssenceElementHandler *handler, gpointer *mapping_data);
+mxf_mpeg_create_caps (MXFMetadataGenericPackage *package, MXFMetadataTrack *track, GstTagList **tags, MXFEssenceElementHandler *handler, gpointer *mapping_data);
#endif /* __MXF_MPEG_H__ */