Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Anton Khirnov <anton@khirnov.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 05/12] fftools/ffmpeg_{demux, dec}: pass -bitexact through DecoderFlags
Date: Fri, 22 Mar 2024 21:28:34 +0100
Message-ID: <20240322202841.31730-5-anton@khirnov.net> (raw)
In-Reply-To: <20240322202841.31730-1-anton@khirnov.net>

Avoids abusing AV_DICT_MULTIKEY and relying on undocumented AVDictionary
ordering behaviour.
---
 fftools/ffmpeg.h       |  2 ++
 fftools/ffmpeg_dec.c   |  2 ++
 fftools/ffmpeg_demux.c | 11 +++++------
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 7454089c2d..1437b36b0d 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -304,6 +304,8 @@ enum DecoderFlags {
     DECODER_FLAG_TOP_FIELD_FIRST  = (1 << 3),
 #endif
     DECODER_FLAG_SEND_END_TS      = (1 << 4),
+    // force bitexact decoding
+    DECODER_FLAG_BITEXACT         = (1 << 5),
 };
 
 typedef struct DecoderOpts {
diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index ad02a64b60..b8bfae469f 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -1211,6 +1211,8 @@ static int dec_open(DecoderPriv *dp, AVDictionary **dec_opts,
         return ret;
 
     dp->dec_ctx->flags |= AV_CODEC_FLAG_COPY_OPAQUE;
+    if (o->flags & DECODER_FLAG_BITEXACT)
+        dp->dec_ctx->flags |= AV_CODEC_FLAG_BITEXACT;
 
     if ((ret = avcodec_open2(dp->dec_ctx, codec, NULL)) < 0) {
         av_log(dp, AV_LOG_ERROR, "Error while opening decoder: %s\n",
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 73b0eb0da1..af4b4cfd1e 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -908,11 +908,11 @@ static int ist_use(InputStream *ist, int decoding_needed)
     if (decoding_needed && ds->sch_idx_dec < 0) {
         int is_audio = ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO;
 
-        ds->dec_opts.flags = (!!ist->fix_sub_duration * DECODER_FLAG_FIX_SUB_DURATION) |
-                             (!!(d->f.ctx->iformat->flags & AVFMT_NOTIMESTAMPS) * DECODER_FLAG_TS_UNRELIABLE) |
-                             (!!(d->loop && is_audio) * DECODER_FLAG_SEND_END_TS)
+        ds->dec_opts.flags |= (!!ist->fix_sub_duration * DECODER_FLAG_FIX_SUB_DURATION) |
+                              (!!(d->f.ctx->iformat->flags & AVFMT_NOTIMESTAMPS) * DECODER_FLAG_TS_UNRELIABLE) |
+                              (!!(d->loop && is_audio) * DECODER_FLAG_SEND_END_TS)
 #if FFMPEG_OPT_TOP
-                             | ((ist->top_field_first >= 0) * DECODER_FLAG_TOP_FIELD_FIRST)
+                              | ((ist->top_field_first >= 0) * DECODER_FLAG_TOP_FIELD_FIRST)
 #endif
                              ;
 
@@ -1357,8 +1357,7 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st)
         ist->user_set_discard = ist->st->discard;
     }
 
-    if (o->bitexact)
-        av_dict_set(&ds->decoder_opts, "flags", "+bitexact", AV_DICT_MULTIKEY);
+    ds->dec_opts.flags |= DECODER_FLAG_BITEXACT * !!o->bitexact;
 
     /* Attached pics are sparse, therefore we would not want to delay their decoding
      * till EOF. */
-- 
2.43.0

_______________________________________________
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".

  parent reply	other threads:[~2024-03-22 20:29 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-22 20:28 [FFmpeg-devel] [PATCH 01/12] tests/fate/ffmpeg: evaluate thread count in fate-run.sh rather than make Anton Khirnov
2024-03-22 20:28 ` [FFmpeg-devel] [PATCH 02/12] fftools/ffmpeg_demux: only call filter_codec_opts() when we have a decoder Anton Khirnov
2024-03-22 20:28 ` [FFmpeg-devel] [PATCH 03/12] fftools/cmdutils: do not use a random codec's private options Anton Khirnov
2024-03-22 20:28 ` [FFmpeg-devel] [PATCH 04/12] fftools/ffmpeg_dec: apply decoder options manually Anton Khirnov
2024-03-22 20:28 ` Anton Khirnov [this message]
2024-03-22 20:28 ` [FFmpeg-devel] [PATCH 06/12] fftools/ffmpeg_dec: apply cropping manually Anton Khirnov
2024-03-23  2:53   ` James Almer
2024-03-23  7:20     ` Anton Khirnov
2024-03-22 20:28 ` [FFmpeg-devel] [PATCH 07/12] fftools/ffmpeg_filter: remove display matrix if we have applied it Anton Khirnov
2024-03-22 20:28 ` [FFmpeg-devel] [PATCH 08/12] lavc/frame_thread_encoder: avoid assigning a whole AVCodecContext Anton Khirnov
2024-03-22 20:42   ` Andreas Rheinhardt
2024-03-23 14:00     ` [FFmpeg-devel] [PATCH v2 " Anton Khirnov
2024-03-23 14:11       ` Andreas Rheinhardt
2024-03-24  9:27         ` Anton Khirnov
2024-03-24 10:19           ` Andreas Rheinhardt
2024-03-24 10:33             ` Anton Khirnov
2024-03-24 11:10               ` Andreas Rheinhardt
2024-03-24 11:23                 ` Anton Khirnov
2024-03-24  0:11   ` [FFmpeg-devel] [PATCH " Michael Niedermayer
2024-03-24  9:29     ` [FFmpeg-devel] [PATCH v3 " Anton Khirnov
2024-03-24 11:25       ` Andreas Rheinhardt
2024-03-24 11:36         ` Anton Khirnov
2024-03-27 10:27   ` [FFmpeg-devel] [PATCH v4 " Anton Khirnov
2024-03-22 20:28 ` [FFmpeg-devel] [PATCH 09/12] lavc/decode: move sd_global_map to avcodec Anton Khirnov
2024-03-22 20:28 ` [FFmpeg-devel] [PATCH 10/12] lavc/encode: map AVCodecContext.decoded_side_data to coded_side_data Anton Khirnov
2024-03-23  2:33   ` James Almer
2024-03-23  7:20     ` Anton Khirnov
2024-03-22 20:28 ` [FFmpeg-devel] [PATCH 11/12] fftools/ffmpeg_enc: stop copying demuxer side data to the muxer Anton Khirnov
2024-03-22 20:28 ` [FFmpeg-devel] [PATCH 12/12] fftools/ffmpeg_demux: make InputStream.autorotate private Anton Khirnov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240322202841.31730-5-anton@khirnov.net \
    --to=anton@khirnov.net \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git