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
|
2012-11-03 20:44:48 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2000-01-30 09:03:00 +00:00
|
|
|
*/
|
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"
|
2011-02-16 03:15:16 +00:00
|
|
|
#include <string.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
|
2012-02-08 23:47:40 +00:00
|
|
|
#define DEFAULT_SILENT TRUE
|
2005-03-28 14:54:33 +00:00
|
|
|
#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
|
|
|
|
2011-04-18 16:07:06 +00:00
|
|
|
#define _do_init \
|
2005-07-14 09:35:12 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_fake_sink_debug, "fakesink", 0, "fakesink element");
|
2011-04-18 16:07:06 +00:00
|
|
|
#define gst_fake_sink_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GstFakeSink, gst_fake_sink, 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);
|
2012-02-25 15:07:05 +00:00
|
|
|
static gboolean gst_fake_sink_query (GstBaseSink * bsink, GstQuery * query);
|
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
|
|
|
|
2010-12-30 18:31:11 +00:00
|
|
|
static GParamSpec *pspec_last_message = NULL;
|
2010-10-07 17:27:06 +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));
|
2010-10-07 17:27:06 +00:00
|
|
|
pspec_last_message = g_param_spec_string ("last-message", "Last Message",
|
|
|
|
"The message describing current status", DEFAULT_LAST_MESSAGE,
|
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_LAST_MESSAGE,
|
2010-10-07 17:27:06 +00:00
|
|
|
pspec_last_message);
|
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,
|
2012-03-02 10:05:48 +00:00
|
|
|
g_cclosure_marshal_generic, G_TYPE_NONE, 2,
|
2012-02-21 11:46:44 +00:00
|
|
|
GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE, 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.
|
|
|
|
*/
|
|
|
|
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),
|
2012-03-02 10:05:48 +00:00
|
|
|
NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 2,
|
2012-02-21 11:46:44 +00:00
|
|
|
GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE, GST_TYPE_PAD);
|
2006-05-23 14:23:49 +00:00
|
|
|
|
2012-04-09 12:05:07 +00:00
|
|
|
gst_element_class_set_static_metadata (gstelement_class,
|
2011-04-18 16:07:06 +00:00
|
|
|
"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));
|
|
|
|
|
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);
|
2012-02-25 15:07:05 +00:00
|
|
|
gstbase_sink_class->query = GST_DEBUG_FUNCPTR (gst_fake_sink_query);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void
|
2011-04-18 16:07:06 +00:00
|
|
|
gst_fake_sink_init (GstFakeSink * fakesink)
|
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;
|
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)
|
|
|
|
{
|
|
|
|
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:
|
2012-09-24 23:55:59 +00:00
|
|
|
sink->state_error = (GstFakeSinkStateError) g_value_get_enum (value);
|
2003-06-03 20:22:52 +00:00
|
|
|
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)
|
|
|
|
{
|
2010-10-07 17:27:06 +00:00
|
|
|
g_object_notify_by_pspec ((GObject *) sink, pspec_last_message);
|
2009-05-30 19:36:25 +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
|
|
|
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;
|
2012-01-27 10:01:27 +00:00
|
|
|
const gchar *tstr;
|
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
|
|
|
|
2010-11-03 15:37:10 +00:00
|
|
|
if (GST_EVENT_TYPE (event) == GST_EVENT_SINK_MESSAGE) {
|
|
|
|
GstMessage *msg;
|
2011-05-10 11:34:10 +00:00
|
|
|
const GstStructure *structure;
|
2010-11-03 15:37:10 +00:00
|
|
|
|
|
|
|
gst_event_parse_sink_message (event, &msg);
|
2011-05-10 11:34:10 +00:00
|
|
|
structure = gst_message_get_structure (msg);
|
|
|
|
sstr = gst_structure_to_string (structure);
|
2010-11-03 15:37:10 +00:00
|
|
|
sink->last_message =
|
2011-12-06 13:55:15 +00:00
|
|
|
g_strdup_printf ("message ******* (%s:%s) M (type: %d, %s) %p",
|
|
|
|
GST_DEBUG_PAD_NAME (GST_BASE_SINK_CAST (sink)->sinkpad),
|
2010-11-03 15:37:10 +00:00
|
|
|
GST_MESSAGE_TYPE (msg), sstr, msg);
|
|
|
|
gst_message_unref (msg);
|
|
|
|
} else {
|
2012-01-27 10:01:27 +00:00
|
|
|
tstr = gst_event_type_get_name (GST_EVENT_TYPE (event));
|
|
|
|
|
2010-11-03 15:37:10 +00:00
|
|
|
if ((s = gst_event_get_structure (event))) {
|
|
|
|
sstr = gst_structure_to_string (s);
|
|
|
|
} else {
|
|
|
|
sstr = g_strdup ("");
|
|
|
|
}
|
|
|
|
|
|
|
|
sink->last_message =
|
2012-01-27 10:01:27 +00:00
|
|
|
g_strdup_printf ("event ******* (%s:%s) E (type: %s (%d), %s) %p",
|
2011-12-06 13:55:15 +00:00
|
|
|
GST_DEBUG_PAD_NAME (GST_BASE_SINK_CAST (sink)->sinkpad),
|
2012-01-27 10:01:27 +00:00
|
|
|
tstr, GST_EVENT_TYPE (event), sstr, event);
|
2010-11-03 15:37:10 +00:00
|
|
|
}
|
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_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
|
|
|
|
2011-12-02 21:20:08 +00:00
|
|
|
return GST_BASE_SINK_CLASS (parent_class)->event (bsink, event);
|
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");
|
2011-10-10 09:33:51 +00:00
|
|
|
return GST_FLOW_EOS;
|
2007-04-05 11:16:09 +00:00
|
|
|
}
|
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) {
|
2012-02-21 11:13:28 +00:00
|
|
|
gchar dts_str[64], pts_str[64], dur_str[64];
|
2011-02-16 03:15:16 +00:00
|
|
|
gchar flag_str[100];
|
2005-10-14 14:10:24 +00:00
|
|
|
|
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);
|
|
|
|
|
2012-02-21 11:13:28 +00:00
|
|
|
if (GST_BUFFER_DTS (buf) != GST_CLOCK_TIME_NONE) {
|
|
|
|
g_snprintf (dts_str, sizeof (dts_str), "%" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_DTS (buf)));
|
2005-10-14 14:10:24 +00:00
|
|
|
} else {
|
2012-02-21 11:13:28 +00:00
|
|
|
g_strlcpy (dts_str, "none", sizeof (dts_str));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GST_BUFFER_PTS (buf) != GST_CLOCK_TIME_NONE) {
|
|
|
|
g_snprintf (pts_str, sizeof (pts_str), "%" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_PTS (buf)));
|
|
|
|
} else {
|
|
|
|
g_strlcpy (pts_str, "none", sizeof (pts_str));
|
2005-10-14 14:10:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
|
2011-02-16 03:15:16 +00:00
|
|
|
{
|
2011-12-08 00:39:10 +00:00
|
|
|
const char *flag_list[15] = {
|
|
|
|
"", "", "", "", "live", "decode-only", "discont", "resync", "corrupted",
|
|
|
|
"marker", "header", "gap", "droppable", "delta-unit", "in-caps"
|
2011-02-16 03:15:16 +00:00
|
|
|
};
|
|
|
|
int i;
|
|
|
|
char *end = flag_str;
|
|
|
|
end[0] = '\0';
|
2011-12-08 00:39:10 +00:00
|
|
|
for (i = 0; i < G_N_ELEMENTS (flag_list); i++) {
|
2011-02-16 03:15:16 +00:00
|
|
|
if (GST_MINI_OBJECT_CAST (buf)->flags & (1 << i)) {
|
|
|
|
strcpy (end, flag_list[i]);
|
|
|
|
end += strlen (end);
|
|
|
|
end[0] = ' ';
|
|
|
|
end[1] = '\0';
|
|
|
|
end++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
sink->last_message =
|
2012-02-21 11:13:28 +00:00
|
|
|
g_strdup_printf ("chain ******* (%s:%s) (%u bytes, dts: %s, pts: %s"
|
2005-10-14 14:10:24 +00:00
|
|
|
", duration: %s, offset: %" G_GINT64_FORMAT ", offset_end: %"
|
2012-07-23 11:40:38 +00:00
|
|
|
G_GINT64_FORMAT ", flags: %08x %s) %p",
|
2011-12-06 13:55:15 +00:00
|
|
|
GST_DEBUG_PAD_NAME (GST_BASE_SINK_CAST (sink)->sinkpad),
|
2012-02-21 11:13:28 +00:00
|
|
|
(guint) gst_buffer_get_size (buf), dts_str, pts_str,
|
2005-10-14 14:10:24 +00:00
|
|
|
dur_str, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
|
2011-02-16 03:15:16 +00:00
|
|
|
GST_MINI_OBJECT_CAST (buf)->flags, flag_str, 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) {
|
2012-01-20 13:23:57 +00:00
|
|
|
GstMapInfo info;
|
2011-03-21 17:13:55 +00:00
|
|
|
|
2012-01-20 13:23:57 +00:00
|
|
|
gst_buffer_map (buf, &info, GST_MAP_READ);
|
|
|
|
gst_util_dump_mem (info.data, info.size);
|
|
|
|
gst_buffer_unmap (buf, &info);
|
2001-10-17 10:21:27 +00:00
|
|
|
}
|
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");
|
2011-10-10 09:33:51 +00:00
|
|
|
return GST_FLOW_EOS;
|
2007-04-05 11:16:09 +00:00
|
|
|
}
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
2001-07-11 16:45:43 +00:00
|
|
|
|
2012-02-25 15:07:05 +00:00
|
|
|
static gboolean
|
|
|
|
gst_fake_sink_query (GstBaseSink * bsink, GstQuery * query)
|
|
|
|
{
|
|
|
|
gboolean ret;
|
|
|
|
|
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_SEEKING:{
|
|
|
|
GstFormat fmt;
|
|
|
|
|
|
|
|
/* we don't supporting seeking */
|
|
|
|
gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
|
|
|
|
gst_query_set_seeking (query, fmt, FALSE, 0, -1);
|
|
|
|
ret = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
ret = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|