From patchwork Sat Apr 10 21:00:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 26839 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 49EB944A1EF for ; Sun, 11 Apr 2021 00:00:49 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2A888687F4E; Sun, 11 Apr 2021 00:00:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7CB2E68799C for ; Sun, 11 Apr 2021 00:00:42 +0300 (EEST) Received: by mail-qv1-f46.google.com with SMTP id es6so4472258qvb.0 for ; Sat, 10 Apr 2021 14:00:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=MiPk7sbHkvB8S2464LOZV9136vSoKu088TJKW9F70/c=; b=Q+ut5z4c043alL9xzu4dZqG12lljUuwJPpQek/v2RcT96TmCC/AlPGQOQKTY2+eKPz Ae6zYpJ0N0YAVnlUUBM/rdiZ39OCmRH8/gdBHUIxDOjNZgBlfuInTdIC+D4roKji+9PN xMRtEInjs1SeXNfPCBbbtMO87qg8r56Up9MVCoNr6o4vpiHf2YhymN8/ElLZ7qIBFOK/ r0ie4Z+Kqn9RaABVoPdAGtf0Cg6SV70egGoWO5vBg939nmvhSwNVg7/pu+G1A47TIJf3 RKHpDgdr/hb7WblX/7sPp8e2KOy1X/9k++cyE853ViriVNmSmfD/00wIgqzSERUnowFZ sFdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MiPk7sbHkvB8S2464LOZV9136vSoKu088TJKW9F70/c=; b=fhGx7LtggWA0ws6j03y8PVzvJb3/DfAK+5sVN5jOttlT3FyQpG2hFtfebixtYlg1U4 Q3cTMRlSsVAybNjgxZ7xuvxTLWXBWdn0gaOJcpFsR5gSoOfqeEKlx/nKhnn9xjNYJD2A ZA0Dqz9/0k/m5YKQ2EdxVRsp1TBNfFfjfVOoHLgq3+aYzmFp/C0UUGvtAT6nBUq+AZ4I GQVXqmBnEM5u0mEqpiSsPePxIMG7Yl1sBXrPFUEGlFhh4Am7J5A5evrlgXnyrYgjdWRW eJRmxjO868xH6ya2jBr/wydCf7Fk1RYe+fGGuUx2DXU2o8I1QmGuPG8f7Xs64XlENnZ3 wDrg== X-Gm-Message-State: AOAM530rjKedCR70Is5jJ/RJ9+9st9XG95AYp2cEixIr1B4iE56dfCVM ZyaHcW6t52VpucvpfpE+6W9/OiuD85o= X-Google-Smtp-Source: ABdhPJzzsrI8JzK5Efm3uoM6yGKzMtSmM52L1G72dxWdeW0xuARlqP3no2oEmTTaF0nwxYkI9eWbBw== X-Received: by 2002:a0c:fc46:: with SMTP id w6mr3038054qvp.0.1618088441237; Sat, 10 Apr 2021 14:00:41 -0700 (PDT) Received: from localhost.localdomain ([191.83.208.158]) by smtp.gmail.com with ESMTPSA id 1sm4914759qtu.96.2021.04.10.14.00.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Apr 2021 14:00:40 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sat, 10 Apr 2021 18:00:23 -0300 Message-Id: <20210410210023.27057-4-jamrial@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210410210023.27057-1-jamrial@gmail.com> References: <20210410210023.27057-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/4] avcodec/h264dec: update exported AVOptions in the user-facing context X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Based on a patch by Hendrik Leppkes. Fixes ticket #9176. Signed-off-by: James Almer --- libavcodec/h264_slice.c | 14 ++++++++++++++ libavcodec/h264dec.c | 1 + libavcodec/h264dec.h | 2 ++ 3 files changed, 17 insertions(+) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 62f7a61aed..a6389a80f3 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -464,6 +464,20 @@ int ff_h264_update_thread_context(AVCodecContext *dst, return err; } +int ff_h264_update_thread_context_for_user(AVCodecContext *dst, + const AVCodecContext *src) +{ + H264Context *h = dst->priv_data, *h1 = src->priv_data; + + if (dst == src) + return 0; + + h->is_avc = h1->is_avc; + h->nal_length_size = h1->nal_length_size; + + return 0; +} + static int h264_frame_start(H264Context *h) { H264Picture *pic; diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index f44c8c8175..885c18667d 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -1083,6 +1083,7 @@ AVCodec ff_h264_decoder = { FF_CODEC_CAP_ALLOCATE_PROGRESS | FF_CODEC_CAP_INIT_CLEANUP, .flush = h264_decode_flush, .update_thread_context = ONLY_IF_THREADS_ENABLED(ff_h264_update_thread_context), + .update_thread_context_for_user = ONLY_IF_THREADS_ENABLED(ff_h264_update_thread_context_for_user), .profiles = NULL_IF_CONFIG_SMALL(ff_h264_profiles), .priv_class = &h264_class, }; diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h index b3677cdbb9..8954b74795 100644 --- a/libavcodec/h264dec.h +++ b/libavcodec/h264dec.h @@ -849,6 +849,8 @@ int ff_h264_queue_decode_slice(H264Context *h, const H2645NAL *nal); int ff_h264_execute_decode_slices(H264Context *h); int ff_h264_update_thread_context(AVCodecContext *dst, const AVCodecContext *src); +int ff_h264_update_thread_context_for_user(AVCodecContext *dst, + const AVCodecContext *src); void ff_h264_flush_change(H264Context *h);