mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-12 23:09:45 +03:00
gstreamer: Document improvements when updating minimum GStreamer version
A const_cast<> was recently added to fix a compilation issue with older GStreamer versions. Add a comment to indicate it can be removed when bumping the minimum GStreamer version requirement. While at it, also document a possible future improvement in the same function, and wrap long lines. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
This commit is contained in:
parent
d3f3b95b64
commit
04e7823eb2
1 changed files with 17 additions and 3 deletions
|
@ -285,10 +285,19 @@ gst_libcamera_extrapolate_info(GstVideoInfo *info, guint32 stride)
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_libcamera_video_frame_copy(GstBuffer *src, GstBuffer *dest, const GstVideoInfo *dest_info, guint32 stride)
|
gst_libcamera_video_frame_copy(GstBuffer *src, GstBuffer *dest,
|
||||||
|
const GstVideoInfo *dest_info, guint32 stride)
|
||||||
{
|
{
|
||||||
GstVideoInfo src_info = *dest_info;
|
/*
|
||||||
|
* When dropping support for versions earlier than v1.22.0, use
|
||||||
|
*
|
||||||
|
* g_auto (GstVideoFrame) src_frame = GST_VIDEO_FRAME_INIT;
|
||||||
|
* g_auto (GstVideoFrame) dest_frame = GST_VIDEO_FRAME_INIT;
|
||||||
|
*
|
||||||
|
* and drop the gst_video_frame_unmap() calls.
|
||||||
|
*/
|
||||||
GstVideoFrame src_frame, dest_frame;
|
GstVideoFrame src_frame, dest_frame;
|
||||||
|
GstVideoInfo src_info = *dest_info;
|
||||||
|
|
||||||
gst_libcamera_extrapolate_info(&src_info, stride);
|
gst_libcamera_extrapolate_info(&src_info, stride);
|
||||||
src_info.size = gst_buffer_get_size(src);
|
src_info.size = gst_buffer_get_size(src);
|
||||||
|
@ -298,7 +307,12 @@ gst_libcamera_video_frame_copy(GstBuffer *src, GstBuffer *dest, const GstVideoIn
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_video_frame_map(&dest_frame, const_cast<GstVideoInfo *>(dest_info), dest, GST_MAP_WRITE)) {
|
/*
|
||||||
|
* When dropping support for versions earlier than 1.20.0, drop the
|
||||||
|
* const_cast<>().
|
||||||
|
*/
|
||||||
|
if (!gst_video_frame_map(&dest_frame, const_cast<GstVideoInfo *>(dest_info),
|
||||||
|
dest, GST_MAP_WRITE)) {
|
||||||
GST_ERROR("Could not map dest buffer");
|
GST_ERROR("Could not map dest buffer");
|
||||||
gst_video_frame_unmap(&src_frame);
|
gst_video_frame_unmap(&src_frame);
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue