1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-04-08 16:54:03 +02:00

avformat/utils: Make ff_compute_frame_duration() static

Since 1c0885334dda9ee8652e60c586fa2e3674056586 ff_compute_frame_duration
is only called from within utils.c and only for demuxers. So make it
static and remove the code in it that deals with muxers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-08-26 19:19:28 +02:00
parent 3f991325b5
commit c6d780b92e
2 changed files with 7 additions and 14 deletions

View File

@ -715,12 +715,6 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
void ff_free_stream(AVFormatContext *s, AVStream *st);
/**
* Return the frame duration in seconds. Return 0 if not available.
*/
void ff_compute_frame_duration(AVFormatContext *s, int *pnum, int *pden, AVStream *st,
AVCodecParserContext *pc, AVPacket *pkt);
unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id);
enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag);

View File

@ -873,18 +873,18 @@ static int determinable_frame_size(AVCodecContext *avctx)
/**
* Return the frame duration in seconds. Return 0 if not available.
*/
void ff_compute_frame_duration(AVFormatContext *s, int *pnum, int *pden, AVStream *st,
AVCodecParserContext *pc, AVPacket *pkt)
static void compute_frame_duration(AVFormatContext *s, int *pnum, int *pden,
AVStream *st, AVCodecParserContext *pc,
AVPacket *pkt)
{
AVRational codec_framerate = s->iformat ? st->internal->avctx->framerate :
av_mul_q(av_inv_q(st->internal->avctx->time_base), (AVRational){1, st->internal->avctx->ticks_per_frame});
AVRational codec_framerate = st->internal->avctx->framerate;
int frame_size, sample_rate;
*pnum = 0;
*pden = 0;
switch (st->codecpar->codec_type) {
case AVMEDIA_TYPE_VIDEO:
if (st->r_frame_rate.num && !pc && s->iformat) {
if (st->r_frame_rate.num && !pc) {
*pnum = st->r_frame_rate.den;
*pden = st->r_frame_rate.num;
} else if (st->time_base.num * 1000LL > st->time_base.den) {
@ -898,7 +898,6 @@ void ff_compute_frame_duration(AVFormatContext *s, int *pnum, int *pden, AVStrea
INT_MAX);
if (pc && pc->repeat_pict) {
av_assert0(s->iformat); // this may be wrong for interlaced encoding but its not used for that case
av_reduce(pnum, pden,
(*pnum) * (1LL + pc->repeat_pict),
(*pden),
@ -1225,7 +1224,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
duration = av_mul_q((AVRational) {pkt->duration, 1}, st->time_base);
if (pkt->duration <= 0) {
ff_compute_frame_duration(s, &num, &den, st, pc, pkt);
compute_frame_duration(s, &num, &den, st, pc, pkt);
if (den && num) {
duration = (AVRational) {num, den};
pkt->duration = av_rescale_rnd(1,
@ -2761,7 +2760,7 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
(st->start_time != AV_NOPTS_VALUE ||
st->internal->first_dts != AV_NOPTS_VALUE)) {
if (pkt->duration == 0) {
ff_compute_frame_duration(ic, &num, &den, st, st->internal->parser, pkt);
compute_frame_duration(ic, &num, &den, st, st->internal->parser, pkt);
if (den && num) {
pkt->duration = av_rescale_rnd(1,
num * (int64_t) st->time_base.den,