Updated/added documentation.

Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
* ext/pango/gstclockoverlay.h:
* ext/pango/gsttextoverlay.h:
* ext/pango/gsttextrender.h:
* ext/pango/gsttimeoverlay.h:
* ext/theora/gsttheoradec.h:
* ext/theora/gsttheoraenc.h:
* ext/theora/theoradec.c:
* ext/theora/theoraenc.c:
* gst/audioconvert/gstaudioconvert.h:
* gst/audiotestsrc/gstaudiotestsrc.h:
* gst/ffmpegcolorspace/gstffmpegcolorspace.h:
* gst/tcp/gstmultifdsink.c: (gst_multi_fd_sink_class_init):
* gst/tcp/gstmultifdsink.h:
Updated/added documentation.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_valign_get_type),
(gst_text_overlay_halign_get_type),
(gst_text_overlay_wrap_mode_get_type),
(gst_text_overlay_base_init), (gst_text_overlay_class_init),
(gst_text_overlay_init), (gst_text_overlay_set_property),
(gst_text_overlay_get_property):
Fix up properties to be enums instead of string to make bindings,
introspection and automatic GUI creation possible.
Add getters for the properties.
This commit is contained in:
Wim Taymans 2006-03-01 16:24:37 +00:00
parent 81311ccfc1
commit 81e72d14b4
18 changed files with 738 additions and 261 deletions

View file

@ -1,3 +1,33 @@
2006-03-01 Wim Taymans <wim@fluendo.com>
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
* ext/pango/gstclockoverlay.h:
* ext/pango/gsttextoverlay.h:
* ext/pango/gsttextrender.h:
* ext/pango/gsttimeoverlay.h:
* ext/theora/gsttheoradec.h:
* ext/theora/gsttheoraenc.h:
* ext/theora/theoradec.c:
* ext/theora/theoraenc.c:
* gst/audioconvert/gstaudioconvert.h:
* gst/audiotestsrc/gstaudiotestsrc.h:
* gst/ffmpegcolorspace/gstffmpegcolorspace.h:
* gst/tcp/gstmultifdsink.c: (gst_multi_fd_sink_class_init):
* gst/tcp/gstmultifdsink.h:
Updated/added documentation.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_valign_get_type),
(gst_text_overlay_halign_get_type),
(gst_text_overlay_wrap_mode_get_type),
(gst_text_overlay_base_init), (gst_text_overlay_class_init),
(gst_text_overlay_init), (gst_text_overlay_set_property),
(gst_text_overlay_get_property):
Fix up properties to be enums instead of string to make bindings,
introspection and automatic GUI creation possible.
Add getters for the properties.
2006-02-28 Sebastien Moutte <sebastien@moutte.net> 2006-02-28 Sebastien Moutte <sebastien@moutte.net>
* gst/audiotestsrc/gstaudiotestsrc.c: * gst/audiotestsrc/gstaudiotestsrc.c:

View file

@ -80,6 +80,7 @@ EXTRA_HFILES = \
$(top_srcdir)/ext/pango/gsttextoverlay.h \ $(top_srcdir)/ext/pango/gsttextoverlay.h \
$(top_srcdir)/ext/pango/gsttextrender.h \ $(top_srcdir)/ext/pango/gsttextrender.h \
$(top_srcdir)/ext/pango/gsttimeoverlay.h \ $(top_srcdir)/ext/pango/gsttimeoverlay.h \
$(top_srcdir)/ext/theora/gsttheoradec.h \
$(top_srcdir)/ext/theora/gsttheoraenc.h \ $(top_srcdir)/ext/theora/gsttheoraenc.h \
$(top_srcdir)/ext/vorbis/vorbisenc.h \ $(top_srcdir)/ext/vorbis/vorbisenc.h \
$(top_srcdir)/gst/audioconvert/gstaudioconvert.h \ $(top_srcdir)/gst/audioconvert/gstaudioconvert.h \

View file

@ -20,6 +20,7 @@
<xi:include href="xml/element-gnomevfssrc.xml" /> <xi:include href="xml/element-gnomevfssrc.xml" />
<xi:include href="xml/element-multifdsink.xml" /> <xi:include href="xml/element-multifdsink.xml" />
<xi:include href="xml/element-tcpserversink.xml" /> <xi:include href="xml/element-tcpserversink.xml" />
<xi:include href="xml/element-theoradec.xml" />
<xi:include href="xml/element-theoraenc.xml" /> <xi:include href="xml/element-theoraenc.xml" />
<xi:include href="xml/element-textoverlay.xml" /> <xi:include href="xml/element-textoverlay.xml" />
<xi:include href="xml/element-textrender.xml" /> <xi:include href="xml/element-textrender.xml" />

View file

@ -1,9 +1,13 @@
<SECTION> <SECTION>
<FILE>element-audioconvert</FILE> <FILE>element-audioconvert</FILE>
<TITLE>audioconvert</TITLE> <TITLE>audioconvert</TITLE>
GstAudioConvert GstAudioConvert
<SUBSECTION Standard> <SUBSECTION Standard>
GST_AUDIO_CONVERT
GST_AUDIO_CONVERT_CLASS
GST_IS_AUDIO_CONVERT
GST_IS_AUDIO_CONVERT_CLASS
GST_TYPE_AUDIO_CONVERT
GstAudioConvertClass GstAudioConvertClass
</SECTION> </SECTION>
@ -11,8 +15,20 @@ GstAudioConvertClass
<FILE>element-audiotestsrc</FILE> <FILE>element-audiotestsrc</FILE>
<TITLE>audiotestsrc</TITLE> <TITLE>audiotestsrc</TITLE>
GstAudioTestSrc GstAudioTestSrc
GstAudioTestSrcWave
<SUBSECTION Standard> <SUBSECTION Standard>
GST_AUDIO_TEST_SRC
GST_AUDIO_TEST_SRC_CLASS
GST_IS_AUDIO_TEST_SRC
GST_IS_AUDIO_TEST_SRC_CLASS
GST_TYPE_AUDIO_TEST_SRC
GstAudioTestSrcClass GstAudioTestSrcClass
gst_audio_test_src_factory_init
gst_audio_test_src_get_type
GstPinkNoise
PINK_MAX_RANDOM_ROWS
PINK_RANDOM_BITS
PINK_RANDOM_SHIFT
</SECTION> </SECTION>
<SECTION> <SECTION>
@ -20,7 +36,13 @@ GstAudioTestSrcClass
<TITLE>clockoverlay</TITLE> <TITLE>clockoverlay</TITLE>
GstClockOverlay GstClockOverlay
<SUBSECTION Standard> <SUBSECTION Standard>
GST_CLOCK_OVERLAY
GST_CLOCK_OVERLAY_CLASS
GST_IS_CLOCK_OVERLAY
GST_IS_CLOCK_OVERLAY_CLASS
GST_TYPE_CLOCK_OVERLAY
GstClockOverlayClass GstClockOverlayClass
gst_clock_overlay_get_type
</SECTION> </SECTION>
<SECTION> <SECTION>
@ -28,6 +50,11 @@ GstClockOverlayClass
<TITLE>ffmpegcolorspace</TITLE> <TITLE>ffmpegcolorspace</TITLE>
GstFFMpegCsp GstFFMpegCsp
<SUBSECTION Standard> <SUBSECTION Standard>
GST_FFMPEGCSP
GST_FFMPEGCSP_CLASS
GST_IS_FFMPEGCSP
GST_IS_FFMPEGCSP_CLASS
GST_TYPE_FFMPEGCSP
GstFFMpegCspClass GstFFMpegCspClass
</SECTION> </SECTION>
@ -35,14 +62,29 @@ GstFFMpegCspClass
<FILE>element-multifdsink</FILE> <FILE>element-multifdsink</FILE>
<TITLE>multifdsink</TITLE> <TITLE>multifdsink</TITLE>
GstMultiFdSink GstMultiFdSink
GstMultiFdSinkFlags
GstRecoverPolicy GstRecoverPolicy
GstSyncMethod GstSyncMethod
GstUnitType
GstClientStatus GstClientStatus
<SUBSECTION Standard> <SUBSECTION Standard>
CLIENTS_LOCK
CLIENTS_LOCK_FREE
CLIENTS_LOCK_INIT
CLIENTS_UNLOCK
GST_TYPE_MULTI_FD_SINK
GST_IS_MULTI_FD_SINK
GST_IS_MULTI_FD_SINK_CLASS
GST_MULTI_FD_SINK
GST_MULTI_FD_SINK_CLASS
GST_MULTI_FD_SINK_GET_CLASS
GstTCPClient
GstUnitType
GstMultiFdSinkFlags
GstMultiFdSinkClass GstMultiFdSinkClass
gst_multi_fd_sink_add
gst_multi_fd_sink_clear
gst_multi_fd_sink_get_stats
gst_multi_fd_sink_get_type
gst_multi_fd_sink_remove
</SECTION> </SECTION>
<SECTION> <SECTION>
@ -51,6 +93,12 @@ GstMultiFdSinkClass
GstGnomeVFSSink GstGnomeVFSSink
<SUBSECTION Standard> <SUBSECTION Standard>
GstGnomeVFSSinkClass GstGnomeVFSSinkClass
GST_GNOME_VFS_SINK_CLASS
GST_TYPE_GNOME_VFS_SINK
GST_IS_GNOME_VFS_SINK
gst_gnome_vfs_sink_get_type
GST_IS_GNOME_VFS_SINK_CLASS
GST_GNOME_VFS_SINK
</SECTION> </SECTION>
<SECTION> <SECTION>
@ -58,7 +106,13 @@ GstGnomeVFSSinkClass
<TITLE>gnomevfssrc</TITLE> <TITLE>gnomevfssrc</TITLE>
GstGnomeVFSSrc GstGnomeVFSSrc
<SUBSECTION Standard> <SUBSECTION Standard>
GST_GNOME_VFS_SRC
GST_GNOME_VFS_SRC_CLASS
GST_IS_GNOME_VFS_SRC
GST_IS_GNOME_VFS_SRC_CLASS
GST_TYPE_GNOME_VFS_SRC
GstGnomeVFSSrcClass GstGnomeVFSSrcClass
gst_gnome_vfs_src_get_type
</SECTION> </SECTION>
<SECTION> <SECTION>
@ -67,14 +121,30 @@ GstGnomeVFSSrcClass
GstTCPServerSink GstTCPServerSink
<SUBSECTION Standard> <SUBSECTION Standard>
GstTCPServerSinkClass GstTCPServerSinkClass
GST_TCP_SERVER_SINK
GstTCPServerSinkFlags
GST_TYPE_TCP_SERVER_SINK
gst_tcp_server_sink_get_type
GST_IS_TCP_SERVER_SINK_CLASS
GST_IS_TCP_SERVER_SINK
</SECTION> </SECTION>
<SECTION> <SECTION>
<FILE>element-textoverlay</FILE> <FILE>element-textoverlay</FILE>
<TITLE>textoverlay</TITLE> <TITLE>textoverlay</TITLE>
GstTextOverlay GstTextOverlay
GstTextOverlayVAlign
GstTextOverlayHAlign
GstTextOverlayWrapMode
<SUBSECTION Standard> <SUBSECTION Standard>
GST_TEXT_OVERLAY
GST_TEXT_OVERLAY_CLASS
GST_TEXT_OVERLAY_GET_CLASS
GST_IS_TEXT_OVERLAY
GST_IS_TEXT_OVERLAY_CLASS
GST_TYPE_TEXT_OVERLAY
GstTextOverlayClass GstTextOverlayClass
gst_text_overlay_get_type
</SECTION> </SECTION>
<SECTION> <SECTION>
@ -82,7 +152,27 @@ GstTextOverlayClass
<TITLE>textrender</TITLE> <TITLE>textrender</TITLE>
GstTextRender GstTextRender
<SUBSECTION Standard> <SUBSECTION Standard>
GST_TEXT_RENDER
GST_TEXT_RENDER_CLASS
GST_TEXT_RENDER_GET_CLASS
GST_IS_TEXT_RENDER
GST_IS_TEXT_RENDER_CLASS
GST_TYPE_TEXT_RENDER
GstTextRenderClass GstTextRenderClass
gst_text_render_get_type
</SECTION>
<SECTION>
<FILE>element-theoradec</FILE>
<TITLE>theoradec</TITLE>
GstTheoraDec
<SUBSECTION Standard>
GST_THEORA_DEC
GST_IS_THEORA_DEC
GST_TYPE_THEORA_DEC
GST_THEORA_DEC_CLASS
GST_IS_THEORA_DEC_CLASS
GstTheoraDecClass
</SECTION> </SECTION>
<SECTION> <SECTION>
@ -91,6 +181,11 @@ GstTextRenderClass
GstTheoraEnc GstTheoraEnc
GstTheoraEncBorderMode GstTheoraEncBorderMode
<SUBSECTION Standard> <SUBSECTION Standard>
GST_THEORA_ENC
GST_THEORA_ENC_CLASS
GST_IS_THEORA_ENC
GST_IS_THEORA_ENC_CLASS
GST_TYPE_THEORA_ENC
GstTheoraEncClass GstTheoraEncClass
</SECTION> </SECTION>
@ -99,7 +194,13 @@ GstTheoraEncClass
<TITLE>timeoverlay</TITLE> <TITLE>timeoverlay</TITLE>
GstTimeOverlay GstTimeOverlay
<SUBSECTION Standard> <SUBSECTION Standard>
GST_TIME_OVERLAY
GST_TIME_OVERLAY_CLASS
GST_IS_TIME_OVERLAY
GST_IS_TIME_OVERLAY_CLASS
GST_TYPE_TIME_OVERLAY
GstTimeOverlayClass GstTimeOverlayClass
gst_time_overlay_get_type
</SECTION> </SECTION>
<SECTION> <SECTION>
@ -108,7 +209,13 @@ GstTimeOverlayClass
GstVideoTestSrc GstVideoTestSrc
GstVideoTestSrcPattern GstVideoTestSrcPattern
<SUBSECTION Standard> <SUBSECTION Standard>
GST_VIDEO_TEST_SRC
GST_VIDEO_TEST_SRC_CLASS
GST_IS_VIDEO_TEST_SRC
GST_IS_VIDEO_TEST_SRC_CLASS
GST_TYPE_VIDEO_TEST_SRC
GstVideoTestSrcClass GstVideoTestSrcClass
gst_video_test_src_get_type
</SECTION> </SECTION>
<SECTION> <SECTION>
@ -116,7 +223,13 @@ GstVideoTestSrcClass
<TITLE>volume</TITLE> <TITLE>volume</TITLE>
GstVolume GstVolume
<SUBSECTION Standard> <SUBSECTION Standard>
GST_VOLUME
GST_VOLUME_CLASS
GST_IS_VOLUME
GST_IS_VOLUME_CLASS
GST_TYPE_VOLUME
GstVolumeClass GstVolumeClass
gst_volume_get_type
</SECTION> </SECTION>
<SECTION> <SECTION>
@ -125,6 +238,13 @@ GstVolumeClass
GstVorbisEnc GstVorbisEnc
<SUBSECTION Standard> <SUBSECTION Standard>
GstVorbisEncClass GstVorbisEncClass
vorbisenc_get_type
GST_IS_VORBISENC
GST_VORBISENC_CLASS
GST_VORBISENC
GST_TCP_SERVER_SINK_CLASS
GST_TYPE_VORBISENC
GST_IS_VORBISENC_CLASS
</SECTION> </SECTION>
<SECTION> <SECTION>
@ -132,7 +252,13 @@ GstVorbisEncClass
<TITLE>ximagesink</TITLE> <TITLE>ximagesink</TITLE>
GstXImageSink GstXImageSink
<SUBSECTION Standard> <SUBSECTION Standard>
GST_XIMAGESINK
GST_XIMAGESINK_CLASS
GST_IS_XIMAGESINK
GST_IS_XIMAGESINK_CLASS
GST_TYPE_XIMAGESINK
GstXImagesSinkClass GstXImagesSinkClass
gst_ximagesink_get_type
</SECTION> </SECTION>
<SECTION> <SECTION>
@ -140,50 +266,11 @@ GstXImagesSinkClass
<TITLE>xvimagesink</TITLE> <TITLE>xvimagesink</TITLE>
GstXvImageSink GstXvImageSink
<SUBSECTION Standard> <SUBSECTION Standard>
GST_XVIMAGESINK
GST_XVIMAGESINK_CLASS
GST_IS_XVIMAGESINK
GST_IS_XVIMAGESINK_CLASS
GST_TYPE_XVIMAGESINK
GstXvImagesSinkClass GstXvImagesSinkClass
</SECTION> gst_xvimagesink_get_type
<SECTION>
<FILE>private</FILE>
CLIENTS_UNLOCK
CLIENTS_LOCK_INIT
GST_MULTI_FD_SINK_GET_CLASS
CLIENTS_LOCK_FREE
GST_IS_MULTI_FD_SINK_CLASS
gst_multi_fd_sink_get_type
gst_multi_fd_sink_remove
GST_IS_MULTI_FD_SINK
CLIENTS_LOCK
GST_TYPE_MULTI_FD_SINK
gst_multi_fd_sink_clear
GstTCPClient
GST_MULTI_FD_SINK_CLASS
gst_multi_fd_sink_get_stats
GST_MULTI_FD_SINK
gst_multi_fd_sink_add
GST_TCP_SERVER_SINK
GstTCPServerSinkFlags
GST_TYPE_TCP_SERVER_SINK
gst_tcp_server_sink_get_type
GST_IS_TCP_SERVER_SINK_CLASS
GST_IS_TCP_SERVER_SINK
GST_GNOME_VFS_SINK_CLASS
GST_TYPE_GNOME_VFS_SINK
GST_IS_GNOME_VFS_SINK
gst_gnome_vfs_sink_get_type
GST_IS_GNOME_VFS_SINK_CLASS
GST_ELEMENT_CLASS
GST_GNOME_VFS_SINK
GST_IS_VORBISENC
GST_VORBISENC_CLASS
GST_VORBISENC
GST_TCP_SERVER_SINK_CLASS
GST_TYPE_VORBISENC
GST_IS_VORBISENC_CLASS
vorbisenc_get_type
</SECTION> </SECTION>

