Commit graph

1418 commits

Author SHA1 Message Date
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 e332862985 pad: implement DRAIN handling
When we forward the DRAIN query and there is nothing to forward it to, assume we
are drained.
When a basesink receives a drain query, reply with TRUE.
2012-03-14 16:27:31 +01:00
Wim Taymans d8578d5c09 adapter: add more debug 2012-03-14 12:42:00 +01:00
Stefan Sauer cc445664c8 docs: fix function name and typo 2012-03-12 23:08:45 +01:00
Wim Taymans 934ddcfcfe basetransform: get template caps only once
Get the template caps of the pads only once, avoids unecessary ref
and unrefs.
2012-03-12 19:52:03 +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
Wim Taymans fe5fe438d3 typefind: remove const from refcounted GstCaps
Having const on refcounted objects require us to make copies instead of simply
taking a ref, don't do that.
2012-03-10 09:25:43 +01:00
Tim-Philipp Müller e09fe53a22 Merge remote-tracking branch 'origin/master' into 0.11
Conflicts:
	common
	gst/gstpad.h
	gst/gsttask.c
	libs/gst/base/gstcollectpads2.h
2012-03-08 19:55:30 +00:00
Tim-Philipp Müller c683e39429 pads, collectpads2: get rid of superfluous brackets around static rec mutex calls
Makes it possible to define those calls to something for tracing.
2012-03-08 16:27:48 +00:00
Sebastian Dröge 38d398448a baseparse: Fix merge mistake 2012-03-08 10:32:02 +01:00
Sebastian Dröge 6b4091a30d Merge branch 'master' into 0.11
Conflicts:
	libs/gst/base/gstbaseparse.c
	libs/gst/base/gstbasetransform.c
	plugins/elements/gsttee.c
2012-03-08 10:19:52 +01:00
Mark Nauwelaerts ee6f6ff362 baseparse: arrange for properly disjoint frame flags 2012-03-07 11:25:19 +01:00
Wim Taymans ed94dbf1d2 basetransform: delay pool activation
Delay the activation of the bufferpool until we actually need a buffer from the
pool.
2012-03-06 15:17:05 +01:00
Sebastian Dröge ed7f480222 baseparse: Fix 'self-comparison always evaluates to true'
This was really a bug.
2012-03-06 12:28:02 +01:00
Sebastian Dröge 7c32cfd661 basetransform: Fix 'equality comparison with extraneous parentheses' compiler warning 2012-03-06 12:23:15 +01:00
Wim Taymans 247d2d08f7 basetransform: don't propose_allocation before negotiation
Answer the allocation query with FALSE when we are not negotiated yet because at
that point we have no idea if we need to proxy the allocation query or not.
2012-03-05 15:23:46 +01:00
Sebastian Dröge 495aca4905 baseparse: Fix handling of multiple newsegment events
Previously only the last would be pushed, which would cause
invalid running times downstream. This also fixes the handling
of update newsegment events.
2012-03-05 14:41:12 +01:00
Sebastian Dröge 563ba031a2 baseparse: Also flush the close_segment
Pushing this after flushing will confuse downstream.
2012-03-05 14:37:57 +01:00
Sebastian Dröge 747dfc09b2 baseparse: Remove obsolete code and move gap handling to the correct place
The segment start adjustment code in pull mode should never trigger
anymore because the bisection code earlier would have already made
sure that we're at the desired position.

