2005-03-28 14:54:33 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wtay@chello.be>
|
|
|
|
*
|
2005-06-28 12:01:49 +00:00
|
|
|
* gstbasesink.h:
|
2005-03-28 14:54:33 +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.
|
2005-03-28 14:54:33 +00:00
|
|
|
*/
|
|
|
|
|
2005-07-10 12:03:13 +00:00
|
|
|
#ifndef __GST_BASE_SINK_H__
|
|
|
|
#define __GST_BASE_SINK_H__
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
|
2009-08-24 16:01:07 +00:00
|
|
|
#define GST_TYPE_BASE_SINK (gst_base_sink_get_type())
|
|
|
|
#define GST_BASE_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_SINK,GstBaseSink))
|
|
|
|
#define GST_BASE_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_SINK,GstBaseSinkClass))
|
2005-08-15 16:57:34 +00:00
|
|
|
#define GST_BASE_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_SINK, GstBaseSinkClass))
|
2009-08-24 16:01:07 +00:00
|
|
|
#define GST_IS_BASE_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_SINK))
|
|
|
|
#define GST_IS_BASE_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_SINK))
|
|
|
|
#define GST_BASE_SINK_CAST(obj) ((GstBaseSink *) (obj))
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2005-08-15 16:57:34 +00:00
|
|
|
/**
|
|
|
|
* GST_BASE_SINK_PAD:
|
|
|
|
* @obj: base sink instance
|
|
|
|
*
|
2005-09-11 12:57:36 +00:00
|
|
|
* Gives the pointer to the #GstPad object of the element.
|
2005-08-15 16:57:34 +00:00
|
|
|
*/
|
2009-08-24 16:01:07 +00:00
|
|
|
#define GST_BASE_SINK_PAD(obj) (GST_BASE_SINK_CAST (obj)->sinkpad)
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2015-10-22 10:00:42 +00:00
|
|
|
#define GST_BASE_SINK_GET_PREROLL_LOCK(obj) (&GST_BASE_SINK_CAST(obj)->preroll_lock)
|
|
|
|
#define GST_BASE_SINK_PREROLL_LOCK(obj) (g_mutex_lock(GST_BASE_SINK_GET_PREROLL_LOCK(obj)))
|
|
|
|
#define GST_BASE_SINK_PREROLL_TRYLOCK(obj) (g_mutex_trylock(GST_BASE_SINK_GET_PREROLL_LOCK(obj)))
|
|
|
|
#define GST_BASE_SINK_PREROLL_UNLOCK(obj) (g_mutex_unlock(GST_BASE_SINK_GET_PREROLL_LOCK(obj)))
|
2011-03-04 16:25:02 +00:00
|
|
|
|
2015-10-22 10:00:42 +00:00
|
|
|
#define GST_BASE_SINK_GET_PREROLL_COND(obj) (&GST_BASE_SINK_CAST(obj)->preroll_cond)
|
|
|
|
#define GST_BASE_SINK_PREROLL_WAIT(obj) \
|
|
|
|
g_cond_wait (GST_BASE_SINK_GET_PREROLL_COND (obj), GST_BASE_SINK_GET_PREROLL_LOCK (obj))
|
|
|
|
#define GST_BASE_SINK_PREROLL_WAIT_UNTIL(obj, end_time) \
|
|
|
|
g_cond_wait_until (GST_BASE_SINK_GET_PREROLL_COND (obj), GST_BASE_SINK_GET_PREROLL_LOCK (obj), end_time)
|
|
|
|
#define GST_BASE_SINK_PREROLL_SIGNAL(obj) g_cond_signal (GST_BASE_SINK_GET_PREROLL_COND (obj));
|
|
|
|
#define GST_BASE_SINK_PREROLL_BROADCAST(obj) g_cond_broadcast (GST_BASE_SINK_GET_PREROLL_COND (obj));
|
2011-03-04 16:25:02 +00:00
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
typedef struct _GstBaseSink GstBaseSink;
|
|
|
|
typedef struct _GstBaseSinkClass GstBaseSinkClass;
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
typedef struct _GstBaseSinkPrivate GstBaseSinkPrivate;
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2005-11-24 09:44:07 +00:00
|
|
|
/**
|
|
|
|
* GstBaseSink:
|
|
|
|
*
|
|
|
|
* The opaque #GstBaseSink data structure.
|
|
|
|
*/
|
2005-03-28 14:54:33 +00:00
|
|
|
struct _GstBaseSink {
|
2009-08-24 16:01:07 +00:00
|
|
|
GstElement element;
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2005-08-26 14:21:43 +00:00
|
|
|
/*< protected >*/
|
2009-08-24 16:01:07 +00:00
|
|
|
GstPad *sinkpad;
|
2011-11-18 11:35:46 +00:00
|
|
|
GstPadMode pad_mode;
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2005-08-26 14:21:43 +00:00
|
|
|
/*< protected >*/ /* with LOCK */
|
2009-08-24 16:01:07 +00:00
|
|
|
guint64 offset;
|
|
|
|
gboolean can_activate_pull;
|
|
|
|
gboolean can_activate_push;
|
2005-08-26 14:21:43 +00:00
|
|
|
|
2005-05-06 08:25:19 +00:00
|
|
|
/*< protected >*/ /* with PREROLL_LOCK */
|
2012-01-19 08:27:04 +00:00
|
|
|
GMutex preroll_lock;
|
|
|
|
GCond preroll_cond;
|
2005-08-26 14:21:43 +00:00
|
|
|
gboolean eos;
|
|
|
|
gboolean need_preroll;
|
|
|
|
gboolean have_preroll;
|
|
|
|
gboolean playing_async;
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2005-08-26 14:21:43 +00:00
|
|
|
/*< protected >*/ /* with STREAM_LOCK */
|
2009-08-24 16:01:07 +00:00
|
|
|
gboolean have_newsegment;
|
More segment updates, replace code in plugins with segment helper functions.
Original commit message from CVS:
* check/gst/gstsegment.c: (GST_START_TEST):
* docs/design/part-TODO.txt:
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_event), (gst_base_sink_do_sync),
(gst_base_sink_activate_pull), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasesrc.c: (gst_base_src_init), (gst_base_src_query),
(gst_base_src_default_newsegment),
(gst_base_src_configure_segment), (gst_base_src_do_seek),
(gst_base_src_get_range), (gst_base_src_loop),
(gst_base_src_change_state):
* gst/base/gstbasesrc.h:
* gst/base/gstbasetransform.c:
(gst_base_transform_prepare_output_buf),
(gst_base_transform_event), (gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
* gst/base/gstcollectpads.c: (gst_collect_pads_add_pad),
(gst_collect_pads_event):
* gst/base/gstcollectpads.h:
* gst/elements/gstfakesrc.c: (gst_fake_src_init),
(gst_fake_src_create):
* gst/elements/gstfakesrc.h:
* gst/elements/gstidentity.c: (gst_identity_transform_ip):
* gst/gstsegment.c: (gst_segment_init), (gst_segment_set_duration),
(gst_segment_set_last_stop), (gst_segment_set_seek),
(gst_segment_set_newsegment), (gst_segment_to_stream_time),
(gst_segment_to_running_time), (gst_segment_clip):
* gst/gstsegment.h:
More segment updates, replace code in plugins with segment
helper functions.
2005-11-21 17:09:45 +00:00
|
|
|
GstSegment segment;
|
gst/base/gstbasesink.*: Store and use discont values when syncing buffers as described in design docs.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_event), (gst_base_sink_get_times),
(gst_base_sink_do_sync), (gst_base_sink_change_state):
* gst/base/gstbasesink.h:
Store and use discont values when syncing buffers as described
in design docs.
* gst/base/gstbasesrc.c: (gst_base_src_send_discont),
(gst_base_src_do_seek), (gst_base_src_loop), (gst_base_src_start),
(gst_base_src_activate_push):
Push discont event when starting.
* gst/elements/gstidentity.c: (gst_identity_transform):
Small cleanups.
* gst/gstbin.c: (gst_bin_change_state):
Small cleanups in base_time distribution.
* gst/gstelement.c: (gst_element_set_base_time),
(gst_element_get_base_time), (gst_element_change_state):
* gst/gstelement.h:
Added methods for the base_time of the element.
Some MT fixes.
* gst/gstpipeline.c: (gst_pipeline_send_event),
(gst_pipeline_change_state), (gst_pipeline_set_new_stream_time),
(gst_pipeline_get_last_stream_time):
* gst/gstpipeline.h:
MT fixes.
Handle seeking as described in design doc, remove stream_time
hack.
Cleanups clock and stream_time selection code. Added accessors
for the stream_time.
2005-07-16 14:41:25 +00:00
|
|
|
|
2005-08-26 14:21:43 +00:00
|
|
|
/*< private >*/ /* with LOCK */
|
|
|
|
GstClockID clock_id;
|
2005-09-20 12:05:47 +00:00
|
|
|
gboolean sync;
|
2005-10-08 09:58:30 +00:00
|
|
|
gboolean flushing;
|
2011-02-22 18:09:48 +00:00
|
|
|
gboolean running;
|
2005-08-08 13:31:09 +00:00
|
|
|
|
2011-02-22 18:09:48 +00:00
|
|
|
gint64 max_lateness;
|
docs/design/part-element-sink.txt: Updated document.
Original commit message from CVS:
* docs/design/part-element-sink.txt:
Updated document.
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_finalize), (gst_base_sink_preroll_queue_flush),
(gst_base_sink_configure_segment), (gst_base_sink_commit_state),
(gst_base_sink_get_sync_times), (gst_base_sink_wait_clock),
(gst_base_sink_do_sync), (gst_base_sink_render_object),
(gst_base_sink_preroll_object),
(gst_base_sink_queue_object_unlocked),
(gst_base_sink_queue_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_chain),
(gst_base_sink_loop), (gst_base_sink_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Totally refactored matching the design doc.
Use two segments, one to clip incomming buffers and another to
perform sync.
Handle queueing correctly, bypass the queue when playing.
Make EOS cancelable.
Handle errors correctly when operating in pull based mode.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Added new check for sinks.
2006-02-02 12:07:48 +00:00
|
|
|
|
2011-02-22 18:09:48 +00:00
|
|
|
/*< private >*/
|
2006-03-24 09:48:33 +00:00
|
|
|
GstBaseSinkPrivate *priv;
|
2011-02-22 18:09:48 +00:00
|
|
|
|
|
|
|
gpointer _gst_reserved[GST_PADDING_LARGE];
|
2005-03-28 14:54:33 +00:00
|
|
|
};
|
|
|
|
|
2006-04-04 14:58:50 +00:00
|
|
|
/**
|
|
|
|
* GstBaseSinkClass:
|
2007-02-15 12:05:09 +00:00
|
|
|
* @parent_class: Element parent class
|
2006-05-03 16:42:08 +00:00
|
|
|
* @get_caps: Called to get sink pad caps from the subclass
|
2006-04-04 14:58:50 +00:00
|
|
|
* @set_caps: Notify subclass of changed caps
|
2012-03-11 17:57:44 +00:00
|
|
|
* @fixate: Only useful in pull mode. Implement if you have
|
2011-07-26 10:21:38 +00:00
|
|
|
* ideas about what should be the default values for the caps you support.
|
|
|
|
* @activate_pull: Subclasses should override this when they can provide an
|
|
|
|
* alternate method of spawning a thread to drive the pipeline in pull mode.
|
|
|
|
* Should start or stop the pulling thread, depending on the value of the
|
|
|
|
* "active" argument. Called after actually activating the sink pad in pull
|
|
|
|
* mode. The default implementation starts a task on the sink pad.
|
2006-05-03 16:42:08 +00:00
|
|
|
* @get_times: Called to get the start and end times for synchronising
|
libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate): (gst_base_transform_init, gst_base_transform_sink_activa...
Original commit message from CVS:
2007-01-12 Andy Wingo <wingo@pobox.com>
* libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate):
(gst_base_transform_init, gst_base_transform_sink_activate_push)
(gst_base_transform_src_activate_pull):
Track the activation mode.
(gst_base_transform_setcaps): In pull mode, when activating the
src pad, after activating the sink pad, activate the sink pad's
peer, as discussed in part-negotiation.txt.
* libs/gst/base/gstbasesrc.h:
* libs/gst/base/gstbasesrc.c (gst_base_src_fixate): Add fixate
vmethod, as in basesink.
* libs/gst/base/gstbasesink.h: Reformat docs, add fixate vmethod.
* libs/gst/base/gstbasesink.c (gst_base_sink_pad_setcaps): In pull
mode, first proxy the setcaps to the peer pad.
(gst_base_sink_pad_fixate): Add a fixate function that calls the
new fixate vmethod.
(gst_base_sink_default_activate_pull): Rename from
gst_base_sink_activate_pull.
(gst_base_sink_negotiate_pull): New function, performs negotiation
in pull mode before calling ::activate_pull().
(gst_base_sink_pad_activate_pull): Actually call the activate_pull
vmethod instead of the default implementation. I have no idea how
this worked before. Negotiate before calling activate_pull.
2007-01-12 15:56:00 +00:00
|
|
|
* the passed buffer to the clock
|
2011-08-26 12:18:33 +00:00
|
|
|
* @propose_allocation: configure the allocation query
|
2006-04-04 14:58:50 +00:00
|
|
|
* @start: Start processing. Ideal for opening resources in the subclass
|
|
|
|
* @stop: Stop processing. Subclasses should use this to close resources.
|
2006-05-03 16:42:08 +00:00
|
|
|
* @unlock: Unlock any pending access to the resource. Subclasses should
|
libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate): (gst_base_transform_init, gst_base_transform_sink_activa...
Original commit message from CVS:
2007-01-12 Andy Wingo <wingo@pobox.com>
* libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate):
(gst_base_transform_init, gst_base_transform_sink_activate_push)
(gst_base_transform_src_activate_pull):
Track the activation mode.
(gst_base_transform_setcaps): In pull mode, when activating the
src pad, after activating the sink pad, activate the sink pad's
peer, as discussed in part-negotiation.txt.
* libs/gst/base/gstbasesrc.h:
* libs/gst/base/gstbasesrc.c (gst_base_src_fixate): Add fixate
vmethod, as in basesink.
* libs/gst/base/gstbasesink.h: Reformat docs, add fixate vmethod.
* libs/gst/base/gstbasesink.c (gst_base_sink_pad_setcaps): In pull
mode, first proxy the setcaps to the peer pad.
(gst_base_sink_pad_fixate): Add a fixate function that calls the
new fixate vmethod.
(gst_base_sink_default_activate_pull): Rename from
gst_base_sink_activate_pull.
(gst_base_sink_negotiate_pull): New function, performs negotiation
in pull mode before calling ::activate_pull().
(gst_base_sink_pad_activate_pull): Actually call the activate_pull
vmethod instead of the default implementation. I have no idea how
this worked before. Negotiate before calling activate_pull.
2007-01-12 15:56:00 +00:00
|
|
|
* unblock any blocked function ASAP
|
libs/gst/base/: Add ::unlock_stop to basesrc and basesink. This allows an opportunity for sub-classes to correctly cl...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_set_flushing),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
* libs/gst/base/gstbasesrc.c: (gst_base_src_perform_seek),
(gst_base_src_default_event), (gst_base_src_unlock_stop),
(gst_base_src_deactivate):
* libs/gst/base/gstbasesrc.h:
Add ::unlock_stop to basesrc and basesink. This allows an opportunity
for sub-classes to correctly clear any state they set trying to
unlock, such as clearing out unlock commands from a command fd.
* plugins/elements/gstfdsink.c: (gst_fd_sink_class_init),
(gst_fd_sink_render), (gst_fd_sink_unlock),
(gst_fd_sink_unlock_stop):
* plugins/elements/gstfdsrc.c: (gst_fd_src_class_init),
(gst_fd_src_init), (gst_fd_src_unlock), (gst_fd_src_unlock_stop),
(gst_fd_src_create), (gst_fd_src_get_size), (gst_fd_src_do_seek):
Implement unlock_stop in fdsrc and fdsink.
Implement seeking in fdsrc when a seekable fd is passed, as in
gst-launch-0.10 fdsrc ! ... ! xvimagesink < /path/to/file
2007-03-19 15:01:40 +00:00
|
|
|
* @unlock_stop: Clear the previous unlock request. Subclasses should clear
|
2009-08-24 16:01:07 +00:00
|
|
|
* any state they set during unlock(), such as clearing command queues.
|
2012-07-10 09:46:41 +00:00
|
|
|
* @query: perform a #GstQuery on the element.
|
2006-04-04 14:58:50 +00:00
|
|
|
* @event: Override this to handle events arriving on the sink pad
|
2012-09-04 10:13:11 +00:00
|
|
|
* @wait_event: Override this to implement custom logic to wait for the event
|
|
|
|
* time (for events like EOS and GAP). Subclasses should always first
|
|
|
|
* chain up to the default implementation.
|
2012-05-16 10:08:44 +00:00
|
|
|
* @prepare: Called to prepare the buffer for @render and @preroll. This
|
|
|
|
* function is called before synchronisation is performed.
|
|
|
|
* @prepare_list: Called to prepare the buffer list for @render_list. This
|
|
|
|
* function is called before synchronisation is performed.
|
|
|
|
* @preroll: Called to present the preroll buffer if desired.
|
2006-04-04 14:58:50 +00:00
|
|
|
* @render: Called when a buffer should be presented or output, at the
|
libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate): (gst_base_transform_init, gst_base_transform_sink_activa...
Original commit message from CVS:
2007-01-12 Andy Wingo <wingo@pobox.com>
* libs/gst/base/gstbasetransform.c (_GstBaseTransformPrivate):
(gst_base_transform_init, gst_base_transform_sink_activate_push)
(gst_base_transform_src_activate_pull):
Track the activation mode.
(gst_base_transform_setcaps): In pull mode, when activating the
src pad, after activating the sink pad, activate the sink pad's
peer, as discussed in part-negotiation.txt.
* libs/gst/base/gstbasesrc.h:
* libs/gst/base/gstbasesrc.c (gst_base_src_fixate): Add fixate
vmethod, as in basesink.
* libs/gst/base/gstbasesink.h: Reformat docs, add fixate vmethod.
* libs/gst/base/gstbasesink.c (gst_base_sink_pad_setcaps): In pull
mode, first proxy the setcaps to the peer pad.
(gst_base_sink_pad_fixate): Add a fixate function that calls the
new fixate vmethod.
(gst_base_sink_default_activate_pull): Rename from
gst_base_sink_activate_pull.
(gst_base_sink_negotiate_pull): New function, performs negotiation
in pull mode before calling ::activate_pull().
(gst_base_sink_pad_activate_pull): Actually call the activate_pull
vmethod instead of the default implementation. I have no idea how
this worked before. Negotiate before calling activate_pull.
2007-01-12 15:56:00 +00:00
|
|
|
* correct moment if the #GstBaseSink has been set to sync to the clock.
|
2013-12-07 14:38:19 +00:00
|
|
|
* @render_list: Same as @render but used with buffer lists instead of
|
2012-07-10 09:46:41 +00:00
|
|
|
* buffers.
|
2006-04-04 14:58:50 +00:00
|
|
|
*
|
2006-05-03 16:42:08 +00:00
|
|
|
* Subclasses can override any of the available virtual methods or not, as
|
2007-02-15 12:05:09 +00:00
|
|
|
* needed. At the minimum, the @render method should be overridden to
|
2006-05-03 16:42:08 +00:00
|
|
|
* output/present buffers.
|
2006-04-04 14:58:50 +00:00
|
|
|
*/
|
2005-03-28 14:54:33 +00:00
|
|
|
struct _GstBaseSinkClass {
|
|
|
|
GstElementClass parent_class;
|
|
|
|
|
2005-05-06 08:25:19 +00:00
|
|
|
/* get caps from subclass */
|
2011-05-11 13:12:04 +00:00
|
|
|
GstCaps* (*get_caps) (GstBaseSink *sink, GstCaps *filter);
|
2005-05-06 08:25:19 +00:00
|
|
|
/* notify subclass of new caps */
|
2005-03-28 14:54:33 +00:00
|
|
|
gboolean (*set_caps) (GstBaseSink *sink, GstCaps *caps);
|
|
|
|
|
2011-02-22 18:09:48 +00:00
|
|
|
/* fixate sink caps during pull-mode negotiation */
|
2012-03-11 17:57:44 +00:00
|
|
|
GstCaps * (*fixate) (GstBaseSink *sink, GstCaps *caps);
|
2011-02-22 18:09:48 +00:00
|
|
|
/* start or stop a pulling thread */
|
|
|
|
gboolean (*activate_pull)(GstBaseSink *sink, gboolean active);
|
|
|
|
|
2005-05-06 08:25:19 +00:00
|
|
|
/* get the start and end times for syncing on this buffer */
|
2009-08-24 16:01:07 +00:00
|
|
|
void (*get_times) (GstBaseSink *sink, GstBuffer *buffer,
|
|
|
|
GstClockTime *start, GstClockTime *end);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2011-08-26 12:18:33 +00:00
|
|
|
/* propose allocation parameters for upstream */
|
|
|
|
gboolean (*propose_allocation) (GstBaseSink *sink, GstQuery *query);
|
2011-07-26 10:21:38 +00:00
|
|
|
|
gst/base/: Make basesrc negotiate.
Original commit message from CVS:
* gst/base/README:
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_handle_object), (gst_base_sink_loop),
(gst_base_sink_change_state):
* gst/base/gstbasesink.h:
* gst/base/gstbasesrc.c: (gst_base_src_class_init),
(gst_base_src_init), (gst_base_src_setcaps),
(gst_base_src_getcaps), (gst_base_src_loop),
(gst_base_src_default_negotiate), (gst_base_src_negotiate),
(gst_base_src_start), (gst_base_src_change_state):
* gst/base/gstbasesrc.h:
Make basesrc negotiate.
Handle the case where preroll fails in basesink.
Update README.
2005-07-06 13:25:26 +00:00
|
|
|
/* start and stop processing, ideal for opening/closing the resource */
|
|
|
|
gboolean (*start) (GstBaseSink *sink);
|
|
|
|
gboolean (*stop) (GstBaseSink *sink);
|
|
|
|
|
2005-05-06 08:25:19 +00:00
|
|
|
/* unlock any pending access to the resource. subclasses should unlock
|
|
|
|
* any function ASAP. */
|
|
|
|
gboolean (*unlock) (GstBaseSink *sink);
|
2009-08-24 16:01:07 +00:00
|
|
|
/* Clear a previously indicated unlock request not that unlocking is
|
libs/gst/base/: Add ::unlock_stop to basesrc and basesink. This allows an opportunity for sub-classes to correctly cl...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_set_flushing),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
* libs/gst/base/gstbasesrc.c: (gst_base_src_perform_seek),
(gst_base_src_default_event), (gst_base_src_unlock_stop),
(gst_base_src_deactivate):
* libs/gst/base/gstbasesrc.h:
Add ::unlock_stop to basesrc and basesink. This allows an opportunity
for sub-classes to correctly clear any state they set trying to
unlock, such as clearing out unlock commands from a command fd.
* plugins/elements/gstfdsink.c: (gst_fd_sink_class_init),
(gst_fd_sink_render), (gst_fd_sink_unlock),
(gst_fd_sink_unlock_stop):
* plugins/elements/gstfdsrc.c: (gst_fd_src_class_init),
(gst_fd_src_init), (gst_fd_src_unlock), (gst_fd_src_unlock_stop),
(gst_fd_src_create), (gst_fd_src_get_size), (gst_fd_src_do_seek):
Implement unlock_stop in fdsrc and fdsink.
Implement seeking in fdsrc when a seekable fd is passed, as in
gst-launch-0.10 fdsrc ! ... ! xvimagesink < /path/to/file
2007-03-19 15:01:40 +00:00
|
|
|
* complete. Sub-classes should clear any command queue or indicator they
|
|
|
|
* set during unlock */
|
2009-06-16 11:32:37 +00:00
|
|
|
gboolean (*unlock_stop) (GstBaseSink *sink);
|
|
|
|
|
2011-07-26 10:21:38 +00:00
|
|
|
/* notify subclass of query */
|
|
|
|
gboolean (*query) (GstBaseSink *sink, GstQuery *query);
|
|
|
|
|
2011-11-10 11:33:33 +00:00
|
|
|
/* notify subclass of event */
|
2011-02-22 18:09:48 +00:00
|
|
|
gboolean (*event) (GstBaseSink *sink, GstEvent *event);
|
2012-09-04 10:13:11 +00:00
|
|
|
/* wait for eos or gap, subclasses should chain up to parent first */
|
|
|
|
GstFlowReturn (*wait_event) (GstBaseSink *sink, GstEvent *event);
|
2011-12-02 21:20:08 +00:00
|
|
|
|
2012-05-16 10:08:44 +00:00
|
|
|
/* notify subclass of buffer or list before doing sync */
|
|
|
|
GstFlowReturn (*prepare) (GstBaseSink *sink, GstBuffer *buffer);
|
|
|
|
GstFlowReturn (*prepare_list) (GstBaseSink *sink, GstBufferList *buffer_list);
|
|
|
|
|
2011-11-10 11:33:33 +00:00
|
|
|
/* notify subclass of preroll buffer or real buffer */
|
2011-02-22 18:09:48 +00:00
|
|
|
GstFlowReturn (*preroll) (GstBaseSink *sink, GstBuffer *buffer);
|
|
|
|
GstFlowReturn (*render) (GstBaseSink *sink, GstBuffer *buffer);
|
2009-06-16 11:32:37 +00:00
|
|
|
/* Render a BufferList */
|
|
|
|
GstFlowReturn (*render_list) (GstBaseSink *sink, GstBufferList *buffer_list);
|
libs/gst/base/: Add ::unlock_stop to basesrc and basesink. This allows an opportunity for sub-classes to correctly cl...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_set_flushing),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
* libs/gst/base/gstbasesrc.c: (gst_base_src_perform_seek),
(gst_base_src_default_event), (gst_base_src_unlock_stop),
(gst_base_src_deactivate):
* libs/gst/base/gstbasesrc.h:
Add ::unlock_stop to basesrc and basesink. This allows an opportunity
for sub-classes to correctly clear any state they set trying to
unlock, such as clearing out unlock commands from a command fd.
* plugins/elements/gstfdsink.c: (gst_fd_sink_class_init),
(gst_fd_sink_render), (gst_fd_sink_unlock),
(gst_fd_sink_unlock_stop):
* plugins/elements/gstfdsrc.c: (gst_fd_src_class_init),
(gst_fd_src_init), (gst_fd_src_unlock), (gst_fd_src_unlock_stop),
(gst_fd_src_create), (gst_fd_src_get_size), (gst_fd_src_do_seek):
Implement unlock_stop in fdsrc and fdsink.
Implement seeking in fdsrc when a seekable fd is passed, as in
gst-launch-0.10 fdsrc ! ... ! xvimagesink < /path/to/file
2007-03-19 15:01:40 +00:00
|
|
|
|
2005-08-08 13:31:09 +00:00
|
|
|
/*< private >*/
|
2011-02-22 18:09:48 +00:00
|
|
|
gpointer _gst_reserved[GST_PADDING_LARGE];
|
2005-03-28 14:54:33 +00:00
|
|
|
};
|
|
|
|
|
2005-06-28 12:01:49 +00:00
|
|
|
GType gst_base_sink_get_type(void);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2009-08-24 16:01:07 +00:00
|
|
|
GstFlowReturn gst_base_sink_do_preroll (GstBaseSink *sink, GstMiniObject *obj);
|
|
|
|
GstFlowReturn gst_base_sink_wait_preroll (GstBaseSink *sink);
|
2006-09-15 08:47:36 +00:00
|
|
|
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
/* synchronizing against the clock */
|
2009-08-24 16:01:07 +00:00
|
|
|
void gst_base_sink_set_sync (GstBaseSink *sink, gboolean sync);
|
|
|
|
gboolean gst_base_sink_get_sync (GstBaseSink *sink);
|
2006-03-07 16:21:02 +00:00
|
|
|
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
/* dropping late buffers */
|
2009-08-24 16:01:07 +00:00
|
|
|
void gst_base_sink_set_max_lateness (GstBaseSink *sink, gint64 max_lateness);
|
|
|
|
gint64 gst_base_sink_get_max_lateness (GstBaseSink *sink);
|
2006-03-07 16:21:02 +00:00
|
|
|
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
/* performing QoS */
|
2009-08-24 16:01:07 +00:00
|
|
|
void gst_base_sink_set_qos_enabled (GstBaseSink *sink, gboolean enabled);
|
|
|
|
gboolean gst_base_sink_is_qos_enabled (GstBaseSink *sink);
|
libs/gst/base/gstbasesink.c: Decouple max-lateness and the fact that QoS messages are generated with a new property (...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_finalize),
(gst_base_sink_set_qos_enabled), (gst_base_sink_is_qos_enabled),
(gst_base_sink_set_property), (gst_base_sink_get_property),
(gst_base_sink_commit_state), (gst_base_sink_get_sync_times),
(gst_base_sink_wait_clock), (gst_base_sink_do_sync),
(gst_base_sink_add_qos_observation), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_reset_qos),
(gst_base_sink_is_too_late), (gst_base_sink_render_object),
(gst_base_sink_preroll_object), (gst_base_sink_event),
(gst_base_sink_chain_unlocked), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query), (gst_base_sink_change_state):
Decouple max-lateness and the fact that QoS messages are generated
with a new property (qos).
Add vmethod so subclasses can be notified of ASYNC playing
state changes.
Collect timestamp start and stop to report better current
position in EOS/PLAYING/PAUSED/READY/NULL.
Refactor QoS/frame dropping and other measurements.
API: GstBaseSrc::qos
* libs/gst/base/gstbasesink.h:
Added Private struct.
API: gst_base_sink_set_qos_enabled
API: gst_base_sink_is_qos_enabled
2006-03-23 16:20:40 +00:00
|
|
|
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
/* doing async state changes */
|
2009-08-24 16:01:07 +00:00
|
|
|
void gst_base_sink_set_async_enabled (GstBaseSink *sink, gboolean enabled);
|
|
|
|
gboolean gst_base_sink_is_async_enabled (GstBaseSink *sink);
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
|
2007-08-30 17:50:54 +00:00
|
|
|
/* tuning synchronisation */
|
2009-08-24 16:01:07 +00:00
|
|
|
void gst_base_sink_set_ts_offset (GstBaseSink *sink, GstClockTimeDiff offset);
|
|
|
|
GstClockTimeDiff gst_base_sink_get_ts_offset (GstBaseSink *sink);
|
2007-08-30 17:50:54 +00:00
|
|
|
|
2011-12-01 15:46:06 +00:00
|
|
|
/* last sample */
|
|
|
|
GstSample * gst_base_sink_get_last_sample (GstBaseSink *sink);
|
|
|
|
void gst_base_sink_set_last_sample_enabled (GstBaseSink *sink, gboolean enabled);
|
|
|
|
gboolean gst_base_sink_is_last_sample_enabled (GstBaseSink *sink);
|
2007-10-30 18:30:13 +00:00
|
|
|
|
libs/gst/base/gstbasesink.*: Add async property to instruct the sink never to inform the parent about
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_sync),
(gst_base_sink_get_sync), (gst_base_sink_set_max_lateness),
(gst_base_sink_get_max_lateness), (gst_base_sink_set_qos_enabled),
(gst_base_sink_is_qos_enabled), (gst_base_sink_set_async_enabled),
(gst_base_sink_is_async_enabled), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add async property to instruct the sink never to inform the parent about
ASYNC state changes, update docs.
Check argument with g_return_* for the public functions.
API: GstBaseSink::async property
API: gst_base_sink_set_async_enabled()
API: gst_base_sink_is_async_enabled()
2007-08-29 20:57:58 +00:00
|
|
|
/* latency */
|
2009-08-24 16:01:07 +00:00
|
|
|
gboolean gst_base_sink_query_latency (GstBaseSink *sink, gboolean *live, gboolean *upstream_live,
|
|
|
|
GstClockTime *min_latency, GstClockTime *max_latency);
|
|
|
|
GstClockTime gst_base_sink_get_latency (GstBaseSink *sink);
|
docs/design/draft-latency.txt: Small update.
Original commit message from CVS:
* docs/design/draft-latency.txt:
Small update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_get_latency), (gst_base_sink_query_latency),
(gst_base_sink_wait_clock), (gst_base_sink_send_qos),
(gst_base_sink_perform_qos), (gst_base_sink_queue_object_unlocked),
(gst_base_sink_chain_unlocked), (gst_base_sink_send_event),
(gst_base_sink_get_position), (gst_base_sink_query),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
API: gst_base_sink_query_latency() to let subclasses query the upstream
latency.
API: gst_base_sink_get_latency() to let subclasses query the configured
latency in the sink.
Implement query and set latency.
Update some docs.
As spotted by Will Newton <will dot newton at gmail dot com>: Make sure we
don't continue preroll when we are flushing. Fixes #405284.
* tests/check/pipelines/stress.c: (change_state_timeout),
(quit_timeout), (GST_START_TEST), (stress_suite):
Test for #405284.
2007-02-12 11:32:22 +00:00
|
|
|
|
2008-06-20 08:54:45 +00:00
|
|
|
/* render delay */
|
2009-08-24 16:01:07 +00:00
|
|
|
void gst_base_sink_set_render_delay (GstBaseSink *sink, GstClockTime delay);
|
|
|
|
GstClockTime gst_base_sink_get_render_delay (GstBaseSink *sink);
|
2008-06-20 08:54:45 +00:00
|
|
|
|
docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
|
|
|
/* blocksize */
|
2009-08-24 16:01:07 +00:00
|
|
|
void gst_base_sink_set_blocksize (GstBaseSink *sink, guint blocksize);
|
|
|
|
guint gst_base_sink_get_blocksize (GstBaseSink *sink);
|
2008-06-20 08:54:45 +00:00
|
|
|
|
2011-02-10 12:42:05 +00:00
|
|
|
/* throttle-time */
|
|
|
|
void gst_base_sink_set_throttle_time (GstBaseSink *sink, guint64 throttle);
|
|
|
|
guint64 gst_base_sink_get_throttle_time (GstBaseSink *sink);
|
|
|
|
|
2012-11-09 15:50:50 +00:00
|
|
|
/* max-bitrate */
|
|
|
|
void gst_base_sink_set_max_bitrate (GstBaseSink *sink, guint64 max_bitrate);
|
|
|
|
guint64 gst_base_sink_get_max_bitrate (GstBaseSink *sink);
|
|
|
|
|
2009-01-09 15:43:17 +00:00
|
|
|
GstClockReturn gst_base_sink_wait_clock (GstBaseSink *sink, GstClockTime time,
|
2008-05-19 16:36:51 +00:00
|
|
|
GstClockTimeDiff * jitter);
|
2012-06-18 09:36:25 +00:00
|
|
|
GstFlowReturn gst_base_sink_wait (GstBaseSink *sink, GstClockTime time,
|
2007-10-10 15:18:44 +00:00
|
|
|
GstClockTimeDiff *jitter);
|
|
|
|
|
2015-11-10 17:38:59 +00:00
|
|
|
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstBaseSink, gst_object_unref)
|
|
|
|
#endif
|
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
2005-07-10 12:03:13 +00:00
|
|
|
#endif /* __GST_BASE_SINK_H__ */
|