diff options
author | Luis de Bethencourt <luisbg@osg.samsung.com> | 2015-11-26 21:46:11 +0000 |
---|---|---|
committer | Luis de Bethencourt <luisbg@osg.samsung.com> | 2015-11-26 21:46:14 +0000 |
commit | a400d504ca25ba3812a563a4cac94ef2bf910b2a (patch) | |
tree | b05c257c3e89cacb7acd54e8ec59c9affa2b4e0a | |
parent | 9d70682e73e414ebf3d734c030cf92903f53e386 (diff) |
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
-rw-r--r-- | gst/isomp4/qtdemux.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index ea3f1f59a..31aba9d0f 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -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; |