2000-12-29 05:38:06 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wtay@chello.be>
|
2005-03-21 17:34:02 +00:00
|
|
|
* 2005 Wim Taymans <wim@fluendo.com>
|
2000-12-29 05:38:06 +00:00
|
|
|
*
|
2005-10-15 15:30:24 +00:00
|
|
|
* gstidentity.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
|
|
|
*/
|
docs/: Correct fixxrefs options.
Original commit message from CVS:
* docs/gst/Makefile.am:
* docs/libs/Makefile.am:
Correct fixxrefs options.
* docs/plugins/Makefile.am:
* docs/plugins/gstreamer-plugins-docs.sgml:
* docs/plugins/gstreamer-plugins-sections.txt:
* plugins/elements/Makefile.am:
* plugins/elements/gstcapsfilter.c (gst_capsfilter_details):
* plugins/elements/gstcapsfilter.h (__GST_CAPSFILTER_H__,
GST_TYPE_CAPSFILTER, GST_CAPSFILTER, GST_CAPSFILTER_CLASS,
GST_IS_CAPSFILTER, GST_IS_CAPSFILTER_CLASS, GstCapsFilter,
GstCapsFilterClass, _GstCapsFilter, trans, filter_caps,
_GstCapsFilterClass, trans_class):
* plugins/elements/gstelements.c (name, rank, type, _elements):
* plugins/elements/gstidentity.c
(gst_identity_check_imperfect_timestamp,
gst_identity_check_imperfect_offset):
Document capsfilter and add doc-blurb to identity.
2007-05-06 18:27:25 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-identity
|
|
|
|
*
|
2011-09-07 11:14:38 +00:00
|
|
|
* Dummy element that passes incoming data through unmodified. It has some
|
docs/: Correct fixxrefs options.
Original commit message from CVS:
* docs/gst/Makefile.am:
* docs/libs/Makefile.am:
Correct fixxrefs options.
* docs/plugins/Makefile.am:
* docs/plugins/gstreamer-plugins-docs.sgml:
* docs/plugins/gstreamer-plugins-sections.txt:
* plugins/elements/Makefile.am:
* plugins/elements/gstcapsfilter.c (gst_capsfilter_details):
* plugins/elements/gstcapsfilter.h (__GST_CAPSFILTER_H__,
GST_TYPE_CAPSFILTER, GST_CAPSFILTER, GST_CAPSFILTER_CLASS,
GST_IS_CAPSFILTER, GST_IS_CAPSFILTER_CLASS, GstCapsFilter,
GstCapsFilterClass, _GstCapsFilter, trans, filter_caps,
_GstCapsFilterClass, trans_class):
* plugins/elements/gstelements.c (name, rank, type, _elements):
* plugins/elements/gstidentity.c
(gst_identity_check_imperfect_timestamp,
gst_identity_check_imperfect_offset):
Document capsfilter and add doc-blurb to identity.
2007-05-06 18:27:25 +00:00
|
|
|
* useful diagnostic functions, such as offset and timestamp checking.
|
|
|
|
*/
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2006-05-04 15:20:14 +00:00
|
|
|
#include <stdlib.h>
|
2011-12-06 13:55:11 +00:00
|
|
|
#include <string.h>
|
2006-05-04 15:20:14 +00:00
|
|
|
|
2014-04-07 13:49:59 +00:00
|
|
|
#include "gstelements_private.h"
|
2005-11-29 18:00:15 +00:00
|
|
|
#include "../../gst/gst-i18n-lib.h"
|
2003-06-29 14:05:49 +00:00
|
|
|
#include "gstidentity.h"
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
2003-10-31 19:32:47 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_identity_debug);
|
2003-06-29 14:05:49 +00:00
|
|
|
#define GST_CAT_DEFAULT gst_identity_debug
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
/* Identity signals and args */
|
2004-03-13 15:27:01 +00:00
|
|
|
enum
|
|
|
|
{
|
2001-07-11 15:51:40 +00:00
|
|
|
SIGNAL_HANDOFF,
|
2000-01-30 09:03:00 +00:00
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2005-12-06 19:29:15 +00:00
|
|
|
#define DEFAULT_SLEEP_TIME 0
|
|
|
|
#define DEFAULT_DUPLICATE 1
|
|
|
|
#define DEFAULT_ERROR_AFTER -1
|
|
|
|
#define DEFAULT_DROP_PROBABILITY 0.0
|
2015-06-18 20:56:53 +00:00
|
|
|
#define DEFAULT_DROP_BUFFER_FLAGS 0
|
2005-12-06 19:29:15 +00:00
|
|
|
#define DEFAULT_DATARATE 0
|
2012-02-08 23:47:40 +00:00
|
|
|
#define DEFAULT_SILENT TRUE
|
2005-12-06 19:29:15 +00:00
|
|
|
#define DEFAULT_SINGLE_SEGMENT FALSE
|
|
|
|
#define DEFAULT_DUMP FALSE
|
|
|
|
#define DEFAULT_SYNC FALSE
|
2007-03-09 14:20:25 +00:00
|
|
|
#define DEFAULT_CHECK_IMPERFECT_TIMESTAMP FALSE
|
|
|
|
#define DEFAULT_CHECK_IMPERFECT_OFFSET FALSE
|
2007-11-21 13:27:50 +00:00
|
|
|
#define DEFAULT_SIGNAL_HANDOFFS TRUE
|
gst/elements/: Added datarate properties to limit the datarate.
Original commit message from CVS:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_set_clock),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get), (gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_chain),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
Added datarate properties to limit the datarate.
2004-09-03 11:40:35 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
enum
|
|
|
|
{
|
2005-03-21 17:34:02 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_SLEEP_TIME,
|
|
|
|
PROP_ERROR_AFTER,
|
|
|
|
PROP_DROP_PROBABILITY,
|
2015-06-18 20:56:53 +00:00
|
|
|
PROP_DROP_BUFFER_FLAGS,
|
2005-03-21 17:34:02 +00:00
|
|
|
PROP_DATARATE,
|
|
|
|
PROP_SILENT,
|
gst/base/gstbasetransform.c: The event virtual method is now properly implemented, with a default handler
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_class_init),
(gst_base_transform_event), (gst_base_transform_eventfunc):
The event virtual method is now properly implemented, with a default
handler
Sub classes should call the parent_class event method. They should
return FALSE if they had a problem handling the given event, or don't
want GstBaseTransform to send that even downstream
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_event),
(gst_identity_transform_ip), (gst_identity_set_property),
(gst_identity_get_property):
* gst/elements/gstidentity.h:
Added the single-segment boolean property.
If set to TRUE, it will output a single segment of data, starting from
0, will eat up all incoming newsegment, and modify the timestamp of the
buffers accordingly
2005-11-29 14:47:07 +00:00
|
|
|
PROP_SINGLE_SEGMENT,
|
2005-03-21 17:34:02 +00:00
|
|
|
PROP_LAST_MESSAGE,
|
|
|
|
PROP_DUMP,
|
|
|
|
PROP_SYNC,
|
2007-03-09 14:20:25 +00:00
|
|
|
PROP_CHECK_IMPERFECT_TIMESTAMP,
|
2007-11-21 13:27:50 +00:00
|
|
|
PROP_CHECK_IMPERFECT_OFFSET,
|
|
|
|
PROP_SIGNAL_HANDOFFS
|
2000-01-30 09:03:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-04-18 16:07:06 +00:00
|
|
|
#define _do_init \
|
2004-01-08 04:10:18 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_identity_debug, "identity", 0, "identity element");
|
2011-04-18 16:07:06 +00:00
|
|
|
#define gst_identity_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GstIdentity, gst_identity, GST_TYPE_BASE_TRANSFORM,
|
|
|
|
_do_init);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2004-03-21 03:22:55 +00:00
|
|
|
static void gst_identity_finalize (GObject * object);
|
2004-03-13 15:27:01 +00:00
|
|
|
static void gst_identity_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_identity_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
2000-11-25 14:18:47 +00:00
|
|
|
|
2011-07-22 19:17:42 +00:00
|
|
|
static gboolean gst_identity_sink_event (GstBaseTransform * trans,
|
|
|
|
GstEvent * event);
|
docs/design/part-events.txt: Small update.
Original commit message from CVS:
* docs/design/part-events.txt:
Small update.
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_do_sync), (gst_base_sink_activate_push),
(gst_base_sink_activate_pull):
Some more comments.
* gst/elements/gstfakesrc.c: (gst_fake_src_class_init),
(gst_fake_src_create):
Fix handoff marshall.
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_transform_ip):
We're a real inplace element.
* gst/gstbus.c: (gst_bus_post):
Added some comments.
* tests/lat.c: (fakesrc), (fakesink), (simple), (queue), (main):
* tests/muxing/case1.c: (main):
* tests/sched/dynamic-pipeline.c: (main):
* tests/sched/interrupt1.c: (main):
* tests/sched/interrupt2.c: (main):
* tests/sched/interrupt3.c: (main):
* tests/sched/runxml.c: (main):
* tests/sched/sched-stress.c: (main):
* tests/seeking/seeking1.c: (event_received), (main):
* tests/threadstate/threadstate2.c: (bus_handler), (timeout_func),
(main):
* tests/threadstate/threadstate3.c: (main):
* tests/threadstate/threadstate4.c: (main):
* tests/threadstate/threadstate5.c: (main):
Fix the tests.
2005-07-22 11:47:10 +00:00
|
|
|
static GstFlowReturn gst_identity_transform_ip (GstBaseTransform * trans,
|
|
|
|
GstBuffer * buf);
|
gst/: Added start/stop methods to transform base class so subclasses don't need to deal with state changes even.
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_base_init),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_setcaps), (gst_base_transform_handle_buffer),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_start),
(gst_identity_stop):
Added start/stop methods to transform base class so subclasses
don't need to deal with state changes even.
2005-03-31 10:10:55 +00:00
|
|
|
static gboolean gst_identity_start (GstBaseTransform * trans);
|
|
|
|
static gboolean gst_identity_stop (GstBaseTransform * trans);
|
2011-12-02 12:19:38 +00:00
|
|
|
static GstStateChangeReturn gst_identity_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2014-07-01 17:17:11 +00:00
|
|
|
static gboolean gst_identity_accept_caps (GstBaseTransform * base,
|
|
|
|
GstPadDirection direction, GstCaps * caps);
|
2015-04-20 23:24:45 +00:00
|
|
|
static gboolean gst_identity_query (GstBaseTransform * base,
|
|
|
|
GstPadDirection direction, GstQuery * query);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2001-07-11 15:51:40 +00:00
|
|
|
static guint gst_identity_signals[LAST_SIGNAL] = { 0 };
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2010-10-07 16:53:18 +00:00
|
|
|
static GParamSpec *pspec_last_message = NULL;
|
|
|
|
|
2004-03-21 03:22:55 +00:00
|
|
|
static void
|
|
|
|
gst_identity_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstIdentity *identity;
|
|
|
|
|
|
|
|
identity = GST_IDENTITY (object);
|
|
|
|
|
|
|
|
g_free (identity->last_message);
|
2015-04-20 23:31:37 +00:00
|
|
|
g_cond_clear (&identity->blocked_cond);
|
2010-10-07 16:53:18 +00:00
|
|
|
|
2004-03-21 03:22:55 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void
|
|
|
|
gst_identity_class_init (GstIdentityClass * klass)
|
2000-11-25 14:18:47 +00:00
|
|
|
{
|
2001-06-25 01:20:11 +00:00
|
|
|
GObjectClass *gobject_class;
|
2011-04-18 16:07:06 +00:00
|
|
|
GstElementClass *gstelement_class;
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
GstBaseTransformClass *gstbasetrans_class;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2003-10-31 19:32:47 +00:00
|
|
|
gobject_class = G_OBJECT_CLASS (klass);
|
2011-04-18 16:07:06 +00:00
|
|
|
gstelement_class = GST_ELEMENT_CLASS (klass);
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
gstbasetrans_class = GST_BASE_TRANSFORM_CLASS (klass);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2009-10-28 00:29:30 +00:00
|
|
|
gobject_class->set_property = gst_identity_set_property;
|
|
|
|
gobject_class->get_property = gst_identity_get_property;
|
2005-03-08 17:42:29 +00:00
|
|
|
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_SLEEP_TIME,
|
2004-03-13 15:27:01 +00:00
|
|
|
g_param_spec_uint ("sleep-time", "Sleep time",
|
gst/elements/: Added datarate properties to limit the datarate.
Original commit message from CVS:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_set_clock),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get), (gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_chain),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
Added datarate properties to limit the datarate.
2004-09-03 11:40:35 +00:00
|
|
|
"Microseconds to sleep between processing", 0, G_MAXUINT,
|
2008-03-22 14:56:17 +00:00
|
|
|
DEFAULT_SLEEP_TIME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_ERROR_AFTER,
|
2008-03-22 14:56:17 +00:00
|
|
|
g_param_spec_int ("error-after", "Error After", "Error after N buffers",
|
|
|
|
G_MININT, G_MAXINT, DEFAULT_ERROR_AFTER,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
g_object_class_install_property (gobject_class, PROP_DROP_PROBABILITY,
|
|
|
|
g_param_spec_float ("drop-probability", "Drop Probability",
|
2007-03-08 11:40:18 +00:00
|
|
|
"The Probability a buffer is dropped", 0.0, 1.0,
|
2008-03-22 14:56:17 +00:00
|
|
|
DEFAULT_DROP_PROBABILITY,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2015-06-18 20:56:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GstIdentity:drop-buffer-flags:
|
|
|
|
*
|
|
|
|
* Drop buffers with the given flags.
|
|
|
|
*
|
|
|
|
* Since: 1.8
|
|
|
|
**/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_DROP_BUFFER_FLAGS,
|
|
|
|
g_param_spec_flags ("drop-buffer-flags", "Check flags to drop buffers",
|
|
|
|
"Drop buffers with the given flags",
|
|
|
|
GST_TYPE_BUFFER_FLAGS, DEFAULT_DROP_BUFFER_FLAGS,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_DATARATE,
|
gst/elements/: Added datarate properties to limit the datarate.
Original commit message from CVS:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_set_clock),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get), (gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_chain),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
Added datarate properties to limit the datarate.
2004-09-03 11:40:35 +00:00
|
|
|
g_param_spec_int ("datarate", "Datarate",
|
|
|
|
"(Re)timestamps buffers with number of bytes per second (0 = inactive)",
|
2008-03-22 14:56:17 +00:00
|
|
|
0, G_MAXINT, DEFAULT_DATARATE,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2006-05-11 18:10:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_SILENT,
|
gst/elements/: Added datarate properties to limit the datarate.
Original commit message from CVS:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_set_clock),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get), (gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_chain),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
Added datarate properties to limit the datarate.
2004-09-03 11:40:35 +00:00
|
|
|
g_param_spec_boolean ("silent", "silent", "silent", 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_SINGLE_SEGMENT,
|
gst/base/gstbasetransform.c: The event virtual method is now properly implemented, with a default handler
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_class_init),
(gst_base_transform_event), (gst_base_transform_eventfunc):
The event virtual method is now properly implemented, with a default
handler
Sub classes should call the parent_class event method. They should
return FALSE if they had a problem handling the given event, or don't
want GstBaseTransform to send that even downstream
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_event),
(gst_identity_transform_ip), (gst_identity_set_property),
(gst_identity_get_property):
* gst/elements/gstidentity.h:
Added the single-segment boolean property.
If set to TRUE, it will output a single segment of data, starting from
0, will eat up all incoming newsegment, and modify the timestamp of the
buffers accordingly
2005-11-29 14:47:07 +00:00
|
|
|
g_param_spec_boolean ("single-segment", "Single Segment",
|
2011-05-13 16:07:24 +00:00
|
|
|
"Timestamp buffers and eat segments so as to appear as one segment",
|
2008-03-22 14:56:17 +00:00
|
|
|
DEFAULT_SINGLE_SEGMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2010-10-07 16:53:18 +00:00
|
|
|
pspec_last_message = g_param_spec_string ("last-message", "last-message",
|
|
|
|
"last-message", NULL, 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 16:53:18 +00:00
|
|
|
pspec_last_message);
|
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, PROP_SYNC,
|
2004-06-18 14:05:55 +00:00
|
|
|
g_param_spec_boolean ("sync", "Synchronize",
|
2008-03-22 14:56:17 +00:00
|
|
|
"Synchronize to pipeline clock", DEFAULT_SYNC,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2007-03-09 14:20:25 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_CHECK_IMPERFECT_TIMESTAMP,
|
|
|
|
g_param_spec_boolean ("check-imperfect-timestamp",
|
|
|
|
"Check for discontiguous timestamps",
|
|
|
|
"Send element messages if timestamps and durations do not match up",
|
2008-03-22 14:56:17 +00:00
|
|
|
DEFAULT_CHECK_IMPERFECT_TIMESTAMP,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2007-03-09 14:20:25 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_CHECK_IMPERFECT_OFFSET,
|
|
|
|
g_param_spec_boolean ("check-imperfect-offset",
|
|
|
|
"Check for discontiguous offset",
|
|
|
|
"Send element messages if offset and offset_end do not match up",
|
2008-03-22 14:56:17 +00:00
|
|
|
DEFAULT_CHECK_IMPERFECT_OFFSET,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2007-11-21 13:27:50 +00:00
|
|
|
/**
|
|
|
|
* GstIdentity:signal-handoffs
|
|
|
|
*
|
|
|
|
* If set to #TRUE, the identity will emit a handoff signal when handling a buffer.
|
2013-12-07 14:38:19 +00:00
|
|
|
* When set to #FALSE, no signal will be emitted, which might improve performance.
|
2007-11-21 13:27:50 +00:00
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_SIGNAL_HANDOFFS,
|
|
|
|
g_param_spec_boolean ("signal-handoffs",
|
|
|
|
"Signal handoffs", "Send a signal before pushing the buffer",
|
2008-03-22 14:56:17 +00:00
|
|
|
DEFAULT_SIGNAL_HANDOFFS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2007-11-21 13:27:50 +00:00
|
|
|
|
|
|
|
/**
|
2006-01-04 12:41:35 +00:00
|
|
|
* GstIdentity::handoff:
|
|
|
|
* @identity: the identity instance
|
|
|
|
* @buffer: the buffer that just has been received
|
|
|
|
* @pad: the pad that received it
|
|
|
|
*
|
|
|
|
* This signal gets emitted before passing the buffer downstream.
|
|
|
|
*/
|
2001-07-11 15:51:40 +00:00
|
|
|
gst_identity_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 (GstIdentityClass, handoff), NULL, NULL,
|
2012-03-02 10:05:48 +00:00
|
|
|
g_cclosure_marshal_generic, G_TYPE_NONE, 1,
|
2012-02-21 11:12:21 +00:00
|
|
|
GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE);
|
2001-07-11 15:51:40 +00:00
|
|
|
|
2009-10-28 00:29:30 +00:00
|
|
|
gobject_class->finalize = gst_identity_finalize;
|
2004-06-18 14:05:55 +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
|
|
|
"Identity",
|
|
|
|
"Generic",
|
|
|
|
"Pass data without modification", "Erik Walthinsen <omega@cse.ogi.edu>");
|
2016-02-27 15:36:28 +00:00
|
|
|
gst_element_class_add_static_pad_template (gstelement_class, &srctemplate);
|
|
|
|
gst_element_class_add_static_pad_template (gstelement_class, &sinktemplate);
|
2011-04-18 16:07:06 +00:00
|
|
|
|
2011-12-02 12:19:38 +00:00
|
|
|
gstelement_class->change_state =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_identity_change_state);
|
2012-02-02 11:32:49 +00:00
|
|
|
|
2011-07-22 19:17:42 +00:00
|
|
|
gstbasetrans_class->sink_event = GST_DEBUG_FUNCPTR (gst_identity_sink_event);
|
docs/design/part-events.txt: Small update.
Original commit message from CVS:
* docs/design/part-events.txt:
Small update.
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_do_sync), (gst_base_sink_activate_push),
(gst_base_sink_activate_pull):
Some more comments.
* gst/elements/gstfakesrc.c: (gst_fake_src_class_init),
(gst_fake_src_create):
Fix handoff marshall.
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_transform_ip):
We're a real inplace element.
* gst/gstbus.c: (gst_bus_post):
Added some comments.
* tests/lat.c: (fakesrc), (fakesink), (simple), (queue), (main):
* tests/muxing/case1.c: (main):
* tests/sched/dynamic-pipeline.c: (main):
* tests/sched/interrupt1.c: (main):
* tests/sched/interrupt2.c: (main):
* tests/sched/interrupt3.c: (main):
* tests/sched/runxml.c: (main):
* tests/sched/sched-stress.c: (main):
* tests/seeking/seeking1.c: (event_received), (main):
* tests/threadstate/threadstate2.c: (bus_handler), (timeout_func),
(main):
* tests/threadstate/threadstate3.c: (main):
* tests/threadstate/threadstate4.c: (main):
* tests/threadstate/threadstate5.c: (main):
Fix the tests.
2005-07-22 11:47:10 +00:00
|
|
|
gstbasetrans_class->transform_ip =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_identity_transform_ip);
|
gst/: Added start/stop methods to transform base class so subclasses don't need to deal with state changes even.
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_base_init),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_setcaps), (gst_base_transform_handle_buffer),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_start),
(gst_identity_stop):
Added start/stop methods to transform base class so subclasses
don't need to deal with state changes even.
2005-03-31 10:10:55 +00:00
|
|
|
gstbasetrans_class->start = GST_DEBUG_FUNCPTR (gst_identity_start);
|
|
|
|
gstbasetrans_class->stop = GST_DEBUG_FUNCPTR (gst_identity_stop);
|
2014-07-01 17:17:11 +00:00
|
|
|
gstbasetrans_class->accept_caps =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_identity_accept_caps);
|
2015-04-20 23:24:45 +00:00
|
|
|
gstbasetrans_class->query = gst_identity_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_identity_init (GstIdentity * identity)
|
2000-11-25 14:18:47 +00:00
|
|
|
{
|
gst/elements/: Added datarate properties to limit the datarate.
Original commit message from CVS:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_set_clock),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get), (gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_chain),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
Added datarate properties to limit the datarate.
2004-09-03 11:40:35 +00:00
|
|
|
identity->sleep_time = DEFAULT_SLEEP_TIME;
|
|
|
|
identity->error_after = DEFAULT_ERROR_AFTER;
|
|
|
|
identity->drop_probability = DEFAULT_DROP_PROBABILITY;
|
2015-06-18 20:56:53 +00:00
|
|
|
identity->drop_buffer_flags = DEFAULT_DROP_BUFFER_FLAGS;
|
gst/elements/: Added datarate properties to limit the datarate.
Original commit message from CVS:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_set_clock),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get), (gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_chain),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
Added datarate properties to limit the datarate.
2004-09-03 11:40:35 +00:00
|
|
|
identity->datarate = DEFAULT_DATARATE;
|
|
|
|
identity->silent = DEFAULT_SILENT;
|
gst/base/gstbasetransform.c: The event virtual method is now properly implemented, with a default handler
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_class_init),
(gst_base_transform_event), (gst_base_transform_eventfunc):
The event virtual method is now properly implemented, with a default
handler
Sub classes should call the parent_class event method. They should
return FALSE if they had a problem handling the given event, or don't
want GstBaseTransform to send that even downstream
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_event),
(gst_identity_transform_ip), (gst_identity_set_property),
(gst_identity_get_property):
* gst/elements/gstidentity.h:
Added the single-segment boolean property.
If set to TRUE, it will output a single segment of data, starting from
0, will eat up all incoming newsegment, and modify the timestamp of the
buffers accordingly
2005-11-29 14:47:07 +00:00
|
|
|
identity->single_segment = DEFAULT_SINGLE_SEGMENT;
|
gst/elements/: Added datarate properties to limit the datarate.
Original commit message from CVS:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_set_clock),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get), (gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_chain),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
Added datarate properties to limit the datarate.
2004-09-03 11:40:35 +00:00
|
|
|
identity->sync = DEFAULT_SYNC;
|
2007-03-09 14:20:25 +00:00
|
|
|
identity->check_imperfect_timestamp = DEFAULT_CHECK_IMPERFECT_TIMESTAMP;
|
|
|
|
identity->check_imperfect_offset = DEFAULT_CHECK_IMPERFECT_OFFSET;
|
gst/elements/: Added datarate properties to limit the datarate.
Original commit message from CVS:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_set_clock),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get), (gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_chain),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
Added datarate properties to limit the datarate.
2004-09-03 11:40:35 +00:00
|
|
|
identity->dump = DEFAULT_DUMP;
|
2002-09-08 18:27:36 +00:00
|
|
|
identity->last_message = NULL;
|
2007-11-21 13:27:50 +00:00
|
|
|
identity->signal_handoffs = DEFAULT_SIGNAL_HANDOFFS;
|
2015-04-20 23:31:37 +00:00
|
|
|
g_cond_init (&identity->blocked_cond);
|
2010-10-07 16:53:18 +00:00
|
|
|
|
2010-09-09 14:11:41 +00:00
|
|
|
gst_base_transform_set_gap_aware (GST_BASE_TRANSFORM_CAST (identity), TRUE);
|
2009-05-31 20:27:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_identity_notify_last_message (GstIdentity * identity)
|
|
|
|
{
|
2010-10-07 16:53:18 +00:00
|
|
|
g_object_notify_by_pspec ((GObject *) identity, pspec_last_message);
|
2005-03-21 17:34:02 +00:00
|
|
|
}
|
|
|
|
|
2015-04-21 00:02:51 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_identity_do_sync (GstIdentity * identity, GstClockTime running_time)
|
|
|
|
{
|
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
|
|
|
|
|
|
|
if (identity->sync &&
|
|
|
|
GST_BASE_TRANSFORM_CAST (identity)->segment.format == GST_FORMAT_TIME) {
|
|
|
|
GstClock *clock;
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (identity);
|
|
|
|
|
|
|
|
while (identity->blocked)
|
|
|
|
g_cond_wait (&identity->blocked_cond, GST_OBJECT_GET_LOCK (identity));
|
|
|
|
|
|
|
|
|
|
|
|
if ((clock = GST_ELEMENT (identity)->clock)) {
|
|
|
|
GstClockReturn cret;
|
|
|
|
GstClockTime timestamp;
|
|
|
|
|
|
|
|
timestamp = running_time + GST_ELEMENT (identity)->base_time +
|
|
|
|
identity->upstream_latency;
|
|
|
|
|
|
|
|
/* save id if we need to unlock */
|
|
|
|
identity->clock_id = gst_clock_new_single_shot_id (clock, timestamp);
|
|
|
|
GST_OBJECT_UNLOCK (identity);
|
|
|
|
|
|
|
|
cret = gst_clock_id_wait (identity->clock_id, NULL);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (identity);
|
|
|
|
if (identity->clock_id) {
|
|
|
|
gst_clock_id_unref (identity->clock_id);
|
|
|
|
identity->clock_id = NULL;
|
|
|
|
}
|
|
|
|
if (cret == GST_CLOCK_UNSCHEDULED)
|
|
|
|
ret = GST_FLOW_EOS;
|
|
|
|
}
|
|
|
|
GST_OBJECT_UNLOCK (identity);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
static gboolean
|
2011-07-22 19:17:42 +00:00
|
|
|
gst_identity_sink_event (GstBaseTransform * trans, GstEvent * event)
|
2000-11-25 14:18:47 +00:00
|
|
|
{
|
2000-01-30 09:03:00 +00:00
|
|
|
GstIdentity *identity;
|
gst/base/gstbasetransform.c: The event virtual method is now properly implemented, with a default handler
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_class_init),
(gst_base_transform_event), (gst_base_transform_eventfunc):
The event virtual method is now properly implemented, with a default
handler
Sub classes should call the parent_class event method. They should
return FALSE if they had a problem handling the given event, or don't
want GstBaseTransform to send that even downstream
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_event),
(gst_identity_transform_ip), (gst_identity_set_property),
(gst_identity_get_property):
* gst/elements/gstidentity.h:
Added the single-segment boolean property.
If set to TRUE, it will output a single segment of data, starting from
0, will eat up all incoming newsegment, and modify the timestamp of the
buffers accordingly
2005-11-29 14:47:07 +00:00
|
|
|
gboolean ret = TRUE;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
identity = GST_IDENTITY (trans);
|
2001-04-20 19:21:51 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
if (!identity->silent) {
|
2005-10-12 09:02:42 +00:00
|
|
|
const GstStructure *s;
|
2012-01-27 10:01:27 +00:00
|
|
|
const gchar *tstr;
|
2005-10-12 09:02:42 +00:00
|
|
|
gchar *sstr;
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (identity);
|
2005-03-21 17:34:02 +00:00
|
|
|
g_free (identity->last_message);
|
2004-06-09 14:19:50 +00:00
|
|
|
|
2012-01-27 10:01:27 +00:00
|
|
|
tstr = gst_event_type_get_name (GST_EVENT_TYPE (event));
|
2005-10-12 09:02:42 +00:00
|
|
|
if ((s = gst_event_get_structure (event)))
|
|
|
|
sstr = gst_structure_to_string (s);
|
|
|
|
else
|
|
|
|
sstr = g_strdup ("");
|
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
identity->last_message =
|
2012-01-27 10:01:27 +00:00
|
|
|
g_strdup_printf ("event ******* (%s:%s) E (type: %s (%d), %s) %p",
|
|
|
|
GST_DEBUG_PAD_NAME (trans->sinkpad), tstr, GST_EVENT_TYPE (event),
|
|
|
|
sstr, event);
|
2005-10-12 09:02:42 +00:00
|
|
|
g_free (sstr);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (identity);
|
2004-06-09 14:19:50 +00:00
|
|
|
|
2009-05-31 20:27:40 +00:00
|
|
|
gst_identity_notify_last_message (identity);
|
2005-03-21 17:34:02 +00:00
|
|
|
}
|
gst/base/gstbasetransform.c: The event virtual method is now properly implemented, with a default handler
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_class_init),
(gst_base_transform_event), (gst_base_transform_eventfunc):
The event virtual method is now properly implemented, with a default
handler
Sub classes should call the parent_class event method. They should
return FALSE if they had a problem handling the given event, or don't
want GstBaseTransform to send that even downstream
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_event),
(gst_identity_transform_ip), (gst_identity_set_property),
(gst_identity_get_property):
* gst/elements/gstidentity.h:
Added the single-segment boolean property.
If set to TRUE, it will output a single segment of data, starting from
0, will eat up all incoming newsegment, and modify the timestamp of the
buffers accordingly
2005-11-29 14:47:07 +00:00
|
|
|
|
2011-05-13 16:07:24 +00:00
|
|
|
if (identity->single_segment && (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT)) {
|
2014-11-28 13:17:54 +00:00
|
|
|
if (!trans->have_segment) {
|
gst/base/gstbasetransform.c: The event virtual method is now properly implemented, with a default handler
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_class_init),
(gst_base_transform_event), (gst_base_transform_eventfunc):
The event virtual method is now properly implemented, with a default
handler
Sub classes should call the parent_class event method. They should
return FALSE if they had a problem handling the given event, or don't
want GstBaseTransform to send that even downstream
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_event),
(gst_identity_transform_ip), (gst_identity_set_property),
(gst_identity_get_property):
* gst/elements/gstidentity.h:
Added the single-segment boolean property.
If set to TRUE, it will output a single segment of data, starting from
0, will eat up all incoming newsegment, and modify the timestamp of the
buffers accordingly
2005-11-29 14:47:07 +00:00
|
|
|
GstEvent *news;
|
2011-05-13 16:07:24 +00:00
|
|
|
GstSegment segment;
|
gst/base/gstbasetransform.c: The event virtual method is now properly implemented, with a default handler
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_class_init),
(gst_base_transform_event), (gst_base_transform_eventfunc):
The event virtual method is now properly implemented, with a default
handler
Sub classes should call the parent_class event method. They should
return FALSE if they had a problem handling the given event, or don't
want GstBaseTransform to send that even downstream
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_event),
(gst_identity_transform_ip), (gst_identity_set_property),
(gst_identity_get_property):
* gst/elements/gstidentity.h:
Added the single-segment boolean property.
If set to TRUE, it will output a single segment of data, starting from
0, will eat up all incoming newsegment, and modify the timestamp of the
buffers accordingly
2005-11-29 14:47:07 +00:00
|
|
|
|
2011-05-18 14:56:13 +00:00
|
|
|
gst_event_copy_segment (event, &segment);
|
2011-07-22 19:17:42 +00:00
|
|
|
gst_event_copy_segment (event, &trans->segment);
|
|
|
|
trans->have_segment = TRUE;
|
gst/base/gstbasetransform.c: The event virtual method is now properly implemented, with a default handler
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_class_init),
(gst_base_transform_event), (gst_base_transform_eventfunc):
The event virtual method is now properly implemented, with a default
handler
Sub classes should call the parent_class event method. They should
return FALSE if they had a problem handling the given event, or don't
want GstBaseTransform to send that even downstream
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_event),
(gst_identity_transform_ip), (gst_identity_set_property),
(gst_identity_get_property):
* gst/elements/gstidentity.h:
Added the single-segment boolean property.
If set to TRUE, it will output a single segment of data, starting from
0, will eat up all incoming newsegment, and modify the timestamp of the
buffers accordingly
2005-11-29 14:47:07 +00:00
|
|
|
|
2011-05-13 16:07:24 +00:00
|
|
|
/* This is the first segment, send out a (0, -1) segment */
|
|
|
|
gst_segment_init (&segment, segment.format);
|
|
|
|
news = gst_event_new_segment (&segment);
|
gst/base/gstbasetransform.c: The event virtual method is now properly implemented, with a default handler
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_class_init),
(gst_base_transform_event), (gst_base_transform_eventfunc):
The event virtual method is now properly implemented, with a default
handler
Sub classes should call the parent_class event method. They should
return FALSE if they had a problem handling the given event, or don't
want GstBaseTransform to send that even downstream
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_event),
(gst_identity_transform_ip), (gst_identity_set_property),
(gst_identity_get_property):
* gst/elements/gstidentity.h:
Added the single-segment boolean property.
If set to TRUE, it will output a single segment of data, starting from
0, will eat up all incoming newsegment, and modify the timestamp of the
buffers accordingly
2005-11-29 14:47:07 +00:00
|
|
|
|
2011-11-17 11:40:45 +00:00
|
|
|
gst_pad_event_default (trans->sinkpad, GST_OBJECT_CAST (trans), news);
|
2012-09-25 13:06:43 +00:00
|
|
|
} else {
|
|
|
|
/* need to track segment for proper running time */
|
|
|
|
gst_event_copy_segment (event, &trans->segment);
|
gst/base/gstbasetransform.c: The event virtual method is now properly implemented, with a default handler
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_class_init),
(gst_base_transform_event), (gst_base_transform_eventfunc):
The event virtual method is now properly implemented, with a default
handler
Sub classes should call the parent_class event method. They should
return FALSE if they had a problem handling the given event, or don't
want GstBaseTransform to send that even downstream
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_event),
(gst_identity_transform_ip), (gst_identity_set_property),
(gst_identity_get_property):
* gst/elements/gstidentity.h:
Added the single-segment boolean property.
If set to TRUE, it will output a single segment of data, starting from
0, will eat up all incoming newsegment, and modify the timestamp of the
buffers accordingly
2005-11-29 14:47:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-21 00:02:51 +00:00
|
|
|
if (GST_EVENT_TYPE (event) == GST_EVENT_GAP &&
|
2012-09-19 13:14:35 +00:00
|
|
|
trans->have_segment && trans->segment.format == GST_FORMAT_TIME) {
|
|
|
|
GstClockTime start, dur;
|
|
|
|
|
|
|
|
gst_event_parse_gap (event, &start, &dur);
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (start)) {
|
|
|
|
start = gst_segment_to_running_time (&trans->segment,
|
|
|
|
GST_FORMAT_TIME, start);
|
2015-04-21 00:02:51 +00:00
|
|
|
|
|
|
|
gst_identity_do_sync (identity, start);
|
|
|
|
|
|
|
|
/* also transform GAP timestamp similar to buffer timestamps */
|
|
|
|
if (identity->single_segment) {
|
|
|
|
gst_event_unref (event);
|
|
|
|
event = gst_event_new_gap (start, dur);
|
|
|
|
}
|
2012-09-19 13:14:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-14 14:22:27 +00:00
|
|
|
/* Reset previous timestamp, duration and offsets on SEGMENT
|
2008-04-09 08:19:36 +00:00
|
|
|
* to prevent false warnings when checking for perfect streams */
|
2011-05-13 16:07:24 +00:00
|
|
|
if (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) {
|
2008-04-09 08:19:36 +00:00
|
|
|
identity->prev_timestamp = identity->prev_duration = GST_CLOCK_TIME_NONE;
|
|
|
|
identity->prev_offset = identity->prev_offset_end = GST_BUFFER_OFFSET_NONE;
|
|
|
|
}
|
|
|
|
|
2011-12-04 15:38:09 +00:00
|
|
|
if (identity->single_segment && GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) {
|
gst/base/gstbasetransform.c: The event virtual method is now properly implemented, with a default handler
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_class_init),
(gst_base_transform_event), (gst_base_transform_eventfunc):
The event virtual method is now properly implemented, with a default
handler
Sub classes should call the parent_class event method. They should
return FALSE if they had a problem handling the given event, or don't
want GstBaseTransform to send that even downstream
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_event),
(gst_identity_transform_ip), (gst_identity_set_property),
(gst_identity_get_property):
* gst/elements/gstidentity.h:
Added the single-segment boolean property.
If set to TRUE, it will output a single segment of data, starting from
0, will eat up all incoming newsegment, and modify the timestamp of the
buffers accordingly
2005-11-29 14:47:07 +00:00
|
|
|
/* eat up segments */
|
2011-07-22 19:17:42 +00:00
|
|
|
gst_event_unref (event);
|
|
|
|
ret = TRUE;
|
|
|
|
} else {
|
2011-12-04 15:38:09 +00:00
|
|
|
if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_START) {
|
|
|
|
GST_OBJECT_LOCK (identity);
|
|
|
|
if (identity->clock_id) {
|
|
|
|
GST_DEBUG_OBJECT (identity, "unlock clock wait");
|
|
|
|
gst_clock_id_unschedule (identity->clock_id);
|
|
|
|
}
|
|
|
|
GST_OBJECT_UNLOCK (identity);
|
2011-12-02 12:19:38 +00:00
|
|
|
}
|
|
|
|
|
2011-07-22 19:17:42 +00:00
|
|
|
ret = GST_BASE_TRANSFORM_CLASS (parent_class)->sink_event (trans, event);
|
gst/base/gstbasetransform.c: The event virtual method is now properly implemented, with a default handler
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_class_init),
(gst_base_transform_event), (gst_base_transform_eventfunc):
The event virtual method is now properly implemented, with a default
handler
Sub classes should call the parent_class event method. They should
return FALSE if they had a problem handling the given event, or don't
want GstBaseTransform to send that even downstream
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_event),
(gst_identity_transform_ip), (gst_identity_set_property),
(gst_identity_get_property):
* gst/elements/gstidentity.h:
Added the single-segment boolean property.
If set to TRUE, it will output a single segment of data, starting from
0, will eat up all incoming newsegment, and modify the timestamp of the
buffers accordingly
2005-11-29 14:47:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
2005-03-21 17:34:02 +00:00
|
|
|
}
|
|
|
|
|
2007-03-09 14:20:25 +00:00
|
|
|
static void
|
|
|
|
gst_identity_check_imperfect_timestamp (GstIdentity * identity, GstBuffer * buf)
|
|
|
|
{
|
|
|
|
GstClockTime timestamp = GST_BUFFER_TIMESTAMP (buf);
|
|
|
|
|
|
|
|
/* invalid timestamp drops us out of check. FIXME: maybe warn ? */
|
|
|
|
if (timestamp != GST_CLOCK_TIME_NONE) {
|
|
|
|
/* check if we had a previous buffer to compare to */
|
|
|
|
if (identity->prev_timestamp != GST_CLOCK_TIME_NONE &&
|
|
|
|
identity->prev_duration != GST_CLOCK_TIME_NONE) {
|
|
|
|
GstClockTime t_expected;
|
|
|
|
GstClockTimeDiff dt;
|
|
|
|
|
|
|
|
t_expected = identity->prev_timestamp + identity->prev_duration;
|
|
|
|
dt = GST_CLOCK_DIFF (t_expected, timestamp);
|
|
|
|
if (dt != 0) {
|
2007-03-07 16:58:42 +00:00
|
|
|
/*
|
2007-03-09 14:20:25 +00:00
|
|
|
* "imperfect-timestamp" bus message:
|
|
|
|
* @identity: the identity instance
|
2014-10-20 14:39:38 +00:00
|
|
|
* @delta: the GST_CLOCK_DIFF to the prev timestamp
|
2007-03-09 14:20:25 +00:00
|
|
|
* @prev-timestamp: the previous buffer timestamp
|
|
|
|
* @prev-duration: the previous buffer duration
|
|
|
|
* @prev-offset: the previous buffer offset
|
2007-03-07 16:58:42 +00:00
|
|
|
* @prev-offset-end: the previous buffer offset end
|
docs/: Correct fixxrefs options.
Original commit message from CVS:
* docs/gst/Makefile.am:
* docs/libs/Makefile.am:
Correct fixxrefs options.
* docs/plugins/Makefile.am:
* docs/plugins/gstreamer-plugins-docs.sgml:
* docs/plugins/gstreamer-plugins-sections.txt:
* plugins/elements/Makefile.am:
* plugins/elements/gstcapsfilter.c (gst_capsfilter_details):
* plugins/elements/gstcapsfilter.h (__GST_CAPSFILTER_H__,
GST_TYPE_CAPSFILTER, GST_CAPSFILTER, GST_CAPSFILTER_CLASS,
GST_IS_CAPSFILTER, GST_IS_CAPSFILTER_CLASS, GstCapsFilter,
GstCapsFilterClass, _GstCapsFilter, trans, filter_caps,
_GstCapsFilterClass, trans_class):
* plugins/elements/gstelements.c (name, rank, type, _elements):
* plugins/elements/gstidentity.c
(gst_identity_check_imperfect_timestamp,
gst_identity_check_imperfect_offset):
Document capsfilter and add doc-blurb to identity.
2007-05-06 18:27:25 +00:00
|
|
|
* @cur-timestamp: the current buffer timestamp
|
2007-03-09 14:20:25 +00:00
|
|
|
* @cur-duration: the current buffer duration
|
|
|
|
* @cur-offset: the current buffer offset
|
|
|
|
* @cur-offset-end: the current buffer offset end
|
2007-03-07 16:58:42 +00:00
|
|
|
*
|
2007-03-09 14:20:25 +00:00
|
|
|
* This bus message gets emitted if the check-imperfect-timestamp
|
|
|
|
* property is set and there is a gap in time between the
|
|
|
|
* last buffer and the newly received buffer.
|
2007-03-07 16:58:42 +00:00
|
|
|
*/
|
|
|
|
gst_element_post_message (GST_ELEMENT (identity),
|
|
|
|
gst_message_new_element (GST_OBJECT (identity),
|
2007-03-09 14:20:25 +00:00
|
|
|
gst_structure_new ("imperfect-timestamp",
|
2014-10-20 14:39:38 +00:00
|
|
|
"delta", G_TYPE_INT64, dt,
|
2007-03-09 14:20:25 +00:00
|
|
|
"prev-timestamp", G_TYPE_UINT64,
|
2007-03-07 17:02:51 +00:00
|
|
|
identity->prev_timestamp, "prev-duration", G_TYPE_UINT64,
|
|
|
|
identity->prev_duration, "prev-offset", G_TYPE_UINT64,
|
|
|
|
identity->prev_offset, "prev-offset-end", G_TYPE_UINT64,
|
|
|
|
identity->prev_offset_end, "cur-timestamp", G_TYPE_UINT64,
|
|
|
|
timestamp, "cur-duration", G_TYPE_UINT64,
|
2007-03-07 16:58:42 +00:00
|
|
|
GST_BUFFER_DURATION (buf), "cur-offset", G_TYPE_UINT64,
|
|
|
|
GST_BUFFER_OFFSET (buf), "cur-offset-end", G_TYPE_UINT64,
|
|
|
|
GST_BUFFER_OFFSET_END (buf), NULL)));
|
2004-06-26 13:08:03 +00:00
|
|
|
}
|
2006-12-16 19:33:26 +00:00
|
|
|
} else {
|
2007-03-09 14:20:25 +00:00
|
|
|
GST_DEBUG_OBJECT (identity, "can't check data-contiguity, no "
|
|
|
|
"offset_end was set on previous buffer");
|
2004-06-26 13:08:03 +00:00
|
|
|
}
|
2007-03-09 14:20:25 +00:00
|
|
|
}
|
|
|
|
}
|
2006-12-16 19:33:26 +00:00
|
|
|
|
2007-03-09 14:20:25 +00:00
|
|
|
static void
|
|
|
|
gst_identity_check_imperfect_offset (GstIdentity * identity, GstBuffer * buf)
|
|
|
|
{
|
|
|
|
guint64 offset;
|
|
|
|
|
|
|
|
offset = GST_BUFFER_OFFSET (buf);
|
|
|
|
|
|
|
|
if (identity->prev_offset_end != offset &&
|
2007-03-20 14:25:15 +00:00
|
|
|
identity->prev_offset_end != GST_BUFFER_OFFSET_NONE &&
|
|
|
|
offset != GST_BUFFER_OFFSET_NONE) {
|
2007-03-09 14:20:25 +00:00
|
|
|
/*
|
|
|
|
* "imperfect-offset" bus message:
|
|
|
|
* @identity: the identity instance
|
|
|
|
* @prev-timestamp: the previous buffer timestamp
|
|
|
|
* @prev-duration: the previous buffer duration
|
|
|
|
* @prev-offset: the previous buffer offset
|
|
|
|
* @prev-offset-end: the previous buffer offset end
|
docs/: Correct fixxrefs options.
Original commit message from CVS:
* docs/gst/Makefile.am:
* docs/libs/Makefile.am:
Correct fixxrefs options.
* docs/plugins/Makefile.am:
* docs/plugins/gstreamer-plugins-docs.sgml:
* docs/plugins/gstreamer-plugins-sections.txt:
* plugins/elements/Makefile.am:
* plugins/elements/gstcapsfilter.c (gst_capsfilter_details):
* plugins/elements/gstcapsfilter.h (__GST_CAPSFILTER_H__,
GST_TYPE_CAPSFILTER, GST_CAPSFILTER, GST_CAPSFILTER_CLASS,
GST_IS_CAPSFILTER, GST_IS_CAPSFILTER_CLASS, GstCapsFilter,
GstCapsFilterClass, _GstCapsFilter, trans, filter_caps,
_GstCapsFilterClass, trans_class):
* plugins/elements/gstelements.c (name, rank, type, _elements):
* plugins/elements/gstidentity.c
(gst_identity_check_imperfect_timestamp,
gst_identity_check_imperfect_offset):
Document capsfilter and add doc-blurb to identity.
2007-05-06 18:27:25 +00:00
|
|
|
* @cur-timestamp: the current buffer timestamp
|
2007-03-09 14:20:25 +00:00
|
|
|
* @cur-duration: the current buffer duration
|
|
|
|
* @cur-offset: the current buffer offset
|
|
|
|
* @cur-offset-end: the current buffer offset end
|
|
|
|
*
|
|
|
|
* This bus message gets emitted if the check-imperfect-offset
|
|
|
|
* property is set and there is a gap in offsets between the
|
|
|
|
* last buffer and the newly received buffer.
|
|
|
|
*/
|
|
|
|
gst_element_post_message (GST_ELEMENT (identity),
|
|
|
|
gst_message_new_element (GST_OBJECT (identity),
|
|
|
|
gst_structure_new ("imperfect-offset", "prev-timestamp",
|
|
|
|
G_TYPE_UINT64, identity->prev_timestamp, "prev-duration",
|
|
|
|
G_TYPE_UINT64, identity->prev_duration, "prev-offset",
|
|
|
|
G_TYPE_UINT64, identity->prev_offset, "prev-offset-end",
|
|
|
|
G_TYPE_UINT64, identity->prev_offset_end, "cur-timestamp",
|
|
|
|
G_TYPE_UINT64, GST_BUFFER_TIMESTAMP (buf), "cur-duration",
|
|
|
|
G_TYPE_UINT64, GST_BUFFER_DURATION (buf), "cur-offset",
|
|
|
|
G_TYPE_UINT64, GST_BUFFER_OFFSET (buf), "cur-offset-end",
|
|
|
|
G_TYPE_UINT64, GST_BUFFER_OFFSET_END (buf), NULL)));
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (identity, "can't check offset contiguity, no offset "
|
|
|
|
"and/or offset_end were set on previous buffer");
|
2004-06-26 13:08:03 +00:00
|
|
|
}
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
}
|
|
|
|
|
2011-01-27 09:28:07 +00:00
|
|
|
static const gchar *
|
|
|
|
print_pretty_time (gchar * ts_str, gsize ts_str_len, GstClockTime ts)
|
|
|
|
{
|
|
|
|
if (ts == GST_CLOCK_TIME_NONE)
|
|
|
|
return "none";
|
|
|
|
|
|
|
|
g_snprintf (ts_str, ts_str_len, "%" GST_TIME_FORMAT, GST_TIME_ARGS (ts));
|
|
|
|
return ts_str;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_identity_update_last_message_for_buffer (GstIdentity * identity,
|
2011-03-21 17:13:55 +00:00
|
|
|
const gchar * action, GstBuffer * buf, gsize size)
|
2011-01-27 09:28:07 +00:00
|
|
|
{
|
2012-02-21 11:43:18 +00:00
|
|
|
gchar dts_str[64], pts_str[64], dur_str[64];
|
2014-04-07 13:31:17 +00:00
|
|
|
gchar *flag_str;
|
2011-01-27 09:28:07 +00:00
|
|
|
|
|
|
|
GST_OBJECT_LOCK (identity);
|
|
|
|
|
2014-04-07 13:49:59 +00:00
|
|
|
flag_str = gst_buffer_get_flags_string (buf);
|
2011-12-06 13:55:11 +00:00
|
|
|
|
2011-01-27 09:28:07 +00:00
|
|
|
g_free (identity->last_message);
|
2011-12-06 13:55:11 +00:00
|
|
|
identity->last_message = g_strdup_printf ("%s ******* (%s:%s) "
|
2016-02-25 12:11:34 +00:00
|
|
|
"(%" G_GSIZE_FORMAT " bytes, dts: %s, pts: %s, duration: %s, offset: %"
|
2011-12-08 00:39:10 +00:00
|
|
|
G_GINT64_FORMAT ", " "offset_end: % " G_GINT64_FORMAT
|
2012-07-23 11:40:38 +00:00
|
|
|
", flags: %08x %s) %p", action,
|
2011-12-08 00:39:10 +00:00
|
|
|
GST_DEBUG_PAD_NAME (GST_BASE_TRANSFORM_CAST (identity)->sinkpad), size,
|
2012-02-21 11:43:18 +00:00
|
|
|
print_pretty_time (dts_str, sizeof (dts_str), GST_BUFFER_DTS (buf)),
|
|
|
|
print_pretty_time (pts_str, sizeof (pts_str), GST_BUFFER_PTS (buf)),
|
2011-01-27 09:28:07 +00:00
|
|
|
print_pretty_time (dur_str, sizeof (dur_str), GST_BUFFER_DURATION (buf)),
|
|
|
|
GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
|
2011-12-06 13:55:11 +00:00
|
|
|
GST_BUFFER_FLAGS (buf), flag_str, buf);
|
2014-04-07 13:31:17 +00:00
|
|
|
g_free (flag_str);
|
2011-01-27 09:28:07 +00:00
|
|
|
|
|
|
|
GST_OBJECT_UNLOCK (identity);
|
|
|
|
|
|
|
|
gst_identity_notify_last_message (identity);
|
|
|
|
}
|
|
|
|
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
static GstFlowReturn
|
docs/design/part-events.txt: Small update.
Original commit message from CVS:
* docs/design/part-events.txt:
Small update.
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_do_sync), (gst_base_sink_activate_push),
(gst_base_sink_activate_pull):
Some more comments.
* gst/elements/gstfakesrc.c: (gst_fake_src_class_init),
(gst_fake_src_create):
Fix handoff marshall.
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_transform_ip):
We're a real inplace element.
* gst/gstbus.c: (gst_bus_post):
Added some comments.
* tests/lat.c: (fakesrc), (fakesink), (simple), (queue), (main):
* tests/muxing/case1.c: (main):
* tests/sched/dynamic-pipeline.c: (main):
* tests/sched/interrupt1.c: (main):
* tests/sched/interrupt2.c: (main):
* tests/sched/interrupt3.c: (main):
* tests/sched/runxml.c: (main):
* tests/sched/sched-stress.c: (main):
* tests/seeking/seeking1.c: (event_received), (main):
* tests/threadstate/threadstate2.c: (bus_handler), (timeout_func),
(main):
* tests/threadstate/threadstate3.c: (main):
* tests/threadstate/threadstate4.c: (main):
* tests/threadstate/threadstate5.c: (main):
Fix the tests.
2005-07-22 11:47:10 +00:00
|
|
|
gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
{
|
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
|
|
|
GstIdentity *identity = GST_IDENTITY (trans);
|
2015-04-20 23:07:27 +00:00
|
|
|
GstClockTime rundts = GST_CLOCK_TIME_NONE;
|
|
|
|
GstClockTime runpts = GST_CLOCK_TIME_NONE;
|
2015-04-21 00:02:51 +00:00
|
|
|
GstClockTime ts, duration, runtimestamp;
|
2012-02-02 11:32:49 +00:00
|
|
|
gsize size;
|
2011-03-21 17:13:55 +00:00
|
|
|
|
2012-02-02 11:32:49 +00:00
|
|
|
size = gst_buffer_get_size (buf);
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
|
2007-03-09 14:20:25 +00:00
|
|
|
if (identity->check_imperfect_timestamp)
|
|
|
|
gst_identity_check_imperfect_timestamp (identity, buf);
|
|
|
|
if (identity->check_imperfect_offset)
|
|
|
|
gst_identity_check_imperfect_offset (identity, buf);
|
|
|
|
|
|
|
|
/* update prev values */
|
|
|
|
identity->prev_timestamp = GST_BUFFER_TIMESTAMP (buf);
|
|
|
|
identity->prev_duration = GST_BUFFER_DURATION (buf);
|
|
|
|
identity->prev_offset_end = GST_BUFFER_OFFSET_END (buf);
|
|
|
|
identity->prev_offset = GST_BUFFER_OFFSET (buf);
|
2004-06-26 13:08:03 +00:00
|
|
|
|
2001-12-27 00:40:50 +00:00
|
|
|
if (identity->error_after >= 0) {
|
|
|
|
identity->error_after--;
|
2011-03-21 17:13:55 +00:00
|
|
|
if (identity->error_after == 0)
|
|
|
|
goto error_after;
|
2001-12-27 00:40:50 +00:00
|
|
|
}
|
|
|
|
|
2002-01-01 13:46:04 +00:00
|
|
|
if (identity->drop_probability > 0.0) {
|
2011-03-21 17:13:55 +00:00
|
|
|
if ((gfloat) (1.0 * rand () / (RAND_MAX)) < identity->drop_probability)
|
|
|
|
goto dropped;
|
2002-01-01 13:46:04 +00:00
|
|
|
}
|
2005-03-21 17:34:02 +00:00
|
|
|
|
2015-06-18 20:56:53 +00:00
|
|
|
if (GST_BUFFER_FLAG_IS_SET (buf, identity->drop_buffer_flags))
|
|
|
|
goto dropped;
|
|
|
|
|
2002-03-31 14:04:50 +00:00
|
|
|
if (identity->dump) {
|
2012-02-02 11:32:49 +00:00
|
|
|
GstMapInfo info;
|
|
|
|
|
2014-04-16 09:39:15 +00:00
|
|
|
if (gst_buffer_map (buf, &info, GST_MAP_READ)) {
|
|
|
|
gst_util_dump_mem (info.data, info.size);
|
|
|
|
gst_buffer_unmap (buf, &info);
|
|
|
|
}
|
2002-03-31 14:04:50 +00:00
|
|
|
}
|
2002-01-01 13:46:04 +00:00
|
|
|
|
tests/network-clock.scm: Commentary update.
Original commit message from CVS:
2005-07-01 Andy Wingo <wingo@pobox.com>
* tests/network-clock.scm: Commentary update.
* gst/elements/gstidentity.c (PROP_DUPLICATE): Gone daddy gone.
Didn't really make sense, not implementable with basetransform,
etc.
(gst_identity_transform): Unref inbuf via make_writable. Feeble
attempt at implementing the sync property, needs an unlock method.
* gst/base/gstbasetransform.c (gst_base_transform_transform_caps):
New func, by default returns the same caps (the identity
transformation).
(gst_base_transform_getcaps): Uses transform_caps to return
something sensible.
(gst_base_transform_setcaps): Complicated logic to get caps on
both pads, even if they are different, and to call set_caps once
for every time both pads get their caps set.
(gst_base_transform_handle_buffer): Give the ref to the transform
function. Allows in-place modification of the buffer.
* gst/base/gstbasetransform.h (transform_caps): New class method.
Given caps on one side, what can I do on the other.
(set_caps): Take two caps, one for each side of the element.
* gst/gstpad.h:
* gst/gstpad.c (gst_pad_fixate_caps): Change prototype to modify
caps in place. This is safe because we can check the mutability of
the caps, and a good idea because fixate functions are just called
as a matter of last resort. (Not actually implemented.)
(gst_pad_set_caps): If the caps we're setting is actually the same
as the existing pad caps, just update the pointer without calling
setcaps. Assert that caps is either NULL or fixed, as per the
docs.
* gst/gstghostpad.c: Update for fixate changes.
2005-07-01 16:46:59 +00:00
|
|
|
if (!identity->silent) {
|
2012-02-02 11:32:49 +00:00
|
|
|
gst_identity_update_last_message_for_buffer (identity, "chain", buf, size);
|
tests/network-clock.scm: Commentary update.
Original commit message from CVS:
2005-07-01 Andy Wingo <wingo@pobox.com>
* tests/network-clock.scm: Commentary update.
* gst/elements/gstidentity.c (PROP_DUPLICATE): Gone daddy gone.
Didn't really make sense, not implementable with basetransform,
etc.
(gst_identity_transform): Unref inbuf via make_writable. Feeble
attempt at implementing the sync property, needs an unlock method.
* gst/base/gstbasetransform.c (gst_base_transform_transform_caps):
New func, by default returns the same caps (the identity
transformation).
(gst_base_transform_getcaps): Uses transform_caps to return
something sensible.
(gst_base_transform_setcaps): Complicated logic to get caps on
both pads, even if they are different, and to call set_caps once
for every time both pads get their caps set.
(gst_base_transform_handle_buffer): Give the ref to the transform
function. Allows in-place modification of the buffer.
* gst/base/gstbasetransform.h (transform_caps): New class method.
Given caps on one side, what can I do on the other.
(set_caps): Take two caps, one for each side of the element.
* gst/gstpad.h:
* gst/gstpad.c (gst_pad_fixate_caps): Change prototype to modify
caps in place. This is safe because we can check the mutability of
the caps, and a good idea because fixate functions are just called
as a matter of last resort. (Not actually implemented.)
(gst_pad_set_caps): If the caps we're setting is actually the same
as the existing pad caps, just update the pointer without calling
setcaps. Assert that caps is either NULL or fixed, as per the
docs.
* gst/gstghostpad.c: Update for fixate changes.
2005-07-01 16:46:59 +00:00
|
|
|
}
|
2004-10-05 08:52:37 +00:00
|
|
|
|
tests/network-clock.scm: Commentary update.
Original commit message from CVS:
2005-07-01 Andy Wingo <wingo@pobox.com>
* tests/network-clock.scm: Commentary update.
* gst/elements/gstidentity.c (PROP_DUPLICATE): Gone daddy gone.
Didn't really make sense, not implementable with basetransform,
etc.
(gst_identity_transform): Unref inbuf via make_writable. Feeble
attempt at implementing the sync property, needs an unlock method.
* gst/base/gstbasetransform.c (gst_base_transform_transform_caps):
New func, by default returns the same caps (the identity
transformation).
(gst_base_transform_getcaps): Uses transform_caps to return
something sensible.
(gst_base_transform_setcaps): Complicated logic to get caps on
both pads, even if they are different, and to call set_caps once
for every time both pads get their caps set.
(gst_base_transform_handle_buffer): Give the ref to the transform
function. Allows in-place modification of the buffer.
* gst/base/gstbasetransform.h (transform_caps): New class method.
Given caps on one side, what can I do on the other.
(set_caps): Take two caps, one for each side of the element.
* gst/gstpad.h:
* gst/gstpad.c (gst_pad_fixate_caps): Change prototype to modify
caps in place. This is safe because we can check the mutability of
the caps, and a good idea because fixate functions are just called
as a matter of last resort. (Not actually implemented.)
(gst_pad_set_caps): If the caps we're setting is actually the same
as the existing pad caps, just update the pointer without calling
setcaps. Assert that caps is either NULL or fixed, as per the
docs.
* gst/gstghostpad.c: Update for fixate changes.
2005-07-01 16:46:59 +00:00
|
|
|
if (identity->datarate > 0) {
|
2007-06-08 11:00:59 +00:00
|
|
|
GstClockTime time = gst_util_uint64_scale_int (identity->offset,
|
|
|
|
GST_SECOND, identity->datarate);
|
gst/elements/: Added datarate properties to limit the datarate.
Original commit message from CVS:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_set_clock),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get), (gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_chain),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
Added datarate properties to limit the datarate.
2004-09-03 11:40:35 +00:00
|
|
|
|
2012-09-26 08:54:06 +00:00
|
|
|
GST_BUFFER_PTS (buf) = GST_BUFFER_DTS (buf) = time;
|
2012-02-02 11:32:49 +00:00
|
|
|
GST_BUFFER_DURATION (buf) = size * GST_SECOND / identity->datarate;
|
tests/network-clock.scm: Commentary update.
Original commit message from CVS:
2005-07-01 Andy Wingo <wingo@pobox.com>
* tests/network-clock.scm: Commentary update.
* gst/elements/gstidentity.c (PROP_DUPLICATE): Gone daddy gone.
Didn't really make sense, not implementable with basetransform,
etc.
(gst_identity_transform): Unref inbuf via make_writable. Feeble
attempt at implementing the sync property, needs an unlock method.
* gst/base/gstbasetransform.c (gst_base_transform_transform_caps):
New func, by default returns the same caps (the identity
transformation).
(gst_base_transform_getcaps): Uses transform_caps to return
something sensible.
(gst_base_transform_setcaps): Complicated logic to get caps on
both pads, even if they are different, and to call set_caps once
for every time both pads get their caps set.
(gst_base_transform_handle_buffer): Give the ref to the transform
function. Allows in-place modification of the buffer.
* gst/base/gstbasetransform.h (transform_caps): New class method.
Given caps on one side, what can I do on the other.
(set_caps): Take two caps, one for each side of the element.
* gst/gstpad.h:
* gst/gstpad.c (gst_pad_fixate_caps): Change prototype to modify
caps in place. This is safe because we can check the mutability of
the caps, and a good idea because fixate functions are just called
as a matter of last resort. (Not actually implemented.)
(gst_pad_set_caps): If the caps we're setting is actually the same
as the existing pad caps, just update the pointer without calling
setcaps. Assert that caps is either NULL or fixed, as per the
docs.
* gst/gstghostpad.c: Update for fixate changes.
2005-07-01 16:46:59 +00:00
|
|
|
}
|
gst/elements/: Added datarate properties to limit the datarate.
Original commit message from CVS:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_set_clock),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get), (gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_chain),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
Added datarate properties to limit the datarate.
2004-09-03 11:40:35 +00:00
|
|
|
|
2007-11-21 13:27:50 +00:00
|
|
|
if (identity->signal_handoffs)
|
2009-10-03 19:49:54 +00:00
|
|
|
g_signal_emit (identity, gst_identity_signals[SIGNAL_HANDOFF], 0, buf);
|
gst/elements/: Added datarate properties to limit the datarate.
Original commit message from CVS:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_set_clock),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get), (gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_chain),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
Added datarate properties to limit the datarate.
2004-09-03 11:40:35 +00:00
|
|
|
|
2015-04-20 23:07:27 +00:00
|
|
|
if (trans->segment.format == GST_FORMAT_TIME) {
|
|
|
|
rundts = gst_segment_to_running_time (&trans->segment,
|
|
|
|
GST_FORMAT_TIME, GST_BUFFER_DTS (buf));
|
|
|
|
runpts = gst_segment_to_running_time (&trans->segment,
|
|
|
|
GST_FORMAT_TIME, GST_BUFFER_PTS (buf));
|
|
|
|
}
|
gst/base/gstbasetransform.c: The event virtual method is now properly implemented, with a default handler
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_class_init),
(gst_base_transform_event), (gst_base_transform_eventfunc):
The event virtual method is now properly implemented, with a default
handler
Sub classes should call the parent_class event method. They should
return FALSE if they had a problem handling the given event, or don't
want GstBaseTransform to send that even downstream
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_event),
(gst_identity_transform_ip), (gst_identity_set_property),
(gst_identity_get_property):
* gst/elements/gstidentity.h:
Added the single-segment boolean property.
If set to TRUE, it will output a single segment of data, starting from
0, will eat up all incoming newsegment, and modify the timestamp of the
buffers accordingly
2005-11-29 14:47:07 +00:00
|
|
|
|
2015-04-21 00:02:51 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (rundts))
|
|
|
|
runtimestamp = rundts;
|
|
|
|
else if (GST_CLOCK_TIME_IS_VALID (runpts))
|
|
|
|
runtimestamp = runpts;
|
|
|
|
else
|
|
|
|
runtimestamp = 0;
|
|
|
|
ret = gst_identity_do_sync (identity, runtimestamp);
|
gst/elements/: Added datarate properties to limit the datarate.
Original commit message from CVS:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_set_clock),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get), (gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_chain),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
Added datarate properties to limit the datarate.
2004-09-03 11:40:35 +00:00
|
|
|
|
2012-02-02 11:32:49 +00:00
|
|
|
identity->offset += size;
|
2001-01-07 03:42:27 +00:00
|
|
|
|
tests/network-clock.scm: Commentary update.
Original commit message from CVS:
2005-07-01 Andy Wingo <wingo@pobox.com>
* tests/network-clock.scm: Commentary update.
* gst/elements/gstidentity.c (PROP_DUPLICATE): Gone daddy gone.
Didn't really make sense, not implementable with basetransform,
etc.
(gst_identity_transform): Unref inbuf via make_writable. Feeble
attempt at implementing the sync property, needs an unlock method.
* gst/base/gstbasetransform.c (gst_base_transform_transform_caps):
New func, by default returns the same caps (the identity
transformation).
(gst_base_transform_getcaps): Uses transform_caps to return
something sensible.
(gst_base_transform_setcaps): Complicated logic to get caps on
both pads, even if they are different, and to call set_caps once
for every time both pads get their caps set.
(gst_base_transform_handle_buffer): Give the ref to the transform
function. Allows in-place modification of the buffer.
* gst/base/gstbasetransform.h (transform_caps): New class method.
Given caps on one side, what can I do on the other.
(set_caps): Take two caps, one for each side of the element.
* gst/gstpad.h:
* gst/gstpad.c (gst_pad_fixate_caps): Change prototype to modify
caps in place. This is safe because we can check the mutability of
the caps, and a good idea because fixate functions are just called
as a matter of last resort. (Not actually implemented.)
(gst_pad_set_caps): If the caps we're setting is actually the same
as the existing pad caps, just update the pointer without calling
setcaps. Assert that caps is either NULL or fixed, as per the
docs.
* gst/gstghostpad.c: Update for fixate changes.
2005-07-01 16:46:59 +00:00
|
|
|
if (identity->sleep_time && ret == GST_FLOW_OK)
|
|
|
|
g_usleep (identity->sleep_time);
|
2005-03-21 17:34:02 +00:00
|
|
|
|
2005-11-29 17:13:44 +00:00
|
|
|
if (identity->single_segment && (trans->segment.format == GST_FORMAT_TIME)
|
2006-01-10 15:42:29 +00:00
|
|
|
&& (ret == GST_FLOW_OK)) {
|
2015-04-20 23:07:27 +00:00
|
|
|
GST_BUFFER_DTS (buf) = rundts;
|
|
|
|
GST_BUFFER_PTS (buf) = runpts;
|
2006-01-10 15:42:29 +00:00
|
|
|
GST_BUFFER_OFFSET (buf) = GST_CLOCK_TIME_NONE;
|
|
|
|
GST_BUFFER_OFFSET_END (buf) = GST_CLOCK_TIME_NONE;
|
|
|
|
}
|
gst/base/gstbasetransform.c: The event virtual method is now properly implemented, with a default handler
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_class_init),
(gst_base_transform_event), (gst_base_transform_eventfunc):
The event virtual method is now properly implemented, with a default
handler
Sub classes should call the parent_class event method. They should
return FALSE if they had a problem handling the given event, or don't
want GstBaseTransform to send that even downstream
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_event),
(gst_identity_transform_ip), (gst_identity_set_property),
(gst_identity_get_property):
* gst/elements/gstidentity.h:
Added the single-segment boolean property.
If set to TRUE, it will output a single segment of data, starting from
0, will eat up all incoming newsegment, and modify the timestamp of the
buffers accordingly
2005-11-29 14:47:07 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
return ret;
|
2011-03-21 17:13:55 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
error_after:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (identity, CORE, FAILED,
|
|
|
|
(_("Failed after iterations as requested.")), (NULL));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
dropped:
|
|
|
|
{
|
|
|
|
if (!identity->silent) {
|
|
|
|
gst_identity_update_last_message_for_buffer (identity, "dropping", buf,
|
2012-02-02 11:32:49 +00:00
|
|
|
size);
|
2011-03-21 17:13:55 +00:00
|
|
|
}
|
2015-01-14 10:52:11 +00:00
|
|
|
|
|
|
|
ts = GST_BUFFER_TIMESTAMP (buf);
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (ts)) {
|
|
|
|
duration = GST_BUFFER_DURATION (buf);
|
|
|
|
gst_pad_push_event (GST_BASE_TRANSFORM_SRC_PAD (identity),
|
|
|
|
gst_event_new_gap (ts, duration));
|
|
|
|
}
|
|
|
|
|
2011-03-21 17:13:55 +00:00
|
|
|
/* return DROPPED to basetransform. */
|
|
|
|
return GST_BASE_TRANSFORM_FLOW_DROPPED;
|
|
|
|
}
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void
|
|
|
|
gst_identity_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
2000-11-25 14:18:47 +00:00
|
|
|
{
|
2000-01-30 09:03:00 +00:00
|
|
|
GstIdentity *identity;
|
|
|
|
|
2000-11-25 14:18:47 +00:00
|
|
|
identity = GST_IDENTITY (object);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2001-06-25 01:20:11 +00:00
|
|
|
switch (prop_id) {
|
2005-03-21 17:34:02 +00:00
|
|
|
case PROP_SLEEP_TIME:
|
2001-06-25 01:20:11 +00:00
|
|
|
identity->sleep_time = g_value_get_uint (value);
|
2001-01-07 03:42:27 +00:00
|
|
|
break;
|
2005-03-21 17:34:02 +00:00
|
|
|
case PROP_SILENT:
|
2001-06-25 01:20:11 +00:00
|
|
|
identity->silent = g_value_get_boolean (value);
|
2001-04-20 19:21:51 +00:00
|
|
|
break;
|
gst/base/gstbasetransform.c: The event virtual method is now properly implemented, with a default handler
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_class_init),
(gst_base_transform_event), (gst_base_transform_eventfunc):
The event virtual method is now properly implemented, with a default
handler
Sub classes should call the parent_class event method. They should
return FALSE if they had a problem handling the given event, or don't
want GstBaseTransform to send that even downstream
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_event),
(gst_identity_transform_ip), (gst_identity_set_property),
(gst_identity_get_property):
* gst/elements/gstidentity.h:
Added the single-segment boolean property.
If set to TRUE, it will output a single segment of data, starting from
0, will eat up all incoming newsegment, and modify the timestamp of the
buffers accordingly
2005-11-29 14:47:07 +00:00
|
|
|
case PROP_SINGLE_SEGMENT:
|
|
|
|
identity->single_segment = g_value_get_boolean (value);
|
|
|
|
break;
|
2005-03-21 17:34:02 +00:00
|
|
|
case PROP_DUMP:
|
2002-03-31 14:04:50 +00:00
|
|
|
identity->dump = g_value_get_boolean (value);
|
|
|
|
break;
|
2005-03-21 17:34:02 +00:00
|
|
|
case PROP_ERROR_AFTER:
|
2002-04-14 09:59:13 +00:00
|
|
|
identity->error_after = g_value_get_int (value);
|
2001-12-27 00:40:50 +00:00
|
|
|
break;
|
2005-03-21 17:34:02 +00:00
|
|
|
case PROP_DROP_PROBABILITY:
|
2002-01-01 13:46:04 +00:00
|
|
|
identity->drop_probability = g_value_get_float (value);
|
|
|
|
break;
|
2015-06-18 20:56:53 +00:00
|
|
|
case PROP_DROP_BUFFER_FLAGS:
|
|
|
|
identity->drop_buffer_flags = g_value_get_flags (value);
|
|
|
|
break;
|
2005-03-21 17:34:02 +00:00
|
|
|
case PROP_DATARATE:
|
gst/elements/: Added datarate properties to limit the datarate.
Original commit message from CVS:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_set_clock),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get), (gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_chain),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
Added datarate properties to limit the datarate.
2004-09-03 11:40:35 +00:00
|
|
|
identity->datarate = g_value_get_int (value);
|
|
|
|
break;
|
2005-03-21 17:34:02 +00:00
|
|
|
case PROP_SYNC:
|
2004-06-18 14:05:55 +00:00
|
|
|
identity->sync = g_value_get_boolean (value);
|
|
|
|
break;
|
2007-03-09 14:20:25 +00:00
|
|
|
case PROP_CHECK_IMPERFECT_TIMESTAMP:
|
|
|
|
identity->check_imperfect_timestamp = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case PROP_CHECK_IMPERFECT_OFFSET:
|
|
|
|
identity->check_imperfect_offset = g_value_get_boolean (value);
|
|
|
|
break;
|
2007-11-21 13:27:50 +00:00
|
|
|
case PROP_SIGNAL_HANDOFFS:
|
|
|
|
identity->signal_handoffs = g_value_get_boolean (value);
|
|
|
|
break;
|
2000-01-30 09:03:00 +00:00
|
|
|
default:
|
2004-04-20 16:25:41 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
2000-01-30 09:03:00 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-02-02 12:15:24 +00:00
|
|
|
if (identity->datarate > 0 || identity->single_segment)
|
|
|
|
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (identity), FALSE);
|
|
|
|
else
|
|
|
|
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (identity), TRUE);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void
|
|
|
|
gst_identity_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
|
|
|
{
|
2000-01-30 09:03:00 +00:00
|
|
|
GstIdentity *identity;
|
|
|
|
|
2000-11-25 14:18:47 +00:00
|
|
|
identity = GST_IDENTITY (object);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2001-06-25 01:20:11 +00:00
|
|
|
switch (prop_id) {
|
2005-03-21 17:34:02 +00:00
|
|
|
case PROP_SLEEP_TIME:
|
2001-06-25 01:20:11 +00:00
|
|
|
g_value_set_uint (value, identity->sleep_time);
|
2001-01-07 03:42:27 +00:00
|
|
|
break;
|
2005-03-21 17:34:02 +00:00
|
|
|
case PROP_ERROR_AFTER:
|
2002-04-14 09:59:13 +00:00
|
|
|
g_value_set_int (value, identity->error_after);
|
2001-12-27 00:40:50 +00:00
|
|
|
break;
|
2005-03-21 17:34:02 +00:00
|
|
|
case PROP_DROP_PROBABILITY:
|
2002-01-01 13:46:04 +00:00
|
|
|
g_value_set_float (value, identity->drop_probability);
|
|
|
|
break;
|
2015-06-18 20:56:53 +00:00
|
|
|
case PROP_DROP_BUFFER_FLAGS:
|
|
|
|
g_value_set_flags (value, identity->drop_buffer_flags);
|
|
|
|
break;
|
2005-03-21 17:34:02 +00:00
|
|
|
case PROP_DATARATE:
|
gst/elements/: Added datarate properties to limit the datarate.
Original commit message from CVS:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_set_clock),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get), (gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_chain),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
Added datarate properties to limit the datarate.
2004-09-03 11:40:35 +00:00
|
|
|
g_value_set_int (value, identity->datarate);
|
|
|
|
break;
|
2005-03-21 17:34:02 +00:00
|
|
|
case PROP_SILENT:
|
2001-06-25 01:20:11 +00:00
|
|
|
g_value_set_boolean (value, identity->silent);
|
2001-04-20 19:21:51 +00:00
|
|
|
break;
|
gst/base/gstbasetransform.c: The event virtual method is now properly implemented, with a default handler
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_class_init),
(gst_base_transform_event), (gst_base_transform_eventfunc):
The event virtual method is now properly implemented, with a default
handler
Sub classes should call the parent_class event method. They should
return FALSE if they had a problem handling the given event, or don't
want GstBaseTransform to send that even downstream
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_event),
(gst_identity_transform_ip), (gst_identity_set_property),
(gst_identity_get_property):
* gst/elements/gstidentity.h:
Added the single-segment boolean property.
If set to TRUE, it will output a single segment of data, starting from
0, will eat up all incoming newsegment, and modify the timestamp of the
buffers accordingly
2005-11-29 14:47:07 +00:00
|
|
|
case PROP_SINGLE_SEGMENT:
|
|
|
|
g_value_set_boolean (value, identity->single_segment);
|
|
|
|
break;
|
2005-03-21 17:34:02 +00:00
|
|
|
case PROP_DUMP:
|
2002-03-31 14:04:50 +00:00
|
|
|
g_value_set_boolean (value, identity->dump);
|
|
|
|
break;
|
2005-03-21 17:34:02 +00:00
|
|
|
case PROP_LAST_MESSAGE:
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (identity);
|
2002-02-17 06:00:20 +00:00
|
|
|
g_value_set_string (value, identity->last_message);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (identity);
|
2002-02-17 06:00:20 +00:00
|
|
|
break;
|
2005-03-21 17:34:02 +00:00
|
|
|
case PROP_SYNC:
|
2004-06-18 14:05:55 +00:00
|
|
|
g_value_set_boolean (value, identity->sync);
|
|
|
|
break;
|
2007-03-09 14:20:25 +00:00
|
|
|
case PROP_CHECK_IMPERFECT_TIMESTAMP:
|
|
|
|
g_value_set_boolean (value, identity->check_imperfect_timestamp);
|
|
|
|
break;
|
|
|
|
case PROP_CHECK_IMPERFECT_OFFSET:
|
|
|
|
g_value_set_boolean (value, identity->check_imperfect_offset);
|
|
|
|
break;
|
2007-11-21 13:27:50 +00:00
|
|
|
case PROP_SIGNAL_HANDOFFS:
|
|
|
|
g_value_set_boolean (value, identity->signal_handoffs);
|
|
|
|
break;
|
2000-01-30 09:03:00 +00:00
|
|
|
default:
|
2001-06-25 01:20:11 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
2000-01-30 09:03:00 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
gst/elements/: Added datarate properties to limit the datarate.
Original commit message from CVS:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_set_clock),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get), (gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_chain),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
Added datarate properties to limit the datarate.
2004-09-03 11:40:35 +00:00
|
|
|
|
gst/: Added start/stop methods to transform base class so subclasses don't need to deal with state changes even.
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_base_init),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_setcaps), (gst_base_transform_handle_buffer),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_start),
(gst_identity_stop):
Added start/stop methods to transform base class so subclasses
don't need to deal with state changes even.
2005-03-31 10:10:55 +00:00
|
|
|
static gboolean
|
|
|
|
gst_identity_start (GstBaseTransform * trans)
|
gst/elements/: Added datarate properties to limit the datarate.
Original commit message from CVS:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_set_clock),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get), (gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_chain),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
Added datarate properties to limit the datarate.
2004-09-03 11:40:35 +00:00
|
|
|
{
|
|
|
|
GstIdentity *identity;
|
|
|
|
|
gst/: Added start/stop methods to transform base class so subclasses don't need to deal with state changes even.
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_base_init),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_setcaps), (gst_base_transform_handle_buffer),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_start),
(gst_identity_stop):
Added start/stop methods to transform base class so subclasses
don't need to deal with state changes even.
2005-03-31 10:10:55 +00:00
|
|
|
identity = GST_IDENTITY (trans);
|
gst/elements/: Added datarate properties to limit the datarate.
Original commit message from CVS:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_set_clock),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get), (gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_chain),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
Added datarate properties to limit the datarate.
2004-09-03 11:40:35 +00:00
|
|
|
|
gst/: Added start/stop methods to transform base class so subclasses don't need to deal with state changes even.
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_base_init),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_setcaps), (gst_base_transform_handle_buffer),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_start),
(gst_identity_stop):
Added start/stop methods to transform base class so subclasses
don't need to deal with state changes even.
2005-03-31 10:10:55 +00:00
|
|
|
identity->offset = 0;
|
|
|
|
identity->prev_timestamp = GST_CLOCK_TIME_NONE;
|
|
|
|
identity->prev_duration = GST_CLOCK_TIME_NONE;
|
2008-04-09 08:19:36 +00:00
|
|
|
identity->prev_offset_end = GST_BUFFER_OFFSET_NONE;
|
|
|
|
identity->prev_offset = GST_BUFFER_OFFSET_NONE;
|
gst/elements/: Added datarate properties to limit the datarate.
Original commit message from CVS:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_set_clock),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get), (gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_chain),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
Added datarate properties to limit the datarate.
2004-09-03 11:40:35 +00:00
|
|
|
|
gst/: Added start/stop methods to transform base class so subclasses don't need to deal with state changes even.
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_base_init),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_setcaps), (gst_base_transform_handle_buffer),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_start),
(gst_identity_stop):
Added start/stop methods to transform base class so subclasses
don't need to deal with state changes even.
2005-03-31 10:10:55 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_identity_stop (GstBaseTransform * trans)
|
|
|
|
{
|
|
|
|
GstIdentity *identity;
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
|
gst/: Added start/stop methods to transform base class so subclasses don't need to deal with state changes even.
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_base_init),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_setcaps), (gst_base_transform_handle_buffer),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_start),
(gst_identity_stop):
Added start/stop methods to transform base class so subclasses
don't need to deal with state changes even.
2005-03-31 10:10:55 +00:00
|
|
|
identity = GST_IDENTITY (trans);
|
gst/: Simplify pad activation.
Original commit message from CVS:
* gst/base/Makefile.am:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_basesink_get_type),
(gst_basesink_base_init), (gst_basesink_class_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_activate), (gst_basesink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasetransform.c: (gst_base_transform_get_type),
(gst_base_transform_base_init), (gst_base_transform_finalize),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_proxy_getcaps), (gst_base_transform_setcaps),
(gst_base_transform_event), (gst_base_transform_getrange),
(gst_base_transform_chain), (gst_base_transform_handle_buffer),
(gst_base_transform_set_property),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_set_property),
(gst_identity_get_property), (gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_lost_state), (gst_element_pads_activate):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_check_pull_range), (gst_pad_pull_range):
* gst/gstpad.h:
Simplify pad activation.
Added function to check if pull_range can be performed.
Error out when pulling inactive or flushing pads.
Removed const from refcounted types as it does not make sense.
Simplify pad templates in basesink
Added base class for simple 1-to-1 transforms.
Make identity subclass the base transform.
2005-03-29 16:18:12 +00:00
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (identity);
|
gst/: Added start/stop methods to transform base class so subclasses don't need to deal with state changes even.
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_base_init),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_setcaps), (gst_base_transform_handle_buffer),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_start),
(gst_identity_stop):
Added start/stop methods to transform base class so subclasses
don't need to deal with state changes even.
2005-03-31 10:10:55 +00:00
|
|
|
g_free (identity->last_message);
|
|
|
|
identity->last_message = NULL;
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (identity);
|
gst/elements/: Added datarate properties to limit the datarate.
Original commit message from CVS:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_set_clock),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get), (gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_chain),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
Added datarate properties to limit the datarate.
2004-09-03 11:40:35 +00:00
|
|
|
|
gst/: Added start/stop methods to transform base class so subclasses don't need to deal with state changes even.
Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_base_init),
(gst_base_transform_class_init), (gst_base_transform_init),
(gst_base_transform_setcaps), (gst_base_transform_handle_buffer),
(gst_base_transform_get_property),
(gst_base_transform_sink_activate),
(gst_base_transform_src_activate),
(gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_event), (gst_identity_check_perfect),
(gst_identity_transform), (gst_identity_start),
(gst_identity_stop):
Added start/stop methods to transform base class so subclasses
don't need to deal with state changes even.
2005-03-31 10:10:55 +00:00
|
|
|
return TRUE;
|
gst/elements/: Added datarate properties to limit the datarate.
Original commit message from CVS:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_set_clock),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get), (gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_class_init),
(gst_identity_init), (gst_identity_chain),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
Added datarate properties to limit the datarate.
2004-09-03 11:40:35 +00:00
|
|
|
}
|
2011-12-02 12:19:38 +00:00
|
|
|
|
2014-07-01 17:17:11 +00:00
|
|
|
static gboolean
|
|
|
|
gst_identity_accept_caps (GstBaseTransform * base,
|
|
|
|
GstPadDirection direction, GstCaps * caps)
|
|
|
|
{
|
|
|
|
gboolean ret;
|
|
|
|
GstPad *pad;
|
|
|
|
|
|
|
|
/* Proxy accept-caps */
|
|
|
|
|
|
|
|
if (direction == GST_PAD_SRC)
|
|
|
|
pad = GST_BASE_TRANSFORM_SINK_PAD (base);
|
|
|
|
else
|
|
|
|
pad = GST_BASE_TRANSFORM_SRC_PAD (base);
|
|
|
|
|
|
|
|
ret = gst_pad_peer_query_accept_caps (pad, caps);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-04-20 23:24:45 +00:00
|
|
|
static gboolean
|
|
|
|
gst_identity_query (GstBaseTransform * base, GstPadDirection direction,
|
|
|
|
GstQuery * query)
|
|
|
|
{
|
|
|
|
GstIdentity *identity;
|
|
|
|
gboolean ret;
|
|
|
|
|
|
|
|
identity = GST_IDENTITY (base);
|
|
|
|
|
|
|
|
ret = GST_BASE_TRANSFORM_CLASS (parent_class)->query (base, direction, query);
|
|
|
|
|
|
|
|
if (GST_QUERY_TYPE (query) == GST_QUERY_LATENCY) {
|
|
|
|
gboolean live = FALSE;
|
|
|
|
GstClockTime min = 0, max = 0;
|
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
gst_query_parse_latency (query, &live, &min, &max);
|
|
|
|
|
|
|
|
if (identity->sync && max < min) {
|
|
|
|
GST_ELEMENT_WARNING (base, CORE, CLOCK, (NULL),
|
|
|
|
("Impossible to configure latency before identity sync=true:"
|
|
|
|
" max %" GST_TIME_FORMAT " < min %"
|
|
|
|
GST_TIME_FORMAT ". Add queues or other buffering elements.",
|
|
|
|
GST_TIME_ARGS (max), GST_TIME_ARGS (min)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Ignore the upstream latency if it is not live */
|
|
|
|
GST_OBJECT_LOCK (identity);
|
|
|
|
if (live)
|
|
|
|
identity->upstream_latency = min;
|
|
|
|
else
|
|
|
|
identity->upstream_latency = 0;
|
|
|
|
GST_OBJECT_UNLOCK (identity);
|
|
|
|
|
|
|
|
gst_query_set_latency (query, live || identity->sync, min, max);
|
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-12-02 12:19:38 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_identity_change_state (GstElement * element, GstStateChange transition)
|
|
|
|
{
|
|
|
|
GstStateChangeReturn ret;
|
|
|
|
GstIdentity *identity = GST_IDENTITY (element);
|
2015-04-20 23:31:37 +00:00
|
|
|
gboolean no_preroll = FALSE;
|
2011-12-02 12:19:38 +00:00
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2015-04-20 23:31:37 +00:00
|
|
|
GST_OBJECT_LOCK (identity);
|
|
|
|
identity->blocked = TRUE;
|
|
|
|
GST_OBJECT_UNLOCK (identity);
|
|
|
|
if (identity->sync)
|
|
|
|
no_preroll = TRUE;
|
2011-12-02 12:19:38 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
2015-04-20 23:31:37 +00:00
|
|
|
GST_OBJECT_LOCK (identity);
|
|
|
|
identity->blocked = FALSE;
|
|
|
|
g_cond_broadcast (&identity->blocked_cond);
|
|
|
|
GST_OBJECT_UNLOCK (identity);
|
2011-12-02 12:19:38 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
|
|
|
GST_OBJECT_LOCK (identity);
|
|
|
|
if (identity->clock_id) {
|
|
|
|
GST_DEBUG_OBJECT (identity, "unlock clock wait");
|
|
|
|
gst_clock_id_unschedule (identity->clock_id);
|
|
|
|
}
|
2015-04-20 23:31:37 +00:00
|
|
|
identity->blocked = FALSE;
|
|
|
|
g_cond_broadcast (&identity->blocked_cond);
|
2011-12-02 12:19:38 +00:00
|
|
|
GST_OBJECT_UNLOCK (identity);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
2015-04-20 23:24:45 +00:00
|
|
|
GST_OBJECT_LOCK (identity);
|
|
|
|
identity->upstream_latency = 0;
|
2015-04-20 23:31:37 +00:00
|
|
|
identity->blocked = TRUE;
|
2015-04-20 23:24:45 +00:00
|
|
|
GST_OBJECT_UNLOCK (identity);
|
2015-04-20 23:31:37 +00:00
|
|
|
if (identity->sync)
|
|
|
|
no_preroll = TRUE;
|
2011-12-02 12:19:38 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-04-20 23:31:37 +00:00
|
|
|
if (no_preroll && ret == GST_STATE_CHANGE_SUCCESS)
|
|
|
|
ret = GST_STATE_CHANGE_NO_PREROLL;
|
|
|
|
|
2011-12-02 12:19:38 +00:00
|
|
|
return ret;
|
|
|
|
}
|