gstreamer_core/gst/gstpad.h
changeset 8 4a7fac7dd34a
parent 0 0e761a78d257
child 10 6f340f756486
equal deleted inserted replaced
7:71e347f905f2 8:4a7fac7dd34a
    26 
    26 
    27 #include <gst/gstconfig.h>
    27 #include <gst/gstconfig.h>
    28 
    28 
    29 #include <gst/gstobject.h>
    29 #include <gst/gstobject.h>
    30 #include <gst/gstbuffer.h>
    30 #include <gst/gstbuffer.h>
       
    31 #include <gst/gstbufferlist.h>
    31 #include <gst/gstcaps.h>
    32 #include <gst/gstcaps.h>
    32 #include <gst/gstevent.h>
    33 #include <gst/gstevent.h>
    33 #include <gst/gstquery.h>
    34 #include <gst/gstquery.h>
    34 #include <gst/gsttask.h>
    35 #include <gst/gsttask.h>
    35 
    36 
    45 #define GST_PAD_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD, GstPadClass))
    46 #define GST_PAD_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD, GstPadClass))
    46 #define GST_PAD_CAST(obj)		((GstPad*)(obj))
    47 #define GST_PAD_CAST(obj)		((GstPad*)(obj))
    47 
    48 
    48 
    49 
    49 typedef struct _GstPad GstPad;
    50 typedef struct _GstPad GstPad;
       
    51 typedef struct _GstPadPrivate GstPadPrivate;
    50 typedef struct _GstPadClass GstPadClass;
    52 typedef struct _GstPadClass GstPadClass;
    51 
    53 
    52 /**
    54 /**
    53  * GstPadLinkReturn:
    55  * GstPadLinkReturn:
    54  * @GST_PAD_LINK_OK		: link succeeded
    56  * @GST_PAD_LINK_OK		: link succeeded
   227  *
   229  *
   228  * The implementer of this function receives a refcount to @buffer and should
   230  * The implementer of this function receives a refcount to @buffer and should
   229  * gst_buffer_unref() when the buffer is no longer needed.
   231  * gst_buffer_unref() when the buffer is no longer needed.
   230  *
   232  *
   231  * When a chain function detects an error in the data stream, it must post an
   233  * When a chain function detects an error in the data stream, it must post an
   232  * error on the buffer and return an appropriate #GstFlowReturn value.
   234  * error on the bus and return an appropriate #GstFlowReturn value.
   233  *
   235  *
   234  * Returns: #GST_FLOW_OK for success
   236  * Returns: #GST_FLOW_OK for success
   235  */
   237  */
   236 typedef GstFlowReturn		(*GstPadChainFunction)		(GstPad *pad, GstBuffer *buffer);
   238 typedef GstFlowReturn		(*GstPadChainFunction)		(GstPad *pad, GstBuffer *buffer);
       
   239 
       
   240 /**
       
   241  * GstPadChainListFunction:
       
   242  * @pad: the sink #GstPad that performed the chain.
       
   243  * @list: the #GstBufferList that is chained, not %NULL.
       
   244  *
       
   245  * A function that will be called on sinkpads when chaining buffer lists.
       
   246  * The function typically processes the data contained in the buffer list and
       
   247  * either consumes the data or passes it on to the internally linked pad(s).
       
   248  *
       
   249  * The implementer of this function receives a refcount to @list and
       
   250  * should gst_buffer_list_unref() when the list is no longer needed.
       
   251  *
       
   252  * When a chainlist function detects an error in the data stream, it must
       
   253  * post an error on the bus and return an appropriate #GstFlowReturn value.
       
   254  *
       
   255  * Returns: #GST_FLOW_OK for success
       
   256  */
       
   257 typedef GstFlowReturn		(*GstPadChainListFunction)	(GstPad *pad, GstBufferList *list);
       
   258 
   237 /**
   259 /**
   238  * GstPadGetRangeFunction:
   260  * GstPadGetRangeFunction:
   239  * @pad: the src #GstPad to perform the getrange on.
   261  * @pad: the src #GstPad to perform the getrange on.
   240  * @offset: the offset of the range
   262  * @offset: the offset of the range
   241  * @length: the length of the range
   263  * @length: the length of the range
   310  * @pad: The #GstPad to query.
   332  * @pad: The #GstPad to query.
   311  *
   333  *
   312  * The signature of the internal pad link function.
   334  * The signature of the internal pad link function.
   313  *
   335  *
   314  * Returns: a newly allocated #GList of pads that are linked to the given pad on
   336  * Returns: a newly allocated #GList of pads that are linked to the given pad on
   315  *  the inside of the parent element.
   337  * the inside of the parent element.
   316  *  The caller must call g_list_free() on it after use.
   338  *
       
   339  * The caller must call g_list_free() on it after use.
       
   340  *
       
   341  * Deprecated: use the threadsafe #GstPadIterIntLinkFunction instead.
   317  */
   342  */
   318 typedef GList*			(*GstPadIntLinkFunction)	(GstPad *pad);
   343 typedef GList*			(*GstPadIntLinkFunction)	(GstPad *pad);
   319 
   344 
       
   345 /**
       
   346  * GstPadIterIntLinkFunction:
       
   347  * @pad: The #GstPad to query.
       
   348  *
       
   349  * The signature of the internal pad link iterator function.
       
   350  *
       
   351  * Returns: a new #GstIterator that will iterate over all pads that are
       
   352  * linked to the given pad on the inside of the parent element.
       
   353  *
       
   354  * the caller must call gst_iterator_free() after usage.
       
   355  *
       
   356  * Since 0.10.21
       
   357  */
       
   358 typedef GstIterator*           (*GstPadIterIntLinkFunction)    (GstPad *pad);
   320 
   359 
   321 /* generic query function */
   360 /* generic query function */
   322 /**
   361 /**
   323  * GstPadQueryTypeFunction:
   362  * GstPadQueryTypeFunction:
   324  * @pad: a #GstPad to query
   363  * @pad: a #GstPad to query
   422  *
   461  *
   423  * The purpose of this function is to allocate a buffer that is optimal to
   462  * The purpose of this function is to allocate a buffer that is optimal to
   424  * be processed by @pad. The function is mostly overridden by elements that can
   463  * be processed by @pad. The function is mostly overridden by elements that can
   425  * provide a hardware buffer in order to avoid additional memcpy operations.
   464  * provide a hardware buffer in order to avoid additional memcpy operations.
   426  *
   465  *
   427  * The function can return a buffer that does not have @caps, in which case the
   466  * The function can return a buffer that has caps different from the requested
   428  * upstream element requests a format change. If a format change was requested,
   467  * @caps, in which case the upstream element requests a format change to this
   429  * the returned buffer will be one to hold the data of said new caps, so its
   468  * new caps.
   430  * size might be different from @size.
   469  * If a format change was requested, the returned buffer will be one to hold
       
   470  * the data of said new caps, so its size might be different from the requested
       
   471  * @size.
   431  *
   472  *
   432  * When this function returns anything else than #GST_FLOW_OK, the buffer allocation
   473  * When this function returns anything else than #GST_FLOW_OK, the buffer allocation
   433  * failed and @buf does not contain valid data.
   474  * failed and @buf does not contain valid data. If the function returns #GST_FLOW_OK and
       
   475  * the @buf is NULL, a #GstBuffer will be created with @caps, @offset and @size.
   434  *
   476  *
   435  * By default this function returns a new buffer of @size and with @caps containing
   477  * By default this function returns a new buffer of @size and with @caps containing
   436  * purely malloced data. The buffer should be freed with gst_buffer_unref()
   478  * purely malloced data. The buffer should be freed with gst_buffer_unref()
   437  * after usage.
   479  * after usage.
   438  *
   480  *
   528  * @activatepullfunc: function to activate/deactivate pad in pull mode
   570  * @activatepullfunc: function to activate/deactivate pad in pull mode
   529  * @linkfunc: function called when pad is linked
   571  * @linkfunc: function called when pad is linked
   530  * @unlinkfunc: function called when pad is unlinked
   572  * @unlinkfunc: function called when pad is unlinked
   531  * @peer: the pad this pad is linked to
   573  * @peer: the pad this pad is linked to
   532  * @sched_private: private storage for the scheduler
   574  * @sched_private: private storage for the scheduler
   533  * @chainfunc: function to chain data to pad
   575  * @chainfunc: function to chain buffer to pad
   534  * @checkgetrangefunc: function to check if pad can operate in pull mode
   576  * @checkgetrangefunc: function to check if pad can operate in pull mode
   535  * @getrangefunc: function to get a range of data from a pad
   577  * @getrangefunc: function to get a range of data from a pad
   536  * @eventfunc: function to send an event to a pad
   578  * @eventfunc: function to send an event to a pad
   537  * @mode: current activation mode of the pad
   579  * @mode: current activation mode of the pad
   538  * @querytypefunc: get list of supported queries
   580  * @querytypefunc: get list of supported queries
   539  * @queryfunc: perform a query on the pad
   581  * @queryfunc: perform a query on the pad
   540  * @intlinkfunc: get the internal links of this pad
   582  * @intlinkfunc: get the internal links of this pad
   541  * @bufferallocfunc: function to allocate a buffer for this pad
   583  * @bufferallocfunc: function to allocate a buffer for this pad
   542  * @do_buffer_signals: counter counting installed buffer signals
   584  * @do_buffer_signals: counter counting installed buffer signals
   543  * @do_event_signals: counter counting installed event signals
   585  * @do_event_signals: counter counting installed event signals
       
   586  * @iterintlinkfunc: get the internal links iterator of this pad
       
   587  * @block_destroy_data: notify function for gst_pad_set_blocked_async_full()
   544  *
   588  *
   545  * The #GstPad structure. Use the functions to update the variables.
   589  * The #GstPad structure. Use the functions to update the variables.
   546  */
   590  */
   547 struct _GstPad {
   591 struct _GstPad {
   548   GstObject			object;
   592   GstObject			object;
   606   /* whether to emit signals for have-data. counts number
   650   /* whether to emit signals for have-data. counts number
   607    * of handlers attached. */
   651    * of handlers attached. */
   608   gint				 do_buffer_signals;
   652   gint				 do_buffer_signals;
   609   gint				 do_event_signals;
   653   gint				 do_event_signals;
   610 
   654 
       
   655   /* ABI added */
       
   656   /* iterate internal links */
       
   657   GstPadIterIntLinkFunction     iterintlinkfunc;
       
   658 
       
   659   /* free block_data */
       
   660   GDestroyNotify block_destroy_data;
       
   661 
   611   /*< private >*/
   662   /*< private >*/
   612   gpointer _gst_reserved[GST_PADDING];
   663   union {
       
   664     struct {
       
   665       gboolean                      block_callback_called;
       
   666       GstPadPrivate                *priv;
       
   667     } ABI;
       
   668     gpointer _gst_reserved[GST_PADDING - 2];
       
   669   } abidata;
   613 };
   670 };
   614 
   671 
   615 struct _GstPadClass {
   672 struct _GstPadClass {
   616   GstObjectClass	parent_class;
   673   GstObjectClass	parent_class;
   617 
   674 
   644 #define GST_PAD_GETRANGEFUNC(pad)	(GST_PAD_CAST(pad)->getrangefunc)
   701 #define GST_PAD_GETRANGEFUNC(pad)	(GST_PAD_CAST(pad)->getrangefunc)
   645 #define GST_PAD_EVENTFUNC(pad)		(GST_PAD_CAST(pad)->eventfunc)
   702 #define GST_PAD_EVENTFUNC(pad)		(GST_PAD_CAST(pad)->eventfunc)
   646 #define GST_PAD_QUERYTYPEFUNC(pad)	(GST_PAD_CAST(pad)->querytypefunc)
   703 #define GST_PAD_QUERYTYPEFUNC(pad)	(GST_PAD_CAST(pad)->querytypefunc)
   647 #define GST_PAD_QUERYFUNC(pad)		(GST_PAD_CAST(pad)->queryfunc)
   704 #define GST_PAD_QUERYFUNC(pad)		(GST_PAD_CAST(pad)->queryfunc)
   648 #define GST_PAD_INTLINKFUNC(pad)	(GST_PAD_CAST(pad)->intlinkfunc)
   705 #define GST_PAD_INTLINKFUNC(pad)	(GST_PAD_CAST(pad)->intlinkfunc)
       
   706 #define GST_PAD_ITERINTLINKFUNC(pad)    (GST_PAD_CAST(pad)->iterintlinkfunc)
   649 
   707 
   650 #define GST_PAD_PEER(pad)		(GST_PAD_CAST(pad)->peer)
   708 #define GST_PAD_PEER(pad)		(GST_PAD_CAST(pad)->peer)
   651 #define GST_PAD_LINKFUNC(pad)		(GST_PAD_CAST(pad)->linkfunc)
   709 #define GST_PAD_LINKFUNC(pad)		(GST_PAD_CAST(pad)->linkfunc)
   652 #define GST_PAD_UNLINKFUNC(pad)		(GST_PAD_CAST(pad)->unlinkfunc)
   710 #define GST_PAD_UNLINKFUNC(pad)		(GST_PAD_CAST(pad)->unlinkfunc)
   653 
   711 
       
   712 /**
       
   713  * GST_PAD_CAPS:
       
   714  * @pad: a #GstPad.
       
   715  *
       
   716  * The caps for this pad.
       
   717  */
   654 #define GST_PAD_CAPS(pad)		(GST_PAD_CAST(pad)->caps)
   718 #define GST_PAD_CAPS(pad)		(GST_PAD_CAST(pad)->caps)
   655 #define GST_PAD_GETCAPSFUNC(pad)	(GST_PAD_CAST(pad)->getcapsfunc)
   719 #define GST_PAD_GETCAPSFUNC(pad)	(GST_PAD_CAST(pad)->getcapsfunc)
   656 #define GST_PAD_SETCAPSFUNC(pad)	(GST_PAD_CAST(pad)->setcapsfunc)
   720 #define GST_PAD_SETCAPSFUNC(pad)	(GST_PAD_CAST(pad)->setcapsfunc)
   657 #define GST_PAD_ACCEPTCAPSFUNC(pad)	(GST_PAD_CAST(pad)->acceptcapsfunc)
   721 #define GST_PAD_ACCEPTCAPSFUNC(pad)	(GST_PAD_CAST(pad)->acceptcapsfunc)
   658 #define GST_PAD_FIXATECAPSFUNC(pad)	(GST_PAD_CAST(pad)->fixatecapsfunc)
   722 #define GST_PAD_FIXATECAPSFUNC(pad)	(GST_PAD_CAST(pad)->fixatecapsfunc)
   819 								 GstPadBlockCallback callback, gpointer user_data);
   883 								 GstPadBlockCallback callback, gpointer user_data);
   820 #ifdef __SYMBIAN32__
   884 #ifdef __SYMBIAN32__
   821 IMPORT_C
   885 IMPORT_C
   822 #endif
   886 #endif
   823 
   887 
       
   888 gboolean		gst_pad_set_blocked_async_full		(GstPad *pad, gboolean blocked,
       
   889 								 GstPadBlockCallback callback, gpointer user_data,
       
   890                                                                  GDestroyNotify destroy_data);
       
   891 #ifdef __SYMBIAN32__
       
   892 IMPORT_C
       
   893 #endif
       
   894 
   824 gboolean		gst_pad_is_blocked			(GstPad *pad);
   895 gboolean		gst_pad_is_blocked			(GstPad *pad);
   825 #ifdef __SYMBIAN32__
   896 #ifdef __SYMBIAN32__
   826 IMPORT_C
   897 IMPORT_C
   827 #endif
   898 #endif
   828 
   899 
   886 void			gst_pad_set_chain_function		(GstPad *pad, GstPadChainFunction chain);
   957 void			gst_pad_set_chain_function		(GstPad *pad, GstPadChainFunction chain);
   887 #ifdef __SYMBIAN32__
   958 #ifdef __SYMBIAN32__
   888 IMPORT_C
   959 IMPORT_C
   889 #endif
   960 #endif
   890 
   961 
       
   962 void			gst_pad_set_chain_list_function	(GstPad *pad, GstPadChainListFunction chainlist);
       
   963 #ifdef __SYMBIAN32__
       
   964 IMPORT_C
       
   965 #endif
       
   966 
   891 void			gst_pad_set_getrange_function		(GstPad *pad, GstPadGetRangeFunction get);
   967 void			gst_pad_set_getrange_function		(GstPad *pad, GstPadGetRangeFunction get);
   892 #ifdef __SYMBIAN32__
   968 #ifdef __SYMBIAN32__
   893 IMPORT_C
   969 IMPORT_C
   894 #endif
   970 #endif
   895 
   971 
   914 #ifdef __SYMBIAN32__
   990 #ifdef __SYMBIAN32__
   915 IMPORT_C
   991 IMPORT_C
   916 #endif
   992 #endif
   917 
   993 
   918 
   994 
       
   995 gboolean                gst_pad_can_link                        (GstPad *srcpad, GstPad *sinkpad);
       
   996 #ifdef __SYMBIAN32__
       
   997 IMPORT_C
       
   998 #endif
       
   999 
   919 GstPadLinkReturn        gst_pad_link				(GstPad *srcpad, GstPad *sinkpad);
  1000 GstPadLinkReturn        gst_pad_link				(GstPad *srcpad, GstPad *sinkpad);
   920 #ifdef __SYMBIAN32__
  1001 #ifdef __SYMBIAN32__
   921 IMPORT_C
  1002 IMPORT_C
   922 #endif
  1003 #endif
   923 
  1004 
   960 #endif
  1041 #endif
   961 
  1042 
   962 
  1043 
   963 G_CONST_RETURN GstCaps*	gst_pad_get_pad_template_caps		(GstPad *pad);
  1044 G_CONST_RETURN GstCaps*	gst_pad_get_pad_template_caps		(GstPad *pad);
   964 
  1045 
   965 /* capsnego function for connected/unconnected pads */
  1046 /* capsnego function for linked/unlinked pads */
   966 #ifdef __SYMBIAN32__
  1047 #ifdef __SYMBIAN32__
   967 IMPORT_C
  1048 IMPORT_C
   968 #endif
  1049 #endif
   969 
  1050 
   970 GstCaps *		gst_pad_get_caps			(GstPad * pad);
  1051 GstCaps *		gst_pad_get_caps			(GstPad * pad);
   993 IMPORT_C
  1074 IMPORT_C
   994 #endif
  1075 #endif
   995 
  1076 
   996 gboolean		gst_pad_peer_accept_caps		(GstPad * pad, GstCaps *caps);
  1077 gboolean		gst_pad_peer_accept_caps		(GstPad * pad, GstCaps *caps);
   997 
  1078 
   998 /* capsnego for connected pads */
  1079 /* capsnego for linked pads */
   999 #ifdef __SYMBIAN32__
  1080 #ifdef __SYMBIAN32__
  1000 IMPORT_C
  1081 IMPORT_C
  1001 #endif
  1082 #endif
  1002 
  1083 
  1003 GstCaps *		gst_pad_get_allowed_caps		(GstPad * pad);
  1084 GstCaps *		gst_pad_get_allowed_caps		(GstPad * pad);
  1011 #ifdef __SYMBIAN32__
  1092 #ifdef __SYMBIAN32__
  1012 IMPORT_C
  1093 IMPORT_C
  1013 #endif
  1094 #endif
  1014 
  1095 
  1015 GstFlowReturn		gst_pad_push				(GstPad *pad, GstBuffer *buffer);
  1096 GstFlowReturn		gst_pad_push				(GstPad *pad, GstBuffer *buffer);
       
  1097 #ifdef __SYMBIAN32__
       
  1098 IMPORT_C
       
  1099 #endif
       
  1100 
       
  1101 GstFlowReturn		gst_pad_push_list			(GstPad *pad, GstBufferList *list);
  1016 #ifdef __SYMBIAN32__
  1102 #ifdef __SYMBIAN32__
  1017 IMPORT_C
  1103 IMPORT_C
  1018 #endif
  1104 #endif
  1019 
  1105 
  1020 gboolean		gst_pad_check_pull_range		(GstPad *pad);
  1106 gboolean		gst_pad_check_pull_range		(GstPad *pad);
  1043 GstFlowReturn		gst_pad_chain				(GstPad *pad, GstBuffer *buffer);
  1129 GstFlowReturn		gst_pad_chain				(GstPad *pad, GstBuffer *buffer);
  1044 #ifdef __SYMBIAN32__
  1130 #ifdef __SYMBIAN32__
  1045 IMPORT_C
  1131 IMPORT_C
  1046 #endif
  1132 #endif
  1047 
  1133 
       
  1134 GstFlowReturn		gst_pad_chain_list                      (GstPad *pad, GstBufferList *list);
       
  1135 #ifdef __SYMBIAN32__
       
  1136 IMPORT_C
       
  1137 #endif
       
  1138 
  1048 GstFlowReturn		gst_pad_get_range			(GstPad *pad, guint64 offset, guint size,
  1139 GstFlowReturn		gst_pad_get_range			(GstPad *pad, guint64 offset, guint size,
  1049 								 GstBuffer **buffer);
  1140 								 GstBuffer **buffer);
  1050 #ifdef __SYMBIAN32__
  1141 #ifdef __SYMBIAN32__
  1051 IMPORT_C
  1142 IMPORT_C
  1052 #endif
  1143 #endif
  1085 #ifdef __SYMBIAN32__
  1176 #ifdef __SYMBIAN32__
  1086 IMPORT_C
  1177 IMPORT_C
  1087 #endif
  1178 #endif
  1088 
  1179 
  1089 GList*			gst_pad_get_internal_links_default	(GstPad *pad);
  1180 GList*			gst_pad_get_internal_links_default	(GstPad *pad);
       
  1181 #ifdef __SYMBIAN32__
       
  1182 IMPORT_C
       
  1183 #endif
       
  1184 
       
  1185 
       
  1186 void                    gst_pad_set_iterate_internal_links_function (GstPad * pad,
       
  1187                                                                  GstPadIterIntLinkFunction iterintlink);
       
  1188 #ifdef __SYMBIAN32__
       
  1189 IMPORT_C
       
  1190 #endif
       
  1191 
       
  1192 GstIterator *           gst_pad_iterate_internal_links          (GstPad * pad);
       
  1193 #ifdef __SYMBIAN32__
       
  1194 IMPORT_C
       
  1195 #endif
       
  1196 
       
  1197 GstIterator *           gst_pad_iterate_internal_links_default  (GstPad * pad);
       
  1198 
  1090 
  1199 
  1091 /* generic query function */
  1200 /* generic query function */
  1092 #ifdef __SYMBIAN32__
  1201 #ifdef __SYMBIAN32__
  1093 IMPORT_C
  1202 IMPORT_C
  1094 #endif
  1203 #endif