diff options
author | Anton Khirnov <anton@khirnov.net> | 2024-06-09 18:41:38 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2024-09-23 17:11:40 +0200 |
commit | 299d9115d4c7c6c108197f48960e140d7433dae6 (patch) | |
tree | 2db39ed72c4fb594c208a5b11e17ca03b776f725 /libavfilter/f_select.c | |
parent | 6940a6de2f047ceae414ddebaab30cd9fe35b020 (diff) | |
download | ffmpeg-299d9115d4c7c6c108197f48960e140d7433dae6.tar.gz |
lavfi/f_select: allow selection based on view ID
Can be used together with the split filter to decompose multiview video
into individual views.
Diffstat (limited to 'libavfilter/f_select.c')
-rw-r--r-- | libavfilter/f_select.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c index 6ba96bd7c5..ba0ae31f1b 100644 --- a/libavfilter/f_select.c +++ b/libavfilter/f_select.c @@ -93,6 +93,8 @@ static const char *const var_names[] = { "ih", ///< ih: Represents the height of the input video frame. "iw", ///< iw: Represents the width of the input video frame. + "view", + NULL }; @@ -150,6 +152,8 @@ enum var_name { VAR_IH, VAR_IW, + VAR_VIEW, + VAR_VARS_NB }; @@ -343,6 +347,7 @@ static void select_frame(AVFilterContext *ctx, AVFrame *frame) SelectContext *select = ctx->priv; AVFilterLink *inlink = ctx->inputs[0]; FilterLink *inl = ff_filter_link(inlink); + const AVFrameSideData *sd; double res; if (isnan(select->var_values[VAR_START_PTS])) @@ -381,6 +386,10 @@ FF_ENABLE_DEPRECATION_WARNINGS snprintf(buf, sizeof(buf), "%f", select->var_values[VAR_SCENE]); av_dict_set(&frame->metadata, "lavfi.scene_score", buf, 0); } + + sd = av_frame_side_data_get(frame->side_data, frame->nb_side_data, + AV_FRAME_DATA_VIEW_ID); + select->var_values[VAR_VIEW] = sd ? *(int*)sd->data : NAN; break; } |