diff options
author | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2004-01-16 14:14:58 +0000 |
---|---|---|
committer | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2004-01-16 14:14:58 +0000 |
commit | 0afd3d77334fac3654fa433abf3dab611ea95493 (patch) | |
tree | 4eceb4609c92648309858682a669c7fddd5682ab /ext/mpeg2enc/gstmpeg2encpicturereader.cc | |
parent | a9904a33bcd273aebd3000c793c2da51ed48d31a (diff) | |
download | gst-plugins-bad-0afd3d77334fac3654fa433abf3dab611ea95493.tar.gz gst-plugins-bad-0afd3d77334fac3654fa433abf3dab611ea95493.tar.bz2 gst-plugins-bad-0afd3d77334fac3654fa433abf3dab611ea95493.zip |
ext/mpeg2enc/: Bugfix with respect to EOS handling.
Original commit message from CVS:
2004-01-16 Ronald Bultje <rbultje@ronald.bitfreak.net>
* ext/mpeg2enc/Makefile.am:
* ext/mpeg2enc/gstmpeg2enc.cc:
* ext/mpeg2enc/gstmpeg2encpicturereader.cc:
Bugfix with respect to EOS handling.
Diffstat (limited to 'ext/mpeg2enc/gstmpeg2encpicturereader.cc')
-rw-r--r-- | ext/mpeg2enc/gstmpeg2encpicturereader.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/ext/mpeg2enc/gstmpeg2encpicturereader.cc b/ext/mpeg2enc/gstmpeg2encpicturereader.cc index 004495e7..57e4110b 100644 --- a/ext/mpeg2enc/gstmpeg2encpicturereader.cc +++ b/ext/mpeg2enc/gstmpeg2encpicturereader.cc @@ -79,7 +79,7 @@ GstMpeg2EncPictureReader::StreamPictureParams (MPEG2EncInVidParams &strm) } /* - * Read a frame. + * Read a frame. Return true means EOS or error. */ bool @@ -89,19 +89,27 @@ GstMpeg2EncPictureReader::LoadFrame () GstBuffer *buf = NULL; gint i, x, y, n; guint8 *frame; + GstFormat fmt = GST_FORMAT_DEFAULT; + gint64 pos = 0, tot = 0; + gst_pad_query (GST_PAD_PEER (pad), GST_QUERY_POSITION, &fmt, &pos); + gst_pad_query (GST_PAD_PEER (pad), GST_QUERY_TOTAL, &fmt, &tot); do { if ((data = (GstData *) gst_pad_get_element_private (pad))) { gst_pad_set_element_private (pad, NULL); } else if (!(data = gst_pad_pull (pad))) { + gst_element_error (gst_pad_get_parent (pad), + "Failed to read data"); return true; } + if (GST_IS_EVENT (data)) { if (GST_EVENT_TYPE (data) == GST_EVENT_EOS) { - gst_pad_event_default (pad, GST_EVENT (data)); + gst_event_unref (GST_EVENT (data)); return true; + } else { + gst_pad_event_default (pad, GST_EVENT (data)); } - gst_pad_event_default (pad, GST_EVENT (data)); } else { buf = GST_BUFFER (data); } |