Commit cbeebe3b authored by Ronald S. Bultje's avatar Ronald S. Bultje

ext/ffmpeg/gstffmpegprotocol.c: Add debug. Don't EOS unless all data was read.

Original commit message from CVS:
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_peek), (gst_ffmpegdata_read),
(gst_ffmpegdata_write), (gst_ffmpegdata_seek),
(gst_ffmpegdata_close):
Add debug. Don't EOS unless all data was read.
parent 3be46cad
2004-12-19 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_peek), (gst_ffmpegdata_read),
(gst_ffmpegdata_write), (gst_ffmpegdata_seek),
(gst_ffmpegdata_close):
Add debug. Don't EOS unless all data was read.
2004-12-19 Ronald S. Bultje <rbultje@ronald.bitfreak.net> 2004-12-19 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_peek), * ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_peek),
......
...@@ -50,6 +50,8 @@ gst_ffmpegdata_open (URLContext * h, const char *filename, int flags) ...@@ -50,6 +50,8 @@ gst_ffmpegdata_open (URLContext * h, const char *filename, int flags)
GstProtocolInfo *info; GstProtocolInfo *info;
GstPad *pad; GstPad *pad;
GST_LOG ("Opening %s", filename);
info = g_new0 (GstProtocolInfo, 1); info = g_new0 (GstProtocolInfo, 1);
info->flags = flags; info->flags = flags;
...@@ -96,7 +98,7 @@ gst_ffmpegdata_peek (URLContext * h, unsigned char *buf, int size) ...@@ -96,7 +98,7 @@ gst_ffmpegdata_peek (URLContext * h, unsigned char *buf, int size)
guint32 total, request; guint32 total, request;
guint8 *data; guint8 *data;
GstProtocolInfo *info; GstProtocolInfo *info;
gboolean have_event; gboolean have_event, will_get_eos;
info = (GstProtocolInfo *) h->priv_data; info = (GstProtocolInfo *) h->priv_data;
...@@ -108,12 +110,12 @@ gst_ffmpegdata_peek (URLContext * h, unsigned char *buf, int size) ...@@ -108,12 +110,12 @@ gst_ffmpegdata_peek (URLContext * h, unsigned char *buf, int size)
return 0; return 0;
do { do {
have_event = FALSE; have_event = FALSE, will_get_eos = FALSE;
/* prevent EOS */ /* prevent EOS */
if (gst_bytestream_tell (bs) + size > gst_bytestream_length (bs)) { if (gst_bytestream_tell (bs) + size >= gst_bytestream_length (bs)) {
request = (int) (gst_bytestream_length (bs) - gst_bytestream_tell (bs)); request = (int) (gst_bytestream_length (bs) - gst_bytestream_tell (bs));
info->eos = TRUE; will_get_eos = TRUE;
} else { } else {
request = size; request = size;
} }
...@@ -134,6 +136,8 @@ gst_ffmpegdata_peek (URLContext * h, unsigned char *buf, int size) ...@@ -134,6 +136,8 @@ gst_ffmpegdata_peek (URLContext * h, unsigned char *buf, int size)
g_warning ("gstffmpegprotocol: no bytestream event"); g_warning ("gstffmpegprotocol: no bytestream event");
return total; return total;
} }
GST_LOG ("Reading (req %d, got %d) gave event of type %d",
request, total, GST_EVENT_TYPE (event));
switch (GST_EVENT_TYPE (event)) { switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_DISCONTINUOUS: case GST_EVENT_DISCONTINUOUS:
gst_event_unref (event); gst_event_unref (event);
...@@ -155,6 +159,10 @@ gst_ffmpegdata_peek (URLContext * h, unsigned char *buf, int size) ...@@ -155,6 +159,10 @@ gst_ffmpegdata_peek (URLContext * h, unsigned char *buf, int size)
gst_pad_event_default (info->pad, event); gst_pad_event_default (info->pad, event);
break; break;
} }
} else {
GST_DEBUG ("got data (%d bytes)", request);
if (will_get_eos)
info->eos = TRUE;
} }
} while ((!info->eos && total != request) || have_event); } while ((!info->eos && total != request) || have_event);
...@@ -170,6 +178,8 @@ gst_ffmpegdata_read (URLContext * h, unsigned char *buf, int size) ...@@ -170,6 +178,8 @@ gst_ffmpegdata_read (URLContext * h, unsigned char *buf, int size)
GstByteStream *bs; GstByteStream *bs;
GstProtocolInfo *info; GstProtocolInfo *info;
GST_DEBUG ("Reading %d bytes of data", size);
info = (GstProtocolInfo *) h->priv_data; info = (GstProtocolInfo *) h->priv_data;
bs = info->bs; bs = info->bs;
res = gst_ffmpegdata_peek (h, buf, size); res = gst_ffmpegdata_peek (h, buf, size);
...@@ -177,6 +187,8 @@ gst_ffmpegdata_read (URLContext * h, unsigned char *buf, int size) ...@@ -177,6 +187,8 @@ gst_ffmpegdata_read (URLContext * h, unsigned char *buf, int size)
gst_bytestream_flush_fast (bs, res); gst_bytestream_flush_fast (bs, res);
} }
GST_DEBUG ("Returning %d bytes", res);
return res; return res;
} }
...@@ -186,6 +198,8 @@ gst_ffmpegdata_write (URLContext * h, unsigned char *buf, int size) ...@@ -186,6 +198,8 @@ gst_ffmpegdata_write (URLContext * h, unsigned char *buf, int size)
GstProtocolInfo *info; GstProtocolInfo *info;
GstBuffer *outbuf; GstBuffer *outbuf;
GST_DEBUG ("Writing %d bytes", size);
info = (GstProtocolInfo *) h->priv_data; info = (GstProtocolInfo *) h->priv_data;
g_return_val_if_fail (info->flags == URL_WRONLY, -EIO); g_return_val_if_fail (info->flags == URL_WRONLY, -EIO);
...@@ -207,6 +221,8 @@ gst_ffmpegdata_seek (URLContext * h, offset_t pos, int whence) ...@@ -207,6 +221,8 @@ gst_ffmpegdata_seek (URLContext * h, offset_t pos, int whence)
GstProtocolInfo *info; GstProtocolInfo *info;
guint64 newpos; guint64 newpos;
GST_DEBUG ("Seeking to %" G_GINT64_FORMAT ", whence=%d", pos, whence);
info = (GstProtocolInfo *) h->priv_data; info = (GstProtocolInfo *) h->priv_data;
/* get data (typefind hack) */ /* get data (typefind hack) */
...@@ -313,6 +329,8 @@ gst_ffmpegdata_close (URLContext * h) ...@@ -313,6 +329,8 @@ gst_ffmpegdata_close (URLContext * h)
info = (GstProtocolInfo *) h->priv_data; info = (GstProtocolInfo *) h->priv_data;
GST_LOG ("Closing file");
switch (info->flags) { switch (info->flags) {
case URL_WRONLY:{ case URL_WRONLY:{
/* send EOS - that closes down the stream */ /* send EOS - that closes down the stream */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment