[FFmpeg-devel] [PATCH 3/4] timecode: support >24h timecode.

Clément Bœsch ubitux at gmail.com
Thu Jan 5 21:03:44 CET 2012


From: Clément Bœsch <clement.boesch at smartjog.com>

---
 libavcodec/timecode.c |    4 ++--
 libavcodec/timecode.h |    5 +++--
 libavcodec/version.h  |    2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavcodec/timecode.c b/libavcodec/timecode.c
index a8b4242..31bf219 100644
--- a/libavcodec/timecode.c
+++ b/libavcodec/timecode.c
@@ -90,10 +90,10 @@ char *avpriv_timecode_to_string(char *buf, const struct ff_timecode *tc, unsigne
     ff = frame_num % fps;
     ss = frame_num / fps        % 60;
     mm = frame_num / (fps*60)   % 60;
-    hh = frame_num / (fps*3600) % 24;
+    hh = frame_num / (fps*3600);
     if (ff < 0 || ss < 0 || mm < 0 || hh < 0)
         neg = 1, ff = -ff, ss = -ss, mm = -mm, hh = -hh;
-    snprintf(buf, sizeof("-hh:mm:ss.ff"), "%s%02d:%02d:%02d%c%02d",
+    snprintf(buf, sizeof("-hhh:mm:ss.ff"), "%s%02d:%02d:%02d%c%02d",
              neg ? "-" : "",
              hh, mm, ss, tc->drop ? ';' : ':', ff);
     return buf;
diff --git a/libavcodec/timecode.h b/libavcodec/timecode.h
index 263ca29..83a2b1a 100644
--- a/libavcodec/timecode.h
+++ b/libavcodec/timecode.h
@@ -67,9 +67,10 @@ uint32_t avpriv_framenum_to_smpte_timecode(unsigned frame, int fps, int drop);
  * @param tc    Timecode struct pointer
  * @param frame Frame id (timecode frame is computed with tc->start+frame)
  * @return a pointer to the buf parameter
- * @note  timecode representation can be a negative timecode
+ * @note  timecode representation can be a negative timecode and have
+ *        more than 24 hours.
  * @note  buf must have enough space to store the timecode representation
- *        (sizeof("-hh:mm:ss.ff"))
+ *        (sizeof("-hhh:mm:ss.ff"))
  */
 char *avpriv_timecode_to_string(char *buf, const struct ff_timecode *tc, unsigned frame);
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 3cc2bc3..1e94c96 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -22,7 +22,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR 53
 #define LIBAVCODEC_VERSION_MINOR 54
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
-- 
1.7.8.1



More information about the ffmpeg-devel mailing list