mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
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
This commit is contained in:
parent
b57b82d528
commit
1501b485b1
4 changed files with 53 additions and 23 deletions
12
ChangeLog
12
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:
|
||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
|||
Subproject commit fe94837afc0b10eaf867156fc29eea0073ba45df
|
||||
Subproject commit 4edc214072fe07d2aade96bc336493425654d7b4
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue