From patchwork Fri Apr 30 11:34:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brad Hards X-Patchwork-Id: 27542 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a11:4023:0:0:0:0 with SMTP id ky35csp332974pxb; Fri, 30 Apr 2021 04:35:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfL5ZWZk7WK/yd83ekYratIN/HW0j7gjrEyYIoounohF2bQNOQv5+ZKRWUrYKkzeb6Dd24 X-Received: by 2002:a17:906:5d0c:: with SMTP id g12mr3854152ejt.389.1619782511821; Fri, 30 Apr 2021 04:35:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619782511; cv=none; d=google.com; s=arc-20160816; b=UBUrZePcVM1QGICHx6uQ0R0W8gqqgZHY/6Btiov2eo9Ou8hD+g5wUNClUDLGjiOuaN vLKOqZk5ffEDuVIk2reZ771qlo/OYv8dFW/TnIlfo/yL23/cRq+ncL32T2eEEf95BJDg nqrAyDs9Fjlggynd3edcP2BQM9505mwYEfClet1j4CtP7PRX9K1L1mOcsE1Y6S0YyweZ gafLPC32tyxrWckCzM+2B5fE0ZQ3G5jwOKipjxWxaC3IWpH5gmiEtvhauEjqEn7pOw2p cBwhSPJXYLYYlR2KJYULUaD0Py8MHqxH+SQv9LthTZ0spTgzZeIl4rM16oeDJg3q2xod 1o/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to; bh=pidMeAHG1hveFUyPLE+H/qja+lgIeSvqDrW5EODkZZE=; b=BDFzfBwRWw0aHZgLD2AUZPTZM9fbZrteGxumbOhq0ovQoo/RxtF6SWd33FQbyc+usW OXh1b5RoDGYb0CCdshlLymSUoxkiOP40QnRzEicB5+/4Seil4vy1MNhpnTitlf/wjNoL n2BO1SB8avEIdjZUjwXAF/mT0eqdiPYxvlgtje9LBEDbor5iHF6RI9WCoq2+1+BIyRtm 9XEpxbm/vt00MY/QXz085k0wQ+lOU46yKNaA0u8rmEZqIMoPKW8dcrY6ZQltu1DZ1vlO spKTKzpfyLgrhfJj7kspdh7DrbGcV2P3PznOF9DBVJKMkYBvQiGDsZO8tS9Em85o2es1 VNLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b14si319552edy.31.2021.04.30.04.35.11; Fri, 30 Apr 2021 04:35:11 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 213726899AB; Fri, 30 Apr 2021 14:34:55 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from cp1.nerdvana.net.au (cp1-new.nerdvana.net.au [113.212.99.70]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A68E968830E for ; Fri, 30 Apr 2021 14:34:46 +0300 (EEST) Received: from ppp115-205.static.internode.on.net ([150.101.115.205]:41184 helo=audax.fritz.box) by cp1.nerdvana.net.au with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lcRPu-0000qy-Nr; Fri, 30 Apr 2021 21:34:42 +1000 From: Brad Hards To: ffmpeg-devel@ffmpeg.org Date: Fri, 30 Apr 2021 21:34:29 +1000 Message-Id: <20210430113432.308139-3-bradh@frogmouth.net> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210430113432.308139-1-bradh@frogmouth.net> References: <20210430113432.308139-1-bradh@frogmouth.net> MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cp1.nerdvana.net.au X-AntiAbuse: Original Domain - ffmpeg.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - frogmouth.net X-Get-Message-Sender-Via: cp1.nerdvana.net.au: authenticated_id: bradh@frogmouth.net X-Authenticated-Sender: cp1.nerdvana.net.au: bradh@frogmouth.net X-Source: X-Source-Args: X-Source-Dir: Subject: [FFmpeg-devel] [PATCH 2/5] libavcodec: write out user data unregistered SEI for x264 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 Cc: Brad Hards Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: hue5FPAV4KsM Signed-off-by: Brad Hards --- libavcodec/libx264.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 22c91d8df7..6d4cee55c0 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -31,6 +31,7 @@ #include "internal.h" #include "packet_internal.h" #include "atsc_a53.h" +#include "sei.h" #if defined(_MSC_VER) #define X264_API_IMPORTS 1 @@ -303,6 +304,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, int64_t wallclock = 0; X264Opaque *out_opaque; AVFrameSideData *sd; + int num_unregistered_sei; x264_picture_init( &x4->pic ); x4->pic.img.i_csp = x4->params.i_csp; @@ -438,6 +440,19 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, } } } + num_unregistered_sei = av_frame_num_side_data(frame, AV_FRAME_DATA_SEI_UNREGISTERED); + x4->pic.extra_sei.payloads = av_realloc_array(x4->pic.extra_sei.payloads, + x4->pic.extra_sei.num_payloads + num_unregistered_sei, + sizeof(x264_sei_payload_t)); + for (int i = 0; i < num_unregistered_sei; i++) { + sd = av_frame_get_side_data_n(frame, AV_FRAME_DATA_SEI_UNREGISTERED, i); + if (sd) { + x4->pic.extra_sei.payloads[x4->pic.extra_sei.num_payloads + i].payload = sd->data; + x4->pic.extra_sei.payloads[x4->pic.extra_sei.num_payloads + i].payload_size = sd->size; + x4->pic.extra_sei.payloads[x4->pic.extra_sei.num_payloads + i].payload_type = SEI_TYPE_USER_DATA_UNREGISTERED; + } + } + x4->pic.extra_sei.num_payloads += num_unregistered_sei; } do {