[FFmpeg-devel] [PATCH] drawtext: fix hard dependency to lavc (timecode).
Clément Bœsch
ubitux at gmail.com
Mon Jan 2 09:57:26 CET 2012
On Wed, Dec 28, 2011 at 01:28:42PM +0100, Stefano Sabatini wrote:
[...]
> Alternatively you may consider a run-time error issued in case one of
> those options is called and CONFIG_AVCODEC was not enabled.
>
New version attached. I'll push it in the next days if I see no objection.
--
Clément B.
-------------- next part --------------
From 1b79dbd7ba175471183aaea113fc80daaf8553d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= <clement.boesch at smartjog.com>
Date: Wed, 28 Dec 2011 10:09:45 +0100
Subject: [PATCH] drawtext: fix hard dependency to lavc (timecode).
---
libavfilter/vf_drawtext.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 9f85586..0de5b9f 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -29,6 +29,7 @@
#include <sys/time.h>
#include <time.h>
+#include "config.h"
#include "libavcodec/timecode.h"
#include "libavutil/avstring.h"
#include "libavutil/colorspace.h"
@@ -341,10 +342,16 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
}
if (dtext->tc.str) {
+#if CONFIG_AVCODEC
if (avpriv_init_smpte_timecode(ctx, &dtext->tc) < 0)
return AVERROR(EINVAL);
if (!dtext->text)
dtext->text = av_strdup("");
+#else
+ av_log(ctx, AV_LOG_ERROR,
+ "Timecode options are only available if libavfilter is built with libavcodec enabled.\n");
+ return AVERROR(EINVAL);
+#endif
}
if (!dtext->text) {
@@ -722,11 +729,13 @@ static int draw_text(AVFilterContext *ctx, AVFilterBufferRef *picref,
buf_size *= 2;
} while ((buf = av_realloc(buf, buf_size)));
+#if CONFIG_AVCODEC
if (dtext->tc.str) {
char tcbuf[sizeof("hh:mm:ss.ff")];
avpriv_timecode_to_string(tcbuf, &dtext->tc, dtext->frame_id++);
buf = av_asprintf("%s%s", dtext->text, tcbuf);
}
+#endif
if (!buf)
return AVERROR(ENOMEM);
--
1.7.7.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120102/c95d01d5/attachment.asc>
More information about the ffmpeg-devel
mailing list