Commit 9003ed34 authored by Ronald S. Bultje's avatar Ronald S. Bultje

configure.ac: Fix configure check for mpeg2enc. We need 1.6.1.93 instead of...

configure.ac: Fix configure check for mpeg2enc. We need 1.6.1.93 instead of 1.6.1.92, since the pkg-config file of 1....

Original commit message from CVS:
2004-01-01  Ronald Bultje  <rbultje@ronald.bitfreak.net>

* configure.ac:
Fix configure check for mpeg2enc. We need 1.6.1.93 instead of
1.6.1.92, since the pkg-config file of 1.6.1.92 is borked and
it therefore uses the wrong include paths. Too bad... Note
that 1.6.1.93 is not release yet. ;).
Also add a check for mplex, which is now using the lib'ified
mplex from mjpegtools, too.
* ext/ffmpeg/gstffmpegcodecmap.c:
Add codec_tag for 3ivx/xvid. For xvid, this should fix playback
issues. I don't think ffmpeg handles 3ivx correctly, so this
probably won't work. But it won't hurt either.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_connect),
(gst_ffmpegdec_chain):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_connect),
(gst_ffmpegenc_chain_audio):
Fix memleak in audio encoding. Close codec if open fails, this
calls the cleanup routines so we can re-use the context.
* ext/mpeg2enc/gstmpeg2enc.cc:
Fix pad template names/types, fix memory issue with getcaps().
* ext/mpeg2enc/gstmpeg2encoder.cc:
* ext/mpeg2enc/gstmpeg2encoder.hh:
Fix compile issue with new caps system (const thingy).
* ext/mpeg2enc/gstmpeg2encpicturereader.cc:
* ext/mpeg2enc/gstmpeg2encpicturereader.hh:
We read a first frame right on initing, so that we have a caps
when we init the output. This caps is cached in padprivate and
read as first frame.
* ext/mplex/Makefile.am:
* ext/mplex/gstmplex.cc:
* ext/mplex/gstmplex.h:
* 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:
We wrap mjpegtools mplex. So I rewrote the plugin. The old plugin
had issues, didn't do capsnego, supported only a subset of the
mplex features and required a mplex fork in our local CVS. Plus
that it worked agaist a very old mplex version. Rewriting was
faster than updating it.
* gst-libs/ext/Makefile.am:
* gst-libs/ext/mplex/INSTRUCT:
* gst-libs/ext/mplex/Makefile.am:
* gst-libs/ext/mplex/README:
* gst-libs/ext/mplex/TODO:
* gst-libs/ext/mplex/ac3strm_in.cc:
* gst-libs/ext/mplex/audiostrm.hh:
* gst-libs/ext/mplex/audiostrm_out.cc:
* gst-libs/ext/mplex/aunit.hh:
* gst-libs/ext/mplex/bits.cc:
* gst-libs/ext/mplex/bits.hh:
* gst-libs/ext/mplex/buffer.cc:
* gst-libs/ext/mplex/buffer.hh:
* gst-libs/ext/mplex/fastintfns.h:
* gst-libs/ext/mplex/format_codes.h:
* gst-libs/ext/mplex/inputstrm.cc:
* gst-libs/ext/mplex/inputstrm.hh:
* gst-libs/ext/mplex/lpcmstrm_in.cc:
* gst-libs/ext/mplex/mjpeg_logging.cc:
* gst-libs/ext/mplex/mjpeg_logging.h:
* gst-libs/ext/mplex/mjpeg_types.h:
* gst-libs/ext/mplex/mpastrm_in.cc:
* gst-libs/ext/mplex/mpegconsts.cc:
* gst-libs/ext/mplex/mpegconsts.h:
* gst-libs/ext/mplex/mplexconsts.hh:
* gst-libs/ext/mplex/multplex.cc:
* gst-libs/ext/mplex/outputstream.hh:
* gst-libs/ext/mplex/padstrm.cc:
* gst-libs/ext/mplex/padstrm.hh:
* gst-libs/ext/mplex/stillsstream.cc:
* gst-libs/ext/mplex/stillsstream.hh:
* gst-libs/ext/mplex/systems.cc:
* gst-libs/ext/mplex/systems.hh:
* gst-libs/ext/mplex/vector.cc:
* gst-libs/ext/mplex/vector.hh:
* gst-libs/ext/mplex/videostrm.hh:
* gst-libs/ext/mplex/videostrm_in.cc:
* gst-libs/ext/mplex/videostrm_out.cc:
* gst-libs/ext/mplex/yuv4mpeg.cc:
* gst-libs/ext/mplex/yuv4mpeg.h:
* gst-libs/ext/mplex/yuv4mpeg_intern.h:
* gst-libs/ext/mplex/yuv4mpeg_ratio.cc:
We don't fork mjpegtools' mplex in our CVS anymore.
* gst/avi/gstavidemux.c: (gst_avi_demux_src_getcaps),
(gst_avi_demux_add_stream):
* gst/avi/gstavidemux.h:
Add getcaps() function for proper caps nego. This makes some
parts of AVI playback/reading work.
* sys/ximage/ximagesink.c: (gst_ximagesink_sinkconnect):
Resize window on new capsnego. This is probably wrong, but
I'm still committing it because with current capsnego, the
first successfull capsnego is auto-fixated, therefore rounded
down to the lowest values in the caps. this results in a 16x16
XWindow that is not reized when real capsnego finishes.
Dave, I see more cases of this, do you know a proper solution?
* tools/gst-launch-ext.in:
Fix MPEG-4 AAC (Apple iPod/iTunes) file commandline.
parent 0e302471
2004-01-01 Ronald Bultje <rbultje@ronald.bitfreak.net>
* configure.ac:
Fix configure check for mpeg2enc. We need 1.6.1.93 instead of
1.6.1.92, since the pkg-config file of 1.6.1.92 is borked and
it therefore uses the wrong include paths. Too bad... Note
that 1.6.1.93 is not release yet. ;).
Also add a check for mplex, which is now using the lib'ified
mplex from mjpegtools, too.
* ext/ffmpeg/gstffmpegcodecmap.c:
Add codec_tag for 3ivx/xvid. For xvid, this should fix playback
issues. I don't think ffmpeg handles 3ivx correctly, so this
probably won't work. But it won't hurt either.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_connect),
(gst_ffmpegdec_chain):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_connect),
(gst_ffmpegenc_chain_audio):
Fix memleak in audio encoding. Close codec if open fails, this
calls the cleanup routines so we can re-use the context.
* ext/mpeg2enc/gstmpeg2enc.cc:
Fix pad template names/types, fix memory issue with getcaps().
* ext/mpeg2enc/gstmpeg2encoder.cc:
* ext/mpeg2enc/gstmpeg2encoder.hh:
Fix compile issue with new caps system (const thingy).
* ext/mpeg2enc/gstmpeg2encpicturereader.cc:
* ext/mpeg2enc/gstmpeg2encpicturereader.hh:
We read a first frame right on initing, so that we have a caps
when we init the output. This caps is cached in padprivate and
read as first frame.
* ext/mplex/Makefile.am:
* ext/mplex/gstmplex.cc:
* ext/mplex/gstmplex.h:
* 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:
We wrap mjpegtools mplex. So I rewrote the plugin. The old plugin
had issues, didn't do capsnego, supported only a subset of the
mplex features and required a mplex fork in our local CVS. Plus
that it worked agaist a very old mplex version. Rewriting was
faster than updating it.
* gst-libs/ext/Makefile.am:
* gst-libs/ext/mplex/INSTRUCT:
* gst-libs/ext/mplex/Makefile.am:
* gst-libs/ext/mplex/README:
* gst-libs/ext/mplex/TODO:
* gst-libs/ext/mplex/ac3strm_in.cc:
* gst-libs/ext/mplex/audiostrm.hh:
* gst-libs/ext/mplex/audiostrm_out.cc:
* gst-libs/ext/mplex/aunit.hh:
* gst-libs/ext/mplex/bits.cc:
* gst-libs/ext/mplex/bits.hh:
* gst-libs/ext/mplex/buffer.cc:
* gst-libs/ext/mplex/buffer.hh:
* gst-libs/ext/mplex/fastintfns.h:
* gst-libs/ext/mplex/format_codes.h:
* gst-libs/ext/mplex/inputstrm.cc:
* gst-libs/ext/mplex/inputstrm.hh:
* gst-libs/ext/mplex/lpcmstrm_in.cc:
* gst-libs/ext/mplex/mjpeg_logging.cc:
* gst-libs/ext/mplex/mjpeg_logging.h:
* gst-libs/ext/mplex/mjpeg_types.h:
* gst-libs/ext/mplex/mpastrm_in.cc:
* gst-libs/ext/mplex/mpegconsts.cc:
* gst-libs/ext/mplex/mpegconsts.h:
* gst-libs/ext/mplex/mplexconsts.hh:
* gst-libs/ext/mplex/multplex.cc:
* gst-libs/ext/mplex/outputstream.hh:
* gst-libs/ext/mplex/padstrm.cc:
* gst-libs/ext/mplex/padstrm.hh:
* gst-libs/ext/mplex/stillsstream.cc:
* gst-libs/ext/mplex/stillsstream.hh:
* gst-libs/ext/mplex/systems.cc:
* gst-libs/ext/mplex/systems.hh:
* gst-libs/ext/mplex/vector.cc:
* gst-libs/ext/mplex/vector.hh:
* gst-libs/ext/mplex/videostrm.hh:
* gst-libs/ext/mplex/videostrm_in.cc:
* gst-libs/ext/mplex/videostrm_out.cc:
* gst-libs/ext/mplex/yuv4mpeg.cc:
* gst-libs/ext/mplex/yuv4mpeg.h:
* gst-libs/ext/mplex/yuv4mpeg_intern.h:
* gst-libs/ext/mplex/yuv4mpeg_ratio.cc:
We don't fork mjpegtools' mplex in our CVS anymore.
* gst/avi/gstavidemux.c: (gst_avi_demux_src_getcaps),
(gst_avi_demux_add_stream):
* gst/avi/gstavidemux.h:
Add getcaps() function for proper caps nego. This makes some
parts of AVI playback/reading work.
* sys/ximage/ximagesink.c: (gst_ximagesink_sinkconnect):
Resize window on new capsnego. This is probably wrong, but
I'm still committing it because with current capsnego, the
first successfull capsnego is auto-fixated, therefore rounded
down to the lowest values in the caps. this results in a 16x16
XWindow that is not reized when real capsnego finishes.
Dave, I see more cases of this, do you know a proper solution?
* tools/gst-launch-ext.in:
Fix MPEG-4 AAC (Apple iPod/iTunes) file commandline.
2003-12-31 David Schleef <ds@schleef.org>
* gst/tcp/gsttcpsrc.c: (gst_tcpsrc_get):
......
......@@ -1084,7 +1084,7 @@ GST_CHECK_FEATURE(MPEG2ENC, [mpeg2enc], mpeg2enc, [
dnl libmpeg2enc was first included in mjpegtools-1.6.2-rc3 (1.6.1.92)
dnl since many distros include mjpegtools specifically without mplex
dnl and mpeg2enc, we check for mpeg2enc on its own, too.
PKG_CHECK_MODULES(MPEG2ENC, mjpegtools >= 1.6.1.92, [
PKG_CHECK_MODULES(MPEG2ENC, mjpegtools >= 1.6.1.93, [
dnl switch over to c++ to test things
AC_LANG_CPLUSPLUS
OLD_CPPFLAGS="$CPPFLAGS"
......@@ -1123,7 +1123,61 @@ main (int argc,
dnl *** mplex ***
translit(dnm, m, l) AM_CONDITIONAL(USE_MPLEX, true)
GST_CHECK_FEATURE(MPLEX, [mplex], mplex, [HAVE_MPLEX=$HAVE_CXX])
GST_CHECK_FEATURE(MPLEX, [mplex], mplex, [
HAVE_MPLEX="no"
dnl we require a c++ compiler for this one
if [ test x$HAVE_CXX = xyes ]; then
dnl libmplex was first included in mjpegtools-1.6.2-rc4 (1.6.1.93)
dnl since many distros include mjpegtools specifically without mplex
dnl and mpeg2enc, we check for mplex on its own, too.
PKG_CHECK_MODULES(MPLEX, mjpegtools >= 1.6.1.93, [
dnl switch over to c++ to test things
AC_LANG_CPLUSPLUS
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $MPLEX_CFLAGS"
AC_CHECK_HEADER(interact.hpp, [
MPLEX_LIBS="$MPLEX_LIBS -lmplex2 -lm"
OLD_LIBS="$LIBS"
LIBS="$LIBS $MPLEX_LIBS"
AC_MSG_CHECKING([for valid mplex objects])
AC_TRY_RUN([
#include <interact.hpp>
#include <outputstrm.hpp>
#include <multiplexor.hpp>
int
main (int argc,
char *argv[])
{
class TestOutputStream : public OutputStream {
public:
TestOutputStream () : OutputStream () { }
void Write (uint8_t *a, unsigned int b) { }
void NextSegment () { }
off_t SegmentSize () { }
void Close () { }
int Open () { }
};
MultiplexJob *job = new MultiplexJob ();
vector<IBitStream *> inputs;
job->SetupInputStreams (inputs);
TestOutputStream *out = new TestOutputStream ();
Multiplexor mux (*job, *out);
return 0;
}
],[
HAVE_MPLEX="yes"
AC_SUBST(MPLEX_CFLAGS)
AC_SUBST(MPLEX_LIBS)
AC_MSG_RESULT(yes)
], AC_MSG_RESULT(no))
LIBS="$OLD_LIBS"
])
CPPFLAGS="$OLD_CPPFLAGS"
AC_LANG_C
], HAVE_MPLEX="no")
fi
])
dnl *** pango ***
translit(dnm, m, l) AM_CONDITIONAL(USE_PANGO, true)
......@@ -1588,7 +1642,6 @@ gst-libs/gst/xoverlay/Makefile
gst-libs/gst/xwindowlistener/Makefile
gst-libs/ext/Makefile
gst-libs/ext/ffmpeg/Makefile
gst-libs/ext/mplex/Makefile
examples/dynparams/Makefile
examples/capsfilter/Makefile
examples/seeking/Makefile
......
......@@ -89,7 +89,7 @@ src_templ (void)
NULL);
add_fps (caps);
templ = gst_pad_template_new ("sink", GST_PAD_SINK,
templ = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS, caps);
}
......@@ -205,14 +205,15 @@ static void
gst_mpeg2enc_init (GstMpeg2enc *enc)
{
GstElement *element = GST_ELEMENT (enc);
GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
enc->sinkpad = gst_pad_new_from_template (
gst_element_get_pad_template (element, "sink"), "sink");
gst_element_class_get_pad_template (klass, "sink"), "sink");
gst_pad_set_link_function (enc->sinkpad, gst_mpeg2enc_sink_link);
gst_element_add_pad (element, enc->sinkpad);
enc->srcpad = gst_pad_new_from_template (
gst_element_get_pad_template (element, "src"), "src");
gst_element_class_get_pad_template (klass, "src"), "src");
gst_pad_set_getcaps_function (enc->srcpad, gst_mpeg2enc_src_getcaps);
gst_element_add_pad (element, enc->srcpad);
......@@ -229,7 +230,12 @@ gst_mpeg2enc_loop (GstElement *element)
GstMpeg2enc *enc = GST_MPEG2ENC (element);
if (!enc->encoder) {
GstCaps *caps;
const GstCaps *caps;
GstData *data;
/* make sure we've had data */
data = gst_pad_pull (enc->sinkpad);
gst_pad_set_element_private (enc->sinkpad, data);
if (!(caps = GST_PAD_CAPS (enc->sinkpad))) {
gst_element_error (element,
......@@ -281,8 +287,8 @@ gst_mpeg2enc_src_getcaps (GstPad *pad)
return enc->encoder->getFormat ();
}
return (GstCaps* ) gst_pad_template_get_caps (
gst_element_get_pad_template (gst_pad_get_parent (pad), "src"));
return gst_caps_copy (gst_pad_template_get_caps (
gst_element_get_pad_template (gst_pad_get_parent (pad), "src")));
}
static void
......
......@@ -37,7 +37,7 @@
GstMpeg2Encoder::GstMpeg2Encoder (GstMpeg2EncOptions *options,
GstPad *sinkpad,
GstCaps *caps,
const GstCaps *caps,
GstPad *srcpad) :
MPEG2Encoder (*options)
{
......
......@@ -31,7 +31,7 @@ class GstMpeg2Encoder : public MPEG2Encoder {
public:
GstMpeg2Encoder (GstMpeg2EncOptions *options,
GstPad *sinkpad,
GstCaps *caps,
const GstCaps *caps,
GstPad *srcpad);
/* one image */
......
......@@ -32,7 +32,7 @@
*/
GstMpeg2EncPictureReader::GstMpeg2EncPictureReader (GstPad *in_pad,
GstCaps *in_caps,
const GstCaps *in_caps,
EncoderParams *params) :
PictureReader (*params)
{
......@@ -91,9 +91,12 @@ GstMpeg2EncPictureReader::LoadFrame ()
guint8 *frame;
do {
if (!(data = gst_pad_pull (pad))) {
if ((data = (GstData *) gst_pad_get_element_private (pad))) {
gst_pad_set_element_private (pad, NULL);
} else if (!(data = gst_pad_pull (pad))) {
return true;
} else if (GST_IS_EVENT (data)) {
}
if (GST_IS_EVENT (data)) {
if (GST_EVENT_TYPE (data) == GST_EVENT_EOS) {
gst_pad_event_default (pad, GST_EVENT (data));
return true;
......
......@@ -30,7 +30,7 @@
class GstMpeg2EncPictureReader : public PictureReader {
public:
GstMpeg2EncPictureReader (GstPad *pad,
GstCaps *caps,
const GstCaps *caps,
EncoderParams *params);
~GstMpeg2EncPictureReader ();
......
plugin_LTLIBRARIES = libgstmplex.la
libgstmplex_la_SOURCES = gstmplex.cc
libgstmplex_la_CXXFLAGS = $(GST_CFLAGS) -I$(top_srcdir)/gst-libs/ext/mplex/
libgstmplex_la_LIBADD = $(LIBM_LIBS) $(top_builddir)/gst-libs/ext/mplex/libmplex.la
libgstmplex_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
noinst_HEADERS = gstmplex.h
libgstmplex_la_SOURCES = \
gstmplex.cc \
gstmplexibitstream.cc \
gstmplexjob.cc \
gstmplexoutputstream.cc
libgstmplex_la_CXXFLAGS = $(GST_CFLAGS) $(MPLEX_CFLAGS)
libgstmplex_la_LIBADD = $(MPLEX_LIBS)
libgstmplex_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
noinst_HEADERS = \
gstmplex.hh \
gstmplexibitstream.hh \
gstmplexjob.hh \
gstmplexoutputstream.hh
This diff is collapsed.
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
/* GStreamer mplex (mjpegtools) wrapper
* (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* gstmplex.hh: gstreamer mplex wrapper
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -17,87 +19,46 @@
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_MPLEX_H__
#define __GST_MPLEX_H__
#include <stdlib.h>
#include <gst/gst.h>
#include <gst/bytestream/bytestream.h>
#include "outputstream.hh"
#include "bits.hh"
#include <multiplexor.hpp>
#include "gstmplexjob.hh"
G_BEGIN_DECLS
#define GST_TYPE_MPLEX \
(gst_mplex_get_type())
(gst_mplex_get_type ())
#define GST_MPLEX(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MPLEX,GstMPlex))
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MPLEX, GstMplex))
#define GST_MPLEX_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MPLEX,GstMPlex))
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MPLEX, GstMplex))
#define GST_IS_MPLEX(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MPLEX))
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MPLEX))
#define GST_IS_MPLEX_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MPLEX))
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MPLEX))
typedef enum {
GST_MPLEX_INIT,
GST_MPLEX_OPEN_STREAMS,
GST_MPLEX_RUN,
GST_MPLEX_END
} GstMPlexState;
typedef struct _GstMplex {
GstElement parent;
typedef enum {
GST_MPLEX_STREAM_UNKOWN,
GST_MPLEX_STREAM_AC3,
GST_MPLEX_STREAM_MPA,
GST_MPLEX_STREAM_LPCM,
GST_MPLEX_STREAM_VIDEO,
GST_MPLEX_STREAM_DVD_VIDEO,
} GstMPlexStreamType;
typedef struct _GstMPlex GstMPlex;
typedef struct _GstMPlexStream GstMPlexStream;
typedef struct _GstMPlexClass GstMPlexClass;
struct _GstMPlexStream {
IBitStream *bitstream;
ElementaryStream *elem_stream;
GstPad *pad;
GstMPlexStreamType type;
GstByteStream *bytestream;
gboolean eos;
};
struct _GstMPlex {
GstElement element;
GstMPlexState state;
/* pads */
GstPad *srcpad;
GList *streams;
GstPad *sinkpad, *srcpad;
guint num_apads, num_vpads;
/* options wrapper */
GstMplexJob *job;
vector<ElementaryStream *> *strms;
OutputStream *ostrm;
PS_Stream *ps_stream;
gint data_rate;
gint sync_offset;
/* general muxing object (contains rest) */
Multiplexor *mux;
} GstMplex;
gint num_video;
gint num_audio;
gint num_private1;
};
typedef struct _GstMplexClass {
GstElementClass parent;
} GstMplexClass;
struct _GstMPlexClass {
GstElementClass parent_class;
};
GType gst_mplex_get_type (void);
GType gst_mplex_get_type (void);
G_END_DECLS
#endif /* __GST_MPLEX_H__ */
/* GStreamer mplex (mjpegtools) wrapper
* (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* gstmplexibitstream.hh: gstreamer/mplex input bitstream wrapper
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include "gstmplexibitstream.hh"
/*
* Class init/exit functions.
*/
GstMplexIBitStream::GstMplexIBitStream (GstPad *_pad,
guint buf_size) :
IBitStream ()
{
guint8 *data;
pad = _pad;
bs = gst_bytestream_new (pad);
eos = FALSE;
streamname = g_strdup (gst_pad_get_name (_pad));
SetBufSize (buf_size);
eobs = false;
byteidx = 0;
/* we peek 1 byte (not even caring about the return value) so we
* are sure that we have data and thus capsnego must be completed
* when we return. */
gst_bytestream_peek_bytes (bs, &data, 1);
if (!ReadIntoBuffer () && buffered == 0) {
gst_element_error (gst_pad_get_parent (_pad),
"Failed to read from input stream %s",
gst_pad_get_name (pad));
}
}
GstMplexIBitStream::~GstMplexIBitStream (void)
{
gst_bytestream_destroy (bs);
}
/*
* Read data.
*/
size_t
GstMplexIBitStream::ReadStreamBytes (uint8_t *buf,
size_t size)
{
guint8 *data;
guint read;
if (eos)
return 0;
if ((read = gst_bytestream_peek_bytes (bs, &data, size)) != size) {
GstEvent *event;
guint pending;
gst_bytestream_get_status (bs, &pending, &event);
if (event) {
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
eos = TRUE;
break;
default:
break;
}
gst_event_unref (event);
}
}
memcpy (buf, data, read);
gst_bytestream_flush_fast (bs, read);
return read;
}
/*
* Are we at EOS?
*/
bool
GstMplexIBitStream::EndOfStream (void)
{
return eos;
}
/* GStreamer mplex (mjpegtools) wrapper
* (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* gstmplexibitstream.hh: gstreamer/mplex input bitstream wrapper
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_MPLEXIBITSTREAM_H__
#define __GST_MPLEXIBITSTREAM_H__
#include <gst/gst.h>
#include <gst/bytestream/bytestream.h>
#include <mjpeg_types.h>
#include <bits.hpp>
class GstMplexIBitStream : public IBitStream {
public:
GstMplexIBitStream (GstPad *pad,
guint buf_size = BUFFER_SIZE);
~GstMplexIBitStream (void);
protected:
/* read data */
size_t ReadStreamBytes (uint8_t *buf,
size_t number);
/* are we at EOS? */
bool EndOfStream (void);
private:
GstPad *pad;
GstByteStream *bs;
gboolean eos;
};
#endif /* __GST_MPLEXIBITSTREAM_H__ */
/* GStreamer mplex (mjpegtools) wrapper
* (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* gstmplexjob.hh: gstreamer/mplex multiplex-job wrapper
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gstmplexjob.hh"
enum {
ARG_0,
ARG_FORMAT,
ARG_MUX_BITRATE,
ARG_VBR,
ARG_SYSTEM_HEADERS,
ARG_SPLIT_SEQUENCE,
ARG_SEGMENT_SIZE,
ARG_PACKETS_PER_PACK,
ARG_SECTOR_SIZE,
ARG_WORKAROUND_MPLAYER_HDR
/* FILL ME */
};
/*
* Property enumeration types.
*/
#define GST_TYPE_MPLEX_FORMAT \
(gst_mplex_format_get_type ())
static GType
gst_mplex_format_get_type (void)
{
static GType mplex_format_type = 0;
if (!mplex_format_type) {
static const GEnumValue mplex_formats[] = {
{ 0, "0", "Generic MPEG-1" },
{ 1, "1", "Standard VCD" },
{ 2, "2", "User VCD" },
{ 3, "3", "Generic MPEG-2" },
{ 4, "4", "Standard SVCD" },
{ 5, "5", "User SVCD" },
{ 6, "6", "VCD Stills sequences" },
{ 7, "7", "SVCD Stills sequences" },
{ 8, "8", "DVD MPEG-2 for dvdauthor" },
{ 9, "9", "DVD MPEG-2" },
{ 0, NULL, NULL },
};
mplex_format_type =
g_enum_register_static ("GstMplexFormat",
mplex_formats);
}
return mplex_format_type;
}
/*
* Class init functions.
*/
GstMplexJob::GstMplexJob (void) :
MultiplexJob ()
{
/* blabla */
}
/*
* GObject properties.
*/
void
GstMplexJob::initProperties (GObjectClass *klass)
{
/* encoding profile */
g_object_class_install_property (klass, ARG_FORMAT,
g_param_spec_enum ("format", "Format", "Encoding profile format",
GST_TYPE_MPLEX_FORMAT, 0,
(GParamFlags) G_PARAM_READWRITE));
/* total stream datarate. Normally, this shouldn't be needed, but
* some DVD/VCD/SVCD players really need strict values to handle
* the created files correctly. */
g_object_class_install_property (klass, ARG_MUX_BITRATE,
g_param_spec_int ("mux-bitrate", "Mux. bitrate",
"Bitrate of output stream in kbps (0 = autodetect)",
0, 15 * 1024, 0, (GParamFlags) G_PARAM_READWRITE));
#if 0
{ "video-buffer", 1, 0, 'b' },
#endif
/* some boolean stuff for headers */
g_object_class_install_property (klass, ARG_VBR,
g_param_spec_boolean ("vbr", "VBR",
"Whether the input video stream is variable bitrate",
FALSE, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_SYSTEM_HEADERS,
g_param_spec_boolean ("system-headers", "System headers",
"Create system header in every pack for generic formats",
FALSE, (GParamFlags) G_PARAM_READWRITE));