Commit graph

137 commits

Author SHA1 Message Date
Thibault Saunier
2fd28195ca Move files from gst-plugins-base into the "subprojects/gst-plugins-base/" subdir 2021-09-24 16:13:26 -03:00
Guillaume Desmottes
c148ecf2cb appsrc: serialize custom events with buffers flow
Application may want to inject events to the pipeline and keep them
synchronized with the buffers flow.

Fix #247

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1046>
2021-07-22 13:56:22 +02:00
Sebastian Dröge
1565b9635b appsrc: When dropping buffers before handling the initial segment use the latest input segment
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1198>
2021-06-08 17:31:02 +03:00
Sebastian Dröge
0b9976ac46 appsrc: Correctly check if this is the first buffer that was queued
By checking the queue length this would also count events and caps. We
already keep track of the number of buffers separately so just use that.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1197>
2021-06-08 13:05:46 +03:00
Mathieu Duponchelle
d1fa109083 appsrc: signal enough-data even when leaking
this is convenient for application that wish to monitor whether
the appsrc is leaking.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1193>
2021-06-05 16:55:44 +02:00
Sebastian Dröge
02530e9d3e appsrc: Implement a leaky property similar to the queue element
This allows dropping the newest or oldest buffer when the internal queue
is full instead of blocking or continuing to grow.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1133>
2021-05-05 15:13:33 +00:00
Sebastian Dröge
d987ec21f2 appsrc: Add new max-buffers / max-time / current-level-buffers / current-level-time properties
These work the same way as the corresponding properties on queue and
allow to control the internal buffer size of the appsrc in a more
flexible way.

Unlike in queue the max-buffers and max-time properties are 0 (i.e.
disabled) by default for backwards compatibility reasons.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1133>
2021-05-05 15:13:33 +00:00
Sebastian Dröge
da9a3da8aa appsrc: Don't leak buffer list while wrongly unreffing buffer on EOS/flushing
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1134>
2021-05-03 05:42:07 +00:00
Mathieu Duponchelle
06c158957d appsrc: fix signal documentation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/992>
2020-12-31 17:01:40 +00:00
Sebastian Dröge
825eea9545 Add some missing nullable annotations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/876>
2020-10-17 15:30:02 +00:00
Sebastian Dröge
d2a0b38717 appsrc: Wake up the create() function on caps changes
This allows the new caps to be sent downstream as soon as possible
instead of having to wait for the next buffer/buffer list.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/798>
2020-09-09 06:45:49 +00:00
Jan Schmidt
b18fd0f239 appsrc: Post a bus error if a segment can't be applied
When applying segments from the input samples, post a bus
error and fail loudly if the segment fails to configure, instead of
just posting debug output.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/783>
2020-08-11 07:35:56 +00:00
Seungha Yang
061e195e01 appsrc: Fix annotations
Don't put double ':' there

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/663>
2020-07-10 07:52:53 +00:00
Seungha Yang
64e768e836 appsrc: Add support for custom GstSegment
Add property "handle-segment-change" for user to allow pushing
custom segment event. For now, this property can work only for
time format GstSegment.
This property can be useful in case application controls timeline
of stream such as there is timestamp discontinuity but playback is
expected to be continuous. Multi-period scenario of MPEG-DASH is an
example of this use case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/663>
2020-07-10 07:52:53 +00:00
Sebastian Dröge
9a55945c0b appsrc/appsink: Make setting/replacing callbacks thread-safe
Previously we would simply use them without any locking at all, while
using the object lock for setting them. Nothing prevented new callbacks
to be set in the meantime, potentially calling a callback with already
freed user_data.

To prevent this move the callbacks into a reference counted struct and
use the appsrc/appsink mutex to protect access to it, which is used in
all functions calling the callbacks already anyway.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/729
2020-02-14 14:42:19 +00:00
Thibault Saunier
909baa2360 Pass the code through codespell 2019-08-30 13:05:36 +00:00
Niels De Graef
0314b482f3 Don't pass default GLib marshallers for signals
By passing NULL to `g_signal_new` instead of a marshaller, GLib will
actually internally optimize the signal (if the marshaller is available
in GLib itself) by also setting the valist marshaller. This makes the
signal emission a bit more performant than the regular marshalling,
which still needs to box into `GValue` and call libffi in case of a
generic marshaller.

