summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2008-12-01 15:24:37 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-12-01 15:24:37 +0000
commit65009ed81b1434e17c94928da2ca57f164e429aa (patch)
tree82e649e04c43220640a2edc4161f5dd5368a3473 /gst
parentcffc0f920726841aa7c41bd418402adae5812488 (diff)
downloadgst-plugins-bad-65009ed81b1434e17c94928da2ca57f164e429aa.tar.gz
gst-plugins-bad-65009ed81b1434e17c94928da2ca57f164e429aa.tar.bz2
gst-plugins-bad-65009ed81b1434e17c94928da2ca57f164e429aa.zip
gst/mxf/: Add the codec name, and if possible the avg bitrate, to the pad's taglist.
Original commit message from CVS: * gst/mxf/mxfaes-bwf.c: (mxf_bwf_create_caps): * gst/mxf/mxfalaw.c: (mxf_alaw_create_caps): * gst/mxf/mxfdemux.c: (gst_mxf_demux_handle_generic_container_essence_element): * gst/mxf/mxfdv-dif.c: (mxf_dv_dif_create_caps): * gst/mxf/mxfjpeg2000.c: (mxf_jpeg2000_create_caps): * gst/mxf/mxfmpeg.c: (mxf_mpeg_es_create_caps), (mxf_mpeg_create_caps): Add the codec name, and if possible the avg bitrate, to the pad's taglist.
Diffstat (limited to 'gst')
-rw-r--r--gst/mxf/mxfaes-bwf.c23
-rw-r--r--gst/mxf/mxfalaw.c34
-rw-r--r--gst/mxf/mxfdemux.c13
-rw-r--r--gst/mxf/mxfdv-dif.c10
-rw-r--r--gst/mxf/mxfjpeg2000.c9
-rw-r--r--gst/mxf/mxfmpeg.c24
6 files changed, 84 insertions, 29 deletions
diff --git a/gst/mxf/mxfaes-bwf.c b/gst/mxf/mxfaes-bwf.c
index ba2bc2ef..0b6d9eb9 100644
--- a/gst/mxf/mxfaes-bwf.c
+++ b/gst/mxf/mxfaes-bwf.c
@@ -258,6 +258,7 @@ mxf_bwf_create_caps (MXFMetadataGenericPackage * package,
GstCaps *ret = NULL;
MXFMetadataWaveAudioEssenceDescriptor *wa_descriptor = NULL;
gchar str[48];
+ gchar *codec_name = NULL;
if (((MXFMetadataGenericDescriptor *) descriptor)->type ==
MXF_METADATA_WAVE_AUDIO_ESSENCE_DESCRIPTOR)
@@ -293,6 +294,10 @@ mxf_bwf_create_caps (MXFMetadataGenericPackage * package,
(block_align != 1), "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, "depth",
G_TYPE_INT, (block_align / descriptor->channel_count) * 8, "width",
G_TYPE_INT, (block_align / descriptor->channel_count) * 8, NULL);
+
+ codec_name =
+ g_strdup_printf ("Uncompressed %u-bit little endian integer PCM audio",
+ (block_align / descriptor->channel_count) * 8);
} else if (mxf_ul_is_equal (&descriptor->sound_essence_compression,
&mxf_sound_essence_compression_aiff)) {
guint block_align;
@@ -318,6 +323,10 @@ mxf_bwf_create_caps (MXFMetadataGenericPackage * package,
(block_align != 1), "endianness", G_TYPE_INT, G_BIG_ENDIAN, "depth",
G_TYPE_INT, (block_align / descriptor->channel_count) * 8, "width",
G_TYPE_INT, (block_align / descriptor->channel_count) * 8, NULL);
+
+ codec_name =
+ g_strdup_printf ("Uncompressed %u-bit big endian integer PCM audio",
+ (block_align / descriptor->channel_count) * 8);
} else if (mxf_ul_is_equal (&descriptor->sound_essence_compression,
&mxf_sound_essence_compression_alaw)) {
@@ -331,11 +340,25 @@ mxf_bwf_create_caps (MXFMetadataGenericPackage * package,
(gint) (((gdouble) descriptor->audio_sampling_rate.n) /
((gdouble) descriptor->audio_sampling_rate.d) + 0.5),
"channels", G_TYPE_INT, descriptor->channel_count);
+ codec_name = g_strdup ("A-law encoded audio");
} else {
GST_ERROR ("Unsupported sound essence compression: %s",
mxf_ul_to_string (&descriptor->sound_essence_compression, str));
}
+ if (!*tags)
+ *tags = gst_tag_list_new ();
+
+ if (codec_name) {
+ gst_tag_list_add (*tags, GST_TAG_MERGE_APPEND, GST_TAG_AUDIO_CODEC,
+ codec_name, NULL);
+ g_free (codec_name);
+ }
+
+ if (wa_descriptor && wa_descriptor->avg_bps)
+ gst_tag_list_add (*tags, GST_TAG_MERGE_APPEND, GST_TAG_BITRATE,
+ wa_descriptor->avg_bps * 8, NULL);
+
*handler = mxf_bwf_handle_essence_element;
return ret;
diff --git a/gst/mxf/mxfalaw.c b/gst/mxf/mxfalaw.c
index b82ff7bb..89faed44 100644
--- a/gst/mxf/mxfalaw.c
+++ b/gst/mxf/mxfalaw.c
@@ -80,7 +80,6 @@ mxf_alaw_create_caps (MXFMetadataGenericPackage * package,
MXFMetadataTrack * track, GstTagList ** tags,
MXFEssenceElementHandler * handler, gpointer * mapping_data)
{
- MXFMetadataFileDescriptor *f = NULL;
MXFMetadataGenericSoundEssenceDescriptor *s = NULL;
guint i;
GstCaps *caps = NULL;
@@ -97,37 +96,32 @@ mxf_alaw_create_caps (MXFMetadataGenericPackage * package,
if (((MXFMetadataGenericDescriptor *) track->descriptor[i])->type ==
MXF_METADATA_GENERIC_SOUND_ESSENCE_DESCRIPTOR) {
s = (MXFMetadataGenericSoundEssenceDescriptor *) track->descriptor[i];
- f = track->descriptor[i];
break;
- } else if (((MXFMetadataGenericDescriptor *) track->descriptor[i])->
- is_file_descriptor
- && ((MXFMetadataGenericDescriptor *) track->descriptor[i])->type !=
- MXF_METADATA_MULTIPLE_DESCRIPTOR) {
- f = track->descriptor[i];
}
}
- if (!f) {
- GST_ERROR ("No descriptor found for this track");
+ if (!s) {
+ GST_ERROR ("No generic sound essence descriptor found for this track");
return NULL;
}
*handler = mxf_alaw_handle_essence_element;
- caps = gst_caps_new_simple ("audio/x-alaw", NULL);
- if (s) {
- if (s->audio_sampling_rate.n != 0 && s->audio_sampling_rate.d != 0)
- gst_caps_set_simple (caps, "rate", G_TYPE_INT,
- (gint) (((gdouble) s->audio_sampling_rate.n) /
- ((gdouble) s->audio_sampling_rate.d) + 0.5), NULL);
+ if (s && s->audio_sampling_rate.n != 0 && s->audio_sampling_rate.d != 0 &&
+ s->channel_count != 0) {
- if (s->channel_count != 0)
- gst_caps_set_simple (caps, "channels", G_TYPE_INT, s->channel_count,
- NULL);
+ caps = gst_caps_new_simple ("audio/x-alaw", "rate", G_TYPE_INT,
+ (gint) (((gdouble) s->audio_sampling_rate.n) /
+ ((gdouble) s->audio_sampling_rate.d) + 0.5),
+ "channels", G_TYPE_INT, s->channel_count, NULL);
/* TODO: Handle channel layout somehow? */
- } else {
- GST_WARNING ("Only a generic sound essence descriptor found");
+ if (!*tags)
+ *tags = gst_tag_list_new ();
+
+ gst_tag_list_add (*tags, GST_TAG_MERGE_APPEND, GST_TAG_AUDIO_CODEC,
+ "A-law encoded audio", NULL);
+
}
return caps;
diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c
index 1bc0e7bf..38b53004 100644
--- a/gst/mxf/mxfdemux.c
+++ b/gst/mxf/mxfdemux.c
@@ -1305,8 +1305,9 @@ 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;
}
@@ -2152,13 +2153,18 @@ gst_mxf_demux_handle_generic_container_essence_element (GstMXFDemux * demux,
return GST_FLOW_OK;
}
- /* TODO: Use a better start value */
if (pad->need_segment) {
gst_pad_push_event (GST_PAD_CAST (pad),
gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, -1, 0));
pad->need_segment = FALSE;
}
+ if (pad->tags) {
+ gst_element_found_tags_for_pad (GST_ELEMENT_CAST (demux),
+ GST_PAD_CAST (pad), pad->tags);
+ pad->tags = NULL;
+ }
+
/* Create subbuffer to be able to change metadata */
inbuf = gst_buffer_create_sub (buffer, 0, GST_BUFFER_SIZE (buffer));
@@ -2197,6 +2203,7 @@ gst_mxf_demux_handle_generic_container_essence_element (GstMXFDemux * demux,
}
if (outbuf) {
+ /* TODO: handle timestamp gaps */
ret = gst_pad_push (GST_PAD_CAST (pad), outbuf);
ret = gst_mxf_demux_combine_flows (demux, pad, ret);
}
diff --git a/gst/mxf/mxfdv-dif.c b/gst/mxf/mxfdv-dif.c
index 71268ff1..f92e71fd 100644
--- a/gst/mxf/mxfdv-dif.c
+++ b/gst/mxf/mxfdv-dif.c
@@ -91,8 +91,8 @@ mxf_dv_dif_create_caps (MXFMetadataGenericPackage * package,
}
for (i = 0; i < track->n_descriptor; i++) {
- if (((MXFMetadataGenericDescriptor *) track->descriptor[i])->
- is_file_descriptor
+ if (((MXFMetadataGenericDescriptor *) track->
+ descriptor[i])->is_file_descriptor
&& ((MXFMetadataGenericDescriptor *) track->descriptor[i])->type !=
MXF_METADATA_MULTIPLE_DESCRIPTOR) {
f = track->descriptor[i];
@@ -116,6 +116,12 @@ mxf_dv_dif_create_caps (MXFMetadataGenericPackage * package,
caps =
gst_caps_new_simple ("video/x-dv", "systemstream", G_TYPE_BOOLEAN, TRUE,
NULL);
+
+ if (!*tags)
+ *tags = gst_tag_list_new ();
+
+ gst_tag_list_add (*tags, GST_TAG_MERGE_APPEND, GST_TAG_CODEC, "DV-DIF",
+ NULL);
}
return caps;
diff --git a/gst/mxf/mxfjpeg2000.c b/gst/mxf/mxfjpeg2000.c
index e480f894..5b3611bb 100644
--- a/gst/mxf/mxfjpeg2000.c
+++ b/gst/mxf/mxfjpeg2000.c
@@ -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];
@@ -129,5 +129,10 @@ mxf_jpeg2000_create_caps (MXFMetadataGenericPackage * package,
GST_WARNING ("Only a generic file descriptor found");
}
+ if (!*tags)
+ *tags = gst_tag_list_new ();
+ gst_tag_list_add (*tags, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC,
+ "JPEG 2000", NULL);
+
return caps;
}
diff --git a/gst/mxf/mxfmpeg.c b/gst/mxf/mxfmpeg.c
index 10d0373f..1e6d0369 100644
--- a/gst/mxf/mxfmpeg.c
+++ b/gst/mxf/mxfmpeg.c
@@ -254,6 +254,7 @@ mxf_mpeg_es_create_caps (MXFMetadataGenericPackage * package,
MXFMetadataMPEGVideoDescriptor * d)
{
GstCaps *caps = NULL;
+ const gchar *codec_name = NULL;
/* SMPTE RP224 */
if (!p || mxf_ul_is_zero (&p->picture_essence_coding)) {
@@ -262,6 +263,7 @@ mxf_mpeg_es_create_caps (MXFMetadataGenericPackage * package,
caps =
gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 2,
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
+ codec_name = "MPEG-2 Video";
} else if (p->picture_essence_coding.u[0] != 0x06
|| p->picture_essence_coding.u[1] != 0x0e
|| p->picture_essence_coding.u[2] != 0x2b
@@ -280,9 +282,11 @@ mxf_mpeg_es_create_caps (MXFMetadataGenericPackage * package,
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);
+ codec_name = "MPEG-2 Video";
} 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);
+ codec_name = "MPEG-1 Video";
} else if (p->picture_essence_coding.u[13] == 0x20) {
MXFLocalTag *local_tag =
(((MXFMetadataGenericDescriptor *) f)->other_tags) ?
@@ -300,15 +304,21 @@ mxf_mpeg_es_create_caps (MXFMetadataGenericPackage * package,
NULL);
gst_buffer_unref (codec_data);
}
-
+ codec_name = "MPEG-4 Video";
} else {
GST_ERROR ("Unsupported MPEG picture essence coding 0x%02x",
p->picture_essence_coding.u[13]);
caps = NULL;
}
- if (caps)
+ if (caps) {
*handler = mxf_mpeg_video_handle_essence_element;
+ if (!*tags)
+ *tags = gst_tag_list_new ();
+ if (codec_name)
+ gst_tag_list_add (*tags, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC,
+ codec_name, NULL);
+ }
return caps;
}
@@ -378,9 +388,19 @@ mxf_mpeg_create_caps (MXFMetadataGenericPackage * package,
GST_DEBUG ("Found MPEG PS stream");
caps = gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 1,
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
+
+ if (!*tags)
+ *tags = gst_tag_list_new ();
+ gst_tag_list_add (*tags, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC,
+ "MPEG PS", NULL);
} else if (f->essence_container.u[13] == 0x09) {
GST_DEBUG ("Found MPEG TS stream");
caps = gst_caps_new_simple ("video/mpegts", NULL);
+
+ if (!*tags)
+ *tags = gst_tag_list_new ();
+ gst_tag_list_add (*tags, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC,
+ "MPEG TS", NULL);
}
if (p)