Don't use g_idle_add() and friends to schedule things we can't do from the
streaming thread in another thread. The app may not be running the default
GLib main loop. Instead, just spawn a thread.
Also, we need to care for when acessing a pad variable, as another thread
might have taken camerabin to NULL while this gst_camerabin_imgbin_finished
didn't run.
https://bugzilla.gnome.org/show_bug.cgi?id=615655
The videobin and imagebin from camerabin have their states
locked and aren't put to READY when all the rest of camerabin
is set to it.
This might cause one of them to be still processing and post
an EOS after camerabin isn't expecting it anymore, this causes
an assertion as the processing counter would already be 0 and
would be decremented.
No need to check if camerabin is on video mode if it isn't on
image mode as those are the only 2 modes available.
Additionally, if mode gets corrupted somehow and would be neither
image or video it would cause a null pointer dereferencing some
lines of code below, so this is safer.
As imgbin_finished() is scheduled from g_idle_add, it might
be run a little later than expected, this can lead to the application
setting camerabin to ready before imgbin_finished() runs. In this case,
the processing counter goes to 0 and an assertion happens.
This patch relaxes the imgbin_finished() check on the processing
counter.
This patch refactors imagebin element creation and linking into separate functions,
and adds re-using also for imagebin internally created elements.
So this refactoring allows creating imagebin elements already in NULL state when
application sets the image mode, and next state change from NULL to READY will be faster.
This reduces first capture latency.
Earlier the elements were both created and linked in NULL to READY state change.
Adds 'idle', a read-only boolean property that tells applications
if there is any capturing/saving/encoding going on in camerabin. If
not, it is safe to set it to NULL and release resources without
losing data.
Add "ready-for-capture" property to indicate if preparing a new
capture is possible.
"ready-for-capture" changes before the 'image-done' signal, so
the application can be notified that it can do a new capture
even before the previous one has finished encoding/saving.
When switching between video/still modes the pre-night-mode fps
should be reset to prevent it being used in the incorrect mode, causing
the videosource to fail configuring itself
Store width/height/fps for video captures in a separate variable
than the one that stores the currently used value.
This prevents the user preferences to be lost when resetting
the currently used dimensions for night mode, for example
Resets used caps so that camerabin doesn't try to use them
when restarting, where elements/properties might have changed
and the old caps be incompatible
Adds a higher priority to the idle_add function for when
the image bin finished the image capture. This reduces the
delay for the application to be notified about this.
As camerabin only gets notified of the changes from the
video source element, it should query the initial value
once the source is created so it initializes itself
correctly.
If the elements are in NULL/READY and changing state to
PAUSED/PLAYING while a capture is started
camerabin might not set the active_bin properly causing the
capture start to fail.
This patch fixes it by checking the current and pending state
of the branches instead of only the current one
Adds another boolean to help controlling viewfinder blocking,
making it possible for the applications to reset the viewfinder
blocking after capture was started but before the blocking
actually happens.
Unblock the viewfinder when going to ready to avoid
blocking when setting camerabin to playing again and
attemping to capture. Keep the property as is.
Remove notify signal proxy for video-source. Application can use
video-source directly from now on to get notified of property changes.
Add monitoring scene-mode property change to select lowest possible
framerate for video capture when night mode is selected.
Fixes#616923
Having GST_DEBUG_CATEGORY and GST_DEBUG_CATEGORY_EXTERN together
might lead to 'undefined symbol' problems. This commit moves
the _EXTERN to a separate new file.