gst-plugins-base: typefinding: add depth and endianness to DTS caps
Tim Müller
tpm at kemper.freedesktop.org
Mon Mar 14 11:44:14 PDT 2011
Module: gst-plugins-base
Branch: master
Commit: a558af4bbf6cd3cdcfbcb6e5ef791d154d251d79
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=a558af4bbf6cd3cdcfbcb6e5ef791d154d251d79
Author: Tim-Philipp Müller <tim.muller at collabora.co.uk>
Date: Mon Mar 14 18:35:27 2011 +0000
typefinding: add depth and endianness to DTS caps
https://bugzilla.gnome.org/show_bug.cgi?id=644208
---
gst/typefind/gsttypefindfunctions.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/gst/typefind/gsttypefindfunctions.c b/gst/typefind/gsttypefindfunctions.c
index 47c6bb5..8615490 100644
--- a/gst/typefind/gsttypefindfunctions.c
+++ b/gst/typefind/gsttypefindfunctions.c
@@ -1333,7 +1333,7 @@ static GstStaticCaps dts_caps = GST_STATIC_CAPS ("audio/x-dts");
static gboolean
dts_parse_frame_header (DataScanCtx * c, guint * frame_size,
- guint * sample_rate, guint * channels)
+ guint * sample_rate, guint * channels, guint * depth, guint * endianness)
{
static const int sample_rates[16] = { 0, 8000, 16000, 32000, 0, 0, 11025,
22050, 44100, 0, 0, 12000, 24000, 48000, 96000, 192000
@@ -1349,11 +1349,13 @@ dts_parse_frame_header (DataScanCtx * c, guint * frame_size,
/* raw big endian or 14-bit big endian */
if (marker == 0x7FFE8001 || marker == 0x1FFFE800) {
+ *endianness = G_BIG_ENDIAN;
for (i = 0; i < G_N_ELEMENTS (hdr); ++i)
hdr[i] = GST_READ_UINT16_BE (c->data + (i * sizeof (guint16)));
} else
/* raw little endian or 14-bit little endian */
if (marker == 0xFE7F0180 || marker == 0xFF1F00E8) {
+ *endianness = G_LITTLE_ENDIAN;
for (i = 0; i < G_N_ELEMENTS (hdr); ++i)
hdr[i] = GST_READ_UINT16_LE (c->data + (i * sizeof (guint16)));
} else {
@@ -1376,6 +1378,9 @@ dts_parse_frame_header (DataScanCtx * c, guint * frame_size,
hdr[5] = (hdr[5] << 12) | ((hdr[6] >> 2) & 0x0FFF);
hdr[6] = (hdr[6] << 14) | ((hdr[7] >> 0) & 0x3FFF);
g_assert (hdr[0] == 0x7FFE && hdr[1] == 0x8001);
+ *depth = 14;
+ } else {
+ *depth = 16;
}
GST_LOG ("frame header: %04x%04x%04x%04x", hdr[2], hdr[3], hdr[4], hdr[5]);
@@ -1409,12 +1414,13 @@ dts_type_find (GstTypeFind * tf, gpointer unused)
* a lower probability if not found right at the start. Check that the
* frame is followed by a second frame at the expected offset. */
while (c.offset <= DTS_MAX_FRAMESIZE) {
- guint frame_size = 0, rate = 0, chans = 0;
+ guint frame_size = 0, rate = 0, chans = 0, depth = 0, endianness = 0;
if (G_UNLIKELY (!data_scan_ctx_ensure_data (tf, &c, DTS_MIN_FRAMESIZE)))
return;
- if (G_UNLIKELY (dts_parse_frame_header (&c, &frame_size, &rate, &chans))) {
+ if (G_UNLIKELY (dts_parse_frame_header (&c, &frame_size, &rate, &chans,
+ &depth, &endianness))) {
GstTypeFindProbability prob;
DataScanCtx next_c;
@@ -1433,10 +1439,13 @@ dts_type_find (GstTypeFind * tf, gpointer unused)
if (chans > 0) {
gst_type_find_suggest_simple (tf, prob, "audio/x-dts",
"rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, chans,
+ "depth", G_TYPE_INT, depth, "endianness", G_TYPE_INT, endianness,
"framed", G_TYPE_BOOLEAN, FALSE, NULL);
} else {
gst_type_find_suggest_simple (tf, prob, "audio/x-dts",
- "rate", G_TYPE_INT, rate, "framed", G_TYPE_BOOLEAN, FALSE, NULL);
+ "rate", G_TYPE_INT, rate, "depth", G_TYPE_INT, depth,
+ "endianness", G_TYPE_INT, endianness,
+ "framed", G_TYPE_BOOLEAN, FALSE, NULL);
}
return;
More information about the gstreamer-commits
mailing list