video: Convert info_to_caps to take self as const ptr

This requires a slight modification to the function itself because it
was overwriting a member locally.

However, now this side-effect cannot be observed outside the function
anymore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1008>
This commit is contained in:
Marijn Suijten 2021-01-12 10:36:34 +01:00 committed by GStreamer Merge Bot
parent b60951a4fa
commit 1f06cf60e7
2 changed files with 7 additions and 7 deletions

View file

@ -641,7 +641,7 @@ gst_video_info_is_equal (const GstVideoInfo * info, const GstVideoInfo * other)
* Returns: a new #GstCaps containing the info of @info.
*/
GstCaps *
gst_video_info_to_caps (GstVideoInfo * info)
gst_video_info_to_caps (const GstVideoInfo * info)
{
GstCaps *caps;
const gchar *format;
@ -686,14 +686,14 @@ gst_video_info_to_caps (GstVideoInfo * info)
if (GST_VIDEO_INFO_MULTIVIEW_MODE (info) != GST_VIDEO_MULTIVIEW_MODE_NONE) {
const gchar *caps_str = NULL;
GstVideoMultiviewFlags multiview_flags =
GST_VIDEO_INFO_MULTIVIEW_FLAGS (info);
/* If the half-aspect flag is set, applying it into the PAR of the
* resulting caps now seems safe, and helps with automatic behaviour
* in elements that aren't explicitly multiview aware */
if (GST_VIDEO_INFO_MULTIVIEW_FLAGS (info) &
GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT) {
GST_VIDEO_INFO_MULTIVIEW_FLAGS (info) &=
~GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT;
if (multiview_flags & GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT) {
multiview_flags &= ~GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT;
switch (GST_VIDEO_INFO_MULTIVIEW_MODE (info)) {
case GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE:
case GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE_QUINCUNX:
@ -716,7 +716,7 @@ gst_video_info_to_caps (GstVideoInfo * info)
if (caps_str != NULL) {
gst_caps_set_simple (caps, "multiview-mode", G_TYPE_STRING,
caps_str, "multiview-flags", GST_TYPE_VIDEO_MULTIVIEW_FLAGSET,
GST_VIDEO_INFO_MULTIVIEW_FLAGS (info), GST_FLAG_SET_MASK_EXACT, NULL);
multiview_flags, GST_FLAG_SET_MASK_EXACT, NULL);
}
}

View file

@ -452,7 +452,7 @@ GST_VIDEO_API
gboolean gst_video_info_from_caps (GstVideoInfo *info, const GstCaps * caps);
GST_VIDEO_API
GstCaps * gst_video_info_to_caps (GstVideoInfo *info);
GstCaps * gst_video_info_to_caps (const GstVideoInfo *info);
GST_VIDEO_API
gboolean gst_video_info_convert (GstVideoInfo *info,