mirror of https://git.ffmpeg.org/ffmpeg.git
lavf: remove disabled FF_API_R_FRAME_RATE cruft
This commit is contained in:
parent
7b486ab13b
commit
85a5bc054c
|
@ -632,17 +632,6 @@ typedef struct AVStream {
|
|||
* not actually used for encoding.
|
||||
*/
|
||||
AVCodecContext *codec;
|
||||
#if FF_API_R_FRAME_RATE
|
||||
/**
|
||||
* Real base framerate of the stream.
|
||||
* This is the lowest framerate with which all timestamps can be
|
||||
* represented accurately (it is the least common multiple of all
|
||||
* framerates in the stream). Note, this value is just a guess!
|
||||
* For example, if the time base is 1/90000 and all frames have either
|
||||
* approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1.
|
||||
*/
|
||||
AVRational r_frame_rate;
|
||||
#endif
|
||||
void *priv_data;
|
||||
|
||||
/**
|
||||
|
@ -718,12 +707,6 @@ typedef struct AVStream {
|
|||
*/
|
||||
#define MAX_STD_TIMEBASES (60*12+5)
|
||||
struct {
|
||||
#if FF_API_R_FRAME_RATE
|
||||
int64_t last_dts;
|
||||
int64_t duration_gcd;
|
||||
int duration_count;
|
||||
double duration_error[MAX_STD_TIMEBASES];
|
||||
#endif
|
||||
int nb_decoded_frames;
|
||||
int found_decoder;
|
||||
|
||||
|
|
|
@ -122,9 +122,6 @@ static int avisynth_read_header(AVFormatContext *s)
|
|||
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
|
||||
st->avg_frame_rate.num = stream->info.dwRate;
|
||||
st->avg_frame_rate.den = stream->info.dwScale;
|
||||
#if FF_API_R_FRAME_RATE
|
||||
st->r_frame_rate = st->avg_frame_rate;
|
||||
#endif
|
||||
|
||||
st->codec->width = imgfmt.bmiHeader.biWidth;
|
||||
st->codec->height = imgfmt.bmiHeader.biHeight;
|
||||
|
|
|
@ -188,9 +188,6 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
|
|||
avs->st_video->codec->height = avs->height;
|
||||
avs->st_video->codec->bits_per_coded_sample=avs->bits_per_sample;
|
||||
avs->st_video->nb_frames = avs->nb_frames;
|
||||
#if FF_API_R_FRAME_RATE
|
||||
avs->st_video->r_frame_rate =
|
||||
#endif
|
||||
avs->st_video->avg_frame_rate = (AVRational){avs->fps, 1};
|
||||
}
|
||||
return avs_read_video_packet(s, pkt, type, sub_type, size,
|
||||
|
|
|
@ -432,9 +432,6 @@ static int ea_read_header(AVFormatContext *s)
|
|||
st->codec->width = ea->width;
|
||||
st->codec->height = ea->height;
|
||||
avpriv_set_pts_info(st, 33, ea->time_base.num, ea->time_base.den);
|
||||
#if FF_API_R_FRAME_RATE
|
||||
st->r_frame_rate =
|
||||
#endif
|
||||
st->avg_frame_rate = (AVRational){ea->time_base.den, ea->time_base.num};
|
||||
}
|
||||
|
||||
|
|
|
@ -1647,9 +1647,6 @@ static int matroska_read_header(AVFormatContext *s)
|
|||
if (track->default_duration) {
|
||||
av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
|
||||
1000000000, track->default_duration, 30000);
|
||||
#if FF_API_R_FRAME_RATE
|
||||
st->r_frame_rate = st->avg_frame_rate;
|
||||
#endif
|
||||
}
|
||||
} else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) {
|
||||
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
|
|
|
@ -2061,12 +2061,6 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||
if (st->duration != AV_NOPTS_VALUE)
|
||||
av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
|
||||
sc->time_scale*st->nb_frames, st->duration, INT_MAX);
|
||||
|
||||
#if FF_API_R_FRAME_RATE
|
||||
if (sc->stts_count == 1 || (sc->stts_count == 2 && sc->stts_data[1].count == 1))
|
||||
av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den,
|
||||
sc->time_scale, sc->stts_data[0].duration, INT_MAX);
|
||||
#endif
|
||||
}
|
||||
|
||||
switch (st->codec->codec_id) {
|
||||
|
|
|
@ -195,9 +195,6 @@ static int nuv_header(AVFormatContext *s)
|
|||
vst->codec->bits_per_coded_sample = 10;
|
||||
vst->sample_aspect_ratio = av_d2q(aspect * height / width,
|
||||
10000);
|
||||
#if FF_API_R_FRAME_RATE
|
||||
vst->r_frame_rate =
|
||||
#endif
|
||||
vst->avg_frame_rate = av_d2q(fps, 60000);
|
||||
avpriv_set_pts_info(vst, 32, 1, 1000);
|
||||
} else
|
||||
|
|
|
@ -88,9 +88,6 @@ static int r3d_read_red1(AVFormatContext *s)
|
|||
framerate.num = avio_rb16(s->pb);
|
||||
framerate.den = avio_rb16(s->pb);
|
||||
if (framerate.num && framerate.den) {
|
||||
#if FF_API_R_FRAME_RATE
|
||||
st->r_frame_rate =
|
||||
#endif
|
||||
st->avg_frame_rate = framerate;
|
||||
}
|
||||
|
||||
|
|
|
@ -92,9 +92,6 @@ int ff_raw_video_read_header(AVFormatContext *s)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
#if FF_API_R_FRAME_RATE
|
||||
st->r_frame_rate =
|
||||
#endif
|
||||
st->avg_frame_rate = framerate;
|
||||
avpriv_set_pts_info(st, 64, framerate.den, framerate.num);
|
||||
|
||||
|
|
|
@ -333,9 +333,6 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
|
|||
|
||||
av_reduce(&st->avg_frame_rate.den, &st->avg_frame_rate.num,
|
||||
0x10000, fps, (1 << 30) - 1);
|
||||
#if FF_API_R_FRAME_RATE
|
||||
st->r_frame_rate = st->avg_frame_rate;
|
||||
#endif
|
||||
}
|
||||
|
||||
skip:
|
||||
|
|
|
@ -2276,9 +2276,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
|
|||
}
|
||||
|
||||
for (i=0; i<ic->nb_streams; i++) {
|
||||
#if FF_API_R_FRAME_RATE
|
||||
ic->streams[i]->info->last_dts = AV_NOPTS_VALUE;
|
||||
#endif
|
||||
ic->streams[i]->info->fps_first_dts = AV_NOPTS_VALUE;
|
||||
ic->streams[i]->info->fps_last_dts = AV_NOPTS_VALUE;
|
||||
}
|
||||
|
@ -2427,31 +2424,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#if FF_API_R_FRAME_RATE
|
||||
{
|
||||
int64_t last = st->info->last_dts;
|
||||
|
||||
if(pkt->dts != AV_NOPTS_VALUE && last != AV_NOPTS_VALUE && pkt->dts > last){
|
||||
int64_t duration= pkt->dts - last;
|
||||
double dur= duration * av_q2d(st->time_base);
|
||||
|
||||
if (st->info->duration_count < 2)
|
||||
memset(st->info->duration_error, 0, sizeof(st->info->duration_error));
|
||||
for (i=1; i<FF_ARRAY_ELEMS(st->info->duration_error); i++) {
|
||||
int framerate= get_std_framerate(i);
|
||||
int ticks= lrintf(dur*framerate/(1001*12));
|
||||
double error = dur - (double)ticks*1001*12 / framerate;
|
||||
st->info->duration_error[i] += error*error;
|
||||
}
|
||||
st->info->duration_count++;
|
||||
// ignore the first 4 values, they might have some random jitter
|
||||
if (st->info->duration_count > 3)
|
||||
st->info->duration_gcd = av_gcd(st->info->duration_gcd, duration);
|
||||
}
|
||||
if (last == AV_NOPTS_VALUE || st->info->duration_count <= 1)
|
||||
st->info->last_dts = pkt->dts;
|
||||
}
|
||||
#endif
|
||||
if(st->parser && st->parser->parser->split && !st->codec->extradata){
|
||||
int i= st->parser->parser->split(st->codec, pkt->data, pkt->size);
|
||||
if (i > 0 && i < FF_MAX_EXTRADATA_SIZE) {
|
||||
|
@ -2514,30 +2486,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
|
|||
best_fps, 12*1001, INT_MAX);
|
||||
}
|
||||
}
|
||||
#if FF_API_R_FRAME_RATE
|
||||
// the check for tb_unreliable() is not completely correct, since this is not about handling
|
||||
// a unreliable/inexact time base, but a time base that is finer than necessary, as e.g.
|
||||
// ipmovie.c produces.
|
||||
if (tb_unreliable(st->codec) && st->info->duration_count > 15 && st->info->duration_gcd > 1 && !st->r_frame_rate.num)
|
||||
av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, st->time_base.den, st->time_base.num * st->info->duration_gcd, INT_MAX);
|
||||
if (st->info->duration_count && !st->r_frame_rate.num
|
||||
&& tb_unreliable(st->codec)) {
|
||||
int num = 0;
|
||||
double best_error= 2*av_q2d(st->time_base);
|
||||
best_error = best_error*best_error*st->info->duration_count*1000*12*30;
|
||||
|
||||
for (j=1; j<FF_ARRAY_ELEMS(st->info->duration_error); j++) {
|
||||
double error = st->info->duration_error[j] * get_std_framerate(j);
|
||||
if(error < best_error){
|
||||
best_error= error;
|
||||
num = get_std_framerate(j);
|
||||
}
|
||||
}
|
||||
// do not increase frame rate by more than 1 % in order to match a standard rate.
|
||||
if (num && (!st->r_frame_rate.num || (double)num/(12*1001) < 1.01 * av_q2d(st->r_frame_rate)))
|
||||
av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, num, 12*1001, INT_MAX);
|
||||
}
|
||||
#endif
|
||||
}else if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
if(!st->codec->bits_per_coded_sample)
|
||||
st->codec->bits_per_coded_sample= av_get_bits_per_sample(st->codec->codec_id);
|
||||
|
@ -2766,9 +2714,6 @@ AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c)
|
|||
|
||||
st->sample_aspect_ratio = (AVRational){0,1};
|
||||
|
||||
#if FF_API_R_FRAME_RATE
|
||||
st->info->last_dts = AV_NOPTS_VALUE;
|
||||
#endif
|
||||
st->info->fps_first_dts = AV_NOPTS_VALUE;
|
||||
st->info->fps_last_dts = AV_NOPTS_VALUE;
|
||||
|
||||
|
@ -2903,10 +2848,6 @@ static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_out
|
|||
if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
|
||||
if(st->avg_frame_rate.den && st->avg_frame_rate.num)
|
||||
print_fps(av_q2d(st->avg_frame_rate), "fps");
|
||||
#if FF_API_R_FRAME_RATE
|
||||
if(st->r_frame_rate.den && st->r_frame_rate.num)
|
||||
print_fps(av_q2d(st->r_frame_rate), "tbr");
|
||||
#endif
|
||||
if(st->time_base.den && st->time_base.num)
|
||||
print_fps(1/av_q2d(st->time_base), "tbn");
|
||||
if(st->codec->time_base.den && st->codec->time_base.num)
|
||||
|
|
|
@ -49,8 +49,4 @@
|
|||
* the public API and may change, break or disappear at any time.
|
||||
*/
|
||||
|
||||
#ifndef FF_API_R_FRAME_RATE
|
||||
#define FF_API_R_FRAME_RATE (LIBAVFORMAT_VERSION_MAJOR < 55)
|
||||
#endif
|
||||
|
||||
#endif /* AVFORMAT_VERSION_H */
|
||||
|
|
Loading…
Reference in New Issue