From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 25BD04898D for ; Fri, 22 Mar 2024 20:29:22 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 068BF68D583; Fri, 22 Mar 2024 22:29:04 +0200 (EET) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4A55D68D42B for ; Fri, 22 Mar 2024 22:28:56 +0200 (EET) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=Rx14rwEA; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 437C24D64 for ; Fri, 22 Mar 2024 21:28:55 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id V3nSGwq1OFyD for ; Fri, 22 Mar 2024 21:28:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1711139334; bh=spOVD7KsJnwQV4SNRguNakUXeB2ycZujH8hf5lEP7EI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Rx14rwEAhwnH5imlGzR06QLJDOMtiV1TLji2cfpGyskGps9HVhm9gALe1ZVIkG4km YGCoryv/Z4+nBLSq14FoWClZMCZsvybRrT08kvlQKScHNpV56l4aGBstpSM0dEKr9O Nyji8O4uZLZyuaaZj+UqgFz41H9rg/GUebDW1Sy8AAHCsLCYBiQrCxJJTlaec8bzI0 WubL27cuR537rmw8iuipGIYd+hd8FEiYjOfZe19odnCYb0JFu03/MD6cmFDHLJWuqc HYDA8MSozJX2h3SrG7eEGu4En0mQoEKr31V268wWHLn+7WCPPpyDaKi61NQLbQxLJr RTVq0LNcl2hpQ== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id 36B214D42 for ; Fri, 22 Mar 2024 21:28:54 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 576CC3A0B9C for ; Fri, 22 Mar 2024 21:28:45 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 22 Mar 2024 21:28:34 +0100 Message-ID: <20240322202841.31730-5-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240322202841.31730-1-anton@khirnov.net> References: <20240322202841.31730-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 05/12] fftools/ffmpeg_{demux, dec}: pass -bitexact through DecoderFlags X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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".