summaryrefslogtreecommitdiff
path: root/ext/mpeg2enc/gstmpeg2encoder.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/gstmpeg2encoder.cc
parent15ac9f5a1398cc7a65f5d44fd53452c2cdf27bc6 (diff)
downloadgstreamer-plugins-bad-646ac4cdf2054e5cd38c1869701a4e839f8436b2.tar.gz
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/gstmpeg2encoder.cc')
-rw-r--r--ext/mpeg2enc/gstmpeg2encoder.cc33
1 files changed, 17 insertions, 16 deletions
diff --git a/ext/mpeg2enc/gstmpeg2encoder.cc b/ext/mpeg2enc/gstmpeg2encoder.cc
index c8d1b3e0f..acfda5052 100644
--- a/ext/mpeg2enc/gstmpeg2encoder.cc
+++ b/ext/mpeg2enc/gstmpeg2encoder.cc
@@ -26,8 +26,10 @@
#include <mpegconsts.h>
#include <quantize.hh>
-#ifdef GST_MJPEGTOOLS_19x
+#if GST_MJPEGTOOLS_API >= 10900
#include <ontheflyratectl.hh>
+#include <pass1ratectl.hh>
+#include <pass2ratectl.hh>
#else
#include <ratectl.hh>
#endif
@@ -57,18 +59,19 @@ GstMpeg2Encoder::~GstMpeg2Encoder ()
gst_object_unref (element);
}
-gboolean
-GstMpeg2Encoder::setup ()
+gboolean GstMpeg2Encoder::setup ()
{
- MPEG2EncInVidParams strm;
- GstMpeg2enc *enc;
+ MPEG2EncInVidParams
+ strm;
+ GstMpeg2enc *
+ enc;
enc = GST_MPEG2ENC (element);
/* I/O */
reader = new GstMpeg2EncPictureReader (element, caps, &parms);
reader->StreamPictureParams (strm);
-#if defined(GST_MJPEGTOOLS_18x) && !defined(GST_MJPEGTOOLS_19x)
+#if GST_MJPEGTOOLS_API == 10800
/* chain thread caters for reading, do not need another thread for this */
options.allow_parallel_read = FALSE;
#endif
@@ -79,22 +82,20 @@ GstMpeg2Encoder::setup ()
/* encoding internals */
quantizer = new Quantizer (parms);
-#ifdef GST_MJPEGTOOLS_19x
+#if GST_MJPEGTOOLS_API < 10900
+ bitrate_controller = new OnTheFlyRateCtl (parms);
+#else
pass1ratectl = new OnTheFlyPass1 (parms);
pass2ratectl = new OnTheFlyPass2 (parms);
-#else
- bitrate_controller = new OnTheFlyRateCtl (parms);
#endif
-
-#ifdef GST_MJPEGTOOLS_18x
+#if GST_MJPEGTOOLS_API >= 10900
/* sequencer */
-# ifdef GST_MJPEGTOOLS_19x
seqencoder = new SeqEncoder (parms, *reader, *quantizer,
*writer, *pass1ratectl, *pass2ratectl);
-# else
+#elif GST_MJPEGTOOLS_API >= 10800
+ /* sequencer */
seqencoder = new SeqEncoder (parms, *reader, *quantizer,
*writer, *bitrate_controller);
-# endif
#else
coder = new MPEG2Coder (parms, *writer);
/* sequencer */
@@ -112,7 +113,7 @@ GstMpeg2Encoder::init ()
parms.Init (options);
reader->Init ();
quantizer->Init ();
-#ifdef GST_MJPEGTOOLS_18x
+#if GST_MJPEGTOOLS_API >= 10800
seqencoder->Init ();
#endif
init_done = TRUE;
@@ -127,7 +128,7 @@ void
GstMpeg2Encoder::encode ()
{
/* hm, this is all... eek! */
-#ifdef GST_MJPEGTOOLS_18x
+#if GST_MJPEGTOOLS_API >= 10800
seqencoder->EncodeStream ();
#else
seqencoder->Encode ();