Commit graph

411 commits

Author SHA1 Message Date
Wim Taymans
6802620d9d basesrc: indent fix 2012-09-13 10:24:30 +02:00
Víctor Manuel Jáquez Leal
65cfafb3b9 basesrc: getters for pool and allocator
Sometimes the sources would use the buffer pool or the memory allocator for
something else than just allocating output buffers; for example, querying for
different parameters, such as a bigger number of buffers to allocate by the
pool.

This patch expose a two getters accessors: one for the buffer pool and the
other for the memory allocator.
2012-08-14 15:45:14 +02:00
Thiago Santos
5c0e02c79c basesrc: retry on not-negotiate if a reconfigure is pending
Before erroring out on not-negotiated returns, check if the pad
has the reconfigure flag set and retry.

https://bugzilla.gnome.org/show_bug.cgi?id=681198
2012-08-10 13:58:02 -03:00
Tim-Philipp Müller
9427851fd2 basesrc: don't try to answer URI queries with NULL URIs
Should make unit tests in -base that use appsrc a bit happier.
2012-08-06 20:04:09 +01:00
Sebastian Dröge
0d22988e5c event: Update for stream-start event API changes 2012-08-06 14:00:56 +02:00
Sebastian Dröge
389ec66946 basesrc: Add default handler for URI query in GstURIHandler subclasses 2012-07-31 17:26:37 +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
Tim-Philipp Müller
ebcfd0ce05 basesrc: provide fallback in case a create function doesn't know about provided buffers
In 0.11 the caller may provide a buffer to be filled by the source to
pull_range/get_range/create, but it's easy to miss this new case when
porting code from 0.10. Provide fallback that copies the created data
into the provided buffer for now.

This makes oggdemux in pull-mode work with dataurisrc.
2012-07-10 09:42:15 +01:00
Tim-Philipp Müller
c51a2c1ddf basesrc, basesink, baseparse, typefind: use GST_SEGMENT_FLAG with segment flags 2012-07-09 21:51:07 +01:00
Wim Taymans
f362f643ac memory: Make GstAllocator a GstObject
Make GstAllocator a GstObject instead of a GstMiniObject, like bufferpool.
Make a new gstallocator.c file. Make a GstAllocator subclass for the default
allocator.
2012-07-09 16:28:22 +02:00
Sebastian Dröge
aa2309e54a event: Add format and position to the segment-done event 2012-07-05 13:04:31 +02:00
Sebastian Dröge
49d2ad5633 event: Implement segment-done event 2012-07-05 12:52:51 +02:00
Wim Taymans
d7fdf75e13 basesrc: handle DTS and PTS
Use DTS and PTS of the subclass.
Calculate PTS from DTS on keyframes.
2012-06-28 09:44:06 +02:00
Wim Taymans
76e8b2ecda task: add GDestroyNotify to _new
Add a GDestroyNotify to the user_data we pass to gst_task_new()
Change gst_pad_start_task() to also take the notify
2012-06-20 10:31:49 +02:00
Evan Nemerson
8f6b6b8ab5 introspection: assorted introspection and documentation fixes in base 2012-06-18 13:28:35 +02:00
Wim Taymans
1c60558d8c basesrc: avoid flush when starting
When we are doing the initial seek in startup, avoid doing a flush
(and unlock) because we know that the task is not started yet.
2012-06-15 14:54:48 +02:00
Wim Taymans
36d034d1e4 basesrc: handle flush events on the element as well
Handle flush-start and flush-stop sent on the element as well and send them
downstream. Make sure to send a segment event after the flush stop.
2012-06-12 16:01:56 +02:00
Sebastian Dröge
aee0d2a2b3 basesrc: Don't ignore the return value of gst_pad_set_caps() and call it after the vfunc 2012-06-08 15:41:17 +02:00
Wim Taymans
80ff9dfb3d basesrc: release the object lock sooner
Release the object lock before we get the time of the clock because that code
might take other locks.
Fix potential clock refcount error because we released the object lock but
didn't ref the clock.
2012-06-07 15:32:27 +02:00
Wim Taymans
42e755f7c3 basesrc: remove 0.11 fixme
We always require elements to have an unlock_stop vmethod.
2012-06-07 15:32:27 +02:00
Wim Taymans
d6e909994c basesrc: avoid potential deadlock
In gst_base_src_start_complete() we do a perform_seek() that will eventually
start the streaming thread which acquires the live lock and then goes to sleep
in the case of appsrc. Right after we perform seek we also try to acquire the
live lock which might then deadlock.

