summaryrefslogtreecommitdiffstats
path: root/ext/mplex/gstmplexoutputstream.cc
diff options
context:
space:
mode:
authorMark Nauwelaerts <manauw@skynet.be>2008-03-05 06:03:03 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-03-05 06:03:03 +0000
commitacb81c58c547b0e6155fd61b7914f39deea428ad (patch)
tree8427c825ea71f1fee1dbc46b37e4b9d35d6a14c8 /ext/mplex/gstmplexoutputstream.cc
parent646ac4cdf2054e5cd38c1869701a4e839f8436b2 (diff)
downloadgst-plugins-bad-acb81c58c547b0e6155fd61b7914f39deea428ad.tar.gz
gst-plugins-bad-acb81c58c547b0e6155fd61b7914f39deea428ad.tar.bz2
gst-plugins-bad-acb81c58c547b0e6155fd61b7914f39deea428ad.zip
Port mplex element to 0.10. Fixes bug #520329.
Original commit message from CVS: Patch by: Mark Nauwelaerts <manauw at skynet dot be> * configure.ac: * ext/Makefile.am: * ext/mplex/Makefile.am: * ext/mplex/gstmplex.cc: * ext/mplex/gstmplex.hh: * ext/mplex/gstmplexibitstream.cc: * ext/mplex/gstmplexibitstream.hh: * ext/mplex/gstmplexjob.cc: * ext/mplex/gstmplexjob.hh: * ext/mplex/gstmplexoutputstream.cc: * ext/mplex/gstmplexoutputstream.hh: Port mplex element to 0.10. Fixes bug #520329. * tests/check/Makefile.am: * tests/check/elements/mplex.c: (test_sink_event), (setup_src_pad), (teardown_src_pad), (setup_mplex), (cleanup_mplex), (GST_START_TEST), (mplex_suite), (main): Add unit test for the mplex element.
Diffstat (limited to 'ext/mplex/gstmplexoutputstream.cc')
-rw-r--r--ext/mplex/gstmplexoutputstream.cc35
1 files changed, 25 insertions, 10 deletions
diff --git a/ext/mplex/gstmplexoutputstream.cc b/ext/mplex/gstmplexoutputstream.cc
index 206c13ec..5a0cc5ae 100644
--- a/ext/mplex/gstmplexoutputstream.cc
+++ b/ext/mplex/gstmplexoutputstream.cc
@@ -1,5 +1,6 @@
/* GStreamer mplex (mjpegtools) wrapper
* (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
+ * (c) 2008 Mark Nauwelaerts <mnauw@users.sourceforge.net>
*
* gstmplexoutputstream.hh: gstreamer/mplex output stream wrapper
*
@@ -25,16 +26,17 @@
#include <string.h>
+#include "gstmplex.hh"
#include "gstmplexoutputstream.hh"
/*
* Class init functions.
*/
-GstMplexOutputStream::GstMplexOutputStream (GstElement * _element, GstPad * _pad):
+GstMplexOutputStream::GstMplexOutputStream (GstMplex * _element, GstPad * _pad):
OutputStream ()
{
- element = _element;
+ mplex = _element;
pad = _pad;
size = 0;
}
@@ -54,21 +56,32 @@ GstMplexOutputStream::Open (void)
void
GstMplexOutputStream::Close (void)
{
- gst_pad_push (pad, GST_DATA (gst_event_new (GST_EVENT_EOS)));
- gst_element_set_eos (element);
+ GST_MPLEX_MUTEX_LOCK (mplex);
+ GST_DEBUG_OBJECT (mplex, "closing stream and sending eos");
+ gst_pad_push_event (pad, gst_event_new_eos ());
+ /* notify chain there is no more need to supply buffers */
+ mplex->eos = TRUE;
+ GST_MPLEX_SIGNAL_ALL (mplex);
+ GST_MPLEX_MUTEX_UNLOCK (mplex);
}
/*
* Get size of current segment.
*/
-off_t GstMplexOutputStream::SegmentSize (void)
+#if GST_MJPEGTOOLS_API >= 10900
+uint64_t
+GstMplexOutputStream::SegmentSize (void)
+#else
+off_t
+GstMplexOutputStream::SegmentSize (void)
+#endif
{
return size;
}
/*
- * Next segment.
+ * Next segment; not really supported.
*/
void
@@ -76,9 +89,8 @@ GstMplexOutputStream::NextSegment (void)
{
size = 0;
- /* send EOS. The filesink (or whatever) handles that
- * and opens a new file. */
- gst_pad_push (pad, GST_DATA (gst_event_new (GST_EVENT_EOS)));
+ GST_WARNING_OBJECT (mplex, "multiple file output is not supported");
+ /* FIXME: no such filesink behaviour to be expected */
}
/*
@@ -94,5 +106,8 @@ GstMplexOutputStream::Write (guint8 * data, guint len)
memcpy (GST_BUFFER_DATA (buf), data, len);
size += len;
- gst_pad_push (pad, GST_DATA (buf));
+ GST_MPLEX_MUTEX_LOCK (mplex);
+ gst_buffer_set_caps (buf, GST_PAD_CAPS (pad));
+ mplex->srcresult = gst_pad_push (pad, buf);
+ GST_MPLEX_MUTEX_UNLOCK (mplex);
}