mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
gst-libs/gst/riff/riff-read.*: Add _peek version (req'ed in CDXA).
Original commit message from CVS: * gst-libs/gst/riff/riff-read.c: (gst_riff_peek_element_data), (gst_riff_read_element_data): * gst-libs/gst/riff/riff-read.h: Add _peek version (req'ed in CDXA). * gst/cdxaparse/gstcdxaparse.c: (gst_cdxaparse_init), (gst_cdxaparse_loop): Fix parsing in playbin. * gst/playback/gstdecodebin.c: (close_pad_link): Ignore current_ pads, they cause major annoyance.
This commit is contained in:
parent
0c9eca74c2
commit
d9c770356c
4 changed files with 50 additions and 13 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2005-01-19 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
|
||||||
|
* gst-libs/gst/riff/riff-read.c: (gst_riff_peek_element_data),
|
||||||
|
(gst_riff_read_element_data):
|
||||||
|
* gst-libs/gst/riff/riff-read.h:
|
||||||
|
Add _peek version (req'ed in CDXA).
|
||||||
|
* gst/cdxaparse/gstcdxaparse.c: (gst_cdxaparse_init),
|
||||||
|
(gst_cdxaparse_loop):
|
||||||
|
Fix parsing in playbin.
|
||||||
|
* gst/playback/gstdecodebin.c: (close_pad_link):
|
||||||
|
Ignore current_ pads, they cause major annoyance.
|
||||||
|
|
||||||
2005-01-19 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
2005-01-19 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
|
||||||
* ext/alsa/gstalsasink.c: (gst_alsa_sink_loop):
|
* ext/alsa/gstalsasink.c: (gst_alsa_sink_loop):
|
||||||
|
|
|
@ -260,7 +260,7 @@ gst_riff_peek_head (GstRiffRead * riff,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GstBuffer *
|
GstBuffer *
|
||||||
gst_riff_read_element_data (GstRiffRead * riff, guint length, guint * got_bytes)
|
gst_riff_peek_element_data (GstRiffRead * riff, guint length, guint * got_bytes)
|
||||||
{
|
{
|
||||||
GstBuffer *buf = NULL;
|
GstBuffer *buf = NULL;
|
||||||
guint32 got;
|
guint32 got;
|
||||||
|
@ -272,14 +272,28 @@ gst_riff_read_element_data (GstRiffRead * riff, guint length, guint * got_bytes)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (got_bytes)
|
||||||
|
*got_bytes = got;
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
GstBuffer *
|
||||||
|
gst_riff_read_element_data (GstRiffRead * riff, guint length, guint * got_bytes)
|
||||||
|
{
|
||||||
|
GstBuffer *buf;
|
||||||
|
|
||||||
|
if (!(buf = gst_riff_peek_element_data (riff, length, got_bytes)))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
/* we need 16-bit alignment */
|
/* we need 16-bit alignment */
|
||||||
if (length & 1)
|
if (length & 1)
|
||||||
length++;
|
length++;
|
||||||
|
|
||||||
gst_bytestream_flush (riff->bs, length);
|
if (!gst_bytestream_flush (riff->bs, length)) {
|
||||||
|
gst_buffer_unref (buf);
|
||||||
if (got_bytes)
|
return NULL;
|
||||||
*got_bytes = got;
|
}
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,6 +85,9 @@ gboolean gst_riff_read_header (GstRiffRead *read,
|
||||||
GstBuffer *gst_riff_read_element_data (GstRiffRead *riff,
|
GstBuffer *gst_riff_read_element_data (GstRiffRead *riff,
|
||||||
guint length,
|
guint length,
|
||||||
guint *got_bytes);
|
guint *got_bytes);
|
||||||
|
GstBuffer *gst_riff_peek_element_data (GstRiffRead *riff,
|
||||||
|
guint length,
|
||||||
|
guint *got_bytes);
|
||||||
/*
|
/*
|
||||||
* Utility functions (including byteswapping).
|
* Utility functions (including byteswapping).
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -129,6 +129,8 @@ gst_cdxaparse_init (GstCDXAParse * cdxaparse)
|
||||||
cdxaparse->state = GST_CDXAPARSE_START;
|
cdxaparse->state = GST_CDXAPARSE_START;
|
||||||
cdxaparse->seek_pending = FALSE;
|
cdxaparse->seek_pending = FALSE;
|
||||||
cdxaparse->seek_offset = 0;
|
cdxaparse->seek_offset = 0;
|
||||||
|
|
||||||
|
GST_FLAG_SET (cdxaparse, GST_ELEMENT_EVENT_AWARE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -149,7 +151,7 @@ gst_cdxaparse_stream_init (GstCDXAParse * cdxa)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read 'fmt ' header */
|
/* Read 'fmt ' header */
|
||||||
static gboolean
|
static gboolean G_GNUC_UNUSED
|
||||||
gst_cdxaparse_fmt (GstCDXAParse * cdxa)
|
gst_cdxaparse_fmt (GstCDXAParse * cdxa)
|
||||||
{
|
{
|
||||||
GstRiffRead *riff = GST_RIFF_READ (cdxa);
|
GstRiffRead *riff = GST_RIFF_READ (cdxa);
|
||||||
|
@ -165,7 +167,7 @@ gst_cdxaparse_fmt (GstCDXAParse * cdxa)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean G_GNUC_UNUSED
|
||||||
gst_cdxaparse_other (GstCDXAParse * cdxa)
|
gst_cdxaparse_other (GstCDXAParse * cdxa)
|
||||||
{
|
{
|
||||||
GstRiffRead *riff = GST_RIFF_READ (cdxa);
|
GstRiffRead *riff = GST_RIFF_READ (cdxa);
|
||||||
|
@ -203,7 +205,7 @@ gst_cdxaparse_loop (GstElement * element)
|
||||||
if (cdxa->state == GST_CDXAPARSE_DATA) {
|
if (cdxa->state == GST_CDXAPARSE_DATA) {
|
||||||
if (cdxa->dataleft > 0) {
|
if (cdxa->dataleft > 0) {
|
||||||
gint sync;
|
gint sync;
|
||||||
guint32 got_bytes, desired;
|
guint got_bytes, desired;
|
||||||
GstBuffer *buf = NULL;
|
GstBuffer *buf = NULL;
|
||||||
GstBuffer *outbuf = NULL;
|
GstBuffer *outbuf = NULL;
|
||||||
|
|
||||||
|
@ -211,11 +213,10 @@ gst_cdxaparse_loop (GstElement * element)
|
||||||
desired = cdxa->dataleft;
|
desired = cdxa->dataleft;
|
||||||
if (desired > 1024)
|
if (desired > 1024)
|
||||||
desired = 1024;
|
desired = 1024;
|
||||||
if (gst_bytestream_peek (riff->bs, &buf, desired) != desired) {
|
if (!(buf = gst_riff_peek_element_data (riff, desired, &got_bytes)))
|
||||||
GST_ELEMENT_ERROR (element, RESOURCE, READ, (NULL), (NULL));
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
sync = gst_cdxastrip_sync (buf);
|
sync = gst_cdxastrip_sync (buf);
|
||||||
|
gst_buffer_unref (buf);
|
||||||
if (sync == -1) {
|
if (sync == -1) {
|
||||||
gst_bytestream_flush_fast (riff->bs, desired);
|
gst_bytestream_flush_fast (riff->bs, desired);
|
||||||
cdxa->dataleft -= desired;
|
cdxa->dataleft -= desired;
|
||||||
|
@ -237,6 +238,7 @@ gst_cdxaparse_loop (GstElement * element)
|
||||||
|
|
||||||
/* Skip CDXA headers, only keep data */
|
/* Skip CDXA headers, only keep data */
|
||||||
outbuf = gst_cdxastrip_strip (buf);
|
outbuf = gst_cdxastrip_strip (buf);
|
||||||
|
GST_DEBUG ("Pushing one buffer");
|
||||||
gst_pad_push (cdxa->srcpad, GST_DATA (outbuf));
|
gst_pad_push (cdxa->srcpad, GST_DATA (outbuf));
|
||||||
|
|
||||||
if (got_bytes < cdxa->dataleft)
|
if (got_bytes < cdxa->dataleft)
|
||||||
|
@ -253,15 +255,21 @@ gst_cdxaparse_loop (GstElement * element)
|
||||||
case GST_CDXAPARSE_START:
|
case GST_CDXAPARSE_START:
|
||||||
if (!gst_cdxaparse_stream_init (cdxa))
|
if (!gst_cdxaparse_stream_init (cdxa))
|
||||||
return;
|
return;
|
||||||
|
cdxa->state = GST_CDXAPARSE_DATA;
|
||||||
|
cdxa->dataleft = cdxa->datasize =
|
||||||
|
(guint64) gst_bytestream_length (riff->bs);
|
||||||
|
cdxa->datastart = gst_bytestream_tell (riff->bs);
|
||||||
|
break;
|
||||||
|
#if 0
|
||||||
cdxa->state = GST_CDXAPARSE_FMT;
|
cdxa->state = GST_CDXAPARSE_FMT;
|
||||||
/* fall-through */
|
/* fall-through */
|
||||||
|
|
||||||
case GST_CDXAPARSE_FMT:
|
case GST_CDXAPARSE_FMT:
|
||||||
if (!gst_cdxaparse_fmt (cdxa))
|
if (0 && !gst_cdxaparse_fmt (cdxa))
|
||||||
return;
|
return;
|
||||||
cdxa->state = GST_CDXAPARSE_OTHER;
|
cdxa->state = GST_CDXAPARSE_OTHER;
|
||||||
/* fall-through */
|
/* fall-through */
|
||||||
|
#endif
|
||||||
case GST_CDXAPARSE_OTHER:
|
case GST_CDXAPARSE_OTHER:
|
||||||
if (!gst_cdxaparse_other (cdxa))
|
if (!gst_cdxaparse_other (cdxa))
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue