[FFmpeg-devel] [PATCH] lavfi/drawtext: replace "draw" option with generic timeline interface.

Alexander Strasser eclipse7 at gmx.net
Fri Aug 23 21:29:09 CEST 2013


Hi Clément!

On 2013-08-21 01:26 +0200, Clément Bœsch wrote:
> On Tue, Aug 20, 2013 at 11:00:47PM +0000, Paul B Mahol wrote:
> > On 8/20/13, Clement Boesch <u at pkh.me> wrote:
> > > ---
> > >  Changelog                 |  1 +
> > >  doc/filters.texi          | 12 +-----------
> > >  libavfilter/version.h     |  2 +-
> > >  libavfilter/vf_drawtext.c | 17 +++--------------
> > >  4 files changed, 6 insertions(+), 26 deletions(-)
> > >
> > > diff --git a/Changelog b/Changelog
> > > index 4a6c60c..4337ba2 100644
> > > --- a/Changelog
> > > +++ b/Changelog
> > > @@ -15,6 +15,7 @@ version <next>
> > >    data read from an input file
> > >  - incomplete Voxware MetaSound decoder
> > >  - read EXIF metadata from JPEG
> > > +- drawtext filter now uses the generic timeline interface
> > >
> > >
> > 
> > What about backward compatibility?
> 
> I guess I'm being a bit rude assuming micro bump and Changelog entry are
> enough. Should I add some version #ifdefery around all the "draw" code
> which will be removed at next major bump? It sounded a bit overkill to me
> but well...

  Counter proposal attached; please start flaming :)

  BTW there is even another possibility. Make "enable" and
"draw" work together without prioritizing "enable" but by
treating both equally and combine them with a logical or.

  I do mind dropping draw option because of two things:

  - compatibility
  - functionality
    (draw option can use information timeline can't e.g. text width/height)


  Alexander
-------------- next part --------------
From c384207cefbc649fb66ef3f38f7f8b4b78248ceb Mon Sep 17 00:00:00 2001
Message-Id: <c384207cefbc649fb66ef3f38f7f8b4b78248ceb.1377286082.git.eclipse7 at gmx.net>
From: Alexander Strasser <eclipse7 at gmx.net>
Date: Fri, 23 Aug 2013 20:32:25 +0200
Subject: [PATCH] lavfi/drawtext: Support timeline
To: ffdev

Implement the common timeline functionality.

The global timeline feature has priority over the draw expression.
The filter's draw option is only evaluated if the global timeline
says the filter is enabled.

Draw has access to more filter specific state than global timeline
feature.

Signed-off-by: Alexander Strasser <eclipse7 at gmx.net>
---
 Changelog                 | 1 +
 doc/filters.texi          | 2 +-
 libavfilter/vf_drawtext.c | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 4a6c60c..dd5d6ea 100644
--- a/Changelog
+++ b/Changelog
@@ -15,6 +15,7 @@ version <next>
   data read from an input file
 - incomplete Voxware MetaSound decoder
 - read EXIF metadata from JPEG
+- drawtext filter: timeline support (in addition to its custom draw option)
 
 
 version 2.0:
diff --git a/doc/filters.texi b/doc/filters.texi
index 5d9a2df..78aef1d 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3548,7 +3548,7 @@ drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_gly
 @item
 Show text for 1 second every 3 seconds:
 @example
-drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:draw=lt(mod(t\,3)\,1):text='blink'"
+drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
 @end example
 
 @item
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 69124a9..630bb47 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -1042,4 +1042,5 @@ AVFilter avfilter_vf_drawtext = {
     .inputs    = avfilter_vf_drawtext_inputs,
     .outputs   = avfilter_vf_drawtext_outputs,
     .process_command = command,
+    .flags           = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
 };
-- 
1.7.10.2.552.gaa3bb87

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130823/3fef0afd/attachment.asc>


More information about the ffmpeg-devel mailing list