2005-07-20 09:40:32 +00:00
|
|
|
/* GStreamer
|
|
|
|
* (c) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
Re-factor the gconfaudiosink into a "GstSwitchSink" base class and a child that implements the GConf key monitoring. ...
Original commit message from CVS:
* ext/gconf/Makefile.am:
* ext/gconf/gconf.c: (gst_gconf_get_string),
(gst_gconf_get_key_for_sink_profile), (gst_gconf_set_string),
(gst_gconf_render_bin_with_default):
* ext/gconf/gconf.h:
* ext/gconf/gstgconfaudiosink.c: (gst_gconf_audio_sink_base_init),
(gst_gconf_audio_sink_reset), (gst_gconf_audio_sink_init),
(gst_gconf_audio_sink_dispose), (do_change_child),
(gst_gconf_switch_profile), (gst_gconf_audio_sink_set_property),
(cb_change_child), (gst_gconf_audio_sink_change_state):
* ext/gconf/gstgconfaudiosink.h:
* ext/gconf/gstswitchsink.c: (gst_switch_sink_base_init),
(gst_switch_sink_class_init), (gst_switch_sink_reset),
(gst_switch_sink_init), (gst_switch_sink_dispose),
(gst_switch_commit_new_kid), (gst_switch_sink_set_child),
(gst_switch_sink_set_property), (gst_switch_sink_handle_event),
(gst_switch_sink_get_property), (gst_switch_sink_change_state):
* ext/gconf/gstswitchsink.h:
* gst/autodetect/gstautoaudiosink.c:
(gst_auto_audio_sink_class_init), (gst_auto_audio_sink_dispose),
(gst_auto_audio_sink_clear_kid), (gst_auto_audio_sink_reset),
(gst_auto_audio_sink_detect):
* gst/autodetect/gstautovideosink.c:
(gst_auto_video_sink_class_init), (gst_auto_video_sink_dispose),
(gst_auto_video_sink_clear_kid), (gst_auto_video_sink_reset),
(gst_auto_video_sink_detect):
Re-factor the gconfaudiosink into a "GstSwitchSink" base class
and a child that implements the GConf key monitoring. The end goal of
this is an audio sink that can be changed on the fly, but at the
moment it still only changes on the next READY transition.
2007-02-13 16:01:29 +00:00
|
|
|
* (c) 2006 Jan Schmidt <thaytan@noraisin.net>
|
2005-07-20 09:40:32 +00:00
|
|
|
*
|
|
|
|
* 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
|
2012-11-04 00:07:18 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2005-07-20 09:40:32 +00:00
|
|
|
*/
|
|
|
|
|
2005-11-25 21:02:16 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-autovideosink
|
2018-10-22 09:39:24 +00:00
|
|
|
* @title: autovideosink
|
2005-11-25 21:02:16 +00:00
|
|
|
* @see_also: autoaudiosink, ximagesink, xvimagesink, sdlvideosink
|
|
|
|
*
|
|
|
|
* autovideosink is a video sink that automatically detects an appropriate
|
|
|
|
* video sink to use. It does so by scanning the registry for all elements
|
2007-12-05 16:04:47 +00:00
|
|
|
* that have <quote>Sink</quote> and <quote>Video</quote> in the class field
|
2005-11-25 21:02:16 +00:00
|
|
|
* of their element information, and also have a non-zero autoplugging rank.
|
2008-10-27 08:54:30 +00:00
|
|
|
*
|
2018-10-22 09:39:24 +00:00
|
|
|
* ## Example launch line
|
2008-10-27 08:54:30 +00:00
|
|
|
* |[
|
2012-08-26 21:39:55 +00:00
|
|
|
* gst-launch-1.0 -v -m videotestsrc ! autovideosink
|
2008-10-27 08:54:30 +00:00
|
|
|
* ]|
|
2018-10-22 09:39:24 +00:00
|
|
|
*
|
2005-11-25 21:02:16 +00:00
|
|
|
*/
|
|
|
|
|
2005-07-20 09:40:32 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "gstautovideosink.h"
|
|
|
|
|
2012-07-10 12:38:21 +00:00
|
|
|
#define DEFAULT_TS_OFFSET 0
|
|
|
|
|
2007-12-05 16:04:47 +00:00
|
|
|
/* Properties */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
2012-07-10 12:38:21 +00:00
|
|
|
PROP_TS_OFFSET,
|
2007-12-05 16:04:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void gst_auto_video_sink_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_auto_video_sink_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
2014-02-19 20:55:52 +00:00
|
|
|
static void gst_auto_video_sink_configure (GstAutoDetect * autodetect,
|
|
|
|
GstElement * kid);
|
2007-12-05 16:04:47 +00:00
|
|
|
|
2014-02-19 20:55:52 +00:00
|
|
|
G_DEFINE_TYPE (GstAutoVideoSink, gst_auto_video_sink, GST_TYPE_AUTO_DETECT);
|
2005-07-20 09:40:32 +00:00
|
|
|
|
2006-09-22 12:12:10 +00:00
|
|
|
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
2005-07-20 09:40:32 +00:00
|
|
|
static void
|
|
|
|
gst_auto_video_sink_class_init (GstAutoVideoSinkClass * klass)
|
|
|
|
{
|
2014-02-19 20:55:52 +00:00
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
2005-07-20 09:40:32 +00:00
|
|
|
GstElementClass *eklass = GST_ELEMENT_CLASS (klass);
|
2014-02-19 20:55:52 +00:00
|
|
|
GstAutoDetectClass *aklass = GST_AUTO_DETECT_CLASS (klass);
|
2005-07-20 09:40:32 +00:00
|
|
|
|
2010-06-06 15:52:40 +00:00
|
|
|
gobject_class->set_property = gst_auto_video_sink_set_property;
|
|
|
|
gobject_class->get_property = gst_auto_video_sink_get_property;
|
2007-12-05 16:04:47 +00:00
|
|
|
|
2014-02-19 20:55:52 +00:00
|
|
|
aklass->configure = gst_auto_video_sink_configure;
|
2011-04-19 15:07:18 +00:00
|
|
|
|
2012-07-10 12:38:21 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_TS_OFFSET,
|
|
|
|
g_param_spec_int64 ("ts-offset", "TS Offset",
|
|
|
|
"Timestamp offset in nanoseconds", G_MININT64, G_MAXINT64,
|
|
|
|
DEFAULT_TS_OFFSET, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
2016-03-04 01:30:12 +00:00
|
|
|
gst_element_class_add_static_pad_template (eklass, &sink_template);
|
2012-04-09 23:51:41 +00:00
|
|
|
gst_element_class_set_static_metadata (eklass, "Auto video sink",
|
2011-04-19 15:07:18 +00:00
|
|
|
"Sink/Video",
|
|
|
|
"Wrapper video sink for automatically detected video sink",
|
|
|
|
"Jan Schmidt <thaytan@noraisin.net>");
|
2005-07-20 09:40:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-04-19 15:07:18 +00:00
|
|
|
gst_auto_video_sink_init (GstAutoVideoSink * sink)
|
2005-07-20 09:40:32 +00:00
|
|
|
{
|
2014-02-19 20:55:52 +00:00
|
|
|
GstAutoDetect *autodetect = GST_AUTO_DETECT (sink);
|
Use new ghostpad API; now they actually work in Totem, also.
Original commit message from CVS:
* ext/gconf/gstgconfaudiosink.c: (gst_gconf_audio_sink_reset),
(gst_gconf_audio_sink_init), (do_toggle_element),
(cb_toggle_element), (gst_gconf_audio_sink_change_state):
* ext/gconf/gstgconfaudiosink.h:
* ext/gconf/gstgconfvideosink.c: (gst_gconf_video_sink_reset),
(gst_gconf_video_sink_init), (do_toggle_element),
(cb_toggle_element), (gst_gconf_video_sink_change_state):
* ext/gconf/gstgconfvideosink.h:
* gst/autodetect/gstautoaudiosink.c: (gst_auto_audio_sink_reset),
(gst_auto_audio_sink_init), (gst_auto_audio_sink_detect),
(gst_auto_audio_sink_change_state):
* gst/autodetect/gstautoaudiosink.h:
* gst/autodetect/gstautovideosink.c: (gst_auto_video_sink_reset),
(gst_auto_video_sink_init), (gst_auto_video_sink_detect),
(gst_auto_video_sink_change_state):
* gst/autodetect/gstautovideosink.h:
Use new ghostpad API; now they actually work in Totem, also.
2005-08-03 17:18:31 +00:00
|
|
|
|
2014-02-19 20:55:52 +00:00
|
|
|
autodetect->media_klass = "Video";
|
|
|
|
autodetect->flag = GST_ELEMENT_FLAG_SINK;
|
2005-09-24 13:10:52 +00:00
|
|
|
|
2012-07-10 12:38:21 +00:00
|
|
|
sink->ts_offset = DEFAULT_TS_OFFSET;
|
2005-07-20 09:40:32 +00:00
|
|
|
}
|
|
|
|
|
2014-02-19 20:55:52 +00:00
|
|
|
static void
|
|
|
|
gst_auto_video_sink_configure (GstAutoDetect * autodetect, GstElement * kid)
|
2005-07-20 09:40:32 +00:00
|
|
|
{
|
2014-02-19 20:55:52 +00:00
|
|
|
GstAutoVideoSink *self = GST_AUTO_VIDEO_SINK (autodetect);
|
2005-11-01 12:39:16 +00:00
|
|
|
|
2014-02-19 20:55:52 +00:00
|
|
|
g_object_set (G_OBJECT (kid), "ts-offset", self->ts_offset, NULL);
|
2005-07-20 09:40:32 +00:00
|
|
|
}
|
2007-12-05 16:04:47 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gst_auto_video_sink_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstAutoVideoSink *sink = GST_AUTO_VIDEO_SINK (object);
|
2014-02-19 20:55:52 +00:00
|
|
|
GstAutoDetect *autodetect = (GstAutoDetect *) sink;
|
2007-12-05 16:04:47 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2012-07-10 12:38:21 +00:00
|
|
|
case PROP_TS_OFFSET:
|
|
|
|
sink->ts_offset = g_value_get_int64 (value);
|
2014-02-19 20:55:52 +00:00
|
|
|
if (autodetect->kid)
|
|
|
|
g_object_set_property (G_OBJECT (autodetect->kid), pspec->name, value);
|
2013-08-28 08:51:32 +00:00
|
|
|
break;
|
2007-12-05 16:04:47 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_auto_video_sink_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstAutoVideoSink *sink = GST_AUTO_VIDEO_SINK (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2012-07-10 12:38:21 +00:00
|
|
|
case PROP_TS_OFFSET:
|
|
|
|
g_value_set_int64 (value, sink->ts_offset);
|
|
|
|
break;
|
2007-12-05 16:04:47 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|