Those functions are shared between libs.
Also fix a typo in function names: smtpe → smpte.
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 {
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);
#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;
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
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;
}
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
#define AVCODEC_TIMECODE_H
#include <stdint.h>
+#include "avcodec.h"
#include "libavutil/rational.h"
#define TIMECODE_OPT(ctx, flags) \
* @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
* @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
* @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 */
#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, \
#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 */
}
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("");
*/
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;
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;
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) {
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);