mirror of https://git.ffmpeg.org/ffmpeg.git
lavf: replace FFFormatContext.prefer_codec_framerate with FF_INFMT_FLAG
There is no reason for this to be a dynamic property, as the only demuxer using this sets it unconditionally.
This commit is contained in:
parent
12e5116872
commit
31da5222a4
|
@ -2946,7 +2946,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
|
||||||
best_fps = std_fps.num;
|
best_fps = std_fps.num;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (si->prefer_codec_framerate && codec_frame_rate.num > 0 && codec_frame_rate.den > 0) {
|
if ((ffifmt(ic->iformat)->flags_internal & FF_INFMT_FLAG_PREFER_CODEC_FRAMERATE) &&
|
||||||
|
codec_frame_rate.num > 0 && codec_frame_rate.den > 0) {
|
||||||
error = fabs(av_q2d(codec_frame_rate) /
|
error = fabs(av_q2d(codec_frame_rate) /
|
||||||
av_q2d(std_fps) - 1);
|
av_q2d(std_fps) - 1);
|
||||||
if (error < best_error) {
|
if (error < best_error) {
|
||||||
|
|
|
@ -34,6 +34,11 @@ struct AVDeviceInfoList;
|
||||||
*/
|
*/
|
||||||
#define FF_INFMT_FLAG_INIT_CLEANUP (1 << 0)
|
#define FF_INFMT_FLAG_INIT_CLEANUP (1 << 0)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Prefer the codec framerate for avg_frame_rate computation.
|
||||||
|
*/
|
||||||
|
#define FF_INFMT_FLAG_PREFER_CODEC_FRAMERATE (1 << 1)
|
||||||
|
|
||||||
typedef struct FFInputFormat {
|
typedef struct FFInputFormat {
|
||||||
/**
|
/**
|
||||||
* The public AVInputFormat. See avformat.h for it.
|
* The public AVInputFormat. See avformat.h for it.
|
||||||
|
|
|
@ -120,11 +120,6 @@ typedef struct FFFormatContext {
|
||||||
* ID3v2 tag useful for MP3 demuxing
|
* ID3v2 tag useful for MP3 demuxing
|
||||||
*/
|
*/
|
||||||
AVDictionary *id3v2_meta;
|
AVDictionary *id3v2_meta;
|
||||||
|
|
||||||
/*
|
|
||||||
* Prefer the codec framerate for avg_frame_rate computation.
|
|
||||||
*/
|
|
||||||
int prefer_codec_framerate;
|
|
||||||
} FFFormatContext;
|
} FFFormatContext;
|
||||||
|
|
||||||
static av_always_inline FFFormatContext *ffformatcontext(AVFormatContext *s)
|
static av_always_inline FFFormatContext *ffformatcontext(AVFormatContext *s)
|
||||||
|
|
|
@ -3113,8 +3113,6 @@ static int mpegts_read_header(AVFormatContext *s)
|
||||||
int64_t pos, probesize = s->probesize;
|
int64_t pos, probesize = s->probesize;
|
||||||
int64_t seekback = FFMAX(s->probesize, (int64_t)ts->resync_size + PROBE_PACKET_MAX_BUF);
|
int64_t seekback = FFMAX(s->probesize, (int64_t)ts->resync_size + PROBE_PACKET_MAX_BUF);
|
||||||
|
|
||||||
ffformatcontext(s)->prefer_codec_framerate = 1;
|
|
||||||
|
|
||||||
if (ffio_ensure_seekback(pb, seekback) < 0)
|
if (ffio_ensure_seekback(pb, seekback) < 0)
|
||||||
av_log(s, AV_LOG_WARNING, "Failed to allocate buffers for seekback\n");
|
av_log(s, AV_LOG_WARNING, "Failed to allocate buffers for seekback\n");
|
||||||
|
|
||||||
|
@ -3446,6 +3444,7 @@ const FFInputFormat ff_mpegts_demuxer = {
|
||||||
.read_packet = mpegts_read_packet,
|
.read_packet = mpegts_read_packet,
|
||||||
.read_close = mpegts_read_close,
|
.read_close = mpegts_read_close,
|
||||||
.read_timestamp = mpegts_get_dts,
|
.read_timestamp = mpegts_get_dts,
|
||||||
|
.flags_internal = FF_INFMT_FLAG_PREFER_CODEC_FRAMERATE,
|
||||||
};
|
};
|
||||||
|
|
||||||
const FFInputFormat ff_mpegtsraw_demuxer = {
|
const FFInputFormat ff_mpegtsraw_demuxer = {
|
||||||
|
@ -3458,4 +3457,5 @@ const FFInputFormat ff_mpegtsraw_demuxer = {
|
||||||
.read_packet = mpegts_raw_read_packet,
|
.read_packet = mpegts_raw_read_packet,
|
||||||
.read_close = mpegts_read_close,
|
.read_close = mpegts_read_close,
|
||||||
.read_timestamp = mpegts_get_dts,
|
.read_timestamp = mpegts_get_dts,
|
||||||
|
.flags_internal = FF_INFMT_FLAG_PREFER_CODEC_FRAMERATE,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue