diff mbox

[FFmpeg-devel] lavu/timecode: clarify error msg for timecode_rate

Message ID bd9ad31a-3f7e-434f-74c0-4f5f217acdee@gmail.com
State Accepted
Commit 84556ef05963138cbc39fa1a39b790dffe15ffe8
Headers show

Commit Message

Gyan Nov. 5, 2017, 4:10 p.m. UTC
Prompted by an issue reported at StackExchange, patch changes error 
message for timecode_rate values below 1.

The user-supplied value for timecode_rate in drawtext is rounded
to nearest integer. So, a supplied value of 0.49 or lower is rounded to 
0. This throws a misleading error message which says "Timecode frame 
rate must be specified". Changed message to account for values under one.

Also noted supported framerates for drop TC.

Regards,
Gyan
From ef152e77da4d1ea40d452b9cc86dcc51df1e20a7 Mon Sep 17 00:00:00 2001
From: Gyan Doshi <gyandoshi@gmail.com>
Date: Sun, 5 Nov 2017 21:29:22 +0530
Subject: [PATCH] lavu/timecode: clarify error msg for timecode_rate

The user-supplied value for timecode_rate in drawtext is rounded
to nearest integer. So, a supplied value of 0.49 or lower is rounded to 0.
This throws a misleading error message which says "Timecode frame rate must be
specified". Changed message to account for values under one.

Also noted supported framerates for drop TC.
---
 doc/filters.texi     | 4 +++-
 libavutil/timecode.c | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

Comments

Gyan Nov. 9, 2017, 7:07 p.m. UTC | #1
Ping.
Michael Niedermayer Nov. 9, 2017, 11:51 p.m. UTC | #2
On Sun, Nov 05, 2017 at 09:40:41PM +0530, Gyan Doshi wrote:
> Prompted by an issue reported at StackExchange, patch changes error
> message for timecode_rate values below 1.
> 
> The user-supplied value for timecode_rate in drawtext is rounded
> to nearest integer. So, a supplied value of 0.49 or lower is rounded
> to 0. This throws a misleading error message which says "Timecode
> frame rate must be specified". Changed message to account for values
> under one.
> 
> Also noted supported framerates for drop TC.
> 
> Regards,
> Gyan

>  doc/filters.texi     |    4 +++-
>  libavutil/timecode.c |    2 +-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 46ec36f411475b98d95396db7f239cb832fd80ae  0001-lavu-timecode-clarify-error-msg-for-timecode_rate.patch
> From ef152e77da4d1ea40d452b9cc86dcc51df1e20a7 Mon Sep 17 00:00:00 2001
> From: Gyan Doshi <gyandoshi@gmail.com>
> Date: Sun, 5 Nov 2017 21:29:22 +0530
> Subject: [PATCH] lavu/timecode: clarify error msg for timecode_rate
> 
> The user-supplied value for timecode_rate in drawtext is rounded
> to nearest integer. So, a supplied value of 0.49 or lower is rounded to 0.
> This throws a misleading error message which says "Timecode frame rate must be
> specified". Changed message to account for values under one.
> 
> Also noted supported framerates for drop TC.

will apply

thanks

[...]
diff mbox

Patch

diff --git a/doc/filters.texi b/doc/filters.texi
index 6f6dfcff48..61e27fea6f 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -7365,7 +7365,9 @@  format. It can be used with or without text parameter. @var{timecode_rate}
 option must be specified.
 
 @item timecode_rate, rate, r
-Set the timecode frame rate (timecode only).
+Set the timecode frame rate (timecode only). Value will be rounded to nearest
+integer. Minimum value is "1".
+Drop-frame timecode is supported for frame rates 30 & 60.
 
 @item tc24hmax
 If set to 1, the output of the timecode option will wrap around at 24 hours.
diff --git a/libavutil/timecode.c b/libavutil/timecode.c
index c0c67c8478..e9d8504ee7 100644
--- a/libavutil/timecode.c
+++ b/libavutil/timecode.c
@@ -155,7 +155,7 @@  static int check_fps(int fps)
 static int check_timecode(void *log_ctx, AVTimecode *tc)
 {
     if ((int)tc->fps <= 0) {
-        av_log(log_ctx, AV_LOG_ERROR, "Timecode frame rate must be specified\n");
+        av_log(log_ctx, AV_LOG_ERROR, "Valid timecode frame rate must be specified. Minimum value is 1\n");
         return AVERROR(EINVAL);
     }
     if ((tc->flags & AV_TIMECODE_FLAG_DROPFRAME) && tc->fps != 30 && tc->fps != 60) {