mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-20 14:18:34 +00:00
Put the MPEG audio version into the caps as "mpegaudioversion".
Original commit message from CVS: * ext/lame/gstlame.c: (gst_lame_sink_setcaps): * gst/mpegaudioparse/gstmpegaudioparse.c: (mp3_type_frame_length_from_header), (mp3_caps_create), (gst_mp3parse_chain): Put the MPEG audio version into the caps as "mpegaudioversion". This is different from "mpegversion".
This commit is contained in:
parent
59aed0789c
commit
d2d56eb183
3 changed files with 32 additions and 9 deletions
|
@ -1,3 +1,12 @@
|
|||
2008-07-27 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
||||
|
||||
* ext/lame/gstlame.c: (gst_lame_sink_setcaps):
|
||||
* gst/mpegaudioparse/gstmpegaudioparse.c:
|
||||
(mp3_type_frame_length_from_header), (mp3_caps_create),
|
||||
(gst_mp3parse_chain):
|
||||
Put the MPEG audio version into the caps as "mpegaudioversion".
|
||||
This is different from "mpegversion".
|
||||
|
||||
2008-07-22 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
||||
|
||||
* ext/lame/gstlame.c: (gst_lame_class_init), (gst_lame_init),
|
||||
|
|
|
@ -506,6 +506,7 @@ gst_lame_sink_setcaps (GstPad * pad, GstCaps * caps)
|
|||
{
|
||||
GstLame *lame;
|
||||
gint out_samplerate;
|
||||
gint version;
|
||||
GstStructure *structure;
|
||||
GstCaps *othercaps;
|
||||
|
||||
|
@ -531,9 +532,18 @@ gst_lame_sink_setcaps (GstPad * pad, GstCaps * caps)
|
|||
out_samplerate, lame->samplerate);
|
||||
}
|
||||
|
||||
version = lame_get_version (lame->lgf);
|
||||
if (version == 0)
|
||||
version = 2;
|
||||
else if (version == 1)
|
||||
version = 1;
|
||||
else if (version == 2)
|
||||
version = 3;
|
||||
|
||||
othercaps =
|
||||
gst_caps_new_simple ("audio/mpeg",
|
||||
"mpegversion", G_TYPE_INT, 1,
|
||||
"mpegaudioversion", G_TYPE_INT, version,
|
||||
"layer", G_TYPE_INT, 3,
|
||||
"channels", G_TYPE_INT, lame->mode == MONO ? 1 : lame->num_channels,
|
||||
"rate", G_TYPE_INT, out_samplerate, NULL);
|
||||
|
|
|
@ -185,9 +185,8 @@ mp3_type_frame_length_from_header (GstMPEGAudioParse * mp3parse, guint32 header,
|
|||
guint * put_crc)
|
||||
{
|
||||
guint length;
|
||||
|
||||
gulong mode, samplerate, bitrate, layer, channels, padding, crc;
|
||||
|
||||
gulong version;
|
||||
gint lsf, mpg25;
|
||||
|
||||
GEnumValue *mode_enum;
|
||||
|
@ -200,6 +199,8 @@ mp3_type_frame_length_from_header (GstMPEGAudioParse * mp3parse, guint32 header,
|
|||
mpg25 = 1;
|
||||
}
|
||||
|
||||
version = 1 + lsf + mpg25;
|
||||
|
||||
layer = 4 - ((header >> 17) & 0x3);
|
||||
|
||||
crc = (header >> 16) & 0x1;
|
||||
|
@ -235,12 +236,12 @@ mp3_type_frame_length_from_header (GstMPEGAudioParse * mp3parse, guint32 header,
|
|||
|
||||
GST_DEBUG_OBJECT (mp3parse, "Calculated mp3 frame length of %u bytes",
|
||||
length);
|
||||
GST_DEBUG_OBJECT (mp3parse, "samplerate = %lu, bitrate = %lu, layer = %lu, "
|
||||
"channels = %lu, mode = %s", samplerate, bitrate, layer, channels,
|
||||
mode_enum->value_nick);
|
||||
GST_DEBUG_OBJECT (mp3parse, "samplerate = %lu, bitrate = %lu, version = %lu, "
|
||||
"layer = %lu, channels = %lu, mode = %s", samplerate, bitrate, version,
|
||||
layer, channels, mode_enum->value_nick);
|
||||
|
||||
if (put_version)
|
||||
*put_version = lsf ? 2 : 1;
|
||||
*put_version = version;
|
||||
if (put_layer)
|
||||
*put_layer = layer;
|
||||
if (put_channels)
|
||||
|
@ -258,16 +259,18 @@ mp3_type_frame_length_from_header (GstMPEGAudioParse * mp3parse, guint32 header,
|
|||
}
|
||||
|
||||
static GstCaps *
|
||||
mp3_caps_create (guint layer, guint channels, guint samplerate)
|
||||
mp3_caps_create (guint version, guint layer, guint channels, guint samplerate)
|
||||
{
|
||||
GstCaps *new;
|
||||
|
||||
g_assert (version);
|
||||
g_assert (layer);
|
||||
g_assert (samplerate);
|
||||
g_assert (channels);
|
||||
|
||||
new = gst_caps_new_simple ("audio/mpeg",
|
||||
"mpegversion", G_TYPE_INT, 1,
|
||||
"mpegaudioversion", G_TYPE_INT, version,
|
||||
"layer", G_TYPE_INT, layer,
|
||||
"rate", G_TYPE_INT, samplerate,
|
||||
"channels", G_TYPE_INT, channels, "parsed", G_TYPE_BOOLEAN, TRUE, NULL);
|
||||
|
@ -1317,10 +1320,11 @@ gst_mp3parse_chain (GstPad * pad, GstBuffer * buf)
|
|||
}
|
||||
|
||||
if (channels != mp3parse->channels ||
|
||||
rate != mp3parse->rate || layer != mp3parse->layer) {
|
||||
rate != mp3parse->rate || layer != mp3parse->layer ||
|
||||
version != mp3parse->version) {
|
||||
GstCaps *caps;
|
||||
|
||||
caps = mp3_caps_create (layer, channels, rate);
|
||||
caps = mp3_caps_create (version, layer, channels, rate);
|
||||
gst_pad_set_caps (mp3parse->srcpad, caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
|
|
Loading…
Reference in a new issue