View file

@ -40,6 +40,11 @@ G_BEGIN_DECLS
typedef struct _GstClockOverlay GstClockOverlay; typedef struct _GstClockOverlay GstClockOverlay;
typedef struct _GstClockOverlayClass GstClockOverlayClass; typedef struct _GstClockOverlayClass GstClockOverlayClass;
/**
* GstClockOverlay:
*
* Opaque clockoverlay data structure.
*/
struct _GstClockOverlay { struct _GstClockOverlay {
GstTextOverlay textoverlay; GstTextOverlay textoverlay;
}; };

View file

@ -100,19 +100,34 @@ static GstElementDetails text_overlay_details = {
"David Schleef <ds@schleef.org>" "David Schleef <ds@schleef.org>"
}; };
#define DEFAULT_PROP_TEXT ""
#define DEFAULT_PROP_SHADING FALSE
#define DEFAULT_PROP_VALIGN GST_TEXT_OVERLAY_VALIGN_BASELINE
#define DEFAULT_PROP_HALIGN GST_TEXT_OVERLAY_HALIGN_CENTER
#define DEFAULT_PROP_XPAD 25
#define DEFAULT_PROP_YPAD 25
#define DEFAULT_PROP_DELTAX 0
#define DEFAULT_PROP_DELTAY 0
#define DEFAULT_PROP_WRAP_MODE GST_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR
#define DEFAULT_PROP_FONT_DESC ""
/* make a property of me */
#define DEFAULT_SHADING_VALUE -80
enum enum
{ {
ARG_0, PROP_0,
ARG_TEXT, PROP_TEXT,
ARG_SHADING, PROP_SHADING,
ARG_VALIGN, PROP_VALIGN,
ARG_HALIGN, PROP_HALIGN,
ARG_XPAD, PROP_XPAD,
ARG_YPAD, PROP_YPAD,
ARG_DELTAX, PROP_DELTAX,
ARG_DELTAY, PROP_DELTAY,
ARG_WRAP_MODE, PROP_WRAP_MODE,
ARG_FONT_DESC PROP_FONT_DESC
}; };
@ -137,6 +152,67 @@ static GstStaticPadTemplate text_sink_template_factory =
GST_STATIC_CAPS ("text/x-pango-markup; text/plain") GST_STATIC_CAPS ("text/x-pango-markup; text/plain")
); );
#define GST_TYPE_TEXT_OVERLAY_VALIGN (gst_text_overlay_valign_get_type())
static GType
gst_text_overlay_valign_get_type (void)
{
static GType text_overlay_valign_type = 0;
static GEnumValue text_overlay_valign[] = {
{GST_TEXT_OVERLAY_VALIGN_BASELINE, "baseline", "baseline"},
{GST_TEXT_OVERLAY_VALIGN_BOTTOM, "bottom", "bottom"},
{GST_TEXT_OVERLAY_VALIGN_TOP, "top", "top"},
{0, NULL, NULL},
};
if (!text_overlay_valign_type) {
text_overlay_valign_type =
g_enum_register_static ("GstTextOverlayVAlign", text_overlay_valign);
}
return text_overlay_valign_type;
}
#define GST_TYPE_TEXT_OVERLAY_HALIGN (gst_text_overlay_halign_get_type())
static GType
gst_text_overlay_halign_get_type (void)
{
static GType text_overlay_halign_type = 0;
static GEnumValue text_overlay_halign[] = {
{GST_TEXT_OVERLAY_HALIGN_LEFT, "left", "left"},
{GST_TEXT_OVERLAY_HALIGN_CENTER, "center", "center"},
{GST_TEXT_OVERLAY_HALIGN_RIGHT, "right", "right"},
{0, NULL, NULL},
};
if (!text_overlay_halign_type) {
text_overlay_halign_type =
g_enum_register_static ("GstTextOverlayHAlign", text_overlay_halign);
}
return text_overlay_halign_type;
}
#define GST_TYPE_TEXT_OVERLAY_WRAP_MODE (gst_text_overlay_wrap_mode_get_type())
static GType
gst_text_overlay_wrap_mode_get_type (void)
{
static GType text_overlay_wrap_mode_type = 0;
static GEnumValue text_overlay_wrap_mode[] = {
{GST_TEXT_OVERLAY_WRAP_MODE_NONE, "none", "none"},
{GST_TEXT_OVERLAY_WRAP_MODE_WORD, "word", "word"},
{GST_TEXT_OVERLAY_WRAP_MODE_CHAR, "char", "char"},
{GST_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR, "wordchar", "wordchar"},
{0, NULL, NULL},
};
if (!text_overlay_wrap_mode_type) {
text_overlay_wrap_mode_type =
g_enum_register_static ("GstTextOverlayWrapMode",
text_overlay_wrap_mode);
}
return text_overlay_wrap_mode_type;
}
/* These macros are adapted from videotestsrc.c */ /* These macros are adapted from videotestsrc.c */
#define I420_Y_ROWSTRIDE(width) (GST_ROUND_UP_4(width)) #define I420_Y_ROWSTRIDE(width) (GST_ROUND_UP_4(width))
#define I420_U_ROWSTRIDE(width) (GST_ROUND_UP_8(width)/2) #define I420_U_ROWSTRIDE(width) (GST_ROUND_UP_8(width)/2)
@ -175,16 +251,11 @@ static void gst_text_overlay_pop_text (GstTextOverlay * overlay);
static void gst_text_overlay_finalize (GObject * object); static void gst_text_overlay_finalize (GObject * object);
static void gst_text_overlay_set_property (GObject * object, guint prop_id, static void gst_text_overlay_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); const GValue * value, GParamSpec * pspec);
static void gst_text_overlay_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
GST_BOILERPLATE (GstTextOverlay, gst_text_overlay, GstElement, GST_TYPE_ELEMENT) GST_BOILERPLATE (GstTextOverlay, gst_text_overlay, GstElement, GST_TYPE_ELEMENT)
#define DEFAULT_YPAD 25
#define DEFAULT_XPAD 25
#define DEFAULT_DELTAX 0
#define DEFAULT_DELTAY 0
/* keep wrap enum in sync with string in class_init */
#define DEFAULT_WRAP_MODE GST_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR
#define DEFAULT_SHADING_VALUE -80
static void gst_text_overlay_base_init (gpointer g_class) static void gst_text_overlay_base_init (gpointer g_class)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
@ -221,6 +292,7 @@ gst_text_overlay_class_init (GstTextOverlayClass * klass)
gobject_class->finalize = gst_text_overlay_finalize; gobject_class->finalize = gst_text_overlay_finalize;
gobject_class->set_property = gst_text_overlay_set_property; gobject_class->set_property = gst_text_overlay_set_property;
gobject_class->get_property = gst_text_overlay_get_property;
gstelement_class->change_state = gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_text_overlay_change_state); GST_DEBUG_FUNCPTR (gst_text_overlay_change_state);
@ -228,51 +300,48 @@ gst_text_overlay_class_init (GstTextOverlayClass * klass)
klass->get_text = gst_text_overlay_get_text; klass->get_text = gst_text_overlay_get_text;
klass->pango_context = pango_ft2_get_context (72, 72); klass->pango_context = pango_ft2_get_context (72, 72);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TEXT, g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_TEXT,
g_param_spec_string ("text", "text", g_param_spec_string ("text", "text",
"Text to be display.", "", G_PARAM_WRITABLE)); "Text to be display.", DEFAULT_PROP_TEXT, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SHADING, g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SHADING,
g_param_spec_boolean ("shaded-background", "shaded background", g_param_spec_boolean ("shaded-background", "shaded background",
"Whether to shade the background under the text area", FALSE, "Whether to shade the background under the text area",
G_PARAM_WRITABLE)); DEFAULT_PROP_SHADING, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VALIGN, g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_VALIGN,
g_param_spec_string ("valign", "vertical alignment", g_param_spec_enum ("valign", "vertical alignment",
"Vertical alignment of the text. " "Vertical alignment of the text. ",
"Can be either 'baseline', 'bottom', or 'top'", GST_TYPE_TEXT_OVERLAY_VALIGN, DEFAULT_PROP_VALIGN,
"baseline", G_PARAM_WRITABLE)); G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HALIGN, g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HALIGN,
g_param_spec_string ("halign", "horizontal alignment", g_param_spec_enum ("halign", "horizontal alignment",
"Horizontal alignment of the text. " "Horizontal alignment of the text. ", GST_TYPE_TEXT_OVERLAY_HALIGN,
"Can be either 'left', 'right', or 'center'", DEFAULT_PROP_HALIGN, G_PARAM_READWRITE));
"center", G_PARAM_WRITABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_XPAD,
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_XPAD,
g_param_spec_int ("xpad", "horizontal paddding", g_param_spec_int ("xpad", "horizontal paddding",
"Horizontal paddding when using left/right alignment", "Horizontal paddding when using left/right alignment", 0, G_MAXINT,
0, G_MAXINT, DEFAULT_XPAD, G_PARAM_WRITABLE)); DEFAULT_PROP_XPAD, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_YPAD, g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_YPAD,
g_param_spec_int ("ypad", "vertical padding", g_param_spec_int ("ypad", "vertical padding",
"Vertical padding when using top/bottom alignment", "Vertical padding when using top/bottom alignment", 0, G_MAXINT,
0, G_MAXINT, DEFAULT_YPAD, G_PARAM_WRITABLE)); DEFAULT_PROP_YPAD, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DELTAX, g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DELTAX,
g_param_spec_int ("deltax", "X position modifier", g_param_spec_int ("deltax", "X position modifier",
"Shift X position to the left or to the right. Unit is pixels.", "Shift X position to the left or to the right. Unit is pixels.",
G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); G_MININT, G_MAXINT, DEFAULT_PROP_DELTAX, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DELTAY, g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DELTAY,
g_param_spec_int ("deltay", "Y position modifier", g_param_spec_int ("deltay", "Y position modifier",
"Shift Y position up or down. Unit is pixels.", "Shift Y position up or down. Unit is pixels.", G_MININT, G_MAXINT,
G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); DEFAULT_PROP_DELTAY, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WRAP_MODE, g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_WRAP_MODE,
g_param_spec_string ("wrap-mode", "wrap mode", g_param_spec_enum ("wrap-mode", "wrap mode",
"Whether to wrap the text and if so how." "Whether to wrap the text and if so how.",
"Can be either 'none', 'word', 'char' or 'wordchar'", GST_TYPE_TEXT_OVERLAY_WRAP_MODE, DEFAULT_PROP_WRAP_MODE,
"wordchar", G_PARAM_WRITABLE)); G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FONT_DESC, g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_FONT_DESC,
g_param_spec_string ("font-desc", "font description", g_param_spec_string ("font-desc", "font description",
"Pango font description of font " "Pango font description of font to be used for rendering. "
"to be used for rendering. " "See documentation of pango_font_description_from_string "
"See documentation of " "for syntax.", DEFAULT_PROP_FONT_DESC, G_PARAM_WRITABLE));
"pango_font_description_from_string"
" for syntax.", "", G_PARAM_WRITABLE));
} }
static void static void
@ -353,19 +422,19 @@ gst_text_overlay_init (GstTextOverlay * overlay, GstTextOverlayClass * klass)
pango_layout_new (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_context); pango_layout_new (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_context);
memset (&overlay->bitmap, 0, sizeof (overlay->bitmap)); memset (&overlay->bitmap, 0, sizeof (overlay->bitmap));
overlay->halign = GST_TEXT_OVERLAY_HALIGN_CENTER; overlay->halign = DEFAULT_PROP_HALIGN;
overlay->valign = GST_TEXT_OVERLAY_VALIGN_BASELINE; overlay->valign = DEFAULT_PROP_VALIGN;
overlay->xpad = DEFAULT_XPAD; overlay->xpad = DEFAULT_PROP_XPAD;
overlay->ypad = DEFAULT_YPAD; overlay->ypad = DEFAULT_PROP_YPAD;
overlay->deltax = 0; overlay->deltax = DEFAULT_PROP_DELTAX;
overlay->deltay = 0; overlay->deltay = DEFAULT_PROP_DELTAY;
overlay->wrap_mode = DEFAULT_WRAP_MODE; overlay->wrap_mode = DEFAULT_PROP_WRAP_MODE;
overlay->want_shading = FALSE; overlay->want_shading = DEFAULT_PROP_SHADING;
overlay->shading_value = DEFAULT_SHADING_VALUE; overlay->shading_value = DEFAULT_SHADING_VALUE;
overlay->default_text = g_strdup (""); overlay->default_text = g_strdup (DEFAULT_PROP_TEXT);
overlay->need_render = TRUE; overlay->need_render = TRUE;
overlay->fps_n = 0; overlay->fps_n = 0;
@ -448,82 +517,38 @@ gst_text_overlay_set_property (GObject * object, guint prop_id,
GstTextOverlay *overlay = GST_TEXT_OVERLAY (object); GstTextOverlay *overlay = GST_TEXT_OVERLAY (object);
GST_OBJECT_LOCK (overlay); GST_OBJECT_LOCK (overlay);
switch (prop_id) { switch (prop_id) {
case ARG_TEXT: case PROP_TEXT:
g_free (overlay->default_text); g_free (overlay->default_text);
overlay->default_text = g_value_dup_string (value); overlay->default_text = g_value_dup_string (value);
overlay->need_render = TRUE; overlay->need_render = TRUE;
break; break;
case PROP_SHADING:
case ARG_SHADING:{
overlay->want_shading = g_value_get_boolean (value); overlay->want_shading = g_value_get_boolean (value);
break; break;
} case PROP_XPAD:
case ARG_XPAD:{
overlay->xpad = g_value_get_int (value); overlay->xpad = g_value_get_int (value);
break; break;
} case PROP_YPAD:
case ARG_YPAD:{
overlay->ypad = g_value_get_int (value); overlay->ypad = g_value_get_int (value);
break; break;
} case PROP_DELTAX:
case ARG_DELTAX:{
overlay->deltax = g_value_get_int (value); overlay->deltax = g_value_get_int (value);
break; break;
} case PROP_DELTAY:
case ARG_DELTAY:{
overlay->deltay = g_value_get_int (value); overlay->deltay = g_value_get_int (value);
break; break;
} case PROP_VALIGN:
overlay->valign = g_value_get_enum (value);
case ARG_VALIGN:{
const gchar *s = g_value_get_string (value);
if (g_ascii_strcasecmp (s, "baseline") == 0)
overlay->valign = GST_TEXT_OVERLAY_VALIGN_BASELINE;
else if (g_ascii_strcasecmp (s, "bottom") == 0)
overlay->valign = GST_TEXT_OVERLAY_VALIGN_BOTTOM;
else if (g_ascii_strcasecmp (s, "top") == 0)
overlay->valign = GST_TEXT_OVERLAY_VALIGN_TOP;
else
g_warning ("Invalid 'valign' property value: %s", s);
break; break;
} case PROP_HALIGN:
overlay->halign = g_value_get_enum (value);
case ARG_HALIGN:{
const gchar *s = g_value_get_string (value);
if (g_ascii_strcasecmp (s, "left") == 0)
overlay->halign = GST_TEXT_OVERLAY_HALIGN_LEFT;
else if (g_ascii_strcasecmp (s, "right") == 0)
overlay->halign = GST_TEXT_OVERLAY_HALIGN_RIGHT;
else if (g_ascii_strcasecmp (s, "center") == 0)
overlay->halign = GST_TEXT_OVERLAY_HALIGN_CENTER;
else
g_warning ("Invalid 'halign' property value: %s", s);
break; break;
} case PROP_WRAP_MODE:
overlay->wrap_mode = g_value_get_enum (value);
case ARG_WRAP_MODE:{
const gchar *s = g_value_get_string (value);
if (g_ascii_strcasecmp (s, "none") == 0)
overlay->wrap_mode = GST_TEXT_OVERLAY_WRAP_MODE_NONE;
else if (g_ascii_strcasecmp (s, "char") == 0)
overlay->wrap_mode = GST_TEXT_OVERLAY_WRAP_MODE_CHAR;
else if (g_ascii_strcasecmp (s, "word") == 0)
overlay->wrap_mode = GST_TEXT_OVERLAY_WRAP_MODE_WORD;
else if (g_ascii_strcasecmp (s, "wordchar") == 0)
overlay->wrap_mode = GST_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR;
else
g_warning ("Invalid 'wrap-mode' property value: %s", s);
gst_text_overlay_update_wrap_mode (overlay); gst_text_overlay_update_wrap_mode (overlay);
break; break;
} case PROP_FONT_DESC:
case ARG_FONT_DESC:
{ {
PangoFontDescription *desc; PangoFontDescription *desc;
const gchar *fontdesc_str; const gchar *fontdesc_str;
@ -531,22 +556,65 @@ gst_text_overlay_set_property (GObject * object, guint prop_id,
fontdesc_str = g_value_get_string (value); fontdesc_str = g_value_get_string (value);
desc = pango_font_description_from_string (fontdesc_str); desc = pango_font_description_from_string (fontdesc_str);
if (desc) { if (desc) {
GST_LOG ("font description set: %s", fontdesc_str); GST_LOG_OBJECT (overlay, "font description set: %s", fontdesc_str);
pango_layout_set_font_description (overlay->layout, desc); pango_layout_set_font_description (overlay->layout, desc);
pango_font_description_free (desc); pango_font_description_free (desc);
} else { } else {
GST_WARNING ("font description parse failed: %s", fontdesc_str); GST_WARNING_OBJECT (overlay, "font description parse failed: %s",
fontdesc_str);
} }
break; break;
} }
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
} }
overlay->need_render = TRUE; overlay->need_render = TRUE;
GST_OBJECT_UNLOCK (overlay);
}
static void
gst_text_overlay_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstTextOverlay *overlay = GST_TEXT_OVERLAY (object);
GST_OBJECT_LOCK (overlay);
switch (prop_id) {
case PROP_TEXT:
g_value_set_string (value, overlay->default_text);
break;
case PROP_SHADING:
g_value_set_boolean (value, overlay->want_shading);
break;
case PROP_XPAD:
g_value_set_int (value, overlay->xpad);
break;
case PROP_YPAD:
g_value_set_int (value, overlay->ypad);
break;
case PROP_DELTAX:
g_value_set_int (value, overlay->deltax);
break;
case PROP_DELTAY:
g_value_set_int (value, overlay->deltay);
break;
case PROP_VALIGN:
g_value_set_enum (value, overlay->valign);
break;
case PROP_HALIGN:
g_value_set_enum (value, overlay->halign);
break;
case PROP_WRAP_MODE:
g_value_set_enum (value, overlay->wrap_mode);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
overlay->need_render = TRUE;
GST_OBJECT_UNLOCK (overlay); GST_OBJECT_UNLOCK (overlay);
} }

