* [FFmpeg-devel] [PATCH 2/3] avformat/avformat: Remove obsolete comment
2024-02-03 11:25 [FFmpeg-devel] [PATCH 1/3] avformat/avformat: Remove dead check, write-only assignment Andreas Rheinhardt
@ 2024-02-03 11:29 ` Andreas Rheinhardt
2024-02-03 11:29 ` [FFmpeg-devel] [PATCH 3/3] avformat/options: Only allocate AVCodecContext for demuxers Andreas Rheinhardt
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2024-02-03 11:29 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Forgotten in 3f991325b5ef472cf51b7d8433a2380bef2c94ff,
obsolete since 3749eede66c3774799766b1f246afae8a6ffc9bb.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/avformat.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index 1a99598d6f..41b1c4e7d9 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -821,7 +821,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
AVRational av_stream_get_codec_timebase(const AVStream *st)
{
- // See avformat_transfer_internal_stream_timing_info() TODO.
return cffstream(st)->avctx->time_base;
}
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* [FFmpeg-devel] [PATCH 3/3] avformat/options: Only allocate AVCodecContext for demuxers
2024-02-03 11:25 [FFmpeg-devel] [PATCH 1/3] avformat/avformat: Remove dead check, write-only assignment Andreas Rheinhardt
2024-02-03 11:29 ` [FFmpeg-devel] [PATCH 2/3] avformat/avformat: Remove obsolete comment Andreas Rheinhardt
@ 2024-02-03 11:29 ` Andreas Rheinhardt
2024-02-03 19:33 ` [FFmpeg-devel] [PATCH 4/5] avformat/avformat: Avoid av_strdup(NULL) Andreas Rheinhardt
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2024-02-03 11:29 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
The muxer's AVCodecContext is currently used for exactly one thing:
To store a time base in it that has been derived via heuristics
in avformat_transfer_internal_stream_timing_info(); said time base
can then be read back via av_stream_get_codec_timebase().
But one does not need a whole AVCodecContext for that, a simple
AVRational is enough.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
If it were not for lavd, I would add a ff_demux_add_stream()
to be used internally for demuxers instead of avformat_new_stream().
libavformat/avformat.c | 59 +++++++++++++++++++++++-------------------
libavformat/dump.c | 14 +++++-----
libavformat/internal.h | 2 ++
libavformat/options.c | 8 +++---
4 files changed, 47 insertions(+), 36 deletions(-)
diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index 41b1c4e7d9..9cacaef87d 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -729,8 +729,6 @@ AVRational av_guess_frame_rate(AVFormatContext *format, AVStream *st, AVFrame *f
{
AVRational fr = st->r_frame_rate;
const AVCodecDescriptor *desc = cffstream(st)->codec_desc;
- AVCodecContext *const avctx = ffstream(st)->avctx;
- AVRational codec_fr = avctx->framerate;
AVRational avg_fr = st->avg_frame_rate;
if (avg_fr.num > 0 && avg_fr.den > 0 && fr.num > 0 && fr.den > 0 &&
@@ -739,6 +737,9 @@ AVRational av_guess_frame_rate(AVFormatContext *format, AVStream *st, AVFrame *f
}
if (desc && (desc->props & AV_CODEC_PROP_FIELDS)) {
+ const AVCodecContext *const avctx = ffstream(st)->avctx;
+ AVRational codec_fr = avctx->framerate;
+
if ( codec_fr.num > 0 && codec_fr.den > 0 &&
(fr.num == 0 || av_q2d(codec_fr) < av_q2d(fr)*0.7 && fabs(1.0 - av_q2d(av_div_q(avg_fr, fr))) > 0.1))
fr = codec_fr;
@@ -753,13 +754,19 @@ int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt,
{
const AVCodecDescriptor *desc = cffstream(ist)->codec_desc;
const AVCodecContext *const dec_ctx = cffstream(ist)->avctx;
- AVCodecContext *const enc_ctx = ffstream(ost)->avctx;
AVRational mul = (AVRational){ desc && (desc->props & AV_CODEC_PROP_FIELDS) ? 2 : 1, 1 };
- AVRational dec_ctx_tb = dec_ctx->framerate.num ? av_inv_q(av_mul_q(dec_ctx->framerate, mul))
+ AVRational dec_ctx_framerate = dec_ctx ? dec_ctx->framerate : (AVRational){ 0, 0 };
+ AVRational dec_ctx_tb = dec_ctx_framerate.num ? av_inv_q(av_mul_q(dec_ctx_framerate, mul))
: (ist->codecpar->codec_type == AVMEDIA_TYPE_AUDIO ? (AVRational){0, 1}
: ist->time_base);
- enc_ctx->time_base = ist->time_base;
+ AVRational enc_tb = ist->time_base;
+#if FF_API_TICKS_PER_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+ int ticks_per_frame = dec_ctx ? dec_ctx->ticks_per_frame : 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
/*
* Avi is a special case here because it supports variable fps but
* having the fps and timebase differe significantly adds quite some
@@ -773,35 +780,31 @@ int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt,
&& 0.5/av_q2d(ist->r_frame_rate) > av_q2d(dec_ctx_tb)
&& av_q2d(ist->time_base) < 1.0/500 && av_q2d(dec_ctx_tb) < 1.0/500
|| copy_tb == AVFMT_TBCF_R_FRAMERATE) {
- enc_ctx->time_base.num = ist->r_frame_rate.den;
- enc_ctx->time_base.den = 2*ist->r_frame_rate.num;
+ enc_tb.num = ist->r_frame_rate.den;
+ enc_tb.den = 2*ist->r_frame_rate.num;
} else
#endif
- if (copy_tb == AVFMT_TBCF_AUTO && dec_ctx->framerate.num &&
- av_q2d(av_inv_q(dec_ctx->framerate)) > 2*av_q2d(ist->time_base)
+ if (copy_tb == AVFMT_TBCF_AUTO && dec_ctx_framerate.num &&
+ av_q2d(av_inv_q(dec_ctx_framerate)) > 2*av_q2d(ist->time_base)
&& av_q2d(ist->time_base) < 1.0/500
|| (copy_tb == AVFMT_TBCF_DECODER &&
- (dec_ctx->framerate.num || ist->codecpar->codec_type == AVMEDIA_TYPE_AUDIO))) {
- enc_ctx->time_base = dec_ctx_tb;
- enc_ctx->time_base.den *= 2;
+ (dec_ctx_framerate.num || ist->codecpar->codec_type == AVMEDIA_TYPE_AUDIO))) {
+ enc_tb = dec_ctx_tb;
+ enc_tb.den *= 2;
#if FF_API_TICKS_PER_FRAME
-FF_DISABLE_DEPRECATION_WARNINGS
- enc_ctx->time_base.num *= dec_ctx->ticks_per_frame;
-FF_ENABLE_DEPRECATION_WARNINGS
+ enc_tb.num *= ticks_per_frame;
#endif
}
} else if (!(ofmt->flags & AVFMT_VARIABLE_FPS)
&& !av_match_name(ofmt->name, "mov,mp4,3gp,3g2,psp,ipod,ismv,f4v")) {
- if (copy_tb == AVFMT_TBCF_AUTO && dec_ctx->framerate.num
- && av_q2d(av_inv_q(dec_ctx->framerate)) > av_q2d(ist->time_base)
+ if (copy_tb == AVFMT_TBCF_AUTO && dec_ctx_framerate.num
+ && av_q2d(av_inv_q(dec_ctx_framerate)) > av_q2d(ist->time_base)
&& av_q2d(ist->time_base) < 1.0/500
|| (copy_tb == AVFMT_TBCF_DECODER &&
- (dec_ctx->framerate.num || ist->codecpar->codec_type == AVMEDIA_TYPE_AUDIO))) {
- enc_ctx->time_base = dec_ctx_tb;
+ (dec_ctx_framerate.num || ist->codecpar->codec_type == AVMEDIA_TYPE_AUDIO))) {
+ enc_tb = dec_ctx_tb;
#if FF_API_TICKS_PER_FRAME
-FF_DISABLE_DEPRECATION_WARNINGS
- enc_ctx->time_base.num *= dec_ctx->ticks_per_frame;
-FF_ENABLE_DEPRECATION_WARNINGS
+ enc_tb.num *= ticks_per_frame;
#endif
}
}
@@ -810,18 +813,19 @@ FF_ENABLE_DEPRECATION_WARNINGS
&& dec_ctx_tb.num < dec_ctx_tb.den
&& dec_ctx_tb.num > 0
&& 121LL*dec_ctx_tb.num > dec_ctx_tb.den) {
- enc_ctx->time_base = dec_ctx_tb;
+ enc_tb = dec_ctx_tb;
}
- av_reduce(&enc_ctx->time_base.num, &enc_ctx->time_base.den,
- enc_ctx->time_base.num, enc_ctx->time_base.den, INT_MAX);
+ av_reduce(&ffstream(ost)->transferred_mux_tb.num,
+ &ffstream(ost)->transferred_mux_tb.den,
+ enc_tb.num, enc_tb.den, INT_MAX);
return 0;
}
AVRational av_stream_get_codec_timebase(const AVStream *st)
{
- return cffstream(st)->avctx->time_base;
+ return cffstream(st)->avctx ? cffstream(st)->avctx->time_base : cffstream(st)->transferred_mux_tb;
}
void avpriv_set_pts_info(AVStream *st, int pts_wrap_bits,
@@ -846,7 +850,8 @@ void avpriv_set_pts_info(AVStream *st, int pts_wrap_bits,
return;
}
st->time_base = new_tb;
- sti->avctx->pkt_timebase = new_tb;
+ if (sti->avctx)
+ sti->avctx->pkt_timebase = new_tb;
st->pts_wrap_bits = pts_wrap_bits;
}
diff --git a/libavformat/dump.c b/libavformat/dump.c
index aff51b43f6..01e2306479 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -550,12 +550,14 @@ static void dump_stream_format(const AVFormatContext *ic, int i,
}
// Fields which are missing from AVCodecParameters need to be taken from the AVCodecContext
- avctx->properties = sti->avctx->properties;
- avctx->codec = sti->avctx->codec;
- avctx->qmin = sti->avctx->qmin;
- avctx->qmax = sti->avctx->qmax;
- avctx->coded_width = sti->avctx->coded_width;
- avctx->coded_height = sti->avctx->coded_height;
+ if (sti->avctx) {
+ avctx->properties = sti->avctx->properties;
+ avctx->codec = sti->avctx->codec;
+ avctx->qmin = sti->avctx->qmin;
+ avctx->qmax = sti->avctx->qmax;
+ avctx->coded_width = sti->avctx->coded_width;
+ avctx->coded_height = sti->avctx->coded_height;
+ }
if (separator)
av_opt_set(avctx, "dump_separator", separator, 0);
diff --git a/libavformat/internal.h b/libavformat/internal.h
index f93832b3c4..520f1a5229 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -416,6 +416,8 @@ typedef struct FFStream {
int64_t cur_dts;
const struct AVCodecDescriptor *codec_desc;
+
+ AVRational transferred_mux_tb;
} FFStream;
static av_always_inline FFStream *ffstream(AVStream *st)
diff --git a/libavformat/options.c b/libavformat/options.c
index 75ec86ce05..03e6a2a7ff 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -283,11 +283,12 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
goto fail;
sti->fmtctx = s;
- sti->avctx = avcodec_alloc_context3(NULL);
- if (!sti->avctx)
- goto fail;
if (s->iformat) {
+ sti->avctx = avcodec_alloc_context3(NULL);
+ if (!sti->avctx)
+ goto fail;
+
sti->info = av_mallocz(sizeof(*sti->info));
if (!sti->info)
goto fail;
@@ -323,6 +324,7 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
sti->pts_buffer[i] = AV_NOPTS_VALUE;
st->sample_aspect_ratio = (AVRational) { 0, 1 };
+ sti->transferred_mux_tb = (AVRational) { 0, 1 };;
#if FF_API_AVSTREAM_SIDE_DATA
sti->inject_global_side_data = si->inject_global_side_data;
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* [FFmpeg-devel] [PATCH 4/5] avformat/avformat: Avoid av_strdup(NULL)
2024-02-03 11:25 [FFmpeg-devel] [PATCH 1/3] avformat/avformat: Remove dead check, write-only assignment Andreas Rheinhardt
2024-02-03 11:29 ` [FFmpeg-devel] [PATCH 2/3] avformat/avformat: Remove obsolete comment Andreas Rheinhardt
2024-02-03 11:29 ` [FFmpeg-devel] [PATCH 3/3] avformat/options: Only allocate AVCodecContext for demuxers Andreas Rheinhardt
@ 2024-02-03 19:33 ` Andreas Rheinhardt
2024-02-03 19:33 ` [FFmpeg-devel] [PATCH 5/5] avformat/mux: Don't allocate priv_pts separately Andreas Rheinhardt
2024-02-06 8:57 ` [FFmpeg-devel] [PATCH 1/3] avformat/avformat: Remove dead check, write-only assignment Andreas Rheinhardt
4 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2024-02-03 19:33 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
It is not documented to be safe.
Also copy these lists in a more generic manner.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/avformat.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index 9cacaef87d..ae79ee6ef7 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -875,20 +875,28 @@ const AVCodec *ff_find_decoder(AVFormatContext *s, const AVStream *st,
int ff_copy_whiteblacklists(AVFormatContext *dst, const AVFormatContext *src)
{
+#define OFF(field) offsetof(AVFormatContext, field)
+ static const unsigned offsets[] = {
+ OFF(codec_whitelist), OFF(format_whitelist),
+ OFF(protocol_whitelist), OFF(protocol_blacklist),
+ };
+#undef OFF
av_assert0(!dst->codec_whitelist &&
!dst->format_whitelist &&
!dst->protocol_whitelist &&
!dst->protocol_blacklist);
- dst-> codec_whitelist = av_strdup(src->codec_whitelist);
- dst->format_whitelist = av_strdup(src->format_whitelist);
- dst->protocol_whitelist = av_strdup(src->protocol_whitelist);
- dst->protocol_blacklist = av_strdup(src->protocol_blacklist);
- if ( (src-> codec_whitelist && !dst-> codec_whitelist)
- || (src-> format_whitelist && !dst-> format_whitelist)
- || (src->protocol_whitelist && !dst->protocol_whitelist)
- || (src->protocol_blacklist && !dst->protocol_blacklist)) {
- av_log(dst, AV_LOG_ERROR, "Failed to duplicate black/whitelist\n");
- return AVERROR(ENOMEM);
+ for (unsigned i = 0; i < FF_ARRAY_ELEMS(offsets); i++) {
+ const char *src_str = *(char *const*)((const char*)src + offsets[i]);
+
+ if (src_str) {
+ char *dst_str = av_strdup(src_str);
+ if (!dst_str) {
+ av_log(dst, AV_LOG_ERROR, "Failed to duplicate black/whitelist\n");
+ return AVERROR(ENOMEM);
+ }
+
+ *(char **)((char*)dst + offsets[i]) = dst_str;
+ }
}
return 0;
}
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* [FFmpeg-devel] [PATCH 5/5] avformat/mux: Don't allocate priv_pts separately
2024-02-03 11:25 [FFmpeg-devel] [PATCH 1/3] avformat/avformat: Remove dead check, write-only assignment Andreas Rheinhardt
` (2 preceding siblings ...)
2024-02-03 19:33 ` [FFmpeg-devel] [PATCH 4/5] avformat/avformat: Avoid av_strdup(NULL) Andreas Rheinhardt
@ 2024-02-03 19:33 ` Andreas Rheinhardt
2024-02-06 8:57 ` [FFmpeg-devel] [PATCH 1/3] avformat/avformat: Remove dead check, write-only assignment Andreas Rheinhardt
4 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2024-02-03 19:33 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/avformat.c | 1 -
libavformat/internal.h | 2 +-
libavformat/mux.c | 17 ++++++-----------
libavformat/mux_utils.c | 5 +----
4 files changed, 8 insertions(+), 17 deletions(-)
diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index ae79ee6ef7..ca31d3dc56 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -63,7 +63,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
av_parser_close(sti->parser);
avcodec_free_context(&sti->avctx);
av_bsf_free(&sti->bsfc);
- av_freep(&sti->priv_pts);
av_freep(&sti->index_entries);
av_freep(&sti->probe_data.buf);
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 520f1a5229..c66f959e9f 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -245,7 +245,7 @@ typedef struct FFStream {
int is_intra_only;
- FFFrac *priv_pts;
+ FFFrac priv_pts;
/**
* Stream information used internally by avformat_find_stream_info()
diff --git a/libavformat/mux.c b/libavformat/mux.c
index de10d2c008..93280f9047 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -406,16 +406,11 @@ static int init_pts(AVFormatContext *s)
break;
}
- if (!sti->priv_pts)
- sti->priv_pts = av_mallocz(sizeof(*sti->priv_pts));
- if (!sti->priv_pts)
- return AVERROR(ENOMEM);
-
if (den != AV_NOPTS_VALUE) {
if (den <= 0)
return AVERROR_INVALIDDATA;
- frac_init(sti->priv_pts, 0, 0, den);
+ frac_init(&sti->priv_pts, 0, 0, den);
}
}
@@ -550,7 +545,7 @@ static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket *
}
pkt->dts =
// pkt->pts= st->cur_dts;
- pkt->pts = sti->priv_pts->val;
+ pkt->pts = sti->priv_pts.val;
}
//calculate dts from pts
@@ -587,7 +582,7 @@ static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket *
av_ts2str(pkt->pts), av_ts2str(pkt->dts));
sti->cur_dts = pkt->dts;
- sti->priv_pts->val = pkt->dts;
+ sti->priv_pts.val = pkt->dts;
/* update pts */
switch (st->codecpar->codec_type) {
@@ -599,12 +594,12 @@ static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket *
/* HACK/FIXME, we skip the initial 0 size packets as they are most
* likely equal to the encoder delay, but it would be better if we
* had the real timestamps from the encoder */
- if (frame_size >= 0 && (pkt->size || sti->priv_pts->num != sti->priv_pts->den >> 1 || sti->priv_pts->val)) {
- frac_add(sti->priv_pts, (int64_t)st->time_base.den * frame_size);
+ if (frame_size >= 0 && (pkt->size || sti->priv_pts.num != sti->priv_pts.den >> 1 || sti->priv_pts.val)) {
+ frac_add(&sti->priv_pts, (int64_t)st->time_base.den * frame_size);
}
break;
case AVMEDIA_TYPE_VIDEO:
- frac_add(sti->priv_pts, (int64_t)st->time_base.den * st->time_base.num);
+ frac_add(&sti->priv_pts, (int64_t)st->time_base.den * st->time_base.num);
break;
}
return 0;
diff --git a/libavformat/mux_utils.c b/libavformat/mux_utils.c
index 3e63b8039a..c7ac2a9c97 100644
--- a/libavformat/mux_utils.c
+++ b/libavformat/mux_utils.c
@@ -33,10 +33,7 @@
#if FF_API_GET_END_PTS
int64_t av_stream_get_end_pts(const AVStream *st)
{
- if (cffstream(st)->priv_pts) {
- return cffstream(st)->priv_pts->val;
- } else
- return AV_NOPTS_VALUE;
+ return cffstream(st)->priv_pts.val;
}
#endif
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/3] avformat/avformat: Remove dead check, write-only assignment
2024-02-03 11:25 [FFmpeg-devel] [PATCH 1/3] avformat/avformat: Remove dead check, write-only assignment Andreas Rheinhardt
` (3 preceding siblings ...)
2024-02-03 19:33 ` [FFmpeg-devel] [PATCH 5/5] avformat/mux: Don't allocate priv_pts separately Andreas Rheinhardt
@ 2024-02-06 8:57 ` Andreas Rheinhardt
4 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2024-02-06 8:57 UTC (permalink / raw)
To: ffmpeg-devel
Andreas Rheinhardt:
> For muxers, the internal AVCodecContext is basically unused
> except in avformat_transfer_internal_stream_timing_info()
> (which sets time_base and ticks_per_frame) and
> av_stream_get_codec_timebase() (a getter for time_base).
> This makes ticks_per_frame write-only, so don't set it.
>
> Also remove an always-false check for the AVCodecContext's
> codec_tag.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> libavformat/avformat.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/libavformat/avformat.c b/libavformat/avformat.c
> index 8e8c6fbe55..1a99598d6f 100644
> --- a/libavformat/avformat.c
> +++ b/libavformat/avformat.c
> @@ -775,11 +775,6 @@ int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt,
> || copy_tb == AVFMT_TBCF_R_FRAMERATE) {
> enc_ctx->time_base.num = ist->r_frame_rate.den;
> enc_ctx->time_base.den = 2*ist->r_frame_rate.num;
> -#if FF_API_TICKS_PER_FRAME
> -FF_DISABLE_DEPRECATION_WARNINGS
> - enc_ctx->ticks_per_frame = 2;
> -FF_ENABLE_DEPRECATION_WARNINGS
> -#endif
> } else
> #endif
> if (copy_tb == AVFMT_TBCF_AUTO && dec_ctx->framerate.num &&
> @@ -792,7 +787,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
> #if FF_API_TICKS_PER_FRAME
> FF_DISABLE_DEPRECATION_WARNINGS
> enc_ctx->time_base.num *= dec_ctx->ticks_per_frame;
> - enc_ctx->ticks_per_frame = 2;
> FF_ENABLE_DEPRECATION_WARNINGS
> #endif
> }
> @@ -812,7 +806,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
> }
> }
>
> - if ((enc_ctx->codec_tag == AV_RL32("tmcd") || ost->codecpar->codec_tag == AV_RL32("tmcd"))
> + if (ost->codecpar->codec_tag == AV_RL32("tmcd")
> && dec_ctx_tb.num < dec_ctx_tb.den
> && dec_ctx_tb.num > 0
> && 121LL*dec_ctx_tb.num > dec_ctx_tb.den) {
Will apply this patchset tomorrow unless there are objections.
- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 6+ messages in thread