We never get a tag name quark from a caller, it's always a
string, from which we'll try to look up our tag info in the
hash table, so change the hash table key from quark to string.
Avoids a bunch of pointless string => quark lookup in the
global quark table. We need to do an extra string => quark
conversion now when we copy a taglist, but in that case we're
in a slow path anyway.
This will make sure we spawn a new plugin scanner helper for each plugin
to be introspected, which helps with making sure we don't load too many
shared objects (libs, plugins) at the same time on systems where there
is a hard limit like on Android.
A better version might re-use the scanner for up to N times, though
it's not clear whether that would actually improve things dramatically.
https://bugzilla.gnome.org/show_bug.cgi?id=662091
The second caps ownership is transfered, no need to require it to
be writable from the caller function. Instead, _append and _merge
make it writable on their own.
Discovered because of an assertion on encoding-profile.c in
_get_input_caps using _merge but not passing writable caps.
Returning a newly allocated string makes no sense. It's unexpected for a
getter, and also this behaves differently in 0.10, so it would make future
merges harder.
Except for these two places here in core which were updated for the new
semantic, the return value is getting leaked all over the place.
Handle virtual links between ghost and proxypads when iterating pads instead of
when linking. Besides using less code this provides a more accurate picture.
This was leaking the PtrArray from caps->priv, as set up by the other call to
gst_caps_init. Also, the thread safety issue presented in the comment above was
not taken care of anymore. We now zero the refcount again when publishing the
structure.
Fixes#661629.
If pushgin downstream returned a non-ok value (like GST_FLOW_WRONG_STATE),
we don't want to end up returning a different value (GST_FLOW_OK in this
case) if IDLE probes are present.
This was a FIXME for 0.11. I guess a case could be made to keep it around
separately for apps or libraries that only want to use GStreamer's debugging
system, but it seems more likely they'd just copy the two source files into
their own tree if the case. Also, things like types wouldn't be initialised
without gst_init(). We can still make it public again if anyone needs it,
but then we should make it a proper function and not hide it behind
underscores.
Don't export those 35-something random _gst_parse_yy* symbols. These were
never in any header files and also blacklisted from our .def files, in
case anyone wonders.
GstBuffer pointers can now be printed using GST_PTR_FORMAT. This is used
in the very useful GST_SCHEDULING debug logs in gstpad.c and allows for
easier and more information tracking of buffer progress through a
pipeline with just debug logging.
This allows the setcaps handler and notify::caps to link
the pad downstream and doesn't require hacks to always
provide a peer to the pad, like in decodebin2.
This reverts commit 2bfada5581.
Conflicts:
gst/gstpad.c
For 0.11 we want to enforce that only subsets of the pad
caps are allowed. This breaks backward compatibility for
some elements, which is why we only print a warning in
0.10.
Pads should only accept caps that are a subset of the pad caps, e.g.
they should accept only caps that have a non-empty intersection and
at least all fields of the pad caps.
Without this a pad that wants for example
"video/x-h264,stream-format=byte-stream"
will be happy to accept
"video/x-h264".
Remove gst_mini_object_register() and add a GST_DEFINE_MINI_OBJECT macro to
define a _get_type() function for the boxed miniobject.
Remove a bunch of custom _get_type() functions and replace them with the
miniobject macro.
Rename some _init method to _priv_*_initialize() like the rest of them.
Inspired by patch from Johan Dahlin and see bug #657603
We can also use a flag to indicate that a frame should be decoded but not
displayed regardless of the the segment boundaries so we use the more generic
_DROP.
Reorder buffer flags and add some new ones.
Remove the media specific flags, we can now easily do this with the FLAG_LAST
flag because we don't extend from GstBuffer anymore.
Make the acceptcaps function behave like all the other functions with a default
implementation. Don't try to chain up to the default implementation when it was
set to NULL explicitly but return FALSE instead.
Fix some docs
Remove gst_pad_get_negotiated_caps(), it does not realy do what it says,
gst_pad_get_current_caps() returns the currently negotiated caps on the pad
correctly.
Instead of checking for valid utf-8 element-details every time we create
elements (from plugin-init or registry), do it before we save the registry.
Fixes#656193.
Make it possible to query the supported options of a bufferpool and enable
options. This is a bit more generic than the API to enable metadata. The purpose
is to make it possible to add new custom config options to the configuration of
the bufferpool when supported.
The idea was originally that if one passed &dest_fmt with
dest_fmt=GST_FORMAT_DEFAULT, then the code answering the query
could change dest_fmt to the actual default format used. However,
in more than half a decade of GStreamer 0.10 no piece of code in
GStreamer has ever used that feature, nor are there that many
users of this API that actually check whether the format returned
is the original format passed before using the values returned.
Also, it's just annoying-to-use API in its own right.
For all these reasons, make it so that the destination format is
passed directly and can't be changed by the element queried.
Refactor calling the GETCAPS function and checks.
Move the filter code in one place.
When using fixed pad caps, get the currently configured caps and then fallback
to the GETCAPS function. We used to simply ignore the GETCAPS function, which
resulted in transform elements returning the template caps instead of doing the
caps transform.
Avoid playing with the refcount to decide when a buffer has been recycled by the
dispose function. The problem is that we then temporarily can have a buffer with
a refcount > 1 being acquired from the pool, which is not writable. Instead use
a simple boolean return value from the dispose function to inform the called
that the object was recycled or not.
After we allocated a new buffer, call the release_buffer vmethod to put the new
buffer in the pool instead of assuming that the pool uses the default
release_method implementation.
Don't remove memory blocks from the buffer when we clip and resize, instead set
the memory offset and size to 0. This allows us to make the buffer larger again
later.
Add more debug.
Alow resize to 0 bytes.
Do clipping correctly.
Add more unit tests. Also add a failing test: when we resize to 0 and then
try to resize back to the original size it fails because the memory was
removed.
Allow for negative offsets when doing memory copy and share.
Add fast path in the _get_sizes() function.
Fix resize for negative offset and expanding the buffer.
Add some unit tests.
Also return the offset in a GstMemory block with the get_sizes() method. This
allows us to figure out how much prefix there is unused.
Change the resize function so that a negative offset can be given. This would
make it possible to resize the buffer so that the prefix becomes available.
Add gst_buffer_get_sizes() to return the offset and maxsize as well as the size.
Also change the buffer resize method so that we can specify a negative offset
to remove prefix bytes.
It was a bit too clever, and didn't really work as an API,
confusing people to no end. Better implement specific methods
whether an interface is usable/available/ready on the interface
itself, or even add GError arguments, rather than try to have
per-instance interfaces.
Don't mix messages and pads and tags.
Make the sink post tag messages when a tag event is received.
Since tags are sticky on pads now, they can be retrieved from there
when needed.
Make the Array of structures private. This should allow us to implement
the array more efficiently or with some preallocated structures when
we want to later.
Add a new method to clean up a static structure so that we can remove some code
that pokes into the private bits of the caps.
Add a function to retrieve an array of supported metadata apis from the the
bufferpool.
Add functions to configure and query the configured metadata apis in a
bufferpool configuration.
This reverts commit de29ae7b92.
Re-adds GFLOAT_TO_LE, GFLOAT_TO_BE, GDOUBLE_TO_LE, and GDOUBLE_TO_BE.
Turns out these aren't in GLib yet afer all (since we didn't
actually open a bug to get them added..)
Add an index to gst_buffer_take_memory() so that we can also insert memory at a
certain offset. This is mostly interesting to prepend a header memory block to
the buffer.
Fix the code to support allocating the buffer and memory in one memory block.
Add an extra variable to store the memory of the buffer.
This code is disabled still because of complications.
Make a new method to allocate a buffer + memory that takes the allocator and the
alignment as parameters. Provide a macro for the old method but prefer to use
the new method to encourage plugins to negotiate the allocator properly.
Add a boolean to the flush_stop event to make it possible to implement flushes
that don't reset_time.
Make basesink post async_done with the reset_time property from the flush stop
event.
Fix some unit tests
Add a new method to steal the miniobject stored at a location.
Add a new method to store a miniobject in a location and taking ownership
of the miniobject.
Always forward all events in the default handler. Previously it used to not
forward caps events by default. It makes more sense to forward the caps events,
if the element is interested in the caps, it will implement an event handler to
retrieve the caps and then it can decide to forward or not. If the element has
no event handler, it probably just doesn't care about caps and it probably is
also not going to modify the data in a way that needs a caps change.
Move the flag to indicate that a new_base_time should be distributed to the
pipeline, from the async_start to the async_done message. This would allow us to
decide when to reset the pipeline time based on other reasons than the
FLUSH_START event.
The main goal eventually is to make the FLUSH events not reset time at all but
reset the time based on the first buffer or segment that prerolls the pipeline
again.
Require the memory implementations to implement a share operation. This allows
us to remove the fallback share implementation which uses a different allocator
implementation and complicates things too much.
Update design doc a bit.
Make the fallback copy use the same memory allocator as the original object.
Improve some docs.
Require an alloc function when registering an allocator.
Remove gst_memory_allocator_get_default() and merge the feature in
gst_memory_allocator_find()
Fix locks on the hashtable.
Remove defined but not-implemented gst_memory_span() method.
Rename the GstMemoryImpl to GstMemoryAllocator because that's really what it is.
Add an alloc vmethod to the allocator members.
Improve registration of allocators.
Add methods to get and set the default allocator
Always use an allocator to allocate memory, use the default allocator when NULL
is passed.
Add user_data to the allocator Info so that we can pass extra info to the
allocator new method.
Rename gst_pad_dispatcher() to gst_pad_forward() and make it more useful by
iterating the internal links of a pad and handling resync properly.
Add a method gst_pad_event_forward() that unconditionally forwards an event to
all internally linked pads.
Update some pad code to use the new forward function.
See #651514 for details. It's apparently impossible to write code
that avoids both type punning warnings with old g_atomic headers and
assertions in the new. Thus, macros and a version check.
The most common case is to not specify any flags when doing the allocation. Make
the allocation from a pool with a maximum amount of buffers block by default for
this reason.
Optimize linking by only releasing the pad locks when there are link functions
installed on the pads.
Add some G_LIKELY here and there.
Move error paths out of the main code flow.
Keep track of installed number of probes to shortcut emission.
Allow NULL callbacks, this is useful for blocking probes.
Improve probe selection based on the mask, an empty mask for the data or the
scheduling flags equals that all probes match.
Add some more debug info.
Don't check the flushing flag in the probe callback handler, this needs to be
done before calling the handler.
Fix blocking probes.
Fix unit tests
Make the PadBlock callback take a GstBlockType parameter to handle the different
kind of stages in the pad block. This provides for more backwards compatibility
in the pad block API.
Separate blocking and unblocking into different methods, only blocking can do a
callback, unblock is always immediately. Also removed synchronous blocking, it
can always be implemented with a callback.
Previously this was only done in the is_subset() check but
having it only there brings us into definition-hell where
"1" and "{1}" are subset of each other but not equal.
Make pad block call the callback as soon as the pad is not in use. This makes it
possible to make sure that when the callback is called, no activity is happening
on the pad and that no activity will ever happen until the pad is unblocked
again. This makes pad blocking work when there is no dataflow or after EOS and
greatly helps dynamic pipelines.
Move the probe handling right where we wait on the pad block. The two are
related but not the same and the probe can eventually influence the pad
blocking as we'll se later.
Fix up some broken unit tests or tests that fail with the new behaviour.
..and as a result gst_caps_is_equal() and others.
This now only checks if for every subset structure there is
a superset structure in the superset caps. Previously we were
subtracting one from another, creating completely new caps
and then even simplified them.
The new implemention now is about 1.27 times faster and doesn't
break the -base unit tests are anything anymore.
..and as a result gst_caps_is_equal() and others.
This now only checks if for every subset structure there is
a superset structure in the superset caps. Previously we were
subtracting one from another, creating completely new caps
and then even simplified them.
The new implemention now is about 1.27 times faster.
Rework _push_event() a little so that it drops events on blocking pads.
Make sure that events are forwarded when we unblock.
Add counter on the pad to keep track of busy pads.
Implement a default buffer-list function in case the element doesn't implement
one.
Also pass buffer-lists to the have-data signal, this allows us to remove some
backward compatibility code.
Change the sticky event array so that it contains a pending and an active event.
Events on the sinkpad are copied to the pending array and after the eventfunc
returned TRUE, moved to the active event. This allows us to queue new events
like when we do per-pad offsets without removing the currently active event.
Remove the active argument from the gst_pad_get_sticky_event() method, the
pending events are not something we want to expose.
When linking pads and when copying a segment event from the sourc pad to the
sinkpad, apply the src and sinkpad offsets to the segment base. Make sure that
we only modify the event stored on the sinkpad and never the one on the source
pad.
When changing the pad offset, perform the segment copy with the updated offsets.
When pushing a segment event, apply the srcpad offset before sending the event
to the peer pad.
This part is missing the adjustment of the segment event on the sinkpad, which
is for a later patch.
Add methods to adjust the offset. This will be used to change the segment events
with an offset so that we can tweak the timing of the stream on a per-pad base.
First store the sticky event on the sinkpad in the inactive state, then check
for the flushing flag. We want to have the events on sinkpads at all times,
ready to be activated when the pad becomes active.
Make a function to call the eventfunc and perform a caps check when we are
dispatching a caps event.
This makes sure that all code paths correctly check that the caps are
acceptable before sending the caps to the eventfunction.
Update the design docs with some clear rules for how sticky events are
handled.
Reimplement the sticky tags, use a small structure to hold the event and its
current state (active or inactive).
Events on sinkpads only become active when the event function returned success
for the event.
When linking, only update events that are different.
Avoid making a copy of the event array, use the object lock to protect the event
array and release it only to call the event function. This will need to check
if something changed, later.
Disable a test in the unit test, it can't work yet.
The feature name is not supposed to change over time anyway. In order to enforce
this parentize features to the registry and make the feature->name pointing to
GstObject:name. In 0.11 we could consider of removing the feature->name variable
(FIXME comment added).
Fixes: #459466
gst_pad_template_get_caps(), gst_pad_get_pad_template_caps()
and gst_pad_get_pad_template() return a new reference of the
caps or template now and the return value needs to be
unreffed after usage.
This reverts commit cf4fbc005c.
This change did not improve the situation for bindings because
queries are usually created, then directly passed to a function
and not stored elsewhere, and the writability problem with
miniobjects usually happens with buffers or caps instead.
Improve GstSegment, rename some fields. The idea is to have the GstSegment
structure represent the timing structure of the buffers as they are generated by
the source or demuxer element.
gst_segment_set_seek() -> gst_segment_do_seek()
Rename the NEWSEGMENT event to SEGMENT.
Make parsing of the SEGMENT event into a GstSegment structure.
Pass a GstSegment structure when making a new SEGMENT event. This allows us to
pass the timing info directly to the next element. No accumulation is needed in
the receiving element, all the info is inside the element.
Remove gst_segment_set_newsegment(): This function as used to accumulate
segments received from upstream, which is now not needed anymore because the
segment event contains the complete timing information.