From patchwork Sat Apr 10 21:00:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 26842 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 2A1BE44B7CA for ; Sun, 11 Apr 2021 00:08:55 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DD6BD68799C; Sun, 11 Apr 2021 00:08:54 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 635F8680A2C for ; Sun, 11 Apr 2021 00:08:48 +0300 (EEST) Received: by mail-qk1-f176.google.com with SMTP id q26so9474017qkm.6 for ; Sat, 10 Apr 2021 14:08:48 -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=hiyz9gFFNvao0nracTC/1vnuC8QiM//wSjvUPDO8YPw=; b=FFEc7EXoTAMJZf5A5spelOVdsah4xopx3Z2ihTSz5Fue+qbge2uB1cbkNJjuZIJuy1 Grv1dAgmD/j5fRHO3bT9IqBBv979DuVENEQ8Z+t/zT71seGz+66bO2ofTCtcYdVrwQGJ iJYvwjXLeMYwVXXvPGk4gGSZ9qBMF/bChy37y2Nn9qgTGP3Qg9QOa60Bk7ndLtmDMKq1 aMhNcKA+Z3UMm0UDggRPaoAyN8w4P5WM6bfwCsYTEIfWsrdLSJbG2iJtRKSxcO+LD3Kb tyyPzlTwjYiXa35wPH6EWcAWP5sJNRM88S5rTw+3yccP05BZvfk7zIKj8YJBxosZ0/6y M0Nw== 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=hiyz9gFFNvao0nracTC/1vnuC8QiM//wSjvUPDO8YPw=; b=GaHdWunodlHijvuFek5HYZi0yJemrv5mOamI4bWfsiirQpA0U/UcKu0ISNgXRa1/hz WTDNWPUWbgGTfm8IBZTaD+vMx3TF0OJS1K937p1jkwp2Pq1UnNWKWq0mMJqmIEErM3df nCyyVO/13Ey6n1fgYttv26udrz4TKF7Hw8YaMYPYa2JdeN2Oo8cG6RvepAu5cpIHdDNl rRZ02gKFDWDZElpRt1lL9dvAqjzRA18zJJOKhD+tCCQ22WuQrsNIrGJDjdjc9fmMqIoj b1LXP1G3UvAPMY1AJAWuu/rzPIUET14dlYsNvRgHAAfIlkzhMhdXHs5z45Deabgpb8CZ Y/8w== X-Gm-Message-State: AOAM53255hU0Ug6oFBJ7MYdLDZFzpWZb1WbNsDnFv+/cugd48uUDqLpo VWbnAxXN6ZG7a5ilM65pwXr19l/lU2A= X-Google-Smtp-Source: ABdhPJwGkGB4gwhXmxDYc5tPmAzYJQ+c3K5yv9xS6qbqZHFzo3nqC0f86MhDuHka9AFqj9BX60f9Yw== X-Received: by 2002:a37:a390:: with SMTP id m138mr19462286qke.59.1618088440089; Sat, 10 Apr 2021 14:00:40 -0700 (PDT) Received: from localhost.localdomain ([191.83.208.158]) by smtp.gmail.com with ESMTPSA id 1sm4914759qtu.96.2021.04.10.14.00.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Apr 2021 14:00:39 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sat, 10 Apr 2021 18:00:22 -0300 Message-Id: <20210410210023.27057-3-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 3/4] pthread_frame: introduce a codec callback to update 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" From: Hendrik Leppkes --- libavcodec/codec.h | 5 +++++ libavcodec/pthread_frame.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/libavcodec/codec.h b/libavcodec/codec.h index 50a22f6e3c..de050b2815 100644 --- a/libavcodec/codec.h +++ b/libavcodec/codec.h @@ -258,6 +258,11 @@ typedef struct AVCodec { * dst and src will (rarely) point to the same context, in which case memcpy should be skipped. */ int (*update_thread_context)(struct AVCodecContext *dst, const struct AVCodecContext *src); + + /** + * Copy variables back to the user-facing context + */ + int (*update_thread_context_for_user)(struct AVCodecContext *dst, const struct AVCodecContext *src); /** @} */ /** diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index 9176027f15..ae5b000d97 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -326,6 +326,8 @@ FF_DISABLE_DEPRECATION_WARNINGS dst->coded_frame = src->coded_frame; FF_ENABLE_DEPRECATION_WARNINGS #endif + if (dst->codec->update_thread_context_for_user) + err = dst->codec->update_thread_context_for_user(dst, src); } else { if (dst->codec->update_thread_context) err = dst->codec->update_thread_context(dst, src);