+2004-05-08 Iain <iain@prettypeople.org>
+
+ * gst/wavparse/gstwavparse.[ch]: Rewrote to use RiffRead instead.
+ * gst-libs/gst/riff/riff-read.c (gst_riff_read_peek_head): Unstatic it
+ (gst_riff_read_element_data): Ditto, and added a got_bytes argument to
+ return the length that was read.
+ (gst_riff_read_strf_auds): Allow fmt tags as well.
+
2004-05-07 David Schleef <ds@schleef.org>
* ext/faad/gstfaad.c: (gst_faad_sinkconnect): HACK to correct
/* WAV stuff */
#define GST_RIFF_TAG_fmt GST_MAKE_FOURCC ('f','m','t',' ')
#define GST_RIFF_TAG_data GST_MAKE_FOURCC ('d','a','t','a')
-
+#define GST_RIFF_TAG_cue GST_MAKE_FOURCC ('c','u','e',' ')
/* LIST types */
#define GST_RIFF_LIST_movi GST_MAKE_FOURCC ('m','o','v','i')
#define GST_RIFF_LIST_hdrl GST_MAKE_FOURCC ('h','d','r','l')
#define GST_RIFF_LIST_strl GST_MAKE_FOURCC ('s','t','r','l')
#define GST_RIFF_LIST_INFO GST_MAKE_FOURCC ('I','N','F','O')
#define GST_RIFF_LIST_AVIX GST_MAKE_FOURCC ('A','V','I','X')
+#define GST_RIFF_LIST_adtl GST_MAKE_FOURCC ('a','d','t','l')
/* fcc types */
#define GST_RIFF_FCC_vids GST_MAKE_FOURCC ('v','i','d','s')
* TRUE on success or FALSE on failure.
*/
-static gboolean
+gboolean
gst_riff_peek_head (GstRiffRead * riff,
guint32 * tag, guint32 * length, guint * level_up)
{
* Return: the data, as a GstBuffer.
*/
-static GstBuffer *
-gst_riff_read_element_data (GstRiffRead * riff, guint length)
+GstBuffer *
+gst_riff_read_element_data (GstRiffRead * riff, guint length, guint * got_bytes)
{
GstBuffer *buf = NULL;
+ guint32 got;
- if (gst_bytestream_peek (riff->bs, &buf, length) != length) {
- GST_ELEMENT_ERROR (riff, RESOURCE, READ, (NULL), (NULL));
- if (buf)
- gst_buffer_unref (buf);
- return NULL;
+ while ((got = gst_bytestream_peek (riff->bs, &buf, length)) != length) {
+ /*GST_ELEMENT_ERROR (riff, RESOURCE, READ, (NULL), (NULL)); */
+ GstEvent *event = NULL;
+ guint32 remaining;
+
+ gst_bytestream_get_status (riff->bs, &remaining, &event);
+ if (GST_IS_EVENT (event)) {
+ gst_pad_event_default (riff->sinkpad, event);
+ if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
+
+ if (buf)
+ gst_buffer_unref (buf);
+
+ if (got_bytes)
+ *got_bytes = got;
+
+ return NULL;
+ }
+ } else {
+ GST_ELEMENT_ERROR (riff, RESOURCE, READ, (NULL), (NULL));
+ if (buf)
+ gst_buffer_unref (buf);
+
+ if (got_bytes)
+ *got_bytes = got;
+
+ return NULL;
+ }
}
/* we need 16-bit alignment */
gst_bytestream_flush (riff->bs, length);
+ if (got_bytes)
+ *got_bytes = got;
+
return buf;
}
return FALSE;
gst_bytestream_flush_fast (riff->bs, 8);
- return ((*buf = gst_riff_read_element_data (riff, length)) != NULL);
+ return ((*buf = gst_riff_read_element_data (riff, length, NULL)) != NULL);
}
/*
if (!gst_riff_read_data (riff, &tag, &buf))
return FALSE;
- if (tag != GST_RIFF_TAG_strf) {
+ if (tag != GST_RIFF_TAG_strf && tag != GST_RIFF_TAG_fmt) {
g_warning ("Not a strf chunk");
gst_buffer_unref (buf);
return FALSE;
guint32 gst_riff_peek_tag (GstRiffRead *riff,
guint *level_up);
guint32 gst_riff_peek_list (GstRiffRead *riff);
+gboolean gst_riff_peek_head (GstRiffRead *riff,
+ guint32 *tag,
+ guint32 *length,
+ guint *level_up);
GstEvent *gst_riff_read_seek (GstRiffRead *riff,
guint64 offset);
guint32 *tag);
gboolean gst_riff_read_header (GstRiffRead *read,
guint32 *doctype);
-
+GstBuffer *gst_riff_read_element_data (GstRiffRead *riff,
+ guint length,
+ guint *got_bytes);
/*
* Utility functions (including byteswapping).
*/