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.
This commit is contained in:
parent
a9904a33bc
commit
0afd3d7733
@ -1,3 +1,10 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2004-01-16 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
2004-01-16 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
|
||||||
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_connect):
|
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_connect):
|
||||||
|
@ -7,8 +7,7 @@ libgstmpeg2enc_la_SOURCES = \
|
|||||||
gstmpeg2encstreamwriter.cc \
|
gstmpeg2encstreamwriter.cc \
|
||||||
gstmpeg2encpicturereader.cc
|
gstmpeg2encpicturereader.cc
|
||||||
libgstmpeg2enc_la_CXXFLAGS = $(MPEG2ENC_CFLAGS) $(GST_CFLAGS)
|
libgstmpeg2enc_la_CXXFLAGS = $(MPEG2ENC_CFLAGS) $(GST_CFLAGS)
|
||||||
libgstmpeg2enc_la_LIBADD = $(MPEG2ENC_LIBS)
|
libgstmpeg2enc_la_LIBADD = $(MPEG2ENC_LIBS) $(GST_PLUGIN_LDFLAGS)
|
||||||
libgstmpeg2enc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
|
||||||
|
|
||||||
noinst_HEADERS = \
|
noinst_HEADERS = \
|
||||||
gstmpeg2enc.hh \
|
gstmpeg2enc.hh \
|
||||||
|
@ -205,6 +205,8 @@ gst_mpeg2enc_init (GstMpeg2enc *enc)
|
|||||||
GstElement *element = GST_ELEMENT (enc);
|
GstElement *element = GST_ELEMENT (enc);
|
||||||
GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
|
GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
|
||||||
|
|
||||||
|
GST_FLAG_SET (element, GST_ELEMENT_EVENT_AWARE);
|
||||||
|
|
||||||
enc->sinkpad = gst_pad_new_from_template (
|
enc->sinkpad = gst_pad_new_from_template (
|
||||||
gst_element_class_get_pad_template (klass, "sink"), "sink");
|
gst_element_class_get_pad_template (klass, "sink"), "sink");
|
||||||
gst_pad_set_link_function (enc->sinkpad, gst_mpeg2enc_sink_link);
|
gst_pad_set_link_function (enc->sinkpad, gst_mpeg2enc_sink_link);
|
||||||
@ -258,6 +260,7 @@ gst_mpeg2enc_loop (GstElement *element)
|
|||||||
}
|
}
|
||||||
|
|
||||||
enc->encoder->encodePicture ();
|
enc->encoder->encodePicture ();
|
||||||
|
gst_pad_event_default (enc->sinkpad, gst_event_new (GST_EVENT_EOS));
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstPadLinkReturn
|
static GstPadLinkReturn
|
||||||
|
@ -79,7 +79,7 @@ GstMpeg2EncPictureReader::StreamPictureParams (MPEG2EncInVidParams &strm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read a frame.
|
* Read a frame. Return true means EOS or error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -89,19 +89,27 @@ GstMpeg2EncPictureReader::LoadFrame ()
|
|||||||
GstBuffer *buf = NULL;
|
GstBuffer *buf = NULL;
|
||||||
gint i, x, y, n;
|
gint i, x, y, n;
|
||||||
guint8 *frame;
|
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 {
|
do {
|
||||||
if ((data = (GstData *) gst_pad_get_element_private (pad))) {
|
if ((data = (GstData *) gst_pad_get_element_private (pad))) {
|
||||||
gst_pad_set_element_private (pad, NULL);
|
gst_pad_set_element_private (pad, NULL);
|
||||||
} else if (!(data = gst_pad_pull (pad))) {
|
} else if (!(data = gst_pad_pull (pad))) {
|
||||||
|
gst_element_error (gst_pad_get_parent (pad),
|
||||||
|
"Failed to read data");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GST_IS_EVENT (data)) {
|
if (GST_IS_EVENT (data)) {
|
||||||
if (GST_EVENT_TYPE (data) == GST_EVENT_EOS) {
|
if (GST_EVENT_TYPE (data) == GST_EVENT_EOS) {
|
||||||
gst_pad_event_default (pad, GST_EVENT (data));
|
gst_event_unref (GST_EVENT (data));
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
gst_pad_event_default (pad, GST_EVENT (data));
|
||||||
}
|
}
|
||||||
gst_pad_event_default (pad, GST_EVENT (data));
|
|
||||||
} else {
|
} else {
|
||||||
buf = GST_BUFFER (data);
|
buf = GST_BUFFER (data);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user