From e3ba1c0fd5f99782b7481f79e410a7cbf56c167b Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Sat, 21 Jan 2006 11:43:53 +0000 Subject: [PATCH] gst/qtdemux/qtdemux.c: 'twos' and 'sowt' fourcc can be 16bit or 8bit audio. Original commit message from CVS: * gst/qtdemux/qtdemux.c: (qtdemux_parse_trak), (qtdemux_audio_caps): 'twos' and 'sowt' fourcc can be 16bit or 8bit audio. Fix 8bit case (#327133, based on patch by: Fabrizio Gennari ). Also, "G_LITTLE_ENDIAN" and "G_BIG_ENDIAN" are not valid literals for endianness in caps strings, only "LITTLE_ENDIAN" and "BIG_ENDIAN" are valid. --- common | 2 +- gst/qtdemux/qtdemux.c | 57 +++++++++++++++++++++++++++---------------- 2 files changed, 37 insertions(+), 22 deletions(-) diff --git a/common b/common index 5b72280d9c..bc4325349e 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 5b72280d9ce34e312924e2c4831ed21c26f885eb +Subproject commit bc4325349e8d0ec90aa5c5e74566880cc2e82527 diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c index ee0383cbdf..fb1926367d 100644 --- a/gst/qtdemux/qtdemux.c +++ b/gst/qtdemux/qtdemux.c @@ -167,8 +167,9 @@ static void gst_qtdemux_handle_esds (GstQTDemux * qtdemux, QtDemuxStream * stream, GNode * esds); static GstCaps *qtdemux_video_caps (GstQTDemux * qtdemux, guint32 fourcc, const guint8 * stsd_data, const gchar ** codec_name); -static GstCaps *qtdemux_audio_caps (GstQTDemux * qtdemux, guint32 fourcc, - const guint8 * data, int len, const gchar ** codec_name); +static GstCaps *qtdemux_audio_caps (GstQTDemux * qtdemux, + QtDemuxStream * stream, guint32 fourcc, const guint8 * data, int len, + const gchar ** codec_name); static GType gst_qtdemux_get_type (void) @@ -2124,7 +2125,9 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak) GST_ERROR ("unknown version %08x", version); } - stream->caps = qtdemux_audio_caps (qtdemux, fourcc, NULL, 0, &codec); + stream->caps = qtdemux_audio_caps (qtdemux, stream, fourcc, NULL, 0, + &codec); + if (codec) { list = gst_tag_list_new (); gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, @@ -2737,8 +2740,8 @@ qtdemux_video_caps (GstQTDemux * qtdemux, guint32 fourcc, } static GstCaps * -qtdemux_audio_caps (GstQTDemux * qtdemux, guint32 fourcc, const guint8 * data, - int len, const gchar ** codec_name) +qtdemux_audio_caps (GstQTDemux * qtdemux, QtDemuxStream * stream, + guint32 fourcc, const guint8 * data, int len, const gchar ** codec_name) { switch (fourcc) { #if 0 @@ -2751,41 +2754,53 @@ qtdemux_audio_caps (GstQTDemux * qtdemux, guint32 fourcc, const guint8 * data, return gst_caps_from_string ("audio/x-raw-int, " "width = (int) 8, " "depth = (int) 8, " "signed = (boolean) false"); case GST_MAKE_FOURCC ('t', 'w', 'o', 's'): - _codec ("Raw 16-bit PCM audio"); - /* FIXME */ - return gst_caps_from_string ("audio/x-raw-int, " - "width = (int) 16, " - "depth = (int) 16, " - "endianness = (int) BIG_ENDIAN, " "signed = (boolean) true"); + if (stream->bytes_per_frame == 1) { + _codec ("Raw 8-bit PCM audio"); + return gst_caps_from_string ("audio/x-raw-int, " + "width = (int) 8, " "depth = (int) 8, " "signed = (boolean) true"); + } else { + _codec ("Raw 16-bit PCM audio"); + /* FIXME */ + return gst_caps_from_string ("audio/x-raw-int, " + "width = (int) 16, " + "depth = (int) 16, " + "endianness = (int) BIG_ENDIAN, " "signed = (boolean) true"); + } case GST_MAKE_FOURCC ('s', 'o', 'w', 't'): - _codec ("Raw 16-bit PCM audio"); - /* FIXME */ - return gst_caps_from_string ("audio/x-raw-int, " - "width = (int) 16, " - "depth = (int) 16, " - "endianness = (int) G_LITTLE_ENDIAN, " "signed = (boolean) true"); + if (stream->bytes_per_frame == 1) { + _codec ("Raw 8-bit PCM audio"); + return gst_caps_from_string ("audio/x-raw-int, " + "width = (int) 8, " "depth = (int) 8, " "signed = (boolean) true"); + } else { + _codec ("Raw 16-bit PCM audio"); + /* FIXME */ + return gst_caps_from_string ("audio/x-raw-int, " + "width = (int) 16, " + "depth = (int) 16, " + "endianness = (int) LITTLE_ENDIAN, " "signed = (boolean) true"); + } case GST_MAKE_FOURCC ('f', 'l', '6', '4'): _codec ("Raw 64-bit floating-point audio"); return gst_caps_from_string ("audio/x-raw-float, " - "width = (int) 64, " "endianness = (int) G_BIG_ENDIAN"); + "width = (int) 64, " "endianness = (int) BIG_ENDIAN"); case GST_MAKE_FOURCC ('f', 'l', '3', '2'): _codec ("Raw 32-bit floating-point audio"); return gst_caps_from_string ("audio/x-raw-float, " - "width = (int) 32, " "endianness = (int) G_BIG_ENDIAN"); + "width = (int) 32, " "endianness = (int) BIG_ENDIAN"); case GST_MAKE_FOURCC ('i', 'n', '2', '4'): _codec ("Raw 24-bit PCM audio"); /* FIXME */ return gst_caps_from_string ("audio/x-raw-int, " "width = (int) 24, " "depth = (int) 32, " - "endianness = (int) G_BIG_ENDIAN, " "signed = (boolean) true"); + "endianness = (int) BIG_ENDIAN, " "signed = (boolean) true"); case GST_MAKE_FOURCC ('i', 'n', '3', '2'): _codec ("Raw 32-bit PCM audio"); /* FIXME */ return gst_caps_from_string ("audio/x-raw-int, " "width = (int) 32, " "depth = (int) 32, " - "endianness = (int) G_BIG_ENDIAN, " "signed = (boolean) true"); + "endianness = (int) BIG_ENDIAN, " "signed = (boolean) true"); case GST_MAKE_FOURCC ('u', 'l', 'a', 'w'): _codec ("Mu-law audio"); /* FIXME */