ext/faad/gstfaad.c: Some cleanups.
Original commit message from CVS: * ext/faad/gstfaad.c: (gst_faad_setcaps), (gst_faad_chain), (gst_faad_close_decoder): Some cleanups. Added some more debugging. Don't ever ignore unlinked, we're not a demuxer. * gst/qtdemux/qtdemux.c: (gst_qtdemux_add_stream): Activate pad before adding it to the element.
This commit is contained in:
parent
91447f8428
commit
09624a5894
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
2006-10-06 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* ext/faad/gstfaad.c: (gst_faad_setcaps), (gst_faad_chain),
|
||||||
|
(gst_faad_close_decoder):
|
||||||
|
Some cleanups.
|
||||||
|
Added some more debugging.
|
||||||
|
Don't ever ignore unlinked, we're not a demuxer.
|
||||||
|
|
||||||
|
* gst/qtdemux/qtdemux.c: (gst_qtdemux_add_stream):
|
||||||
|
Activate pad before adding it to the element.
|
||||||
|
|
||||||
2006-10-06 Michael Smith <msmith@fluendo.com>
|
2006-10-06 Michael Smith <msmith@fluendo.com>
|
||||||
|
|
||||||
* ext/theora/theoradec.c: (gst_theoradec_reset),
|
* ext/theora/theoradec.c: (gst_theoradec_reset),
|
||||||
|
2
common
2
common
@ -1 +1 @@
|
|||||||
Subproject commit a4af1b8542911352e29d53fba47e2c3d7231ebdb
|
Subproject commit 83b08805d0c109b6dbdcfca0a8b9659b1c556480
|
@ -291,14 +291,21 @@ gst_faad_setcaps (GstPad * pad, GstCaps * caps)
|
|||||||
if ((value = gst_structure_get_value (str, "codec_data"))) {
|
if ((value = gst_structure_get_value (str, "codec_data"))) {
|
||||||
guint32 samplerate;
|
guint32 samplerate;
|
||||||
guint8 channels;
|
guint8 channels;
|
||||||
|
guint8 *cdata;
|
||||||
|
guint csize;
|
||||||
|
|
||||||
/* We have codec data, means packetised stream */
|
/* We have codec data, means packetised stream */
|
||||||
faad->packetised = TRUE;
|
faad->packetised = TRUE;
|
||||||
buf = GST_BUFFER (gst_value_get_mini_object (value));
|
buf = gst_value_get_buffer (value);
|
||||||
|
|
||||||
|
cdata = GST_BUFFER_DATA (buf);
|
||||||
|
csize = GST_BUFFER_SIZE (buf);
|
||||||
|
|
||||||
|
if (csize < 2)
|
||||||
|
goto wrong_length;
|
||||||
|
|
||||||
/* someone forgot that char can be unsigned when writing the API */
|
/* someone forgot that char can be unsigned when writing the API */
|
||||||
if ((gint8) faacDecInit2 (faad->handle,
|
if ((gint8) faacDecInit2 (faad->handle, cdata, csize, &samplerate,
|
||||||
GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf), &samplerate,
|
|
||||||
&channels) < 0)
|
&channels) < 0)
|
||||||
goto init_failed;
|
goto init_failed;
|
||||||
|
|
||||||
@ -351,6 +358,11 @@ gst_faad_setcaps (GstPad * pad, GstCaps * caps)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
wrong_length:
|
||||||
|
{
|
||||||
|
GST_DEBUG_OBJECT (faad, "codec_data less than 2 bytes long");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
init_failed:
|
init_failed:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (faad, "faacDecInit2() failed");
|
GST_DEBUG_OBJECT (faad, "faacDecInit2() failed");
|
||||||
@ -1028,7 +1040,6 @@ gst_faad_update_caps (GstFaad * faad, faacDecFrameInfo * info)
|
|||||||
* subsequent syncpoints (similar to mp3 typefinding in
|
* subsequent syncpoints (similar to mp3 typefinding in
|
||||||
* gst/typefind/) for ADTS because 12 bits isn't very reliable.
|
* gst/typefind/) for ADTS because 12 bits isn't very reliable.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_faad_sync (GstBuffer * buf, guint * off)
|
gst_faad_sync (GstBuffer * buf, guint * off)
|
||||||
{
|
{
|
||||||
@ -1197,6 +1208,7 @@ gst_faad_chain (GstPad * pad, GstBuffer * buffer)
|
|||||||
|
|
||||||
input_data = GST_BUFFER_DATA (buffer);
|
input_data = GST_BUFFER_DATA (buffer);
|
||||||
input_size = GST_BUFFER_SIZE (buffer);
|
input_size = GST_BUFFER_SIZE (buffer);
|
||||||
|
|
||||||
if (!faad->packetised) {
|
if (!faad->packetised) {
|
||||||
if (!gst_faad_sync (buffer, &sync_off)) {
|
if (!gst_faad_sync (buffer, &sync_off)) {
|
||||||
goto next;
|
goto next;
|
||||||
@ -1262,10 +1274,15 @@ gst_faad_chain (GstPad * pad, GstBuffer * buffer)
|
|||||||
out = faacDecDecode (faad->handle, &info, input_data + skip_bytes,
|
out = faacDecDecode (faad->handle, &info, input_data + skip_bytes,
|
||||||
input_size - skip_bytes);
|
input_size - skip_bytes);
|
||||||
|
|
||||||
if (info.error) {
|
if (info.error > 0) {
|
||||||
guint32 rate;
|
guint32 rate;
|
||||||
guint8 ch;
|
guint8 ch;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (faad, "decoding error: %s",
|
||||||
|
faacDecGetErrorMessage (info.error));
|
||||||
|
|
||||||
|
goto out;
|
||||||
|
|
||||||
if (!faad->packetised)
|
if (!faad->packetised)
|
||||||
goto decode_error;
|
goto decode_error;
|
||||||
|
|
||||||
@ -1303,6 +1320,7 @@ gst_faad_chain (GstPad * pad, GstBuffer * buffer)
|
|||||||
|
|
||||||
if (info.bytesconsumed > input_size)
|
if (info.bytesconsumed > input_size)
|
||||||
info.bytesconsumed = input_size;
|
info.bytesconsumed = input_size;
|
||||||
|
|
||||||
input_size -= info.bytesconsumed;
|
input_size -= info.bytesconsumed;
|
||||||
input_data += info.bytesconsumed;
|
input_data += info.bytesconsumed;
|
||||||
|
|
||||||
@ -1336,6 +1354,8 @@ gst_faad_chain (GstPad * pad, GstBuffer * buffer)
|
|||||||
guint bufsize = info.samples * faad->bps;
|
guint bufsize = info.samples * faad->bps;
|
||||||
guint num_samples = info.samples / faad->channels;
|
guint num_samples = info.samples / faad->channels;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (faad, "decoded %d samples", info.samples);
|
||||||
|
|
||||||
/* note: info.samples is total samples, not per channel */
|
/* note: info.samples is total samples, not per channel */
|
||||||
ret =
|
ret =
|
||||||
gst_pad_alloc_buffer_and_set_caps (faad->srcpad, 0, bufsize,
|
gst_pad_alloc_buffer_and_set_caps (faad->srcpad, 0, bufsize,
|
||||||
@ -1360,8 +1380,8 @@ gst_faad_chain (GstPad * pad, GstBuffer * buffer)
|
|||||||
"pushing buffer, off=%" G_GUINT64_FORMAT ", ts=%" GST_TIME_FORMAT,
|
"pushing buffer, off=%" G_GUINT64_FORMAT ", ts=%" GST_TIME_FORMAT,
|
||||||
GST_BUFFER_OFFSET (outbuf),
|
GST_BUFFER_OFFSET (outbuf),
|
||||||
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)));
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)));
|
||||||
if ((ret = gst_pad_push (faad->srcpad, outbuf)) != GST_FLOW_OK
|
ret = gst_pad_push (faad->srcpad, outbuf);
|
||||||
&& ret != GST_FLOW_NOT_LINKED)
|
if (ret != GST_FLOW_OK)
|
||||||
goto out;
|
goto out;
|
||||||
} else
|
} else
|
||||||
gst_buffer_unref (outbuf);
|
gst_buffer_unref (outbuf);
|
||||||
@ -1397,7 +1417,6 @@ init_failed:
|
|||||||
ret = GST_FLOW_ERROR;
|
ret = GST_FLOW_ERROR;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
init2_failed:
|
init2_failed:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (faad, STREAM, DECODE, (NULL),
|
GST_ELEMENT_ERROR (faad, STREAM, DECODE, (NULL),
|
||||||
@ -1405,7 +1424,6 @@ init2_failed:
|
|||||||
ret = GST_FLOW_ERROR;
|
ret = GST_FLOW_ERROR;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
decode_error:
|
decode_error:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (faad, STREAM, DECODE, (NULL),
|
GST_ELEMENT_ERROR (faad, STREAM, DECODE, (NULL),
|
||||||
@ -1443,8 +1461,10 @@ gst_faad_open_decoder (GstFaad * faad)
|
|||||||
static void
|
static void
|
||||||
gst_faad_close_decoder (GstFaad * faad)
|
gst_faad_close_decoder (GstFaad * faad)
|
||||||
{
|
{
|
||||||
faacDecClose (faad->handle);
|
if (faad->handle) {
|
||||||
faad->handle = NULL;
|
faacDecClose (faad->handle);
|
||||||
|
faad->handle = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstStateChangeReturn
|
static GstStateChangeReturn
|
||||||
|
@ -1905,6 +1905,7 @@ gst_qtdemux_add_stream (GstQTDemux * qtdemux,
|
|||||||
|
|
||||||
GST_DEBUG_OBJECT (qtdemux, "adding pad %s %p to qtdemux %p",
|
GST_DEBUG_OBJECT (qtdemux, "adding pad %s %p to qtdemux %p",
|
||||||
GST_OBJECT_NAME (stream->pad), stream->pad, qtdemux);
|
GST_OBJECT_NAME (stream->pad), stream->pad, qtdemux);
|
||||||
|
gst_pad_set_active (stream->pad, TRUE);
|
||||||
gst_element_add_pad (GST_ELEMENT (qtdemux), stream->pad);
|
gst_element_add_pad (GST_ELEMENT (qtdemux), stream->pad);
|
||||||
if (list) {
|
if (list) {
|
||||||
gst_element_found_tags_for_pad (GST_ELEMENT (qtdemux), stream->pad, list);
|
gst_element_found_tags_for_pad (GST_ELEMENT (qtdemux), stream->pad, list);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user