Also move the gap handling some lines below after sending the currently
configured segments. Otherwise we might fill gaps in a segment that is
not configured downstream yet.
2012-03-05 14:23:17 +01:00
Sebastian Dröge 13930dad53 baseparse: Clear some more state when receiving FLUSH_STOP
Like pending serialized events and the currently cached buffer.
2012-03-05 13:12:18 +01:00
Sebastian Dröge cd195f2143 baseparse: Only queue serialized events for sending them later 2012-03-05 13:01:14 +01:00
Wim Taymans 7eae198be2 basetransform: refine metadata filter and transform
Add a vmethod to filter metadata that should be passed upstream. By default,
don't pass anything.
Add a vmethod to transform metadata from the input buffer to the output buffer.
By default, nothing is transformed or copied.
2012-03-02 17:32:28 +01:00
Wim Taymans 3fa69e6e11 basetrans: fix comment 2012-03-02 11:08:55 +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
Wim Taymans afb9d81be9 basetransform: improve debugging 2012-03-01 17:41:57 +01:00
Wim Taymans bdcf1dc3cd basetransform: remove metadata tagged with the memory tag
Remove metadata that describes the particular memory of the buffer it is
attached to. We need to do this because in non-passthrough mode we will allocate
new memory for our output buffer.
2012-03-01 17:41:57 +01:00
Wim Taymans d6a28a6e3a basetransform: improve propose_allocation
Improve the propose allocation vmethod by passing the downstream allocation
query to it. This way the vmethod implementation can use properties of the
downstream allocation to generate the upstream query result. If there is no
downstream quety, it means that the element is working in passthrough mode.
Implement a default decide_allocation.
2012-03-01 17:41:57 +01:00
Wim Taymans 4f6faa3405 basetransform: clear allocation parameters in passthrough
Clear the allocation parameters when we operate in passthrough.
2012-03-01 17:41:57 +01:00
Sebastian Dröge a8dcb63616 libs: Fix some merge mistakes 2012-03-01 14:51:26 +01:00
Sebastian Dröge 99a8cd1048 Merge branch 'master' into 0.11
Conflicts:
	libs/gst/base/gstcollectpads2.c
	libs/gst/check/gstconsistencychecker.c
2012-03-01 14:43:01 +01:00
Stefan Sauer 9fd063e404 collectpads2: add more logging 2012-02-28 20:36:59 +01:00
Tim-Philipp Müller 1fbcc71dbd Merge remote-tracking branch 'origin/master' into 0.11
Conflicts:
	NEWS
	RELEASE
	configure.ac
	docs/plugins/gstreamer-plugins.hierarchy
	docs/plugins/inspect/plugin-coreelements.xml
	libs/gst/base/gstcollectpads.c
	libs/gst/base/gstcollectpads2.c
	plugins/elements/gstfdsink.c
	win32/common/config.h
	win32/common/gstenumtypes.c
	win32/common/gstversion.h
