summaryrefslogtreecommitdiff
path: root/fftools/ffmpeg.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-12-11 15:37:41 +0100
committerAnton Khirnov <anton@khirnov.net>2022-07-23 11:53:19 +0200
commit4877842bb5c2481fb06b4c7e2b817c2c75120a75 (patch)
treed1a73db25119b0d06d5d99bfc48e89ddc877dcc1 /fftools/ffmpeg.c
parentcc1cc2c65e7b776433791adea932e0ea9b1cfd42 (diff)
fftools/ffmpeg: refactor the code checking for bitexact output
Figure out earlier whether the output stream/file should be bitexact and store this information in a flag in OutputFile/OutputStream. Stop accessing the muxer in set_encoder_id(), which will become forbidden in future commits.
Diffstat (limited to 'fftools/ffmpeg.c')
-rw-r--r--fftools/ffmpeg.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index a2b8fa99b9..4f7b8fcc76 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2823,37 +2823,18 @@ static int init_output_stream_streamcopy(OutputStream *ost)
static void set_encoder_id(OutputFile *of, OutputStream *ost)
{
- const AVDictionaryEntry *e;
-
uint8_t *encoder_string;
int encoder_string_len;
- int format_flags = 0;
- int codec_flags = ost->enc_ctx->flags;
if (av_dict_get(ost->st->metadata, "encoder", NULL, 0))
return;
- e = av_dict_get(of->opts, "fflags", NULL, 0);
- if (e) {
- const AVOption *o = av_opt_find(of->ctx, "fflags", NULL, 0, 0);
- if (!o)
- return;
- av_opt_eval_flags(of->ctx, o, e->value, &format_flags);
- }
- e = av_dict_get(ost->encoder_opts, "flags", NULL, 0);
- if (e) {
- const AVOption *o = av_opt_find(ost->enc_ctx, "flags", NULL, 0, 0);
- if (!o)
- return;
- av_opt_eval_flags(ost->enc_ctx, o, e->value, &codec_flags);
- }
-
encoder_string_len = sizeof(LIBAVCODEC_IDENT) + strlen(ost->enc->name) + 2;
encoder_string = av_mallocz(encoder_string_len);
if (!encoder_string)
exit_program(1);
- if (!(format_flags & AVFMT_FLAG_BITEXACT) && !(codec_flags & AV_CODEC_FLAG_BITEXACT))
+ if (!of->bitexact && !ost->bitexact)
av_strlcpy(encoder_string, LIBAVCODEC_IDENT " ", encoder_string_len);
else
av_strlcpy(encoder_string, "Lavc ", encoder_string_len);