View file

@ -21,30 +21,55 @@ G_BEGIN_DECLS
typedef struct _GstTextOverlay GstTextOverlay; typedef struct _GstTextOverlay GstTextOverlay;
typedef struct _GstTextOverlayClass GstTextOverlayClass; typedef struct _GstTextOverlayClass GstTextOverlayClass;
typedef enum _GstTextOverlayVAlign GstTextOverlayVAlign; /**
typedef enum _GstTextOverlayHAlign GstTextOverlayHAlign; * GstTextOverlayVAlign:
typedef enum _GstTextOverlayWrapMode GstTextOverlayWrapMode; * @GST_TEXT_OVERLAY_VALIGN_BASELINE: draw text on the baseline
* @GST_TEXT_OVERLAY_VALIGN_BOTTOM: draw text on the bottom
enum _GstTextOverlayVAlign { * @GST_TEXT_OVERLAY_VALIGN_TOP: draw test on top
*
* Vertical alignment of the text.
*/
typedef enum {
GST_TEXT_OVERLAY_VALIGN_BASELINE, GST_TEXT_OVERLAY_VALIGN_BASELINE,
GST_TEXT_OVERLAY_VALIGN_BOTTOM, GST_TEXT_OVERLAY_VALIGN_BOTTOM,
GST_TEXT_OVERLAY_VALIGN_TOP GST_TEXT_OVERLAY_VALIGN_TOP
}; } GstTextOverlayVAlign;
enum _GstTextOverlayHAlign { /**
* GstTextOverlayHAlign:
* @GST_TEXT_OVERLAY_HALIGN_LEFT: align text left
* @GST_TEXT_OVERLAY_HALIGN_CENTER: align text center
* @GST_TEXT_OVERLAY_HALIGN_RIGHT: align text right
*
* Horizontal alignment of the text.
*/
typedef enum {
GST_TEXT_OVERLAY_HALIGN_LEFT, GST_TEXT_OVERLAY_HALIGN_LEFT,
GST_TEXT_OVERLAY_HALIGN_CENTER, GST_TEXT_OVERLAY_HALIGN_CENTER,
GST_TEXT_OVERLAY_HALIGN_RIGHT GST_TEXT_OVERLAY_HALIGN_RIGHT
}; } GstTextOverlayHAlign;
enum _GstTextOverlayWrapMode { /**
* GstTextOverlayWrapMode:
* @GST_TEXT_OVERLAY_WRAP_MODE_NONE: no wrapping
* @GST_TEXT_OVERLAY_WRAP_MODE_WORD: do word wrapping
* @GST_TEXT_OVERLAY_WRAP_MODE_CHAR: do char wrapping
* @GST_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR: do word and char wrapping
*
* Whether to wrap the text and if so how.
*/
typedef enum {
GST_TEXT_OVERLAY_WRAP_MODE_NONE = -1, GST_TEXT_OVERLAY_WRAP_MODE_NONE = -1,
GST_TEXT_OVERLAY_WRAP_MODE_WORD = PANGO_WRAP_WORD, GST_TEXT_OVERLAY_WRAP_MODE_WORD = PANGO_WRAP_WORD,
GST_TEXT_OVERLAY_WRAP_MODE_CHAR = PANGO_WRAP_CHAR, GST_TEXT_OVERLAY_WRAP_MODE_CHAR = PANGO_WRAP_CHAR,
GST_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR = PANGO_WRAP_WORD_CHAR GST_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR = PANGO_WRAP_WORD_CHAR
}; } GstTextOverlayWrapMode;
/**
* GstTextOverlay:
*
* Opaque textoverlay object structure
*/
struct _GstTextOverlay { struct _GstTextOverlay {
GstElement element; GstElement element;
@ -92,7 +117,6 @@ struct _GstTextOverlayClass {
PangoContext *pango_context; PangoContext *pango_context;
gchar * (*get_text) (GstTextOverlay *overlay, GstBuffer *video_frame); gchar * (*get_text) (GstTextOverlay *overlay, GstBuffer *video_frame);
}; };
GType gst_text_overlay_get_type(void) G_GNUC_CONST; GType gst_text_overlay_get_type(void) G_GNUC_CONST;

View file

@ -21,6 +21,11 @@ G_BEGIN_DECLS
typedef struct _GstTextRender GstTextRender; typedef struct _GstTextRender GstTextRender;
typedef struct _GstTextRenderClass GstTextRenderClass; typedef struct _GstTextRenderClass GstTextRenderClass;
/**
* GstTextRender:
*
* Opaque textrender data structure.
*/
struct _GstTextRender { struct _GstTextRender {
GstElement element; GstElement element;

View file

@ -40,6 +40,11 @@ G_BEGIN_DECLS
typedef struct _GstTimeOverlay GstTimeOverlay; typedef struct _GstTimeOverlay GstTimeOverlay;
typedef struct _GstTimeOverlayClass GstTimeOverlayClass; typedef struct _GstTimeOverlayClass GstTimeOverlayClass;
/**
* GstTimeOverlay:
*
* Opaque timeoverlay data structure.
*/
struct _GstTimeOverlay { struct _GstTimeOverlay {
GstTextOverlay textoverlay; GstTextOverlay textoverlay;
}; };

90
ext/theora/gsttheoradec.h Normal file
View file

@ -0,0 +1,90 @@
/* GStreamer
* Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* 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_THEORADEC_H__
#define __GST_THEORADEC_H__
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <gst/gst.h>
#include <theora/theora.h>
#include <string.h>
G_BEGIN_DECLS
#define GST_TYPE_THEORA_DEC \
(gst_theora_dec_get_type())
#define GST_THEORA_DEC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_THEORA_DEC,GstTheoraDec))
#define GST_THEORA_DEC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_THEORA_DEC,GstTheoraDec))
#define GST_IS_THEORA_DEC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_THEORA_DEC))
#define GST_IS_THEORA_DEC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_THEORA_DEC))
typedef struct _GstTheoraDec GstTheoraDec;
typedef struct _GstTheoraDecClass GstTheoraDecClass;
/**
* GstTheoraDec:
*
* Opaque object data structure.
*/
struct _GstTheoraDec
{
GstElement element;
GstPad *sinkpad;
GstPad *srcpad;
theora_state state;
theora_info info;
theora_comment comment;
gboolean have_header;
guint64 granulepos;
guint64 granule_shift;
GstClockTime last_timestamp;
guint64 frame_nr;
gboolean need_keyframe;
gint width, height;
gint offset_x, offset_y;
gboolean crop;
GList *queued;
gdouble segment_rate;
gint64 segment_start;
gint64 segment_stop;
gint64 segment_time;
};
struct _GstTheoraDecClass
{
GstElementClass parent_class;
};
G_END_DECLS
#endif /* __GST_THEORADEC_H__ */

View file

@ -39,6 +39,14 @@ G_BEGIN_DECLS
typedef struct _GstTheoraEnc GstTheoraEnc; typedef struct _GstTheoraEnc GstTheoraEnc;
typedef struct _GstTheoraEncClass GstTheoraEncClass; typedef struct _GstTheoraEncClass GstTheoraEncClass;
/**
* GstTheoraEncBorderMode:
* @BORDER_NONE: no border
* @BORDER_BLACK: black border
* @BORDER_MIRROR: Mirror image in border
*
* Border color to add when sizes not multiple of 16.
*/
typedef enum typedef enum
{ {
BORDER_NONE, BORDER_NONE,
@ -47,6 +55,11 @@ typedef enum
} }
GstTheoraEncBorderMode; GstTheoraEncBorderMode;
/**
* GstTheoraEnc:
*
* Opaque data structure.
*/
struct _GstTheoraEnc struct _GstTheoraEnc
{ {
GstElement element; GstElement element;

View file

@ -17,68 +17,40 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
/**
* SECTION:element-theoradec
* @see_also: theoraenc, oggdemux
*
* <refsect2>
* <para>
* This element decodes theora streams into raw video
* <ulink url="http://www.theora.org/">Theora</ulink> is a royalty-free
* video codec maintained by the <ulink url="http://www.xiph.org/">Xiph.org
* Foundation</ulink>, based on the VP3 codec.
* </para>
* <para>
* </para>
* <title>Example pipeline</title>
* <programlisting>
* gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! xvimagesink
* </programlisting>
* This example pipeline will decode an ogg stream and decodes the theora video. Refer to
* the theoraenc example to create the ogg file.
* </refsect2>
*
* Last reviewed on 2006-03-01 (0.10.4)
*/
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#include <gst/gst.h> #include "gsttheoradec.h"
#include <theora/theora.h>
#include <string.h>
#include <gst/tag/tag.h> #include <gst/tag/tag.h>
GST_DEBUG_CATEGORY (theoradec_debug); GST_DEBUG_CATEGORY (theoradec_debug);
#define GST_CAT_DEFAULT theoradec_debug #define GST_CAT_DEFAULT theoradec_debug
#define GST_TYPE_THEORA_DEC \
(gst_theora_dec_get_type())
#define GST_THEORA_DEC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_THEORA_DEC,GstTheoraDec))
#define GST_THEORA_DEC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_THEORA_DEC,GstTheoraDec))
#define GST_IS_THEORA_DEC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_THEORA_DEC))
#define GST_IS_THEORA_DEC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_THEORA_DEC))
typedef struct _GstTheoraDec GstTheoraDec;
typedef struct _GstTheoraDecClass GstTheoraDecClass;
struct _GstTheoraDec
{
GstElement element;
GstPad *sinkpad;
GstPad *srcpad;
theora_state state;
theora_info info;
theora_comment comment;
gboolean have_header;
guint64 granulepos;
guint64 granule_shift;
GstClockTime last_timestamp;
guint64 frame_nr;
gboolean need_keyframe;
gint width, height;
gint offset_x, offset_y;
gboolean crop;
GList *queued;
gdouble segment_rate;
gint64 segment_start;
gint64 segment_stop;
gint64 segment_time;
};
struct _GstTheoraDecClass
{
GstElementClass parent_class;
};
#define THEORA_DEF_CROP TRUE #define THEORA_DEF_CROP TRUE
enum enum
{ {

View file

@ -28,11 +28,29 @@
* video codec maintained by the <ulink url="http://www.xiph.org/">Xiph.org * video codec maintained by the <ulink url="http://www.xiph.org/">Xiph.org
* Foundation</ulink>, based on the VP3 codec. * Foundation</ulink>, based on the VP3 codec.
* </para> * </para>
* <para>
* The theora codec internally only supports encoding of images that are a
* multiple of 16 pixls in both X and Y direction. It is however perfectly possible
* to encode images with other dimensions because an arbitrary rectangular cropping
* region can be set up. This element will automatically set up a correct cropping
* region if the dimensions are not multiples of 16 pixels. The "border" and "center"
* properties control how this cropping region will be set up.
* </para>
* <para>
* To control the quality of the encoding, the "bitrate" and "quality" properties can
* be used. These two properties are mutualy exclusive. Setting the bitrate property
* will produce a constant bitrate (CBR) stream while setting the quality property
* will produce a variable bitrate (VBR) stream.
* </para>
* <title>Example pipeline</title> * <title>Example pipeline</title>
* <programlisting> * <programlisting>
* gst-launch -v videotestsrc num-buffers=1000 ! theoraenc ! oggmux ! filesink location=videotestsrc.ogg * gst-launch -v videotestsrc num-buffers=1000 ! theoraenc ! oggmux ! filesink location=videotestsrc.ogg
* </programlisting> * </programlisting>
* This example pipeline will encode a test video source to theora muxed in an
* ogg container. Refer to the theoradec documentation to decode the create stream.
* </refsect2> * </refsect2>
*
* Last reviewed on 2006-03-01 (0.10.4)
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -69,19 +87,6 @@ gst_border_mode_get_type (void)
#define ROUND_UP_4(x) (((x) + 3) & ~3) #define ROUND_UP_4(x) (((x) + 3) & ~3)
#define ROUND_UP_8(x) (((x) + 7) & ~7) #define ROUND_UP_8(x) (((x) + 7) & ~7)
#define THEORA_DEF_CENTER TRUE
#define THEORA_DEF_BORDER BORDER_BLACK
#define THEORA_DEF_BITRATE 0
#define THEORA_DEF_QUALITY 16
#define THEORA_DEF_QUICK TRUE
#define THEORA_DEF_KEYFRAME_AUTO TRUE
#define THEORA_DEF_KEYFRAME_FREQ 64
#define THEORA_DEF_KEYFRAME_FREQ_FORCE 64
#define THEORA_DEF_KEYFRAME_THRESHOLD 80
#define THEORA_DEF_KEYFRAME_MINDISTANCE 8
#define THEORA_DEF_NOISE_SENSITIVITY 1
#define THEORA_DEF_SHARPNESS 0
/* taken from theora/lib/toplevel.c */ /* taken from theora/lib/toplevel.c */
static int static int
_ilog (unsigned int v) _ilog (unsigned int v)
@ -95,6 +100,18 @@ _ilog (unsigned int v)
return (ret); return (ret);
} }
#define THEORA_DEF_CENTER TRUE
#define THEORA_DEF_BORDER BORDER_BLACK
#define THEORA_DEF_BITRATE 0
#define THEORA_DEF_QUALITY 16
#define THEORA_DEF_QUICK TRUE
#define THEORA_DEF_KEYFRAME_AUTO TRUE
#define THEORA_DEF_KEYFRAME_FREQ 64
#define THEORA_DEF_KEYFRAME_FREQ_FORCE 64
#define THEORA_DEF_KEYFRAME_THRESHOLD 80
#define THEORA_DEF_KEYFRAME_MINDISTANCE 8
#define THEORA_DEF_NOISE_SENSITIVITY 1
#define THEORA_DEF_SHARPNESS 0
enum enum
{ {
ARG_0, ARG_0,

View file

@ -37,6 +37,11 @@
typedef struct _GstAudioConvert GstAudioConvert; typedef struct _GstAudioConvert GstAudioConvert;
typedef struct _GstAudioConvertClass GstAudioConvertClass; typedef struct _GstAudioConvertClass GstAudioConvertClass;
/**
* GstAudioConvert
*
* The audioconvert object structure.
*/
struct _GstAudioConvert struct _GstAudioConvert
{ {
GstBaseTransform element; GstBaseTransform element;

View file

@ -42,6 +42,19 @@ G_BEGIN_DECLS
#define GST_IS_AUDIO_TEST_SRC_CLASS(obj) \ #define GST_IS_AUDIO_TEST_SRC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_TEST_SRC)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_TEST_SRC))
/**
* GstAudioTestSrcWave:
* @GST_AUDIO_TEST_SRC_WAVE_SINE: a sine wave
* @GST_AUDIO_TEST_SRC_WAVE_SQUARE: a square wave
* @GST_AUDIO_TEST_SRC_WAVE_SAW: a saw wave
* @GST_AUDIO_TEST_SRC_WAVE_TRIANGLE: a tringle wave
* @GST_AUDIO_TEST_SRC_WAVE_SILENCE: silence
* @GST_AUDIO_TEST_SRC_WAVE_WHITE_NOISE: white noise
* @GST_AUDIO_TEST_SRC_WAVE_PINK_NOISE: pink noise
* @GST_AUDIO_TEST_SRC_WAVE_SINE_TAB: sine wave using a table
*
* Different types of supported sound waves.
*/
typedef enum { typedef enum {
GST_AUDIO_TEST_SRC_WAVE_SINE, GST_AUDIO_TEST_SRC_WAVE_SINE,
GST_AUDIO_TEST_SRC_WAVE_SQUARE, GST_AUDIO_TEST_SRC_WAVE_SQUARE,
@ -51,7 +64,7 @@ typedef enum {
GST_AUDIO_TEST_SRC_WAVE_WHITE_NOISE, GST_AUDIO_TEST_SRC_WAVE_WHITE_NOISE,
GST_AUDIO_TEST_SRC_WAVE_PINK_NOISE, GST_AUDIO_TEST_SRC_WAVE_PINK_NOISE,
GST_AUDIO_TEST_SRC_WAVE_SINE_TAB GST_AUDIO_TEST_SRC_WAVE_SINE_TAB
} GstAudioTestSrcWaves; } GstAudioTestSrcWave;
#define PINK_MAX_RANDOM_ROWS (30) #define PINK_MAX_RANDOM_ROWS (30)
#define PINK_RANDOM_BITS (16) #define PINK_RANDOM_BITS (16)
@ -68,13 +81,18 @@ typedef struct {
typedef struct _GstAudioTestSrc GstAudioTestSrc; typedef struct _GstAudioTestSrc GstAudioTestSrc;
typedef struct _GstAudioTestSrcClass GstAudioTestSrcClass; typedef struct _GstAudioTestSrcClass GstAudioTestSrcClass;
/**
* GstAudioTestSrc:
*
* audiotestsrc object structure.
*/
struct _GstAudioTestSrc { struct _GstAudioTestSrc {
GstBaseSrc parent; GstBaseSrc parent;
void (*process)(GstAudioTestSrc*, gint16 *); void (*process)(GstAudioTestSrc*, gint16 *);
/* parameters */ /* parameters */
GstAudioTestSrcWaves wave; GstAudioTestSrcWave wave;
gdouble volume; gdouble volume;
gdouble freq; gdouble freq;
@ -82,7 +100,7 @@ struct _GstAudioTestSrc {
gint samplerate; gint samplerate;
gint samples_per_buffer; gint samples_per_buffer;
/* < private > */ /*< private >*/
gboolean tags_pushed; /* send tags just once ? */ gboolean tags_pushed; /* send tags just once ? */
GstClockTimeDiff timestamp_offset; /* base offset */ GstClockTimeDiff timestamp_offset; /* base offset */
GstClockTime running_time; /* total running time */ GstClockTime running_time; /* total running time */

View file

@ -42,6 +42,11 @@ G_BEGIN_DECLS
typedef struct _GstFFMpegCsp GstFFMpegCsp; typedef struct _GstFFMpegCsp GstFFMpegCsp;
typedef struct _GstFFMpegCspClass GstFFMpegCspClass; typedef struct _GstFFMpegCspClass GstFFMpegCspClass;
/**
* GstFFMpegCsp:
*
* Opaque object data structure.
*/
struct _GstFFMpegCsp struct _GstFFMpegCsp
{ {
GstBaseTransform element; GstBaseTransform element;

View file

@ -20,7 +20,66 @@
/** /**
* SECTION:element-multifdsink * SECTION:element-multifdsink
* @short_description: Send data to multiple file descriptors
* @see_also: tcpserversink * @see_also: tcpserversink
*
* <refsect2>
* <para>
* This plugin writes incoming data to a set of filedescriptors. The filedescriptors
* can be added to multifdsink by emiting the "add" signal. For each descriptor added
* the "client-added" signal will be called.
* </para>
* <para>
* Clients can be removed from multifdsink by emiting the "remove" signal. For each
* descriptor removed the "client-removed" signal will be called. The "client-removed"
* signal can also be fired when multifdsink decides that a client is not active anymore
* or, depending on the value of the "recover-policy" if the client is reading to slow.
* In all cases, multifdsink will never close a filedescriptor itself, the application
* has to do that itself, for example, in the "client-removed" signal callback.
* </para>
* <para>
* Multifdsink internally keeps a queue of the incomming buffers and uses a separate
* thread to send the buffers to the clients. This ensures that no client write can
* block the pipeline and that clients can read with different speeds.
* </para>
* <para>
* When adding a client to multifdsink, the "sync-method" property will define which
* buffer will be sent first to the client. Clients can be sent respectively the most
* recent buffer (which might not be decodable by the client when it is not a keyframe),
* the next keyframe received in multifdsink (which can take some time depending on the
* keyframe rate, or the last received keyframe (which will cause a burst-on-connect).
* </para>
* <para>
* When streaming data, clients are allowed to read at a different rate than the rate
* at which multifdsink receives data. If the client is reading too fast, no data will
* be send to the client until multifdsink receives more data. If the client however
* reads too slow, data for that client will bunch up in multifdsink. Two properties
* control the amount of data (buffers) that is queued in multifdsink: "buffers-max"
* and "buffers-soft-max". A client with a lag of "buffers-max" is removed from
* multifdsink forcibly.
* </para>
* <para>
* A client with a lag of at least "buffers-soft-max" enters the recovery procedure
* which is controled with the "recover-policy" property. A recover policy of NONE will
* do nothing, RESYNC_LATEST will send the most recently received buffer as the next
* buffer for the client, RESYNC_SOFT_LIMIT positions the client to the soft limit
* in the buffer queue and RESYNC_KEYFRAME positions the client to the most recent
* keyframe in the buffer queue.
* </para>
* <para>
* multifdsink will synchronize on the clock before serving the buffers to the clients.
* </para>
* <para>
* Example pipeline:
* <programlisting>
* gst-launch -v videotestsrc ! multifdsink
* </programlisting>
* This pipeline will not do a lot since it is not possible from a gst-launch line
* to add filedescriptors to multifdsink.
* </para>
* </refsect2>
*
* Last reviewed on 2006-03-01 (0.10.4)
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -369,6 +428,21 @@ gst_multi_fd_sink_class_init (GstMultiFdSinkClass * klass)
g_signal_new ("clear", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, g_signal_new ("clear", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMultiFdSinkClass, clear), G_STRUCT_OFFSET (GstMultiFdSinkClass, clear),
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
/**
* GstMultiFdSink::get-stats:
* @gstmultifdsink: the multifdsink element to emit this signal on
* @fd: the file descriptor to get stats of from multifdsink
*
* Get statistics about @fd. This function returns a GValueArray to ease
* automatic wrapping for bindings.
*
* Returns: a GValueArray with the statistics. The array contains 5 guint64
* values that represent respectively total number of bytes sent, time
* when the client was added, time when the client was disconnected/removed,
* time the client is/was active, last activity time. All times are
* expressed in nanoseconds (GstClockTime).
*/
gst_multi_fd_sink_signals[SIGNAL_GET_STATS] = gst_multi_fd_sink_signals[SIGNAL_GET_STATS] =
g_signal_new ("get-stats", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, g_signal_new ("get-stats", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMultiFdSinkClass, get_stats), G_STRUCT_OFFSET (GstMultiFdSinkClass, get_stats),
@ -378,9 +452,11 @@ gst_multi_fd_sink_class_init (GstMultiFdSinkClass * klass)
/** /**
* GstMultiFdSink::client-added: * GstMultiFdSink::client-added:
* @gstmultifdsink: the multifdsink element that emitted this signal * @gstmultifdsink: the multifdsink element that emitted this signal
* @arg1: the file descriptor that was added to multifdsink * @fd: the file descriptor that was added to multifdsink
* *
* The given file descriptor was added to multifdsink. * The given file descriptor was added to multifdsink. This signal will
* be emited from the streaming thread so application should be prepared
* for that.
*/ */
gst_multi_fd_sink_signals[SIGNAL_CLIENT_ADDED] = gst_multi_fd_sink_signals[SIGNAL_CLIENT_ADDED] =
g_signal_new ("client-added", G_TYPE_FROM_CLASS (klass), g_signal_new ("client-added", G_TYPE_FROM_CLASS (klass),
@ -389,9 +465,12 @@ gst_multi_fd_sink_class_init (GstMultiFdSinkClass * klass)
/** /**
* GstMultiFdSink::client-removed: * GstMultiFdSink::client-removed:
* @gstmultifdsink: the multifdsink element that emitted this signal * @gstmultifdsink: the multifdsink element that emitted this signal
* @arg1: the file descriptor that was removed from multifdsink * @fd: the file descriptor that was removed from multifdsink
* @status: the reason why the client was removed
* *
* The given file descriptor was removed from multifdsink. * The given file descriptor was removed from multifdsink. This signal will
* be emited from the streaming thread so applications should be prepared
* for that.
*/ */
gst_multi_fd_sink_signals[SIGNAL_CLIENT_REMOVED] = gst_multi_fd_sink_signals[SIGNAL_CLIENT_REMOVED] =
g_signal_new ("client-removed", G_TYPE_FROM_CLASS (klass), g_signal_new ("client-removed", G_TYPE_FROM_CLASS (klass),
@ -563,6 +642,14 @@ gst_multi_fd_sink_clear (GstMultiFdSink * sink)
CLIENTS_UNLOCK (sink); CLIENTS_UNLOCK (sink);
} }
/* the array returned contains:
*
* guint64 : bytes_sent
* guint64 : connect time (in nanoseconds)
* guint64 : disconnect time (in nanoseconds)
* guint64 : time the client is/was connected (in nanoseconds)
* guint64 : last activity time (in nanoseconds)
*/
GValueArray * GValueArray *
gst_multi_fd_sink_get_stats (GstMultiFdSink * sink, int fd) gst_multi_fd_sink_get_stats (GstMultiFdSink * sink, int fd)
{ {
@ -1204,7 +1291,6 @@ gst_multi_fd_sink_recover_client (GstMultiFdSink * sink, GstTCPClient * client)
* had a position of -1) because they can proceed after adding this new buffer. * had a position of -1) because they can proceed after adding this new buffer.
* This is done by adding the client back into the write fd_set and signalling * This is done by adding the client back into the write fd_set and signalling
* the select thread that the fd_set changed. * the select thread that the fd_set changed.
*
*/ */
static void static void
gst_multi_fd_sink_queue_buffer (GstMultiFdSink * sink, GstBuffer * buf) gst_multi_fd_sink_queue_buffer (GstMultiFdSink * sink, GstBuffer * buf)

View file

@ -53,6 +53,16 @@ typedef enum {
GST_MULTI_FD_SINK_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2), GST_MULTI_FD_SINK_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2),
} GstMultiFdSinkFlags; } GstMultiFdSinkFlags;
/**
* GstRecoverPolicy:
* @GST_RECOVER_POLICY_NONE : no recovering is done
* @GST_RECOVER_POLICY_RESYNC_LATEST : client is moved to last buffer
* @GST_RECOVER_POLICY_RESYNC_SOFT_LIMIT: client is moved to the soft limit
* @GST_RECOVER_POLICY_RESYNC_KEYFRAME : client is moved to latest keyframe
*
* Possible values for the recovery procedure to use when a client consumes
* data too slow and has a backlag of more that soft-limit buffers.
*/
typedef enum typedef enum
{ {
GST_RECOVER_POLICY_NONE, GST_RECOVER_POLICY_NONE,
@ -61,6 +71,15 @@ typedef enum
GST_RECOVER_POLICY_RESYNC_KEYFRAME, GST_RECOVER_POLICY_RESYNC_KEYFRAME,
} GstRecoverPolicy; } GstRecoverPolicy;
/**
* GstSyncMethod:
* @GST_SYNC_METHOD_LATEST : client receives most recent buffer
* @GST_SYNC_METHOD_NEXT_KEYFRAME : client receives next keyframe
* @GST_SYNC_METHOD_LATEST_KEYFRAME: client receives latest keyframe (burst)
*
* This enum defines the selection of the first buffer that is sent
* to a new client.
*/
typedef enum typedef enum
{ {
GST_SYNC_METHOD_LATEST, GST_SYNC_METHOD_LATEST,
@ -68,6 +87,14 @@ typedef enum
GST_SYNC_METHOD_LATEST_KEYFRAME, GST_SYNC_METHOD_LATEST_KEYFRAME,
} GstSyncMethod; } GstSyncMethod;
/**
* GstUnitType:
* @GST_UNIT_TYPE_BUFFERS: a buffer
* @GST_UNIT_TYPE_TIME : timeunits (in nanoseconds)
* @GST_UNIT_TYPE_BYTES : bytes
*
* The units used to specify limits.
*/
typedef enum typedef enum
{ {
GST_UNIT_TYPE_BUFFERS, GST_UNIT_TYPE_BUFFERS,
@ -75,6 +102,18 @@ typedef enum
GST_UNIT_TYPE_BYTES, GST_UNIT_TYPE_BYTES,
} GstUnitType; } GstUnitType;
/**
* GstClientStatus:
* @GST_CLIENT_STATUS_OK : client is ok
* @GST_CLIENT_STATUS_CLOSED : client closed the socket
* @GST_CLIENT_STATUS_REMOVED : client is removed
* @GST_CLIENT_STATUS_SLOW : client is too slow
* @GST_CLIENT_STATUS_ERROR : client is in error
* @GST_CLIENT_STATUS_DUPLICATE: same client added twice
*
* This specifies the reason why a client was removed from
* multifdsink and is received in the "client-removed" signal.
*/
typedef enum typedef enum
{ {
GST_CLIENT_STATUS_OK = 0, GST_CLIENT_STATUS_OK = 0,
@ -86,7 +125,7 @@ typedef enum
} GstClientStatus; } GstClientStatus;
/* structure for a client /* structure for a client
* */ */
typedef struct { typedef struct {
GstFD fd; GstFD fd;
@ -121,9 +160,15 @@ typedef struct {
#define CLIENTS_LOCK(fdsink) (g_static_rec_mutex_lock(&fdsink->clientslock)) #define CLIENTS_LOCK(fdsink) (g_static_rec_mutex_lock(&fdsink->clientslock))
#define CLIENTS_UNLOCK(fdsink) (g_static_rec_mutex_unlock(&fdsink->clientslock)) #define CLIENTS_UNLOCK(fdsink) (g_static_rec_mutex_unlock(&fdsink->clientslock))
/**
* GstMultiFdSink:
*
* The multifdsink object structure.
*/
struct _GstMultiFdSink { struct _GstMultiFdSink {
GstBaseSink element; GstBaseSink element;
/*< private >*/
guint64 bytes_to_serve; /* how much bytes we must serve */ guint64 bytes_to_serve; /* how much bytes we must serve */
guint64 bytes_served; /* how much bytes have we served */ guint64 bytes_served; /* how much bytes have we served */