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
|
|
|
|
* @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
|
|
|
*
|
|
|
|
* <refsect2>
|
2005-11-25 21:02:16 +00:00
|
|
|
* <title>Example launch line</title>
|
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
|
|
|
* ]|
|
2005-11-25 21:02:16 +00:00
|
|
|
* </refsect2>
|
|
|
|
*/
|
|
|
|
|
2005-07-20 09:40:32 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "gstautovideosink.h"
|
|
|
|
#include "gstautodetect.h"
|
|
|
|
|
2012-07-10 12:38:21 +00:00
|
|
|
#define DEFAULT_TS_OFFSET 0
|
2013-08-28 08:51:32 +00:00
|
|
|
#define DEFAULT_SYNC TRUE
|
2012-07-10 12:38:21 +00:00
|
|
|
|
2007-12-05 16:04:47 +00:00
|
|
|
/* Properties */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_CAPS,
|
2012-07-10 12:38:21 +00:00
|
|
|
PROP_TS_OFFSET,
|
2013-08-28 08:51:32 +00:00
|
|
|
PROP_SYNC,
|
2007-12-05 16:04:47 +00:00
|
|
|
};
|
|
|
|
|
2005-09-02 15:44:50 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_auto_video_sink_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
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
|
|
|
static void gst_auto_video_sink_dispose (GstAutoVideoSink * sink);
|
|
|
|
static void gst_auto_video_sink_clear_kid (GstAutoVideoSink * sink);
|
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);
|
|
|
|
static void gst_auto_video_sink_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
|
2011-04-19 15:07:18 +00:00
|
|
|
#define gst_auto_video_sink_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE (GstAutoVideoSink, gst_auto_video_sink, GST_TYPE_BIN);
|
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)
|
|
|
|
{
|
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
|
|
|
GObjectClass *gobject_class;
|
2005-07-20 09:40:32 +00:00
|
|
|
GstElementClass *eklass = GST_ELEMENT_CLASS (klass);
|
|
|
|
|
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
|
|
|
gobject_class = G_OBJECT_CLASS (klass);
|
2010-06-06 15:52:40 +00:00
|
|
|
gobject_class->dispose = (GObjectFinalizeFunc) gst_auto_video_sink_dispose;
|
|
|
|
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
|
|
|
|
2010-06-06 15:52:40 +00:00
|
|
|
eklass->change_state = GST_DEBUG_FUNCPTR (gst_auto_video_sink_change_state);
|
2007-12-05 16:04:47 +00:00
|
|
|
/**
|
|
|
|
* GstAutoVideoSink:filter-caps
|
|
|
|
*
|
|
|
|
* This property will filter out candidate sinks that can handle the specified
|
|
|
|
* caps. By default only video sinks that support raw rgb and yuv video
|
|
|
|
* are selected.
|
|
|
|
*
|
|
|
|
* This property can only be set before the element goes to the READY state.
|
|
|
|
*
|
|
|
|
* Since: 0.10.7
|
|
|
|
**/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_CAPS,
|
|
|
|
g_param_spec_boxed ("filter-caps", "Filter caps",
|
|
|
|
"Filter sink candidates using these caps.", GST_TYPE_CAPS,
|
2010-10-13 14:21:23 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
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));
|
|
|
|
|
2013-08-28 08:51:32 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_SYNC,
|
|
|
|
g_param_spec_boolean ("sync", "Sync",
|
|
|
|
"Sync on the clock", DEFAULT_SYNC,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
2011-04-19 15:07:18 +00:00
|
|
|
gst_element_class_add_pad_template (eklass,
|
|
|
|
gst_static_pad_template_get (&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
|
|
|
}
|
|
|
|
|
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
|
|
|
static void
|
|
|
|
gst_auto_video_sink_dispose (GstAutoVideoSink * sink)
|
|
|
|
{
|
|
|
|
gst_auto_video_sink_clear_kid (sink);
|
|
|
|
|
2007-12-05 16:04:47 +00:00
|
|
|
if (sink->filter_caps)
|
|
|
|
gst_caps_unref (sink->filter_caps);
|
|
|
|
sink->filter_caps = NULL;
|
|
|
|
|
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
|
|
|
G_OBJECT_CLASS (parent_class)->dispose ((GObject *) sink);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_auto_video_sink_clear_kid (GstAutoVideoSink * sink)
|
|
|
|
{
|
|
|
|
if (sink->kid) {
|
|
|
|
gst_element_set_state (sink->kid, GST_STATE_NULL);
|
|
|
|
gst_bin_remove (GST_BIN (sink), sink->kid);
|
|
|
|
sink->kid = NULL;
|
2010-06-09 18:22:30 +00:00
|
|
|
/* Don't lose the SINK flag */
|
2011-11-28 15:57:24 +00:00
|
|
|
GST_OBJECT_FLAG_SET (sink, GST_ELEMENT_FLAG_SINK);
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/*
|
|
|
|
* Hack to make initial linking work; ideally, this'd work even when
|
|
|
|
* no target has been assigned to the ghostpad yet.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_auto_video_sink_reset (GstAutoVideoSink * sink)
|
|
|
|
{
|
|
|
|
GstPad *targetpad;
|
|
|
|
|
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
|
|
|
/* Remove any existing element */
|
|
|
|
gst_auto_video_sink_clear_kid (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
|
|
|
/* fakesink placeholder */
|
|
|
|
sink->kid = gst_element_factory_make ("fakesink", "tempsink");
|
|
|
|
gst_bin_add (GST_BIN (sink), sink->kid);
|
|
|
|
|
2008-11-25 16:26:16 +00:00
|
|
|
/* pad, setting this target should always work */
|
Don't use gst_element_get_pad(), it's a bad method.
Original commit message from CVS:
* ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_reset),
(do_toggle_element):
* ext/gconf/gstgconfvideosink.c: (gst_gconf_video_sink_reset),
(do_toggle_element):
* ext/gconf/gstgconfvideosrc.c: (gst_gconf_video_src_reset),
(do_toggle_element):
* ext/gconf/gstswitchsink.c: (gst_switch_commit_new_kid):
* ext/hal/gsthalaudiosink.c: (gst_hal_audio_sink_reset),
(do_toggle_element):
* ext/hal/gsthalaudiosrc.c: (gst_hal_audio_src_reset),
(do_toggle_element):
* gst/autodetect/gstautoaudiosink.c: (gst_auto_audio_sink_reset),
(gst_auto_audio_sink_detect):
* gst/autodetect/gstautovideosink.c: (gst_auto_video_sink_reset),
(gst_auto_video_sink_detect):
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_init),
(gst_rtspsrc_stream_free), (gst_rtspsrc_stream_configure_udp),
(gst_rtspsrc_stream_configure_udp_sink), (gst_rtspsrc_skip_lws),
(gst_rtspsrc_unskip_lws), (gst_rtspsrc_skip_commas),
(gst_rtspsrc_skip_item), (gst_rtsp_decode_quoted_string),
(gst_rtspsrc_parse_digest_challenge), (gst_rtspsrc_parse_auth_hdr):
* tests/icles/videocrop-test.c: (test_with_caps),
(video_crop_get_test_caps):
Don't use gst_element_get_pad(), it's a bad method.
2008-05-21 17:39:38 +00:00
|
|
|
targetpad = gst_element_get_static_pad (sink->kid, "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
|
|
|
gst_ghost_pad_set_target (GST_GHOST_PAD (sink->pad), targetpad);
|
|
|
|
gst_object_unref (targetpad);
|
|
|
|
}
|
|
|
|
|
2011-06-17 16:11:38 +00:00
|
|
|
static GstStaticCaps raw_caps = GST_STATIC_CAPS ("video/x-raw");
|
2007-12-05 16:04:47 +00:00
|
|
|
|
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
|
|
|
{
|
2005-11-22 11:53:34 +00:00
|
|
|
sink->pad = gst_ghost_pad_new_no_target ("sink", GST_PAD_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
|
|
|
gst_element_add_pad (GST_ELEMENT (sink), sink->pad);
|
|
|
|
|
|
|
|
gst_auto_video_sink_reset (sink);
|
2005-09-24 13:10:52 +00:00
|
|
|
|
2007-12-05 16:04:47 +00:00
|
|
|
/* set the default raw video caps */
|
|
|
|
sink->filter_caps = gst_static_caps_get (&raw_caps);
|
2012-07-10 12:38:21 +00:00
|
|
|
sink->ts_offset = DEFAULT_TS_OFFSET;
|
2013-08-28 08:51:32 +00:00
|
|
|
sink->sync = DEFAULT_SYNC;
|
2007-12-05 16:04:47 +00:00
|
|
|
|
|
|
|
/* mark as sink */
|
2011-11-28 15:57:24 +00:00
|
|
|
GST_OBJECT_FLAG_SET (sink, GST_ELEMENT_FLAG_SINK);
|
2005-07-20 09:40:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_auto_video_sink_factory_filter (GstPluginFeature * feature, gpointer data)
|
|
|
|
{
|
|
|
|
guint rank;
|
|
|
|
const gchar *klass;
|
|
|
|
|
|
|
|
/* we only care about element factories */
|
|
|
|
if (!GST_IS_ELEMENT_FACTORY (feature))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* video sinks */
|
2012-09-15 17:06:06 +00:00
|
|
|
klass = gst_element_factory_get_metadata (GST_ELEMENT_FACTORY (feature),
|
|
|
|
GST_ELEMENT_METADATA_KLASS);
|
2005-11-25 21:02:16 +00:00
|
|
|
if (!(strstr (klass, "Sink") && strstr (klass, "Video")))
|
2005-07-20 09:40:32 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* only select elements with autoplugging rank */
|
|
|
|
rank = gst_plugin_feature_get_rank (feature);
|
|
|
|
if (rank < GST_RANK_MARGINAL)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2007-12-05 16:04:47 +00:00
|
|
|
static GstElement *
|
|
|
|
gst_auto_video_sink_create_element_with_pretty_name (GstAutoVideoSink * sink,
|
|
|
|
GstElementFactory * factory)
|
|
|
|
{
|
|
|
|
GstElement *element;
|
|
|
|
gchar *name, *marker;
|
|
|
|
|
2011-05-24 16:27:10 +00:00
|
|
|
marker = g_strdup (GST_OBJECT_NAME (factory));
|
2007-12-05 16:04:47 +00:00
|
|
|
if (g_str_has_suffix (marker, "sink"))
|
|
|
|
marker[strlen (marker) - 4] = '\0';
|
|
|
|
if (g_str_has_prefix (marker, "gst"))
|
|
|
|
g_memmove (marker, marker + 3, strlen (marker + 3) + 1);
|
|
|
|
name = g_strdup_printf ("%s-actual-sink-%s", GST_OBJECT_NAME (sink), marker);
|
|
|
|
g_free (marker);
|
|
|
|
|
|
|
|
element = gst_element_factory_create (factory, name);
|
|
|
|
g_free (name);
|
|
|
|
|
|
|
|
return element;
|
|
|
|
}
|
|
|
|
|
2005-07-20 09:40:32 +00:00
|
|
|
static GstElement *
|
|
|
|
gst_auto_video_sink_find_best (GstAutoVideoSink * sink)
|
|
|
|
{
|
2007-12-05 16:04:47 +00:00
|
|
|
GList *list, *item;
|
2005-11-22 14:44:26 +00:00
|
|
|
GstElement *choice = NULL;
|
2007-12-05 16:04:47 +00:00
|
|
|
GstMessage *message = NULL;
|
|
|
|
GSList *errors = NULL;
|
|
|
|
GstBus *bus = gst_bus_new ();
|
|
|
|
GstPad *el_pad = NULL;
|
2010-05-06 12:38:35 +00:00
|
|
|
GstCaps *el_caps = NULL;
|
2007-12-05 16:04:47 +00:00
|
|
|
gboolean no_match = TRUE;
|
2005-07-20 09:40:32 +00:00
|
|
|
|
2012-01-02 14:32:40 +00:00
|
|
|
list = gst_registry_feature_filter (gst_registry_get (),
|
2005-07-20 09:40:32 +00:00
|
|
|
(GstPluginFeatureFilter) gst_auto_video_sink_factory_filter, FALSE, sink);
|
2013-04-18 09:20:08 +00:00
|
|
|
list =
|
|
|
|
g_list_sort (list, (GCompareFunc) gst_plugin_feature_rank_compare_func);
|
2005-07-20 09:40:32 +00:00
|
|
|
|
2007-12-05 16:04:47 +00:00
|
|
|
GST_LOG_OBJECT (sink, "Trying to find usable video devices ...");
|
|
|
|
|
|
|
|
for (item = list; item != NULL; item = item->next) {
|
|
|
|
GstElementFactory *f = GST_ELEMENT_FACTORY (item->data);
|
2005-07-20 09:40:32 +00:00
|
|
|
GstElement *el;
|
|
|
|
|
2007-12-05 16:04:47 +00:00
|
|
|
if ((el = gst_auto_video_sink_create_element_with_pretty_name (sink, f))) {
|
2005-10-04 17:58:40 +00:00
|
|
|
GstStateChangeReturn ret;
|
|
|
|
|
2011-05-24 16:27:10 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "Testing %s", GST_OBJECT_NAME (f));
|
2007-12-05 16:04:47 +00:00
|
|
|
|
|
|
|
/* If autovideosink has been provided with filter caps,
|
|
|
|
* accept only sinks that match with the filter caps */
|
|
|
|
if (sink->filter_caps) {
|
|
|
|
el_pad = gst_element_get_static_pad (GST_ELEMENT (el), "sink");
|
2011-11-15 15:55:27 +00:00
|
|
|
el_caps = gst_pad_query_caps (el_pad, NULL);
|
2007-12-05 16:04:47 +00:00
|
|
|
gst_object_unref (el_pad);
|
|
|
|
GST_DEBUG_OBJECT (sink,
|
|
|
|
"Checking caps: %" GST_PTR_FORMAT " vs. %" GST_PTR_FORMAT,
|
|
|
|
sink->filter_caps, el_caps);
|
2010-05-06 12:38:35 +00:00
|
|
|
no_match = !gst_caps_can_intersect (sink->filter_caps, el_caps);
|
2007-12-05 16:04:47 +00:00
|
|
|
gst_caps_unref (el_caps);
|
|
|
|
|
|
|
|
if (no_match) {
|
|
|
|
GST_DEBUG_OBJECT (sink, "Incompatible caps");
|
|
|
|
gst_object_unref (el);
|
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (sink, "Found compatible caps");
|
|
|
|
}
|
|
|
|
}
|
2005-10-04 17:58:40 +00:00
|
|
|
|
2007-12-05 16:04:47 +00:00
|
|
|
gst_element_set_bus (el, bus);
|
2005-10-04 17:58:40 +00:00
|
|
|
ret = gst_element_set_state (el, GST_STATE_READY);
|
|
|
|
if (ret == GST_STATE_CHANGE_SUCCESS) {
|
2007-12-05 16:04:47 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "This worked!");
|
2005-11-22 14:44:26 +00:00
|
|
|
choice = el;
|
2007-12-05 16:04:47 +00:00
|
|
|
break;
|
2005-07-20 09:40:32 +00:00
|
|
|
}
|
|
|
|
|
2007-12-05 16:04:47 +00:00
|
|
|
/* collect all error messages */
|
|
|
|
while ((message = gst_bus_pop_filtered (bus, GST_MESSAGE_ERROR))) {
|
|
|
|
GST_DEBUG_OBJECT (sink, "error message %" GST_PTR_FORMAT, message);
|
|
|
|
errors = g_slist_append (errors, message);
|
|
|
|
}
|
2005-10-04 17:58:40 +00:00
|
|
|
|
2007-12-05 16:04:47 +00:00
|
|
|
gst_element_set_state (el, GST_STATE_NULL);
|
2005-11-22 14:44:26 +00:00
|
|
|
gst_object_unref (el);
|
2005-07-20 09:40:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-05 16:04:47 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "done trying");
|
|
|
|
if (!choice) {
|
|
|
|
if (errors) {
|
|
|
|
/* FIXME: we forward the first error for now; but later on it might make
|
|
|
|
* sense to actually analyse them */
|
|
|
|
gst_message_ref (GST_MESSAGE (errors->data));
|
|
|
|
GST_DEBUG_OBJECT (sink, "reposting message %p", errors->data);
|
|
|
|
gst_element_post_message (GST_ELEMENT (sink), GST_MESSAGE (errors->data));
|
|
|
|
} else {
|
|
|
|
/* send warning message to application and use a fakesink */
|
|
|
|
GST_ELEMENT_WARNING (sink, RESOURCE, NOT_FOUND, (NULL),
|
|
|
|
("Failed to find a usable video sink"));
|
|
|
|
choice = gst_element_factory_make ("fakesink", "fake-video-sink");
|
|
|
|
if (g_object_class_find_property (G_OBJECT_GET_CLASS (choice), "sync"))
|
|
|
|
g_object_set (choice, "sync", TRUE, NULL);
|
|
|
|
gst_element_set_state (choice, GST_STATE_READY);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gst_object_unref (bus);
|
2005-11-22 14:44:26 +00:00
|
|
|
gst_plugin_feature_list_free (list);
|
2007-12-05 16:04:47 +00:00
|
|
|
g_slist_foreach (errors, (GFunc) gst_mini_object_unref, NULL);
|
|
|
|
g_slist_free (errors);
|
2005-11-22 14:44:26 +00:00
|
|
|
|
|
|
|
return choice;
|
2005-07-20 09:40:32 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
static gboolean
|
|
|
|
gst_auto_video_sink_detect (GstAutoVideoSink * sink)
|
2005-07-20 09:40:32 +00:00
|
|
|
{
|
|
|
|
GstElement *esink;
|
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
|
|
|
GstPad *targetpad;
|
2005-07-20 09:40:32 +00:00
|
|
|
|
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
|
|
|
gst_auto_video_sink_clear_kid (sink);
|
2005-07-20 09:40:32 +00:00
|
|
|
|
|
|
|
/* find element */
|
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
|
|
|
GST_DEBUG_OBJECT (sink, "Creating new kid");
|
2006-09-25 13:55:44 +00:00
|
|
|
if (!(esink = gst_auto_video_sink_find_best (sink)))
|
|
|
|
goto no_sink;
|
2005-11-22 14:44:26 +00:00
|
|
|
|
2012-07-10 12:38:21 +00:00
|
|
|
g_object_set (G_OBJECT (esink), "ts-offset", sink->ts_offset, NULL);
|
2013-08-28 08:51:32 +00:00
|
|
|
g_object_set (G_OBJECT (esink), "sync", sink->sync, NULL);
|
2012-07-10 12:38:21 +00:00
|
|
|
|
2005-07-20 09:40:32 +00:00
|
|
|
sink->kid = esink;
|
|
|
|
gst_bin_add (GST_BIN (sink), esink);
|
|
|
|
|
|
|
|
/* attach ghost pad */
|
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
|
|
|
GST_DEBUG_OBJECT (sink, "Re-assigning ghostpad");
|
Don't use gst_element_get_pad(), it's a bad method.
Original commit message from CVS:
* ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_reset),
(do_toggle_element):
* ext/gconf/gstgconfvideosink.c: (gst_gconf_video_sink_reset),
(do_toggle_element):
* ext/gconf/gstgconfvideosrc.c: (gst_gconf_video_src_reset),
(do_toggle_element):
* ext/gconf/gstswitchsink.c: (gst_switch_commit_new_kid):
* ext/hal/gsthalaudiosink.c: (gst_hal_audio_sink_reset),
(do_toggle_element):
* ext/hal/gsthalaudiosrc.c: (gst_hal_audio_src_reset),
(do_toggle_element):
* gst/autodetect/gstautoaudiosink.c: (gst_auto_audio_sink_reset),
(gst_auto_audio_sink_detect):
* gst/autodetect/gstautovideosink.c: (gst_auto_video_sink_reset),
(gst_auto_video_sink_detect):
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_init),
(gst_rtspsrc_stream_free), (gst_rtspsrc_stream_configure_udp),
(gst_rtspsrc_stream_configure_udp_sink), (gst_rtspsrc_skip_lws),
(gst_rtspsrc_unskip_lws), (gst_rtspsrc_skip_commas),
(gst_rtspsrc_skip_item), (gst_rtsp_decode_quoted_string),
(gst_rtspsrc_parse_digest_challenge), (gst_rtspsrc_parse_auth_hdr):
* tests/icles/videocrop-test.c: (test_with_caps),
(video_crop_get_test_caps):
Don't use gst_element_get_pad(), it's a bad method.
2008-05-21 17:39:38 +00:00
|
|
|
targetpad = gst_element_get_static_pad (sink->kid, "sink");
|
2008-11-25 16:26:16 +00:00
|
|
|
if (!gst_ghost_pad_set_target (GST_GHOST_PAD (sink->pad), targetpad))
|
|
|
|
goto target_failed;
|
|
|
|
|
Port auto/gconfsinks to 0.9. They actually appear to work here in
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/gconf/Makefile.am:
* ext/gconf/gconf.c: (gst_bin_find_unconnected_pad),
(gst_gconf_render_bin_from_description),
(gst_gconf_get_default_video_sink):
* ext/gconf/gstgconfaudiosink.c: (gst_gconf_audio_sink_base_init),
(gst_gconf_audio_sink_class_init), (gst_gconf_audio_sink_dispose),
(cb_toggle_element), (gst_gconf_audio_sink_change_state):
* ext/gconf/gstgconfelements.h:
* ext/gconf/gstgconfvideosink.c: (gst_gconf_video_sink_base_init),
(gst_gconf_video_sink_class_init), (gst_gconf_video_sink_dispose),
(cb_toggle_element), (gst_gconf_video_sink_change_state):
* gst/autodetect/gstautoaudiosink.c:
(gst_auto_audio_sink_base_init), (gst_auto_audio_sink_class_init),
(gst_auto_audio_sink_detect), (gst_auto_audio_sink_change_state):
* gst/autodetect/gstautovideosink.c:
(gst_auto_video_sink_base_init), (gst_auto_video_sink_class_init),
(gst_auto_video_sink_find_best), (gst_auto_video_sink_detect):
Port auto/gconfsinks to 0.9. They actually appear to work here in
Totem as well, making them actually useful.
2005-07-20 10:07:10 +00:00
|
|
|
gst_object_unref (targetpad);
|
2005-07-20 09:40:32 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "done changing auto video 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
|
|
|
|
|
|
|
return TRUE;
|
2006-09-25 13:55:44 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
no_sink:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (sink, LIBRARY, INIT, (NULL),
|
|
|
|
("Failed to find a supported video sink"));
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-11-25 16:26:16 +00:00
|
|
|
target_failed:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (sink, LIBRARY, INIT, (NULL),
|
|
|
|
("Failed to set target pad"));
|
|
|
|
gst_object_unref (targetpad);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-07-20 09:40:32 +00:00
|
|
|
}
|
|
|
|
|
2005-09-02 15:44:50 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_auto_video_sink_change_state (GstElement * element,
|
|
|
|
GstStateChange transition)
|
2005-07-20 09:40:32 +00:00
|
|
|
{
|
2005-11-01 12:39:16 +00:00
|
|
|
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
2005-07-20 09:40:32 +00:00
|
|
|
GstAutoVideoSink *sink = GST_AUTO_VIDEO_SINK (element);
|
|
|
|
|
2005-09-02 15:44:50 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
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
|
|
|
if (!gst_auto_video_sink_detect (sink))
|
2005-09-02 15:44:50 +00:00
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
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
|
|
|
break;
|
2005-11-01 12:39:16 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
|
|
|
|
|
|
switch (transition) {
|
2005-09-02 15:44:50 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
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
|
|
|
gst_auto_video_sink_reset (sink);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2005-07-20 09:40:32 +00:00
|
|
|
}
|
|
|
|
|
2005-11-01 12:39:16 +00:00
|
|
|
return ret;
|
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);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_CAPS:
|
|
|
|
if (sink->filter_caps)
|
|
|
|
gst_caps_unref (sink->filter_caps);
|
|
|
|
sink->filter_caps = gst_caps_copy (gst_value_get_caps (value));
|
|
|
|
break;
|
2012-07-10 12:38:21 +00:00
|
|
|
case PROP_TS_OFFSET:
|
|
|
|
sink->ts_offset = g_value_get_int64 (value);
|
|
|
|
if (sink->kid)
|
|
|
|
g_object_set_property (G_OBJECT (sink->kid), pspec->name, value);
|
|
|
|
break;
|
2013-08-28 08:51:32 +00:00
|
|
|
case PROP_SYNC:
|
|
|
|
sink->sync = g_value_get_boolean (value);
|
|
|
|
if (sink->kid)
|
|
|
|
g_object_set_property (G_OBJECT (sink->kid), pspec->name, value);
|
|
|
|
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) {
|
|
|
|
case PROP_CAPS:{
|
|
|
|
gst_value_set_caps (value, sink->filter_caps);
|
|
|
|
break;
|
|
|
|
}
|
2012-07-10 12:38:21 +00:00
|
|
|
case PROP_TS_OFFSET:
|
|
|
|
g_value_set_int64 (value, sink->ts_offset);
|
|
|
|
break;
|
2013-08-28 08:51:32 +00:00
|
|
|
case PROP_SYNC:
|
|
|
|
g_value_set_boolean (value, sink->sync);
|
|
|
|
break;
|
2007-12-05 16:04:47 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|