fix this by taking the stream lock before performing the seek. This makes sure
that the streaming thread cannot start and grab the live lock until we are done
and release the stream lock again.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=676048
2012-05-16 09:24:45 +02:00
Wim Taymans
05580beb77 docs: fix docs
GST_FLOW_WRONG_STATE -> GST_FLOW_FLUSHING
2012-05-11 09:14:52 +02:00
Sebastian Dröge
105fa1ffde basetransform/basesrc: Do bufferpool configuration inside the default decide_allocation() implementation
This allows subclasses to override it, as is necessary for e.g. the
video-crop meta. It is now necessary that after decide_allocation()
there is always a allocator and a configured buffer pool inside the
query.
2012-05-01 13:32:41 +02:00
Wim Taymans
f9c85a53dc pad: improve docs of get/pull_range
Improve the docs of the get/pull_range functions, define the lifetime of the
buffer in case of errors and short reads.
Make sure the code does what the docs say.
2012-03-20 13:14:55 +01:00
Wim Taymans
db1318ab4a pad: change the semantics of get/pull_range a little
Make it so that one can specify a buffer for get/pull_range where the downstream
element should write into. When passing NULL, upstream should allocate a buffer,
like in 0.10.
We also need to change the probes a little because before the pull probe, there
could already be a buffer passed. This then allows us to use the same PROBE
macro for before and after pulling.
While we're at the probes, make the query probe more powerful by handling the
GST_PAD_PROBE_DROP return value. Returning _DROP from a query probe will now
return TRUE upstream and will not forward the probe to the peer or handler.
Also handle _DROP for get/pull_range properly by not dispatching to the
peer/handler or by generating EOS when the probe returns DROP and no buffer.
Make filesrc handle the non-NULL buffer passed in the get_range function and
skip the allocation in that case, writing directly into the downstream provided
buffer.
Update tests because now we need to make sure to not pass a random value in the
buffer pointer to get/pull_range
2012-03-16 21:37:10 +01:00
Wim Taymans
a7e6c7d2a8 bufferpool: split bufferpool configuration
Make separate methods to control the bufferpool and the allocator used by the
bufferpool.
Make it possible to change the allocator of a pool.
2012-03-15 22:09:02 +01:00
Wim Taymans
83af60019e query: rework the ALLOCATION query
Separate the bufferpool and allocator hints in the allocation query, some
of the values don't always make sense together.
Keep the bufferpool and its configuration together.
Keep the allocator and its parameters together.
Allow for multiple bufferpool configurations in the query.
2012-03-15 20:23:59 +01:00
Wim Taymans
85c9543841 memory: group allocation parameters in a struct
Group the extra allocation parameters in a GstAllocationParams structure to make
it easier to deal with them and so that we can extend them later if needed.
Make gst_buffer_new_allocate() take the GstAllocationParams for added
functionality.
Add boxed type for GstAllocationParams.
2012-03-15 13:42:17 +01:00
Wim Taymans
edd2ffe4d4 memory: Add 0 padding
Change gst_allocator_alloc() so that we can also spicify flags and padding.
Add 2 new flags to mark the memory 0 prefixed/padded. This allows us to
remove some resizes in the base classes.
When allocating memory, memset prefix and padding with 0 when the flags tell
us to.
On resize, clear the zero padding flags if we can't guarantee the memory is
still 0 filled.
Update tests.
2012-03-14 21:32:22 +01:00
Wim Taymans
3d76e6011c query: also include padding in ALLOCATION query
Negotiating padding is needed on second thought so include it in the
ALLOCATION query.
Make the bufferpool take padding into account when allocating.
Make basesrc take padding into account.
Use padding and prefix when allocating in basetransform.
2012-03-14 19:47:10 +01:00
Wim Taymans
72ac5f5165 basesrc: take prefix into account when allocating
Take into account the prefix that we received from the allocation query and use
it to allocate and resize a larger buffer.
2012-03-14 18:45:55 +01:00
Wim Taymans
43abf99a8a caps: avoid using in-place oprations
Rework some caps operations so they don't rely on writable caps but instead take
ownership of the input caps and do _make_writable() only when needed.
Remove some const from caps functions, it does not make much sense for
refcounted objects and does not allow us to return a refcount to the const input
caps.
Rework the base classes fixate vmethods to not operate on the caps in-place.
All this saves us around 30% of caps and structure copy and new operations.
2012-03-11 18:57:44 +01:00
Sebastian Dröge
cfe71423f0 gst: Remove gstmarshal.[ch] completely and use the generic marshaller
Fixes bug #671130.
2012-03-02 11:05:48 +01:00
Edward Hervey
dc304041ed basesrc: Move variable and assignment to where it's needed 2012-02-17 15:11:38 -08:00
Wim Taymans
7ab1d62c24 GST_FLOW_WRONG_STATE -> GST_FLOW_FLUSHING 2012-02-08 16:18:04 +01:00
Wim Taymans
18118218b1 basesrc: fix race in startup
Mark renegotiate before starting the pushing thread.
Do also check if we are starting in the get_range function.
2012-01-31 17:41:13 +01:00
Wim Taymans
0bd5a78701 query: pass allocator in query
Place the allocator object in the ALLOCATION query instead of the name. This
allows us to exchange allocators that are not in the global pool of allocators.
Update elements for the new api
2012-01-30 16:13:31 +01:00
Wim Taymans
af2fc026fc memory: make the allocator refcounted
Add refcounting to the GstAllocator object.
Remove const from functions because the allocator is refcounted now.
Rename the vmethods for consistency
Expose the constructor for GstAllocator and add a destroy notify for the
user_data. This should make it possible to create allocators that are not
registered and shared globally along with the possibility to destroy them
properly.
Update defs with new symbols.
2012-01-30 13:20:36 +01:00
Sebastian Dröge
0d4081fbbb basesrc: Send the stream-start event as first event ever 2012-01-27 10:41:07 +01:00
Wim Taymans
c6ac51e729 basesrc: handle NULL from getcaps
If the getcaps functions returns NULL, return FALSE from the CAPS query.
2012-01-19 15:17:58 +01:00
Wim Taymans
252327f87a Update for new gthread API 2012-01-19 09:27:04 +01:00
Mark Nauwelaerts
247842eaa9 basesrc: prevent unlikely caps leak 2012-01-13 14:21:27 +01:00
Wim Taymans
63d95063a7 basesrc: handle latency event 2012-01-02 15:42:46 +01:00
Wim Taymans
768e28e1c4 basesrc: say we handle RECONFIGURE event
We handle the RECONFIGURE event so return TRUE from the event handler.
2011-12-10 11:08:22 +01:00
Wim Taymans
e32fa21071 basesrc: stop when negotiation fails 2011-12-09 10:01:16 +01:00
Wim Taymans
ebc25e895f basesrc: add async start option
Add a method to enable async start behaviour. The subclass can then complete the
start operation from any other thread by caling gst_base_src_start_complete().
The base class can wait for the start to complete with
gst_base_src_start_wait().
2011-12-06 14:01:50 +01:00
Tim-Philipp Müller
a1daf846f3 Merge remote-tracking branch 'origin/master' into 0.11
Conflicts:
	gst/gstobject.h
	libs/gst/check/gstcheck.h
	libs/gst/controller/gstcontroller.c
	plugins/elements/gstidentity.c
	tools/gst-xmlinspect.c
