diff mbox series

[FFmpeg-devel] avfilter/graphparser: fix filter instance name when an id is provided

Message ID 20230302130243.202-1-jamrial@gmail.com
State Accepted
Commit 2fd86d9afadf9b62c2e900505558141a35e2ed6f
Headers show
Series [FFmpeg-devel] avfilter/graphparser: fix filter instance name when an id is provided | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

James Almer March 2, 2023, 1:02 p.m. UTC
Restores the behavior of naming the instance filter@id, which was accidentally changed
to simpy id in commit f17051eaae.

Fixes ticket #10226.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavfilter/graphparser.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

James Almer March 5, 2023, 10:13 p.m. UTC | #1
On 3/2/2023 10:02 AM, James Almer wrote:
> Restores the behavior of naming the instance filter@id, which was accidentally changed
> to simpy id in commit f17051eaae.
> 
> Fixes ticket #10226.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>   libavfilter/graphparser.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c
> index 8e12416ccb..4347131fad 100644
> --- a/libavfilter/graphparser.c
> +++ b/libavfilter/graphparser.c
> @@ -532,8 +532,7 @@ int avfilter_graph_segment_create_filters(AVFilterGraphSegment *seg, int flags)
>           for (size_t j = 0; j < ch->nb_filters; j++) {
>               AVFilterParams *p = ch->filters[j];
>               const AVFilter *f = avfilter_get_by_name(p->filter_name);
> -            char inst_name[30], *name = p->instance_name ? p->instance_name :
> -                                                           inst_name;
> +            char name[64];
>   
>               // skip already processed filters
>               if (p->filter || !p->filter_name)
> @@ -546,7 +545,9 @@ int avfilter_graph_segment_create_filters(AVFilterGraphSegment *seg, int flags)
>               }
>   
>               if (!p->instance_name)
> -                snprintf(inst_name, sizeof(inst_name), "Parsed_%s_%zu", f->name, idx);
> +                snprintf(name, sizeof(name), "Parsed_%s_%zu", f->name, idx);
> +            else
> +                snprintf(name, sizeof(name), "%s@%s", f->name, p->instance_name);
>   
>               p->filter = avfilter_graph_alloc_filter(seg->graph, f, name);
>               if (!p->filter)

Will apply.
diff mbox series

Patch

diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c
index 8e12416ccb..4347131fad 100644
--- a/libavfilter/graphparser.c
+++ b/libavfilter/graphparser.c
@@ -532,8 +532,7 @@  int avfilter_graph_segment_create_filters(AVFilterGraphSegment *seg, int flags)
         for (size_t j = 0; j < ch->nb_filters; j++) {
             AVFilterParams *p = ch->filters[j];
             const AVFilter *f = avfilter_get_by_name(p->filter_name);
-            char inst_name[30], *name = p->instance_name ? p->instance_name :
-                                                           inst_name;
+            char name[64];
 
             // skip already processed filters
             if (p->filter || !p->filter_name)
@@ -546,7 +545,9 @@  int avfilter_graph_segment_create_filters(AVFilterGraphSegment *seg, int flags)
             }
 
             if (!p->instance_name)
-                snprintf(inst_name, sizeof(inst_name), "Parsed_%s_%zu", f->name, idx);
+                snprintf(name, sizeof(name), "Parsed_%s_%zu", f->name, idx);
+            else
+                snprintf(name, sizeof(name), "%s@%s", f->name, p->instance_name);
 
             p->filter = avfilter_graph_alloc_filter(seg->graph, f, name);
             if (!p->filter)