[FFmpeg-cvslog] timecode: rename internal ff_* symbols to avpriv_*.

Clément Bœsch git at videolan.org
Mon Dec 12 17:53:43 CET 2011


ffmpeg | branch: master | Clément Bœsch <clement.boesch at smartjog.com> | Wed Dec  7 10:44:50 2011 +0100| [80914cde6f2b5d6584c74bad6b3613d16dfbda67] | committer: Clément Bœsch

timecode: rename internal ff_* symbols to avpriv_*.

Those functions are shared between libs.

Also fix a typo in function names: smtpe → smpte.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=80914cde6f2b5d6584c74bad6b3613d16dfbda67
---

 libavcodec/mpeg12enc.c    |    4 ++--
 libavcodec/timecode.c     |   25 +++++++++++++++++++++----
 libavcodec/timecode.h     |   13 ++++++++++---
 libavcodec/version.h      |    6 +++++-
 libavfilter/vf_drawtext.c |    2 +-
 libavformat/dvenc.c       |    8 ++++----
 libavformat/mxfenc.c      |    8 ++++----
 7 files changed, 47 insertions(+), 19 deletions(-)

diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 3cfe733..195d14e 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -182,7 +182,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
 
     if (s->tc.str) {
         s->tc.rate = avpriv_frame_rate_tab[s->frame_rate_index];
-        if (ff_init_smtpe_timecode(s, &s->tc) < 0)
+        if (avpriv_init_smpte_timecode(s, &s->tc) < 0)
             return -1;
         s->avctx->timecode_frame_start = s->tc.start;
     } else {
@@ -303,7 +303,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
             s->gop_picture_number = s->current_picture_ptr->f.coded_picture_number;
             av_assert0(s->drop_frame_timecode == s->tc.drop);
             if (s->tc.drop)
-                time_code = ff_framenum_to_drop_timecode(time_code);
+                time_code = avpriv_framenum_to_drop_timecode(time_code);
             put_bits(&s->pb, 5, (uint32_t)((time_code / (fps * 3600)) % 24));
             put_bits(&s->pb, 6, (uint32_t)((time_code / (fps * 60)) % 60));
             put_bits(&s->pb, 1, 1);
diff --git a/libavcodec/timecode.c b/libavcodec/timecode.c
index 379f08a..fd996ed 100644
--- a/libavcodec/timecode.c
+++ b/libavcodec/timecode.c
@@ -28,7 +28,7 @@
 #include "timecode.h"
 #include "libavutil/log.h"
 
-int ff_framenum_to_drop_timecode(int frame_num)
+int avpriv_framenum_to_drop_timecode(int frame_num)
 {
     /* only works for NTSC 29.97 */
     int d = frame_num / 17982;
@@ -37,7 +37,7 @@ int ff_framenum_to_drop_timecode(int frame_num)
     return frame_num + 18 * d + 2 * ((m - 2) / 1798);
 }
 
-uint32_t ff_framenum_to_smtpe_timecode(unsigned frame, int fps, int drop)
+uint32_t avpriv_framenum_to_smpte_timecode(unsigned frame, int fps, int drop)
 {
     return (0                                    << 31) | // color frame flag
            (drop                                 << 30) | // drop  frame flag
@@ -89,13 +89,13 @@ char *avpriv_timecode_to_string(char *buf, const struct ff_timecode *tc, unsigne
     int hh  = frame_num / (fps*3600) % 24;
 
     if (tc->drop)
-        frame_num = ff_framenum_to_drop_timecode(frame_num);
+        frame_num = avpriv_framenum_to_drop_timecode(frame_num);
     snprintf(buf, sizeof("hh:mm:ss.ff"), "%02d:%02d:%02d%c%02d",
              hh, mm, ss, tc->drop ? ';' : ':', ff);
     return buf;
 }
 
-int ff_init_smtpe_timecode(void *avcl, struct ff_timecode *tc)
+int avpriv_init_smpte_timecode(void *avcl, struct ff_timecode *tc)
 {
     int hh, mm, ss, ff, fps, ret;
     char c;
@@ -121,3 +121,20 @@ int ff_init_smtpe_timecode(void *avcl, struct ff_timecode *tc)
     }
     return 0;
 }
+
+#if FF_API_OLD_TIMECODE
+int ff_framenum_to_drop_timecode(int frame_num)
+{
+    return avpriv_framenum_to_drop_timecode(frame_num);
+}
+
+uint32_t ff_framenum_to_smtpe_timecode(unsigned frame, int fps, int drop)
+{
+    return avpriv_framenum_to_smpte_timecode(frame, fps, drop);
+}
+
+int ff_init_smtpe_timecode(void *avcl, struct ff_timecode *tc)
+{
+    return avpriv_init_smpte_timecode(avcl, tc);
+}
+#endif
diff --git a/libavcodec/timecode.h b/libavcodec/timecode.h
index 7bbd1ea..3f3c17e 100644
--- a/libavcodec/timecode.h
+++ b/libavcodec/timecode.h
@@ -28,6 +28,7 @@
 #define AVCODEC_TIMECODE_H
 
 #include <stdint.h>
+#include "avcodec.h"
 #include "libavutil/rational.h"
 
 #define TIMECODE_OPT(ctx, flags)                                         \
@@ -49,7 +50,7 @@ struct ff_timecode {
  * @return          Adjusted frame number
  * @warning         Adjustment is only valid in NTSC 29.97
  */
-int ff_framenum_to_drop_timecode(int frame_num);
+int avpriv_framenum_to_drop_timecode(int frame_num);
 
 /**
  * @brief       Convert frame id (timecode) to SMPTE 12M binary representation
@@ -58,7 +59,7 @@ int ff_framenum_to_drop_timecode(int frame_num);
  * @param drop  Drop flag
  * @return      The actual binary representation
  */
-uint32_t ff_framenum_to_smtpe_timecode(unsigned frame, int fps, int drop);
+uint32_t avpriv_framenum_to_smpte_timecode(unsigned frame, int fps, int drop);
 
 /**
  * @brief       Load timecode string in buf
@@ -81,6 +82,12 @@ char *avpriv_timecode_to_string(char *buf, const struct ff_timecode *tc, unsigne
  * @return     0 on success, negative value on failure
  * @warning    Adjustement is only valid in NTSC 29.97
  */
-int ff_init_smtpe_timecode(void *avcl, struct ff_timecode *tc);
+int avpriv_init_smpte_timecode(void *avcl, struct ff_timecode *tc);
+
+#if FF_API_OLD_TIMECODE
+attribute_deprecated int ff_framenum_to_drop_timecode(int frame_num);
+attribute_deprecated uint32_t ff_framenum_to_smtpe_timecode(unsigned frame, int fps, int drop);
+attribute_deprecated int ff_init_smtpe_timecode(void *avcl, struct ff_timecode *tc);
+#endif
 
 #endif /* AVCODEC_TIMECODE_H */
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 0e2c58e..c5b0027 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 42
+#define LIBAVCODEC_VERSION_MINOR 43
 #define LIBAVCODEC_VERSION_MICRO  0
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
@@ -116,5 +116,9 @@
 #ifndef FF_API_OLD_DECODE_AUDIO
 #define FF_API_OLD_DECODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 54)
 #endif
+#ifndef FF_API_OLD_TIMECODE
+#define FF_API_OLD_TIMECODE (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+
 
 #endif /* AVCODEC_VERSION_H */
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index ffcf512..0c545c8 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -341,7 +341,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
     }
 
     if (dtext->tc.str) {
-        if (ff_init_smtpe_timecode(ctx, &dtext->tc) < 0)
+        if (avpriv_init_smpte_timecode(ctx, &dtext->tc) < 0)
             return AVERROR(EINVAL);
         if (!dtext->text)
             dtext->text = av_strdup("");
diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c
index ce6568b..049bb7b 100644
--- a/libavformat/dvenc.c
+++ b/libavformat/dvenc.c
@@ -92,9 +92,9 @@ static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* bu
          */
         ltc_frame = c->tc.start + c->frames;
         if (c->tc.drop)
-            ltc_frame = ff_framenum_to_drop_timecode(ltc_frame);
-        timecode = ff_framenum_to_smtpe_timecode(ltc_frame, c->sys->ltc_divisor,
-                                                 c->tc.drop);
+            ltc_frame = avpriv_framenum_to_drop_timecode(ltc_frame);
+        timecode = avpriv_framenum_to_smpte_timecode(ltc_frame, c->sys->ltc_divisor,
+                                                     c->tc.drop);
         timecode |= 1<<23 | 1<<15 | 1<<7 | 1<<6; // biphase and binary group flags
         AV_WB32(buf + 1, timecode);
         break;
@@ -378,7 +378,7 @@ static int dv_write_header(AVFormatContext *s)
     if (dvc->tc.str) {
         dvc->tc.rate.num = dvc->sys->time_base.den;
         dvc->tc.rate.den = dvc->sys->time_base.num;
-        if (ff_init_smtpe_timecode(s, &dvc->tc) < 0)
+        if (avpriv_init_smpte_timecode(s, &dvc->tc) < 0)
             return -1;
     }
     return 0;
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index c209c5c..881902b 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -1432,7 +1432,7 @@ static int mxf_write_header(AVFormatContext *s)
             if (mxf->tc.str) {
                 mxf->tc.rate.num = mxf->time_base.den;
                 mxf->tc.rate.den = mxf->time_base.num;
-                if (ff_init_smtpe_timecode(s, &mxf->tc) < 0)
+                if (avpriv_init_smpte_timecode(s, &mxf->tc) < 0)
                     return -1;
             }
             if (s->oformat == &ff_mxf_d10_muxer) {
@@ -1572,9 +1572,9 @@ static void mxf_write_system_item(AVFormatContext *s)
     avio_w8(pb, 0x81); // SMPTE 12M time code
     time_code = frame;
     if (mxf->tc.drop)
-        time_code = ff_framenum_to_drop_timecode(time_code);
-    time_code = ff_framenum_to_smtpe_timecode(time_code, mxf->timecode_base,
-                                              mxf->tc.drop);
+        time_code = avpriv_framenum_to_drop_timecode(time_code);
+    time_code = avpriv_framenum_to_smpte_timecode(time_code, mxf->timecode_base,
+                                                  mxf->tc.drop);
     avio_wb32(pb, time_code);
     avio_wb32(pb, 0); // binary group data
     avio_wb64(pb, 0);



More information about the ffmpeg-cvslog mailing list