2011-12-04 15:38:09 +00:00
Tim-Philipp Müller
2666450864 Suppress deprecation warnings in selected files, for g_static_rec_mutex_* mostly
GStaticRecMutex is part of our API/ABI, not much we can do here in 0.10.
2011-12-04 14:38:26 +00:00
Tim-Philipp Müller
5889260d5a Work around deprecated thread API in glib master
Add private replacements for deprecated functions such as
g_mutex_new(), g_mutex_free(), g_cond_new() etc., mostly
to avoid the deprecation warnings. We can't change most of
these in 0.10 because they're part of our API and ABI.
2011-12-04 13:35:38 +00:00
Wim Taymans
d893040aec basesrc: add some more debug 2011-12-01 15:35:02 +01:00
Wim Taymans
d65773b5fa element: clean up element flags
Clean up the element flags
2011-11-28 16:54:55 +01:00
Matej Knopp
6ea74a0572 Fix printf format compiler warnings on OSX/64bit
https://bugzilla.gnome.org/show_bug.cgi?id=664491
2011-11-22 00:51:06 +00:00
Wim Taymans
2f1ed65339 pad: Merge pad mode activation functions
Add the pad mode to the activate function so that we can reuse the same function
for all activation modes. This makes the core logic smaller and allows for some
elements to make their activation code easier. It would allow us to add more
scheduling modes later without having to add more activate functions.
2011-11-21 13:29:05 +01:00
Wim Taymans
770159fb1c query: improve scheduling query
Turns some boolean arguments in the scheduling query to flags, which are easier
to extend and makes the code easier to read.
Make extra methods for configuring and querying the supported scheduling modes.
This should make it easier to add new modes later.
2011-11-18 17:27:16 +01:00
Wim Taymans
39a5e26ea9 pad: add parent to activate functions 2011-11-18 13:54:29 +01:00
Wim Taymans
12d5f03453 pad: fix scheduling mode enums
GstPadActivateMode -> GstPadMode
GST_PAD_ACTIVATE_* -> GST_PAD_MODE_*
2011-11-18 12:39:55 +01:00
Wim Taymans
612b1fbb14 pad: add parent to other functions
Add parent to chain, chain_list, getrange and event functions.
2011-11-17 12:40:45 +01:00
Wim Taymans
09a8294d36 pad: add parent to the query function 2011-11-16 17:22:56 +01:00
Wim Taymans
c55962c2d3 _peer_get_caps() -> peer_query_caps() 2011-11-15 17:11:46 +01:00
Wim Taymans
d805f0f034 pad: _get_caps() -> _query_caps() 2011-11-15 16:46:37 +01:00
Wim Taymans
b5c3e254b1 pad: remove getcaps and use caps query
Remove the getcaps function on the pad and use the CAPS query for
the same effect.
Add PROXY_CAPS to the pad flags. This instructs the default caps event and query
handlers to pass on the CAPS related queries and events. This simplifies a lot
of elements that passtrough caps negotiation.
Make two utility functions to proxy caps queries and aggregate the result. Needs
to use the pad forward function instead later.
Make the _query_peer_ utility functions use the gst_pad_peer_query() function to
make sure the probes are emited properly.
2011-11-15 11:20:48 +01:00
Wim Taymans
54a9c5d3f8 basesrc: implement a default get_caps function
Don't rely on the return value of a vmethod to trigger the default
implementation but make a real defaul implementation of the method that the
subclass can chain up to.
2011-11-10 16:04:55 +01:00
Wim Taymans
b3998146c1 basesrc: don't do things in the vmethod trampoline 2011-11-10 12:33:10 +01:00
Wim Taymans
37318a8cd2 pad: remove GstPadFixateCapsFunction
The fixate caps function was not used externally and we have vmethods in the
base classes where it is needed.
Update some docs.
simplify some fixate functions in the base classes. Also pass the untruncated
caps to the vmethod.
2011-11-10 10:58:42 +01:00
Wim Taymans
6ed869c9f4 element: remove more query_types 2011-11-09 17:23:37 +01:00
Wim Taymans
9c0d8ca718 Merge branch 'master' into 0.11
Conflicts:
	gst/gstelement.h
	gst/gstghostpad.c
	gst/gstminiobject.c
