mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
audioringbuffer: parse channels field from compressed audio caps
Also parse channels as an optional field in the caps for compressed audio formats.
This commit is contained in:
parent
968e28a818
commit
6ce7ade7c6
1 changed files with 6 additions and 0 deletions
|
@ -242,6 +242,7 @@ gst_audio_ring_buffer_parse_caps (GstAudioRingBufferSpec * spec, GstCaps * caps)
|
||||||
if (!(gst_structure_get_int (structure, "rate", &info.rate)))
|
if (!(gst_structure_get_int (structure, "rate", &info.rate)))
|
||||||
goto parse_error;
|
goto parse_error;
|
||||||
|
|
||||||
|
gst_structure_get_int (structure, "channels", &info.channels);
|
||||||
spec->type = GST_AUDIO_RING_BUFFER_FORMAT_TYPE_AC3;
|
spec->type = GST_AUDIO_RING_BUFFER_FORMAT_TYPE_AC3;
|
||||||
info.bpf = 4;
|
info.bpf = 4;
|
||||||
} else if (g_str_equal (mimetype, "audio/x-eac3")) {
|
} else if (g_str_equal (mimetype, "audio/x-eac3")) {
|
||||||
|
@ -249,6 +250,7 @@ gst_audio_ring_buffer_parse_caps (GstAudioRingBufferSpec * spec, GstCaps * caps)
|
||||||
if (!(gst_structure_get_int (structure, "rate", &info.rate)))
|
if (!(gst_structure_get_int (structure, "rate", &info.rate)))
|
||||||
goto parse_error;
|
goto parse_error;
|
||||||
|
|
||||||
|
gst_structure_get_int (structure, "channels", &info.channels);
|
||||||
spec->type = GST_AUDIO_RING_BUFFER_FORMAT_TYPE_EAC3;
|
spec->type = GST_AUDIO_RING_BUFFER_FORMAT_TYPE_EAC3;
|
||||||
info.bpf = 16;
|
info.bpf = 16;
|
||||||
} else if (g_str_equal (mimetype, "audio/x-dts")) {
|
} else if (g_str_equal (mimetype, "audio/x-dts")) {
|
||||||
|
@ -256,6 +258,7 @@ gst_audio_ring_buffer_parse_caps (GstAudioRingBufferSpec * spec, GstCaps * caps)
|
||||||
if (!(gst_structure_get_int (structure, "rate", &info.rate)))
|
if (!(gst_structure_get_int (structure, "rate", &info.rate)))
|
||||||
goto parse_error;
|
goto parse_error;
|
||||||
|
|
||||||
|
gst_structure_get_int (structure, "channels", &info.channels);
|
||||||
spec->type = GST_AUDIO_RING_BUFFER_FORMAT_TYPE_DTS;
|
spec->type = GST_AUDIO_RING_BUFFER_FORMAT_TYPE_DTS;
|
||||||
info.bpf = 4;
|
info.bpf = 4;
|
||||||
} else if (g_str_equal (mimetype, "audio/mpeg") &&
|
} else if (g_str_equal (mimetype, "audio/mpeg") &&
|
||||||
|
@ -266,6 +269,7 @@ gst_audio_ring_buffer_parse_caps (GstAudioRingBufferSpec * spec, GstCaps * caps)
|
||||||
if (!(gst_structure_get_int (structure, "rate", &info.rate)))
|
if (!(gst_structure_get_int (structure, "rate", &info.rate)))
|
||||||
goto parse_error;
|
goto parse_error;
|
||||||
|
|
||||||
|
gst_structure_get_int (structure, "channels", &info.channels);
|
||||||
spec->type = GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG;
|
spec->type = GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG;
|
||||||
info.bpf = 4;
|
info.bpf = 4;
|
||||||
} else if (g_str_equal (mimetype, "audio/mpeg") &&
|
} else if (g_str_equal (mimetype, "audio/mpeg") &&
|
||||||
|
@ -276,6 +280,8 @@ gst_audio_ring_buffer_parse_caps (GstAudioRingBufferSpec * spec, GstCaps * caps)
|
||||||
/* MPEG-2 AAC or MPEG-4 AAC */
|
/* MPEG-2 AAC or MPEG-4 AAC */
|
||||||
if (!(gst_structure_get_int (structure, "rate", &info.rate)))
|
if (!(gst_structure_get_int (structure, "rate", &info.rate)))
|
||||||
goto parse_error;
|
goto parse_error;
|
||||||
|
|
||||||
|
gst_structure_get_int (structure, "channels", &info.channels);
|
||||||
spec->type = (i == 2) ? GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG2_AAC :
|
spec->type = (i == 2) ? GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG2_AAC :
|
||||||
GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG4_AAC;
|
GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG4_AAC;
|
||||||
info.bpf = 4;
|
info.bpf = 4;
|
||||||
|
|
Loading…
Reference in a new issue