From 1501b485b1a64e5d5f84de3c72540013706f85ce Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Fri, 9 Dec 2005 15:30:21 +0000 Subject: ext/faad/gstfaad.c: Assume that an unknown channel mapping with 2 channels is stereo and play it that way instead of ... Original commit message from CVS: * ext/faad/gstfaad.c: (gst_faad_chanpos_to_gst), (gst_faad_update_caps): Assume that an unknown channel mapping with 2 channels is stereo and play it that way instead of erroring. * gst/qtdemux/qtdemux.c: (gst_qtdemux_loop_header), (gst_qtdemux_add_stream), (qtdemux_parse_trak): Handle e.g. jpeg streams with 0 duration frames as having 0 framerate. Debug fixes. Some 64 bit variable fixes --- ext/faad/gstfaad.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'ext') diff --git a/ext/faad/gstfaad.c b/ext/faad/gstfaad.c index 299e7d19..2de3ebb5 100644 --- a/ext/faad/gstfaad.c +++ b/ext/faad/gstfaad.c @@ -315,6 +315,7 @@ gst_faad_chanpos_to_gst (guchar * fpos, guint num) { GstAudioChannelPosition *pos = g_new (GstAudioChannelPosition, num); guint n; + gboolean unknown_channel = FALSE; for (n = 0; n < num; n++) { switch (fpos[n]) { @@ -350,10 +351,20 @@ gst_faad_chanpos_to_gst (guchar * fpos, guint num) pos[n] = GST_AUDIO_CHANNEL_POSITION_LFE; break; default: - GST_WARNING ("Unsupported FAAD channel position 0x%x encountered", - fpos[n]); - g_free (pos); - return NULL; + unknown_channel = TRUE; + break; + } + } + if (unknown_channel) { + if (num == 2) { + GST_DEBUG ("FAAD reports unknown 2 channel mapping. Forcing to stereo"); + pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT; + pos[1] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT; + } else { + GST_WARNING ("Unsupported FAAD channel position 0x%x encountered", + fpos[n]); + g_free (pos); + return NULL; } } @@ -729,6 +740,11 @@ gst_faad_update_caps (GstFaad * faad, faacDecFrameInfo * info, faad->bps = 16 / 8; pos = gst_faad_chanpos_to_gst (faad->channel_positions, faad->channels); + if (!pos) { + GST_DEBUG_OBJECT (faad, "Could not map channel positions"); + gst_caps_unref (caps); + return FALSE; + } gst_audio_set_channel_positions (gst_caps_get_structure (caps, 0), pos); g_free (pos); -- cgit v1.2.1