In order to be able to change the caps on multiple capsfilters the
source element needs to be stopped, otherwise it will get a few
reconfigure events and might try to renegotiate while the bin
is still transitioning its caps, leading to a not-negotiated failure
and the image capture won't happen because the source will be
unusable.
The solution is to keep the source in paused while the caps are being
changed in the bin, and then bring the element back to playing once
it is done. Unfortunately this increases the image capture latency,
but it should always work.
A possible improvement to reduce the latency is to add another signal
to be called before 'start-capture': 'prepare-capture'. At this step
the camera source should set all caps it needs and get the source
ready for doing the capture as soon as 'start-capture' is called.
This can be done on a future commit
Force filesink to null before posting video-done to make sure the
file was closed.
Had to do it from a separate thread to avoid calling state_change from
a sync message handler.
https://bugzilla.gnome.org/show_bug.cgi?id=709373
By adding the video-source-filter during construction time, rather then
patching it in later (*), we can greatly reduce the amount of caps involved
in negotation, speeding up pipeline creation.
I wrote this while working on speeding up the startup of cheese. My cheese
has been modified to add a capsfilter, filtering for only the configured
resolution, with that cheese patch + this patch, the pipeline creation time
goes from aprox 1.1 seconds to aprox 350ms. This is with a Logitech 9000
pro camera, which supports lots of different resolutions at many different
framerates per resolution, causing a caps "explosion" if not filtered.
*) Note the code for this is left in, as it is still necessary if the
video-source-filter is changed between a stop + re-start.
https://bugzilla.gnome.org/show_bug.cgi?id=701953
check_and_replace_src() was setting self->app_vid_src to NULL, which
means that an app setting the video-source property, and then starting,
stopping and re-starting the pipeline (ie to make changes to the
video-source-filter property) would after the restart no longer have
a video-source.
This patch fixes this by making gst_camerabin_setup_default_element return a
ref to the passed in user_element, rather then returning the user_element as
is, so that that ref can be passed on to the bin, and the app_vid_src ref
stays valid.
https://bugzilla.gnome.org/show_bug.cgi?id=701915
The name was updated on the 0.10 -> 1.0 transition, but the
gst_bin_remove was still using the old name, causing an assertion
when replacing video-source-filter
https://bugzilla.gnome.org/show_bug.cgi?id=681564
Add a src pad event handler function that filters reconfigure events to
trigger the renegotiation code paths in the mode-specific start-capture
phase.
This is to work towards fixing unit tests but more work is needed.
need to pass a GstSample to the utilitary preview buffer post functions
as a GstBuffer doesn't have caps anymore. The GstSample has the GstCaps
and it is used to inform the preview's pipeline about the format of the
input, before it gets converted to the user's requested output format.
image-encodebin can't use videorate as it always store one buffer
to be able to do its timestamps/duration math. As image captures
only push one buffer at a time, this videorate behavior breaks
camerabin usage.
Do not use jpeg as a container format for image captures, use
the plain video encoding format. It was used as a container in
0.10 to force the addition of tags to the image.
In 0.10 camerabin2 controlled the negotiation strictly and the output-selector
wouldn't forward setcaps calls. In 0.11 the renegotiation events are already in
core and we can allow the pipeline to handle it without much control from camerabin
part (I hope), so this patch makes output-selector forward caps negotiation events
to the active pad.
It seems that v4l2src isn't happy when switching formats on ready
state, it works when putting it to NULL. Keep this workaround in
wrappercamerabinsrc while v4l2src isn't fixed.
Fixes#849832