videocrop: add gst_video_crop_get_image_details_from_structure function

Add an function to allow retrieval of image details from structures instead of
only from caps.
videocrop: change the unit of rowstride to byte

Set rowstride units to bytes in order to align with other plugins.
videocrop: add tests to determine if width and height caps hold range value before getting image details

This check is necessary because gst_video_crop_get_image_details_from_structure()
can't be performed when caps contain range value.
videocrop: replace the processing to set gint value to structure with gst_structure_set
videocrop: don't set rowstride only when the color space is the planar

videocrop wouldn't support zero-copy cropping in the planar format.
Therefore, rowstride shouldn't set only when the color space is the planar.
videocrop: fix wrong subbuffer size

It wasn't just subbuffer size but in a unit of stride.
This patch corrects it.
videocrop: support getting NV12 image details

This patch adds a new pixel format definition that is NV12 format.
The color format type of NV12 is classified into VIDEO_CROP_PIXEL_FORMAT_SEMI_PLANAR.
When rowstride or chroma_byte_offset is contained in caps, image
details reflects these value.

This is preliminary for NV12 zero-copy cropping.
videocrop: add NV12 format caps template

This is preliminary for NV12 zero-copy cropping.
videocrop: kick off NV12 zero-copy cropping

This patch allows videocrop plugin to do zero-copy cropping by
adjusting the buffer offsets that are rowstride and chroma_byte_offset.
First of all, the function of cropping with memcpy is passed through
when the semi planar is set. Then, chroma_byte_offset is adjusted
to compensate for the extra offset due to creating the subbuffer,
which is caused by offsetting the buffer address based on Y plane.
videocrop: send a query by the first invorker of query_stride_supported

The query_stride_supported() might be failed because start() method
can be called before the pipeline is constructed. To resolve this issue,
this patch has the first invoker of query_stride_supported() send
the query to downstream plugins. The result of query is cached
at the first invoking.
videocrop: set tile boundary offset in caps for T/L addressing

This change is necessary for cropping the image data that is stored
as tiles in memory. Thease capabilities notify downstream plugins of
the offset to the previous tile boundary.
videocrop: support cropping interlaced images

This patch supports it by adjusting the subbuffer offset and
chroma_byte_offset in caps.
videocrop: move output buffer size calculation to transform_size()

transform_size() is the optional method that can be overridden to
calculate buffer sizes. The default implementation uses get_unit_size(),
but when performing zero-copy cropping, transform_size() should be used
because the buffer size calculation is different from the default.
The buffer size calculation should be performed using the tranform_size()
override, rather than being inlined in prepare_output_buffer().
videocrop: skip the transforming caps process when the passthrough mode is set

When the passthrough mode is set, the basetransform class tries to accommodate
a difference between input and output caps. This behavior causes
the reallocation of the output buffers, and discarding the physical buffers
used for zero-copy processing.
To avoid this problem, the transforming caps process shouldn't be performed.
v4l2src: fix RGB32 colorspace deinitions

This patch makes RGB32 colorspace definitions used in the caps negotiation
suitable for actual v4l2 driver's output format.
sys/v4l2/gstv4l2: skip set caps processing if the parameters are unchanged

v4l2src re-creates the buffer pool in set_caps() when the buffers
already have been allocated. If always-copy is set to false,
the buffer dequeued from V4L2 driver can be passed to next plugin
without copying. Therefore, set_caps() could free the buffer which
is in use.

set_caps() may be invoked by core libraries even if there is no change
to the caps value. This behavior could free the buffer which is in use
by another plugin. This patch skips the set_caps() processing if the caps
parameters are unchanged.
sys/v4l2/gstv4l2: return an error from set_caps() if trying to re-create in-use buffers

Whether the caps can be changed depends on the always-copy option.

If the caps of a buffer are changed, the buffer must be
re-created because the buffer size may change. If always-copy is
set to false, a buffer which is in use could be freed so that it
can be re-created.

For this reason, if always-copy is set to false, changing the caps is
not supported and this patch returns an error.
videocrop: add a new function to determine if source images are interlaced

This patch groups the processing to determine if source images are
interlaced to gst_video_crop_is_interlaced().
videocrop: set result of determing if source images are interlaced at the head of transform_caps
videocrop: round down cropping parameters when the color format is NV12

When the color format is NV12, there are restrictions as the following.
This change properly rounds down cropping parameters according to the
restrictions.

* Top: even number or multiple of 4 when a interlaced image is received.
* Left: even number
* Right: even number