Commit graph

347 commits

Author SHA1 Message Date
François Laignel
1a8dfdfc54 Introduce gst_element_request_pad_simple
The name `gst_element_get_request_pad()` is confusing to people
learning GStreamer. `gst_element_request_pad_simple()` aims at
providing the exact same functionality, while making it more
explicit it is a simplified `gst_element_request_pad()`.

`gst_element_request_pad_simple()` is consistent with other
functions such as `gst_element_seek_simple`.

This commit deprecates `gst_element_get_request_pad()` so that a
compilation warning is emitted when used and incite developers
to use the more explicit `gst_element_request_pad_simple()`.

See also https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/743#note_886586

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/802>
2021-05-04 15:49:32 +02:00
Chris White
a38d06cb1c gst: Add missing G_GNUC_NULL_TERMINATED markers
Functions that require NULL as their last vararg are marked so the
compiler can warn on missing NULL.

Also, document the NULL terminator for gst_make_element_message_details()
and gst_tracer_record_new().

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/669

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/774>
2021-04-01 20:53:26 -04:00
Stéphane Cerveau
0da1721364 element: remove useless ret test
The ret test is unrelevant and confusing.
We dont want the code to fail and the register
to succeed by example.
In the case of a conditional element_init,
the element should be defined with
GST_ELEMENT_REGISTER_DEFINE_CUSTOM instead
of GST_ELEMENT_REGISTER_DEFINE_WITH_CODE.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/768>
2021-03-08 16:37:31 +01:00
Stéphane Cerveau
3952e19c2a features: remove extra G_BEGIN_DECLS/G_END_DECLS
_GST_ELEMENT_REGISTER_DEFINE_BEGIN
_GST_ELEMENT_REGISTER_DEFINE_END was introducing
an extra extern "C" in case of c++ build.

Add missing ";" in GST_ELEMENT_REGISTER_DECLARE

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/757>
2021-02-15 12:21:49 +01:00
Nicolas Dufresne
8a45c8d1df gir: Fix parser warning due to empty line
The GIR parser does not want any empty line after the function or macro
name line.

Fixes the following warning:
[309/4246] Generating Gst-1.0.gir with a custom command
../subprojects/gstreamer/gst/gstelement.h:57: Warning: Gst: "@element" parameter unexpected at this location:
 * @element: The element name in lower case, with words separated by '_'.
    ^
../subprojects/gstreamer/gst/gstelement.h:84: Warning: Gst: "@e" parameter unexpected at this location:
 * @e: The element name in lower case, with words separated by '_'.
    ^
../subprojects/gstreamer/gst/gstelement.h:106: Warning: Gst: "@e" parameter unexpected at this location:
 * @e: The element name in lower case, with words separated by '_'.
    ^
../subprojects/gstreamer/gst/gstdeviceprovider.h:32: Warning: Gst: "@d_p" parameter unexpected at this location:
 * @d_p: The device provider name in lower case, with words separated by '_'.
    ^
../subprojects/gstreamer/gst/gstdynamictypefactory.h:28: Warning: Gst: "@t_n" parameter unexpected at this location:
 * @t_n: The dynamic type name in lower case, with words separated by '_'.
    ^
../subprojects/gstreamer/gst/gsttypefind.h:34: Warning: Gst: "@type_find" parameter unexpected at this location:
 * @type_find: The type find name in lower case, with words separated by '_'.
    ^
../subprojects/gstreamer/gst/gsttypefind.h:61: Warning: Gst: "@t_f" parameter unexpected at this location:
 * @t_f: The type find name in lower case, with words separated by '_'.
    ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/719>
2020-12-10 14:08:53 -05:00
Julian Bouzas
7828237496 element: add convenience macros to register
Define separate macros to define an element
apart from the plugin itself.
These macros will help to register
elements a part from a plugin.
By example in the case of a gstreamer static build
producing the libgstreamer-full library.

More details here:

https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661>
2020-12-10 12:45:16 +01:00
Jan Alexander Steffens (heftig)
1d5a1e8235 element: Added gst_element_get_current_clock_time and gst_element_get_current_running_time
Helper functions for getting the element clock's time, and the clock
time minus base time, respectively.
2019-08-12 12:59:27 +03:00
Niels De Graef
09141c6e1f Use G_DEFINE_AUTOPTR_CLEANUP_FUNC unconditionally
Since we started depending on GLib 2.44, we can be sure this macro is
defined (it will be a no-op on compilers that don't support it). For
plugins we should just start using `G_DECLARE_FINAL_TYPE` which means
we no longer need the macro there, but for most types in core we don't
want to break ABI, which means it's better to just keep it like it is
(and use the `#ifdef` instead).
2019-06-04 08:50:59 +02:00
Mathieu Duponchelle
bcb4be455e gstelement: fix links to the gsterror page 2019-05-31 01:56:08 +02:00
Thibault Saunier
949fba4b1f doc: Fix hotdoc warnings
* Making sure that `static inline` function are in the GIR (by first
  defining them, and make sure to mark as skiped)
* Do not try to link to unexisting symbols
* Also generate GIR information about gst_tracers
2019-05-13 16:34:09 -04:00
Thibault Saunier
4e29b4aa34 doc: Add some missing docstrings 2019-05-13 11:33:49 -04:00
Sebastian Dröge
a42aaf87d5 gst: Fix various Since markers 2019-04-23 15:08:18 +03:00
luz.paz
4a402c1c7d Fix typos in comments and docs
Found via `codespell`

https://bugzilla.gnome.org/show_bug.cgi?id=795610
2018-05-01 11:18:03 +01:00
Tim-Philipp Müller
8983cce9f6 gst: GST_EXPORT -> GST_API
We need different export decorators for the different libs.
For now no actual change though, just rename before the release,
and add prelude headers to define the new decorator to GST_EXPORT.
2018-03-13 00:45:35 +00:00
Mathieu Duponchelle
c01949a99e pad templates: Allow specifying GType
See https://bugzilla.gnome.org/show_bug.cgi?id=731301

https://bugzilla.gnome.org/show_bug.cgi?id=789986
2017-11-22 16:44:08 +01:00
Tim-Philipp Müller
d106390adc element: add gst_element_foreach_*pad()
Add convenience API that iterates over all pads, sink pads or
source pads and makes sure that the foreach function is called
exactly once for each pad.

This is a KISS implementation. It doesn't use GstIterator and
doesn't try to do clever things like resync if pads are added
or removed while the function is executing. We can still do that
in future if we think it's needed, but in practice it will
likely make absolutely no difference whatsoever, since these
things will have to be handled properly elsewhere by the element
anyway if they're important.

After all, it's always possible that a pad is added or removed
just after the iterator finishes iterating, but before the
function returns.

This is also a replacement for gst_aggregator_iterate_sink_pads().

https://bugzilla.gnome.org/show_bug.cgi?id=785679
2017-11-02 15:59:22 +00:00
Sebastian Dröge
0459b2db84 element/deviceprovider: Add instance getter functions for class properties
That is, the metadata and pad templates. Using instance getters is
easier to deal with for bindings, especially autogenerated ones.
2017-08-17 14:13:39 +03:00
Thibault Saunier
54e16cc34e element: Add missing values for "to same" state changes
And handle newly added GstStateChange values in GstPipeline

https://bugzilla.gnome.org/show_bug.cgi?id=783798
2017-06-20 09:33:25 -04:00
Tim-Philipp Müller
92d3246f76 gst: mark symbols explicitly for export with GST_EXPORT
One omission: gst_allocator_sysmem_get_type() was
exported but never in any public header file.
2017-05-15 23:14:12 +01:00
Thibault Saunier
b15d59b53c doc: Fix some doctsing making GI happy 2017-04-21 10:51:59 -03:00
Thibault Saunier
e6db45a8af doc: Fix GstChangeState docstring 2017-04-20 17:58:08 -03:00
Thibault Saunier
a87b4551a6 Port gtk-doc comments to their equivalent markdown syntax
Modernizing our documentation and preparing a possible move to hotdoc.
This commits also adds missing @title metadatas to all SECTIONs
2017-01-27 16:36:38 -03:00
Thibault Saunier
76f049bc49 gst: Fix includes so that files can be built separately
It used to work but it has broke in the 1.10 cycle.
2017-01-27 16:33:42 -03:00
Tim-Philipp Müller
0794b593af docs: misc fixes 2016-11-16 10:57:33 +00:00
Thibault Saunier
da73b89200 element: Add API to more easily post messages about flowing issues
In many parts of the code we raise streaming error when the flow
goes wrong, and each time we create more or less similare error
message. Also that message does not let the application know what
has actually gone wrong. In the new API we add a "flow-return" detail
field inside the GstMessage so that the application has all the information
if it needs it.

API:
    GST_ELEMENT_FLOW_ERROR

https://bugzilla.gnome.org/show_bug.cgi?id=770158
2016-08-27 09:33:20 -03:00
Tim-Philipp Müller
3cba95ca2a element: rename gst_element_message_new_details() to gst_make_element_message_details()
Fixes g-i warning "Gst: Constructor return type mismatch
symbol='gst_element_message_new_details' constructed='Gst.Element'
return='Gst.Structure'".

This is a newly-added function in git that has not been in a stable
release yet, so it's fine to rename it. It's also only used indirectly
via macros.
2016-08-26 12:56:40 +01:00
Tim-Philipp Müller
d052ae63d8 element: fix GST_ELEMENT_ERROR() error code expansion
In some corner cases, the error 'code' part passed to
GST_ELEMENT_ERROR() is a valid define as well, in which
case it won't survive two levels of macro expansion, but
only one. Fixes:

oss4-sink.c: In function ‘gst_oss4_sink_open’:
error: ‘GST_RESOURCE_ERROR_0x00000002’ undeclared (first use in this function)
GST_ ## domain ## _ERROR_ ## code, __txt, __dbg, __FILE__,

which is from GST_ELEMENT_ERROR(el,RESOURCE,OPEN_WRITE,..)
and OPEN_WRITE happens to be defined to 2 here.

https://bugzilla.gnome.org/show_bug.cgi?id=756806
https://bugzilla.gnome.org/show_bug.cgi?id=769117
2016-07-24 01:35:41 +01:00
Vincent Penquerc'h
1105caa805 message: new API for additional custom data to error messages
https://bugzilla.gnome.org/show_bug.cgi?id=756806
2016-07-22 14:16:34 +01:00
Sebastian Dröge
8177173db0 element: Add gst_element_call_async()
This calls a function from another thread, asynchronously. This is to be
used for cases when a state change has to be performed from a streaming
thread, directly via gst_element_set_state() or indirectly e.g. via SEEK
events.

Calling those functions directly from the streaming thread will cause
deadlocks in many situations, as they might involve waiting for the
streaming thread to shut down from this very streaming thread.

This is mostly a convenience function around a GThreadPool and is for example
used by GstBin to continue asynchronous state changes.

https://bugzilla.gnome.org/show_bug.cgi?id=760532
2016-04-27 18:51:33 +03:00
Tim-Philipp Müller
6e3fb7af52 element: add API to get property change notifications via messages
Be notified in the application thread via bus messages about
notify::* and deep-notify::* property changes, instead of
having to deal with it in a non-application thread.

API: gst_element_add_property_notify_watch()
API: gst_element_add_property_deep_notify_watch()
API: gst_element_remove_property_notify_watch()
API: gst_message_new_property_notify()
API: gst_message_parse_property_notify()
API: GST_MESSAGE_PROPERTY_NOTIFY

https://bugzilla.gnome.org/show_bug.cgi?id=763142
2016-04-08 13:27:59 +01:00
Carlos Rafael Giani
f70dc95c35 docs: Flesh out element and object macro accessor docs a bit
https://bugzilla.gnome.org/show_bug.cgi?id=763213
2016-03-10 10:07:07 +00:00
Sebastian Dröge
01b2476d36 element: Remove GST_STATE_LOCK_FULL() / UNLOCK_FULL()
There is no corresponding API for that in GLib and nobody could've ever used
these macros without compiler errors anyway.
2016-02-29 17:07:26 +02:00
Tim-Philipp Müller
fa12d23a17 element: add gst_element_class_add_static_pad_template()
Pretty much every single element does

  gst_element_class_add_pad_template (element_class,
      gst_static_pad_template_get (&some_templ));

which is both confusing and unnecessary. We might just
as well add a function to do that in one step.

https://bugzilla.gnome.org/show_bug.cgi?id=762778
2016-02-28 13:10:03 +00:00
Xavier Claessens
46f83f5fcd core: Add g_autoptr() support to all types
https://bugzilla.gnome.org/show_bug.cgi?id=754464
2015-12-14 12:06:55 -05:00
Matthew Waters
d5ded15889 bin: implement context propagation when adding elements
When adding an element to a bin we need to propagate the GstContext's
to/from the element.

This moves the GstContext list from GstBin to GstElement and adds
convenience functions to get the currently set list of GstContext's.

This does not deal with the collection of GstContext's propagated
using GST_CONTEXT_QUERY.  Element subclasses are advised to call
gst_element_set_context if they need to propagate GstContext's
received from the context query.

https://bugzilla.gnome.org/show_bug.cgi?id=705579
2015-09-28 18:21:59 +10:00
Thibault Saunier
04d8b01e2e element: Add a FIXME for 2.0 about request_new_pad VS request_pad naming 2015-04-02 09:48:02 +02:00
Evan Nemerson
2759882379 introspection: add missing (nullable) annotations to return values
Support for (nullable) was added to G-I at the same time as nullable
return values.  Previous versions of G-I will not mark return values as
nullable, even when an (allow-none) annotation is present, so it is
not necessary to add (allow-none) annotations for compatibility with
older versions of G-I.

https://bugzilla.gnome.org/show_bug.cgi?id=730957
2014-06-26 18:56:38 +02:00
Evan Nemerson
e10266e3f3 docs: convert NULL, TRUE, and FALSE to %NULL, %TRUE, and %FALSE
This should help improve documentation generated for
languages other than C.

https://bugzilla.gnome.org/show_bug.cgi?id=730961
2014-05-30 00:20:27 +01:00
Sebastian Rasmussen
53ae1b2c9c docs: Fix typos in function/object descriptions
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=720029
2013-12-07 17:11:12 +00:00
Sebastian Dröge
014690326f element: Remove GstContext caching 2013-09-17 13:16:40 +02:00
Tim-Philipp Müller
7b19944280 info: use new internal printf for debug message printing
and remove all the printf extension/specifier stuff for
the system printf. Next we need to add back the custom
specifiers to our own printf implementation.

https://bugzilla.gnome.org/show_bug.cgi?id=613081
2013-04-12 23:05:57 +01:00
Sebastian Dröge
dd831b8114 element: Add API to get the last set context from an element
Elements should override GstElement::set_context() and also call
gst_element_set_context() to keep this context up-to-date with
the very latest context they internally use.
2013-03-31 11:26:32 +02:00
Sebastian Dröge
b909061031 gst: Add new GstContext miniobject for sharing contexts in a pipeline 2013-03-29 16:40:21 +01:00
Tim-Philipp Müller
666c8c11c6 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 20:44:48 +00:00
Sebastian Dröge
1c4fe1bf1a element: API: Add GstElement::post_message() vfunc
Conflicts:
	gst/gstelement.h
2012-10-16 12:35:56 +02:00
Wim Taymans
f05b0e222f Update for new seeking variable name
When seeking, the start value and type are now called start and start_type.
2012-07-27 15:24:52 +02:00
Edward Hervey
d3ffa82639 Remove 0.10-related documentation and "Since" markers 2012-07-10 12:03:27 +02:00
Evan Nemerson
d13ce8b7e8 introspection: add some missing annotations 2012-06-12 20:48:50 +02:00
Wim Taymans
26682f7c7a element: remove unused UNPARENTING flag 2012-06-11 15:49:10 +02:00
Tim-Philipp Müller
bca1ae8fb0 element: add gst_element_class_{set,add}_static_metadata()
Add gst_element_class_{add,set}_metadata() variants for static strings,
so we can avoid unnecessary g_strdup()s.

API: gst_element_class_add_static_metadata()
API: gst_element_class_set_static_metadata()
2012-04-09 12:49:38 +01:00