[FFmpeg-devel] [PATCH 1/2] mpeg12: raise timecode string to codec context.

Clément Bœsch ubitux at gmail.com
Wed Nov 16 17:52:33 CET 2011


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

---
 doc/APIchanges       |    3 +++
 libavcodec/avcodec.h |    7 +++++++
 libavcodec/mpeg12.c  |   10 ++++++----
 libavcodec/version.h |    2 +-
 4 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 8a2a9de..cc72063 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil:   2011-04-18
 
 API changes, most recent first:
 
+2011-11-xx - xxxxxxx - lavc 53.35.0
+  Add timecode string (timecode_str) to AVCodecContext.
+
 2011-11-03 - 96949da - lavu 51.23.0
   Add av_strcasecmp() and av_strncasecmp() to avstring.h.
 
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index d62cbfb..88ebbad 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2679,6 +2679,13 @@ typedef struct AVCodecContext {
      */
     int64_t timecode_frame_start;
 
+    /**
+     * Codec timecode string
+     * - encoding: unused
+     * - decoding: set by libavcodec
+     */
+    char timecode_str[16];
+
 #if FF_API_REQUEST_CHANNELS
     /**
      * Decoder should decode to this many channels if it can (0 for default)
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 3bc857d..c6e5968 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -2162,11 +2162,13 @@ static void mpeg_decode_gop(AVCodecContext *avctx,
       are missing (open gop)*/
     broken_link = get_bits1(&s->gb);
 
+    snprintf(avctx->timecode_str, sizeof(avctx->timecode_str),
+             "%02d:%02d:%02d%c%02d",
+             time_code_hours, time_code_minutes, time_code_seconds,
+             drop_frame_flag ? ';' : ':', time_code_pictures);
     if (s->avctx->debug & FF_DEBUG_PICT_INFO)
-        av_log(s->avctx, AV_LOG_DEBUG, "GOP (%02d:%02d:%02d%c%02d) closed_gop=%d broken_link=%d\n",
-               time_code_hours, time_code_minutes, time_code_seconds,
-               drop_frame_flag ? ';' : ':',
-               time_code_pictures, s->closed_gop, broken_link);
+        av_log(s->avctx, AV_LOG_DEBUG, "GOP (%s) closed_gop=%d broken_link=%d\n",
+               avctx->timecode_str, s->closed_gop, broken_link);
 }
 /**
  * Find the end of the current frame in the bitstream.
diff --git a/libavcodec/version.h b/libavcodec/version.h
index b7f01e9..cdc983f 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -21,7 +21,7 @@
 #define AVCODEC_VERSION_H
 
 #define LIBAVCODEC_VERSION_MAJOR 53
-#define LIBAVCODEC_VERSION_MINOR 34
+#define LIBAVCODEC_VERSION_MINOR 35
 #define LIBAVCODEC_VERSION_MICRO  0
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
-- 
1.7.7.1



More information about the ffmpeg-devel mailing list