When recording 2 videos in sequence with the same video-capture-caps,
the second video would get a not-negotiated error because the
src caps were being cleared without any intention of
renegotiating it back to the requested capture caps.
This patch avoids this caps reset procedure unless a new
caps was set.
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.
Use video_renegotiate and image_renegotiate booleans to make
the videosrc negotiate the capture caps on the first capture because
the caps might be set before wrappercamerabinsrc goes into PLAYING
and pads drop the internal renegotiate event.
This is required as the output-selector is using the 'none' negotiation
mode.
When setting the internal capsfilter caps for capture we should put
the full caps instead of trying to fixate it ourselves. This way we let
the elements (and mostly the source) select the best format instead
of defaulting to what the pad fixation function picks.
Image previews where being posted in sync with the buffers
timestamps, this makes no sense as previews should be posted ASAP.
Also adds some debugging messages.
Camerabin2 uses state changes to force the source to renegotiate its
caps to the capture formats. The state changes makes the source lose
its clock and base_time, causing it to stop timestamping the buffers.
We still need a proper way to make sources renegotiate its caps, so this
patch is a hack to make the source continue timestamping buffers even
after changing state. The patch works by getting the clock and base
time before doing the state change to NULL and setting them back
after putting it to PLAYING again. It also cares to drop the first
new segment after this state change.
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.
Instead of linking 3 src pads from tee to the ghostpads, use 2
srcpads and add an output-selector to completely split caps
negotiation of video/image modes. I don't think there is an
use case that would require image and video pads to be used
at the same time.