From afedd107a88eb9cbefe717634976c6dcb5c5521a Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 11 Jan 2023 12:21:09 +0100 Subject: [PATCH] Revert "video: Add extra field indicating if modifier value is valid" This reverts commit 1e6920c33b9a4ae67a349711fa48c6a4daae538e. Causes an ABI break. --- spa/include/spa/param/video/format-utils.h | 20 ++++---------------- spa/include/spa/param/video/raw.h | 7 ++----- spa/plugins/libcamera/libcamera-source.cpp | 5 +---- 3 files changed, 7 insertions(+), 25 deletions(-) diff --git a/spa/include/spa/param/video/format-utils.h b/spa/include/spa/param/video/format-utils.h index 6f7b11a84..339e7e523 100644 --- a/spa/include/spa/param/video/format-utils.h +++ b/spa/include/spa/param/video/format-utils.h @@ -42,9 +42,7 @@ static inline int spa_format_video_raw_parse(const struct spa_pod *format, struct spa_video_info_raw *info) { - int res; - - res = spa_pod_parse_object(format, + return spa_pod_parse_object(format, SPA_TYPE_OBJECT_Format, NULL, SPA_FORMAT_VIDEO_format, SPA_POD_OPT_Id(&info->format), SPA_FORMAT_VIDEO_modifier, SPA_POD_OPT_Long(&info->modifier), @@ -61,26 +59,16 @@ spa_format_video_raw_parse(const struct spa_pod *format, SPA_FORMAT_VIDEO_colorMatrix, SPA_POD_OPT_Id(&info->color_matrix), SPA_FORMAT_VIDEO_transferFunction, SPA_POD_OPT_Id(&info->transfer_function), SPA_FORMAT_VIDEO_colorPrimaries, SPA_POD_OPT_Id(&info->color_primaries)); - - info->use_modifier = spa_pod_find_prop (format, NULL, SPA_FORMAT_VIDEO_modifier) ? true : false; - - return res; } static inline int spa_format_video_dsp_parse(const struct spa_pod *format, struct spa_video_info_dsp *info) { - int res; - - res = spa_pod_parse_object(format, + return spa_pod_parse_object(format, SPA_TYPE_OBJECT_Format, NULL, SPA_FORMAT_VIDEO_format, SPA_POD_OPT_Id(&info->format), SPA_FORMAT_VIDEO_modifier, SPA_POD_OPT_Long(&info->modifier)); - - info->use_modifier = spa_pod_find_prop (format, NULL, SPA_FORMAT_VIDEO_modifier) ? true : false; - - return res; } static inline struct spa_pod * @@ -102,7 +90,7 @@ spa_format_video_raw_build(struct spa_pod_builder *builder, uint32_t id, if (info->framerate.denom != 0) spa_pod_builder_add(builder, SPA_FORMAT_VIDEO_framerate, SPA_POD_Fraction(&info->framerate), 0); - if (info->use_modifier) + if (info->modifier != 0) spa_pod_builder_add(builder, SPA_FORMAT_VIDEO_modifier, SPA_POD_Long(info->modifier), 0); if (info->max_framerate.denom != 0) @@ -154,7 +142,7 @@ spa_format_video_dsp_build(struct spa_pod_builder *builder, uint32_t id, if (info->format != SPA_VIDEO_FORMAT_UNKNOWN) spa_pod_builder_add(builder, SPA_FORMAT_VIDEO_format, SPA_POD_Id(info->format), 0); - if (info->use_modifier) + if (info->modifier) spa_pod_builder_add(builder, SPA_FORMAT_VIDEO_modifier, SPA_POD_Long(info->modifier), 0); return (struct spa_pod*)spa_pod_builder_pop(builder, &f); diff --git a/spa/include/spa/param/video/raw.h b/spa/include/spa/param/video/raw.h index 2beed4456..47fbd19b3 100644 --- a/spa/include/spa/param/video/raw.h +++ b/spa/include/spa/param/video/raw.h @@ -186,9 +186,7 @@ enum spa_video_interlace_mode { */ struct spa_video_info_raw { enum spa_video_format format; /**< the format */ - - bool use_modifier; /**< whether the modifier field has a valid value */ - uint64_t modifier; /**< format modifier + int64_t modifier; /**< format modifier * only used with DMA-BUF */ struct spa_rectangle size; /**< the frame size of the video */ struct spa_fraction framerate; /**< the framerate of the video, 0/1 means variable rate */ @@ -212,8 +210,7 @@ struct spa_video_info_raw { struct spa_video_info_dsp { enum spa_video_format format; - bool use_modifier; - uint64_t modifier; + int64_t modifier; }; #define SPA_VIDEO_INFO_DSP_INIT(...) ((struct spa_video_info_dsp) { __VA_ARGS__ }) diff --git a/spa/plugins/libcamera/libcamera-source.cpp b/spa/plugins/libcamera/libcamera-source.cpp index 62a73281d..26ef14874 100644 --- a/spa/plugins/libcamera/libcamera-source.cpp +++ b/spa/plugins/libcamera/libcamera-source.cpp @@ -676,10 +676,7 @@ static int port_set_format(struct impl *impl, struct port *port, info.media_subtype == port->current_format->media_subtype && info.info.raw.format == port->current_format->info.raw.format && info.info.raw.size.width == port->current_format->info.raw.size.width && - info.info.raw.size.height == port->current_format->info.raw.size.height && - info.info.raw.use_modifier == port->current_format->info.raw.use_modifier && - (!info.info.raw.use_modifier || - info.info.raw.modifier == port->current_format->info.raw.modifier)) + info.info.raw.size.height == port->current_format->info.raw.size.height) return 0; break; case SPA_MEDIA_SUBTYPE_mjpg: