An element stores the result for the last state change it did and
GstBin's state change handler will use this last result for state
locked elements to decide if its state change was successfull or not.
In camerabin2, the filesinks have their state locked and when they
fail switching states, this last failure will be used if the application
tries to change camerabin2's state, causing any state change to fail.
This patch makes camerabin2 reset this last change failure, avoiding
that camerabin2 fails on its next state changes.
Camerabin2 has a zoom property that is simply proxied to its
internal camera-source element. This patch makes camerabin2 listen
to 'notify' signals from it so it can update its zoom property value
when camera-source changes its zoom as a side-effect of another operation
or because the user set the zoom directly to it, instead of doing
it from camerabin2.
If we know that our camera source element produces buffers at the same
resolution and appropriate colourspace for the output, we don't need any
of the generic conversion elements in encodebin. This reduces caps
negotiation overheads among other things.
Reduce the viewfinder queue limits to only allow it to store
one buffer, preventing the queue from holding old buffers for
too long. This also avoids showing slightly outdated frames on
the viewfinder when the source has already produced new ones
and improves the buffer recycling rate, important for sources
that use bufferpools.
Basesrc derived classes send an eos when they change state
from paused to ready and that breaks video recordings on camerabin2
as it makes the whole audio branch pads flushing.
Prevent it by using a pad probe that only allows the eos to pass
when it is caused by a stop-capture action.
Capsfilters are created on the constructor and their properties can
be set/get from camerabin2's set/get_property functions. The user with
a broken setup would cause assertions when trying to set/get the
capture caps of this camerabin2.
A proper missing-plugin message will be posted when the user tries to
set camerabin2 to READY state.
Adds a property to add a custom GstElement to the audio
branch of the pipeline. This allows the user to do custom audio
processing/analysis when recording videos.
The audio source inside camerabin2 is put to READY and back to
PLAYING when starting capture, causing the pipeline to lose its
clock. As camerabin2 isn't put to PAUSED->PLAYING again during
this, a new clock isn't selected for elements.
A flags property has been added to encodebin to toggle whether the
conversion elements (ffmpegcolorspace, videoscale, audioconvert,
audioresample, audiorate) are created and linked into the appropriate
branches of encodebin.
Not including these elements avoids some slow caps negotiation and
allows the first buffers to flow through encodebin much more quickly.
However, it imposes that the uncompressed input is appropriate for the
target profile and elements selected to meet that profile.
If we bring the audio source up to the PAUSED state before emitting the
start-capture signal to the camera source, when subequently taking the
audio source to the PLAYING state, it will begin capture more quickly.
Since camerabin2 has switched to encodebin and encodebin has its own
queues and conversion elements, those preceding encodebin are no longer
necessary and as such can be removed.
Using a NULL string for location means that the application
doesn't want the image to be encoded, but wants to receive
the preview image. (Only works for image captures)
Useful for application that want the capture in memory only, like
displaying to the user before it choses to encode or take another
picture in avatar capturing scenarios.
https://bugzilla.gnome.org/show_bug.cgi?id=641918
The default for tagsetters is to use merge keep mode, so tags
would never be replaced and all captures would have the same tags.
This commit watches all elements added into encodebin and sets
all tagsetters to merge replace mode
Using serialized custom events for switching image capture saving
location makes camerabin2 save each capture correctly to the location
that was set during the moment start-capture was called, and not
the moment the filesink was writing to disk.
This prevents captures to be overwriten by racyness among start-capture
and setting location for images.
We only need to change the state of the filesink to switch its
saving location. This might still cause some problems of dropping
captured buffers, but it is better than changing the state of
the whole branch.
Some properties (like viewfinder-filter) only are taken into use
on NULL->READY transitions and the get/set property was returning
the currently in use value, instead of the last set.
This is bad, as after setting 'a' to 'x', you expect that getting 'a'
will return 'x'. This patch fixes it.
If needed, later we could add current-* properties that are readonly
and get the current value in use.
handle the case where encodebin doesn't have the pad
camerabin2 is requesting, either because of its current profile
or because of missing elements, making it fail to provide
the pad
In video mode the tags should be pushed after sending the start capture
to the source, this allows the video recording elements to be reset
and leave the flushing state they were at after a previous capture.
This fixes the problem where tags only work for the first video capture
Instead of probing the videosink sinkpad for passing EOS, better
to wait for EOS from the bus.
This makes sure the filesink has already processed it and is
ready to close the file. This is used to notify applications
that camerabin2 is idle and can be shut down.
This is not implemented in any of our real sources to which wrappercamerabinsrc
might connect but this is optional and can be implemented at any time. A
limit on the software zoom level using video{crop,scale} would be arbitrary.
Use resource warning messages to notify camerabin2 that a capture
as aborted or couldn't be started, making it decrement the
processing counter and making the idle property more reliable.
Setting the audio source to null isn't needed and it could
make the EOS that is still flowing be dropped if autoaudiosrc
is used because its pads go flushing before the EOS gets pushed
from the real source.
Don't leak string copy returned by gst_element_get_name(). Also, check
for certain elements by checking the plugin feature / factory name, not
the assigned object name.
We can't rely on audio sources pushing EOS when going PAUSED->READY
because this is a basesrc bahavior and when used inside autoaudiosrc
the ghostpad goes flushing before the real source pushes the EOS,
so it is dropped.
Audio elements are put into bin only when needed, so we need
to be careful with their states as camerabin2 won't manage
them if they are outside the bin.
Also we should reset their pad's flushing status before
starting a new capture.
Adds an audio source and audio capsfilter/queue/convert, creating
a new branch on camerabin2 that is used to feed encodebin with
audio buffers for video recording.
Adds properties to check what caps are supported on the
viewfinder (from the camerasrc viewfinder pad) and another
one to set a caps for the viewfinder.
When going to ready, camerabin2 could create an empty file
if the videosink was put to ready. This patch only puts videosink
to ready on the PAUSED_TO_READY state change if it is on PAUSED
or PLAYING.
Implement previewing functionality using 2 properties. A boolean
(post-previews) that indicates if previews should be posted, and a
GstCaps (preview-caps) to provide the desired preview caps.
wrappercamerabinsrc implements previewing by supplying the captured
image to a pipeline to adapt it to the required caps before posting.
Use a hack to make the event upstream to reach the camera source
instead of going downstream and being useless.
This was already fixed this way for image srcpad renegotiate and
video srcpad was left unfixed.
Adds a custom renegotiate event that is pushed to the camerasrc pad
that needs renegotiation due to the user selecting a new capture
caps for that pad.
This is a way of notifying the source that it should update its caps, even
if it doesn't use pad allocs.
Use better name for the variables, making the code clearer. Also
keep a ref for some internal elements to avoid fetching them
by name when needed later.
We need to reset the elements from the video recording branch, including
the queue and capsfilter in order to clear the eos state and activate
the pads.
This makes it possible to record multiple videos with camerabin2 in a
sequence, otherwise the source would get a unexpected return and
push EOS, stopping the whole pipeline.
As video recording bin's state is locked, we should always
remember of setting it to NULL when camerabin2 goes to NULL
Be more careful when using elements that might not
have been created yet
And do not set location property recursively on videorecordingbin
Adds a location property to enable applications to select
the captured files names. Locations are handled just like
multifilesink ones
Also disables -Wformat-nonliteral to allow to use non-literals
on g_strdup_printf on camerabin and generate a sequence of
locations for captures.
Keep vidbin state locked to avoid it going to playing without
being used and leaving an empty file created.
Check the docs on the code for details on the handling.
Removes the old logic for v4l2camerasrc that used the mode
property switching to start/stop captures to make it identical
to camerabin2 behavior and to allow the future addition of
pausing a video recording.
This also removes the MODE_PREVIEW as it became useless.