gstreamer/gst/gstpad.h

877 lines
31 KiB
C
Raw Normal View History

/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wim.taymans@chello.be>
*
* gstpad.h: Header for GstPad object
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_PAD_H__
#define __GST_PAD_H__
#include <gst/gstconfig.h>
#include <gst/gstobject.h>
#include <gst/gstbuffer.h>
#include <gst/gstcaps.h>
#include <gst/gstevent.h>
#include <gst/gstquery.h>
#include <gst/gsttask.h>
G_BEGIN_DECLS
/*
* Pad base class
*/
#define GST_TYPE_PAD (gst_pad_get_type ())
#define GST_IS_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD))
#define GST_IS_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD))
#define GST_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD, GstPad))
#define GST_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD, GstPadClass))
#define GST_PAD_CAST(obj) ((GstPad*)(obj))
typedef struct _GstPad GstPad;
typedef struct _GstPadClass GstPadClass;
WARNING: Don't grab this updated unless you're really, REALLY sure. Original commit message from CVS: WARNING: Don't grab this updated unless you're really, REALLY sure. WARNING: Wait for the next one. Whole lotta changes here, including a few random bits: examples/*/Makefile: updated to use `libtool gcc`, not just `gcc` gst/ gstbuffer.h: updated to new flag style gst.c, gstdebug.h: added new debugging for function ptrs gstpipeline.c: set type of parent_class to the class, not the object gstthread.c: ditto plugins/ cdparanoia/cdparanoia.c: added an argument type, updated some defaults cobin/spindentity.c: updated to new do/while loopfunction style mp3encode/lame/gstlame.c: argument types, whole lotta lame options tests/: various changes Now, for the big changes: Once again, the scheduling system has changed. And once again, it broke a whole bunch of things. The gist of the change is that there is now a function pointer for gst_pad_push and gst_pad_pull, instead of a hard-wired function. Well, currently they are functions, but that's for debugging purposes only, they just call the function pointer after spewing lots of DEBUG(). This changed the GstPad structure a bit, and the GstPad API as well. Where elements used to provide chain() and pull() functions, they provide chain() and get() functions. gst_pad_set_pull[region]_function has been changed to get_pad_set_get[region]_function. This means all the elements out there that used to have pull functions need to be updated. The calls to that function have been changed in the normal elements, but the names of the functions passed is still _pull[region](), which is an aesthetic issue more than anything. As for what doesn't work yet, just about anything dealing with Connections is hosed, meaning threaded stuff won't work. This will be fixed about 12 hours from now, after I've slept, etc. The simplefake.c test works in both cothreaded and chained cases, but not much else will work due to the Connection problem. Needless to say, don't grab this unless you *need* these features *now*, else wait to update this stuff until tomorrow. I'm going to sleep now.
2000-12-16 10:18:09 +00:00
/**
* GstPadLinkReturn:
* @GST_PAD_LINK_OK : link succeeded
* @GST_PAD_LINK_WRONG_HIERARCHY: pads have no common grandparent
* @GST_PAD_LINK_WAS_LINKED : pad was already linked
* @GST_PAD_LINK_WRONG_DIRECTION: pads have wrong direction
* @GST_PAD_LINK_NOFORMAT : pads do not have common format
* @GST_PAD_LINK_NOSCHED : pads cannot cooperate in scheduling
* @GST_PAD_LINK_REFUSED : refused for some reason
*
* Result values from gst_pad_link and friends.
*/
typedef enum {
GST_PAD_LINK_OK = 0,
GST_PAD_LINK_WRONG_HIERARCHY = -1,
GST_PAD_LINK_WAS_LINKED = -2,
GST_PAD_LINK_WRONG_DIRECTION = -3,
GST_PAD_LINK_NOFORMAT = -4,
GST_PAD_LINK_NOSCHED = -5,
GST_PAD_LINK_REFUSED = -6
} GstPadLinkReturn;
/**
* GST_PAD_LINK_FAILED:
* @ret: the #GstPadLinkReturn value
*
* Macro to test if the given #GstPadLinkReturn value indicates a failed
* link step.
*/
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
#define GST_PAD_LINK_FAILED(ret) ((ret) < GST_PAD_LINK_OK)
/**
* GST_PAD_LINK_SUCCESSFUL:
* @ret: the #GstPadLinkReturn value
*
* Macro to test if the given #GstPadLinkReturn value indicates a successful
* link step.
*/
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
#define GST_PAD_LINK_SUCCESSFUL(ret) ((ret) >= GST_PAD_LINK_OK)
/**
* GstFlowReturn:
* @GST_FLOW_CUSTOM_SUCCESS: Elements can use values starting from
* this to define custom success codes.
* Since 0.10.7.
* @GST_FLOW_RESEND: Resend buffer, possibly with new caps.
* @GST_FLOW_OK: Data passing was ok.
* @GST_FLOW_NOT_LINKED: Pad is not linked.
* @GST_FLOW_WRONG_STATE: Pad is in wrong state.
* @GST_FLOW_UNEXPECTED: Did not expect anything, like after EOS.
* @GST_FLOW_NOT_NEGOTIATED: Pad is not negotiated.
* @GST_FLOW_ERROR: Some (fatal) error occured. Element generating
* this error should post an error message with more
* details.
* @GST_FLOW_NOT_SUPPORTED: This operation is not supported.
* @GST_FLOW_CUSTOM_ERROR: Elements can use values starting from
* this to define custom error codes. Since 0.10.7.
*
* The result of passing data to a pad.
*
* Note that the custom return values should not be exposed outside of the
* element scope and are available since 0.10.7.
*/
typedef enum {
/* custom success starts here */
GST_FLOW_CUSTOM_SUCCESS = 100,
/* core predefined */
GST_FLOW_RESEND = 1,
GST_FLOW_OK = 0,
/* expected failures */
GST_FLOW_NOT_LINKED = -1,
GST_FLOW_WRONG_STATE = -2,
/* error cases */
GST_FLOW_UNEXPECTED = -3,
GST_FLOW_NOT_NEGOTIATED = -4,
GST_FLOW_ERROR = -5,
GST_FLOW_NOT_SUPPORTED = -6,
/* custom error starts here */
GST_FLOW_CUSTOM_ERROR = -100
} GstFlowReturn;
/**
* GST_FLOW_IS_FATAL:
* @ret: a #GstFlowReturn value
*
* Macro to test if the given #GstFlowReturn value indicates a fatal
* error. This macro is mainly used in elements to decide when an error
* message should be posted on the bus.
*/
#define GST_FLOW_IS_FATAL(ret) ((ret) <= GST_FLOW_UNEXPECTED)
/**
* GST_FLOW_IS_SUCCESS:
* @ret: a #GstFlowReturn value
*
* Macro to test if the given #GstFlowReturn value indicates a
* successfull result
* This macro is mainly used in elements to decide if the processing
* of a buffer was successfull.
*
* Since: 0.10.7
*/
#define GST_FLOW_IS_SUCCESS(ret) ((ret) >= GST_FLOW_OK)
G_CONST_RETURN gchar* gst_flow_get_name (GstFlowReturn ret);
GQuark gst_flow_to_quark (GstFlowReturn ret);
/**
* GstActivateMode:
* @GST_ACTIVATE_NONE: Pad will not handle dataflow
* @GST_ACTIVATE_PUSH: Pad handles dataflow in downstream push mode
* @GST_ACTIVATE_PULL: Pad handles dataflow in upstream pull mode
*
* The status of a GstPad. After activating a pad, which usually happens when the
* parent element goes from READY to PAUSED, the GstActivateMode defines if the
* pad operates in push or pull mode.
*/
typedef enum {
GST_ACTIVATE_NONE,
GST_ACTIVATE_PUSH,
GST_ACTIVATE_PULL
} GstActivateMode;
/**
* GST_PAD_MODE_ACTIVATE:
* @mode: a #GstActivateMode
*
* Macro to test if the given #GstActivateMode value indicates that datapassing
* is possible or not.
*/
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
#define GST_PAD_MODE_ACTIVATE(mode) ((mode) != GST_ACTIVATE_NONE)
/* pad states */
/**
* GstPadActivateFunction:
* @pad: a #GstPad
*
* This function is called when the pad is activated during the element
* READY to PAUSED state change. By default this function will call the
* activate function that puts the pad in push mode but elements can
* override this function to activate the pad in pull mode if they wish.
*
* Returns: TRUE if the pad could be activated.
*/
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer. Original commit message from CVS: 2005-06-27 Andy Wingo <wingo@pobox.com> * gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer. * gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper, returns a sorted copy of the trace list. (gst_alloc_trace_print_live): New API, only prints traces with live objects. Sort the list. (gst_alloc_trace_print_all): Sort the list. (gst_alloc_trace_print): Align columns. * gst/elements/gstttypefindelement.c: * gst/elements/gsttee.c: * gst/base/gstbasesrc.c: * gst/base/gstbasesink.c: * gst/base/gstbasetransform.c: * gst/gstqueue.c: Adapt for pad activation changes. * gst/gstpipeline.c (gst_pipeline_init): Unref after parenting sched. (gst_pipeline_dispose): Drop ref on sched. * gst/gstpad.c (gst_pad_init): Set the default activate func. (gst_pad_activate_default): Push mode by default. (pre_activate_switch, post_activate_switch): New stubs, things to do before and after switching activation modes on pads. (gst_pad_set_active): Take a boolean and not a mode, dispatch to the pad's activate function to choose which mode to activate. Shortcut on deactivation and call the right function directly. (gst_pad_activate_pull): New API, (de)activates a pad in pull mode. (gst_pad_activate_push): New API, same for push mode. (gst_pad_set_activate_function) (gst_pad_set_activatepull_function) (gst_pad_set_activatepush_function): Setters for new API. * gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free): Trace all miniobjects. (gst_mini_object_make_writable): Unref the arg if we copy, like gst_caps_make_writable. * gst/gstmessage.c (_gst_message_initialize): No trace init. * gst/gstghostpad.c (gst_proxy_pad_do_activate) (gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush): Adapt for new pad API. * gst/gstevent.c (_gst_event_initialize): Don't initialize trace. * gst/gstelement.h: * gst/gstelement.c (gst_element_iterate_src_pads) (gst_element_iterate_sink_pads): New API functions. * gst/gstelement.c (iterator_fold_with_resync): New utility, should fold into gstiterator.c in some form. (gst_element_pads_activate): Simplified via use of fold and delegation of decisions to gstpad->activate. * gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL, help in debugging. * gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type class once in init, like gstmessage. Didn't run into this issue but it seems correct. Don't initialize a trace, gstminiobject does that. * check/pipelines/simple_launch_lines.c (test_stop_from_app): New test, runs fakesrc ! fakesink, stopping on ::handoff via a message to the bus. (assert_live_count): New util function, uses alloc traces to check cleanup. * check/gst/gstghostpad.c (test_ghost_pads): More refcount checks. To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
typedef gboolean (*GstPadActivateFunction) (GstPad *pad);
/**
* GstPadActivateModeFunction:
* @pad: a #GstPad
* @active: activate or deactivate the pad.
*
* The prototype of the push and pull activate functions.
*
* Returns: TRUE if the pad could be activated or deactivated.
*/
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer. Original commit message from CVS: 2005-06-27 Andy Wingo <wingo@pobox.com> * gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer. * gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper, returns a sorted copy of the trace list. (gst_alloc_trace_print_live): New API, only prints traces with live objects. Sort the list. (gst_alloc_trace_print_all): Sort the list. (gst_alloc_trace_print): Align columns. * gst/elements/gstttypefindelement.c: * gst/elements/gsttee.c: * gst/base/gstbasesrc.c: * gst/base/gstbasesink.c: * gst/base/gstbasetransform.c: * gst/gstqueue.c: Adapt for pad activation changes. * gst/gstpipeline.c (gst_pipeline_init): Unref after parenting sched. (gst_pipeline_dispose): Drop ref on sched. * gst/gstpad.c (gst_pad_init): Set the default activate func. (gst_pad_activate_default): Push mode by default. (pre_activate_switch, post_activate_switch): New stubs, things to do before and after switching activation modes on pads. (gst_pad_set_active): Take a boolean and not a mode, dispatch to the pad's activate function to choose which mode to activate. Shortcut on deactivation and call the right function directly. (gst_pad_activate_pull): New API, (de)activates a pad in pull mode. (gst_pad_activate_push): New API, same for push mode. (gst_pad_set_activate_function) (gst_pad_set_activatepull_function) (gst_pad_set_activatepush_function): Setters for new API. * gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free): Trace all miniobjects. (gst_mini_object_make_writable): Unref the arg if we copy, like gst_caps_make_writable. * gst/gstmessage.c (_gst_message_initialize): No trace init. * gst/gstghostpad.c (gst_proxy_pad_do_activate) (gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush): Adapt for new pad API. * gst/gstevent.c (_gst_event_initialize): Don't initialize trace. * gst/gstelement.h: * gst/gstelement.c (gst_element_iterate_src_pads) (gst_element_iterate_sink_pads): New API functions. * gst/gstelement.c (iterator_fold_with_resync): New utility, should fold into gstiterator.c in some form. (gst_element_pads_activate): Simplified via use of fold and delegation of decisions to gstpad->activate. * gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL, help in debugging. * gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type class once in init, like gstmessage. Didn't run into this issue but it seems correct. Don't initialize a trace, gstminiobject does that. * check/pipelines/simple_launch_lines.c (test_stop_from_app): New test, runs fakesrc ! fakesink, stopping on ::handoff via a message to the bus. (assert_live_count): New util function, uses alloc traces to check cleanup. * check/gst/gstghostpad.c (test_ghost_pads): More refcount checks. To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
typedef gboolean (*GstPadActivateModeFunction) (GstPad *pad, gboolean active);
/* data passing */
/**
* GstPadChainFunction:
* @pad: the sink #GstPad that performed the chain.
* @buffer: the #GstBuffer that is chained, not %NULL.
*
* A function that will be called on sinkpads when chaining buffers.
* The function typically processes the data contained in the buffer and
* either consumes the data or passes it on to the internally linked pad(s).
*
* The implementer of this function receives a refcount to @buffer and should
* gst_buffer_unref() when the buffer is no longer needed.
*
* When a chain function detects an error in the data stream, it must post an
* error on the buffer and return an appropriate #GstFlowReturn value.
*
* Returns: #GST_FLOW_OK for success
*/
typedef GstFlowReturn (*GstPadChainFunction) (GstPad *pad, GstBuffer *buffer);
/**
* GstPadGetRangeFunction:
* @pad: the src #GstPad to perform the getrange on.
* @offset: the offset of the range
* @length: the length of the range
* @buffer: a memory location to hold the result buffer, cannot be NULL.
*
* This function will be called on source pads when a peer element
* request a buffer at the specified @offset and @length. If this function
* returns #GST_FLOW_OK, the result buffer will be stored in @buffer. The
* contents of @buffer is invalid for any other return value.
*
* This function is installed on a source pad with
* gst_pad_set_getrange_function() and can only be called on source pads after
* they are successfully activated with gst_pad_activate_pull().
*
* @offset and @length are always given in byte units. @offset must normally be a value
* between 0 and the length in bytes of the data available on @pad. The
* length (duration in bytes) can be retrieved with a #GST_QUERY_DURATION or with a
* #GST_QUERY_SEEKING.
*
* Any @offset larger or equal than the length will make the function return
* #GST_FLOW_UNEXPECTED, which corresponds to EOS. In this case @buffer does not
* contain a valid buffer.
*
* The buffer size of @buffer might be smaller than @length when @offset is near
* the end of the stream.
*
* It is allowed to call this function with a 0 @length and valid @offset, in
* which case @buffer will contain a 0-sized buffer and the function returns
* #GST_FLOW_OK.
*
* When this function is called with a -1 @offset, the sequentially next buffer
* of length @length in the stream is returned.
*
* When this function is called with a -1 @length, a buffer with a default
* optimal length is returned in @buffer. The length might depend on the value
* of @offset.
*
* Returns: #GST_FLOW_OK for success
*/
typedef GstFlowReturn (*GstPadGetRangeFunction) (GstPad *pad, guint64 offset,
guint length, GstBuffer **buffer);
/**
* GstPadEventFunction:
* @pad: the #GstPad to handle the event.
* @event: the #GstEvent to handle.
*
* Function signature to handle an event for the pad.
*
* Returns: TRUE if the pad could handle the event.
*/
typedef gboolean (*GstPadEventFunction) (GstPad *pad, GstEvent *event);
/* FIXME: 0.11: deprecate me, check range should use seeking query */
/**
* GstPadCheckGetRangeFunction:
* @pad: a #GstPad
*
* Check if @pad can be activated in pull mode.
*
* This function will be deprecated after 0.10; use the seeking query to check
* if a pad can support random access.
*
* Returns: TRUE if the pad can operate in pull mode.
*/
typedef gboolean (*GstPadCheckGetRangeFunction) (GstPad *pad);
/* internal links */
/**
* GstPadIntLinkFunction:
* @pad: The #GstPad to query.
*
* The signature of the internal pad link function.
*
* Returns: a newly allocated #GList of pads that are linked to the given pad on
* the inside of the parent element.
* The caller must call g_list_free() on it after use.
*/
typedef GList* (*GstPadIntLinkFunction) (GstPad *pad);
gst/gstquery.h Original commit message from CVS: 2005-05-06 Andy Wingo <wingo@pobox.com> * gst/gstquery.h * gst/gstquery.c (_gst_query_initialize): Extend GstQuery from GstData, init a memchunk. (standard_definitions): Add a few query types, deprecate a few. (gst_query_get_type): New proc. (_gst_query_copy, _gst_query_free, gst_query_new): GstData implementation. (gst_query_new_application, gst_query_get_structure): New public procs. * docs/design/draft-query.txt: Removed LINKS from the query types, because all the rest can be dispatched to other pads -- seemed ugly to have a query that couldn't be dispatched. internal_links is fine as a pad method. * gst/gstpad.h: Add query2 as a pad method, add the new functions in gstpad.c, but maintain binary compatibility for the moment. Will fix before 0.9 is out. * gst/gstqueryutils.c: * gst/gstqueryutils.h: New files, implement 3 methods for each query type: parse_query, parse_response, and set. Probably need an allocator as well. * gst/gst.h: Add gstquery.h and gstqueryutils.h to the list. * gst/elements/gstfilesink.c (gst_filesink_query2): * gst/base/gstbasesrc.c (gst_basesrc_query2): Replace old query, query_types, and formats methods. * gst/gstpad.c (gst_pad_query2, gst_pad_query2_default) (gst_pad_set_query2_function): New functions. (gst_real_pad_init): Set query2_default as the default query2 function. Basically just dispatches to internally linked pads. Needs review! * gst/gstdata_private.h (_GST_DATA_INIT): Set data->refcount to 1 without using the atomic operations. Only one thread can possibly be accessing the data at this point. Changed so as to avoid gst_atomic operations.
2005-05-06 21:41:22 +00:00
/* generic query function */
/**
* GstPadQueryTypeFunction:
* @pad: a #GstPad to query
*
* The signature of the query types function.
*
* Returns: a constant array of query types
*/
typedef const GstQueryType* (*GstPadQueryTypeFunction) (GstPad *pad);
/**
* GstPadQueryFunction:
* @pad: the #GstPad to query.
* @query: the #GstQuery object to execute
*
* The signature of the query function.
*
* Returns: TRUE if the query could be performed.
*/
typedef gboolean (*GstPadQueryFunction) (GstPad *pad, GstQuery *query);
gst/gstquery.h Original commit message from CVS: 2005-05-06 Andy Wingo <wingo@pobox.com> * gst/gstquery.h * gst/gstquery.c (_gst_query_initialize): Extend GstQuery from GstData, init a memchunk. (standard_definitions): Add a few query types, deprecate a few. (gst_query_get_type): New proc. (_gst_query_copy, _gst_query_free, gst_query_new): GstData implementation. (gst_query_new_application, gst_query_get_structure): New public procs. * docs/design/draft-query.txt: Removed LINKS from the query types, because all the rest can be dispatched to other pads -- seemed ugly to have a query that couldn't be dispatched. internal_links is fine as a pad method. * gst/gstpad.h: Add query2 as a pad method, add the new functions in gstpad.c, but maintain binary compatibility for the moment. Will fix before 0.9 is out. * gst/gstqueryutils.c: * gst/gstqueryutils.h: New files, implement 3 methods for each query type: parse_query, parse_response, and set. Probably need an allocator as well. * gst/gst.h: Add gstquery.h and gstqueryutils.h to the list. * gst/elements/gstfilesink.c (gst_filesink_query2): * gst/base/gstbasesrc.c (gst_basesrc_query2): Replace old query, query_types, and formats methods. * gst/gstpad.c (gst_pad_query2, gst_pad_query2_default) (gst_pad_set_query2_function): New functions. (gst_real_pad_init): Set query2_default as the default query2 function. Basically just dispatches to internally linked pads. Needs review! * gst/gstdata_private.h (_GST_DATA_INIT): Set data->refcount to 1 without using the atomic operations. Only one thread can possibly be accessing the data at this point. Changed so as to avoid gst_atomic operations.
2005-05-06 21:41:22 +00:00
/* linking */
/**
* GstPadLinkFunction
* @pad: the #GstPad that is linked.
* @peer: the peer #GstPad of the link
*
* Function signature to handle a new link on the pad.
*
* Returns: the result of the link with the specified peer.
*/
typedef GstPadLinkReturn (*GstPadLinkFunction) (GstPad *pad, GstPad *peer);
/**
* GstPadUnlinkFunction
* @pad: the #GstPad that is linked.
*
* Function signature to handle a unlinking the pad prom its peer.
*/
typedef void (*GstPadUnlinkFunction) (GstPad *pad);
/* caps nego */
/**
* GstPadGetCapsFunction:
* @pad: the #GstPad to get the capabilities of.
*
* Returns a copy of the capabilities of the specified pad. By default this
* function will return the pad template capabilities, but can optionally
* be overridden by elements.
*
* Returns: a newly allocated copy #GstCaps of the pad.
*/
typedef GstCaps* (*GstPadGetCapsFunction) (GstPad *pad);
/**
* GstPadSetCapsFunction:
* @pad: the #GstPad to set the capabilities of.
* @caps: the #GstCaps to set
*
* Set @caps on @pad. By default this function updates the caps of the
* pad but the function can be overriden by elements to perform extra
* actions or verifications.
*
* Returns: TRUE if the caps could be set on the pad.
*/
typedef gboolean (*GstPadSetCapsFunction) (GstPad *pad, GstCaps *caps);
/**
* GstPadAcceptCapsFunction:
* @pad: the #GstPad to check
* @caps: the #GstCaps to check
*
* Check if @pad can accept @caps. By default this function will see if @caps
* intersect with the result from gst_pad_get_caps() by can be overridden to
* perform extra checks.
*
* Returns: TRUE if the caps can be accepted by the pad.
*/
typedef gboolean (*GstPadAcceptCapsFunction) (GstPad *pad, GstCaps *caps);
/**
* GstPadFixateCapsFunction:
* @pad: a #GstPad
* @caps: the #GstCaps to fixate
*
* Given possibly unfixed caps @caps, let @pad use its default prefered
* format to make a fixed caps. @caps should be writable. By default this
* function will pick the first value of any ranges or lists in the caps but
* elements can override this function to perform other behaviour.
*/
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
typedef void (*GstPadFixateCapsFunction) (GstPad *pad, GstCaps *caps);
/**
* GstPadBufferAllocFunction:
* @pad: a sink #GstPad
* @offset: the desired offset of the buffer
* @size: the desired size of the buffer
* @caps: the desired caps of the buffer
* @buf: pointer to hold the allocated buffer.
*
* Ask the sinkpad @pad to allocate a buffer with @offset, @size and @caps.
* The result will be stored in @buf.
*
* The purpose of this function is to allocate a buffer that is optimal to
* be processed by @pad. The function is mostly overridden by elements that can
* provide a hardware buffer in order to avoid additional memcpy operations.
*
* The function can return a buffer that does not have @caps, in which case the
* upstream element requests a format change. If a format change was requested,
* the returned buffer will be one to hold the data of said new caps, so its
* size might be different from @size.
*
* When this function returns anything else than #GST_FLOW_OK, the buffer allocation
* failed and @buf does not contain valid data.
*
* By default this function returns a new buffer of @size and with @caps containing
* purely malloced data. The buffer should be freed with gst_buffer_unref()
* after usage.
*
* Returns: #GST_FLOW_OK if @buf contains a valid buffer, any other return
* value means @buf does not hold a valid buffer.
*/
typedef GstFlowReturn (*GstPadBufferAllocFunction) (GstPad *pad, guint64 offset, guint size,
GstCaps *caps, GstBuffer **buf);
/* misc */
/**
* GstPadDispatcherFunction:
* @pad: the #GstPad that is dispatched.
* @data: the gpointer to optional user data.
*
* A dispatcher function is called for all internally linked pads, see
* gst_pad_dispatcher().
*
* Returns: TRUE if the dispatching procedure has to be stopped.
*/
typedef gboolean (*GstPadDispatcherFunction) (GstPad *pad, gpointer data);
/**
* GstPadBlockCallback:
* @pad: the #GstPad that is blockend or unblocked.
* @blocked: blocking state for the pad
* @user_data: the gpointer to optional user data.
*
* Callback used by gst_pad_set_blocked_async(). Gets called when the blocking
* operation succeeds.
*/
typedef void (*GstPadBlockCallback) (GstPad *pad, gboolean blocked, gpointer user_data);
/**
* GstPadDirection:
* @GST_PAD_UNKNOWN: direction is unknown.
* @GST_PAD_SRC: the pad is a source pad.
* @GST_PAD_SINK: the pad is a sink pad.
*
* The direction of a pad.
*/
typedef enum {
GST_PAD_UNKNOWN,
GST_PAD_SRC,
GST_PAD_SINK
} GstPadDirection;
/**
* GstPadFlags:
* @GST_PAD_BLOCKED: is dataflow on a pad blocked
* @GST_PAD_FLUSHING: is pad refusing buffers
* @GST_PAD_IN_GETCAPS: GstPadGetCapsFunction() is running now
* @GST_PAD_IN_SETCAPS: GstPadSetCapsFunction() is running now
* @GST_PAD_BLOCKING: is pad currently blocking on a buffer or event
* @GST_PAD_FLAG_LAST: offset to define more flags
*
* Pad state flags
*/
typedef enum {
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition Original commit message from CVS: * check/gst/gstbin.c: (GST_START_TEST): * docs/gst/gstreamer-sections.txt: * gst/base/gstbasesink.c: (gst_base_sink_init): * gst/base/gstbasesrc.c: (gst_base_src_init), (gst_base_src_get_range), (gst_base_src_check_get_range), (gst_base_src_start), (gst_base_src_stop): * gst/base/gstbasesrc.h: * gst/elements/gstfakesrc.c: (gst_fake_src_set_property): * gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func), (bin_element_is_sink), (reset_degree), (gst_bin_element_set_state), (bin_bus_handler): * gst/gstbin.h: * gst/gstbuffer.h: * gst/gstbus.c: (gst_bus_post), (gst_bus_set_flushing): * gst/gstbus.h: * gst/gstelement.c: (gst_element_is_locked_state), (gst_element_set_locked_state), (gst_element_commit_state), (gst_element_set_state): * gst/gstelement.h: * gst/gstindex.c: (gst_index_init): * gst/gstindex.h: * gst/gstminiobject.h: * gst/gstobject.c: (gst_object_init), (gst_object_sink), (gst_object_set_parent): * gst/gstobject.h: * gst/gstpad.c: (gst_pad_set_blocked_async), (gst_pad_is_blocked), (gst_pad_get_caps_unlocked), (gst_pad_set_caps): * gst/gstpad.h: * gst/gstpadtemplate.h: * gst/gstpipeline.c: (gst_pipeline_provide_clock_func), (gst_pipeline_use_clock), (gst_pipeline_auto_clock): * gst/gstpipeline.h: * gst/indexers/gstfileindex.c: (gst_file_index_load), (gst_file_index_commit): * testsuite/bytestream/filepadsink.c: (gst_fp_sink_init): * testsuite/pad/link.c: (gst_test_src_init), (gst_test_filter_init), (gst_test_sink_init): * testsuite/states/locked.c: (main): renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
2005-10-12 14:28:39 +00:00
GST_PAD_BLOCKED = (GST_OBJECT_FLAG_LAST << 0),
GST_PAD_FLUSHING = (GST_OBJECT_FLAG_LAST << 1),
GST_PAD_IN_GETCAPS = (GST_OBJECT_FLAG_LAST << 2),
GST_PAD_IN_SETCAPS = (GST_OBJECT_FLAG_LAST << 3),
GST_PAD_BLOCKING = (GST_OBJECT_FLAG_LAST << 4),
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition Original commit message from CVS: * check/gst/gstbin.c: (GST_START_TEST): * docs/gst/gstreamer-sections.txt: * gst/base/gstbasesink.c: (gst_base_sink_init): * gst/base/gstbasesrc.c: (gst_base_src_init), (gst_base_src_get_range), (gst_base_src_check_get_range), (gst_base_src_start), (gst_base_src_stop): * gst/base/gstbasesrc.h: * gst/elements/gstfakesrc.c: (gst_fake_src_set_property): * gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func), (bin_element_is_sink), (reset_degree), (gst_bin_element_set_state), (bin_bus_handler): * gst/gstbin.h: * gst/gstbuffer.h: * gst/gstbus.c: (gst_bus_post), (gst_bus_set_flushing): * gst/gstbus.h: * gst/gstelement.c: (gst_element_is_locked_state), (gst_element_set_locked_state), (gst_element_commit_state), (gst_element_set_state): * gst/gstelement.h: * gst/gstindex.c: (gst_index_init): * gst/gstindex.h: * gst/gstminiobject.h: * gst/gstobject.c: (gst_object_init), (gst_object_sink), (gst_object_set_parent): * gst/gstobject.h: * gst/gstpad.c: (gst_pad_set_blocked_async), (gst_pad_is_blocked), (gst_pad_get_caps_unlocked), (gst_pad_set_caps): * gst/gstpad.h: * gst/gstpadtemplate.h: * gst/gstpipeline.c: (gst_pipeline_provide_clock_func), (gst_pipeline_use_clock), (gst_pipeline_auto_clock): * gst/gstpipeline.h: * gst/indexers/gstfileindex.c: (gst_file_index_load), (gst_file_index_commit): * testsuite/bytestream/filepadsink.c: (gst_fp_sink_init): * testsuite/pad/link.c: (gst_test_src_init), (gst_test_filter_init), (gst_test_sink_init): * testsuite/states/locked.c: (main): renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
2005-10-12 14:28:39 +00:00
/* padding */
GST_PAD_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 8)
} GstPadFlags;
/* FIXME: this awful circular dependency need to be resolved properly (see padtemplate.h) */
typedef struct _GstPadTemplate GstPadTemplate;
/**
* GstPad:
* @element_private: private data owned by the parent element
* @padtemplate: padtemplate for this pad
* @direction: the direction of the pad, cannot change after creating
* the pad.
* @stream_rec_lock: recursive stream lock of the pad, used to protect
* the data used in streaming.
* @task: task for this pad if the pad is actively driving dataflow.
* @preroll_lock: lock used when prerolling
* @preroll_cond: conf to signal preroll
* @block_cond: conditional to signal pad block
* @block_callback: callback for the pad block if any
* @block_data: user data for @block_callback
* @caps: the current caps of the pad
* @getcapsfunc: function to get caps of the pad
* @setcapsfunc: function to set caps on the pad
* @acceptcapsfunc: function to check if pad can accept caps
* @fixatecapsfunc: function to fixate caps
* @activatefunc: pad activation function
* @activatepushfunc: function to activate/deactivate pad in push mode
* @activatepullfunc: function to activate/deactivate pad in pull mode
* @linkfunc: function called when pad is linked
* @unlinkfunc: function called when pad is unlinked
* @peer: the pad this pad is linked to
* @sched_private: private storage for the scheduler
* @chainfunc: function to chain data to pad
* @checkgetrangefunc: function to check if pad can operate in pull mode
* @getrangefunc: function to get a range of data from a pad
* @eventfunc: function to send an event to a pad
* @mode: current activation mode of the pad
* @querytypefunc: get list of supported queries
* @queryfunc: perform a query on the pad
* @intlinkfunc: get the internal links of this pad
* @bufferallocfunc: function to allocate a buffer for this pad
* @do_buffer_signals: counter counting installed buffer signals
* @do_event_signals: counter counting installed event signals
*
* The #GstPad structure. Use the functions to update the variables.
*/
struct _GstPad {
GstObject object;
/*< public >*/
gpointer element_private;
GstPadTemplate *padtemplate;
GstPadDirection direction;
/*< public >*/ /* with STREAM_LOCK */
/* streaming rec_lock */
GStaticRecMutex *stream_rec_lock;
GstTask *task;
/*< public >*/ /* with PREROLL_LOCK */
GMutex *preroll_lock;
GCond *preroll_cond;
/*< public >*/ /* with LOCK */
/* block cond, mutex is from the object */
GCond *block_cond;
GstPadBlockCallback block_callback;
gpointer block_data;
/* the pad capabilities */
GstCaps *caps;
GstPadGetCapsFunction getcapsfunc;
GstPadSetCapsFunction setcapsfunc;
GstPadAcceptCapsFunction acceptcapsfunc;
GstPadFixateCapsFunction fixatecapsfunc;
GstPadActivateFunction activatefunc;
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer. Original commit message from CVS: 2005-06-27 Andy Wingo <wingo@pobox.com> * gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer. * gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper, returns a sorted copy of the trace list. (gst_alloc_trace_print_live): New API, only prints traces with live objects. Sort the list. (gst_alloc_trace_print_all): Sort the list. (gst_alloc_trace_print): Align columns. * gst/elements/gstttypefindelement.c: * gst/elements/gsttee.c: * gst/base/gstbasesrc.c: * gst/base/gstbasesink.c: * gst/base/gstbasetransform.c: * gst/gstqueue.c: Adapt for pad activation changes. * gst/gstpipeline.c (gst_pipeline_init): Unref after parenting sched. (gst_pipeline_dispose): Drop ref on sched. * gst/gstpad.c (gst_pad_init): Set the default activate func. (gst_pad_activate_default): Push mode by default. (pre_activate_switch, post_activate_switch): New stubs, things to do before and after switching activation modes on pads. (gst_pad_set_active): Take a boolean and not a mode, dispatch to the pad's activate function to choose which mode to activate. Shortcut on deactivation and call the right function directly. (gst_pad_activate_pull): New API, (de)activates a pad in pull mode. (gst_pad_activate_push): New API, same for push mode. (gst_pad_set_activate_function) (gst_pad_set_activatepull_function) (gst_pad_set_activatepush_function): Setters for new API. * gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free): Trace all miniobjects. (gst_mini_object_make_writable): Unref the arg if we copy, like gst_caps_make_writable. * gst/gstmessage.c (_gst_message_initialize): No trace init. * gst/gstghostpad.c (gst_proxy_pad_do_activate) (gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush): Adapt for new pad API. * gst/gstevent.c (_gst_event_initialize): Don't initialize trace. * gst/gstelement.h: * gst/gstelement.c (gst_element_iterate_src_pads) (gst_element_iterate_sink_pads): New API functions. * gst/gstelement.c (iterator_fold_with_resync): New utility, should fold into gstiterator.c in some form. (gst_element_pads_activate): Simplified via use of fold and delegation of decisions to gstpad->activate. * gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL, help in debugging. * gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type class once in init, like gstmessage. Didn't run into this issue but it seems correct. Don't initialize a trace, gstminiobject does that. * check/pipelines/simple_launch_lines.c (test_stop_from_app): New test, runs fakesrc ! fakesink, stopping on ::handoff via a message to the bus. (assert_live_count): New util function, uses alloc traces to check cleanup. * check/gst/gstghostpad.c (test_ghost_pads): More refcount checks. To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
GstPadActivateModeFunction activatepushfunc;
GstPadActivateModeFunction activatepullfunc;
/* pad link */
GstPadLinkFunction linkfunc;
GstPadUnlinkFunction unlinkfunc;
GstPad *peer;
gpointer sched_private;
/* data transport functions */
GstPadChainFunction chainfunc;
GstPadCheckGetRangeFunction checkgetrangefunc;
GstPadGetRangeFunction getrangefunc;
GstPadEventFunction eventfunc;
gst/: Implement gst_pad_pause/start/stop_task(), take STREAM lock in task function. Original commit message from CVS: * gst/base/gstadapter.c: (gst_adapter_peek), (gst_adapter_flush): * gst/base/gstbasesink.c: (gst_basesink_preroll_queue_push), (gst_basesink_finish_preroll), (gst_basesink_chain), (gst_basesink_loop), (gst_basesink_activate), (gst_basesink_change_state): * gst/base/gstbasesrc.c: (gst_basesrc_do_seek), (gst_basesrc_get_range), (gst_basesrc_loop), (gst_basesrc_activate): * gst/elements/gsttee.c: (gst_tee_sink_activate): * gst/gstpad.c: (gst_pad_dispose), (gst_real_pad_class_init), (gst_real_pad_init), (gst_real_pad_set_property), (gst_real_pad_get_property), (gst_pad_set_active), (gst_pad_is_active), (gst_pad_get_query_types), (gst_pad_unlink), (gst_pad_link_prepare), (gst_pad_link), (gst_pad_get_real_parent), (gst_real_pad_get_caps_unlocked), (gst_pad_peer_get_caps), (gst_pad_accept_caps), (gst_pad_get_peer), (gst_pad_realize), (gst_pad_event_default_dispatch), (gst_pad_event_default), (gst_pad_dispatcher), (gst_pad_query), (gst_real_pad_dispose), (gst_pad_save_thyself), (handle_pad_block), (gst_pad_chain), (gst_pad_push), (gst_pad_get_range), (gst_pad_pull_range), (gst_pad_send_event), (gst_pad_start_task), (gst_pad_pause_task), (gst_pad_stop_task): * gst/gstpad.h: * gst/gstqueue.c: (gst_queue_handle_sink_event), (gst_queue_chain), (gst_queue_loop), (gst_queue_src_activate): * gst/gsttask.c: (gst_task_init), (gst_task_set_lock), (gst_task_get_state): * gst/gsttask.h: * gst/schedulers/threadscheduler.c: (gst_thread_scheduler_task_start), (gst_thread_scheduler_func): Implement gst_pad_pause/start/stop_task(), take STREAM lock in task function. Remove ACTIVE pad flag, use FLUSHING everywhere Added _pad_chain(), _pad_get_range() to call chain/getrange functions. Add locks around IS_FLUSHING when reading. Take STREAM lock in chain(), get_range() functions so plugins don't need to take it anymore.
2005-05-25 11:50:11 +00:00
GstActivateMode mode;
/* generic query method */
GstPadQueryTypeFunction querytypefunc;
GstPadQueryFunction queryfunc;
/* internal links */
GstPadIntLinkFunction intlinkfunc;
GstPadBufferAllocFunction bufferallocfunc;
/* whether to emit signals for have-data. counts number
* of handlers attached. */
gint do_buffer_signals;
gint do_event_signals;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
gst/gstutils.c: RPAD fixes all around. Original commit message from CVS: 2005-06-08 Andy Wingo <wingo@pobox.com> * gst/gstutils.c: RPAD fixes all around. (gst_element_link_pads): Refcounting fixes. * tools/gst-inspect.c: * tools/gst-xmlinspect.c: * parse/grammar.y: * gst/base/gsttypefindhelper.c: * gst/base/gstbasesink.c: * gst/gstqueue.c: RPAD fixes. * gst/gstghostpad.h: * gst/gstghostpad.c: New ghost pad implementation as full proxy pads. The tricky thing is they provide both source and sink interfaces, since they proxy the internal pad for the external pad, and vice versa. Implement with lower-level ProxyPad objects, with the interior proxy pad as a child of the exterior ghost pad. Should write a doc on this. * gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/. (gst_pad_set_name, gst_pad_set_parent): Macros removed, use gst_object API. * gst/gstpad.c: Big changes. No more stub base GstPad, now all pads are real pads. No ghost pads in this file. Not documenting the myriad s/RPAD/PAD/ and REALIZE fixes. (gst_pad_class_init): Add properties for "direction" and "template". Both are construct-only, so they can't change during the life of the pad. Fixes properly deriving from GstPad. (gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For derived objects, just set properties when creating the objects via g_object_new. (gst_pad_get_parent): Implement as a function, return NULL if the parent is not an element. (gst_pad_get_real_parent, gst_pad_add_ghost_pad) (gst_pad_remove_ghost_pad, gst_pad_realize): Removed. * gst/gstobject.c (gst_object_class_init): Make name a construct property. Don't set it in the object init. * gst/gstelement.c (gst_element_add_pad): Don't allow adding pads with UNKNOWN direction. (gst_element_add_ghost_pad): Remove non-orthogonal API. Replace with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)). (gst_element_remove_pad): Remove ghost-pad special cases. (gst_element_pads_activate): Remove rpad cruft. * gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to catch the pad's-parent-not-an-element case. * gst/gst.h: Include gstghostpad.h. * gst/gst.c (init_post): No more real, ghost pads. * gst/Makefile.am: Add gstghostpad.[ch]. * check/Makefile.am: * check/gst/gstbin.c: * check/gst/gstghostpad.c (test_ghost_pads): Check that linking into a bin creates ghost pads, and that the refcounts are right. Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
struct _GstPadClass {
GstObjectClass parent_class;
/* signal callbacks */
void (*linked) (GstPad *pad, GstPad *peer);
void (*unlinked) (GstPad *pad, GstPad *peer);
void (*request_link) (GstPad *pad);
gboolean (*have_data) (GstPad *pad, GstMiniObject *data);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/***** helper macros *****/
/* GstPad */
#define GST_PAD_NAME(pad) (GST_OBJECT_NAME(pad))
#define GST_PAD_PARENT(pad) (GST_ELEMENT_CAST(GST_OBJECT_PARENT(pad)))
#define GST_PAD_ELEMENT_PRIVATE(pad) (GST_PAD_CAST(pad)->element_private)
#define GST_PAD_PAD_TEMPLATE(pad) (GST_PAD_CAST(pad)->padtemplate)
gst/gstutils.c: RPAD fixes all around. Original commit message from CVS: 2005-06-08 Andy Wingo <wingo@pobox.com> * gst/gstutils.c: RPAD fixes all around. (gst_element_link_pads): Refcounting fixes. * tools/gst-inspect.c: * tools/gst-xmlinspect.c: * parse/grammar.y: * gst/base/gsttypefindhelper.c: * gst/base/gstbasesink.c: * gst/gstqueue.c: RPAD fixes. * gst/gstghostpad.h: * gst/gstghostpad.c: New ghost pad implementation as full proxy pads. The tricky thing is they provide both source and sink interfaces, since they proxy the internal pad for the external pad, and vice versa. Implement with lower-level ProxyPad objects, with the interior proxy pad as a child of the exterior ghost pad. Should write a doc on this. * gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/. (gst_pad_set_name, gst_pad_set_parent): Macros removed, use gst_object API. * gst/gstpad.c: Big changes. No more stub base GstPad, now all pads are real pads. No ghost pads in this file. Not documenting the myriad s/RPAD/PAD/ and REALIZE fixes. (gst_pad_class_init): Add properties for "direction" and "template". Both are construct-only, so they can't change during the life of the pad. Fixes properly deriving from GstPad. (gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For derived objects, just set properties when creating the objects via g_object_new. (gst_pad_get_parent): Implement as a function, return NULL if the parent is not an element. (gst_pad_get_real_parent, gst_pad_add_ghost_pad) (gst_pad_remove_ghost_pad, gst_pad_realize): Removed. * gst/gstobject.c (gst_object_class_init): Make name a construct property. Don't set it in the object init. * gst/gstelement.c (gst_element_add_pad): Don't allow adding pads with UNKNOWN direction. (gst_element_add_ghost_pad): Remove non-orthogonal API. Replace with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)). (gst_element_remove_pad): Remove ghost-pad special cases. (gst_element_pads_activate): Remove rpad cruft. * gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to catch the pad's-parent-not-an-element case. * gst/gst.h: Include gstghostpad.h. * gst/gst.c (init_post): No more real, ghost pads. * gst/Makefile.am: Add gstghostpad.[ch]. * check/Makefile.am: * check/gst/gstbin.c: * check/gst/gstghostpad.c (test_ghost_pads): Check that linking into a bin creates ghost pads, and that the refcounts are right. Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
#define GST_PAD_DIRECTION(pad) (GST_PAD_CAST(pad)->direction)
#define GST_PAD_TASK(pad) (GST_PAD_CAST(pad)->task)
#define GST_PAD_ACTIVATE_MODE(pad) (GST_PAD_CAST(pad)->mode)
#define GST_PAD_ACTIVATEFUNC(pad) (GST_PAD_CAST(pad)->activatefunc)
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer. Original commit message from CVS: 2005-06-27 Andy Wingo <wingo@pobox.com> * gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer. * gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper, returns a sorted copy of the trace list. (gst_alloc_trace_print_live): New API, only prints traces with live objects. Sort the list. (gst_alloc_trace_print_all): Sort the list. (gst_alloc_trace_print): Align columns. * gst/elements/gstttypefindelement.c: * gst/elements/gsttee.c: * gst/base/gstbasesrc.c: * gst/base/gstbasesink.c: * gst/base/gstbasetransform.c: * gst/gstqueue.c: Adapt for pad activation changes. * gst/gstpipeline.c (gst_pipeline_init): Unref after parenting sched. (gst_pipeline_dispose): Drop ref on sched. * gst/gstpad.c (gst_pad_init): Set the default activate func. (gst_pad_activate_default): Push mode by default. (pre_activate_switch, post_activate_switch): New stubs, things to do before and after switching activation modes on pads. (gst_pad_set_active): Take a boolean and not a mode, dispatch to the pad's activate function to choose which mode to activate. Shortcut on deactivation and call the right function directly. (gst_pad_activate_pull): New API, (de)activates a pad in pull mode. (gst_pad_activate_push): New API, same for push mode. (gst_pad_set_activate_function) (gst_pad_set_activatepull_function) (gst_pad_set_activatepush_function): Setters for new API. * gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free): Trace all miniobjects. (gst_mini_object_make_writable): Unref the arg if we copy, like gst_caps_make_writable. * gst/gstmessage.c (_gst_message_initialize): No trace init. * gst/gstghostpad.c (gst_proxy_pad_do_activate) (gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush): Adapt for new pad API. * gst/gstevent.c (_gst_event_initialize): Don't initialize trace. * gst/gstelement.h: * gst/gstelement.c (gst_element_iterate_src_pads) (gst_element_iterate_sink_pads): New API functions. * gst/gstelement.c (iterator_fold_with_resync): New utility, should fold into gstiterator.c in some form. (gst_element_pads_activate): Simplified via use of fold and delegation of decisions to gstpad->activate. * gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL, help in debugging. * gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type class once in init, like gstmessage. Didn't run into this issue but it seems correct. Don't initialize a trace, gstminiobject does that. * check/pipelines/simple_launch_lines.c (test_stop_from_app): New test, runs fakesrc ! fakesink, stopping on ::handoff via a message to the bus. (assert_live_count): New util function, uses alloc traces to check cleanup. * check/gst/gstghostpad.c (test_ghost_pads): More refcount checks. To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
#define GST_PAD_ACTIVATEPUSHFUNC(pad) (GST_PAD_CAST(pad)->activatepushfunc)
#define GST_PAD_ACTIVATEPULLFUNC(pad) (GST_PAD_CAST(pad)->activatepullfunc)
gst/gstutils.c: RPAD fixes all around. Original commit message from CVS: 2005-06-08 Andy Wingo <wingo@pobox.com> * gst/gstutils.c: RPAD fixes all around. (gst_element_link_pads): Refcounting fixes. * tools/gst-inspect.c: * tools/gst-xmlinspect.c: * parse/grammar.y: * gst/base/gsttypefindhelper.c: * gst/base/gstbasesink.c: * gst/gstqueue.c: RPAD fixes. * gst/gstghostpad.h: * gst/gstghostpad.c: New ghost pad implementation as full proxy pads. The tricky thing is they provide both source and sink interfaces, since they proxy the internal pad for the external pad, and vice versa. Implement with lower-level ProxyPad objects, with the interior proxy pad as a child of the exterior ghost pad. Should write a doc on this. * gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/. (gst_pad_set_name, gst_pad_set_parent): Macros removed, use gst_object API. * gst/gstpad.c: Big changes. No more stub base GstPad, now all pads are real pads. No ghost pads in this file. Not documenting the myriad s/RPAD/PAD/ and REALIZE fixes. (gst_pad_class_init): Add properties for "direction" and "template". Both are construct-only, so they can't change during the life of the pad. Fixes properly deriving from GstPad. (gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For derived objects, just set properties when creating the objects via g_object_new. (gst_pad_get_parent): Implement as a function, return NULL if the parent is not an element. (gst_pad_get_real_parent, gst_pad_add_ghost_pad) (gst_pad_remove_ghost_pad, gst_pad_realize): Removed. * gst/gstobject.c (gst_object_class_init): Make name a construct property. Don't set it in the object init. * gst/gstelement.c (gst_element_add_pad): Don't allow adding pads with UNKNOWN direction. (gst_element_add_ghost_pad): Remove non-orthogonal API. Replace with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)). (gst_element_remove_pad): Remove ghost-pad special cases. (gst_element_pads_activate): Remove rpad cruft. * gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to catch the pad's-parent-not-an-element case. * gst/gst.h: Include gstghostpad.h. * gst/gst.c (init_post): No more real, ghost pads. * gst/Makefile.am: Add gstghostpad.[ch]. * check/Makefile.am: * check/gst/gstbin.c: * check/gst/gstghostpad.c (test_ghost_pads): Check that linking into a bin creates ghost pads, and that the refcounts are right. Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
#define GST_PAD_CHAINFUNC(pad) (GST_PAD_CAST(pad)->chainfunc)
#define GST_PAD_CHECKGETRANGEFUNC(pad) (GST_PAD_CAST(pad)->checkgetrangefunc)
#define GST_PAD_GETRANGEFUNC(pad) (GST_PAD_CAST(pad)->getrangefunc)
#define GST_PAD_EVENTFUNC(pad) (GST_PAD_CAST(pad)->eventfunc)
#define GST_PAD_QUERYTYPEFUNC(pad) (GST_PAD_CAST(pad)->querytypefunc)
#define GST_PAD_QUERYFUNC(pad) (GST_PAD_CAST(pad)->queryfunc)
#define GST_PAD_INTLINKFUNC(pad) (GST_PAD_CAST(pad)->intlinkfunc)
#define GST_PAD_PEER(pad) (GST_PAD_CAST(pad)->peer)
#define GST_PAD_LINKFUNC(pad) (GST_PAD_CAST(pad)->linkfunc)
#define GST_PAD_UNLINKFUNC(pad) (GST_PAD_CAST(pad)->unlinkfunc)
#define GST_PAD_CAPS(pad) (GST_PAD_CAST(pad)->caps)
#define GST_PAD_GETCAPSFUNC(pad) (GST_PAD_CAST(pad)->getcapsfunc)
#define GST_PAD_SETCAPSFUNC(pad) (GST_PAD_CAST(pad)->setcapsfunc)
#define GST_PAD_ACCEPTCAPSFUNC(pad) (GST_PAD_CAST(pad)->acceptcapsfunc)
#define GST_PAD_FIXATECAPSFUNC(pad) (GST_PAD_CAST(pad)->fixatecapsfunc)
#define GST_PAD_BUFFERALLOCFUNC(pad) (GST_PAD_CAST(pad)->bufferallocfunc)
#define GST_PAD_DO_BUFFER_SIGNALS(pad) (GST_PAD_CAST(pad)->do_buffer_signals)
#define GST_PAD_DO_EVENT_SIGNALS(pad) (GST_PAD_CAST(pad)->do_event_signals)
gst/gstutils.c: RPAD fixes all around. Original commit message from CVS: 2005-06-08 Andy Wingo <wingo@pobox.com> * gst/gstutils.c: RPAD fixes all around. (gst_element_link_pads): Refcounting fixes. * tools/gst-inspect.c: * tools/gst-xmlinspect.c: * parse/grammar.y: * gst/base/gsttypefindhelper.c: * gst/base/gstbasesink.c: * gst/gstqueue.c: RPAD fixes. * gst/gstghostpad.h: * gst/gstghostpad.c: New ghost pad implementation as full proxy pads. The tricky thing is they provide both source and sink interfaces, since they proxy the internal pad for the external pad, and vice versa. Implement with lower-level ProxyPad objects, with the interior proxy pad as a child of the exterior ghost pad. Should write a doc on this. * gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/. (gst_pad_set_name, gst_pad_set_parent): Macros removed, use gst_object API. * gst/gstpad.c: Big changes. No more stub base GstPad, now all pads are real pads. No ghost pads in this file. Not documenting the myriad s/RPAD/PAD/ and REALIZE fixes. (gst_pad_class_init): Add properties for "direction" and "template". Both are construct-only, so they can't change during the life of the pad. Fixes properly deriving from GstPad. (gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For derived objects, just set properties when creating the objects via g_object_new. (gst_pad_get_parent): Implement as a function, return NULL if the parent is not an element. (gst_pad_get_real_parent, gst_pad_add_ghost_pad) (gst_pad_remove_ghost_pad, gst_pad_realize): Removed. * gst/gstobject.c (gst_object_class_init): Make name a construct property. Don't set it in the object init. * gst/gstelement.c (gst_element_add_pad): Don't allow adding pads with UNKNOWN direction. (gst_element_add_ghost_pad): Remove non-orthogonal API. Replace with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)). (gst_element_remove_pad): Remove ghost-pad special cases. (gst_element_pads_activate): Remove rpad cruft. * gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to catch the pad's-parent-not-an-element case. * gst/gst.h: Include gstghostpad.h. * gst/gst.c (init_post): No more real, ghost pads. * gst/Makefile.am: Add gstghostpad.[ch]. * check/Makefile.am: * check/gst/gstbin.c: * check/gst/gstghostpad.c (test_ghost_pads): Check that linking into a bin creates ghost pads, and that the refcounts are right. Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
#define GST_PAD_IS_LINKED(pad) (GST_PAD_PEER(pad) != NULL)
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition Original commit message from CVS: * check/gst/gstbin.c: (GST_START_TEST): * docs/gst/gstreamer-sections.txt: * gst/base/gstbasesink.c: (gst_base_sink_init): * gst/base/gstbasesrc.c: (gst_base_src_init), (gst_base_src_get_range), (gst_base_src_check_get_range), (gst_base_src_start), (gst_base_src_stop): * gst/base/gstbasesrc.h: * gst/elements/gstfakesrc.c: (gst_fake_src_set_property): * gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func), (bin_element_is_sink), (reset_degree), (gst_bin_element_set_state), (bin_bus_handler): * gst/gstbin.h: * gst/gstbuffer.h: * gst/gstbus.c: (gst_bus_post), (gst_bus_set_flushing): * gst/gstbus.h: * gst/gstelement.c: (gst_element_is_locked_state), (gst_element_set_locked_state), (gst_element_commit_state), (gst_element_set_state): * gst/gstelement.h: * gst/gstindex.c: (gst_index_init): * gst/gstindex.h: * gst/gstminiobject.h: * gst/gstobject.c: (gst_object_init), (gst_object_sink), (gst_object_set_parent): * gst/gstobject.h: * gst/gstpad.c: (gst_pad_set_blocked_async), (gst_pad_is_blocked), (gst_pad_get_caps_unlocked), (gst_pad_set_caps): * gst/gstpad.h: * gst/gstpadtemplate.h: * gst/gstpipeline.c: (gst_pipeline_provide_clock_func), (gst_pipeline_use_clock), (gst_pipeline_auto_clock): * gst/gstpipeline.h: * gst/indexers/gstfileindex.c: (gst_file_index_load), (gst_file_index_commit): * testsuite/bytestream/filepadsink.c: (gst_fp_sink_init): * testsuite/pad/link.c: (gst_test_src_init), (gst_test_filter_init), (gst_test_sink_init): * testsuite/states/locked.c: (main): renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
2005-10-12 14:28:39 +00:00
#define GST_PAD_IS_BLOCKED(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_BLOCKED))
#define GST_PAD_IS_BLOCKING(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_BLOCKING))
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition Original commit message from CVS: * check/gst/gstbin.c: (GST_START_TEST): * docs/gst/gstreamer-sections.txt: * gst/base/gstbasesink.c: (gst_base_sink_init): * gst/base/gstbasesrc.c: (gst_base_src_init), (gst_base_src_get_range), (gst_base_src_check_get_range), (gst_base_src_start), (gst_base_src_stop): * gst/base/gstbasesrc.h: * gst/elements/gstfakesrc.c: (gst_fake_src_set_property): * gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func), (bin_element_is_sink), (reset_degree), (gst_bin_element_set_state), (bin_bus_handler): * gst/gstbin.h: * gst/gstbuffer.h: * gst/gstbus.c: (gst_bus_post), (gst_bus_set_flushing): * gst/gstbus.h: * gst/gstelement.c: (gst_element_is_locked_state), (gst_element_set_locked_state), (gst_element_commit_state), (gst_element_set_state): * gst/gstelement.h: * gst/gstindex.c: (gst_index_init): * gst/gstindex.h: * gst/gstminiobject.h: * gst/gstobject.c: (gst_object_init), (gst_object_sink), (gst_object_set_parent): * gst/gstobject.h: * gst/gstpad.c: (gst_pad_set_blocked_async), (gst_pad_is_blocked), (gst_pad_get_caps_unlocked), (gst_pad_set_caps): * gst/gstpad.h: * gst/gstpadtemplate.h: * gst/gstpipeline.c: (gst_pipeline_provide_clock_func), (gst_pipeline_use_clock), (gst_pipeline_auto_clock): * gst/gstpipeline.h: * gst/indexers/gstfileindex.c: (gst_file_index_load), (gst_file_index_commit): * testsuite/bytestream/filepadsink.c: (gst_fp_sink_init): * testsuite/pad/link.c: (gst_test_src_init), (gst_test_filter_init), (gst_test_sink_init): * testsuite/states/locked.c: (main): renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
2005-10-12 14:28:39 +00:00
#define GST_PAD_IS_FLUSHING(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLUSHING))
#define GST_PAD_IS_IN_GETCAPS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_IN_GETCAPS))
#define GST_PAD_IS_IN_SETCAPS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_IN_SETCAPS))
gst/gstutils.c: RPAD fixes all around. Original commit message from CVS: 2005-06-08 Andy Wingo <wingo@pobox.com> * gst/gstutils.c: RPAD fixes all around. (gst_element_link_pads): Refcounting fixes. * tools/gst-inspect.c: * tools/gst-xmlinspect.c: * parse/grammar.y: * gst/base/gsttypefindhelper.c: * gst/base/gstbasesink.c: * gst/gstqueue.c: RPAD fixes. * gst/gstghostpad.h: * gst/gstghostpad.c: New ghost pad implementation as full proxy pads. The tricky thing is they provide both source and sink interfaces, since they proxy the internal pad for the external pad, and vice versa. Implement with lower-level ProxyPad objects, with the interior proxy pad as a child of the exterior ghost pad. Should write a doc on this. * gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/. (gst_pad_set_name, gst_pad_set_parent): Macros removed, use gst_object API. * gst/gstpad.c: Big changes. No more stub base GstPad, now all pads are real pads. No ghost pads in this file. Not documenting the myriad s/RPAD/PAD/ and REALIZE fixes. (gst_pad_class_init): Add properties for "direction" and "template". Both are construct-only, so they can't change during the life of the pad. Fixes properly deriving from GstPad. (gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For derived objects, just set properties when creating the objects via g_object_new. (gst_pad_get_parent): Implement as a function, return NULL if the parent is not an element. (gst_pad_get_real_parent, gst_pad_add_ghost_pad) (gst_pad_remove_ghost_pad, gst_pad_realize): Removed. * gst/gstobject.c (gst_object_class_init): Make name a construct property. Don't set it in the object init. * gst/gstelement.c (gst_element_add_pad): Don't allow adding pads with UNKNOWN direction. (gst_element_add_ghost_pad): Remove non-orthogonal API. Replace with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)). (gst_element_remove_pad): Remove ghost-pad special cases. (gst_element_pads_activate): Remove rpad cruft. * gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to catch the pad's-parent-not-an-element case. * gst/gst.h: Include gstghostpad.h. * gst/gst.c (init_post): No more real, ghost pads. * gst/Makefile.am: Add gstghostpad.[ch]. * check/Makefile.am: * check/gst/gstbin.c: * check/gst/gstghostpad.c (test_ghost_pads): Check that linking into a bin creates ghost pads, and that the refcounts are right. Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
#define GST_PAD_IS_SRC(pad) (GST_PAD_DIRECTION(pad) == GST_PAD_SRC)
#define GST_PAD_IS_SINK(pad) (GST_PAD_DIRECTION(pad) == GST_PAD_SINK)
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition Original commit message from CVS: * check/gst/gstbin.c: (GST_START_TEST): * docs/gst/gstreamer-sections.txt: * gst/base/gstbasesink.c: (gst_base_sink_init): * gst/base/gstbasesrc.c: (gst_base_src_init), (gst_base_src_get_range), (gst_base_src_check_get_range), (gst_base_src_start), (gst_base_src_stop): * gst/base/gstbasesrc.h: * gst/elements/gstfakesrc.c: (gst_fake_src_set_property): * gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func), (bin_element_is_sink), (reset_degree), (gst_bin_element_set_state), (bin_bus_handler): * gst/gstbin.h: * gst/gstbuffer.h: * gst/gstbus.c: (gst_bus_post), (gst_bus_set_flushing): * gst/gstbus.h: * gst/gstelement.c: (gst_element_is_locked_state), (gst_element_set_locked_state), (gst_element_commit_state), (gst_element_set_state): * gst/gstelement.h: * gst/gstindex.c: (gst_index_init): * gst/gstindex.h: * gst/gstminiobject.h: * gst/gstobject.c: (gst_object_init), (gst_object_sink), (gst_object_set_parent): * gst/gstobject.h: * gst/gstpad.c: (gst_pad_set_blocked_async), (gst_pad_is_blocked), (gst_pad_get_caps_unlocked), (gst_pad_set_caps): * gst/gstpad.h: * gst/gstpadtemplate.h: * gst/gstpipeline.c: (gst_pipeline_provide_clock_func), (gst_pipeline_use_clock), (gst_pipeline_auto_clock): * gst/gstpipeline.h: * gst/indexers/gstfileindex.c: (gst_file_index_load), (gst_file_index_commit): * testsuite/bytestream/filepadsink.c: (gst_fp_sink_init): * testsuite/pad/link.c: (gst_test_src_init), (gst_test_filter_init), (gst_test_sink_init): * testsuite/states/locked.c: (main): renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
2005-10-12 14:28:39 +00:00
#define GST_PAD_SET_FLUSHING(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLUSHING))
#define GST_PAD_UNSET_FLUSHING(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLUSHING))
gst/gstutils.c: RPAD fixes all around. Original commit message from CVS: 2005-06-08 Andy Wingo <wingo@pobox.com> * gst/gstutils.c: RPAD fixes all around. (gst_element_link_pads): Refcounting fixes. * tools/gst-inspect.c: * tools/gst-xmlinspect.c: * parse/grammar.y: * gst/base/gsttypefindhelper.c: * gst/base/gstbasesink.c: * gst/gstqueue.c: RPAD fixes. * gst/gstghostpad.h: * gst/gstghostpad.c: New ghost pad implementation as full proxy pads. The tricky thing is they provide both source and sink interfaces, since they proxy the internal pad for the external pad, and vice versa. Implement with lower-level ProxyPad objects, with the interior proxy pad as a child of the exterior ghost pad. Should write a doc on this. * gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/. (gst_pad_set_name, gst_pad_set_parent): Macros removed, use gst_object API. * gst/gstpad.c: Big changes. No more stub base GstPad, now all pads are real pads. No ghost pads in this file. Not documenting the myriad s/RPAD/PAD/ and REALIZE fixes. (gst_pad_class_init): Add properties for "direction" and "template". Both are construct-only, so they can't change during the life of the pad. Fixes properly deriving from GstPad. (gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For derived objects, just set properties when creating the objects via g_object_new. (gst_pad_get_parent): Implement as a function, return NULL if the parent is not an element. (gst_pad_get_real_parent, gst_pad_add_ghost_pad) (gst_pad_remove_ghost_pad, gst_pad_realize): Removed. * gst/gstobject.c (gst_object_class_init): Make name a construct property. Don't set it in the object init. * gst/gstelement.c (gst_element_add_pad): Don't allow adding pads with UNKNOWN direction. (gst_element_add_ghost_pad): Remove non-orthogonal API. Replace with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)). (gst_element_remove_pad): Remove ghost-pad special cases. (gst_element_pads_activate): Remove rpad cruft. * gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to catch the pad's-parent-not-an-element case. * gst/gst.h: Include gstghostpad.h. * gst/gst.c (init_post): No more real, ghost pads. * gst/Makefile.am: Add gstghostpad.[ch]. * check/Makefile.am: * check/gst/gstbin.c: * check/gst/gstghostpad.c (test_ghost_pads): Check that linking into a bin creates ghost pads, and that the refcounts are right. Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
/**
* GST_PAD_GET_STREAM_LOCK:
* @pad: a #GstPad
*
* Get the stream lock of @pad. The stream lock is protecting the
* resources used in the data processing functions of @pad.
*/
#define GST_PAD_GET_STREAM_LOCK(pad) (GST_PAD_CAST(pad)->stream_rec_lock)
/**
* GST_PAD_STREAM_LOCK:
* @pad: a #GstPad
*
* Lock the stream lock of @pad.
*/
#define GST_PAD_STREAM_LOCK(pad) (g_static_rec_mutex_lock(GST_PAD_GET_STREAM_LOCK(pad)))
/**
* GST_PAD_STREAM_LOCK_FULL:
* @pad: a #GstPad
* @t: the number of times to recursively lock
*
* Lock the stream lock of @pad @t times.
*/
#define GST_PAD_STREAM_LOCK_FULL(pad,t) (g_static_rec_mutex_lock_full(GST_PAD_GET_STREAM_LOCK(pad), t))
/**
* GST_PAD_STREAM_TRYLOCK:
* @pad: a #GstPad
*
* Try to Lock the stream lock of the pad, return TRUE if the lock could be
* taken.
*/
#define GST_PAD_STREAM_TRYLOCK(pad) (g_static_rec_mutex_trylock(GST_PAD_GET_STREAM_LOCK(pad)))
/**
* GST_PAD_STREAM_UNLOCK:
* @pad: a #GstPad
*
* Unlock the stream lock of @pad.
*/
#define GST_PAD_STREAM_UNLOCK(pad) (g_static_rec_mutex_unlock(GST_PAD_GET_STREAM_LOCK(pad)))
/**
* GST_PAD_STREAM_UNLOCK_FULL:
* @pad: a #GstPad
*
* Fully unlock the recursive stream lock of @pad, return the number of times
* @pad was locked.
*/
#define GST_PAD_STREAM_UNLOCK_FULL(pad) (g_static_rec_mutex_unlock_full(GST_PAD_GET_STREAM_LOCK(pad)))
#define GST_PAD_GET_PREROLL_LOCK(pad) (GST_PAD_CAST(pad)->preroll_lock)
#define GST_PAD_PREROLL_LOCK(pad) (g_mutex_lock(GST_PAD_GET_PREROLL_LOCK(pad)))
#define GST_PAD_PREROLL_TRYLOCK(pad) (g_mutex_trylock(GST_PAD_GET_PREROLL_LOCK(pad)))
#define GST_PAD_PREROLL_UNLOCK(pad) (g_mutex_unlock(GST_PAD_GET_PREROLL_LOCK(pad)))
#define GST_PAD_GET_PREROLL_COND(pad) (GST_PAD_CAST(pad)->preroll_cond)
#define GST_PAD_PREROLL_WAIT(pad) \
g_cond_wait (GST_PAD_GET_PREROLL_COND (pad), GST_PAD_GET_PREROLL_LOCK (pad))
#define GST_PAD_PREROLL_TIMED_WAIT(pad, timeval) \
g_cond_timed_wait (GST_PAD_GET_PREROLL_COND (pad), GST_PAD_GET_PREROLL_LOCK (pad), timeval)
#define GST_PAD_PREROLL_SIGNAL(pad) g_cond_signal (GST_PAD_GET_PREROLL_COND (pad));
#define GST_PAD_PREROLL_BROADCAST(pad) g_cond_broadcast (GST_PAD_GET_PREROLL_COND (pad));
gst/gstutils.c: RPAD fixes all around. Original commit message from CVS: 2005-06-08 Andy Wingo <wingo@pobox.com> * gst/gstutils.c: RPAD fixes all around. (gst_element_link_pads): Refcounting fixes. * tools/gst-inspect.c: * tools/gst-xmlinspect.c: * parse/grammar.y: * gst/base/gsttypefindhelper.c: * gst/base/gstbasesink.c: * gst/gstqueue.c: RPAD fixes. * gst/gstghostpad.h: * gst/gstghostpad.c: New ghost pad implementation as full proxy pads. The tricky thing is they provide both source and sink interfaces, since they proxy the internal pad for the external pad, and vice versa. Implement with lower-level ProxyPad objects, with the interior proxy pad as a child of the exterior ghost pad. Should write a doc on this. * gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/. (gst_pad_set_name, gst_pad_set_parent): Macros removed, use gst_object API. * gst/gstpad.c: Big changes. No more stub base GstPad, now all pads are real pads. No ghost pads in this file. Not documenting the myriad s/RPAD/PAD/ and REALIZE fixes. (gst_pad_class_init): Add properties for "direction" and "template". Both are construct-only, so they can't change during the life of the pad. Fixes properly deriving from GstPad. (gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For derived objects, just set properties when creating the objects via g_object_new. (gst_pad_get_parent): Implement as a function, return NULL if the parent is not an element. (gst_pad_get_real_parent, gst_pad_add_ghost_pad) (gst_pad_remove_ghost_pad, gst_pad_realize): Removed. * gst/gstobject.c (gst_object_class_init): Make name a construct property. Don't set it in the object init. * gst/gstelement.c (gst_element_add_pad): Don't allow adding pads with UNKNOWN direction. (gst_element_add_ghost_pad): Remove non-orthogonal API. Replace with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)). (gst_element_remove_pad): Remove ghost-pad special cases. (gst_element_pads_activate): Remove rpad cruft. * gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to catch the pad's-parent-not-an-element case. * gst/gst.h: Include gstghostpad.h. * gst/gst.c (init_post): No more real, ghost pads. * gst/Makefile.am: Add gstghostpad.[ch]. * check/Makefile.am: * check/gst/gstbin.c: * check/gst/gstghostpad.c (test_ghost_pads): Check that linking into a bin creates ghost pads, and that the refcounts are right. Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
#define GST_PAD_BLOCK_GET_COND(pad) (GST_PAD_CAST(pad)->block_cond)
#define GST_PAD_BLOCK_WAIT(pad) (g_cond_wait(GST_PAD_BLOCK_GET_COND (pad), GST_OBJECT_GET_LOCK (pad)))
#define GST_PAD_BLOCK_SIGNAL(pad) (g_cond_signal(GST_PAD_BLOCK_GET_COND (pad)))
/* FIXME: this awful circular dependency need to be resolved properly (see padtemplate.h) */
#include <gst/gstpadtemplate.h>
GType gst_pad_get_type (void);
/* creating pads */
GstPad* gst_pad_new (const gchar *name, GstPadDirection direction);
GstPad* gst_pad_new_from_template (GstPadTemplate *templ, const gchar *name);
GstPad* gst_pad_new_from_static_template (GstStaticPadTemplate *templ, const gchar *name);
/**
* gst_pad_get_name:
* @pad: the pad to get the name from
*
* Get a copy of the name of the pad. g_free() after usage.
*
* MT safe.
*/
gst/gstutils.c: RPAD fixes all around. Original commit message from CVS: 2005-06-08 Andy Wingo <wingo@pobox.com> * gst/gstutils.c: RPAD fixes all around. (gst_element_link_pads): Refcounting fixes. * tools/gst-inspect.c: * tools/gst-xmlinspect.c: * parse/grammar.y: * gst/base/gsttypefindhelper.c: * gst/base/gstbasesink.c: * gst/gstqueue.c: RPAD fixes. * gst/gstghostpad.h: * gst/gstghostpad.c: New ghost pad implementation as full proxy pads. The tricky thing is they provide both source and sink interfaces, since they proxy the internal pad for the external pad, and vice versa. Implement with lower-level ProxyPad objects, with the interior proxy pad as a child of the exterior ghost pad. Should write a doc on this. * gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/. (gst_pad_set_name, gst_pad_set_parent): Macros removed, use gst_object API. * gst/gstpad.c: Big changes. No more stub base GstPad, now all pads are real pads. No ghost pads in this file. Not documenting the myriad s/RPAD/PAD/ and REALIZE fixes. (gst_pad_class_init): Add properties for "direction" and "template". Both are construct-only, so they can't change during the life of the pad. Fixes properly deriving from GstPad. (gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For derived objects, just set properties when creating the objects via g_object_new. (gst_pad_get_parent): Implement as a function, return NULL if the parent is not an element. (gst_pad_get_real_parent, gst_pad_add_ghost_pad) (gst_pad_remove_ghost_pad, gst_pad_realize): Removed. * gst/gstobject.c (gst_object_class_init): Make name a construct property. Don't set it in the object init. * gst/gstelement.c (gst_element_add_pad): Don't allow adding pads with UNKNOWN direction. (gst_element_add_ghost_pad): Remove non-orthogonal API. Replace with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)). (gst_element_remove_pad): Remove ghost-pad special cases. (gst_element_pads_activate): Remove rpad cruft. * gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to catch the pad's-parent-not-an-element case. * gst/gst.h: Include gstghostpad.h. * gst/gst.c (init_post): No more real, ghost pads. * gst/Makefile.am: Add gstghostpad.[ch]. * check/Makefile.am: * check/gst/gstbin.c: * check/gst/gstghostpad.c (test_ghost_pads): Check that linking into a bin creates ghost pads, and that the refcounts are right. Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
#define gst_pad_get_name(pad) gst_object_get_name (GST_OBJECT_CAST (pad))
/**
* gst_pad_get_parent:
* @pad: the pad to get the parent of
*
* Get the parent of @pad. This function increases the refcount
* of the parent object so you should gst_object_unref() it after usage.
* Can return NULL if the pad did not have a parent.
*
* MT safe.
*/
#define gst_pad_get_parent(pad) gst_object_get_parent (GST_OBJECT_CAST (pad))
GstPadDirection gst_pad_get_direction (GstPad *pad);
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer. Original commit message from CVS: 2005-06-27 Andy Wingo <wingo@pobox.com> * gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer. * gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper, returns a sorted copy of the trace list. (gst_alloc_trace_print_live): New API, only prints traces with live objects. Sort the list. (gst_alloc_trace_print_all): Sort the list. (gst_alloc_trace_print): Align columns. * gst/elements/gstttypefindelement.c: * gst/elements/gsttee.c: * gst/base/gstbasesrc.c: * gst/base/gstbasesink.c: * gst/base/gstbasetransform.c: * gst/gstqueue.c: Adapt for pad activation changes. * gst/gstpipeline.c (gst_pipeline_init): Unref after parenting sched. (gst_pipeline_dispose): Drop ref on sched. * gst/gstpad.c (gst_pad_init): Set the default activate func. (gst_pad_activate_default): Push mode by default. (pre_activate_switch, post_activate_switch): New stubs, things to do before and after switching activation modes on pads. (gst_pad_set_active): Take a boolean and not a mode, dispatch to the pad's activate function to choose which mode to activate. Shortcut on deactivation and call the right function directly. (gst_pad_activate_pull): New API, (de)activates a pad in pull mode. (gst_pad_activate_push): New API, same for push mode. (gst_pad_set_activate_function) (gst_pad_set_activatepull_function) (gst_pad_set_activatepush_function): Setters for new API. * gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free): Trace all miniobjects. (gst_mini_object_make_writable): Unref the arg if we copy, like gst_caps_make_writable. * gst/gstmessage.c (_gst_message_initialize): No trace init. * gst/gstghostpad.c (gst_proxy_pad_do_activate) (gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush): Adapt for new pad API. * gst/gstevent.c (_gst_event_initialize): Don't initialize trace. * gst/gstelement.h: * gst/gstelement.c (gst_element_iterate_src_pads) (gst_element_iterate_sink_pads): New API functions. * gst/gstelement.c (iterator_fold_with_resync): New utility, should fold into gstiterator.c in some form. (gst_element_pads_activate): Simplified via use of fold and delegation of decisions to gstpad->activate. * gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL, help in debugging. * gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type class once in init, like gstmessage. Didn't run into this issue but it seems correct. Don't initialize a trace, gstminiobject does that. * check/pipelines/simple_launch_lines.c (test_stop_from_app): New test, runs fakesrc ! fakesink, stopping on ::handoff via a message to the bus. (assert_live_count): New util function, uses alloc traces to check cleanup. * check/gst/gstghostpad.c (test_ghost_pads): More refcount checks. To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
gboolean gst_pad_set_active (GstPad *pad, gboolean active);
gboolean gst_pad_is_active (GstPad *pad);
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer. Original commit message from CVS: 2005-06-27 Andy Wingo <wingo@pobox.com> * gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer. * gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper, returns a sorted copy of the trace list. (gst_alloc_trace_print_live): New API, only prints traces with live objects. Sort the list. (gst_alloc_trace_print_all): Sort the list. (gst_alloc_trace_print): Align columns. * gst/elements/gstttypefindelement.c: * gst/elements/gsttee.c: * gst/base/gstbasesrc.c: * gst/base/gstbasesink.c: * gst/base/gstbasetransform.c: * gst/gstqueue.c: Adapt for pad activation changes. * gst/gstpipeline.c (gst_pipeline_init): Unref after parenting sched. (gst_pipeline_dispose): Drop ref on sched. * gst/gstpad.c (gst_pad_init): Set the default activate func. (gst_pad_activate_default): Push mode by default. (pre_activate_switch, post_activate_switch): New stubs, things to do before and after switching activation modes on pads. (gst_pad_set_active): Take a boolean and not a mode, dispatch to the pad's activate function to choose which mode to activate. Shortcut on deactivation and call the right function directly. (gst_pad_activate_pull): New API, (de)activates a pad in pull mode. (gst_pad_activate_push): New API, same for push mode. (gst_pad_set_activate_function) (gst_pad_set_activatepull_function) (gst_pad_set_activatepush_function): Setters for new API. * gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free): Trace all miniobjects. (gst_mini_object_make_writable): Unref the arg if we copy, like gst_caps_make_writable. * gst/gstmessage.c (_gst_message_initialize): No trace init. * gst/gstghostpad.c (gst_proxy_pad_do_activate) (gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush): Adapt for new pad API. * gst/gstevent.c (_gst_event_initialize): Don't initialize trace. * gst/gstelement.h: * gst/gstelement.c (gst_element_iterate_src_pads) (gst_element_iterate_sink_pads): New API functions. * gst/gstelement.c (iterator_fold_with_resync): New utility, should fold into gstiterator.c in some form. (gst_element_pads_activate): Simplified via use of fold and delegation of decisions to gstpad->activate. * gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL, help in debugging. * gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type class once in init, like gstmessage. Didn't run into this issue but it seems correct. Don't initialize a trace, gstminiobject does that. * check/pipelines/simple_launch_lines.c (test_stop_from_app): New test, runs fakesrc ! fakesink, stopping on ::handoff via a message to the bus. (assert_live_count): New util function, uses alloc traces to check cleanup. * check/gst/gstghostpad.c (test_ghost_pads): More refcount checks. To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
gboolean gst_pad_activate_pull (GstPad *pad, gboolean active);
gboolean gst_pad_activate_push (GstPad *pad, gboolean active);
gboolean gst_pad_set_blocked (GstPad *pad, gboolean blocked);
gboolean gst_pad_set_blocked_async (GstPad *pad, gboolean blocked,
GstPadBlockCallback callback, gpointer user_data);
gboolean gst_pad_is_blocked (GstPad *pad);
gboolean gst_pad_is_blocking (GstPad *pad);
void gst_pad_set_element_private (GstPad *pad, gpointer priv);
gpointer gst_pad_get_element_private (GstPad *pad);
GstPadTemplate* gst_pad_get_pad_template (GstPad *pad);
void gst_pad_set_bufferalloc_function (GstPad *pad, GstPadBufferAllocFunction bufalloc);
GstFlowReturn gst_pad_alloc_buffer (GstPad *pad, guint64 offset, gint size,
GstCaps *caps, GstBuffer **buf);
GstFlowReturn gst_pad_alloc_buffer_and_set_caps (GstPad *pad, guint64 offset, gint size,
GstCaps *caps, GstBuffer **buf);
/* data passing setup functions */
void gst_pad_set_activate_function (GstPad *pad, GstPadActivateFunction activate);
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer. Original commit message from CVS: 2005-06-27 Andy Wingo <wingo@pobox.com> * gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer. * gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper, returns a sorted copy of the trace list. (gst_alloc_trace_print_live): New API, only prints traces with live objects. Sort the list. (gst_alloc_trace_print_all): Sort the list. (gst_alloc_trace_print): Align columns. * gst/elements/gstttypefindelement.c: * gst/elements/gsttee.c: * gst/base/gstbasesrc.c: * gst/base/gstbasesink.c: * gst/base/gstbasetransform.c: * gst/gstqueue.c: Adapt for pad activation changes. * gst/gstpipeline.c (gst_pipeline_init): Unref after parenting sched. (gst_pipeline_dispose): Drop ref on sched. * gst/gstpad.c (gst_pad_init): Set the default activate func. (gst_pad_activate_default): Push mode by default. (pre_activate_switch, post_activate_switch): New stubs, things to do before and after switching activation modes on pads. (gst_pad_set_active): Take a boolean and not a mode, dispatch to the pad's activate function to choose which mode to activate. Shortcut on deactivation and call the right function directly. (gst_pad_activate_pull): New API, (de)activates a pad in pull mode. (gst_pad_activate_push): New API, same for push mode. (gst_pad_set_activate_function) (gst_pad_set_activatepull_function) (gst_pad_set_activatepush_function): Setters for new API. * gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free): Trace all miniobjects. (gst_mini_object_make_writable): Unref the arg if we copy, like gst_caps_make_writable. * gst/gstmessage.c (_gst_message_initialize): No trace init. * gst/gstghostpad.c (gst_proxy_pad_do_activate) (gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush): Adapt for new pad API. * gst/gstevent.c (_gst_event_initialize): Don't initialize trace. * gst/gstelement.h: * gst/gstelement.c (gst_element_iterate_src_pads) (gst_element_iterate_sink_pads): New API functions. * gst/gstelement.c (iterator_fold_with_resync): New utility, should fold into gstiterator.c in some form. (gst_element_pads_activate): Simplified via use of fold and delegation of decisions to gstpad->activate. * gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL, help in debugging. * gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type class once in init, like gstmessage. Didn't run into this issue but it seems correct. Don't initialize a trace, gstminiobject does that. * check/pipelines/simple_launch_lines.c (test_stop_from_app): New test, runs fakesrc ! fakesink, stopping on ::handoff via a message to the bus. (assert_live_count): New util function, uses alloc traces to check cleanup. * check/gst/gstghostpad.c (test_ghost_pads): More refcount checks. To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
void gst_pad_set_activatepull_function (GstPad *pad, GstPadActivateModeFunction activatepull);
void gst_pad_set_activatepush_function (GstPad *pad, GstPadActivateModeFunction activatepush);
void gst_pad_set_chain_function (GstPad *pad, GstPadChainFunction chain);
void gst_pad_set_getrange_function (GstPad *pad, GstPadGetRangeFunction get);
gst/: More work on the generic source base class, implement seeking, query. Original commit message from CVS: * gst/base/README: * gst/base/gstbasesrc.c: (gst_basesrc_get_type), (gst_basesrc_init), (gst_basesrc_get_formats), (gst_basesrc_query), (gst_basesrc_get_event_mask), (gst_basesrc_do_seek), (gst_basesrc_event_handler), (gst_basesrc_get_range_unlocked), (gst_basesrc_check_get_range), (gst_basesrc_loop), (gst_basesrc_unlock), (gst_basesrc_get_size), (gst_basesrc_start), (gst_basesrc_stop), (gst_basesrc_activate), (gst_basesrc_change_state), (basesrc_find_peek), (basesrc_find_suggest), (gst_basesrc_type_find): * gst/base/gstbasesrc.h: * gst/elements/gstfilesrc.c: (gst_filesrc_base_init), (gst_filesrc_class_init), (gst_filesrc_init), (gst_filesrc_finalize), (gst_filesrc_set_location), (gst_filesrc_set_property), (gst_filesrc_get_property), (gst_filesrc_free_parent_mmap), (gst_filesrc_map_region), (gst_filesrc_map_small_region), (gst_filesrc_create_mmap), (gst_filesrc_create_read), (gst_filesrc_create), (gst_filesrc_get_size), (gst_filesrc_start), (gst_filesrc_stop): * gst/elements/gstfilesrc.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_set_checkgetrange_function), (gst_pad_check_pull_range), (gst_pad_pull_range): * gst/gstpad.h: More work on the generic source base class, implement seeking, query. Make filesrc extend the base source class. Added gst_pad_set_checkgetrange_function to GstPad.
2005-04-06 17:30:48 +00:00
void gst_pad_set_checkgetrange_function (GstPad *pad, GstPadCheckGetRangeFunction check);
void gst_pad_set_event_function (GstPad *pad, GstPadEventFunction event);
/* pad links */
void gst_pad_set_link_function (GstPad *pad, GstPadLinkFunction link);
void gst_pad_set_unlink_function (GstPad *pad, GstPadUnlinkFunction unlink);
GstPadLinkReturn gst_pad_link (GstPad *srcpad, GstPad *sinkpad);
gboolean gst_pad_unlink (GstPad *srcpad, GstPad *sinkpad);
gboolean gst_pad_is_linked (GstPad *pad);
GstPad* gst_pad_get_peer (GstPad *pad);
/* capsnego functions */
void gst_pad_set_getcaps_function (GstPad *pad, GstPadGetCapsFunction getcaps);
void gst_pad_set_acceptcaps_function (GstPad *pad, GstPadAcceptCapsFunction acceptcaps);
void gst_pad_set_fixatecaps_function (GstPad *pad, GstPadFixateCapsFunction fixatecaps);
void gst_pad_set_setcaps_function (GstPad *pad, GstPadSetCapsFunction setcaps);
G_CONST_RETURN GstCaps* gst_pad_get_pad_template_caps (GstPad *pad);
/* capsnego function for connected/unconnected pads */
GstCaps * gst_pad_get_caps (GstPad * pad);
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
void gst_pad_fixate_caps (GstPad * pad, GstCaps *caps);
gboolean gst_pad_accept_caps (GstPad * pad, GstCaps *caps);
gboolean gst_pad_set_caps (GstPad * pad, GstCaps *caps);
GstCaps * gst_pad_peer_get_caps (GstPad * pad);
gboolean gst_pad_peer_accept_caps (GstPad * pad, GstCaps *caps);
/* capsnego for connected pads */
GstCaps * gst_pad_get_allowed_caps (GstPad * srcpad);
GstCaps * gst_pad_get_negotiated_caps (GstPad * pad);
gst/: Implement gst_pad_pause/start/stop_task(), take STREAM lock in task function. Original commit message from CVS: * gst/base/gstadapter.c: (gst_adapter_peek), (gst_adapter_flush): * gst/base/gstbasesink.c: (gst_basesink_preroll_queue_push), (gst_basesink_finish_preroll), (gst_basesink_chain), (gst_basesink_loop), (gst_basesink_activate), (gst_basesink_change_state): * gst/base/gstbasesrc.c: (gst_basesrc_do_seek), (gst_basesrc_get_range), (gst_basesrc_loop), (gst_basesrc_activate): * gst/elements/gsttee.c: (gst_tee_sink_activate): * gst/gstpad.c: (gst_pad_dispose), (gst_real_pad_class_init), (gst_real_pad_init), (gst_real_pad_set_property), (gst_real_pad_get_property), (gst_pad_set_active), (gst_pad_is_active), (gst_pad_get_query_types), (gst_pad_unlink), (gst_pad_link_prepare), (gst_pad_link), (gst_pad_get_real_parent), (gst_real_pad_get_caps_unlocked), (gst_pad_peer_get_caps), (gst_pad_accept_caps), (gst_pad_get_peer), (gst_pad_realize), (gst_pad_event_default_dispatch), (gst_pad_event_default), (gst_pad_dispatcher), (gst_pad_query), (gst_real_pad_dispose), (gst_pad_save_thyself), (handle_pad_block), (gst_pad_chain), (gst_pad_push), (gst_pad_get_range), (gst_pad_pull_range), (gst_pad_send_event), (gst_pad_start_task), (gst_pad_pause_task), (gst_pad_stop_task): * gst/gstpad.h: * gst/gstqueue.c: (gst_queue_handle_sink_event), (gst_queue_chain), (gst_queue_loop), (gst_queue_src_activate): * gst/gsttask.c: (gst_task_init), (gst_task_set_lock), (gst_task_get_state): * gst/gsttask.h: * gst/schedulers/threadscheduler.c: (gst_thread_scheduler_task_start), (gst_thread_scheduler_func): Implement gst_pad_pause/start/stop_task(), take STREAM lock in task function. Remove ACTIVE pad flag, use FLUSHING everywhere Added _pad_chain(), _pad_get_range() to call chain/getrange functions. Add locks around IS_FLUSHING when reading. Take STREAM lock in chain(), get_range() functions so plugins don't need to take it anymore.
2005-05-25 11:50:11 +00:00
/* data passing functions to peer */
GstFlowReturn gst_pad_push (GstPad *pad, GstBuffer *buffer);
gboolean gst_pad_check_pull_range (GstPad *pad);
GstFlowReturn gst_pad_pull_range (GstPad *pad, guint64 offset, guint size,
GstBuffer **buffer);
gboolean gst_pad_push_event (GstPad *pad, GstEvent *event);
gboolean gst_pad_event_default (GstPad *pad, GstEvent *event);
gst/: Implement gst_pad_pause/start/stop_task(), take STREAM lock in task function. Original commit message from CVS: * gst/base/gstadapter.c: (gst_adapter_peek), (gst_adapter_flush): * gst/base/gstbasesink.c: (gst_basesink_preroll_queue_push), (gst_basesink_finish_preroll), (gst_basesink_chain), (gst_basesink_loop), (gst_basesink_activate), (gst_basesink_change_state): * gst/base/gstbasesrc.c: (gst_basesrc_do_seek), (gst_basesrc_get_range), (gst_basesrc_loop), (gst_basesrc_activate): * gst/elements/gsttee.c: (gst_tee_sink_activate): * gst/gstpad.c: (gst_pad_dispose), (gst_real_pad_class_init), (gst_real_pad_init), (gst_real_pad_set_property), (gst_real_pad_get_property), (gst_pad_set_active), (gst_pad_is_active), (gst_pad_get_query_types), (gst_pad_unlink), (gst_pad_link_prepare), (gst_pad_link), (gst_pad_get_real_parent), (gst_real_pad_get_caps_unlocked), (gst_pad_peer_get_caps), (gst_pad_accept_caps), (gst_pad_get_peer), (gst_pad_realize), (gst_pad_event_default_dispatch), (gst_pad_event_default), (gst_pad_dispatcher), (gst_pad_query), (gst_real_pad_dispose), (gst_pad_save_thyself), (handle_pad_block), (gst_pad_chain), (gst_pad_push), (gst_pad_get_range), (gst_pad_pull_range), (gst_pad_send_event), (gst_pad_start_task), (gst_pad_pause_task), (gst_pad_stop_task): * gst/gstpad.h: * gst/gstqueue.c: (gst_queue_handle_sink_event), (gst_queue_chain), (gst_queue_loop), (gst_queue_src_activate): * gst/gsttask.c: (gst_task_init), (gst_task_set_lock), (gst_task_get_state): * gst/gsttask.h: * gst/schedulers/threadscheduler.c: (gst_thread_scheduler_task_start), (gst_thread_scheduler_func): Implement gst_pad_pause/start/stop_task(), take STREAM lock in task function. Remove ACTIVE pad flag, use FLUSHING everywhere Added _pad_chain(), _pad_get_range() to call chain/getrange functions. Add locks around IS_FLUSHING when reading. Take STREAM lock in chain(), get_range() functions so plugins don't need to take it anymore.
2005-05-25 11:50:11 +00:00
/* data passing functions on pad */
GstFlowReturn gst_pad_chain (GstPad *pad, GstBuffer *buffer);
GstFlowReturn gst_pad_get_range (GstPad *pad, guint64 offset, guint size,
GstBuffer **buffer);
gboolean gst_pad_send_event (GstPad *pad, GstEvent *event);
/* pad tasks */
gboolean gst_pad_start_task (GstPad *pad, GstTaskFunction func,
gst/: Implement gst_pad_pause/start/stop_task(), take STREAM lock in task function. Original commit message from CVS: * gst/base/gstadapter.c: (gst_adapter_peek), (gst_adapter_flush): * gst/base/gstbasesink.c: (gst_basesink_preroll_queue_push), (gst_basesink_finish_preroll), (gst_basesink_chain), (gst_basesink_loop), (gst_basesink_activate), (gst_basesink_change_state): * gst/base/gstbasesrc.c: (gst_basesrc_do_seek), (gst_basesrc_get_range), (gst_basesrc_loop), (gst_basesrc_activate): * gst/elements/gsttee.c: (gst_tee_sink_activate): * gst/gstpad.c: (gst_pad_dispose), (gst_real_pad_class_init), (gst_real_pad_init), (gst_real_pad_set_property), (gst_real_pad_get_property), (gst_pad_set_active), (gst_pad_is_active), (gst_pad_get_query_types), (gst_pad_unlink), (gst_pad_link_prepare), (gst_pad_link), (gst_pad_get_real_parent), (gst_real_pad_get_caps_unlocked), (gst_pad_peer_get_caps), (gst_pad_accept_caps), (gst_pad_get_peer), (gst_pad_realize), (gst_pad_event_default_dispatch), (gst_pad_event_default), (gst_pad_dispatcher), (gst_pad_query), (gst_real_pad_dispose), (gst_pad_save_thyself), (handle_pad_block), (gst_pad_chain), (gst_pad_push), (gst_pad_get_range), (gst_pad_pull_range), (gst_pad_send_event), (gst_pad_start_task), (gst_pad_pause_task), (gst_pad_stop_task): * gst/gstpad.h: * gst/gstqueue.c: (gst_queue_handle_sink_event), (gst_queue_chain), (gst_queue_loop), (gst_queue_src_activate): * gst/gsttask.c: (gst_task_init), (gst_task_set_lock), (gst_task_get_state): * gst/gsttask.h: * gst/schedulers/threadscheduler.c: (gst_thread_scheduler_task_start), (gst_thread_scheduler_func): Implement gst_pad_pause/start/stop_task(), take STREAM lock in task function. Remove ACTIVE pad flag, use FLUSHING everywhere Added _pad_chain(), _pad_get_range() to call chain/getrange functions. Add locks around IS_FLUSHING when reading. Take STREAM lock in chain(), get_range() functions so plugins don't need to take it anymore.
2005-05-25 11:50:11 +00:00
gpointer data);
gboolean gst_pad_pause_task (GstPad *pad);
gboolean gst_pad_stop_task (GstPad *pad);
/* internal links */
void gst_pad_set_internal_link_function (GstPad *pad, GstPadIntLinkFunction intlink);
GList* gst_pad_get_internal_links (GstPad *pad);
GList* gst_pad_get_internal_links_default (GstPad *pad);
/* generic query function */
void gst_pad_set_query_type_function (GstPad *pad, GstPadQueryTypeFunction type_func);
G_CONST_RETURN GstQueryType*
gst_pad_get_query_types (GstPad *pad);
G_CONST_RETURN GstQueryType*
gst_pad_get_query_types_default (GstPad *pad);
gboolean gst_pad_query (GstPad *pad, GstQuery *query);
void gst_pad_set_query_function (GstPad *pad, GstPadQueryFunction query);
gboolean gst_pad_query_default (GstPad *pad, GstQuery *query);
/* misc helper functions */
gboolean gst_pad_dispatcher (GstPad *pad, GstPadDispatcherFunction dispatch,
gpointer data);
#ifndef GST_DISABLE_LOADSAVE
void gst_pad_load_and_link (xmlNodePtr self, GstObject *parent);
#endif
G_END_DECLS
#endif /* __GST_PAD_H__ */