Commit 1501b485 authored by Jan Schmidt's avatar Jan Schmidt

ext/faad/gstfaad.c: Assume that an unknown channel mapping with 2 channels is...

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
parent b57b82d5
2005-12-09 Jan Schmidt <thaytan@mad.scientist.com>
* 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
2005-12-09 Edgard Lima <edgard.lima@indt.org.br> 2005-12-09 Edgard Lima <edgard.lima@indt.org.br>
* configure.ac: * configure.ac:
......
common @ 4edc2140
Subproject commit fe94837afc0b10eaf867156fc29eea0073ba45df Subproject commit 4edc214072fe07d2aade96bc336493425654d7b4
...@@ -315,6 +315,7 @@ gst_faad_chanpos_to_gst (guchar * fpos, guint num) ...@@ -315,6 +315,7 @@ gst_faad_chanpos_to_gst (guchar * fpos, guint num)
{ {
GstAudioChannelPosition *pos = g_new (GstAudioChannelPosition, num); GstAudioChannelPosition *pos = g_new (GstAudioChannelPosition, num);
guint n; guint n;
gboolean unknown_channel = FALSE;
for (n = 0; n < num; n++) { for (n = 0; n < num; n++) {
switch (fpos[n]) { switch (fpos[n]) {
...@@ -350,6 +351,16 @@ gst_faad_chanpos_to_gst (guchar * fpos, guint num) ...@@ -350,6 +351,16 @@ gst_faad_chanpos_to_gst (guchar * fpos, guint num)
pos[n] = GST_AUDIO_CHANNEL_POSITION_LFE; pos[n] = GST_AUDIO_CHANNEL_POSITION_LFE;
break; break;
default: default:
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", GST_WARNING ("Unsupported FAAD channel position 0x%x encountered",
fpos[n]); fpos[n]);
g_free (pos); g_free (pos);
...@@ -729,6 +740,11 @@ gst_faad_update_caps (GstFaad * faad, faacDecFrameInfo * info, ...@@ -729,6 +740,11 @@ gst_faad_update_caps (GstFaad * faad, faacDecFrameInfo * info,
faad->bps = 16 / 8; faad->bps = 16 / 8;
pos = gst_faad_chanpos_to_gst (faad->channel_positions, faad->channels); 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); gst_audio_set_channel_positions (gst_caps_get_structure (caps, 0), pos);
g_free (pos); g_free (pos);
......
...@@ -69,7 +69,7 @@ struct _QtDemuxSample ...@@ -69,7 +69,7 @@ struct _QtDemuxSample
int sample_index; int sample_index;
int chunk; int chunk;
int size; int size;
guint32 offset; guint64 offset;
guint64 timestamp; /* In GstClockTime */ guint64 timestamp; /* In GstClockTime */
guint32 duration; /* in stream->timescale units */ guint32 duration; /* in stream->timescale units */
}; };
...@@ -494,13 +494,13 @@ gst_qtdemux_loop_header (GstPad * pad) ...@@ -494,13 +494,13 @@ gst_qtdemux_loop_header (GstPad * pad)
guint32 length; guint32 length;
guint32 fourcc; guint32 fourcc;
GstBuffer *buf = NULL; GstBuffer *buf = NULL;
int offset; guint64 offset;
guint64 cur_offset; guint64 cur_offset;
int size; int size;
GstFlowReturn ret; GstFlowReturn ret;
cur_offset = qtdemux->offset; cur_offset = qtdemux->offset;
GST_DEBUG ("loop at position %" G_GUINT64_FORMAT ", state %d", GST_DEBUG_OBJECT (qtdemux, "loop at position %" G_GUINT64_FORMAT ", state %d",
cur_offset, qtdemux->state); cur_offset, qtdemux->state);
switch (qtdemux->state) { switch (qtdemux->state) {
...@@ -596,15 +596,14 @@ gst_qtdemux_loop_header (GstPad * pad) ...@@ -596,15 +596,14 @@ gst_qtdemux_loop_header (GstPad * pad)
min_time = G_MAXUINT64; min_time = G_MAXUINT64;
for (i = 0; i < qtdemux->n_streams; i++) { for (i = 0; i < qtdemux->n_streams; i++) {
stream = qtdemux->streams[i]; stream = qtdemux->streams[i];
if (stream->sample_index < stream->n_samples && if (stream->sample_index < stream->n_samples &&
stream->samples[stream->sample_index].timestamp < min_time) { stream->samples[stream->sample_index].timestamp < min_time) {
min_time = stream->samples[stream->sample_index].timestamp; min_time = stream->samples[stream->sample_index].timestamp;
index = i; index = i;
} }
} }
if (index == -1) { if (index == -1) {
GST_DEBUG_OBJECT (qtdemux, "No samples left for any streams - EOS");
gst_pad_event_default (qtdemux->sinkpad, gst_event_new_eos ()); gst_pad_event_default (qtdemux->sinkpad, gst_event_new_eos ());
break; break;
} }
...@@ -619,11 +618,13 @@ gst_qtdemux_loop_header (GstPad * pad) ...@@ -619,11 +618,13 @@ gst_qtdemux_loop_header (GstPad * pad)
index, stream->sample_index, offset, size, index, stream->sample_index, offset, size,
stream->samples[stream->sample_index].timestamp); stream->samples[stream->sample_index].timestamp);
GST_DEBUG ("reading %d bytes", size);
buf = NULL; buf = NULL;
if (size > 0) {
GST_DEBUG_OBJECT (qtdemux, "reading %d bytes @ ", size);
if (gst_pad_pull_range (qtdemux->sinkpad, offset, if (gst_pad_pull_range (qtdemux->sinkpad, offset,
size, &buf) != GST_FLOW_OK) size, &buf) != GST_FLOW_OK)
goto error; goto error;
}
if (buf) { if (buf) {
/* hum... FIXME changing framerate breaks horribly, better set /* hum... FIXME changing framerate breaks horribly, better set
...@@ -722,8 +723,6 @@ void ...@@ -722,8 +723,6 @@ void
gst_qtdemux_add_stream (GstQTDemux * qtdemux, gst_qtdemux_add_stream (GstQTDemux * qtdemux,
QtDemuxStream * stream, GstTagList * list) QtDemuxStream * stream, GstTagList * list)
{ {
gchar *caps;
if (stream->subtype == GST_MAKE_FOURCC ('v', 'i', 'd', 'e')) { if (stream->subtype == GST_MAKE_FOURCC ('v', 'i', 'd', 'e')) {
GstPadTemplate *templ; GstPadTemplate *templ;
gchar *name = g_strdup_printf ("video_%02d", qtdemux->n_video_streams); gchar *name = g_strdup_printf ("video_%02d", qtdemux->n_video_streams);
...@@ -732,8 +731,13 @@ gst_qtdemux_add_stream (GstQTDemux * qtdemux, ...@@ -732,8 +731,13 @@ gst_qtdemux_add_stream (GstQTDemux * qtdemux,
stream->pad = gst_pad_new_from_template (templ, name); stream->pad = gst_pad_new_from_template (templ, name);
gst_object_unref (templ); gst_object_unref (templ);
g_free (name); g_free (name);
if (stream->samples[0].duration == 0) {
stream->fps_n = 0;
stream->fps_d = 1;
} else {
stream->fps_n = stream->timescale; stream->fps_n = stream->timescale;
stream->fps_d = stream->samples[0].duration; stream->fps_d = stream->samples[0].duration;
}
if (stream->caps) { if (stream->caps) {
gst_caps_set_simple (stream->caps, gst_caps_set_simple (stream->caps,
...@@ -769,9 +773,7 @@ gst_qtdemux_add_stream (GstQTDemux * qtdemux, ...@@ -769,9 +773,7 @@ gst_qtdemux_add_stream (GstQTDemux * qtdemux,
gst_qtdemux_get_src_query_types); gst_qtdemux_get_src_query_types);
gst_pad_set_query_function (stream->pad, gst_qtdemux_handle_src_query); gst_pad_set_query_function (stream->pad, gst_qtdemux_handle_src_query);
caps = gst_caps_to_string (stream->caps); GST_DEBUG ("setting caps %" GST_PTR_FORMAT, stream->caps);
GST_DEBUG ("setting caps %s", caps);
g_free (caps);
gst_pad_set_caps (stream->pad, stream->caps); gst_pad_set_caps (stream->pad, stream->caps);
GST_DEBUG ("adding pad %s %p to qtdemux %p", GST_DEBUG ("adding pad %s %p to qtdemux %p",
...@@ -2203,7 +2205,7 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak) ...@@ -2203,7 +2205,7 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
samples_per_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 4); samples_per_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 4);
for (j = first_chunk; j < last_chunk; j++) { for (j = first_chunk; j < last_chunk; j++) {
int chunk_offset; guint64 chunk_offset;
if (stco) { if (stco) {
chunk_offset = QTDEMUX_GUINT32_GET (stco->data + 16 + j * 4); chunk_offset = QTDEMUX_GUINT32_GET (stco->data + 16 + j * 4);
...@@ -2275,7 +2277,7 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak) ...@@ -2275,7 +2277,7 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
samples_per_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 4); samples_per_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 4);
for (j = first_chunk; j < last_chunk; j++) { for (j = first_chunk; j < last_chunk; j++) {
int chunk_offset; guint64 chunk_offset;
if (j >= n_samples) if (j >= n_samples)
goto done2; goto done2;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment