diff options
author | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2013-01-08 20:45:21 -0500 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.net> | 2013-01-28 23:43:57 +0000 |
commit | a76524ea08ebc0322b11d9743733d3987b4793fd (patch) | |
tree | e667d705223b081ec4c8e655ef61bc9a3b1f9304 | |
parent | 69b814546a65a3f62a733dae40c55ad90aab0b44 (diff) |
qtdemux: add support for LPCM fourcc (uncompressed audio in Quicktime7)
https://bugzilla.gnome.org/show_bug.cgi?id=663458
-rw-r--r-- | gst/isomp4/qtdemux.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index 835ea092a..1260f9974 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -9848,6 +9848,62 @@ qtdemux_audio_caps (GstQTDemux * qtdemux, QtDemuxStream * stream, _codec ("WMA"); caps = gst_caps_new_empty_simple ("audio/x-wma"); break; + case GST_MAKE_FOURCC ('l', 'p', 'c', 'm'): + { + guint32 flags = 0; + guint32 depth = 0; + guint32 width = 0; + GstAudioFormat format; + enum + { + FLAG_IS_FLOAT = 0x1, + FLAG_IS_BIG_ENDIAN = 0x2, + FLAG_IS_SIGNED = 0x4, + FLAG_IS_PACKED = 0x8, + FLAG_IS_ALIGNED_HIGH = 0x10, + FLAG_IS_NON_INTERLEAVED = 0x20 + }; + _codec ("Raw LPCM audio"); + + if (data && len >= 56) { + depth = QT_UINT32 (data + 40); + flags = QT_UINT32 (data + 44); + width = QT_UINT32 (data + 48) * 8 / stream->n_channels; + } + if ((flags & FLAG_IS_FLOAT) == 0) { + if (depth == 0) + depth = 16; + if (width == 0) + width = 16; + format = gst_audio_format_build_integer ((flags & FLAG_IS_SIGNED) ? + TRUE : FALSE, (flags & FLAG_IS_BIG_ENDIAN) ? + G_BIG_ENDIAN : G_LITTLE_ENDIAN, width, depth); + // FIXME: check FLAG_IS_NON_INTERLEAVED flag for layout + caps = gst_caps_new_simple ("audio/x-raw", + "format", G_TYPE_STRING, gst_audio_format_to_string (format), + "layout", G_TYPE_STRING, "interleaved", NULL); + } else { + if (depth == 0) + depth = 32; + if (width == 0) + width = 32; + if (width == 64) { + if (flags & FLAG_IS_BIG_ENDIAN) + format = GST_AUDIO_FORMAT_F64BE; + else + format = GST_AUDIO_FORMAT_F64LE; + } else { + if (flags & FLAG_IS_BIG_ENDIAN) + format = GST_AUDIO_FORMAT_F32BE; + else + format = GST_AUDIO_FORMAT_F32LE; + } + caps = gst_caps_new_simple ("audio/x-raw", + "format", G_TYPE_STRING, gst_audio_format_to_string (format), + "layout", G_TYPE_STRING, "interleaved", NULL); + } + break; + } case GST_MAKE_FOURCC ('q', 't', 'v', 'r'): /* ? */ default: |