qtdemux: add support for Opus

Add support for demuxing Opus encapsulated in MP4 files, based on the
following spec: https://www.opus-codec.org/docs/opus_in_isobmff.html

https://bugzilla.gnome.org/show_bug.cgi?id=742643
This commit is contained in:
Luis de Bethencourt 2015-11-26 21:46:11 +00:00
parent 9d70682e73
commit a400d504ca

View file

@ -9834,6 +9834,38 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
}
break;
}
case FOURCC_opus:
{
GNode *opus;
const guint8 *opus_data;
guint8 *channel_mapping = NULL;
guint32 rate;
guint8 channels;
guint8 channel_mapping_family;
guint8 stream_count;
guint8 coupled_count;
guint8 i;
opus = qtdemux_tree_get_child_by_type (stsd, FOURCC_opus);
opus_data = opus->data;
channels = GST_READ_UINT8 (opus_data + 45);
rate = GST_READ_UINT32_LE (opus_data + 48);
channel_mapping_family = GST_READ_UINT8 (opus_data + 54);
stream_count = GST_READ_UINT8 (opus_data + 55);
coupled_count = GST_READ_UINT8 (opus_data + 56);
if (channels > 0) {
channel_mapping = g_malloc (channels * sizeof (guint8));
for (i = 0; i < channels; i++)
channel_mapping[i] = GST_READ_UINT8 (opus_data + i + 57);
}
stream->caps = gst_codec_utils_opus_create_caps (rate, channels,
channel_mapping_family, stream_count, coupled_count,
channel_mapping);
break;
}
default:
break;
}
@ -12707,6 +12739,10 @@ qtdemux_audio_caps (GstQTDemux * qtdemux, QtDemuxStream * stream,
_codec ("WMA");
caps = gst_caps_new_empty_simple ("audio/x-wma");
break;
case FOURCC_opus:
_codec ("Opus");
caps = gst_caps_new_empty_simple ("audio/x-opus");
break;
case GST_MAKE_FOURCC ('l', 'p', 'c', 'm'):
{
guint32 flags = 0;