mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-06 18:52:07 +00:00
ext/vorbis/: Add sane defaults for the 7 and 8 channel layouts as those are undefined in the Vorbis spec. Use NONE ch...
Original commit message from CVS: * ext/vorbis/vorbisdec.c: (vorbis_handle_identification_packet): * ext/vorbis/vorbisenc.c: (gst_vorbis_enc_generate_sink_caps): Add sane defaults for the 7 and 8 channel layouts as those are undefined in the Vorbis spec. Use NONE channel layouts when decoding more than 8 channels instead of erroring out. Fixes bug #535356.
This commit is contained in:
parent
1a3053b241
commit
31b677599a
3 changed files with 78 additions and 13 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2008-05-29 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
|
|
||||||
|
* ext/vorbis/vorbisdec.c: (vorbis_handle_identification_packet):
|
||||||
|
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_generate_sink_caps):
|
||||||
|
Add sane defaults for the 7 and 8 channel layouts as those are
|
||||||
|
undefined in the Vorbis spec. Use NONE channel layouts when decoding
|
||||||
|
more than 8 channels instead of erroring out. Fixes bug #535356.
|
||||||
|
|
||||||
2008-05-28 Wim Taymans <wim.taymans@collabora.co.uk>
|
2008-05-28 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
* docs/plugins/Makefile.am:
|
* docs/plugins/Makefile.am:
|
||||||
|
|
|
@ -618,8 +618,49 @@ vorbis_handle_identification_packet (GstVorbisDec * vd)
|
||||||
pos = pos6;
|
pos = pos6;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
/* FIXME: for >6 channels the layout is not defined by the Vorbis
|
||||||
goto channel_count_error;
|
* spec. These are the gstreamer "defaults" for 7/8 channels and
|
||||||
|
* NONE layouts for more channels
|
||||||
|
*/
|
||||||
|
case 7:{
|
||||||
|
static const GstAudioChannelPosition pos7[] = {
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_LFE,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
|
||||||
|
};
|
||||||
|
pos = pos7;
|
||||||
|
}
|
||||||
|
case 8:{
|
||||||
|
static const GstAudioChannelPosition pos8[] = {
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_LFE,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
|
||||||
|
};
|
||||||
|
|
||||||
|
pos = pos8;
|
||||||
|
}
|
||||||
|
default:{
|
||||||
|
gint i;
|
||||||
|
GstAudioChannelPosition *posn =
|
||||||
|
g_new (GstAudioChannelPosition, vd->vi.channels);
|
||||||
|
|
||||||
|
GST_ELEMENT_WARNING (GST_ELEMENT (vd), STREAM, DECODE,
|
||||||
|
(NULL), ("Using NONE channel layout for more than 8 channels"));
|
||||||
|
|
||||||
|
for (i = 0; i < vd->vi.channels; i++)
|
||||||
|
posn[i] = GST_AUDIO_CHANNEL_POSITION_NONE;
|
||||||
|
|
||||||
|
pos = posn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("audio/x-raw-float",
|
caps = gst_caps_new_simple ("audio/x-raw-float",
|
||||||
|
@ -630,18 +671,15 @@ vorbis_handle_identification_packet (GstVorbisDec * vd)
|
||||||
if (pos) {
|
if (pos) {
|
||||||
gst_audio_set_channel_positions (gst_caps_get_structure (caps, 0), pos);
|
gst_audio_set_channel_positions (gst_caps_get_structure (caps, 0), pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vd->vi.channels > 8) {
|
||||||
|
g_free ((GstAudioChannelPosition *) pos);
|
||||||
|
}
|
||||||
|
|
||||||
gst_pad_set_caps (vd->srcpad, caps);
|
gst_pad_set_caps (vd->srcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
|
|
||||||
/* ERROR */
|
|
||||||
channel_count_error:
|
|
||||||
{
|
|
||||||
GST_ELEMENT_ERROR (vd, STREAM, NOT_IMPLEMENTED, (NULL),
|
|
||||||
("Unsupported channel count %d", vd->vi.channels));
|
|
||||||
return GST_FLOW_ERROR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
|
|
|
@ -241,7 +241,7 @@ gst_vorbis_enc_dispose (GObject * object)
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const GstAudioChannelPosition vorbischannelpositions[][6] = {
|
static const GstAudioChannelPosition vorbischannelpositions[][8] = {
|
||||||
{ /* Mono */
|
{ /* Mono */
|
||||||
GST_AUDIO_CHANNEL_POSITION_FRONT_MONO},
|
GST_AUDIO_CHANNEL_POSITION_FRONT_MONO},
|
||||||
{ /* Stereo */
|
{ /* Stereo */
|
||||||
|
@ -272,6 +272,25 @@ static const GstAudioChannelPosition vorbischannelpositions[][6] = {
|
||||||
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
|
||||||
GST_AUDIO_CHANNEL_POSITION_LFE,
|
GST_AUDIO_CHANNEL_POSITION_LFE,
|
||||||
},
|
},
|
||||||
|
{ /* Not defined by spec, GStreamer default */
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_LFE,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
|
||||||
|
},
|
||||||
|
{ /* Not defined by spec, GStreamer default */
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_LFE,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
|
||||||
|
GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
static GstCaps *
|
static GstCaps *
|
||||||
gst_vorbis_enc_generate_sink_caps (void)
|
gst_vorbis_enc_generate_sink_caps (void)
|
||||||
|
@ -291,7 +310,7 @@ gst_vorbis_enc_generate_sink_caps (void)
|
||||||
"endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32,
|
"endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32,
|
||||||
NULL));
|
NULL));
|
||||||
|
|
||||||
for (i = 3; i <= 6; i++) {
|
for (i = 3; i <= 8; i++) {
|
||||||
GValue chanpos = { 0 };
|
GValue chanpos = { 0 };
|
||||||
GValue pos = { 0 };
|
GValue pos = { 0 };
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
|
@ -317,7 +336,7 @@ gst_vorbis_enc_generate_sink_caps (void)
|
||||||
|
|
||||||
gst_caps_append_structure (caps, gst_structure_new ("audio/x-raw-float",
|
gst_caps_append_structure (caps, gst_structure_new ("audio/x-raw-float",
|
||||||
"rate", GST_TYPE_INT_RANGE, 1, 200000,
|
"rate", GST_TYPE_INT_RANGE, 1, 200000,
|
||||||
"channels", GST_TYPE_INT_RANGE, 7, 256,
|
"channels", GST_TYPE_INT_RANGE, 9, 256,
|
||||||
"endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32,
|
"endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32,
|
||||||
NULL));
|
NULL));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue