summaryrefslogtreecommitdiffstats
path: root/ext/mpeg2enc/gstmpeg2encstreamwriter.cc
diff options
context:
space:
mode:
authorMark Nauwelaerts <manauw@skynet.be>2008-03-05 05:38:06 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-03-05 05:38:06 +0000
commit646ac4cdf2054e5cd38c1869701a4e839f8436b2 (patch)
tree1b3a85ca8e1109983e8fc3c8c9138eb92c48615c /ext/mpeg2enc/gstmpeg2encstreamwriter.cc
parent15ac9f5a1398cc7a65f5d44fd53452c2cdf27bc6 (diff)
downloadgst-plugins-bad-646ac4cdf2054e5cd38c1869701a4e839f8436b2.tar.gz
gst-plugins-bad-646ac4cdf2054e5cd38c1869701a4e839f8436b2.tar.bz2
gst-plugins-bad-646ac4cdf2054e5cd38c1869701a4e839f8436b2.zip
configure.ac: Clean up detection of different mjpegtoolsAPI versions.
Original commit message from CVS: Patch by: Mark Nauwelaerts <manauw at skynet dot be> * configure.ac: Clean up detection of different mjpegtoolsAPI versions. * ext/mpeg2enc/gstmpeg2enc.cc: * ext/mpeg2enc/gstmpeg2enc.hh: * ext/mpeg2enc/gstmpeg2encoder.cc: * ext/mpeg2enc/gstmpeg2encoptions.cc: * ext/mpeg2enc/gstmpeg2encpicturereader.cc: * ext/mpeg2enc/gstmpeg2encpicturereader.hh: * ext/mpeg2enc/gstmpeg2encstreamwriter.cc: * ext/mpeg2enc/gstmpeg2encstreamwriter.hh: Streamline conditional code for evolving mjpegtools API, optimize and fix/prevent crash in log handling, use names/nicks for enums in the usual way andm inor updates in code and properties/settings. Partially fixes bug #520329.
Diffstat (limited to 'ext/mpeg2enc/gstmpeg2encstreamwriter.cc')
-rw-r--r--ext/mpeg2enc/gstmpeg2encstreamwriter.cc17
1 files changed, 13 insertions, 4 deletions
diff --git a/ext/mpeg2enc/gstmpeg2encstreamwriter.cc b/ext/mpeg2enc/gstmpeg2encstreamwriter.cc
index ee3fefd6..a17e82dd 100644
--- a/ext/mpeg2enc/gstmpeg2encstreamwriter.cc
+++ b/ext/mpeg2enc/gstmpeg2encstreamwriter.cc
@@ -28,7 +28,7 @@
#include "gstmpeg2encstreamwriter.hh"
#include <string.h>
-#ifdef GST_MJPEGTOOLS_18x
+#if GST_MJPEGTOOLS_API >= 10800
/*
* Class init stuff.
@@ -51,7 +51,7 @@ void
GstMpeg2EncStreamWriter::WriteOutBufferUpto (const guint8 * buffer,
const guint32 flush_upto)
{
- GstBuffer *buf;
+ GstBuffer *buf, *inbuf;
GstMpeg2enc *enc = GST_MPEG2ENC (GST_PAD_PARENT (pad));
buf = gst_buffer_new_and_alloc (flush_upto);
@@ -62,12 +62,21 @@ GstMpeg2EncStreamWriter::WriteOutBufferUpto (const guint8 * buffer,
/* this should not block anything else (e.g. chain), but if it does,
* it's ok as mpeg2enc is not really a loop-based element, but push-based */
GST_MPEG2ENC_MUTEX_LOCK (enc);
+ /* best effort at giving output some meaningful time metadata
+ * no mpeg2enc specs on this though, but it might help getting the output
+ * into container formats that really do like timestamps (unlike mplex) */
+ if ((inbuf = (GstBuffer *) g_queue_pop_head (enc->time))) {
+ GST_BUFFER_TIMESTAMP (buf) = GST_BUFFER_TIMESTAMP (inbuf);
+ GST_BUFFER_DURATION (buf) = GST_BUFFER_DURATION (inbuf);
+ gst_buffer_unref (inbuf);
+ }
gst_buffer_set_caps (buf, GST_PAD_CAPS (pad));
enc->srcresult = gst_pad_push (pad, buf);
GST_MPEG2ENC_MUTEX_UNLOCK (enc);
}
-guint64 GstMpeg2EncStreamWriter::BitCount ()
+guint64
+GstMpeg2EncStreamWriter::BitCount ()
{
return flushed * 8ll;
}
@@ -157,4 +166,4 @@ void
GstMpeg2EncStreamWriter::FrameDiscard ()
{
}
-#endif /* GST_MJPEGTOOLS_18x */
+#endif /* GST_MJPEGTOOLS_API >= 10800 */