2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000,2004 Wim Taymans <wim@fluendo.com>
5 * gstelement.h: Header for GstElement
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
24 #ifndef __GST_ELEMENT_H__
25 #define __GST_ELEMENT_H__
27 /* gstelement.h and gstelementfactory.h include eachother */
28 typedef struct _GstElement GstElement;
29 typedef struct _GstElementClass GstElementClass;
31 /* gstmessage.h needs State */
34 * @GST_STATE_VOID_PENDING: no pending state.
35 * @GST_STATE_NULL : the NULL state or initial state of an element.
36 * @GST_STATE_READY : the element is ready to go to PAUSED.
37 * @GST_STATE_PAUSED : the element is PAUSED, it is ready to accept and
38 * process data. Sink elements however only accept one
39 * buffer and then block.
40 * @GST_STATE_PLAYING : the element is PLAYING, the #GstClock is running and
41 * the data is flowing.
43 * The possible states an element can be in. States can be changed using
44 * gst_element_set_state() and checked using gst_element_get_state().
47 GST_STATE_VOID_PENDING = 0,
55 #include <gst/gstconfig.h>
56 #include <gst/gstobject.h>
57 #include <gst/gstpad.h>
58 #include <gst/gstbus.h>
59 #include <gst/gstclock.h>
60 #include <gst/gstelementfactory.h>
61 #include <gst/gstplugin.h>
62 #include <gst/gstpluginfeature.h>
63 #include <gst/gstiterator.h>
64 #include <gst/gstmessage.h>
65 #include <gst/gstquery.h>
66 #include <gst/gsttaglist.h>
70 #define GST_TYPE_ELEMENT (gst_element_get_type ())
71 #define GST_IS_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_ELEMENT))
72 #define GST_IS_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_ELEMENT))
73 #define GST_ELEMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_ELEMENT, GstElementClass))
74 #define GST_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_ELEMENT, GstElement))
75 #define GST_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_ELEMENT, GstElementClass))
76 #define GST_ELEMENT_CAST(obj) ((GstElement*)(obj))
79 * GstStateChangeReturn:
80 * @GST_STATE_CHANGE_FAILURE : the state change failed
81 * @GST_STATE_CHANGE_SUCCESS : the state change succeeded
82 * @GST_STATE_CHANGE_ASYNC : the state change will happen asynchronously
83 * @GST_STATE_CHANGE_NO_PREROLL: the state change succeeded but the element
84 * cannot produce data in %GST_STATE_PAUSED.
85 * This typically happens with live sources.
87 * The possible return values from a state change function such as
88 * gst_element_set_state(). Only @GST_STATE_CHANGE_FAILURE is a real failure.
91 GST_STATE_CHANGE_FAILURE = 0,
92 GST_STATE_CHANGE_SUCCESS = 1,
93 GST_STATE_CHANGE_ASYNC = 2,
94 GST_STATE_CHANGE_NO_PREROLL = 3
95 } GstStateChangeReturn;
97 /* NOTE: this probably should be done with an #ifdef to decide
98 * whether to safe-cast or to just do the non-checking cast.
103 * @elem: a #GstElement to return state for.
105 * This macro returns the current #GstState of the element.
107 #define GST_STATE(elem) (GST_ELEMENT_CAST(elem)->current_state)
111 * @elem: a #GstElement to return the next state for.
113 * This macro returns the next #GstState of the element.
115 #define GST_STATE_NEXT(elem) (GST_ELEMENT_CAST(elem)->next_state)
119 * @elem: a #GstElement to return the pending state for.
121 * This macro returns the currently pending #GstState of the element.
123 #define GST_STATE_PENDING(elem) (GST_ELEMENT_CAST(elem)->pending_state)
127 * @elem: a #GstElement to return the target state for.
129 * This macro returns the target #GstState of the element.
131 #define GST_STATE_TARGET(elem) (GST_ELEMENT_CAST(elem)->target_state)
135 * @elem: a #GstElement to return the last state result for.
137 * This macro returns the last #GstStateChangeReturn value.
139 #define GST_STATE_RETURN(elem) (GST_ELEMENT_CAST(elem)->last_return)
141 #define __GST_SIGN(val) ((val) < 0 ? -1 : ((val) > 0 ? 1 : 0))
143 * GST_STATE_GET_NEXT:
144 * @cur: A starting #GstState
145 * @pending: A target #GstState
147 * Given a current state @cur and a target state @pending, calculate the next (intermediate)
150 #define GST_STATE_GET_NEXT(cur,pending) ((GstState)((cur) + __GST_SIGN ((gint)(pending) - (gint)(cur))))
152 * GST_STATE_TRANSITION:
153 * @cur: A current state
154 * @next: A next state
156 * Given a current state @cur and a next state @next, calculate the associated
157 * #GstStateChange transition.
159 #define GST_STATE_TRANSITION(cur,next) ((GstStateChange)(((cur)<<3)|(next)))
161 * GST_STATE_TRANSITION_CURRENT:
162 * @trans: A #GstStateChange
164 * Given a state transition @trans, extract the current #GstState.
166 #define GST_STATE_TRANSITION_CURRENT(trans) ((GstState)((trans)>>3))
168 * GST_STATE_TRANSITION_NEXT:
169 * @trans: A #GstStateChange
171 * Given a state transition @trans, extract the next #GstState.
173 #define GST_STATE_TRANSITION_NEXT(trans) ((GstState)((trans)&0x7))
177 * @GST_STATE_CHANGE_NULL_TO_READY : state change from NULL to READY.
180 * The element must check if the resources it needs are available. Device
181 * sinks and -sources typically try to probe the device to constrain their
185 * The element opens the device (in case feature need to be probed).
188 * @GST_STATE_CHANGE_READY_TO_PAUSED : state change from READY to PAUSED.
191 * The element pads are activated in order to receive data in PAUSED.
192 * Streaming threads are started.
195 * Some elements might need to return %GST_STATE_CHANGE_ASYNC and complete
196 * the state change when they have enough information. It is a requirement
197 * for sinks to return %GST_STATE_CHANGE_ASYNC and complete the state change
198 * when they receive the first buffer or %GST_EVENT_EOS (preroll).
199 * Sinks also block the dataflow when in PAUSED.
202 * A pipeline resets the running_time to 0.
205 * Live sources return %GST_STATE_CHANGE_NO_PREROLL and don't generate data.
208 * @GST_STATE_CHANGE_PAUSED_TO_PLAYING: state change from PAUSED to PLAYING.
211 * Most elements ignore this state change.
214 * The pipeline selects a #GstClock and distributes this to all the children
215 * before setting them to PLAYING. This means that it is only allowed to
216 * synchronize on the #GstClock in the PLAYING state.
219 * The pipeline uses the #GstClock and the running_time to calculate the
220 * base_time. The base_time is distributed to all children when performing
224 * Sink elements stop blocking on the preroll buffer or event and start
225 * rendering the data.
228 * Sinks can post %GST_MESSAGE_EOS in the PLAYING state. It is not allowed
229 * to post %GST_MESSAGE_EOS when not in the PLAYING state.
232 * While streaming in PAUSED or PLAYING elements can create and remove
236 * Live sources start generating data and return %GST_STATE_CHANGE_SUCCESS.
239 * @GST_STATE_CHANGE_PLAYING_TO_PAUSED: state change from PLAYING to PAUSED.
242 * Most elements ignore this state change.
245 * The pipeline calculates the running_time based on the last selected
246 * #GstClock and the base_time. It stores this information to continue
247 * playback when going back to the PLAYING state.
250 * Sinks unblock any #GstClock wait calls.
253 * When a sink does not have a pending buffer to play, it returns
254 * %GST_STATE_CHANGE_ASYNC from this state change and completes the state
255 * change when it receives a new buffer or an %GST_EVENT_EOS.
258 * Any queued %GST_MESSAGE_EOS items are removed since they will be reposted
259 * when going back to the PLAYING state. The EOS messages are queued in
260 * #GstBin containers.
263 * Live sources stop generating data and return %GST_STATE_CHANGE_NO_PREROLL.
266 * @GST_STATE_CHANGE_PAUSED_TO_READY : state change from PAUSED to READY.
269 * Sinks unblock any waits in the preroll.
272 * Elements unblock any waits on devices
275 * Chain or get_range functions return %GST_FLOW_FLUSHING.
278 * The element pads are deactivated so that streaming becomes impossible and
279 * all streaming threads are stopped.
282 * The sink forgets all negotiated formats
285 * Elements remove all sometimes pads
288 * @GST_STATE_CHANGE_READY_TO_NULL : state change from READY to NULL.
291 * Elements close devices
294 * Elements reset any internal state.
298 * These are the different state changes an element goes through.
299 * %GST_STATE_NULL ⇒ %GST_STATE_PLAYING is called an upwards state change
300 * and %GST_STATE_PLAYING ⇒ %GST_STATE_NULL a downwards state change.
302 typedef enum /*< flags=0 >*/
304 GST_STATE_CHANGE_NULL_TO_READY = (GST_STATE_NULL<<3) | GST_STATE_READY,
305 GST_STATE_CHANGE_READY_TO_PAUSED = (GST_STATE_READY<<3) | GST_STATE_PAUSED,
306 GST_STATE_CHANGE_PAUSED_TO_PLAYING = (GST_STATE_PAUSED<<3) | GST_STATE_PLAYING,
307 GST_STATE_CHANGE_PLAYING_TO_PAUSED = (GST_STATE_PLAYING<<3) | GST_STATE_PAUSED,
308 GST_STATE_CHANGE_PAUSED_TO_READY = (GST_STATE_PAUSED<<3) | GST_STATE_READY,
309 GST_STATE_CHANGE_READY_TO_NULL = (GST_STATE_READY<<3) | GST_STATE_NULL
314 * @GST_ELEMENT_FLAG_LOCKED_STATE: ignore state changes from parent
315 * @GST_ELEMENT_FLAG_SINK: the element is a sink
316 * @GST_ELEMENT_FLAG_SOURCE: the element is a source.
317 * @GST_ELEMENT_FLAG_PROVIDE_CLOCK: the element can provide a clock
318 * @GST_ELEMENT_FLAG_REQUIRE_CLOCK: the element requires a clock
319 * @GST_ELEMENT_FLAG_INDEXABLE: the element can use an index
320 * @GST_ELEMENT_FLAG_LAST: offset to define more flags
322 * The standard flags that an element may have.
326 GST_ELEMENT_FLAG_LOCKED_STATE = (GST_OBJECT_FLAG_LAST << 0),
327 GST_ELEMENT_FLAG_SINK = (GST_OBJECT_FLAG_LAST << 1),
328 GST_ELEMENT_FLAG_SOURCE = (GST_OBJECT_FLAG_LAST << 2),
329 GST_ELEMENT_FLAG_PROVIDE_CLOCK = (GST_OBJECT_FLAG_LAST << 3),
330 GST_ELEMENT_FLAG_REQUIRE_CLOCK = (GST_OBJECT_FLAG_LAST << 4),
331 GST_ELEMENT_FLAG_INDEXABLE = (GST_OBJECT_FLAG_LAST << 5),
333 GST_ELEMENT_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 10)
337 * GST_ELEMENT_IS_LOCKED_STATE:
338 * @elem: A #GstElement to query
340 * Check if the element is in the locked state and therefore will ignore state
341 * changes from its parent object.
343 #define GST_ELEMENT_IS_LOCKED_STATE(elem) (GST_OBJECT_FLAG_IS_SET(elem,GST_ELEMENT_FLAG_LOCKED_STATE))
347 * @elem: A #GstElement to query
349 * Gets the name of this element. Use only in core as this is not
350 * ABI-compatible. Others use gst_element_get_name()
352 #define GST_ELEMENT_NAME(elem) (GST_OBJECT_NAME(elem))
355 * GST_ELEMENT_PARENT:
356 * @elem: A #GstElement to query
358 * Get the parent object of this element.
360 #define GST_ELEMENT_PARENT(elem) (GST_ELEMENT_CAST(GST_OBJECT_PARENT(elem)))
364 * @elem: A #GstElement to query
366 * Get the message bus of this element.
368 #define GST_ELEMENT_BUS(elem) (GST_ELEMENT_CAST(elem)->bus)
372 * @elem: A #GstElement to query
374 * Get the clock of this element
376 #define GST_ELEMENT_CLOCK(elem) (GST_ELEMENT_CAST(elem)->clock)
380 * @elem: A #GstElement to query
382 * Get the pads of this elements.
384 #define GST_ELEMENT_PADS(elem) (GST_ELEMENT_CAST(elem)->pads)
387 * GST_ELEMENT_START_TIME:
388 * @elem: a #GstElement to return the start time for.
390 * This macro returns the start_time of the @elem. The start_time is the
391 * running_time of the pipeline when the element went to PAUSED.
393 #define GST_ELEMENT_START_TIME(elem) (GST_ELEMENT_CAST(elem)->start_time)
397 * @el: the element that generates the error
398 * @domain: like CORE, LIBRARY, RESOURCE or STREAM (see #gstreamer-GstGError)
399 * @code: error code defined for that domain (see #gstreamer-GstGError)
400 * @text: the message to display (format string and args enclosed in
402 * @debug: debugging information for the message (format string and args
403 enclosed in parentheses)
405 * Utility function that elements can use in case they encountered a fatal
406 * data processing error. The pipeline will post an error message and the
407 * application will be requested to stop further media processing.
409 #define GST_ELEMENT_ERROR(el, domain, code, text, debug) \
411 gchar *__txt = _gst_element_error_printf text; \
412 gchar *__dbg = _gst_element_error_printf debug; \
414 GST_WARNING_OBJECT (el, "error: %s", __txt); \
416 GST_WARNING_OBJECT (el, "error: %s", __dbg); \
417 gst_element_message_full (GST_ELEMENT(el), GST_MESSAGE_ERROR, \
418 GST_ ## domain ## _ERROR, GST_ ## domain ## _ERROR_ ## code, \
419 __txt, __dbg, __FILE__, GST_FUNCTION, __LINE__); \
423 * GST_ELEMENT_WARNING:
424 * @el: the element that generates the warning
425 * @domain: like CORE, LIBRARY, RESOURCE or STREAM (see #gstreamer-GstGError)
426 * @code: error code defined for that domain (see #gstreamer-GstGError)
427 * @text: the message to display (format string and args enclosed in
429 * @debug: debugging information for the message (format string and args
430 enclosed in parentheses)
432 * Utility function that elements can use in case they encountered a non-fatal
433 * data processing problem. The pipeline will post a warning message and the
434 * application will be informed.
436 #define GST_ELEMENT_WARNING(el, domain, code, text, debug) \
438 gchar *__txt = _gst_element_error_printf text; \
439 gchar *__dbg = _gst_element_error_printf debug; \
441 GST_WARNING_OBJECT (el, "warning: %s", __txt); \
443 GST_WARNING_OBJECT (el, "warning: %s", __dbg); \
444 gst_element_message_full (GST_ELEMENT(el), GST_MESSAGE_WARNING, \
445 GST_ ## domain ## _ERROR, GST_ ## domain ## _ERROR_ ## code, \
446 __txt, __dbg, __FILE__, GST_FUNCTION, __LINE__); \
451 * @el: the element that generates the information
452 * @domain: like CORE, LIBRARY, RESOURCE or STREAM (see #gstreamer-GstGError)
453 * @code: error code defined for that domain (see #gstreamer-GstGError)
454 * @text: the message to display (format string and args enclosed in
456 * @debug: debugging information for the message (format string and args
457 enclosed in parentheses)
459 * Utility function that elements can use in case they want to inform
460 * the application of something noteworthy that is not an error.
461 * The pipeline will post a info message and the
462 * application will be informed.
464 #define GST_ELEMENT_INFO(el, domain, code, text, debug) \
466 gchar *__txt = _gst_element_error_printf text; \
467 gchar *__dbg = _gst_element_error_printf debug; \
469 GST_INFO_OBJECT (el, "info: %s", __txt); \
471 GST_INFO_OBJECT (el, "info: %s", __dbg); \
472 gst_element_message_full (GST_ELEMENT(el), GST_MESSAGE_INFO, \
473 GST_ ## domain ## _ERROR, GST_ ## domain ## _ERROR_ ## code, \
474 __txt, __dbg, __FILE__, GST_FUNCTION, __LINE__); \
477 /* the state change mutexes and conds */
479 * GST_STATE_GET_LOCK:
480 * @elem: a #GstElement
482 * Get a reference to the state lock of @elem.
483 * This lock is used by the core. It is taken while getting or setting
484 * the state, during state changes, and while finalizing.
486 #define GST_STATE_GET_LOCK(elem) (&(GST_ELEMENT_CAST(elem)->state_lock))
488 * GST_STATE_GET_COND:
489 * @elem: a #GstElement
491 * Get the conditional used to signal the completion of a state change.
493 #define GST_STATE_GET_COND(elem) (&GST_ELEMENT_CAST(elem)->state_cond)
495 #define GST_STATE_LOCK(elem) g_rec_mutex_lock(GST_STATE_GET_LOCK(elem))
496 #define GST_STATE_TRYLOCK(elem) g_rec_mutex_trylock(GST_STATE_GET_LOCK(elem))
497 #define GST_STATE_UNLOCK(elem) g_rec_mutex_unlock(GST_STATE_GET_LOCK(elem))
498 #define GST_STATE_UNLOCK_FULL(elem) g_rec_mutex_unlock_full(GST_STATE_GET_LOCK(elem))
499 #define GST_STATE_LOCK_FULL(elem,t) g_rec_mutex_lock_full(GST_STATE_GET_LOCK(elem), t)
500 #define GST_STATE_WAIT(elem) g_cond_wait (GST_STATE_GET_COND (elem), \
501 GST_OBJECT_GET_LOCK (elem))
502 #define GST_STATE_WAIT_UNTIL(elem, end_time) g_cond_wait_until (GST_STATE_GET_COND (elem), \
503 GST_OBJECT_GET_LOCK (elem), end_time)
504 #define GST_STATE_SIGNAL(elem) g_cond_signal (GST_STATE_GET_COND (elem));
505 #define GST_STATE_BROADCAST(elem) g_cond_broadcast (GST_STATE_GET_COND (elem));
509 * @state_lock: Used to serialize execution of gst_element_set_state()
510 * @state_cond: Used to signal completion of a state change
511 * @state_cookie: Used to detect concurrent execution of
512 * gst_element_set_state() and gst_element_get_state()
513 * @target_state: the target state of an element as set by the application
514 * @current_state: the current state of an element
515 * @next_state: the next state of an element, can be #GST_STATE_VOID_PENDING if
516 * the element is in the correct state.
517 * @pending_state: the final state the element should go to, can be
518 * #GST_STATE_VOID_PENDING if the element is in the correct state
519 * @last_return: the last return value of an element state change
520 * @bus: the bus of the element. This bus is provided to the element by the
521 * parent element or the application. A #GstPipeline has a bus of its own.
522 * @clock: the clock of the element. This clock is usually provided to the
523 * element by the toplevel #GstPipeline.
524 * @base_time: the time of the clock right before the element is set to
525 * PLAYING. Subtracting @base_time from the current clock time in the PLAYING
526 * state will yield the running_time against the clock.
527 * @start_time: the running_time of the last PAUSED state
528 * @numpads: number of pads of the element, includes both source and sink pads.
529 * @pads: (element-type Gst.Pad): list of pads
530 * @numsrcpads: number of source pads of the element.
531 * @srcpads: (element-type Gst.Pad): list of source pads
532 * @numsinkpads: number of sink pads of the element.
533 * @sinkpads: (element-type Gst.Pad): list of sink pads
534 * @pads_cookie: updated whenever the a pad is added or removed
536 * GStreamer element abstract base class.
542 /*< public >*/ /* with LOCK */
543 GRecMutex state_lock;
547 guint32 state_cookie;
548 GstState target_state;
549 GstState current_state;
551 GstState pending_state;
552 GstStateChangeReturn last_return;
556 /* allocated clock */
558 GstClockTimeDiff base_time; /* NULL/READY: 0 - PAUSED: current time - PLAYING: difference to clock */
559 GstClockTime start_time;
561 /* element pads, these lists can only be iterated while holding
562 * the LOCK or checking the cookie after each LOCK. */
571 /* with object LOCK */
575 gpointer _gst_reserved[GST_PADDING-1];
580 * @parent_class: the parent class structure
581 * @metadata: metadata for elements of this class
582 * @elementfactory: the #GstElementFactory that creates these elements
583 * @padtemplates: a #GList of #GstPadTemplate
584 * @numpadtemplates: the number of padtemplates
585 * @pad_templ_cookie: changed whenever the padtemplates change
586 * @request_new_pad: called when a new pad is requested
587 * @release_pad: called when a request pad is to be released
588 * @get_state: get the state of the element
589 * @set_state: set a new state on the element
590 * @change_state: called by @set_state to perform an incremental state change
591 * @set_bus: set a #GstBus on the element
592 * @provide_clock: gets the #GstClock provided by the element
593 * @set_clock: set the #GstClock on the element
594 * @send_event: send a #GstEvent to the element
595 * @query: perform a #GstQuery on the element
596 * @state_changed: called immediately after a new state was set.
597 * @post_message: called when a message is posted on the element. Chain up to
598 * the parent class' handler to have it posted on the bus.
599 * @set_context: set a #GstContext on the element
601 * GStreamer element class. Override the vmethods to implement the element
604 struct _GstElementClass
606 GstObjectClass parent_class;
609 /* the element metadata */
612 /* factory that the element was created from */
613 GstElementFactory *elementfactory;
615 /* templates for our pads */
617 gint numpadtemplates;
618 guint32 pad_templ_cookie;
621 /* signal callbacks */
622 void (*pad_added) (GstElement *element, GstPad *pad);
623 void (*pad_removed) (GstElement *element, GstPad *pad);
624 void (*no_more_pads) (GstElement *element);
627 /* virtual methods for subclasses */
629 /* request/release pads */
630 /* FIXME 2.0 harmonize naming with gst_element_request_pad */
631 GstPad* (*request_new_pad) (GstElement *element, GstPadTemplate *templ,
632 const gchar* name, const GstCaps *caps);
634 void (*release_pad) (GstElement *element, GstPad *pad);
637 GstStateChangeReturn (*get_state) (GstElement * element, GstState * state,
638 GstState * pending, GstClockTime timeout);
639 GstStateChangeReturn (*set_state) (GstElement *element, GstState state);
640 GstStateChangeReturn (*change_state) (GstElement *element, GstStateChange transition);
641 void (*state_changed) (GstElement *element, GstState oldstate,
642 GstState newstate, GstState pending);
645 void (*set_bus) (GstElement * element, GstBus * bus);
648 GstClock* (*provide_clock) (GstElement *element);
649 gboolean (*set_clock) (GstElement *element, GstClock *clock);
651 /* query functions */
652 gboolean (*send_event) (GstElement *element, GstEvent *event);
654 gboolean (*query) (GstElement *element, GstQuery *query);
656 gboolean (*post_message) (GstElement *element, GstMessage *message);
658 void (*set_context) (GstElement *element, GstContext *context);
661 gpointer _gst_reserved[GST_PADDING_LARGE-2];
664 /* element class pad templates */
665 void gst_element_class_add_pad_template (GstElementClass *klass, GstPadTemplate *templ);
666 GstPadTemplate* gst_element_class_get_pad_template (GstElementClass *element_class, const gchar *name);
667 GList* gst_element_class_get_pad_template_list (GstElementClass *element_class);
669 /* element class meta data */
670 void gst_element_class_set_metadata (GstElementClass *klass,
671 const gchar *longname,
672 const gchar *classification,
673 const gchar *description,
674 const gchar *author);
675 void gst_element_class_set_static_metadata (GstElementClass *klass,
676 const gchar *longname,
677 const gchar *classification,
678 const gchar *description,
679 const gchar *author);
680 void gst_element_class_add_metadata (GstElementClass * klass,
681 const gchar * key, const gchar * value);
682 void gst_element_class_add_static_metadata (GstElementClass * klass,
683 const gchar * key, const gchar * value);
684 const gchar * gst_element_class_get_metadata (GstElementClass * klass,
688 /* element instance */
689 GType gst_element_get_type (void);
691 /* basic name and parentage stuff from GstObject */
694 * gst_element_get_name:
695 * @elem: a #GstElement to get the name of @elem.
697 * Returns a copy of the name of @elem.
698 * Caller should g_free() the return value after usage.
699 * For a nameless element, this returns %NULL, which you can safely g_free()
702 * Returns: (transfer full) (nullable): the name of @elem. g_free()
703 * after usage. MT safe.
706 #define gst_element_get_name(elem) gst_object_get_name(GST_OBJECT_CAST(elem))
709 * gst_element_set_name:
710 * @elem: a #GstElement to set the name of.
711 * @name: the new name
713 * Sets the name of the element, getting rid of the old name if there was one.
715 #define gst_element_set_name(elem,name) gst_object_set_name(GST_OBJECT_CAST(elem),name)
718 * gst_element_get_parent:
719 * @elem: a #GstElement to get the parent of.
721 * Get the parent of an element.
723 * Returns: (transfer full): the parent of an element.
725 #define gst_element_get_parent(elem) gst_object_get_parent(GST_OBJECT_CAST(elem))
728 * gst_element_set_parent:
729 * @elem: a #GstElement to set the parent of.
730 * @parent: the new parent #GstObject of the element.
732 * Sets the parent of an element.
734 #define gst_element_set_parent(elem,parent) gst_object_set_parent(GST_OBJECT_CAST(elem),parent)
737 GstClock* gst_element_provide_clock (GstElement *element);
738 GstClock* gst_element_get_clock (GstElement *element);
739 gboolean gst_element_set_clock (GstElement *element, GstClock *clock);
740 void gst_element_set_base_time (GstElement *element, GstClockTime time);
741 GstClockTime gst_element_get_base_time (GstElement *element);
742 void gst_element_set_start_time (GstElement *element, GstClockTime time);
743 GstClockTime gst_element_get_start_time (GstElement *element);
746 void gst_element_set_bus (GstElement * element, GstBus * bus);
747 GstBus * gst_element_get_bus (GstElement * element);
750 void gst_element_set_context (GstElement * element, GstContext * context);
751 GList * gst_element_get_contexts (GstElement * element);
752 GstContext * gst_element_get_context (GstElement * element, const gchar * context_type);
753 GstContext * gst_element_get_context_unlocked (GstElement * element, const gchar * context_type);
756 gboolean gst_element_add_pad (GstElement *element, GstPad *pad);
757 gboolean gst_element_remove_pad (GstElement *element, GstPad *pad);
758 void gst_element_no_more_pads (GstElement *element);
760 GstPad* gst_element_get_static_pad (GstElement *element, const gchar *name);
761 GstPad* gst_element_get_request_pad (GstElement *element, const gchar *name);
762 GstPad* gst_element_request_pad (GstElement *element, GstPadTemplate *templ,
763 const gchar * name, const GstCaps *caps);
764 void gst_element_release_request_pad (GstElement *element, GstPad *pad);
766 GstIterator * gst_element_iterate_pads (GstElement * element);
767 GstIterator * gst_element_iterate_src_pads (GstElement * element);
768 GstIterator * gst_element_iterate_sink_pads (GstElement * element);
770 /* event/query/format stuff */
771 gboolean gst_element_send_event (GstElement *element, GstEvent *event);
772 gboolean gst_element_seek (GstElement *element, gdouble rate,
773 GstFormat format, GstSeekFlags flags,
774 GstSeekType start_type, gint64 start,
775 GstSeekType stop_type, gint64 stop);
776 gboolean gst_element_query (GstElement *element, GstQuery *query);
779 gboolean gst_element_post_message (GstElement * element, GstMessage * message);
782 /* gcc versions < 3.3 warn about NULL being passed as format to printf */
783 #if (!defined(__GNUC__) || (__GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ < 3))
784 gchar * _gst_element_error_printf (const gchar *format, ...);
786 gchar * _gst_element_error_printf (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
788 void gst_element_message_full (GstElement * element, GstMessageType type,
789 GQuark domain, gint code, gchar * text,
790 gchar * debug, const gchar * file,
791 const gchar * function, gint line);
793 /* state management */
794 gboolean gst_element_is_locked_state (GstElement *element);
795 gboolean gst_element_set_locked_state (GstElement *element, gboolean locked_state);
796 gboolean gst_element_sync_state_with_parent (GstElement *element);
798 GstStateChangeReturn gst_element_get_state (GstElement * element,
801 GstClockTime timeout);
802 GstStateChangeReturn gst_element_set_state (GstElement *element, GstState state);
804 void gst_element_abort_state (GstElement * element);
805 GstStateChangeReturn gst_element_change_state (GstElement * element,
806 GstStateChange transition);
807 GstStateChangeReturn gst_element_continue_state (GstElement * element,
808 GstStateChangeReturn ret);
809 void gst_element_lost_state (GstElement * element);
811 /* factory management */
812 GstElementFactory* gst_element_get_factory (GstElement *element);
816 #endif /* __GST_ELEMENT_H__ */