Don't use private GMutex implementation details to check
whether it has been freed already or not. Just clear mutex
and GCond unconditionally in free function, they are always
inited anyway, and the free function can't be called multiple
times either.
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.
Create preview pipeline already in initialization phase. This speeds
up NULL_TO_READY state change. Also implement a separate function for
setting the preview filter element.
This also restricts the preview filter property to work only on
NULL state.
Use g_new0 to initialize all fields with 0 to only cleanup what has been
initialized. This makes cleanup work correctly when some initialization
fails and pointers are left in some inconsistent state.
If the preview pipeline fails creation, for any reason, we should
fail basecamerasrc state change.
Also adds a missing g_return_if_fail check to preview pipeline
functions
The preview pipeline doesn't need 2 colorspace converters, remove
one to speed up caps negotiation and reduce the delay on getting
the first preview buffer out of the preview pipeline.
It shouldn't cause problems as videoscale and ffmpegcolorspace seems
to handle the same caps, so no conversion should be needed for
videoscale. Additionally, camerabin1 has been working with a similar
pipeline with a single ffmpegcolorspace and no bugs have been open about it
so far.
Implements a message handling function to preview pipeline bus.
If GST_MESSAGE_ERROR is seen, considers preview pipeline unable
to do its job and posts an error message to application.
Sets pipeline element to NULL so that subsequent calls to post_preview
and set_caps functions just returns without pushing anything to the
disposed preview pipeline. Leaves further actions to the application.
Implements a state indicating flag to preview pipeline,
so that new caps are not set if the pipeline is processing a
preview. The caps are set as pending and applied when the
next preview post is called.
In this case a wait was implemented in the post_preview function,
so that new preview image buffer will wait until the other previews
have been posted to the application and the new caps can be used
safely.