Note that for custom marshallers, one would use
`g_signal_set_va_marshaller()` with the valist marshaller instead.
2019-08-27 07:31:57 +02:00
Wonchul Lee
7883663e26 appsrc: Fix typo in documentation 2019-06-15 14:33:32 +09:00
Wonchul Lee
a75e47e815 appsrc: Fix docs typo
Fix typo empty-percent to min-percent
2019-03-16 14:57:56 +00:00
Tim-Philipp Müller
7b98593280 app: Update for g_type_class_add_private() deprecation in recent GLib
https://gitlab.gnome.org/GNOME/glib/merge_requests/7
2018-06-23 21:33:16 +02:00
Sebastian Dröge
a19497ab67 appsrc/sink: Fix optimization for only signalling waiters if someone is actually waiting
It is possible that both application and the stream are waiting
currently, if for example the following happens:
  1) app is waiting because no buffer in appsink
  2) appsink providing a buffer and waking up app
  3) appsink getting another buffer and waiting because it's full now
  4) app thread getting back control

Previously step 4 would overwrite that the appsink is currently waiting,
so it would never be signalled again.

https://bugzilla.gnome.org/show_bug.cgi?id=795551
2018-05-02 18:11:58 +03:00
Vivia Nikolaidou
06aa4e5b68 appsrc: Documentation fix in gst_app_src_push_sample_internal
Make it clear that it doesn't take ownership of the sample.

https://bugzilla.gnome.org/show_bug.cgi?id=795150
2018-04-11 12:28:26 +03:00
Tim-Philipp Müller
4fe5178957 appsrc: don't signal the GCond if no one is waiting on it
Performance optimisation: Keep track whenever the streaming
thread or the application thread are waiting on the GCond for
more space or new data, and only signal on the GCond if someone
is actually waiting. Avoids unnecessary syscalls and thus
context switches.
2018-02-19 16:04:22 +00:00
Tim-Philipp Müller
5a5a1f0dc6 appsrc: use GstQueueArray instead of GQueue for internal item queue
Performance optimisation.

Avoids alloc/free churn for the queue's list nodes.

Depends on new API in GstQueueArray in core.
2018-02-19 16:04:15 +00:00
Tim-Philipp Müller
b60cc0274c appsrc: add support for pushing buffer lists
And samples that carry buffer lists.

https://bugzilla.gnome.org/show_bug.cgi?id=752363
2017-12-09 11:09:16 +00:00
Philippe Normand
d375a28a37 appsrc: handle duration query only if the property was set
https://bugzilla.gnome.org/show_bug.cgi?id=786200
2017-08-12 16:23:27 +01:00
Tim-Philipp Müller
6105420bfc appsrc: fix doc typos 2017-08-01 17:08:08 +01:00
Sebastian Dröge
8be5030d47 appsrc: Add out annotations to gst_app_src_get_latency() 2017-08-01 18:49:23 +03:00
Sebastian Dröge
b56dcb3e20 app: Generate GLib enums with glib-mkenums 2017-04-09 12:29:55 +03:00
Thibault Saunier
099ac9faf2 docs: Convert gtkdoc comments to markdown
Modernizing the documentation, making it simpler to read an
modify and allowing us to possibly switch to hotdoc in the
future.
2017-03-10 18:19:17 -03:00
Tobias Mueller
57ff3ea72f appsrc: fix compiler warning
Initialize min and max _get_property() to gets rid of these
compiler warnings:

gstappsrc.c:741:7: error: 'max' may be used uninitialized in this function
       g_value_set_int64 (value, max);
       ^
gstappsrc.c:733:7: error: 'min' may be used uninitialized in this function
       g_value_set_int64 (value, min);
       ^
Which happens because gcc doesn't know that GST_IS_APP_SRC will never
fail here.

https://bugzilla.gnome.org/show_bug.cgi?id=752052
2016-12-25 13:15:26 +00:00
Seungha Yang
50f74daa2f appsrc: Remove trailing whitespace
https://bugzilla.gnome.org/show_bug.cgi?id=768510
2016-07-11 09:54:11 +03:00
Sebastian Dröge
1032f5c1b3 appsrc: If do-timestamp=TRUE, capture the time when the buffer was pushed to the source
... instead of the time when it was pushed further downstream.

