summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
m---------common0
-rw-r--r--ext/faad/gstfaad.c24
-rw-r--r--gst/qtdemux/qtdemux.c38
4 files changed, 52 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index 8b7a11a2..de49e971 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+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>
* configure.ac:
diff --git a/common b/common
-Subproject fe94837afc0b10eaf867156fc29eea0073ba45d
+Subproject 4edc214072fe07d2aade96bc336493425654d7b
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);
diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c
index cfd2c7f7..84c2facb 100644
--- a/gst/qtdemux/qtdemux.c
+++ b/gst/qtdemux/qtdemux.c
@@ -69,7 +69,7 @@ struct _QtDemuxSample
int sample_index;
int chunk;
int size;
- guint32 offset;
+ guint64 offset;
guint64 timestamp; /* In GstClockTime */
guint32 duration; /* in stream->timescale units */
};
@@ -494,13 +494,13 @@ gst_qtdemux_loop_header (GstPad * pad)
guint32 length;
guint32 fourcc;
GstBuffer *buf = NULL;
- int offset;
+ guint64 offset;
guint64 cur_offset;
int size;
GstFlowReturn ret;
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);
switch (qtdemux->state) {
@@ -596,15 +596,14 @@ gst_qtdemux_loop_header (GstPad * pad)
min_time = G_MAXUINT64;
for (i = 0; i < qtdemux->n_streams; i++) {
stream = qtdemux->streams[i];
-
if (stream->sample_index < stream->n_samples &&
stream->samples[stream->sample_index].timestamp < min_time) {
min_time = stream->samples[stream->sample_index].timestamp;
index = i;
}
}
-
if (index == -1) {
+ GST_DEBUG_OBJECT (qtdemux, "No samples left for any streams - EOS");
gst_pad_event_default (qtdemux->sinkpad, gst_event_new_eos ());
break;
}
@@ -619,11 +618,13 @@ gst_qtdemux_loop_header (GstPad * pad)
index, stream->sample_index, offset, size,
stream->samples[stream->sample_index].timestamp);
- GST_DEBUG ("reading %d bytes", size);
buf = NULL;
- if (gst_pad_pull_range (qtdemux->sinkpad, offset,
- size, &buf) != GST_FLOW_OK)
- goto error;
+ if (size > 0) {
+ GST_DEBUG_OBJECT (qtdemux, "reading %d bytes @ ", size);
+ if (gst_pad_pull_range (qtdemux->sinkpad, offset,
+ size, &buf) != GST_FLOW_OK)
+ goto error;
+ }
if (buf) {
/* hum... FIXME changing framerate breaks horribly, better set
@@ -722,8 +723,6 @@ void
gst_qtdemux_add_stream (GstQTDemux * qtdemux,
QtDemuxStream * stream, GstTagList * list)
{
- gchar *caps;
-
if (stream->subtype == GST_MAKE_FOURCC ('v', 'i', 'd', 'e')) {
GstPadTemplate *templ;
gchar *name = g_strdup_printf ("video_%02d", qtdemux->n_video_streams);
@@ -732,8 +731,13 @@ gst_qtdemux_add_stream (GstQTDemux * qtdemux,
stream->pad = gst_pad_new_from_template (templ, name);
gst_object_unref (templ);
g_free (name);
- stream->fps_n = stream->timescale;
- stream->fps_d = stream->samples[0].duration;
+ if (stream->samples[0].duration == 0) {
+ stream->fps_n = 0;
+ stream->fps_d = 1;
+ } else {
+ stream->fps_n = stream->timescale;
+ stream->fps_d = stream->samples[0].duration;
+ }
if (stream->caps) {
gst_caps_set_simple (stream->caps,
@@ -769,9 +773,7 @@ gst_qtdemux_add_stream (GstQTDemux * qtdemux,
gst_qtdemux_get_src_query_types);
gst_pad_set_query_function (stream->pad, gst_qtdemux_handle_src_query);
- caps = gst_caps_to_string (stream->caps);
- GST_DEBUG ("setting caps %s", caps);
- g_free (caps);
+ GST_DEBUG ("setting caps %" GST_PTR_FORMAT, stream->caps);
gst_pad_set_caps (stream->pad, stream->caps);
GST_DEBUG ("adding pad %s %p to qtdemux %p",
@@ -2203,7 +2205,7 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
samples_per_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 4);
for (j = first_chunk; j < last_chunk; j++) {
- int chunk_offset;
+ guint64 chunk_offset;
if (stco) {
chunk_offset = QTDEMUX_GUINT32_GET (stco->data + 16 + j * 4);
@@ -2275,7 +2277,7 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
samples_per_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 4);
for (j = first_chunk; j < last_chunk; j++) {
- int chunk_offset;
+ guint64 chunk_offset;
if (j >= n_samples)
goto done2;