Commit 8a3b45aa authored by Edward Hervey's avatar Edward Hervey
parent 82b4f9bf
......@@ -417,6 +417,7 @@ AG_GST_CHECK_PLUGIN(app)
AG_GST_CHECK_PLUGIN(audioconvert)
AG_GST_CHECK_PLUGIN(audiorate)
AG_GST_CHECK_PLUGIN(audiotestsrc)
AG_GST_CHECK_PLUGIN(encoding)
AG_GST_CHECK_PLUGIN(ffmpegcolorspace)
AG_GST_CHECK_PLUGIN(gdp)
AG_GST_CHECK_PLUGIN(playback)
......@@ -914,6 +915,7 @@ gst/app/Makefile
gst/audioconvert/Makefile
gst/audiorate/Makefile
gst/audiotestsrc/Makefile
gst/encoding/Makefile
gst/ffmpegcolorspace/Makefile
gst/gdp/Makefile
gst/playback/Makefile
......
......@@ -50,7 +50,7 @@ MKDB_OPTIONS=--sgml-mode
# Extra options to supply to gtkdoc-fixref.
FIXXREF_OPTIONS=--extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html \
--extra-dir=$(GST_PREFIX)/share/gtk-doc/html \
--extra-dir=$(datadir)/gtk-doc/html
--extra-dir=$(datadir)/gtk-doc/html
# Used for dependencies.
HFILE_GLOB=$(DOC_SOURCE_DIR)/*/*/*.h
......@@ -102,6 +102,7 @@ EXTRA_HFILES = \
$(top_srcdir)/gst/audioconvert/audioconvert.h \
$(top_srcdir)/gst/audioconvert/gstaudioconvert.h \
$(top_srcdir)/gst/audiotestsrc/gstaudiotestsrc.h \
$(top_srcdir)/gst/encoding/gstencodebin.h \
$(top_srcdir)/gst/ffmpegcolorspace/gstffmpegcolorspace.h \
$(top_srcdir)/gst/gdp/gstgdpdepay.h \
$(top_srcdir)/gst/gdp/gstgdppay.h \
......
......@@ -31,6 +31,7 @@
<xi:include href="xml/element-clockoverlay.xml" />
<xi:include href="xml/element-decodebin.xml" />
<xi:include href="xml/element-decodebin2.xml" />
<xi:include href="xml/element-encodebin.xml" />
<xi:include href="xml/element-ffmpegcolorspace.xml" />
<xi:include href="xml/element-gdpdepay.xml" />
<xi:include href="xml/element-gdppay.xml" />
......@@ -80,6 +81,7 @@
<xi:include href="xml/plugin-audiotestsrc.xml" />
<xi:include href="xml/plugin-cdparanoia.xml" />
<xi:include href="xml/plugin-decodebin.xml" />
<xi:include href="xml/plugin-encoding.xml" />
<xi:include href="xml/plugin-ffmpegcolorspace.xml" />
<xi:include href="xml/plugin-gdp.xml" />
<xi:include href="xml/plugin-gio.xml" />
......
......@@ -247,6 +247,22 @@ GstDecodeBin2
<SUBSECTION Standard>
</SECTION>
<SECTION>
<FILE>element-encodebin</FILE>
<TITLE>encodebin</TITLE>
GstEncodeBin
<SUBSECTION Standard>
GST_ENCODE_BIN
GST_ENCODE_BIN_CLASS
GST_IS_ENCODE_BIN
GST_IS_ENCODE_BIN_CLASS
GST_TYPE_ENCODE_BIN
GstEncodeBinClass
gst_encode_bin_get_type
</SECTION>
<SECTION>
<FILE>element-ffmpegcolorspace</FILE>
<TITLE>ffmpegcolorspace</TITLE>
......
......@@ -158,6 +158,26 @@
<DEFAULT>TRUE</DEFAULT>
</ARG>
<ARG>
<NAME>GstXvImageSink::window-height</NAME>
<TYPE>guint64</TYPE>
<RANGE></RANGE>
<FLAGS>r</FLAGS>
<NICK>window-height</NICK>
<BLURB>Height of the window.</BLURB>
<DEFAULT>0</DEFAULT>
</ARG>
<ARG>
<NAME>GstXvImageSink::window-width</NAME>
<TYPE>guint64</TYPE>
<RANGE></RANGE>
<FLAGS>r</FLAGS>
<NICK>window-width</NICK>
<BLURB>Width of the window.</BLURB>
<DEFAULT>0</DEFAULT>
</ARG>
<ARG>
<NAME>GstXImageSink::display</NAME>
<TYPE>gchar*</TYPE>
......@@ -218,6 +238,26 @@
<DEFAULT>TRUE</DEFAULT>
</ARG>
<ARG>
<NAME>GstXImageSink::window-height</NAME>
<TYPE>guint64</TYPE>
<RANGE></RANGE>
<FLAGS>r</FLAGS>
<NICK>window-height</NICK>
<BLURB>Height of the window.</BLURB>
<DEFAULT>0</DEFAULT>
</ARG>
<ARG>
<NAME>GstXImageSink::window-width</NAME>
<TYPE>guint64</TYPE>
<RANGE></RANGE>
<FLAGS>r</FLAGS>
<NICK>window-width</NICK>
<BLURB>Width of the window.</BLURB>
<DEFAULT>0</DEFAULT>
</ARG>
<ARG>
<NAME>GstV4lSrc::autoprobe</NAME>
<TYPE>gboolean</TYPE>
......@@ -3378,3 +3418,63 @@
<DEFAULT>NULL</DEFAULT>
</ARG>
<ARG>
<NAME>GstEncodeBin::audio-jitter-tolerance</NAME>
<TYPE>guint64</TYPE>
<RANGE></RANGE>
<FLAGS>rw</FLAGS>
<NICK>Audio jitter tolerance</NICK>
<BLURB>Amount of timestamp jitter/imperfection to allow on audio streams before inserting/dropping samples (ns).</BLURB>
<DEFAULT>20000000</DEFAULT>
</ARG>
<ARG>
<NAME>GstEncodeBin::avoid-reencoding</NAME>
<TYPE>gboolean</TYPE>
<RANGE></RANGE>
<FLAGS>rw</FLAGS>
<NICK>Avoid re-encoding</NICK>
<BLURB>Whether to re-encode portions of compatible video streams that lay on segment boundaries.</BLURB>
<DEFAULT>FALSE</DEFAULT>
</ARG>
<ARG>
<NAME>GstEncodeBin::profile</NAME>
<TYPE>GstEncodingProfile*</TYPE>
<RANGE></RANGE>
<FLAGS>rw</FLAGS>
<NICK>Profile</NICK>
<BLURB>The GstEncodingProfile to use.</BLURB>
<DEFAULT></DEFAULT>
</ARG>
<ARG>
<NAME>GstEncodeBin::queue-buffers-max</NAME>
<TYPE>guint</TYPE>
<RANGE></RANGE>
<FLAGS>rw</FLAGS>
<NICK>Max. size (buffers)</NICK>
<BLURB>Max. number of buffers in the queue (0=disable).</BLURB>
<DEFAULT>200</DEFAULT>
</ARG>
<ARG>
<NAME>GstEncodeBin::queue-bytes-max</NAME>
<TYPE>guint</TYPE>
<RANGE></RANGE>
<FLAGS>rw</FLAGS>
<NICK>Max. size (kB)</NICK>
<BLURB>Max. amount of data in the queue (bytes, 0=disable).</BLURB>
<DEFAULT>10485760</DEFAULT>
</ARG>
<ARG>
<NAME>GstEncodeBin::queue-time-max</NAME>
<TYPE>guint64</TYPE>
<RANGE></RANGE>
<FLAGS>rw</FLAGS>
<NICK>Max. size (ns)</NICK>
<BLURB>Max. amount of data in the queue (in ns, 0=disable).</BLURB>
<DEFAULT>1000000000</DEFAULT>
</ARG>
......@@ -56,6 +56,7 @@ GObject
GstBin
GstDecodeBin
GstDecodeBin2
GstEncodeBin
GstPipeline
GstPlayBaseBin
GstPlayBin
......
......@@ -8,6 +8,7 @@ GstPlaySink GstChildProxy
GstSubtitleOverlay GstChildProxy
GstDecodeBin2 GstChildProxy
GstURIDecodeBin GstChildProxy
GstEncodeBin GstChildProxy
GstCddaBaseSrc GstURIHandler
GstCdParanoiaSrc GstURIHandler
GstAlsaSrc GstImplementsInterface GstMixer GstPropertyProbe
......
......@@ -471,3 +471,11 @@ GstPlaySink *gstplaysink
GstCaps *arg1
</SIGNAL>
<SIGNAL>
<NAME>GstEncodeBin::request-pad</NAME>
<RETURNS>GstPad*</RETURNS>
<FLAGS>la</FLAGS>
GstEncodeBin *gstencodebin
GstCaps *arg1
</SIGNAL>
<plugin>
<name>encoding</name>
<description>various encoding-related elements</description>
<filename>../../gst/encoding/.libs/libgstencodebin.so</filename>
<basename>libgstencodebin.so</basename>
<version>0.10.31.1</version>
<license>LGPL</license>
<source>gst-plugins-base</source>
<package>GStreamer Base Plug-ins git</package>
<origin>Unknown package origin</origin>
<elements>
<element>
<name>encodebin</name>
<longname>Encoder Bin</longname>
<class>Generic/Bin/Encoder</class>
<description>Convenience encoding/muxing element</description>
<author>Edward Hervey &lt;edward.hervey@collabora.co.uk&gt;</author>
<pads>
<caps>
<name>audio_%d</name>
<direction>sink</direction>
<presence>request</presence>
<details>ANY</details>
</caps>
<caps>
<name>private_%d</name>
<direction>sink</direction>
<presence>request</presence>
<details>ANY</details>
</caps>
<caps>
<name>video_%d</name>
<direction>sink</direction>
<presence>request</presence>
<details>ANY</details>
</caps>
<caps>
<name>src</name>
<direction>source</direction>
<presence>always</presence>
<details>ANY</details>
</caps>
</pads>
</element>
</elements>
</plugin>
\ No newline at end of file
This diff is collapsed.
gstencode-marshal.[ch]
# variables used for enum/marshal generation
glib_enum_define = GST_ENCODE
glib_gen_prefix = gst_encode
glib_gen_basename = gstencode
built_sources = gstencode-marshal.c
built_headers = gstencode-marshal.h
plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@
plugin_LTLIBRARIES = libgstencodebin.la
libgstencodebin_la_SOURCES = \
gstencodebin.c \
gstsmartencoder.c \
gststreamcombiner.c \
gststreamsplitter.c
nodist_libgstencodebin_la_SOURCES = $(built_sources)
libgstencodebin_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
libgstencodebin_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstencodebin_la_LIBADD = \
$(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_MAJORMINOR@.la \
$(GST_LIBS)
libgstencodebin_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = \
gstencodebin.h \
gststreamcombiner.h \
gststreamsplitter.h \
gstsmartencoder.h
BUILT_SOURCES = $(built_headers) $(built_sources)
EXTRA_DIST = gstencode-marshal.list
CLEANFILES = $(BUILT_SOURCES)
include $(top_srcdir)/common/gst-glib-gen.mak
This diff is collapsed.
/* GStreamer encoding bin
* Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
* (C) 2009 Nokia Corporation
*
* 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_ENCODEBIN_H__
#define __GST_ENCODEBIN_H__
#include <gst/gst.h>
#include <gst/pbutils/encoding-profile.h>
#include "gstencode-marshal.h"
#define GST_TYPE_ENCODE_BIN (gst_encode_bin_get_type())
#define GST_ENCODE_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ENCODE_BIN,GstEncodeBin))
#define GST_ENCODE_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ENCODE_BIN,GstEncodeBinClass))
#define GST_IS_ENCODE_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ENCODE_BIN))
#define GST_IS_ENCODE_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ENCODE_BIN))
typedef struct _GstEncodeBin GstEncodeBin;
typedef struct _GstEncodeBinClass GstEncodeBinClass;
GType gst_encode_bin_get_type(void);
#endif /* __GST_ENCODEBIN_H__ */
This diff is collapsed.
/* GStreamer video re-encoder element
* Copyright (C) <2010> Edward Hervey <bilboed@bilboed.com>
*
* 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 __SMART_ENCODER_H__
#define __SMART_ENCODER_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_SMART_ENCODER \
(gst_smart_encoder_get_type())
#define GST_SMART_ENCODER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SMART_ENCODER,GstSmartEncoder))
#define GST_SMART_ENCODER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SMART_ENCODER,GstSmartEncoderClass))
#define GST_IS_SMART_ENCODER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SMART_ENCODER))
#define GST_IS_SMART_ENCODER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SMART_ENCODER))
typedef struct _GstSmartEncoder GstSmartEncoder;
typedef struct _GstSmartEncoderClass GstSmartEncoderClass;
struct _GstSmartEncoder {
GstElement element;
GstPad *sinkpad, *srcpad;
GstSegment *segment;
GstEvent *newsegment;
/* Pending GOP to be checked */
GList *pending_gop;
guint64 gop_start; /* GOP start in running time */
guint64 gop_stop; /* GOP end in running time */
/* Internal recoding elements */
GstPad *internal_sinkpad;
GstPad *internal_srcpad;
GstElement *decoder;
GstElement *encoder;
/* Available caps at runtime */
GstCaps *available_caps;
};
struct _GstSmartEncoderClass {
GstElementClass parent_class;
};
GType gst_smart_encoder_get_type(void);
G_END_DECLS
#endif /* __SMART_ENCODER_H__ */
/* GStreamer Stream Combiner
* Copyright (C) 2010 Edward Hervey <edward.hervey@collabora.co.uk>
* (C) 2009 Nokia Corporation
*
* 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 "gststreamcombiner.h"
static GstStaticPadTemplate src_template =
GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY);
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_STATIC_CAPS_ANY);
GST_DEBUG_CATEGORY_STATIC (gst_stream_combiner_debug);
#define GST_CAT_DEFAULT gst_stream_combiner_debug
G_DEFINE_TYPE (GstStreamCombiner, gst_stream_combiner, GST_TYPE_ELEMENT);
#define STREAMS_LOCK(obj) (g_mutex_lock(obj->lock))
#define STREAMS_UNLOCK(obj) (g_mutex_unlock(obj->lock))
static void gst_stream_combiner_dispose (GObject * object);
static GstPad *gst_stream_combiner_request_new_pad (GstElement * element,
GstPadTemplate * templ, const gchar * name);
static void gst_stream_combiner_release_pad (GstElement * element,
GstPad * pad);
static void
gst_stream_combiner_class_init (GstStreamCombinerClass * klass)
{
GObjectClass *gobject_klass;
GstElementClass *gstelement_klass;
gobject_klass = (GObjectClass *) klass;
gstelement_klass = (GstElementClass *) klass;
gobject_klass->dispose = gst_stream_combiner_dispose;
GST_DEBUG_CATEGORY_INIT (gst_stream_combiner_debug, "streamcombiner", 0,
"Stream Combiner");
gst_element_class_add_pad_template (gstelement_klass,
gst_static_pad_template_get (&src_template));
gst_element_class_add_pad_template (gstelement_klass,
gst_static_pad_template_get (&sink_template));
gstelement_klass->request_new_pad =
GST_DEBUG_FUNCPTR (gst_stream_combiner_request_new_pad);
gstelement_klass->release_pad =
GST_DEBUG_FUNCPTR (gst_stream_combiner_release_pad);
gst_element_class_set_details_simple (gstelement_klass,
"streamcombiner", "Generic",
"Recombines streams splitted by the streamsplitter element",
"Edward Hervey <edward.hervey@collabora.co.uk>");
}
static void
gst_stream_combiner_dispose (GObject * object)
{
GstStreamCombiner *stream_combiner = (GstStreamCombiner *) object;
if (stream_combiner->lock) {
g_mutex_free (stream_combiner->lock);
stream_combiner->lock = NULL;
}
G_OBJECT_CLASS (gst_stream_combiner_parent_class)->dispose (object);
}
static GstFlowReturn
gst_stream_combiner_chain (GstPad * pad, GstBuffer * buf)
{
GstStreamCombiner *stream_combiner =
(GstStreamCombiner *) GST_PAD_PARENT (pad);
/* FIXME : IMPLEMENT */
/* with lock taken, check if we're the active stream, if not drop */
return gst_pad_push (stream_combiner->srcpad, buf);
}
static gboolean
gst_stream_combiner_sink_event (GstPad * pad, GstEvent * event)
{
GstStreamCombiner *stream_combiner =
(GstStreamCombiner *) GST_PAD_PARENT (pad);
/* FIXME : IMPLEMENT */
GST_DEBUG_OBJECT (pad, "Got event %s", GST_EVENT_TYPE_NAME (event));
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_CUSTOM_DOWNSTREAM:
if (gst_event_has_name (event, "stream-switching-eos")) {
gst_event_unref (event);
event = gst_event_new_eos ();
}
break;
default:
break;
}
/* NEW_SEGMENT : lock, wait for other stream to EOS, select stream, unlock, push */
/* EOS : lock, mark pad as unused, unlock , drop event */
/* CUSTOM_REAL_EOS : push EOS downstream */
/* FLUSH_START : lock, mark as flushing, unlock. if wasn't flushing forward */
/* FLUSH_STOP : lock, unmark as flushing, unlock, if was flushing forward */
/* OTHER : if selected pad forward */
return gst_pad_push_event (stream_combiner->srcpad, event);
}
static GstCaps *
gst_stream_combiner_sink_getcaps (GstPad * pad)
{
GstStreamCombiner *stream_combiner =
(GstStreamCombiner *) GST_PAD_PARENT (pad);
return gst_pad_peer_get_caps_reffed (stream_combiner->srcpad);
}
static gboolean
gst_stream_combiner_sink_setcaps (GstPad * pad, GstCaps * caps)
{
GstStreamCombiner *stream_combiner =
(GstStreamCombiner *) GST_PAD_PARENT (pad);
GstPad *peer;
gboolean res = FALSE;
GST_DEBUG_OBJECT (pad, "caps:%" GST_PTR_FORMAT, caps);
peer = gst_pad_get_peer (stream_combiner->srcpad);
if (peer) {
GST_DEBUG_OBJECT (peer, "Setting caps");
res = gst_pad_set_caps (peer, caps);
gst_object_unref (peer);
} else
GST_WARNING_OBJECT (stream_combiner, "sourcepad has no peer !");
return res;
}
static gboolean
gst_stream_combiner_src_event (GstPad * pad, GstEvent * event)
{
GstStreamCombiner *stream_combiner =
(GstStreamCombiner *) GST_PAD_PARENT (pad);
GstPad *sinkpad = NULL;
STREAMS_LOCK (stream_combiner);
if (stream_combiner->current)
sinkpad = stream_combiner->current;
else if (stream_combiner->sinkpads)
sinkpad = (GstPad *) stream_combiner->sinkpads->data;
STREAMS_UNLOCK (stream_combiner);
if (sinkpad)
/* Forward upstream as is */
return gst_pad_push_event (sinkpad, event);
return FALSE;
}
static gboolean
gst_stream_combiner_src_query (GstPad * pad, GstQuery * query)
{
GstStreamCombiner *stream_combiner =
(GstStreamCombiner *) GST_PAD_PARENT (pad);
GstPad *sinkpad = NULL;
STREAMS_LOCK (stream_combiner);
if (stream_combiner->current)
sinkpad = stream_combiner->current;
else if (stream_combiner->sinkpads)
sinkpad = (GstPad *) stream_combiner->sinkpads->data;
STREAMS_UNLOCK (stream_combiner);
if (sinkpad)
/* Forward upstream as is */
return gst_pad_peer_query (sinkpad, query);
return FALSE;
}
static void
gst_stream_combiner_init (GstStreamCombiner * stream_combiner)
{
stream_combiner->srcpad =
gst_pad_new_from_static_template (&src_template, "src");
gst_pad_set_event_function (stream_combiner->srcpad,
gst_stream_combiner_src_event);
gst_pad_set_query_function (stream_combiner->srcpad,
gst_stream_combiner_src_query);
gst_element_add_pad (GST_ELEMENT (stream_combiner), stream_combiner->srcpad);
stream_combiner->lock = g_mutex_new ();
}
static GstPad *
gst_stream_combiner_request_new_pad (GstElement * element,
GstPadTemplate * templ, const gchar * name)
{
GstStreamCombiner *stream_combiner = (<