[PATCH] lavfi/tile: make color of padding configurable
Signed-off-by: Paul B Mahol <onemda@gmail.com> --- doc/filters.texi | 4 ++++ libavfilter/vf_tile.c | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 9a871b9..d390ff4 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -7102,6 +7102,10 @@ Set the inner border thickness (i.e. the number of pixels between frames). For more advanced padding options (such as having different values for the edges), refer to the pad video filter. +@item color +Specify the color of the padded area, it can be the name of a color +(case insensitive match) or a 0xRRGGBB[AA] sequence. +The default value of @var{color} is "black". @end table @subsection Examples diff --git a/libavfilter/vf_tile.c b/libavfilter/vf_tile.c index f5eb763..9807e7e 100644 --- a/libavfilter/vf_tile.c +++ b/libavfilter/vf_tile.c @@ -41,6 +41,7 @@ typedef struct { FFDrawContext draw; FFDrawColor blank; AVFrame *out_ref; + uint8_t rgba_color[4]; } TileContext; #define REASONABLE_SIZE 1024 @@ -57,6 +58,7 @@ static const AVOption tile_options[] = { AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1024, FLAGS }, { "padding", "set inner border thickness in pixels", OFFSET(padding), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1024, FLAGS }, + { "color", "set the color of the padded area", OFFSET(rgba_color), AV_OPT_TYPE_COLOR, {.str = "black"}, .flags = FLAGS }, {NULL}, }; @@ -113,8 +115,7 @@ static int config_props(AVFilterLink *outlink) outlink->frame_rate = av_mul_q(inlink->frame_rate, (AVRational){ 1, tile->nb_frames }); ff_draw_init(&tile->draw, inlink->format, 0); - /* TODO make the color an option, or find an unified way of choosing it */ - ff_draw_color(&tile->draw, &tile->blank, (uint8_t[]){ 0, 0, 0, -1 }); + ff_draw_color(&tile->draw, &tile->blank, tile->rgba_color); outlink->flags |= FF_LINK_FLAG_REQUEST_LOOP; -- 1.7.11.2
On Wed, Aug 14, 2013 at 09:53:02PM +0000, Paul B Mahol wrote:
Signed-off-by: Paul B Mahol <onemda@gmail.com> --- doc/filters.texi | 4 ++++ libavfilter/vf_tile.c | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/doc/filters.texi b/doc/filters.texi index 9a871b9..d390ff4 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -7102,6 +7102,10 @@ Set the inner border thickness (i.e. the number of pixels between frames). For more advanced padding options (such as having different values for the edges), refer to the pad video filter.
+@item color +Specify the color of the padded area, it can be the name of a color +(case insensitive match) or a 0xRRGGBB[AA] sequence. +The default value of @var{color} is "black". @end table
@subsection Examples diff --git a/libavfilter/vf_tile.c b/libavfilter/vf_tile.c index f5eb763..9807e7e 100644 --- a/libavfilter/vf_tile.c +++ b/libavfilter/vf_tile.c @@ -41,6 +41,7 @@ typedef struct { FFDrawContext draw; FFDrawColor blank; AVFrame *out_ref; + uint8_t rgba_color[4]; } TileContext;
#define REASONABLE_SIZE 1024 @@ -57,6 +58,7 @@ static const AVOption tile_options[] = { AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1024, FLAGS }, { "padding", "set inner border thickness in pixels", OFFSET(padding), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1024, FLAGS }, + { "color", "set the color of the padded area", OFFSET(rgba_color), AV_OPT_TYPE_COLOR, {.str = "black"}, .flags = FLAGS }, {NULL}, };
@@ -113,8 +115,7 @@ static int config_props(AVFilterLink *outlink) outlink->frame_rate = av_mul_q(inlink->frame_rate, (AVRational){ 1, tile->nb_frames }); ff_draw_init(&tile->draw, inlink->format, 0); - /* TODO make the color an option, or find an unified way of choosing it */ - ff_draw_color(&tile->draw, &tile->blank, (uint8_t[]){ 0, 0, 0, -1 }); + ff_draw_color(&tile->draw, &tile->blank, tile->rgba_color);
outlink->flags |= FF_LINK_FLAG_REQUEST_LOOP;
Won't this affect blank frame as well? -- Clément B.
On 8/14/13, Clement Boesch <u@pkh.me> wrote:
On Wed, Aug 14, 2013 at 09:53:02PM +0000, Paul B Mahol wrote:
Signed-off-by: Paul B Mahol <onemda@gmail.com> --- doc/filters.texi | 4 ++++ libavfilter/vf_tile.c | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/doc/filters.texi b/doc/filters.texi index 9a871b9..d390ff4 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -7102,6 +7102,10 @@ Set the inner border thickness (i.e. the number of pixels between frames). For more advanced padding options (such as having different values for the edges), refer to the pad video filter.
+@item color +Specify the color of the padded area, it can be the name of a color +(case insensitive match) or a 0xRRGGBB[AA] sequence. +The default value of @var{color} is "black". @end table
@subsection Examples diff --git a/libavfilter/vf_tile.c b/libavfilter/vf_tile.c index f5eb763..9807e7e 100644 --- a/libavfilter/vf_tile.c +++ b/libavfilter/vf_tile.c @@ -41,6 +41,7 @@ typedef struct { FFDrawContext draw; FFDrawColor blank; AVFrame *out_ref; + uint8_t rgba_color[4]; } TileContext;
#define REASONABLE_SIZE 1024 @@ -57,6 +58,7 @@ static const AVOption tile_options[] = { AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1024, FLAGS }, { "padding", "set inner border thickness in pixels", OFFSET(padding), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1024, FLAGS }, + { "color", "set the color of the padded area", OFFSET(rgba_color), AV_OPT_TYPE_COLOR, {.str = "black"}, .flags = FLAGS }, {NULL}, };
@@ -113,8 +115,7 @@ static int config_props(AVFilterLink *outlink) outlink->frame_rate = av_mul_q(inlink->frame_rate, (AVRational){ 1, tile->nb_frames }); ff_draw_init(&tile->draw, inlink->format, 0); - /* TODO make the color an option, or find an unified way of choosing it */ - ff_draw_color(&tile->draw, &tile->blank, (uint8_t[]){ 0, 0, 0, -1 }); + ff_draw_color(&tile->draw, &tile->blank, tile->rgba_color);
outlink->flags |= FF_LINK_FLAG_REQUEST_LOOP;
Won't this affect blank frame as well?
Yes, it will. Perhaps they should be separate?
On Thu, Aug 15, 2013 at 10:35:13AM +0000, Paul B Mahol wrote:
On 8/14/13, Clement Boesch <u@pkh.me> wrote:
On Wed, Aug 14, 2013 at 09:53:02PM +0000, Paul B Mahol wrote:
Signed-off-by: Paul B Mahol <onemda@gmail.com> --- doc/filters.texi | 4 ++++ libavfilter/vf_tile.c | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/doc/filters.texi b/doc/filters.texi index 9a871b9..d390ff4 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -7102,6 +7102,10 @@ Set the inner border thickness (i.e. the number of pixels between frames). For more advanced padding options (such as having different values for the edges), refer to the pad video filter.
+@item color +Specify the color of the padded area, it can be the name of a color +(case insensitive match) or a 0xRRGGBB[AA] sequence. +The default value of @var{color} is "black". @end table
@subsection Examples diff --git a/libavfilter/vf_tile.c b/libavfilter/vf_tile.c index f5eb763..9807e7e 100644 --- a/libavfilter/vf_tile.c +++ b/libavfilter/vf_tile.c @@ -41,6 +41,7 @@ typedef struct { FFDrawContext draw; FFDrawColor blank; AVFrame *out_ref; + uint8_t rgba_color[4]; } TileContext;
#define REASONABLE_SIZE 1024 @@ -57,6 +58,7 @@ static const AVOption tile_options[] = { AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1024, FLAGS }, { "padding", "set inner border thickness in pixels", OFFSET(padding), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1024, FLAGS }, + { "color", "set the color of the padded area", OFFSET(rgba_color), AV_OPT_TYPE_COLOR, {.str = "black"}, .flags = FLAGS }, {NULL}, };
@@ -113,8 +115,7 @@ static int config_props(AVFilterLink *outlink) outlink->frame_rate = av_mul_q(inlink->frame_rate, (AVRational){ 1, tile->nb_frames }); ff_draw_init(&tile->draw, inlink->format, 0); - /* TODO make the color an option, or find an unified way of choosing it */ - ff_draw_color(&tile->draw, &tile->blank, (uint8_t[]){ 0, 0, 0, -1 }); + ff_draw_color(&tile->draw, &tile->blank, tile->rgba_color);
outlink->flags |= FF_LINK_FLAG_REQUEST_LOOP;
Won't this affect blank frame as well?
Yes, it will. Perhaps they should be separate?
I'm fine with the current situation as long as the documentation is clear enough (I'm unsure anyone is willing to have a "fake" frame effect by setting a padding). Changing "padded area" by "unused area" or "blank area" in the doc should do the trick. But maybe Nicolas has a different opinion. -- Clément B.
L'octidi 28 thermidor, an CCXXI, Clément Bœsch a écrit :
I'm fine with the current situation as long as the documentation is clear enough (I'm unsure anyone is willing to have a "fake" frame effect by setting a padding). Changing "padded area" by "unused area" or "blank area" in the doc should do the trick. But maybe Nicolas has a different opinion.
I was just waiting for a few available moments to read the patch carefully. I believe you said everything that needed to be said. The patch seems fine as is, anything can be enhanced it the need actually happens. Regards, -- Nicolas George
participants (3)
-
Clément Bœsch -
Nicolas George -
Paul B Mahol