https://bugzilla.gnome.org/show_bug.cgi?id=763630
2016-07-01 14:32:26 +02:00
Tim-Philipp Müller
75f3c7cb85 app: use generic marshallers 2016-05-15 15:26:13 +01:00
Sebastian Dröge
dc8120f298 appsrc: Add duration property for providing a duration in TIME format
https://bugzilla.gnome.org/show_bug.cgi?id=766229
2016-05-10 16:50:32 +03:00
Vineeth TM
44b70ca3a1 base: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763075
2016-03-24 14:25:41 +02:00
Arun Raghavan
91084f49c0 appsrc: Minor documentation cleanup 2016-01-19 12:56:20 +05:30
Kazunori Kobayashi
d43f1b2a5a appsrc: Clear is_eos flag when receiving the flush-stop event
The EOS event can be propagated to the downstream elements when
is_eos flag remains set even after leaving the flushing state.
This fix allows this element to normally restart the streaming
after receiving the flush event by clearing the is_eos flag.

https://bugzilla.gnome.org/show_bug.cgi?id=759110
2015-12-19 11:35:39 +01:00
Philippe Normand
872f40d7d9 appsrc: duration query support based on the size property
https://bugzilla.gnome.org/show_bug.cgi?id=759126
2015-12-08 12:42:46 +02:00
Sebastian Dröge
8613525301 appsrc: Always take the mutex before flushing the queue
Otherwise the application might push new buffers into the queue while we're
flushing, potentially causing the GQueue data structure to become inconsistent
and causing crashes soon after.

https://bugzilla.gnome.org/show_bug.cgi?id=754597
2015-09-09 12:33:02 +03:00
Vikram Fugro
bbe967a278 appsrc: retain the latest caps in queue when flushing
- Retain the latest caps in the internal queue, when
  flushing.
- Add a unit test case for the same.

https://bugzilla.gnome.org/show_bug.cgi?id=754597
2015-09-09 12:27:40 +03:00
Philippe Normand
9361f7c576 appsrc: remove duplicate get_size vfunc assignment 2015-08-31 12:11:10 +03:00
Tim-Philipp Müller
8304893d06 appsrc: optimise caps changing when previously-set caps have not taken effect yet
Only negotiate/change caps once when setting caps twice and
the first-set caps have not been used yet.

Based on patch by Eunhae Choi.

https://bugzilla.gnome.org/show_bug.cgi?id=747517
2015-05-18 13:37:54 +01:00
Ilya Konstantinov
d668b511d1 appsrc: docs grammar fixes
https://bugzilla.gnome.org/show_bug.cgi?id=747516
2015-04-09 20:39:42 +01:00
Nicola Murino
f23736d52f appsrc: handle a sample not having caps or a buffer more gracefully
https://bugzilla.gnome.org/show_bug.cgi?id=746908
2015-03-28 12:00:38 +00:00
Sebastian Dröge
8547594727 Improve and fix LATENCY query handling
This now follows the design docs everywhere, especially the maximum latency
handling.

https://bugzilla.gnome.org/show_bug.cgi?id=744106
2015-02-11 17:53:49 +02:00
Nicola Murino
617f72b526 appsrc: Add push_sample() convenience function for easy appsink -> appsrc use
https://bugzilla.gnome.org/show_bug.cgi?id=728379
2014-09-12 14:07:49 +03:00
Sebastian Dröge
8fc307fae0 appsrc: Some minor fixes and cleanup 2014-08-06 10:07:42 +02:00
Wang Xin-yu (王昕宇)
251c63c4ab appsrc: Make caps set action queued together with buffer
https://bugzilla.gnome.org/show_bug.cgi?id=729760
2014-08-06 10:04:49 +02:00
Youness Alaoui
6b0063aab5 appsrc: Fix memory leak with callback notify not being called in dispose
https://bugzilla.gnome.org/show_bug.cgi?id=733386
2014-07-19 14:38:36 +02:00