spa: Add SPA_VIDEO_FLAG_MODIFIER_FIXATION_REQUIRED

This flags allows clients to use the parse_format functions and
determine from their result directly if the modifer was fixated yet.
This commit is contained in:
columbarius 2023-07-14 03:36:18 +02:00 committed by Wim Taymans
parent abe8c3581f
commit 0a13d37e5c
3 changed files with 14 additions and 7 deletions

View file

@ -23,8 +23,11 @@ spa_format_video_dsp_parse(const struct spa_pod *format,
struct spa_video_info_dsp *info) struct spa_video_info_dsp *info)
{ {
info->flags = SPA_VIDEO_FLAG_NONE; info->flags = SPA_VIDEO_FLAG_NONE;
if (spa_pod_find_prop (format, NULL, SPA_FORMAT_VIDEO_modifier)) { const struct spa_pod_prop *mod_prop;
if ((mod_prop = spa_pod_find_prop (format, NULL, SPA_FORMAT_VIDEO_modifier)) != NULL) {
info->flags |= SPA_VIDEO_FLAG_MODIFIER; info->flags |= SPA_VIDEO_FLAG_MODIFIER;
if ((mod_prop->flags & SPA_POD_PROP_FLAG_DONT_FIXATE) == SPA_POD_PROP_FLAG_DONT_FIXATE)
info->flags |= SPA_VIDEO_FLAG_MODIFIER_FIXATION_REQUIRED;
} }
return spa_pod_parse_object(format, return spa_pod_parse_object(format,

View file

@ -23,8 +23,11 @@ spa_format_video_raw_parse(const struct spa_pod *format,
struct spa_video_info_raw *info) struct spa_video_info_raw *info)
{ {
info->flags = SPA_VIDEO_FLAG_NONE; info->flags = SPA_VIDEO_FLAG_NONE;
if (spa_pod_find_prop (format, NULL, SPA_FORMAT_VIDEO_modifier)) { const struct spa_pod_prop *mod_prop;
if ((mod_prop = spa_pod_find_prop (format, NULL, SPA_FORMAT_VIDEO_modifier)) != NULL) {
info->flags |= SPA_VIDEO_FLAG_MODIFIER; info->flags |= SPA_VIDEO_FLAG_MODIFIER;
if ((mod_prop->flags & SPA_POD_PROP_FLAG_DONT_FIXATE) == SPA_POD_PROP_FLAG_DONT_FIXATE)
info->flags |= SPA_VIDEO_FLAG_MODIFIER_FIXATION_REQUIRED;
} }
return spa_pod_parse_object(format, return spa_pod_parse_object(format,

View file

@ -134,11 +134,12 @@ enum spa_video_format {
* Extra video flags * Extra video flags
*/ */
enum spa_video_flags { enum spa_video_flags {
SPA_VIDEO_FLAG_NONE = 0, /**< no flags */ SPA_VIDEO_FLAG_NONE = 0, /**< no flags */
SPA_VIDEO_FLAG_VARIABLE_FPS = (1 << 0), /**< a variable fps is selected, fps_n and fps_d SPA_VIDEO_FLAG_VARIABLE_FPS = (1 << 0), /**< a variable fps is selected, fps_n and fps_d
* denote the maximum fps of the video */ * denote the maximum fps of the video */
SPA_VIDEO_FLAG_PREMULTIPLIED_ALPHA = (1 << 1), /**< Each color has been scaled by the alpha value. */ SPA_VIDEO_FLAG_PREMULTIPLIED_ALPHA = (1 << 1), /**< Each color has been scaled by the alpha value. */
SPA_VIDEO_FLAG_MODIFIER = (1 << 2), /**< use the format modifier */ SPA_VIDEO_FLAG_MODIFIER = (1 << 2), /**< use the format modifier */
SPA_VIDEO_FLAG_MODIFIER_FIXATION_REQUIRED = (1 << 3), /**< format modifier was not fixated yet */
}; };
/** /**