2011-11-08 12:54:15 +01:00
Tim-Philipp Müller
16dcd5e958 docs: fix Since: markers for API added after 0.10.35 2011-11-08 00:32:36 +00:00
Tim-Philipp Müller
4f004eff38 pad: rename GstActivateMode to GstPadActivateMode
These might be useful:
sed -i -e 's/GstActivateMode/GstPadActivateMode/g' `git grep GstActivateMode | sed -e 's/:.*//' | sort -u`
sed -i -e 's/GST_ACTIVATE_/GST_PAD_ACTIVATE_/g'    `git grep GST_ACTIVATE_   | sed -e 's/:.*//' | sort -u`
2011-11-01 00:25:02 +00:00
Wim Taymans
f08b2203c8 basesrc: also update the stream time 2011-10-18 12:39:03 +02:00
René Stadler
4b79582925 basesrc: fix caps leak 2011-10-13 12:23:59 +02:00
Wim Taymans
cdd3c303f1 basesrc: properly adjust start time
When we do a non-flushing seek and closed the current segment,
make sure that we open the next segment from where we closed.
2011-10-12 17:17:53 +02:00
Thiago Santos
59319194b8 basesrc: avoid trying to alloc enormous buffer
If a class extending basesrc doesn't set blocksize, basesrc
would try to allocate a (guint)-1 sized buffer, which is enormous
and likely would fail.

Avoid it and error out.
2011-10-10 12:28:46 -03:00
Wim Taymans
ea012d3dd7 pad: GST_FLOW_UNEXPECTED -> GST_FLOW_EOS 2011-10-10 11:33:51 +02:00
Wim Taymans
947276484f docs: fix some more docs 2011-09-28 11:16:33 +02:00
Sebastian Dröge
43538e2e75 Merge branch 'master' into 0.11
Conflicts:
	docs/design/draft-buffer2.txt
	docs/design/part-TODO.txt
	docs/design/part-block.txt
	docs/design/part-bufferlist.txt
	docs/design/part-caps.txt
	docs/design/part-element-transform.txt
	docs/design/part-events.txt
	docs/design/part-negotiation.txt
	gst/gstcaps.c
	gst/gstevent.h
	gst/gstghostpad.c
	gst/gstinterface.c
	gst/gstpad.c
	gst/gstpad.h
	gst/gstutils.c
	libs/gst/base/gstbasesink.c
	libs/gst/base/gstbasesrc.c
	libs/gst/base/gstbasetransform.c
	libs/gst/base/gsttypefindhelper.c
	plugins/elements/gstcapsfilter.c
	plugins/elements/gsttee.c
	tests/check/generic/sinks.c
	tools/gst-launch.1.in
2011-09-08 14:28:23 +02:00
Piotr Fusik
14f5518f3d docs, gst: typo fixes
https://bugzilla.gnome.org/show_bug.cgi?id=658449
2011-09-07 18:03:17 +01:00
Wim Taymans
d924c30f5b base: rename allocation vmethods
Name the allocation vmethod on srcpad decide_allocation because source pads will
have to decide what allocation parameters will be used.
Name the allocation vmethod on sinkpads propose_allocation because they will
need to configure the allocation query with a proposed values for upstream.
2011-08-26 14:18:33 +02:00
Wim Taymans
6b876ebf82 basesrc: add default fixate function
Add a default fixate function which does gst_caps_fixate() because
gst_pad_fixate() does not do that anymore.
2011-08-17 17:16:21 +02:00
Josep Torra
178bdccb76 Fix and clarify debug statements
Fixes build on MacOSX

Signed-off-by: Edward Hervey <edward.hervey@collabora.co.uk>
2011-08-10 11:01:58 +02:00
Wim Taymans
10485ea803 basesrc: add alloc vmethod
Make an alloc vmethod so that subclasses can override or call the default
implementation when they want.
2011-08-04 18:00:02 +02:00
Wim Taymans
dc096f39d1 basesrc: cleanups and mark reconfigure
Don't abuse the result variable.
Mark the srcpad with a reconfigure so that negotiation happens.
2011-08-04 17:12:47 +02:00
Wim Taymans
6bae6b8253 basesrc: remove negotiation from the state change
Remove the negotiation from the state change function, it causes data transfer
and bufferpool negotiation, which is not supposed to be done. Since we have the
reconfigure state on the pad, the create function will do the negotiation as
soon as it gets in the streaming thread.
2011-08-04 16:56:42 +02:00
Wim Taymans
fd75c12631 basesrc: expose set_caps method
Expose a previously static method so that custom negotiate implementation can
call it and do the right thing.
2011-08-04 16:34:49 +02:00
Wim Taymans
21ea3fdd96 basesrc: PAUSED<->PLAY doesn't change pool state
Don't change the state of the bufferpool when going between PAUSED and PLAYING,
it will dealloc and realloc all buffers, which is clearly too invasive. We will
need to add some other way of unblocking the bufferpool.
2011-08-04 13:48:11 +02:00
Tim-Philipp Müller
913e5e310c base: update for query API changes 2011-07-28 11:24:19 +01:00
Wim Taymans
6b0a490740 basesrc: add some more debug info 2011-07-26 14:37:51 +02:00
Wim Taymans
c887dd41f8 basesrc: use DEBUG instead of ERROR for logging
Don't use the ERROR log category because the allocation failure migh only be
bacause of a state change.
2011-07-25 12:49:24 +02:00
Wim Taymans
d23fc81c43 basesrc: don't accidentally disable the pool
When we set a pool and it is the same as the old pool, don't disable the pool.
2011-07-15 16:04:11 +01:00
Wim Taymans
c87375a813 basesrc: fix after merge 2011-07-07 11:14:34 +02:00
Wim Taymans
b171259612 Merge branch 'master' into 0.11
Conflicts:
	libs/gst/base/gstbasesrc.c
2011-07-07 11:13:19 +02:00
Mark Nauwelaerts
0993102834 basesrc: do not sneakily mess with current offset when updating length 2011-06-30 17:59:27 +02:00
Mark Nauwelaerts
c79f8a52af basesrc: unref allocation query when no longer needed 2011-06-28 22:18:46 +02:00
Wim Taymans
3884badea6 memory: rename GstMemoryAllocator -> GstAllocator
simplify the name of the allocator object.
2011-06-22 11:42:46 +02:00
Wim Taymans
9c3bd65ba7 basesrc: improve debugging 2011-06-21 17:47:23 +02:00
Wim Taymans
fc5b0b09da basesrc: always activate the pool we get
Activate the pool when we get it from the allocation query.
2011-06-20 17:32:11 +02:00
Wim Taymans
9c67925fb7 basesrc: Improve logging
Log when things fail.
Fix a query leak.
2011-06-20 16:53:04 +02:00
Wim Taymans
c4f35cb2e0 basesrc: fix refcounting problem 2011-06-15 16:56:30 +02:00
Wim Taymans
1ea2722180 Merge branch 'master' into 0.11 2011-06-13 19:10:00 +02:00
Wim Taymans
844e8aefaa basesrc: Allocator buffers from negotiated allocator
Allocate buffers from the negotiated allocator or bufferpool.
Handle the state of the bufferpool when flushing.
Add fill method to pushsrc.
2011-06-13 12:07:03 +02:00