2000-12-29 05:38:06 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
2005-03-28 14:54:33 +00:00
|
|
|
* 2005 Wim Taymans <wim@fluendo.com>
|
2000-12-29 05:38:06 +00:00
|
|
|
*
|
2005-10-15 15:30:24 +00:00
|
|
|
* gstfakesink.c:
|
2000-01-30 09:03:00 +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
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
2005-08-05 13:42:10 +00:00
|
|
|
/**
|
2005-12-01 12:29:34 +00:00
|
|
|
* SECTION:element-fakesink
|
2005-08-05 13:42:10 +00:00
|
|
|
* @see_also: #GstFakeSrc
|
|
|
|
*
|
|
|
|
* Dummy sink that swallows everything.
|
2010-08-16 15:01:27 +00:00
|
|
|
*
|
|
|
|
* <refsect2>
|
|
|
|
* <title>Example launch line</title>
|
|
|
|
* |[
|
|
|
|
* gst-launch audiotestsrc num-buffers=1000 ! fakesink sync=false
|
|
|
|
* ]| Render 1000 audio buffers (of default size) as fast as possible.
|
|
|
|
* </refsect2>
|
2005-08-05 13:42:10 +00:00
|
|
|
*/
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
#include "gstfakesink.h"
|
2004-02-03 03:31:26 +00:00
|
|
|
#include <gst/gstmarshal.h>
|
2003-06-29 14:05:49 +00:00
|
|
|
|
gst/: s/gst_pad_new/&_from_template/ register pad templates in the base_init function add static pad template definit...
Original commit message from CVS:
* gst/autoplug/gstspideridentity.c:
(gst_spider_identity_request_new_pad):
* gst/elements/gstaggregator.c: (gst_aggregator_base_init),
(gst_aggregator_init):
* gst/elements/gstfakesink.c: (gst_fakesink_base_init),
(gst_fakesink_init):
* gst/elements/gstfakesrc.c: (gst_fakesrc_base_init),
(gst_fakesrc_init):
* gst/elements/gstfdsink.c: (gst_fdsink_base_init),
(gst_fdsink_init):
* gst/elements/gstfdsrc.c: (gst_fdsrc_base_init), (gst_fdsrc_init):
* gst/elements/gstfilesink.c: (gst_filesink_base_init),
(gst_filesink_init):
* gst/elements/gstfilesrc.c: (gst_filesrc_base_init),
(gst_filesrc_init):
* gst/elements/gstidentity.c: (gst_identity_base_init),
(gst_identity_init):
* gst/elements/gstmultifilesrc.c: (gst_multifilesrc_base_init),
(gst_multifilesrc_init):
* gst/elements/gstpipefilter.c: (gst_pipefilter_base_init),
(gst_pipefilter_init):
* gst/elements/gststatistics.c: (gst_statistics_base_init),
(gst_statistics_init):
* gst/elements/gsttee.c: (gst_tee_base_init), (gst_tee_init):
* gst/gstqueue.c: (gst_queue_base_init), (gst_queue_init):
s/gst_pad_new/&_from_template/
register pad templates in the base_init function
add static pad template definitions
2004-08-17 14:11:23 +00:00
|
|
|
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
2005-07-14 09:35:12 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_fake_sink_debug);
|
|
|
|
#define GST_CAT_DEFAULT gst_fake_sink_debug
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
/* FakeSink signals and args */
|
2004-03-13 15:27:01 +00:00
|
|
|
enum
|
|
|
|
{
|
2000-01-30 09:03:00 +00:00
|
|
|
/* FILL ME */
|
2000-12-22 16:14:33 +00:00
|
|
|
SIGNAL_HANDOFF,
|
2006-05-23 14:23:49 +00:00
|
|
|
SIGNAL_PREROLL_HANDOFF,
|
2000-01-30 09:03:00 +00:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2005-09-20 17:38:51 +00:00
|
|
|
#define DEFAULT_SYNC FALSE
|
|
|
|
|
2005-07-14 09:35:12 +00:00
|
|
|
#define DEFAULT_STATE_ERROR FAKE_SINK_STATE_ERROR_NONE
|
2005-03-28 14:54:33 +00:00
|
|
|
#define DEFAULT_SILENT FALSE
|
|
|
|
#define DEFAULT_DUMP FALSE
|
|
|
|
#define DEFAULT_SIGNAL_HANDOFFS FALSE
|
|
|
|
#define DEFAULT_LAST_MESSAGE NULL
|
2005-08-26 14:21:43 +00:00
|
|
|
#define DEFAULT_CAN_ACTIVATE_PUSH TRUE
|
|
|
|
#define DEFAULT_CAN_ACTIVATE_PULL FALSE
|
2007-04-05 11:16:09 +00:00
|
|
|
#define DEFAULT_NUM_BUFFERS -1
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
enum
|
|
|
|
{
|
2005-08-26 14:21:43 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_STATE_ERROR,
|
|
|
|
PROP_SILENT,
|
|
|
|
PROP_DUMP,
|
|
|
|
PROP_SIGNAL_HANDOFFS,
|
|
|
|
PROP_LAST_MESSAGE,
|
|
|
|
PROP_CAN_ACTIVATE_PUSH,
|
2007-04-05 11:16:09 +00:00
|
|
|
PROP_CAN_ACTIVATE_PULL,
|
|
|
|
PROP_NUM_BUFFERS
|
2000-01-30 09:03:00 +00:00
|
|
|
};
|
|
|
|
|
2005-07-14 09:35:12 +00:00
|
|
|
#define GST_TYPE_FAKE_SINK_STATE_ERROR (gst_fake_sink_state_error_get_type())
|
2003-06-03 20:22:52 +00:00
|
|
|
static GType
|
2005-07-14 09:35:12 +00:00
|
|
|
gst_fake_sink_state_error_get_type (void)
|
2003-06-03 20:22:52 +00:00
|
|
|
{
|
|
|
|
static GType fakesink_state_error_type = 0;
|
2006-05-09 17:58:35 +00:00
|
|
|
static const GEnumValue fakesink_state_error[] = {
|
2005-11-22 15:52:03 +00:00
|
|
|
{FAKE_SINK_STATE_ERROR_NONE, "No state change errors", "none"},
|
|
|
|
{FAKE_SINK_STATE_ERROR_NULL_READY,
|
|
|
|
"Fail state change from NULL to READY", "null-to-ready"},
|
|
|
|
{FAKE_SINK_STATE_ERROR_READY_PAUSED,
|
|
|
|
"Fail state change from READY to PAUSED", "ready-to-paused"},
|
|
|
|
{FAKE_SINK_STATE_ERROR_PAUSED_PLAYING,
|
|
|
|
"Fail state change from PAUSED to PLAYING", "paused-to-playing"},
|
|
|
|
{FAKE_SINK_STATE_ERROR_PLAYING_PAUSED,
|
|
|
|
"Fail state change from PLAYING to PAUSED", "playing-to-paused"},
|
|
|
|
{FAKE_SINK_STATE_ERROR_PAUSED_READY,
|
|
|
|
"Fail state change from PAUSED to READY", "paused-to-ready"},
|
|
|
|
{FAKE_SINK_STATE_ERROR_READY_NULL,
|
|
|
|
"Fail state change from READY to NULL", "ready-to-null"},
|
2003-06-03 20:22:52 +00:00
|
|
|
{0, NULL, NULL},
|
|
|
|
};
|
2004-03-15 19:27:17 +00:00
|
|
|
|
2003-06-03 20:22:52 +00:00
|
|
|
if (!fakesink_state_error_type) {
|
2004-03-13 15:27:01 +00:00
|
|
|
fakesink_state_error_type =
|
2004-03-15 19:27:17 +00:00
|
|
|
g_enum_register_static ("GstFakeSinkStateError", fakesink_state_error);
|
2003-06-03 20:22:52 +00:00
|
|
|
}
|
|
|
|
return fakesink_state_error_type;
|
|
|
|
}
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2004-01-08 04:10:18 +00:00
|
|
|
#define _do_init(bla) \
|
2005-07-14 09:35:12 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_fake_sink_debug, "fakesink", 0, "fakesink element");
|
2004-01-08 04:10:18 +00:00
|
|
|
|
2005-07-14 09:35:12 +00:00
|
|
|
GST_BOILERPLATE_FULL (GstFakeSink, gst_fake_sink, GstBaseSink,
|
2005-07-10 12:03:13 +00:00
|
|
|
GST_TYPE_BASE_SINK, _do_init);
|
2001-01-04 10:54:27 +00:00
|
|
|
|
2005-07-14 09:35:12 +00:00
|
|
|
static void gst_fake_sink_set_property (GObject * object, guint prop_id,
|
2004-03-13 15:27:01 +00:00
|
|
|
const GValue * value, GParamSpec * pspec);
|
2005-07-14 09:35:12 +00:00
|
|
|
static void gst_fake_sink_get_property (GObject * object, guint prop_id,
|
2004-03-13 15:27:01 +00:00
|
|
|
GValue * value, GParamSpec * pspec);
|
2009-05-30 19:36:25 +00:00
|
|
|
static void gst_fake_sink_finalize (GObject * obj);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2005-09-02 15:42:00 +00:00
|
|
|
static GstStateChangeReturn gst_fake_sink_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2003-06-03 20:22:52 +00:00
|
|
|
|
2005-07-14 09:35:12 +00:00
|
|
|
static GstFlowReturn gst_fake_sink_preroll (GstBaseSink * bsink,
|
2005-03-28 14:54:33 +00:00
|
|
|
GstBuffer * buffer);
|
2005-07-14 09:35:12 +00:00
|
|
|
static GstFlowReturn gst_fake_sink_render (GstBaseSink * bsink,
|
2005-03-28 14:54:33 +00:00
|
|
|
GstBuffer * buffer);
|
2005-07-14 09:35:12 +00:00
|
|
|
static gboolean gst_fake_sink_event (GstBaseSink * bsink, GstEvent * event);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2005-07-14 09:35:12 +00:00
|
|
|
static guint gst_fake_sink_signals[LAST_SIGNAL] = { 0 };
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2008-05-13 12:54:00 +00:00
|
|
|
static void
|
|
|
|
marshal_VOID__MINIOBJECT_OBJECT (GClosure * closure, GValue * return_value,
|
|
|
|
guint n_param_values, const GValue * param_values, gpointer invocation_hint,
|
|
|
|
gpointer marshal_data)
|
|
|
|
{
|
|
|
|
typedef void (*marshalfunc_VOID__MINIOBJECT_OBJECT) (gpointer obj,
|
|
|
|
gpointer arg1, gpointer arg2, gpointer data2);
|
|
|
|
register marshalfunc_VOID__MINIOBJECT_OBJECT callback;
|
|
|
|
register GCClosure *cc = (GCClosure *) closure;
|
|
|
|
register gpointer data1, data2;
|
|
|
|
|
|
|
|
g_return_if_fail (n_param_values == 3);
|
|
|
|
|
|
|
|
if (G_CCLOSURE_SWAP_DATA (closure)) {
|
|
|
|
data1 = closure->data;
|
|
|
|
data2 = g_value_peek_pointer (param_values + 0);
|
|
|
|
} else {
|
|
|
|
data1 = g_value_peek_pointer (param_values + 0);
|
|
|
|
data2 = closure->data;
|
|
|
|
}
|
|
|
|
callback =
|
2009-05-02 10:59:54 +00:00
|
|
|
(marshalfunc_VOID__MINIOBJECT_OBJECT) (marshal_data ? marshal_data :
|
|
|
|
cc->callback);
|
2008-05-13 12:54:00 +00:00
|
|
|
|
|
|
|
callback (data1, gst_value_get_mini_object (param_values + 1),
|
|
|
|
g_value_get_object (param_values + 2), data2);
|
|
|
|
}
|
|
|
|
|
2003-10-31 19:32:47 +00:00
|
|
|
static void
|
2005-07-14 09:35:12 +00:00
|
|
|
gst_fake_sink_base_init (gpointer g_class)
|
2003-10-31 19:32:47 +00:00
|
|
|
{
|
Revert previous changes to the behaviour of GstPadTemplates, etc and the possiblity to call them in class_init as it ...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_get_type), (gst_bin_base_init),
(gst_bin_class_init):
* gst/gstelement.c: (gst_element_base_class_init),
(gst_element_class_add_pad_template):
* gst/gstpadtemplate.c: (gst_pad_template_init):
* gst/gstpipeline.c: (gst_pipeline_get_type),
(gst_pipeline_base_init), (gst_pipeline_class_init):
* libs/gst/base/gstbasesink.c:
* libs/gst/base/gstbasesrc.c: (gst_base_src_get_type),
(gst_base_src_base_init), (gst_base_src_class_init):
* plugins/elements/gstcapsfilter.c: (gst_capsfilter_base_init),
(gst_capsfilter_class_init):
* plugins/elements/gstfakesink.c: (gst_fake_sink_base_init),
(gst_fake_sink_class_init):
* plugins/elements/gstfakesrc.c: (gst_fake_src_base_init),
(gst_fake_src_class_init):
* plugins/elements/gstfdsink.c: (gst_fd_sink_base_init),
(gst_fd_sink_class_init):
* plugins/elements/gstfdsrc.c: (gst_fd_src_base_init),
(gst_fd_src_class_init):
* plugins/elements/gstfilesink.c: (gst_file_sink_base_init),
(gst_file_sink_class_init):
* plugins/elements/gstfilesrc.c: (gst_file_src_base_init),
(gst_file_src_class_init):
* plugins/elements/gstidentity.c: (gst_identity_base_init),
(gst_identity_class_init):
* plugins/elements/gstmultiqueue.c: (gst_multi_queue_base_init),
(gst_multi_queue_class_init):
* plugins/elements/gstqueue.c: (gst_queue_base_init),
(gst_queue_class_init):
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_class_init):
* plugins/elements/gsttypefindelement.c:
(gst_type_find_element_base_init),
(gst_type_find_element_class_init):
* tests/check/gst/gstelement.c: (gst_element_suite):
Revert previous changes to the behaviour of GstPadTemplates, etc
and the possiblity to call them in class_init as it breaks too
many elements. Reopens bug #491501.
Should be applied again for 0.11, thus added a few FIXME 0.11 at
several places.
2008-02-05 14:15:15 +00:00
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
|
|
|
|
|
|
|
|
gst_element_class_set_details_simple (gstelement_class,
|
|
|
|
"Fake Sink",
|
|
|
|
"Sink",
|
|
|
|
"Black hole for data",
|
|
|
|
"Erik Walthinsen <omega@cse.ogi.edu>, "
|
|
|
|
"Wim Taymans <wim@fluendo.com>, "
|
|
|
|
"Mr. 'frag-me-more' Vanderwingo <wingo@fluendo.com>");
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&sinktemplate));
|
2003-10-31 19:32:47 +00:00
|
|
|
}
|
2003-12-22 01:39:35 +00:00
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
static void
|
2005-07-14 09:35:12 +00:00
|
|
|
gst_fake_sink_class_init (GstFakeSinkClass * klass)
|
2000-11-25 14:18:47 +00:00
|
|
|
{
|
2001-06-25 01:20:11 +00:00
|
|
|
GObjectClass *gobject_class;
|
2001-07-11 16:45:43 +00:00
|
|
|
GstElementClass *gstelement_class;
|
2005-06-28 12:45:21 +00:00
|
|
|
GstBaseSinkClass *gstbase_sink_class;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2006-05-11 18:10:34 +00:00
|
|
|
gobject_class = G_OBJECT_CLASS (klass);
|
|
|
|
gstelement_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
gstbase_sink_class = GST_BASE_SINK_CLASS (klass);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2009-10-28 00:29:30 +00:00
|
|
|
gobject_class->set_property = gst_fake_sink_set_property;
|
|
|
|
gobject_class->get_property = gst_fake_sink_get_property;
|
2009-05-30 19:36:25 +00:00
|
|
|
gobject_class->finalize = gst_fake_sink_finalize;
|
2001-01-04 10:54:27 +00:00
|
|
|
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_STATE_ERROR,
|
2008-03-22 14:56:17 +00:00
|
|
|
g_param_spec_enum ("state-error", "State Error",
|
2005-07-14 09:35:12 +00:00
|
|
|
"Generate a state change error", GST_TYPE_FAKE_SINK_STATE_ERROR,
|
2008-03-22 14:56:17 +00:00
|
|
|
DEFAULT_STATE_ERROR, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_LAST_MESSAGE,
|
2008-03-22 14:56:17 +00:00
|
|
|
g_param_spec_string ("last-message", "Last Message",
|
2005-03-28 14:54:33 +00:00
|
|
|
"The message describing current status", DEFAULT_LAST_MESSAGE,
|
2008-03-22 14:56:17 +00:00
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_SIGNAL_HANDOFFS,
|
2004-03-13 15:27:01 +00:00
|
|
|
g_param_spec_boolean ("signal-handoffs", "Signal handoffs",
|
2005-03-28 14:54:33 +00:00
|
|
|
"Send a signal before unreffing the buffer", DEFAULT_SIGNAL_HANDOFFS,
|
2008-03-22 14:56:17 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_SILENT,
|
2004-03-13 15:27:01 +00:00
|
|
|
g_param_spec_boolean ("silent", "Silent",
|
2005-03-28 14:54:33 +00:00
|
|
|
"Don't produce last_message events", DEFAULT_SILENT,
|
2008-03-22 14:56:17 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_DUMP,
|
2006-09-29 08:22:22 +00:00
|
|
|
g_param_spec_boolean ("dump", "Dump", "Dump buffer contents to stdout",
|
2008-03-22 14:56:17 +00:00
|
|
|
DEFAULT_DUMP, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
2005-08-26 14:21:43 +00:00
|
|
|
PROP_CAN_ACTIVATE_PUSH,
|
|
|
|
g_param_spec_boolean ("can-activate-push", "Can activate push",
|
|
|
|
"Can activate in push mode", DEFAULT_CAN_ACTIVATE_PUSH,
|
2008-03-22 14:56:17 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
2005-08-26 14:21:43 +00:00
|
|
|
PROP_CAN_ACTIVATE_PULL,
|
|
|
|
g_param_spec_boolean ("can-activate-pull", "Can activate pull",
|
|
|
|
"Can activate in pull mode", DEFAULT_CAN_ACTIVATE_PULL,
|
2008-03-22 14:56:17 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2007-04-05 11:16:09 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_NUM_BUFFERS,
|
|
|
|
g_param_spec_int ("num-buffers", "num-buffers",
|
|
|
|
"Number of buffers to accept going EOS", -1, G_MAXINT,
|
2008-03-22 14:56:17 +00:00
|
|
|
DEFAULT_NUM_BUFFERS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2001-01-04 10:54:27 +00:00
|
|
|
|
2005-08-15 16:57:34 +00:00
|
|
|
/**
|
|
|
|
* GstFakeSink::handoff:
|
|
|
|
* @fakesink: the fakesink instance
|
|
|
|
* @buffer: the buffer that just has been received
|
|
|
|
* @pad: the pad that received it
|
|
|
|
*
|
|
|
|
* This signal gets emitted before unreffing the buffer.
|
|
|
|
*/
|
2005-07-14 09:35:12 +00:00
|
|
|
gst_fake_sink_signals[SIGNAL_HANDOFF] =
|
2004-03-13 15:27:01 +00:00
|
|
|
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GstFakeSinkClass, handoff), NULL, NULL,
|
2008-05-13 12:54:00 +00:00
|
|
|
marshal_VOID__MINIOBJECT_OBJECT, G_TYPE_NONE, 2,
|
2005-05-27 09:27:35 +00:00
|
|
|
GST_TYPE_BUFFER, GST_TYPE_PAD);
|
2000-12-22 16:14:33 +00:00
|
|
|
|
2006-05-23 14:23:49 +00:00
|
|
|
/**
|
|
|
|
* GstFakeSink::preroll-handoff:
|
|
|
|
* @fakesink: the fakesink instance
|
|
|
|
* @buffer: the buffer that just has been received
|
|
|
|
* @pad: the pad that received it
|
|
|
|
*
|
|
|
|
* This signal gets emitted before unreffing the buffer.
|
|
|
|
*
|
|
|
|
* Since: 0.10.7
|
|
|
|
*/
|
|
|
|
gst_fake_sink_signals[SIGNAL_PREROLL_HANDOFF] =
|
|
|
|
g_signal_new ("preroll-handoff", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstFakeSinkClass, preroll_handoff),
|
2008-05-13 12:54:00 +00:00
|
|
|
NULL, NULL, marshal_VOID__MINIOBJECT_OBJECT, G_TYPE_NONE, 2,
|
2006-05-23 14:23:49 +00:00
|
|
|
GST_TYPE_BUFFER, GST_TYPE_PAD);
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
gstelement_class->change_state =
|
2005-07-14 09:35:12 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_fake_sink_change_state);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2005-07-14 09:35:12 +00:00
|
|
|
gstbase_sink_class->event = GST_DEBUG_FUNCPTR (gst_fake_sink_event);
|
|
|
|
gstbase_sink_class->preroll = GST_DEBUG_FUNCPTR (gst_fake_sink_preroll);
|
|
|
|
gstbase_sink_class->render = GST_DEBUG_FUNCPTR (gst_fake_sink_render);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void
|
2005-08-28 17:45:58 +00:00
|
|
|
gst_fake_sink_init (GstFakeSink * fakesink, GstFakeSinkClass * g_class)
|
2000-11-25 14:18:47 +00:00
|
|
|
{
|
2005-03-28 14:54:33 +00:00
|
|
|
fakesink->silent = DEFAULT_SILENT;
|
|
|
|
fakesink->dump = DEFAULT_DUMP;
|
2005-09-02 23:17:26 +00:00
|
|
|
fakesink->last_message = g_strdup (DEFAULT_LAST_MESSAGE);
|
2005-03-28 14:54:33 +00:00
|
|
|
fakesink->state_error = DEFAULT_STATE_ERROR;
|
|
|
|
fakesink->signal_handoffs = DEFAULT_SIGNAL_HANDOFFS;
|
2007-04-05 11:16:09 +00:00
|
|
|
fakesink->num_buffers = DEFAULT_NUM_BUFFERS;
|
2009-05-30 19:36:25 +00:00
|
|
|
g_static_rec_mutex_init (&fakesink->notify_lock);
|
2010-06-14 14:51:39 +00:00
|
|
|
|
|
|
|
gst_base_sink_set_sync (GST_BASE_SINK (fakesink), DEFAULT_SYNC);
|
2009-05-30 19:36:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_fake_sink_finalize (GObject * obj)
|
|
|
|
{
|
|
|
|
GstFakeSink *sink = GST_FAKE_SINK (obj);
|
|
|
|
|
|
|
|
g_static_rec_mutex_free (&sink->notify_lock);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (obj);
|
2001-07-11 16:45:43 +00:00
|
|
|
}
|
|
|
|
|
2001-01-04 10:54:27 +00:00
|
|
|
static void
|
2005-07-14 09:35:12 +00:00
|
|
|
gst_fake_sink_set_property (GObject * object, guint prop_id,
|
2004-03-13 15:27:01 +00:00
|
|
|
const GValue * value, GParamSpec * pspec)
|
2001-01-04 10:54:27 +00:00
|
|
|
{
|
|
|
|
GstFakeSink *sink;
|
|
|
|
|
2005-07-14 09:35:12 +00:00
|
|
|
sink = GST_FAKE_SINK (object);
|
2001-01-04 10:54:27 +00:00
|
|
|
|
2001-06-25 01:20:11 +00:00
|
|
|
switch (prop_id) {
|
2005-08-26 14:21:43 +00:00
|
|
|
case PROP_STATE_ERROR:
|
2003-06-03 20:22:52 +00:00
|
|
|
sink->state_error = g_value_get_enum (value);
|
|
|
|
break;
|
2010-08-27 08:11:00 +00:00
|
|
|
case PROP_SILENT:
|
|
|
|
sink->silent = g_value_get_boolean (value);
|
|
|
|
break;
|
2005-08-26 14:21:43 +00:00
|
|
|
case PROP_DUMP:
|
2001-10-17 10:21:27 +00:00
|
|
|
sink->dump = g_value_get_boolean (value);
|
|
|
|
break;
|
2005-08-26 14:21:43 +00:00
|
|
|
case PROP_SIGNAL_HANDOFFS:
|
2003-08-07 12:45:31 +00:00
|
|
|
sink->signal_handoffs = g_value_get_boolean (value);
|
|
|
|
break;
|
2005-08-26 14:21:43 +00:00
|
|
|
case PROP_CAN_ACTIVATE_PUSH:
|
|
|
|
GST_BASE_SINK (sink)->can_activate_push = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case PROP_CAN_ACTIVATE_PULL:
|
|
|
|
GST_BASE_SINK (sink)->can_activate_pull = g_value_get_boolean (value);
|
|
|
|
break;
|
2007-04-05 11:16:09 +00:00
|
|
|
case PROP_NUM_BUFFERS:
|
|
|
|
sink->num_buffers = g_value_get_int (value);
|
|
|
|
break;
|
2001-01-04 10:54:27 +00:00
|
|
|
default:
|
2004-04-20 16:25:41 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
2001-01-04 10:54:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void
|
2005-07-14 09:35:12 +00:00
|
|
|
gst_fake_sink_get_property (GObject * object, guint prop_id, GValue * value,
|
2004-03-13 15:27:01 +00:00
|
|
|
GParamSpec * pspec)
|
2001-01-04 10:54:27 +00:00
|
|
|
{
|
|
|
|
GstFakeSink *sink;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2005-07-14 09:35:12 +00:00
|
|
|
sink = GST_FAKE_SINK (object);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-06-25 01:20:11 +00:00
|
|
|
switch (prop_id) {
|
2005-08-26 14:21:43 +00:00
|
|
|
case PROP_STATE_ERROR:
|
2003-06-03 20:22:52 +00:00
|
|
|
g_value_set_enum (value, sink->state_error);
|
|
|
|
break;
|
2005-08-26 14:21:43 +00:00
|
|
|
case PROP_SILENT:
|
2001-06-25 01:20:11 +00:00
|
|
|
g_value_set_boolean (value, sink->silent);
|
2001-04-16 16:45:53 +00:00
|
|
|
break;
|
2005-08-26 14:21:43 +00:00
|
|
|
case PROP_DUMP:
|
2001-10-17 10:21:27 +00:00
|
|
|
g_value_set_boolean (value, sink->dump);
|
|
|
|
break;
|
2005-08-26 14:21:43 +00:00
|
|
|
case PROP_SIGNAL_HANDOFFS:
|
2003-08-07 12:45:31 +00:00
|
|
|
g_value_set_boolean (value, sink->signal_handoffs);
|
|
|
|
break;
|
2005-08-26 14:21:43 +00:00
|
|
|
case PROP_LAST_MESSAGE:
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (sink);
|
2002-02-06 21:57:35 +00:00
|
|
|
g_value_set_string (value, sink->last_message);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (sink);
|
2002-02-06 21:57:35 +00:00
|
|
|
break;
|
2005-08-26 14:21:43 +00:00
|
|
|
case PROP_CAN_ACTIVATE_PUSH:
|
|
|
|
g_value_set_boolean (value, GST_BASE_SINK (sink)->can_activate_push);
|
|
|
|
break;
|
|
|
|
case PROP_CAN_ACTIVATE_PULL:
|
|
|
|
g_value_set_boolean (value, GST_BASE_SINK (sink)->can_activate_pull);
|
|
|
|
break;
|
2007-04-05 11:16:09 +00:00
|
|
|
case PROP_NUM_BUFFERS:
|
|
|
|
g_value_set_int (value, sink->num_buffers);
|
|
|
|
break;
|
2001-01-04 10:54:27 +00:00
|
|
|
default:
|
2001-06-25 01:20:11 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
2001-01-04 10:54:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-30 19:36:25 +00:00
|
|
|
static void
|
|
|
|
gst_fake_sink_notify_last_message (GstFakeSink * sink)
|
|
|
|
{
|
|
|
|
/* FIXME: this hacks around a bug in GLib/GObject: doing concurrent
|
|
|
|
* g_object_notify() on the same object might lead to crashes, see
|
|
|
|
* http://bugzilla.gnome.org/show_bug.cgi?id=166020#c60 and follow-ups.
|
|
|
|
* So we really don't want to do a g_object_notify() here for out-of-band
|
|
|
|
* events with the streaming thread possibly also doing a g_object_notify()
|
|
|
|
* for an in-band buffer or event. */
|
|
|
|
g_static_rec_mutex_lock (&sink->notify_lock);
|
|
|
|
g_object_notify ((GObject *) sink, "last_message");
|
|
|
|
g_static_rec_mutex_unlock (&sink->notify_lock);
|
|
|
|
}
|
|
|
|
|
gst/: Added object to help in making collect pad based elements.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/gstbasesink.h:
* gst/base/gstbasesrc.c: (gst_basesrc_init),
(gst_basesrc_set_dataflow_funcs), (gst_basesrc_query):
* gst/base/gstcollectpads.c: (gst_collectpads_get_type),
(gst_collectpads_class_init), (gst_collectpads_init),
(gst_collectpads_finalize), (gst_collectpads_new),
(gst_collectpads_set_function), (gst_collectpads_add_pad),
(find_pad), (gst_collectpads_remove_pad),
(gst_collectpads_is_active), (gst_collectpads_collect),
(gst_collectpads_collect_range), (gst_collectpads_start),
(gst_collectpads_stop), (gst_collectpads_peek),
(gst_collectpads_pop), (gst_collectpads_available),
(gst_collectpads_read), (gst_collectpads_flush),
(gst_collectpads_chain):
* gst/base/gstcollectpads.h:
* gst/elements/Makefile.am:
* gst/elements/gstelements.c:
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_get_times), (gst_fakesink_event),
(gst_fakesink_preroll), (gst_fakesink_render):
* gst/elements/gstfilesink.c: (gst_filesink_class_init),
(gst_filesink_init), (gst_filesink_set_location),
(gst_filesink_open_file), (gst_filesink_close_file),
(gst_filesink_pad_query), (gst_filesink_event),
(gst_filesink_render), (gst_filesink_change_state):
* gst/elements/gstfilesink.h:
Added object to help in making collect pad based elements.
Ported filesink.
Make event function in sink baseclass return gboolean.
2005-05-05 09:31:59 +00:00
|
|
|
static gboolean
|
2005-07-14 09:35:12 +00:00
|
|
|
gst_fake_sink_event (GstBaseSink * bsink, GstEvent * event)
|
2005-03-28 14:54:33 +00:00
|
|
|
{
|
2005-07-14 09:35:12 +00:00
|
|
|
GstFakeSink *sink = GST_FAKE_SINK (bsink);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
if (!sink->silent) {
|
2005-10-12 09:02:42 +00:00
|
|
|
const GstStructure *s;
|
Some docs updates
Original commit message from CVS:
* CHANGES-0.9:
* docs/design/part-TODO.txt:
* docs/design/part-events.txt:
Some docs updates
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_event), (gst_base_sink_do_sync),
(gst_base_sink_activate_push), (gst_base_sink_activate_pull):
* gst/base/gstbasesrc.c: (gst_base_src_send_discont),
(gst_base_src_do_seek), (gst_base_src_event_handler),
(gst_base_src_loop):
* gst/base/gstbasetransform.c: (gst_base_transform_transform_caps),
(gst_base_transform_configure_caps), (gst_base_transform_setcaps),
(gst_base_transform_get_size), (gst_base_transform_buffer_alloc),
(gst_base_transform_event), (gst_base_transform_handle_buffer),
(gst_base_transform_set_passthrough),
(gst_base_transform_is_passthrough):
* gst/elements/gstfakesink.c: (gst_fake_sink_event):
* gst/elements/gstfilesink.c: (gst_file_sink_event):
Event updates.
* gst/gstbuffer.h:
Use faster casts.
* gst/gstelement.c: (gst_element_seek):
* gst/gstelement.h:
Update gst_element_seek.
* gst/gstevent.c: (gst_event_finalize), (_gst_event_copy),
(gst_event_new), (gst_event_new_custom), (gst_event_get_structure),
(gst_event_new_flush_start), (gst_event_new_flush_stop),
(gst_event_new_eos), (gst_event_new_newsegment),
(gst_event_parse_newsegment), (gst_event_new_tag),
(gst_event_parse_tag), (gst_event_new_filler), (gst_event_new_qos),
(gst_event_parse_qos), (gst_event_new_seek),
(gst_event_parse_seek), (gst_event_new_navigation):
* gst/gstevent.h:
Make GstEvent use GstStructure. Add parsing code, make sure the
API is sufficiently generic.
Mark possible directions of events and serialization.
* gst/gstmessage.c: (gst_message_init), (gst_message_finalize),
(_gst_message_copy), (gst_message_new_segment_start),
(gst_message_new_segment_done), (gst_message_new_custom),
(gst_message_parse_segment_start),
(gst_message_parse_segment_done):
Small cleanups.
* gst/gstpad.c: (gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Update for new events.
Catch events sent in wrong directions.
* gst/gstqueue.c: (gst_queue_link_src),
(gst_queue_handle_sink_event), (gst_queue_chain), (gst_queue_loop),
(gst_queue_handle_src_query):
Event updates.
* gst/gsttag.c:
* gst/gsttag.h:
Remove event code from this file.
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_event),
(gst_dp_event_from_packet):
Event updates.
2005-07-27 18:33:03 +00:00
|
|
|
gchar *sstr;
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (sink);
|
2005-03-28 14:54:33 +00:00
|
|
|
g_free (sink->last_message);
|
2005-03-21 17:34:02 +00:00
|
|
|
|
2005-07-27 18:47:48 +00:00
|
|
|
if ((s = gst_event_get_structure (event)))
|
|
|
|
sstr = gst_structure_to_string (s);
|
|
|
|
else
|
|
|
|
sstr = g_strdup ("");
|
Some docs updates
Original commit message from CVS:
* CHANGES-0.9:
* docs/design/part-TODO.txt:
* docs/design/part-events.txt:
Some docs updates
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_event), (gst_base_sink_do_sync),
(gst_base_sink_activate_push), (gst_base_sink_activate_pull):
* gst/base/gstbasesrc.c: (gst_base_src_send_discont),
(gst_base_src_do_seek), (gst_base_src_event_handler),
(gst_base_src_loop):
* gst/base/gstbasetransform.c: (gst_base_transform_transform_caps),
(gst_base_transform_configure_caps), (gst_base_transform_setcaps),
(gst_base_transform_get_size), (gst_base_transform_buffer_alloc),
(gst_base_transform_event), (gst_base_transform_handle_buffer),
(gst_base_transform_set_passthrough),
(gst_base_transform_is_passthrough):
* gst/elements/gstfakesink.c: (gst_fake_sink_event):
* gst/elements/gstfilesink.c: (gst_file_sink_event):
Event updates.
* gst/gstbuffer.h:
Use faster casts.
* gst/gstelement.c: (gst_element_seek):
* gst/gstelement.h:
Update gst_element_seek.
* gst/gstevent.c: (gst_event_finalize), (_gst_event_copy),
(gst_event_new), (gst_event_new_custom), (gst_event_get_structure),
(gst_event_new_flush_start), (gst_event_new_flush_stop),
(gst_event_new_eos), (gst_event_new_newsegment),
(gst_event_parse_newsegment), (gst_event_new_tag),
(gst_event_parse_tag), (gst_event_new_filler), (gst_event_new_qos),
(gst_event_parse_qos), (gst_event_new_seek),
(gst_event_parse_seek), (gst_event_new_navigation):
* gst/gstevent.h:
Make GstEvent use GstStructure. Add parsing code, make sure the
API is sufficiently generic.
Mark possible directions of events and serialization.
* gst/gstmessage.c: (gst_message_init), (gst_message_finalize),
(_gst_message_copy), (gst_message_new_segment_start),
(gst_message_new_segment_done), (gst_message_new_custom),
(gst_message_parse_segment_start),
(gst_message_parse_segment_done):
Small cleanups.
* gst/gstpad.c: (gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Update for new events.
Catch events sent in wrong directions.
* gst/gstqueue.c: (gst_queue_link_src),
(gst_queue_handle_sink_event), (gst_queue_chain), (gst_queue_loop),
(gst_queue_handle_src_query):
Event updates.
* gst/gsttag.c:
* gst/gsttag.h:
Remove event code from this file.
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_event),
(gst_dp_event_from_packet):
Event updates.
2005-07-27 18:33:03 +00:00
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
sink->last_message =
|
Some docs updates
Original commit message from CVS:
* CHANGES-0.9:
* docs/design/part-TODO.txt:
* docs/design/part-events.txt:
Some docs updates
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_event), (gst_base_sink_do_sync),
(gst_base_sink_activate_push), (gst_base_sink_activate_pull):
* gst/base/gstbasesrc.c: (gst_base_src_send_discont),
(gst_base_src_do_seek), (gst_base_src_event_handler),
(gst_base_src_loop):
* gst/base/gstbasetransform.c: (gst_base_transform_transform_caps),
(gst_base_transform_configure_caps), (gst_base_transform_setcaps),
(gst_base_transform_get_size), (gst_base_transform_buffer_alloc),
(gst_base_transform_event), (gst_base_transform_handle_buffer),
(gst_base_transform_set_passthrough),
(gst_base_transform_is_passthrough):
* gst/elements/gstfakesink.c: (gst_fake_sink_event):
* gst/elements/gstfilesink.c: (gst_file_sink_event):
Event updates.
* gst/gstbuffer.h:
Use faster casts.
* gst/gstelement.c: (gst_element_seek):
* gst/gstelement.h:
Update gst_element_seek.
* gst/gstevent.c: (gst_event_finalize), (_gst_event_copy),
(gst_event_new), (gst_event_new_custom), (gst_event_get_structure),
(gst_event_new_flush_start), (gst_event_new_flush_stop),
(gst_event_new_eos), (gst_event_new_newsegment),
(gst_event_parse_newsegment), (gst_event_new_tag),
(gst_event_parse_tag), (gst_event_new_filler), (gst_event_new_qos),
(gst_event_parse_qos), (gst_event_new_seek),
(gst_event_parse_seek), (gst_event_new_navigation):
* gst/gstevent.h:
Make GstEvent use GstStructure. Add parsing code, make sure the
API is sufficiently generic.
Mark possible directions of events and serialization.
* gst/gstmessage.c: (gst_message_init), (gst_message_finalize),
(_gst_message_copy), (gst_message_new_segment_start),
(gst_message_new_segment_done), (gst_message_new_custom),
(gst_message_parse_segment_start),
(gst_message_parse_segment_done):
Small cleanups.
* gst/gstpad.c: (gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Update for new events.
Catch events sent in wrong directions.
* gst/gstqueue.c: (gst_queue_link_src),
(gst_queue_handle_sink_event), (gst_queue_chain), (gst_queue_loop),
(gst_queue_handle_src_query):
Event updates.
* gst/gsttag.c:
* gst/gsttag.h:
Remove event code from this file.
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_event),
(gst_dp_event_from_packet):
Event updates.
2005-07-27 18:33:03 +00:00
|
|
|
g_strdup_printf ("event ******* E (type: %d, %s) %p",
|
|
|
|
GST_EVENT_TYPE (event), sstr, event);
|
|
|
|
g_free (sstr);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (sink);
|
2002-11-21 23:52:30 +00:00
|
|
|
|
2009-05-30 19:36:25 +00:00
|
|
|
gst_fake_sink_notify_last_message (sink);
|
2005-03-21 17:34:02 +00:00
|
|
|
}
|
gst/: Added object to help in making collect pad based elements.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/gstbasesink.h:
* gst/base/gstbasesrc.c: (gst_basesrc_init),
(gst_basesrc_set_dataflow_funcs), (gst_basesrc_query):
* gst/base/gstcollectpads.c: (gst_collectpads_get_type),
(gst_collectpads_class_init), (gst_collectpads_init),
(gst_collectpads_finalize), (gst_collectpads_new),
(gst_collectpads_set_function), (gst_collectpads_add_pad),
(find_pad), (gst_collectpads_remove_pad),
(gst_collectpads_is_active), (gst_collectpads_collect),
(gst_collectpads_collect_range), (gst_collectpads_start),
(gst_collectpads_stop), (gst_collectpads_peek),
(gst_collectpads_pop), (gst_collectpads_available),
(gst_collectpads_read), (gst_collectpads_flush),
(gst_collectpads_chain):
* gst/base/gstcollectpads.h:
* gst/elements/Makefile.am:
* gst/elements/gstelements.c:
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_get_times), (gst_fakesink_event),
(gst_fakesink_preroll), (gst_fakesink_render):
* gst/elements/gstfilesink.c: (gst_filesink_class_init),
(gst_filesink_init), (gst_filesink_set_location),
(gst_filesink_open_file), (gst_filesink_close_file),
(gst_filesink_pad_query), (gst_filesink_event),
(gst_filesink_render), (gst_filesink_change_state):
* gst/elements/gstfilesink.h:
Added object to help in making collect pad based elements.
Ported filesink.
Make event function in sink baseclass return gboolean.
2005-05-05 09:31:59 +00:00
|
|
|
|
2008-08-20 07:03:40 +00:00
|
|
|
if (GST_BASE_SINK_CLASS (parent_class)->event) {
|
|
|
|
return GST_BASE_SINK_CLASS (parent_class)->event (bsink, event);
|
|
|
|
} else {
|
|
|
|
return TRUE;
|
|
|
|
}
|
2005-03-21 17:34:02 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
static GstFlowReturn
|
2005-07-14 09:35:12 +00:00
|
|
|
gst_fake_sink_preroll (GstBaseSink * bsink, GstBuffer * buffer)
|
2005-03-21 17:34:02 +00:00
|
|
|
{
|
2005-07-14 09:35:12 +00:00
|
|
|
GstFakeSink *sink = GST_FAKE_SINK (bsink);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2007-04-05 11:16:09 +00:00
|
|
|
if (sink->num_buffers_left == 0)
|
|
|
|
goto eos;
|
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
if (!sink->silent) {
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (sink);
|
2005-03-28 14:54:33 +00:00
|
|
|
g_free (sink->last_message);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
sink->last_message = g_strdup_printf ("preroll ******* ");
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (sink);
|
2002-05-26 21:54:27 +00:00
|
|
|
|
2009-05-30 19:36:25 +00:00
|
|
|
gst_fake_sink_notify_last_message (sink);
|
2002-03-30 17:05:03 +00:00
|
|
|
}
|
2006-05-23 14:23:49 +00:00
|
|
|
if (sink->signal_handoffs) {
|
|
|
|
g_signal_emit (sink,
|
|
|
|
gst_fake_sink_signals[SIGNAL_PREROLL_HANDOFF], 0, buffer,
|
|
|
|
bsink->sinkpad);
|
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
return GST_FLOW_OK;
|
2007-04-05 11:16:09 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
eos:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (sink, "we are EOS");
|
|
|
|
return GST_FLOW_UNEXPECTED;
|
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
}
|
2002-03-30 17:05:03 +00:00
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
static GstFlowReturn
|
2005-07-14 09:35:12 +00:00
|
|
|
gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf)
|
2005-03-28 14:54:33 +00:00
|
|
|
{
|
2006-07-27 11:00:21 +00:00
|
|
|
GstFakeSink *sink = GST_FAKE_SINK_CAST (bsink);
|
2002-02-06 21:57:35 +00:00
|
|
|
|
2007-04-05 11:16:09 +00:00
|
|
|
if (sink->num_buffers_left == 0)
|
|
|
|
goto eos;
|
|
|
|
|
|
|
|
if (sink->num_buffers_left != -1)
|
|
|
|
sink->num_buffers_left--;
|
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
if (!sink->silent) {
|
2005-10-14 14:10:24 +00:00
|
|
|
gchar ts_str[64], dur_str[64];
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (sink);
|
2005-03-28 14:54:33 +00:00
|
|
|
g_free (sink->last_message);
|
|
|
|
|
2005-10-14 14:10:24 +00:00
|
|
|
if (GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) {
|
|
|
|
g_snprintf (ts_str, sizeof (ts_str), "%" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
|
|
|
|
} else {
|
|
|
|
g_strlcpy (ts_str, "none", sizeof (ts_str));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GST_BUFFER_DURATION (buf) != GST_CLOCK_TIME_NONE) {
|
|
|
|
g_snprintf (dur_str, sizeof (dur_str), "%" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
|
|
|
|
} else {
|
|
|
|
g_strlcpy (dur_str, "none", sizeof (dur_str));
|
|
|
|
}
|
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
sink->last_message =
|
2005-10-14 14:10:24 +00:00
|
|
|
g_strdup_printf ("chain ******* < (%5d bytes, timestamp: %s"
|
|
|
|
", duration: %s, offset: %" G_GINT64_FORMAT ", offset_end: %"
|
|
|
|
G_GINT64_FORMAT ", flags: %d) %p", GST_BUFFER_SIZE (buf), ts_str,
|
|
|
|
dur_str, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
|
2009-05-02 10:59:54 +00:00
|
|
|
GST_MINI_OBJECT_CAST (buf)->flags, buf);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (sink);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2009-05-30 19:36:25 +00:00
|
|
|
gst_fake_sink_notify_last_message (sink);
|
2001-12-18 19:03:07 +00:00
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
if (sink->signal_handoffs)
|
2009-10-03 19:49:54 +00:00
|
|
|
g_signal_emit (sink, gst_fake_sink_signals[SIGNAL_HANDOFF], 0, buf,
|
|
|
|
bsink->sinkpad);
|
2001-10-17 10:21:27 +00:00
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
if (sink->dump) {
|
2001-10-17 10:21:27 +00:00
|
|
|
gst_util_dump_mem (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
|
|
|
}
|
2007-04-05 11:16:09 +00:00
|
|
|
if (sink->num_buffers_left == 0)
|
|
|
|
goto eos;
|
2000-12-22 16:14:33 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
return GST_FLOW_OK;
|
2007-04-05 11:16:09 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
eos:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (sink, "we are EOS");
|
|
|
|
return GST_FLOW_UNEXPECTED;
|
|
|
|
}
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
2001-07-11 16:45:43 +00:00
|
|
|
|
2005-09-02 15:42:00 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_fake_sink_change_state (GstElement * element, GstStateChange transition)
|
2003-06-03 20:22:52 +00:00
|
|
|
{
|
2005-09-02 15:42:00 +00:00
|
|
|
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
2005-07-14 09:35:12 +00:00
|
|
|
GstFakeSink *fakesink = GST_FAKE_SINK (element);
|
2003-06-03 20:22:52 +00:00
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
switch (transition) {
|
2005-09-02 15:42:00 +00:00
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
2005-07-14 09:35:12 +00:00
|
|
|
if (fakesink->state_error == FAKE_SINK_STATE_ERROR_NULL_READY)
|
2004-03-15 19:27:17 +00:00
|
|
|
goto error;
|
2003-06-03 20:22:52 +00:00
|
|
|
break;
|
2005-09-02 15:42:00 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2005-07-14 09:35:12 +00:00
|
|
|
if (fakesink->state_error == FAKE_SINK_STATE_ERROR_READY_PAUSED)
|
2004-03-15 19:27:17 +00:00
|
|
|
goto error;
|
2007-04-05 11:16:09 +00:00
|
|
|
fakesink->num_buffers_left = fakesink->num_buffers;
|
2003-06-03 20:22:52 +00:00
|
|
|
break;
|
2005-09-02 15:42:00 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
2005-07-14 09:35:12 +00:00
|
|
|
if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PAUSED_PLAYING)
|
2004-03-15 19:27:17 +00:00
|
|
|
goto error;
|
2003-06-03 20:22:52 +00:00
|
|
|
break;
|
2005-09-02 23:17:26 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
|
|
|
|
|
|
switch (transition) {
|
2005-09-02 15:42:00 +00:00
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
2005-07-14 09:35:12 +00:00
|
|
|
if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PLAYING_PAUSED)
|
2004-03-15 19:27:17 +00:00
|
|
|
goto error;
|
2003-06-03 20:22:52 +00:00
|
|
|
break;
|
2005-09-02 15:42:00 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2005-07-14 09:35:12 +00:00
|
|
|
if (fakesink->state_error == FAKE_SINK_STATE_ERROR_PAUSED_READY)
|
2004-03-15 19:27:17 +00:00
|
|
|
goto error;
|
2003-06-03 20:22:52 +00:00
|
|
|
break;
|
2005-09-02 15:42:00 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
2005-07-14 09:35:12 +00:00
|
|
|
if (fakesink->state_error == FAKE_SINK_STATE_ERROR_READY_NULL)
|
2004-03-15 19:27:17 +00:00
|
|
|
goto error;
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (fakesink);
|
2003-08-07 12:45:31 +00:00
|
|
|
g_free (fakesink->last_message);
|
|
|
|
fakesink->last_message = NULL;
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (fakesink);
|
2003-06-03 20:22:52 +00:00
|
|
|
break;
|
2005-03-28 14:54:33 +00:00
|
|
|
default:
|
|
|
|
break;
|
2003-06-03 20:22:52 +00:00
|
|
|
}
|
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
return ret;
|
2003-06-03 20:22:52 +00:00
|
|
|
|
2005-09-20 17:38:51 +00:00
|
|
|
/* ERROR */
|
2003-06-03 20:22:52 +00:00
|
|
|
error:
|
2007-09-23 10:16:49 +00:00
|
|
|
GST_ELEMENT_ERROR (element, CORE, STATE_CHANGE, (NULL),
|
|
|
|
("Erroring out on state change as requested"));
|
2005-09-02 15:42:00 +00:00
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
2003-06-03 20:22:52 +00:00
|
|
|
}
|