2012-02-27 00:08:39 +00:00
Stefan Sauer daa5cae78b collectpads2: rescue the annotation from collectpads 2012-02-26 23:11:23 +01:00
Stefan Sauer 6045e0f58f docs: fix a typo in comment 2012-02-26 23:10:58 +01:00
Stefan Sauer b9a6b3fc6e collectpads2: move "MT save" tags to doc body
It is not useful to have "MT safe" tags randomly in body, returns or since paragraphs.
2012-02-26 22:57:02 +01:00
Wim Taymans beea57dca7 basetransform: fix reconfigure methods
Rename gst_base_transform_suggest to gst_base_transform_reconfigure_sink because
that is what it does. Also remove the caps and size because that is not needed.
Rename gst_base_transform_reconfigure to gst_base_transform_reconfigure_src.
Remove some old unused code in capsfilter.
2012-02-24 11:00:21 +01:00
Wim Taymans d052c778af basetransform: remove transform lock
This is not needed anymore by the baseclass. subclasses should do their own
locking when needed.
2012-02-23 11:08:26 +01:00
Wim Taymans c83e02d476 basetrans: cleanups
Clean up the setcaps function.
The passthrough variable is protected with the object lock.
2012-02-23 10:12:44 +01:00
Wim Taymans f3ca3f89f7 basetransform: improve propose_allocation
Always call the propose_allocation method and provide a default implementation
that passes the query on in passthrough mode so that subclasses can also call
this. Also pass if the transform is in passthrough mode so that the
implementation can adjust its algorithm.
2012-02-22 15:26:05 +01:00
Wim Taymans 90a82c7e81 basetrans: improve fixate_caps function
Make it possible to also implement non-inplace fixate functions. Let the fixate
function make the caps writable when needed because some fixate functions might
not need to modify the caps.
2012-02-22 12:24:34 +01:00
Wim Taymans 7b0e4f27fb memory: make _new_wrapped take user_data and notify
Make it possible to configure a GDestroyNotify and user_data for
gst_memory_new_wrapped() this allows for more flexible wrapping of foreign
memory blocks.
2012-02-22 02:10:21 +01:00
Wim Taymans 810e67900b basetransform: copy metadata when using a pool
also copy the metadata when we allocated a new buffer from a pool
2012-02-20 11:46:36 +01:00
Edward Hervey dc304041ed basesrc: Move variable and assignment to where it's needed 2012-02-17 15:11:38 -08:00
Edward Hervey 7f8be6935a basetransform: Handle return value of decide_allocation vmethod
If it fails, properly propagate the error
2012-02-17 15:11:38 -08:00
Mark Nauwelaerts d95d2cfa1b baseparse: tweak some documentation 2012-02-15 17:12:09 +01:00
Mark Nauwelaerts bfa4bb7150 baseparse: simplify and improve frame state handling
Use a frame flag to signal to subclass it should reset any retained
state w.r.t. frame parsing since the frame being passed is 'new',
i.e. not related to previously passed and processed data.
2012-02-15 17:11:54 +01:00
Wim Taymans 2609c7b452 baseparse: don't leak event
In the unlikely case where the subclass set the event function to NULL, don't
leak the event.
2012-02-15 13:15:55 +01:00
Wim Taymans b6b239ceaa baseparse: make activation code more like other
Make the pad activation code look more like other activation code.
Only start the sinkpad task when we decide to activate in pull mode, when we
later add srcpad pullmode this will be needed.
2012-02-15 12:19:13 +01:00
Wim Taymans 49a7832499 baseparse: add some more debug 2012-02-15 11:11:11 +01:00
Mark Nauwelaerts d148569cd4 baseparse: track consumed input size
... as used by subsequent input data rate estimation (and seeking).
2012-02-15 11:00:36 +01:00
Wim Taymans 63ba55865c baseparse: chain up to parent for defaults
Chain up to the parent instead of using the FALSE return value from the event
function (because it's otherwise impossible to return an error).
2012-02-15 10:13:37 +01:00
Mark Nauwelaerts 36cc9efa80 baseparse: Revert "baseparse: really provide upstream ts to subclass"
This reverts commit 2363490ef5.
2012-02-14 20:17:37 +01:00
Mark Nauwelaerts a40b993bc3 baseparse: remove dead code and superfluous loop level 2012-02-14 19:33:50 +01:00
Mark Nauwelaerts 193e1cf16e baseparse: modify reverse playback handling
... so as to allow the push-mode case to provide data to subclass
on a buffer by buffer basis (as in regular forward case), rather
than all buffers of a fragment chucked together.

Also refactor buffer handling some more, and add some debug.
2012-02-14 19:33:46 +01:00
Mark Nauwelaerts 2363490ef5 baseparse: really provide upstream ts to subclass 2012-02-14 19:33:33 +01:00
Wim Taymans ebf502d1c6 Merge branch 'master' into 0.11 2012-02-14 10:35:06 +01:00
Mark Nauwelaerts b761f5479a baseparse: modify API to a _finish_frame based approach
... which aligns it with other baseclass in the wild, and should give
converter parsers a bit cleaner freedom.
2012-02-13 18:41:00 +01:00
Mark Nauwelaerts c8ea9994aa baseparse: fix reverse playback
... especially for all-keyframe (audio) cases.
2012-02-13 18:14:02 +01:00
Wim Taymans 5fbdd763bb Merge branch 'master' into 0.11 2012-02-10 15:03:03 +01:00
Mark Nauwelaerts 954dd59fdd baseparse: bitrate mechanics should not deal with duration update
... since that is already handled by _update_duration, or should not be done
altogether if the duration is determined by non-estimated means.

Fixes #669502.
2012-02-10 14:47:00 +01:00
Wim Taymans b30b397c46 basesink: implement faster ACCEPT_CAPS query 2012-02-10 11:24:28 +01:00
Wim Taymans 7ab1d62c24 GST_FLOW_WRONG_STATE -> GST_FLOW_FLUSHING 2012-02-08 16:18:04 +01:00
Mark Nauwelaerts a306518cee baseparse: clean up a few minor extraneous tokens 2012-02-08 15:38:28 +01:00
Mark Nauwelaerts 2aaa475a4f baseparse: remove closing segment handling 2012-02-08 15:38:07 +01:00
Wim Taymans d6dfb07692 basetransform: improve prepare_output_buffer
Clean up the prepare_output_buffer function.
Reuse the input buffer when it is writable and when doing an
in-place but non-passthrough transform.
Move the copy-metadata function call to the prepare_output_buffer default
function. If subclasses implement a custom prepare_output_buffer, they must also
copy the metadata themselves.
Remove a useless memory copy because prepare_output_buffer already did that.
2012-02-02 13:10:27 +01:00
Wim Taymans 3075b3c529 basetransform: simplify code
We already checked passthrough a few lines above.
2012-02-02 12:30:14 +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 39c5f0b28a don't do logic in g_assert... 2012-01-31 12:10:21 +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
Olivier Crête e234a10c63 Use macros to register boxed types thread safely 2012-01-28 16:42:38 +00:00
Sebastian Dröge 753a1125dd Merge branch 'master' into 0.11
Conflicts:
	libs/gst/base/gstcollectpads2.c
	libs/gst/base/gstcollectpads2.h
2012-01-27 15:09:35 +01:00
Sebastian Dröge 9945b2cd88 collectpads2: Move private fields from the public structs to private structs
Fixes bug #668764.
2012-01-27 15:03:46 +01:00
Wim Taymans 21455d35b1 tests: fix some more leaks 2012-01-27 12:52:01 +01:00
Wim Taymans ae12e4f645 basetransform: avoid caps leak 2012-01-27 11:41:33 +01:00
Sebastian Dröge 34b01da26c collectpads2: Drop the stream-start and stream-config events by default 2012-01-27 10:46:02 +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 e122bae3ad basetransform: fix typo 2012-01-26 19:28:46 +01:00
Sebastian Dröge b6d11d844e collectpads: Remove old collectpads
Still have to rename collectpads2 to collectpads before the 1.0 release.
2012-01-26 10:48:56 +01:00
Sebastian Dröge de576f8163 collectpads2: Don't forward CAPS event automatically 2012-01-26 10:45:45 +01:00
Sebastian Dröge 6b9280b18c collectpads2: Fix handling of the event function and document it
The event function is supposed to forward/drop the event in any case
now and takes ownership of the event.
2012-01-26 10:45:45 +01:00
Wim Taymans a521252845 Add new GstMapInfo
Use a structure to hold info about the mapping. The application then keeps track
of this state and we can use it to unmap the memory again later.
2012-01-25 11:54:23 +01:00
Tim-Philipp Müller 13d91d1f6c Use recent GLib API unconditionally now that we depend on the latest GLib 2012-01-22 01:25:22 +00: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 acf0d50bf1 basesink: handle lists correctly 2012-01-19 15:17:33 +01:00
Wim Taymans 252327f87a Update for new gthread API 2012-01-19 09:27:04 +01:00
Sebastian Dröge b56bef1418 basetransform: Always call ::propose_allocation vfunc
And only forward the allocation query if we're working in
passthrough mode if no ::propose_allocation is implemented.
In place buffer transformations will change the buffer
content and require explicit handling of all metas.
2012-01-18 12:07:46 +01:00
Mark Nauwelaerts ea2f87d34e adapter: ensure automagic _unmap in some more cases 2012-01-13 14:21:27 +01:00
Vincent Penquerc'h 12757e604a adapter: automatically unmap on clearing
When _clear gets called between _map and _unmap, buffers
will be unreffed. If the adapter was mapped, memory leaks
may occur.
While calling _clear between _map and _unmap does not seem
like such a great idea, this is possible in the audio
encoder base class, as _clear may be called in _finish_frame.
Since the audio encoder relies on flushing to keep track of
timestamps, delaying flushing till after handle_frame seems
dangerous.
So, we unmap on clear, as the next unmap will do nothing.
This makes _clear safe to call between _map and _unmap,
while avoiding leaking the mapped buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=664133
2012-01-13 14:21:27 +01:00
Mark Nauwelaerts 247842eaa9 basesrc: prevent unlikely caps leak 2012-01-13 14:21:27 +01:00
Tim-Philipp Müller 66d19b65fb Merge remote-tracking branch 'origin/master' into 0.11
Conflicts:
	tools/gst-inspect.c
2012-01-13 00:22:03 +00:00
Antoine Tremblay df6de8fe0c baseparse: clear adapter in reset so baseparse is reusable
GstBaseParse was not clearing its adapter on reset causing
problems when a pipeline went for example from PLAYING to NULL
state and then back to PLAYING again. The data from the last
stream would be used in the parser.

https://bugzilla.gnome.org/show_bug.cgi?id=667444
2012-01-12 19:53:11 +00:00
Sebastian Dröge 148bf27ce3 Merge branch 'master' into 0.11 2012-01-10 13:00:07 +01:00
Havard Graff bea0ed2fc1 basesink: don't compensate for render-delay twice
https://bugzilla.gnome.org/show_bug.cgi?id=667298
2012-01-05 18:04:22 +00:00
Wim Taymans bc1974e962 GST_FLOW_UNEXPECTED -> GST_FLOW_EOS 2012-01-03 15:25:31 +01:00