From patchwork Wed Apr 17 04:37:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 48095 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:ce4e:b0:1a9:af23:56c1 with SMTP id id14csp776477pzb; Tue, 16 Apr 2024 21:38:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVwrLiXskzy8rWWd0WXgiD4QqH93K43+xyNGBA6MIU2kKcESU3BtolsNvrNNgFrhZKa5AD2kXVxoMDG2STFIGNwr7+Dayk8sGAKRQ== X-Google-Smtp-Source: AGHT+IHWHUwTa9lRIHzonRr6HfFONa87qO7gSGgFQEQwHC6iksxLI/fS+3rkw01QBOHCDlY6M7ca X-Received: by 2002:a05:6512:1242:b0:518:b133:7e2b with SMTP id fb2-20020a056512124200b00518b1337e2bmr9557615lfb.64.1713328714811; Tue, 16 Apr 2024 21:38:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713328714; cv=none; d=google.com; s=arc-20160816; b=xneV2j8fFtqIMXtjadI+kEr/Tx34smh3mt0GjXBXiA5l8Zl7q7uYHyfIbr1NUnDXLW /UEiPEDrhh5g2DrhgXV4fEUDORZSqNZi8oLeu09iNIlFHKTRIqCG7/mAN6blkmXoKEwA iHr0UQ6P5jWG/sFegNh8IROnuptQcJZ3ZZi+ZSxGaS4RqiLEv+CXg4ffisa2r/YxLvBY 9R2F0IEeMg0tDgiBQogIC/w/J6mGas1W3CVM4JncrOp4HoZrYLhWvBjLfhD9Tl7wAK+X g3fxZjxWU/zIZpRy39578oobmnWlP35eIixM6dyaXvie36lJa2Mn2QLsIj1tl5Q/k6tU 8R4A== 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:date:to:from:message-id :dkim-signature:delivered-to; bh=Cp2FRYMSBZLEJ3qpMZh0AczVtFkFa9pLKEV2jbnEYg0=; fh=HnHYuZ9XgUo86ZRXTLWWmQxhslYEI9B9taZ5X1DLFfc=; b=skyUtp5XmNjC4TyFx48So2T/wY4709qbvyjfMcE4iWwkAm8hOV/eRKU5/T8Xd9FO8j iXdrwMotB2mvo6jFQvXe01crJb61RH5x2iiiq7nT8qYMlkzFrxWIJ4AC6gV3N552VSnZ V3gI9i7M9ftpQ+q9bAsGi2GyMrhehDtfKZdFmAMyT439bg9thKX8AHWKxv7W+3szA/Rj TCuc4ZGoGo5WnNsGgMm/IvmHxAP7F4H9cb03Wp1UCo9f9gjDTmZEjrMEsnAxFmw+1ws+ YmQnITbP4DwpuA64nv1wGoV5WLQt+VqVA3HC37Xh4AEORWVPeJtEJZgE/s9IFK8vhl/Q 1prw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=HkPjwEjz; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t20-20020a50d714000000b0056ffad2be8csi5298952edi.388.2024.04.16.21.38.34; Tue, 16 Apr 2024 21:38:34 -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; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=HkPjwEjz; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3220768D29F; Wed, 17 Apr 2024 07:38:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-251-80.mail.qq.com (out203-205-251-80.mail.qq.com [203.205.251.80]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AF15268CFF4 for ; Wed, 17 Apr 2024 07:37:53 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1713328663; bh=F2LXtUVgFX3GQ0lOuW5gK07j5hAR3l8v3vl4qjLmjZk=; h=From:To:Cc:Subject:Date; b=HkPjwEjzN5d8kt4G45RzPkChMehWCV3dyNGzQoJu85P3VeeiPlXpaBKr1rRmJdami 2VT8jcIZjbeoel4Axju0FzPQuJOVbKU94uitKr/2PPNOTDcPFEKCRKjMH/lrjU3327 Wp7ACWGuU8xjmvdcOS4spn7WFM/F+nbgCXykKAGQ= Received: from localhost.localdomain ([119.147.10.204]) by newxmesmtplogicsvrsza30-0.qq.com (NewEsmtp) with SMTP id 96A0DC1B; Wed, 17 Apr 2024 12:37:42 +0800 X-QQ-mid: xmsmtpt1713328662tkusazrnc Message-ID: X-QQ-XMAILINFO: OakVxA/3u/8RChWQRqldTY4bUOs/5WK8BvQEjMLHo6Naf8SazmsjgievKDyEHB d7clJdbaFtFSM4nIPU2icfVpWUJx5QX4COqBWWlsicCjz0o3iOm62N07nn9pMagsc8UdsCzZDQ5G K9NoGbWJPeC54OIZ0FVX/mc/qJP6AlskoCSfocAS5ZrCXjA1og7kSxPDSKHK0OoeTLOePqm7aVS8 vEByjFO76oux/e7z4gZTp1QD2K/qNua8gAlfdyPKlpnmbn22GIrhVjsUZGw0g0Lf7pAifIfdokxo qkzCAtq4yxtOExLev6mGPOKfNHwMMx7z9g14rw8yhE5tcUvNEOYYm65GOHGDOs52WgU7kTbeHyaw WLQQfLBuwza7fneAm0rEIGAO8u0+diHPu9cp00e95MHlLoSnq4FyOFPrPbd8Jh5wPu7u4fed4Txq fBhgg0OkOV1J0BkMQ+oTC6dPDvLndzjGgN/B7lzHJ7bEx/lFnHzDT3ZBtxfceAgoXYjhfTjeYM/C JOwGCw3D+tkdwuMFD6U6bQFUd9TipVRCwoNc+HxCT7IKxeUnA0ljRArn8iHrAksp9yd4XLV6os7e o0lRd4yKUoibkMteu2FS3aL14rDceGe0vnNVvRHFvMI+RDqWakzan5celLe8yadCDweem+E/T6ov zPH8j6Mzpn3ybr8TowAz8ww9db5kmiOC2GJszDcrZeHItq5Fc6rTrYwHGR897Z9fRCgoOzSq7hRV IoWQccsNk4mntGwfRO46y/8Ypq1xBZeAi2mVFnNO83O500zZiTv8xnJlkx0zmjTPZA1AiS/DFyZC a8+Zf2J1v+gWp0wyRXobxTOvx7hFZYDV2jHZfpMAMXIygj/TuzwMIPBmH+U3WKxakT1Apw7wY3Ff o341lNngNA8xCptWeFDeMg7MUZfpui6YxExDHxcvqVJw3/tiuXJWNQuAZfahS1/ftOKE/AHVIGC6 7fyOvF/IAEU9cZlZ6GHijZL35ghv9iM9agKEVbbs4TAdFBsiMRXQ== X-QQ-XMRINFO: Mp0Kj//9VHAxr69bL5MkOOs= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Wed, 17 Apr 2024 12:37:35 +0800 X-OQ-MSGID: <20240417043742.505853-1-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/8] configure: Lower Android API level requirement of mediandk 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: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: gmRT8rtASOY4 From: Zhao Zhili AImage_delete is introduced in API level 24, while AMediaFormat_new is introduced in API level 21. We only need API level 21 to support NDK mediacodec. This change doesn't break or change of android_camera_indev since camera2ndk still needs API level 24. --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 55f1fc354d..47ec215f8c 100755 --- a/configure +++ b/configure @@ -6640,7 +6640,7 @@ check_lib shell32 "windows.h shellapi.h" CommandLineToArgvW -lshell32 check_lib psapi "windows.h psapi.h" GetProcessMemoryInfo -lpsapi check_lib android android/native_window.h ANativeWindow_acquire -landroid -check_lib mediandk "stdint.h media/NdkImage.h" AImage_delete -lmediandk +check_lib mediandk "stdint.h media/NdkMediaFormat.h" AMediaFormat_new -lmediandk check_lib camera2ndk "stdbool.h stdint.h camera/NdkCameraManager.h" ACameraManager_create -lcamera2ndk enabled appkit && check_apple_framework AppKit From patchwork Wed Apr 17 04:37:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 48096 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:ce4e:b0:1a9:af23:56c1 with SMTP id id14csp776513pzb; Tue, 16 Apr 2024 21:38:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXpoq7ozMeKhHf9tetob1FPiHfJ/wDxJUWR4VbQK9OTqCwben9a5H1O7ogffp+WMZ6gyQz5ohzuvnt03NO/2DXFNuG7uJqaPmLg1g== X-Google-Smtp-Source: AGHT+IFfJ7jH9WMl7zn9AbPIh7AJ8PEh+HSHKEO70rvXQ1hfs2DHLfklU9/RHBX2Syba605r/NRF X-Received: by 2002:a19:e05e:0:b0:513:d0dd:95ef with SMTP id g30-20020a19e05e000000b00513d0dd95efmr7820301lfj.5.1713328724504; Tue, 16 Apr 2024 21:38:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713328724; cv=none; d=google.com; s=arc-20160816; b=stDBSyCkuh5ybZJU5AbLx7/Zdqc5GABXG6ZQ0spMLcr6lnqneNcCsfEUKwL7EC6SeR 3q97pjMj3UxslUW1PROJYKmtWFDlNIqq6VZbzwrl/s4+fq/n7IsjEzVtSZhw6a83z/r9 eROEyjg5+5caTaim6B6NywW8dCUzVqpA61Lu/FebQsk95/A3OYLcn5r+7v9sZKF/IkE2 nJDJlzVNVC+DGMe/rZU3f22GFQ6RIAogSyh3bZVOPt7tuZf021FqXCpOM9oJk4jvyWsL rMMP3fuC7xrv2K//xfBV5eH9mZeXVLv0f//rw6jJKA7nwrMdWZmqeKwGQVE4XVIjCTku fDLw== 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:date :to:from:message-id:dkim-signature:delivered-to; bh=yeJwKtOKciErgQ31uLTR6piMZfhOR7fMrSQxW0I5oxw=; fh=HnHYuZ9XgUo86ZRXTLWWmQxhslYEI9B9taZ5X1DLFfc=; b=dbSW35w4acz8BlQC/W53VGJR+zP3sFcN6WYN19MvX51oKgY5w6mxtDFWcTI+/LLS3b ikHLCXfxWWqj2FcRzFP99zMO3evFdH6Qk2jUqQKwIFS6UTq9VQhoc4qnZKPNDy2DH69f 4C5cUiG5iVWbKv9kxGA7lehDtSsrzCPi1qhOLK1RtvYeYIFKzrMQJL7ps/k+lkr98w7B l823GFp0GNBdDqjzqRuCaBmNsUt+mEF5Ud71/Jnf/FQ1XnkK0Ajt+UNHon+rLvYQJByO ffu02SclRh/RWh2YpcK5K6t5mA8NlQG9vjYAUFXiYI4tA7jYcCFEn/p+4CekJTdhlH+n WROg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=PYn40sDj; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y17-20020a199151000000b00516cdf64f93si3821045lfj.265.2024.04.16.21.38.44; Tue, 16 Apr 2024 21:38:44 -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; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=PYn40sDj; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3DADD68D29B; Wed, 17 Apr 2024 07:38:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-251-82.mail.qq.com (out203-205-251-82.mail.qq.com [203.205.251.82]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D1B2D68D02E for ; Wed, 17 Apr 2024 07:37:53 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1713328664; bh=pQ/FzNjNhIaVtw1Z9c6y6r6n8uQYJpqVK2I6hnw4hFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=PYn40sDj0WMXAlRHHDheu+S8pi7F+yqc6/L/QqdPwg5WydCXEbfCnO03TwJh2MgV0 MhS4JMuRzs1IuH+xRnHo3wBLlyKALHMf53DrTwjMtbBZtRUcyoJXYqTIF2WkG2J9eX 9igOq/nk4XHIAhOP4H75XXR5F3SvLjBBl6yCOXnY= Received: from localhost.localdomain ([119.147.10.204]) by newxmesmtplogicsvrsza30-0.qq.com (NewEsmtp) with SMTP id 96A0DC1B; Wed, 17 Apr 2024 12:37:42 +0800 X-QQ-mid: xmsmtpt1713328663t3jrrahm5 Message-ID: X-QQ-XMAILINFO: MIAHdi1iQo+z3SLlzHZjQQMErOkc+xNZW1FbNRl/AdEdT+9A/BwqIPJ8fw0nAk W/ksIn+B8vqD8KvZm20V9qCDqSMtSpUnQbPv4MuuGEKjMT24DA6EBh+Qmoxe5EkLsjtcsjFq7p3p LoRiomss+SlZ+RMmim3dJHb2+ERIpiCsDmkadEbt7B99MjbqnMIGslN6di+SStCCXMxjTgKYj1st SXW0B3mgG1nE4x2c1IXAjFzVDZMymjG+7XEIwaqy+Wh393cILzueFFSSDFibhc328RnfKoSydfvu HDv4NRKozlleb9FzZDFfwgr8BTcwUMsCVTFv8CepCDLLew7RPJeX84QP7KW38QbENtq2Rzm2ExNs zOK0Z5t7VyXrYeQglNzaLM537L96c/I6hPC4sJKvTnC4KkH5XsksyOSZi8IOP6+jN7l79k3X9lHw VsUJm6GQmmrA9D9fk3mg4RPWRG6yTDR5l0cJwtXb8c0p5aAJhzoqBhYBOgVcm3wDEaVf4yrXM48P MHtQ0n662ot8IimS22rgrsRQjsJYgunQWSdFTRXZqGWb/5RC7wHUpj4Jf12lhqUnqHLwRrCvdBBR v7sqISeRXz+PIv0dLqAMXCf/V9PTOvnmXCxwHx6qZJcoCTk2cWxKwHxNKXj9mfMboU6LVQwDqaoX 1i4z3H7xc+M49xMDbFIo15dIAEizeiIeGEYV3TuOYdN1Q5TK8srJKJNhezGFHS7Ci9j8kf0OXZea QD13DFLQN84E8lakCXX/Hq5EwC4xfGx31klVZ5Lcw1I+D/S6eWu59V1Od8nVhZoJEtarQqMIbl1Q Fh0v4DA305nOZGAW1qrBSijmnkypQsvGKGPu0yOK7mlBO7VWqMJW1BUr7oz8OgoRbi7g0vyuCw32 Tae6xopyJjDOEGgzxbz5t28olGKwDJoWpvz3hvOZZOJpYUlymqDMbPv2jjbjVa22pQk5OuxC+8or aO9WhVrvoP0kogdeF+E/mhHHX8mYabjw8CaDhffew/iGwjCTK+yg== X-QQ-XMRINFO: OWPUhxQsoeAVDbp3OJHYyFg= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Wed, 17 Apr 2024 12:37:36 +0800 X-OQ-MSGID: <20240417043742.505853-2-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240417043742.505853-1-quinkblack@foxmail.com> References: <20240417043742.505853-1-quinkblack@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/8] avcodec/mediacodec_wrapper: link to NDK mediacodec API directly 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: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: SMQy/YAMaZDc From: Zhao Zhili Drop support of Android version before 5.0. --- configure | 2 +- libavcodec/mediacodec_wrapper.c | 164 +++++++------------------------- 2 files changed, 36 insertions(+), 130 deletions(-) diff --git a/configure b/configure index 47ec215f8c..d0d0e8430b 100755 --- a/configure +++ b/configure @@ -3131,7 +3131,7 @@ d3d11va_deps="dxva_h ID3D11VideoDecoder ID3D11VideoContext" d3d12va_deps="dxva_h ID3D12Device ID3D12VideoDecoder" dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32" ffnvcodec_deps_any="libdl LoadLibrary" -mediacodec_deps="android" +mediacodec_deps="android mediandk" nvdec_deps="ffnvcodec" vaapi_x11_deps="xlib_x11" videotoolbox_hwaccel_deps="videotoolbox pthreads" diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c index 306359071e..a9c8b522e0 100644 --- a/libavcodec/mediacodec_wrapper.c +++ b/libavcodec/mediacodec_wrapper.c @@ -1828,25 +1828,8 @@ typedef struct FFAMediaFormatNdk { void *libmedia; AMediaFormat *impl; - AMediaFormat *(*new)(void); - media_status_t (*delete)(AMediaFormat*); - - const char* (*toString)(AMediaFormat*); - - bool (*getInt32)(AMediaFormat*, const char *name, int32_t *out); - bool (*getInt64)(AMediaFormat*, const char *name, int64_t *out); - bool (*getFloat)(AMediaFormat*, const char *name, float *out); - bool (*getSize)(AMediaFormat*, const char *name, size_t *out); - bool (*getBuffer)(AMediaFormat*, const char *name, void** data, size_t *size); - bool (*getString)(AMediaFormat*, const char *name, const char **out); bool (*getRect)(AMediaFormat *, const char *name, int32_t *left, int32_t *top, int32_t *right, int32_t *bottom); - - void (*setInt32)(AMediaFormat*, const char* name, int32_t value); - void (*setInt64)(AMediaFormat*, const char* name, int64_t value); - void (*setFloat)(AMediaFormat*, const char* name, float value); - void (*setString)(AMediaFormat*, const char* name, const char* value); - void (*setBuffer)(AMediaFormat*, const char* name, const void* data, size_t size); void (*setRect)(AMediaFormat *, const char *name, int32_t left, int32_t top, int32_t right, int32_t bottom); } FFAMediaFormatNdk; @@ -1858,34 +1841,6 @@ typedef struct FFAMediaCodecNdk { AMediaCodec *impl; ANativeWindow *window; - AMediaCodec* (*createCodecByName)(const char *name); - AMediaCodec* (*createDecoderByType)(const char *mime_type); - AMediaCodec* (*createEncoderByType)(const char *mime_type); - media_status_t (*delete)(AMediaCodec*); - - media_status_t (*configure)(AMediaCodec *, - const AMediaFormat *format, - ANativeWindow *surface, - AMediaCrypto *crypto, - uint32_t flags); - media_status_t (*start)(AMediaCodec*); - media_status_t (*stop)(AMediaCodec*); - media_status_t (*flush)(AMediaCodec*); - - uint8_t* (*getInputBuffer)(AMediaCodec*, size_t idx, size_t *out_size); - uint8_t* (*getOutputBuffer)(AMediaCodec*, size_t idx, size_t *out_size); - - ssize_t (*dequeueInputBuffer)(AMediaCodec*, int64_t timeoutUs); - media_status_t (*queueInputBuffer)(AMediaCodec*, size_t idx, - long offset, size_t size, - uint64_t time, uint32_t flags); - - ssize_t (*dequeueOutputBuffer)(AMediaCodec*, AMediaCodecBufferInfo *info, int64_t timeoutUs); - AMediaFormat* (*getOutputFormat)(AMediaCodec*); - - media_status_t (*releaseOutputBuffer)(AMediaCodec*, size_t idx, bool render); - media_status_t (*releaseOutputBufferAtTime)(AMediaCodec *mData, size_t idx, int64_t timestampNs); - // Available since API level 28. media_status_t (*getName)(AMediaCodec*, char** out_name); void (*releaseName)(AMediaCodec*, char* name); @@ -1925,38 +1880,15 @@ static FFAMediaFormat *mediaformat_ndk_create(AMediaFormat *impl) #define GET_OPTIONAL_SYMBOL(sym) \ format->sym = dlsym(format->libmedia, "AMediaFormat_" #sym); -#define GET_SYMBOL(sym) \ - GET_OPTIONAL_SYMBOL(sym) \ - if (!format->sym) \ - goto error; - - GET_SYMBOL(new) - GET_SYMBOL(delete) - - GET_SYMBOL(toString) - - GET_SYMBOL(getInt32) - GET_SYMBOL(getInt64) - GET_SYMBOL(getFloat) - GET_SYMBOL(getSize) - GET_SYMBOL(getBuffer) - GET_SYMBOL(getString) GET_OPTIONAL_SYMBOL(getRect) - - GET_SYMBOL(setInt32) - GET_SYMBOL(setInt64) - GET_SYMBOL(setFloat) - GET_SYMBOL(setString) - GET_SYMBOL(setBuffer) GET_OPTIONAL_SYMBOL(setRect) -#undef GET_SYMBOL #undef GET_OPTIONAL_SYMBOL if (impl) { format->impl = impl; } else { - format->impl = format->new(); + format->impl = AMediaFormat_new(); if (!format->impl) goto error; } @@ -1984,7 +1916,7 @@ static int mediaformat_ndk_delete(FFAMediaFormat* ctx) av_assert0(format->api.class == &amediaformat_ndk_class); - if (format->impl && (format->delete(format->impl) != AMEDIA_OK)) + if (format->impl && (AMediaFormat_delete(format->impl) != AMEDIA_OK)) ret = AVERROR_EXTERNAL; if (format->libmedia) dlclose(format->libmedia); @@ -1996,39 +1928,39 @@ static int mediaformat_ndk_delete(FFAMediaFormat* ctx) static char* mediaformat_ndk_toString(FFAMediaFormat* ctx) { FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; - const char *str = format->toString(format->impl); + const char *str = AMediaFormat_toString(format->impl); return av_strdup(str); } static int mediaformat_ndk_getInt32(FFAMediaFormat* ctx, const char *name, int32_t *out) { FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; - return format->getInt32(format->impl, name, out); + return AMediaFormat_getInt32(format->impl, name, out); } static int mediaformat_ndk_getInt64(FFAMediaFormat* ctx, const char *name, int64_t *out) { FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; - return format->getInt64(format->impl, name, out); + return AMediaFormat_getInt64(format->impl, name, out); } static int mediaformat_ndk_getFloat(FFAMediaFormat* ctx, const char *name, float *out) { FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; - return format->getFloat(format->impl, name, out); + return AMediaFormat_getFloat(format->impl, name, out); } static int mediaformat_ndk_getBuffer(FFAMediaFormat* ctx, const char *name, void** data, size_t *size) { FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; - return format->getBuffer(format->impl, name, data, size); + return AMediaFormat_getBuffer(format->impl, name, data, size); } static int mediaformat_ndk_getString(FFAMediaFormat* ctx, const char *name, const char **out) { FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; const char *tmp = NULL; - int ret = format->getString(format->impl, name, &tmp); + int ret = AMediaFormat_getString(format->impl, name, &tmp); if (tmp) *out = av_strdup(tmp); @@ -2047,31 +1979,31 @@ static int mediaformat_ndk_getRect(FFAMediaFormat *ctx, const char *name, static void mediaformat_ndk_setInt32(FFAMediaFormat* ctx, const char* name, int32_t value) { FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; - format->setInt32(format->impl, name, value); + AMediaFormat_setInt32(format->impl, name, value); } static void mediaformat_ndk_setInt64(FFAMediaFormat* ctx, const char* name, int64_t value) { FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; - format->setInt64(format->impl, name, value); + AMediaFormat_setInt64(format->impl, name, value); } static void mediaformat_ndk_setFloat(FFAMediaFormat* ctx, const char* name, float value) { FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; - format->setFloat(format->impl, name, value); + AMediaFormat_setFloat(format->impl, name, value); } static void mediaformat_ndk_setString(FFAMediaFormat* ctx, const char* name, const char* value) { FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; - format->setString(format->impl, name, value); + AMediaFormat_setString(format->impl, name, value); } static void mediaformat_ndk_setBuffer(FFAMediaFormat* ctx, const char* name, void* data, size_t size) { FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; - format->setBuffer(format->impl, name, data, size); + AMediaFormat_setBuffer(format->impl, name, data, size); } static void mediaformat_ndk_setRect(FFAMediaFormat *ctx, const char *name, @@ -2117,54 +2049,28 @@ static inline FFAMediaCodec *ndk_codec_create(int method, const char *arg) { if (!codec->libmedia) goto error; -#define GET_SYMBOL(sym, required) \ +#define GET_SYMBOL(sym) \ codec->sym = dlsym(codec->libmedia, "AMediaCodec_" #sym); \ - if (!codec->sym) { \ - av_log(codec, required ? AV_LOG_ERROR : AV_LOG_INFO, \ - #sym "() unavailable from %s\n", lib_name); \ - if (required) \ - goto error; \ - } - - GET_SYMBOL(createCodecByName, 1) - GET_SYMBOL(createDecoderByType, 1) - GET_SYMBOL(createEncoderByType, 1) - GET_SYMBOL(delete, 1) - - GET_SYMBOL(configure, 1) - GET_SYMBOL(start, 1) - GET_SYMBOL(stop, 1) - GET_SYMBOL(flush, 1) - - GET_SYMBOL(getInputBuffer, 1) - GET_SYMBOL(getOutputBuffer, 1) - - GET_SYMBOL(dequeueInputBuffer, 1) - GET_SYMBOL(queueInputBuffer, 1) - - GET_SYMBOL(dequeueOutputBuffer, 1) - GET_SYMBOL(getOutputFormat, 1) - - GET_SYMBOL(releaseOutputBuffer, 1) - GET_SYMBOL(releaseOutputBufferAtTime, 1) + if (!codec->sym) \ + av_log(codec, AV_LOG_INFO, #sym "() unavailable from %s\n", lib_name); - GET_SYMBOL(getName, 0) - GET_SYMBOL(releaseName, 0) + GET_SYMBOL(getName) + GET_SYMBOL(releaseName) - GET_SYMBOL(setInputSurface, 0) - GET_SYMBOL(signalEndOfInputStream, 0) + GET_SYMBOL(setInputSurface) + GET_SYMBOL(signalEndOfInputStream) #undef GET_SYMBOL switch (method) { case CREATE_CODEC_BY_NAME: - codec->impl = codec->createCodecByName(arg); + codec->impl = AMediaCodec_createCodecByName(arg); break; case CREATE_DECODER_BY_TYPE: - codec->impl = codec->createDecoderByType(arg); + codec->impl = AMediaCodec_createDecoderByType(arg); break; case CREATE_ENCODER_BY_TYPE: - codec->impl = codec->createEncoderByType(arg); + codec->impl = AMediaCodec_createEncoderByType(arg); break; default: av_assert0(0); @@ -2201,7 +2107,7 @@ static int mediacodec_ndk_delete(FFAMediaCodec* ctx) av_assert0(codec->api.class == &amediacodec_ndk_class); - if (codec->impl && (codec->delete(codec->impl) != AMEDIA_OK)) + if (codec->impl && (AMediaCodec_delete(codec->impl) != AMEDIA_OK)) ret = AVERROR_EXTERNAL; if (codec->window) ANativeWindow_release(codec->window); @@ -2246,7 +2152,7 @@ static int mediacodec_ndk_configure(FFAMediaCodec* ctx, return AVERROR_EXTERNAL; } - status = codec->configure(codec->impl, format->impl, NULL, NULL, flags); + status = AMediaCodec_configure(codec->impl, format->impl, NULL, NULL, flags); if (status != AMEDIA_OK) { av_log(codec, AV_LOG_ERROR, "Encoder configure failed, %d\n", status); return AVERROR_EXTERNAL; @@ -2261,7 +2167,7 @@ static int mediacodec_ndk_configure(FFAMediaCodec* ctx, return AVERROR_EXTERNAL; } } else { - status = codec->configure(codec->impl, format->impl, native_window, NULL, flags); + status = AMediaCodec_configure(codec->impl, format->impl, native_window, NULL, flags); if (status != AMEDIA_OK) { av_log(codec, AV_LOG_ERROR, "Decoder configure failed, %d\n", status); return AVERROR_EXTERNAL; @@ -2275,7 +2181,7 @@ static int mediacodec_ndk_configure(FFAMediaCodec* ctx, static int mediacodec_ndk_ ## method(FFAMediaCodec* ctx) \ { \ FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; \ - media_status_t status = codec->method(codec->impl); \ + media_status_t status = AMediaCodec_ ## method (codec->impl); \ \ if (status != AMEDIA_OK) { \ av_log(codec, AV_LOG_ERROR, #method " failed, %d\n", status); \ @@ -2292,19 +2198,19 @@ MEDIACODEC_NDK_WRAPPER(flush) static uint8_t* mediacodec_ndk_getInputBuffer(FFAMediaCodec* ctx, size_t idx, size_t *out_size) { FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; - return codec->getInputBuffer(codec->impl, idx, out_size); + return AMediaCodec_getInputBuffer(codec->impl, idx, out_size); } static uint8_t* mediacodec_ndk_getOutputBuffer(FFAMediaCodec* ctx, size_t idx, size_t *out_size) { FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; - return codec->getOutputBuffer(codec->impl, idx, out_size); + return AMediaCodec_getOutputBuffer(codec->impl, idx, out_size); } static ssize_t mediacodec_ndk_dequeueInputBuffer(FFAMediaCodec* ctx, int64_t timeoutUs) { FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; - return codec->dequeueInputBuffer(codec->impl, timeoutUs); + return AMediaCodec_dequeueInputBuffer(codec->impl, timeoutUs); } static int mediacodec_ndk_queueInputBuffer(FFAMediaCodec *ctx, size_t idx, @@ -2312,7 +2218,7 @@ static int mediacodec_ndk_queueInputBuffer(FFAMediaCodec *ctx, size_t idx, uint64_t time, uint32_t flags) { FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; - return codec->queueInputBuffer(codec->impl, idx, offset, size, time, flags); + return AMediaCodec_queueInputBuffer(codec->impl, idx, offset, size, time, flags); } static ssize_t mediacodec_ndk_dequeueOutputBuffer(FFAMediaCodec* ctx, FFAMediaCodecBufferInfo *info, int64_t timeoutUs) @@ -2321,7 +2227,7 @@ static ssize_t mediacodec_ndk_dequeueOutputBuffer(FFAMediaCodec* ctx, FFAMediaCo AMediaCodecBufferInfo buf_info = {0}; ssize_t ret; - ret = codec->dequeueOutputBuffer(codec->impl, &buf_info, timeoutUs); + ret = AMediaCodec_dequeueOutputBuffer(codec->impl, &buf_info, timeoutUs); info->offset = buf_info.offset; info->size = buf_info.size; info->presentationTimeUs = buf_info.presentationTimeUs; @@ -2333,7 +2239,7 @@ static ssize_t mediacodec_ndk_dequeueOutputBuffer(FFAMediaCodec* ctx, FFAMediaCo static FFAMediaFormat* mediacodec_ndk_getOutputFormat(FFAMediaCodec* ctx) { FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; - AMediaFormat *format = codec->getOutputFormat(codec->impl); + AMediaFormat *format = AMediaCodec_getOutputFormat(codec->impl); if (!format) return NULL; @@ -2345,7 +2251,7 @@ static int mediacodec_ndk_releaseOutputBuffer(FFAMediaCodec* ctx, size_t idx, in FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; media_status_t status; - status = codec->releaseOutputBuffer(codec->impl, idx, render); + status = AMediaCodec_releaseOutputBuffer(codec->impl, idx, render); if (status != AMEDIA_OK) { av_log(codec, AV_LOG_ERROR, "release output buffer failed, %d\n", status); return AVERROR_EXTERNAL; @@ -2359,7 +2265,7 @@ static int mediacodec_ndk_releaseOutputBufferAtTime(FFAMediaCodec *ctx, size_t i FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; media_status_t status; - status = codec->releaseOutputBufferAtTime(codec->impl, idx, timestampNs); + status = AMediaCodec_releaseOutputBufferAtTime(codec->impl, idx, timestampNs); if (status != AMEDIA_OK) { av_log(codec, AV_LOG_ERROR, "releaseOutputBufferAtTime failed, %d\n", status); return AVERROR_EXTERNAL; From patchwork Wed Apr 17 04:37:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 48092 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:ce4e:b0:1a9:af23:56c1 with SMTP id id14csp776363pzb; Tue, 16 Apr 2024 21:38:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUNmjKPtnad45H8eCo0iGrrVV2nROY8I32Qg1yVHnKBXjVQsA0nnXX6oisCgAlQtlRpjsErqQyYNob9qlK+oSvv57lGXWj6HqPkqg== X-Google-Smtp-Source: AGHT+IHxRhHEI2aqZhFVdXUXaI4s6WzuKr7flEprWzQXD5H4XsSwQegdzZsjDhxxs9W8wOn3Vq3O X-Received: by 2002:a2e:3210:0:b0:2db:196e:3ef7 with SMTP id y16-20020a2e3210000000b002db196e3ef7mr553768ljy.13.1713328687250; Tue, 16 Apr 2024 21:38:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713328687; cv=none; d=google.com; s=arc-20160816; b=WLG7AKQ8SGAvHHshGGKI8Ez3/MOzKXw8wUXUQWdVMbZwC83MN5Ih2C93xf57kl6IKK 4/vwD12T8EVvwACRy5Gl0UiUA/bq/RhXCwWFvcaQpFeqjsRSc1+eul7VOqkXSJC53H/e MvjBNBC7mPRH1HbncJU3WXIoxLwGn/xOHhDKNU86/e3x57ln5uoWCdpCgVD/XNnpJzB3 +MbCg2k3CBFZIDrt3FAnAXcf5js3Kc3xTNPsctiTQvQqOno2Ilv65zZNlrfTlVJ+vsz0 AXR1a/keMXG6llEmebHYziWTBxjqhjA36c3pDSM3QL6irjgVsgXv+Ql0/7rZvity4Lo5 djFQ== 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:date :to:from:message-id:dkim-signature:delivered-to; bh=dW4mL5Pel8CdVHNcFy5ARKiBV/MeMrisVa20bNIUh3c=; fh=HnHYuZ9XgUo86ZRXTLWWmQxhslYEI9B9taZ5X1DLFfc=; b=gQh1NdVZUHNkG+nfAWg55/LNWVshmCRLSPFgwIeMI8IUFqQiu2KcHQwyb1/WGGmXqs TpgilGF+SmjPK8iPcH9jZiEPwkA1qPOSJuXLYo+xN7JUHZfPlKefPrCM2IYL01LWQxSb L9GI4/axNf38AILxNGnF/31d244i+E4uH11J9SdWkClvEZqwxURXJeUtYbUxYviiZ3w+ WXzmSo3ZpPpfkGTmUe5+u4vj2s9A41SnbVFbi+tJ5tmkGgf4Hrx4FRzFfEA4Q5QW2NLy VRO2lv2kEYTkF6ndK3jk1YcxXfWgUiGX7EthjVzOFUjaLCvqjdeOZgGx9X1jhvjafU2a FriQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=F906Q0Z4; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id x6-20020a2ea986000000b002d85aa667c4si3566770ljq.162.2024.04.16.21.38.06; Tue, 16 Apr 2024 21:38:07 -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; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=F906Q0Z4; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AADF968CEEE; Wed, 17 Apr 2024 07:38:00 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-221-192.mail.qq.com (out203-205-221-192.mail.qq.com [203.205.221.192]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4C88668CF59 for ; Wed, 17 Apr 2024 07:37:52 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1713328664; bh=ppaFE+oL+UbAuD2RvWQU4ZgOcF6eclo4EPAXUTzVFT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=F906Q0Z4NJ3QTZkCA7chnuP033FDEyen426BgAOuBqB2Qo92jiJ0rnyzMVRUGD1Dr 8T1eWpy+fQAZp2DRtvTrxMggmaYHq+5YEnl8+WGWjE/tfxGxIFq4Z8seCkI5CrTjge WAKyQMEOjXixjl7mMk7ym6Rcbk1RXtkjmZJICASU= Received: from localhost.localdomain ([119.147.10.204]) by newxmesmtplogicsvrsza30-0.qq.com (NewEsmtp) with SMTP id 96A0DC1B; Wed, 17 Apr 2024 12:37:42 +0800 X-QQ-mid: xmsmtpt1713328663t4u63js8l Message-ID: X-QQ-XMAILINFO: NRYSeI3Ux+UP72AIMS/aZXqqF3IWBM+0Pgj7AyBxFZ+3MHhRIT0NWw/XdMgFrk 1AYaq7O4gJY/xbye9IsEzd/qS1M98LLW1DdN5947LUSL8/V0YNQ9M3AzZ1yFGJgWdyP4Jn7B/NEI fwnvmnEo1ho9bMVVpQWprW8Fd8nKKnufZKZEz/A16U4tnnJw0EvT8WVwZ0XMS23M1b/Ude3R4ViY cyq1YwUlckN4c4LaB2fEurM++9TC5jLnQs7QnUhy0UM2gZt3OW0/JuZq3S6tw97BaERh1o3qoxH8 Uh/IvozCgMlyNQD8dH4GTC1ofVF07pW4VE0omXLTDf+urJpxIQaYiyIc/LYPO+OsJuo+MfhrG3lY l+6OA4DEB8gpoIjp3DnSl2qtoRl/NXdVyPT+uomn577BIm8gWd0VPjfCBuv6FjQmXph/mEj+2GfC hJgShJaLKPCeyQB3c74oxWGaMq/L1Fdeo/DdT9y3nVapALYFtXxTWFfJA7Sl3DB7mSzPhRYFGibL gj8UqljYqNhnZZLGjTbTX1GTy9WGIdZNOaSG/Pr4QfWvTDDXb3+wBziZz8W+9AngNvQO0v56l86L v6HNqRCvy/SnFhbD09XruCw9Z1eqex9nbgwkwsImeS9QN7AyIl6P1J19FV4uhqXFYHUIJcFKYLia 6QAjK3F4OAat5NZ9YYrT+OW5y5utE3/ZgcMDdChOU1rwFMgC6GznX1MbuGJndrFrnyWFbPwQDD/R U048NnvY47ve0RxLDT92Qvs3Mxcd8yFwU6ES9alkvHb6obY+RCLLOc4DIOigTmHpVbvDr7+td6j1 MX5C+3XtLQQdmH704elS0Xi8+utC6ryvMFBqcf3vdM1io296NgFrH+2gm5l4ZZbnnCYq77RWoRPO Kc2koi2W2F1hfhwjbG9YBUJCEAkLersabzhr3YbOHioFN0m6H56leyP+PYFkoU9lvI2Tj6XIkCU5 hdTknzSHcrDS+PrXxQim1iq269KKp7Ozyye1Mp1MGmXAqmflCDIJfKUalPsoQPyrkVAyXy8FdE5b vfYLEgWQ== X-QQ-XMRINFO: Nq+8W0+stu50PRdwbJxPCL0= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Wed, 17 Apr 2024 12:37:37 +0800 X-OQ-MSGID: <20240417043742.505853-3-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240417043742.505853-1-quinkblack@foxmail.com> References: <20240417043742.505853-1-quinkblack@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/8] avcodec/mediacodec_wrapper: Fix unused variable warning 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: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: aESP/ljN07NE From: Zhao Zhili --- libavcodec/mediacodec_wrapper.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c index a9c8b522e0..96c886666a 100644 --- a/libavcodec/mediacodec_wrapper.c +++ b/libavcodec/mediacodec_wrapper.c @@ -365,6 +365,7 @@ int ff_AMediaCodecProfile_getProfileFromAVCodecContext(AVCodecContext *avctx) (void)VP9Profile3HDR; (void)VP9Profile2HDR10Plus; (void)VP9Profile3HDR10Plus; + (void)MPEG4ProfileSimpleFace; (void)AV1ProfileMain10; (void)AV1ProfileMain10HDR10; (void)AV1ProfileMain10HDR10Plus; From patchwork Wed Apr 17 04:37:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 48093 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:ce4e:b0:1a9:af23:56c1 with SMTP id id14csp776400pzb; Tue, 16 Apr 2024 21:38:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXvUEHiPLQbFTJt7MFTDSa4mfsm0wBrIkJPfLUXWnstaRlX5OWytD6pojsy7z7qRZIyD9pTTXY0KvwiXcNwxWlZuJdiEPDnH6Qo2g== X-Google-Smtp-Source: AGHT+IE8b99ql24Tymz5sZa6exxh1r+y5wTbpUF0SmwDTxvmZ4AI4ZoiDgBSUFV67KtsGM6/T9lV X-Received: by 2002:a50:9e4e:0:b0:56e:548b:529f with SMTP id z72-20020a509e4e000000b0056e548b529fmr11224065ede.1.1713328697251; Tue, 16 Apr 2024 21:38:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713328697; cv=none; d=google.com; s=arc-20160816; b=cShqBWMLJw4jgkktv23/A6NDl6fQpgluQu/FCpt8oA7dPyC/aNILO2zOhVtinqMFgy L0wkDZwGgsM3gfqkUgy15MZNTJRszWCk+ARjtOUUrr3ZyKOhfUOYWpXNLcKa82IKPhWK K/kRoTuW7WiCyGVCBSo8ORbtoCengthuQJWcUSRnlVKHDL8pmsQ29Hd+fSDjWcmtclYN rJ8G8kZzjk8aaS8c9FucpX4YTgBUcZngiSZKhHRPZsCAID53SgWZHNWOEwefkM69SWbU GtSIUzjGP7tiBZ+9lTUzuIreQ0fcG6F2EL+frOXpxP+BGUZzfs23vRyqOLzabbjpSvFG HcpA== 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:date :to:from:message-id:dkim-signature:delivered-to; bh=2hJIHqpMNavnO0UHMXwbWDqIrka4uhW2OWF9avseDJ4=; fh=HnHYuZ9XgUo86ZRXTLWWmQxhslYEI9B9taZ5X1DLFfc=; b=miIsQ3miD8Lz5+dzR1VYn87ssa+bug3+kiRfgRXgTUzJRow9W/J29Da/19bSgmDpBN AgaZz1jBvGnVhOs1w5ofS4MPnH71JV1GTRQUaxF5lH1tLRIyBbfRiLgNkGCifKHzoNUh HCYC/lGpOr4K1U5hRPP3krlOT9p992QRBLcOsrAlhcqyIcjAKPc2TtJZyrEbCBs4++6h s4uquecU52VDbv7FMZfyzjOQQJgK09l7fahSzfgzQDEMc650X8vtWsHVS0lj6dGU+01e MZo9wYpKqHCbiTcMvJ/alsCGgUOTwGxHlBcwPAaFdm8U9y7qAiXPaOgJfqyC9V3ikzAZ aOJg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=euCJKXXf; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id n20-20020a509354000000b0056e2f95e09dsi6287844eda.612.2024.04.16.21.38.16; Tue, 16 Apr 2024 21:38:17 -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; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=euCJKXXf; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F1D2968CA01; Wed, 17 Apr 2024 07:38:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-221-191.mail.qq.com (out203-205-221-191.mail.qq.com [203.205.221.191]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4F70E68CFAA for ; Wed, 17 Apr 2024 07:37:52 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1713328665; bh=kxQATrDiYiwuYkEx01vLYaYLOAFx7p9weLc0CU/h3KE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=euCJKXXfz9pz43nQOdtIgo5BKE/ZLG0p1csPYl0372UJ20pHXdYA/eWfp3IyHAjli bGBZzzOVPT0So0z8SASe3VXvFPpwGcpSKNQGJRLIF85R41qLIL1125bwp/t0kWtXdU 4BkzSBCkaUOHcZrNAh3g6lNOpsHLzm++mcUbkFfY= Received: from localhost.localdomain ([119.147.10.204]) by newxmesmtplogicsvrsza30-0.qq.com (NewEsmtp) with SMTP id 96A0DC1B; Wed, 17 Apr 2024 12:37:42 +0800 X-QQ-mid: xmsmtpt1713328664teeg0jp4p Message-ID: X-QQ-XMAILINFO: NLNuKjcZ2ePXl0x8ghmLfJI30EkzZgi3RxhVQlqpEY5L38o/ix0O9L6iivet5F meqSZWZZ7q8Szwi68w2vXvzcZMG7G6iZ+qaa2m7ga5sXQYAWDZDkQjTxvmpdvVjS1f0xf+HQGQr8 HhPjr0W0Srb5lczi9BgEcHcdUDN68X07l/yGM+B/Sj15z7p3XjzzhLOWS0EKiCYtg7FbzG6cvInK pu4CPCIDvRHzSpUjVSELtdI+KVOUT2QfpH/tkZft+ia2LOpsfqotzc8TqIlsFTIDUMhXPZSwAlIB xLyX6zAV6JkhhX+pqffRP4y2rL0qj0pFeDwOV/Ld9XEQ0K6r8D4OcaTrisP6qF6KFOL/U+YQ8za4 9yjaetpZU0RvCIHf+Zj0LzYXNpHQQFG75kOnacyTVSA9d2V4LxJzw3xGnZxSbEwbEaaQeMd8xlr/ Dlyx8aW2MTkY3PYlEBzs0DeglD9yG0GQu/a8Ugc65KZT4txFHbMXSwdOiFtVdobm2a5mBqtDdEX2 wiCWikRxX8LryRqy9Qq8W1vu5VOLWIGxorK8BB3adjcXzaQVBG1db26NiWtI/1hC6odzfGKcjytx Vu26lv3oLo/Q+kStIaLdxyItvBNYRR2+63lQT+qZOPNl7mqVqYcKEntp8edrW+TukycFCAIondRm kD9Z8jROC5oss1NzU/aIG9HdRKIaaqdOVjS/7RjwhebonYj3As0W5QWgqumqtIt6cpkukCgcf5aM 9fMZk9H6bC1DmXMqvcsVjKVRDwx+Xk17FgM31vibatwASOkWuiAvlrEsSy8ZJH2nAKc0qJJm/MJq K7PvwB92BtqGwKcJZf3kcArvTdkDgEmFVJDm+2u97aKelBteFq01AjN2H7jB8Uco5rXGhCU/PZIK dCp3DqNHJfkC1iAjkRtEc0xlwzxhOY9mIDEJR+qF4BGagkgSSF4DDe/kVQoWtR8Gm4UN1ZrwHsAy RK4sQgydENNGgTDQl570Dg+xwUH0W8FkpzP/PjRAoyDZRn/uNUZ0824tlYiILr9PugpscIFCg4XI T82hteHk2EVqZZG0kZ X-QQ-XMRINFO: Nq+8W0+stu50PRdwbJxPCL0= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Wed, 17 Apr 2024 12:37:38 +0800 X-OQ-MSGID: <20240417043742.505853-4-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240417043742.505853-1-quinkblack@foxmail.com> References: <20240417043742.505853-1-quinkblack@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/8] avcodec/mediacodecenc: Fix return empty packet when bsf is used 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: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: qJb7J3nGWHXD From: Zhao Zhili Signed-off-by: Zhao Zhili --- libavcodec/mediacodecenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index b59de75b9b..e562181120 100644 --- a/libavcodec/mediacodecenc.c +++ b/libavcodec/mediacodecenc.c @@ -534,7 +534,7 @@ static int mediacodec_encode(AVCodecContext *avctx, AVPacket *pkt) return 0; } - if (ret != AVERROR(EAGAIN)) + if (ret < 0 && ret != AVERROR(EAGAIN)) return ret; if (!s->frame->buf[0]) { From patchwork Wed Apr 17 04:37:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 48094 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:ce4e:b0:1a9:af23:56c1 with SMTP id id14csp776447pzb; Tue, 16 Apr 2024 21:38:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUynl5Uat9N9X96EBGXYw4L/Lw3CKMkDqrqmNSfikMHaLiMCrCcw6/eJqnHpeCt0wS0q99oyFlGZ1tehTdFOA+/HnIYFNVPLdntxQ== X-Google-Smtp-Source: AGHT+IF+5jdVlDub25DjOqhluGcGQxGbqXE2x57RnZxJCFauIDB35YWIAj+bamOph+mtpNo33YRM X-Received: by 2002:a05:6512:3a90:b0:516:d0c0:3c5 with SMTP id q16-20020a0565123a9000b00516d0c003c5mr11576568lfu.24.1713328705837; Tue, 16 Apr 2024 21:38:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713328705; cv=none; d=google.com; s=arc-20160816; b=q4Vgld1P6vmoR8EiTEJdm9GgYkHePI30C+CERpZXn9qgu7JagGTN2UadqAX+Aau+OT hNEt5J4Jjq8DN0BrY0k3xm4v+Gb3sCUE2axzl/XeISYhW+X6oY/9mV+2DumH/WrA15hx IQjcRC7HK/NzOe2NIWxv0eyzXF/qOHvWPJRZLajnOYxJ78UJgMRKYpvvau3hhY6C+rVf I9/gmGFV2UKI0laUzH1VM5SDRlTYSOc+wUGZEYK7ttGJAq9hbj+GUpjqns2YsY1wch4k CnonIQzhDKZOqkTs0AvxJ4/WtA4YbvqzOmt15I7G9qB1SxtgWHsfmafjWCArZSzObd3P 542w== 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:date :to:from:message-id:dkim-signature:delivered-to; bh=a0DVtuOcQThAML+k/fkIPA5i2WDkHSpu5LFlQtHdAGI=; fh=HnHYuZ9XgUo86ZRXTLWWmQxhslYEI9B9taZ5X1DLFfc=; b=ViwQQ695z6mBsLZnzhbfmGizYlwXsMsrCZiiS5MX/oejyzHnxtg/zv2FR5sSMJyzNV 6Cb8xLgw40kGeYwFRRIXIOIuQVYfZXcBLpucO9ViBBNtQ2nT8TXeHseWJINPQGgbLu/X RjbzvpO70YvvP30vMdEhc+q4BxxtgbOejsLI1R3A3thL8LGYqaPuJLXU22wyW45K2DSz +oe40XDJNE1j2ke9j3W3XkrAV9ZCZU9CvFSX9kR9MOoOjFJo1lAW79bXL9DS+n0lS/bQ MoBUtcZVOfEQlvIbOoTWaQ6Ys7Zixi+RHVh4IwSmydG+mMgYQn0M0ydiB5PSeCYdJmRL 5Slg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=kcp+BLig; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id h34-20020a0564020ea200b0056baf460f94si6666116eda.635.2024.04.16.21.38.25; Tue, 16 Apr 2024 21:38:25 -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; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=kcp+BLig; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 18F7568CFAA; Wed, 17 Apr 2024 07:38:03 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-221-191.mail.qq.com (out203-205-221-191.mail.qq.com [203.205.221.191]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 734BC68CFE3 for ; Wed, 17 Apr 2024 07:37:53 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1713328665; bh=gJcVhda39ELjr3QZyoR+jl9mrZGWzn3k2G5Ud524EWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kcp+BLig8mwbaPLHYphL/czWyWmxZPxC4JnnsWP4dE6b4o1PbYfFAb7aw0xg/+ryG KBv6e/o+dfwEq5l052N89ZHc1V0LgysS/UvqeWoqwxl/NQP5ZQq9FvEacz4sLGqkNt 2P0Q+oQyyvDPoivG3nkuk15dpa543M2rOK7hCIxw= Received: from localhost.localdomain ([119.147.10.204]) by newxmesmtplogicsvrsza30-0.qq.com (NewEsmtp) with SMTP id 96A0DC1B; Wed, 17 Apr 2024 12:37:42 +0800 X-QQ-mid: xmsmtpt1713328664tpymmwdms Message-ID: X-QQ-XMAILINFO: NfHsM/dq2nWIrqcLrdSf3+aaRKCIyE9W0HihdOjoXuxgwf7tSvOLn/q2PiC37W g6xmtxIB+dnjvGeUfY7btDfwUkf6tIXU/5Wh3K8tvYm0OOsVs4cPv+0FZMRukRPQfu9lqHbsNAON 79Q1CYDzqOmAMPhYS1eDpwr2qYupaUPl3Sb/JsqwU7/9YlDIsmHpCp+C7qf1zB0VzeBMM1mp375N uaJUq7nasEqMpHfDVsYPDlvLcv6MO9DlWBUIFXJAZDEMoNrHVvUh3sT5to5tEff1ra0uyhLFuWiy og8/mbuNEePiw8YrgXmLEco9m8YPiPhfwCZgrlRbR4GMsKpthTeiTIEJOlNclAZuizdhE870L5m6 ifpUK9ZL5nM5cN+YajSQTxQa+nRzIUFtwshQwxPsO5pubtbiw5CAD2O3OlMQzZXhGGicHVeTBC3L obeUmvW2A0uLx+by5XTwl6xfSzjbJGJg2VLIZfve6WxteBfcFjeF7XS6oE+zJU8jn6TfcTqWJFSW guIS6rotWN1rQVEhxpRNbS7Hp0DWjD1YTbrfvoZEghX3C5sWcp2OMINabuCokfuSkCdZuNjTIzwa 71Eo1YizJZvx46pzPBTuwgZTqO2o4lJNd9Mydp5mbfkGFhsXuLy10nXdhcfszThrvjTe/sRRsnbt 0GSrpijFp5bVQEnKQKYghgkXVwq8C6hH6D7sfeLBxx9t+V8Q5AxplFwbRbQKu1UpAXVajdj+kxBi xFXCpSXCC/+5A4jufvq4EJQaBOjM+UndqtN8FvdpPP6P7F+O99geUMI2g0HFIog7oUi3DFcle3LY T0cON3bQ0lXWkPvcQr6I5sm4pizUOZ1QH/tAmPp3/cZ/5rVJ7ylkS67hJmjJQt7tukpuvlglwqQA Frpp2iMYTsy17FIUjLWwY6re3wpv23QrpN5CnrsVWzRjqqH2LhuF1UvsdYAZS4Y4oVb35JOpFqTI YdqJAcQapYjsaKBXV9is4QPnp6ii3FR76gQXAaPpLUbjQZH/+fymCj4bzE991tWPMJbXReslzgG7 9dcKPVbA== X-QQ-XMRINFO: MPJ6Tf5t3I/ycC2BItcBVIA= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Wed, 17 Apr 2024 12:37:39 +0800 X-OQ-MSGID: <20240417043742.505853-5-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240417043742.505853-1-quinkblack@foxmail.com> References: <20240417043742.505853-1-quinkblack@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/8] avcodec/mediacodecenc: Remove write only variable 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: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: XKeKJC9yBQmO From: Zhao Zhili Signed-off-by: Zhao Zhili --- libavcodec/mediacodecenc.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index e562181120..8caaad729a 100644 --- a/libavcodec/mediacodecenc.c +++ b/libavcodec/mediacodecenc.c @@ -352,9 +352,7 @@ bailout: return ret; } -static int mediacodec_receive(AVCodecContext *avctx, - AVPacket *pkt, - int *got_packet) +static int mediacodec_receive(AVCodecContext *avctx, AVPacket *pkt) { MediaCodecEncContext *s = avctx->priv_data; FFAMediaCodec *codec = s->codec; @@ -400,7 +398,7 @@ static int mediacodec_receive(AVCodecContext *avctx, memcpy(s->extradata, out_buf + out_info.offset, out_info.size); ff_AMediaCodec_releaseOutputBuffer(codec, index, false); // try immediately - return mediacodec_receive(avctx, pkt, got_packet); + return mediacodec_receive(avctx, pkt); } ret = ff_get_encode_buffer(avctx, pkt, out_info.size + s->extradata_size, 0); @@ -419,7 +417,6 @@ static int mediacodec_receive(AVCodecContext *avctx, if (out_info.flags & ff_AMediaCodec_getBufferFlagKeyFrame(codec)) pkt->flags |= AV_PKT_FLAG_KEY; ret = 0; - *got_packet = 1; av_log(avctx, AV_LOG_TRACE, "receive packet pts %" PRId64 " dts %" PRId64 " flags %d extradata %d\n", @@ -510,7 +507,6 @@ static int mediacodec_encode(AVCodecContext *avctx, AVPacket *pkt) { MediaCodecEncContext *s = avctx->priv_data; int ret; - int got_packet = 0; // Return on three case: // 1. Serious error @@ -525,7 +521,7 @@ static int mediacodec_encode(AVCodecContext *avctx, AVPacket *pkt) return ret; } - ret = mediacodec_receive(avctx, pkt, &got_packet); + ret = mediacodec_receive(avctx, pkt); if (s->bsf) { if (!ret || ret == AVERROR_EOF) ret = av_bsf_send_packet(s->bsf, pkt); From patchwork Wed Apr 17 04:37:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 48097 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:ce4e:b0:1a9:af23:56c1 with SMTP id id14csp776553pzb; Tue, 16 Apr 2024 21:38:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXicakZ5LSV2cFAvTo9dLHCUPJG6ttFuCRAk4nDlCMc9YNmoyw0Apnn/3itEhbfTo5o/LzQDNsAbrQIv4b/dqeZ0C6D+fGDyVbdLA== X-Google-Smtp-Source: AGHT+IHmHSp2dYB4DxuI4OnZBdbEElrot/NXtAUfP+MdoQiNU4qkF6rVUOKCGLA5LGieoD+UzMic X-Received: by 2002:a50:9e4e:0:b0:56f:e715:d1c7 with SMTP id z72-20020a509e4e000000b0056fe715d1c7mr10701657ede.1.1713328732839; Tue, 16 Apr 2024 21:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713328732; cv=none; d=google.com; s=arc-20160816; b=RFvDsxKN+/4Jq1LiScBnE1jqcUijtzfFrbyFkRjQO9yKoIS9z6EKTYzmXzE5kLxfOi 8N+zA55vLVV2IhiIhKs6QzO5uwEfUDD/ElwwfSJhbZMIQNgu2hL+NzbmexoWaJU7arYO NtwWFXccdLG+AQHiY/Zlq89YXsjyG1/lf9I89WkbDElFqmpUe2Sf6fiGcVolxB6Q4d4u QVwqrtsUvApG1RWULwnwGfgd/keFEAdKL6I65X7DTb0BrfOxcehX0MYkPZDZ7KCJ7n8N UdVYsH3hIKYztLAAj11C1vVat7DkjV5NT2kQTKkSKP2ZwlYT64SLRzw631O9vExRAcO/ xkQQ== 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:date :to:from:message-id:dkim-signature:delivered-to; bh=qLuUXIdL3QATsEx2mOtJS0wjIl7NHFSJbWvB278PD/o=; fh=HnHYuZ9XgUo86ZRXTLWWmQxhslYEI9B9taZ5X1DLFfc=; b=roIeVyS8+m+fS6ddTqKWoBu3OsooITq3RTwjRe2d4ANCBz1aKP6Nt4o/WPXvFDbu41 AboCCV06t4/hsCNUt2q9S8ncGZtt0SE/tBqgE1br4kn7n3OCWCWelOQ/djwr4aTTLgP3 E9S+tqoSCgdK2SDtw1pTO6YciXmIha8Fpko4b1JyZNuDi7m/zLzZQhTQgGkisbHmyVn9 M/QBMN9bj9CPdDmVqudZ9dUyOIFY5nUHo+oKnOKXQQ1zPZg9YrN8ID9PgXy3WZWW7EXd vuFxxLM3Ia/WGLUcS+ztDBtIfA+56C63xsIvUg09908jF8MsxabXoq1jbtSgHjEGjiHH duXw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=WvaGGEip; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id f21-20020a50a6d5000000b0056c06e3883dsi6471835edc.311.2024.04.16.21.38.52; Tue, 16 Apr 2024 21:38:52 -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; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=WvaGGEip; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 804AB68D22E; Wed, 17 Apr 2024 07:38:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-221-192.mail.qq.com (out203-205-221-192.mail.qq.com [203.205.221.192]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4983568CF59 for ; Wed, 17 Apr 2024 07:37:54 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1713328666; bh=3RqoSg7r9WYFeKd5gKwryIuSypD8sKKkt5AOh7l/Wbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WvaGGEipBCxLuszyevM5caoIIQJ/NGAiIMpAhqvmupx849DNQtKbssDTXEay4hPlh 9NUraA0lmEerqEIJgq01uXLXFRn2vD9Ylp6WE/9bDRpegNB+VmQCDMbRlMk59L+ut7 BC1cc9CjwbFZryHNb6kBral/W34/YTqD/3tU+hhc= Received: from localhost.localdomain ([119.147.10.204]) by newxmesmtplogicsvrsza30-0.qq.com (NewEsmtp) with SMTP id 96A0DC1B; Wed, 17 Apr 2024 12:37:42 +0800 X-QQ-mid: xmsmtpt1713328665tu09feff4 Message-ID: X-QQ-XMAILINFO: NssJ/YX50roakP4HDC5TB9nfdVx8Abtm8GUkTvyLrK8R81buocxw2Xqooww36D wZB8DnUdVc/iZ2bGZER3vvSU+ugjC3UnuOz2xPRH9V0Fy3lzsFXGudgbgwTLRK4kYbbNP81E8FVd qrjgKT0txqLS4L1A92LVA6yA9XjmLkPYwc8MTz4epSyMy1SZ12rtyiYU6ehYE7JDcUsdc6Hv1pfp aTBjwAtCr7QmBLf/UMRdOKzRMe6QiMNY/SCMKpQmZPnon6h3Gi6vxUxUYGE5+ir/6gEXN58Z2Ah0 3cGWuYdo1gBkFUsZVgR0nHbRaiY3SRFEGLCGm+83rsa2giVZvCTaX31ysNMUU4Q4eCKjf4y174dD bI2axuO/jG78E7nQ0uUVH9WTpUfxUuQTK0HD9LX/1wpdP6qJ3beoa1HrzwYVVfMC59Vloc8t6DFM VI1Sbq2AFLvco68o+AwurwTbZEOi1Ht8s32+BCfBOXj2Fvnw+6qx6/8Cz3LQxRfLzDugMUulq7/g nBukp6sy9DUhYza9XedPxPp4ezTnI6vXmF37tSjk+LVbMVv6vgAPBU2ASN+e0CNLUyeCxLZsOcMq 1PidBmx1NXWEKeoSWdu/bey9eDk1GmXTpEdbH2fTsOyI4i+MMYZi3bpDmal4GqrNPq8SsQ6tSEAu Kn08bVvcM3emBeRNJQbnldVbu64nhU6P90Vq/EalSomgBrN321rIaV5Lf9Dfo0BODSOmD/nxfZQq 4vQ+74soQbiTOmKHD86AUB+lvqWBbHZEPyaYlbhIrQN4S3HyL+hhNaKvPGhBf/ievReFZd3bs4DN mbIHZywjmpjsYIElDAOAFxGMDCdFh21YeTxa0ms2UOidzd8j9YHh9kOLOO53hF+uwAxgBfCCcBCU mgu7gLawuj5Jw1nwFwZs3/QSAgxI+7UtTJTkIef5Y8rupoM9iDJjP4UDryBGCxIsg2+n4QgIXvXz YsXIE/ib4uLYOmLjHke9EabJYWMSDi/dvPwOWx2oYXLwzNS9qL9dKMCE7vQOb2uHrzy5ppTmqi3Y TLgbtieQ== X-QQ-XMRINFO: M/715EihBoGSf6IYSX1iLFg= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Wed, 17 Apr 2024 12:37:40 +0800 X-OQ-MSGID: <20240417043742.505853-6-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240417043742.505853-1-quinkblack@foxmail.com> References: <20240417043742.505853-1-quinkblack@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/8] avcodec/mediacodecenc: Add global header support 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: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: slYTt6KBejHq From: Zhao Zhili The extradata is generated by encoding a dummy frame, then reset the encoder state by mediacodec flush(). It only works for pixel format other than AV_PIX_FMT_MEDIACODEC, since I'm not sure how to create a dummy frame safely with AV_PIX_FMT_MEDIACODEC. Signed-off-by: Zhao Zhili --- configure | 6 +- libavcodec/mediacodecenc.c | 166 +++++++++++++++++++++++++++++++++---- 2 files changed, 155 insertions(+), 17 deletions(-) diff --git a/configure b/configure index d0d0e8430b..4da1c0be35 100755 --- a/configure +++ b/configure @@ -3313,6 +3313,7 @@ ac3_mf_encoder_deps="mediafoundation" av1_cuvid_decoder_deps="cuvid CUVIDAV1PICPARAMS" av1_mediacodec_decoder_deps="mediacodec" av1_mediacodec_encoder_deps="mediacodec" +av1_mediacodec_encoder_select="extract_extradata_bsf" av1_nvenc_encoder_deps="nvenc NV_ENC_PIC_PARAMS_AV1" av1_nvenc_encoder_select="atsc_a53" h263_v4l2m2m_decoder_deps="v4l2_m2m h263_v4l2_m2m" @@ -3323,7 +3324,7 @@ h264_cuvid_decoder_select="h264_mp4toannexb_bsf" h264_mediacodec_decoder_deps="mediacodec" h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_parser" h264_mediacodec_encoder_deps="mediacodec" -h264_mediacodec_encoder_select="h264_metadata" +h264_mediacodec_encoder_select="extract_extradata_bsf h264_metadata" h264_mf_encoder_deps="mediafoundation" h264_mmal_decoder_deps="mmal" h264_nvenc_encoder_deps="nvenc" @@ -3343,7 +3344,7 @@ hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf" hevc_mediacodec_decoder_deps="mediacodec" hevc_mediacodec_decoder_select="hevc_mp4toannexb_bsf hevc_parser" hevc_mediacodec_encoder_deps="mediacodec" -hevc_mediacodec_encoder_select="hevc_metadata" +hevc_mediacodec_encoder_select="extract_extradata_bsf hevc_metadata" hevc_mf_encoder_deps="mediafoundation" hevc_nvenc_encoder_deps="nvenc" hevc_nvenc_encoder_select="atsc_a53" @@ -3375,6 +3376,7 @@ mpeg2_v4l2m2m_decoder_deps="v4l2_m2m mpeg2_v4l2_m2m" mpeg4_cuvid_decoder_deps="cuvid" mpeg4_mediacodec_decoder_deps="mediacodec" mpeg4_mediacodec_encoder_deps="mediacodec" +mpeg4_mediacodec_encoder_select="extract_extradata_bsf" mpeg4_mmal_decoder_deps="mmal" mpeg4_omx_encoder_deps="omx" mpeg4_v4l2m2m_decoder_deps="v4l2_m2m mpeg4_v4l2_m2m" diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index 8caaad729a..64816ccf0a 100644 --- a/libavcodec/mediacodecenc.c +++ b/libavcodec/mediacodecenc.c @@ -23,6 +23,7 @@ #include "config_components.h" #include "libavutil/avassert.h" +#include "libavutil/avstring.h" #include "libavutil/hwcontext_mediacodec.h" #include "libavutil/imgutils.h" #include "libavutil/mem.h" @@ -74,6 +75,7 @@ typedef struct MediaCodecEncContext { int bitrate_mode; int level; int pts_as_dts; + int extract_extradata; } MediaCodecEncContext; enum { @@ -112,6 +114,23 @@ static void mediacodec_output_format(AVCodecContext *avctx) ff_AMediaFormat_delete(out_format); } +static int extract_extradata_support(AVCodecContext *avctx) +{ + const AVBitStreamFilter *bsf = av_bsf_get_by_name("extract_extradata"); + + if (!bsf) { + av_log(avctx, AV_LOG_WARNING, "extract_extradata bsf not found\n"); + return 0; + } + + for (int i = 0; bsf->codec_ids[i] != AV_CODEC_ID_NONE; i++) { + if (bsf->codec_ids[i] == avctx->codec_id) + return 1; + } + + return 0; +} + static int mediacodec_init_bsf(AVCodecContext *avctx) { MediaCodecEncContext *s = avctx->priv_data; @@ -120,20 +139,32 @@ static int mediacodec_init_bsf(AVCodecContext *avctx) int crop_right = s->width - avctx->width; int crop_bottom = s->height - avctx->height; - if (!crop_right && !crop_bottom) + /* Nothing can be done for this format now */ + if (avctx->pix_fmt == AV_PIX_FMT_MEDIACODEC) return 0; - if (avctx->codec_id == AV_CODEC_ID_H264) - ret = snprintf(str, sizeof(str), "h264_metadata=crop_right=%d:crop_bottom=%d", - crop_right, crop_bottom); - else if (avctx->codec_id == AV_CODEC_ID_HEVC) - ret = snprintf(str, sizeof(str), "hevc_metadata=crop_right=%d:crop_bottom=%d", - crop_right, crop_bottom); - else + s->extract_extradata = (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) && + extract_extradata_support(avctx); + if (!crop_right && !crop_bottom && !s->extract_extradata) return 0; - if (ret >= sizeof(str)) - return AVERROR_BUFFER_TOO_SMALL; + ret = 0; + if (crop_right || crop_bottom) { + if (avctx->codec_id == AV_CODEC_ID_H264) + ret = snprintf(str, sizeof(str), "h264_metadata=crop_right=%d:crop_bottom=%d", + crop_right, crop_bottom); + else if (avctx->codec_id == AV_CODEC_ID_HEVC) + ret = snprintf(str, sizeof(str), "hevc_metadata=crop_right=%d:crop_bottom=%d", + crop_right, crop_bottom); + if (ret >= sizeof(str)) + return AVERROR_BUFFER_TOO_SMALL; + } + + if (s->extract_extradata) { + ret = av_strlcatf(str, sizeof(str), "%sextract_extradata", ret ? "," : ""); + if (ret >= sizeof(str)) + return AVERROR_BUFFER_TOO_SMALL; + } ret = av_bsf_list_parse_str(str, &s->bsf); if (ret < 0) @@ -148,6 +179,8 @@ static int mediacodec_init_bsf(AVCodecContext *avctx) return ret; } +static int mediacodec_generate_extradata(AVCodecContext *avctx); + static av_cold int mediacodec_init(AVCodecContext *avctx) { const char *codec_mime = NULL; @@ -337,14 +370,14 @@ static av_cold int mediacodec_init(AVCodecContext *avctx) goto bailout; mediacodec_output_format(avctx); - if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) - av_log(avctx, AV_LOG_WARNING, - "Mediacodec encoder doesn't support AV_CODEC_FLAG_GLOBAL_HEADER. " - "Use extract_extradata bsf when necessary.\n"); s->frame = av_frame_alloc(); - if (!s->frame) + if (!s->frame) { ret = AVERROR(ENOMEM); + goto bailout; + } + + ret = mediacodec_generate_extradata(avctx); bailout: if (format) @@ -549,6 +582,109 @@ static int mediacodec_encode(AVCodecContext *avctx, AVPacket *pkt) return 0; } +static int mediacodec_send_dummy_frame(AVCodecContext *avctx) +{ + MediaCodecEncContext *s = avctx->priv_data; + int ret; + + s->frame->width = avctx->width; + s->frame->height = avctx->height; + s->frame->format = avctx->pix_fmt; + s->frame->pts = 0; + + ret = av_frame_get_buffer(s->frame, 0); + if (ret < 0) + return ret; + + do { + ret = mediacodec_send(avctx, s->frame); + } while (ret == AVERROR(EAGAIN)); + av_frame_unref(s->frame); + + if (ret < 0) + return ret; + + ret = mediacodec_send(avctx, NULL); + if (ret < 0) { + av_log(avctx, AV_LOG_ERROR, "Flush failed: %s\n", av_err2str(ret)); + return ret; + } + + return 0; +} + +static int mediacodec_receive_dummy_pkt(AVCodecContext *avctx, AVPacket *pkt) +{ + MediaCodecEncContext *s = avctx->priv_data; + int ret; + + do { + ret = mediacodec_receive(avctx, pkt); + } while (ret == AVERROR(EAGAIN)); + + if (ret < 0) + return ret; + + do { + ret = av_bsf_send_packet(s->bsf, pkt); + if (ret < 0) + return ret; + ret = av_bsf_receive_packet(s->bsf, pkt); + } while (ret == AVERROR(EAGAIN)); + + return ret; +} + +static int mediacodec_generate_extradata(AVCodecContext *avctx) +{ + MediaCodecEncContext *s = avctx->priv_data; + AVPacket *pkt = NULL; + int ret; + size_t side_size; + uint8_t *side; + + if (!(avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER)) + return 0; + + if (!s->extract_extradata) { + av_log(avctx, AV_LOG_WARNING, + "Mediacodec encoder doesn't support AV_CODEC_FLAG_GLOBAL_HEADER. " + "Use extract_extradata bsf when necessary.\n"); + return 0; + } + + pkt = av_packet_alloc(); + if (!pkt) + return AVERROR(ENOMEM); + + ret = mediacodec_send_dummy_frame(avctx); + if (ret < 0) + goto bailout; + ret = mediacodec_receive_dummy_pkt(avctx, pkt); + if (ret < 0) + goto bailout; + + side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); + if (side && side_size > 0) { + avctx->extradata = av_mallocz(side_size + AV_INPUT_BUFFER_PADDING_SIZE); + if (!avctx->extradata) { + ret = AVERROR(ENOMEM); + goto bailout; + } + + memcpy(avctx->extradata, side, side_size); + avctx->extradata_size = side_size; + } + +bailout: + if (s->eof_sent) { + s->eof_sent = 0; + ff_AMediaCodec_flush(s->codec); + } + av_packet_free(&pkt); + return ret; +} + static av_cold int mediacodec_close(AVCodecContext *avctx) { MediaCodecEncContext *s = avctx->priv_data; From patchwork Wed Apr 17 04:37:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 48098 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:ce4e:b0:1a9:af23:56c1 with SMTP id id14csp776586pzb; Tue, 16 Apr 2024 21:39:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXa29u2hbGnZCApb/ac/bzdm1dNQHRSytcmkW0yXJmjebABKwjxL92pNixotJeAXFSZmQ44aSDxupbQyoXgvosEZgGXMGBbQ/MKFQ== X-Google-Smtp-Source: AGHT+IHy/s2MYUmU7vQYwJpj07es6erwyRXgDqmu1dcJNcRGA5QnG6pQIehY1NFWL9zA/m1dumST X-Received: by 2002:a50:d611:0:b0:56f:e609:743 with SMTP id x17-20020a50d611000000b0056fe6090743mr10716957edi.35.1713328741684; Tue, 16 Apr 2024 21:39:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713328741; cv=none; d=google.com; s=arc-20160816; b=GSyoxkx+C+DvrO9D10sb22PR/HLcZ/aJprnyQC/wvFJkDojjANxB2eCWy0gti1X4+0 tGf2JpZmEM1CjAfeAPBf5EVEILuP4ieios6ViHSCFp4JrJsIAPX66qmb57CAr5Ewxnjw yWrlF4sZ07Wa1WDSqSbYbp5+zlT9TYmvsp7/Cs7tjVmMUwOnTzrVSSJCsKr0OAGfJARj SkpWu8xN7w5ce8Fezg18Bi1VF2l/j6kMbuTi5eR/HFrrufVe8UXGow+esIihVX9L9Z79 YkPh6omPbps7zrMvTDrluLHKSJUnpx1bCmF0IjlQfuIB0DDhtxJLiAs0/Ky+BbGVGZXa xfBQ== 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:date :to:from:message-id:dkim-signature:delivered-to; bh=r/Rd0wEEMmPYC+8w7iJe5Ys6Kko2QIv67uoJ35CcGfE=; fh=HnHYuZ9XgUo86ZRXTLWWmQxhslYEI9B9taZ5X1DLFfc=; b=RYMcww9E3yRcuRAPTPSZwnampjDNK1Xa6NgYERnUu8jjA5aq4gI1mVNw4XEVpahrv7 7CLaDB3zRJbwMUXJ2n2rZ24Dn6XFb25ywRK/jfrqpUr1UTbensT+cI/xeCNkBUB+q0RR 6WmQS7zuFNC2a9IbVRBo+TVaB3KVq9q5M7z8zPgImEaTacswrbBJUUI2SmHVCmGWISuQ OfQG0+LoZz1+Gdc68V/WZqowMqD8ztFgWXmEmNDDke21LIBAtbTxLYD7Kh4CoxiwsFUz qGNKx21I9csfVWw94qBmLM/uZb/+rcZ/JXh15kAHlG7JaGgdJ9Tcr26OjbnaHiviOeVu PrRA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b="cJ9PW/zo"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ew5-20020a056402538500b0056df9d6b14asi6364854edb.442.2024.04.16.21.39.01; Tue, 16 Apr 2024 21:39:01 -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; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b="cJ9PW/zo"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9E59468D2CE; Wed, 17 Apr 2024 07:38:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-221-192.mail.qq.com (out203-205-221-192.mail.qq.com [203.205.221.192]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DF42B68D02E for ; Wed, 17 Apr 2024 07:37:54 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1713328666; bh=Yp+obAj1bIdedzU0YwBoKdR4rOC+yWg4F4J9N/6Zveo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=cJ9PW/zofxRln1NTx1yVO00JM5pNQwJM4g42/uxmJYyn9Q8IzF2ZVZ/QjdWIF0a2+ PoaxZLtWtAdv0XVB/qRJsCmcnzIMDWnuUKlo4drt1aZ6OodfTGv873QAvPaL2p5scJ 2h2Vi7WDUhRgY0htrFcvHfyrZm16Tc6DAio6ZgvU= Received: from localhost.localdomain ([119.147.10.204]) by newxmesmtplogicsvrsza30-0.qq.com (NewEsmtp) with SMTP id 96A0DC1B; Wed, 17 Apr 2024 12:37:42 +0800 X-QQ-mid: xmsmtpt1713328665tfxm4e6c7 Message-ID: X-QQ-XMAILINFO: MmPNY57tR1Xnz9xIJ2y+iWjAGO3V0cOIJpUYayCHQ4ey+yvx5grFx4eCf/gftT KgL/wt19ii6ZhL99t/DCysNbpNlTk8i8LPt1F9WkOlMSYvxM8kG1SJmDIwywUtB3hhW0mRvThvTy dlPNllkUtpu1TppxnirLfnaeuvLsJ0NFnsAOJsd9D4Rf92oCwDckn9yP8RJm0rw5iZhgjnrsaURD uh6OVXdKj+R2m5XWm2tRGamLWk8bst3IXCl15BpOCEow/v/AX2CkKMXejXu0Xc2rkfAC2bqFIniH iGoiz0pL1KkLRvhTlzBT4wx3aKyz88XFvIezlFMkJBhUki1gnLtkldtpExbMZ270Ak/Hrn6qXSb/ xFpmzB8hk96uRhFgB7eLfjgAj+2QWX7S+h5JCs0seJRNI/X0zG/iKHMra3kBbiBRWvszGHU6QFKc iIg+LODxL9WP7S4YjnrwnKqbiBz4vpCSKBpzAWkHsbAvvqRIpGrWuIWFxk3ErWQ/D3i/HDNXE+UP uI468gkeBPtOF60WX4/O7HyfhYVnbV3xgZ11fYl0dlq1yzqXf0MMQ21Mq6H05veMrP5diObelepU seICxV/2w05UBlFMTKBQYgnTQtFxKZllQwUEbSr8UFxSr4G/7RM4NoWcAYmn6HspKNTdcqmMMzaX JLveEIqly5W5GHakOz8VDlW/iDoX9MUZU6ifsWgkBf6AtOoLhuRp9l7VNGojoP+SJmQQT/NRnTjN 63csxquCl0BxOeK4KQpITUnHyzLX22HuovCqXl9WF/KL8gLcYVWP76/BMSkiggJY2T5nlbHRTrIF uElSLbCNujUmwVFZXm/eSdXZai48bHPGs+Ws/LYS+ll/r1ZIwEupP8JJ72PprZy+XErsbw2bqZzJ mbPHAbyNualBZ+TyVqLo+miwZg1bJ103uGFwh1A2CUCe6SPUrTF3a8rkDCVOxXtLAsJgKQGS6wxo Z33/OwUnyEXeZmcOUPz7Rqs/3wEN9MdYfgvPRe+0BcallwTBwl+GQlNF/w7a8Q X-QQ-XMRINFO: OWPUhxQsoeAVDbp3OJHYyFg= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Wed, 17 Apr 2024 12:37:41 +0800 X-OQ-MSGID: <20240417043742.505853-7-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240417043742.505853-1-quinkblack@foxmail.com> References: <20240417043742.505853-1-quinkblack@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 7/8] avcodec/mediacodecenc: add AV_CODEC_CAP_ENCODER_FLUSH support 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: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 0Aa+1zDR9qYs From: Zhao Zhili Signed-off-by: Zhao Zhili --- libavcodec/mediacodecenc.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c index 64816ccf0a..c87a0d86c5 100644 --- a/libavcodec/mediacodecenc.c +++ b/libavcodec/mediacodecenc.c @@ -705,6 +705,15 @@ static av_cold int mediacodec_close(AVCodecContext *avctx) return 0; } +static av_cold void mediacodec_flush(AVCodecContext *avctx) +{ + MediaCodecEncContext *s = avctx->priv_data; + if (s->bsf) + av_bsf_flush(s->bsf); + av_frame_unref(s->frame); + ff_AMediaCodec_flush(s->codec); +} + static const AVCodecHWConfigInternal *const mediacodec_hw_configs[] = { &(const AVCodecHWConfigInternal) { .public = { @@ -755,13 +764,15 @@ const FFCodec ff_ ## short_name ## _mediacodec_encoder = { \ CODEC_LONG_NAME(long_name " Android MediaCodec encoder"), \ .p.type = AVMEDIA_TYPE_VIDEO, \ .p.id = codec_id, \ - .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY \ - | AV_CODEC_CAP_HARDWARE, \ + .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | \ + AV_CODEC_CAP_HARDWARE | \ + AV_CODEC_CAP_ENCODER_FLUSH, \ .priv_data_size = sizeof(MediaCodecEncContext), \ .p.pix_fmts = avc_pix_fmts, \ .init = mediacodec_init, \ FF_CODEC_RECEIVE_PACKET_CB(mediacodec_encode), \ .close = mediacodec_close, \ + .flush = mediacodec_flush, \ .p.priv_class = &short_name ## _mediacodec_class, \ .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, \ .p.wrapper_name = "mediacodec", \ From patchwork Wed Apr 17 04:37:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 48099 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:ce4e:b0:1a9:af23:56c1 with SMTP id id14csp776612pzb; Tue, 16 Apr 2024 21:39:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVPmQoGebeh0lWfW03eWyro90oFK1pusOUQtJ6DQIBaOZ6MaLFtZF+nxdIqeg1DHfCkZBEH90weVNGsYRK/D5yzJuSSE7D9JmZvkw== X-Google-Smtp-Source: AGHT+IFv4j1Ce+X9DwvSpwVgJakhdj/XSPW8pSrzD5sicz9w4I3NAdb2+hYMuhYeBLKpfH6CIj84 X-Received: by 2002:a05:6512:684:b0:518:b180:3f94 with SMTP id t4-20020a056512068400b00518b1803f94mr7514800lfe.2.1713328750420; Tue, 16 Apr 2024 21:39:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713328750; cv=none; d=google.com; s=arc-20160816; b=xo3P4c1RkvgOZCnpQ/WqpQ9TEkZfzN5a869HXesu7eehy6Ru967m3Z1wQj9YppC2G5 Mt59umHWGGJ3TBB/wbQxYC26+GZMjMEri31TsGDLNpSOfdKl0NqoKuEmJkmb1DkU/+XE zKFElh9/p3pSNF2donlfUijEP1vOBmKCB1nWrtlg77U1Jcni+rSS2EvR8UQbIRY+nRiH +ghJNAysPXFvuIxoDpXzb3zTWWix0YcjTjwdIyFHetmnmlbVMHluxI97MGWQeLV18GbM 0pad02wR4IHNc7yCIClYVIGX2GNxVj288UnT7mTDrxrOukmfkpR/YSoEmlQ96wdH/Ara EIDQ== 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:date :to:from:message-id:dkim-signature:delivered-to; bh=KcR7VzH3C0gdFCJHnjJdMK09OXnt1MmszluimWHwYrY=; fh=HnHYuZ9XgUo86ZRXTLWWmQxhslYEI9B9taZ5X1DLFfc=; b=Akh4n4mzjLnWRdgzGxM2Zz/lxMZeVVBUQLSPAsWIfnjTFxPH4YBrUaYmYI+FykNbE9 powllENzJHrK6YxrHs5f0Njxmmd3gZVS30ZYUcvqe7GyWSToHo+1/Wv+MSL9+CmBSrS3 W/PHVsBZuBACxoovSRsFkxhr/wH3amYCEF4ECk4sijyslxBP2aOgFDcz0ut75V3Ac7bz pXO9KXzV0Djs+aNlXvuF222Dy7qmgsY4OlMUSKIEa+YWNzL7XpBQ/AWgFc8C42PJRv8Y D3VIRvBGqznF3Hj5eruKA9urkQDwWkzwVzOb4bij3WMgDkuVKa2bPD1+86ocGxp50f0L Upvw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=khTJ8TB6; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id cw21-20020a170906479500b00a4e8ac27ab1si6628397ejc.443.2024.04.16.21.39.10; Tue, 16 Apr 2024 21:39:10 -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; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=khTJ8TB6; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8951A68D2EC; Wed, 17 Apr 2024 07:38:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-221-202.mail.qq.com (out203-205-221-202.mail.qq.com [203.205.221.202]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0629D68D0BD for ; Wed, 17 Apr 2024 07:37:54 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1713328667; bh=9UnogwGWokyMcLb1ihA8soSngUgUUE06pKvzeVXeqtQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=khTJ8TB6Xjo+317HLg3PLusd0mNQevgWLt+qpZ/OSEa5IgTPkkBuVCgnUqrEKURvq Gjd6RIznuzI25iId1cBvDULitQdUQ9EhAbqfx9gQgFbY6BiU4zcPpXTlgtaz1oZ0H+ 1Uw9l07bKpAaq1JnU6IpM+kyqNSvRqaNjJ3f6MqU= Received: from localhost.localdomain ([119.147.10.204]) by newxmesmtplogicsvrsza30-0.qq.com (NewEsmtp) with SMTP id 96A0DC1B; Wed, 17 Apr 2024 12:37:42 +0800 X-QQ-mid: xmsmtpt1713328666ty7kyiwyc Message-ID: X-QQ-XMAILINFO: NMGzQWUSIfvTt0Q9GDB1RBOaCb+BDJeAwrunL8OedjvIEGdFaimtnx7p5I9kFP IJ4bZgNmaoLk5UzOA8uFnu/iFsPePjMSE7N6MGRCdOu6HEE2I4rbmgprCZujVhFg7ua0hzeSnAC2 0InmMHiHOQLA8A1yx1fX2iHFRFFSGYa1ompYMsrZ20KvJDLtaROlpNW7Nl/QioDVFUlbokjufA8S rXFG/11YtCmQzdok+KHkmKbuhFGwF0s0p4HNiipc93+amq/AxIFQGtDxJNwX99sbvsKstPDLBVHo esmsYf901kGiY655Agi2sZk9JnzBdyJL3ttkrsbbcB81OIpjGBEcBS+78CDkzoKW6zy/3Tvkdjvg xeHaY0ubqhv/7rXOJB51rXugXSmdNt68p0bzE5tqu60WQQAIQ2PZujHqO3ZA6Pi5VitIM3A0JHXu igDpcqja5Zp2k3v3J1ldUtsC9KKv7mrUdL8aRzFBANwobYDpMHswUMHQBYtLX7qcteCrA33NjlS0 EKTaYlD1IUdXK29eAjsK482VYWzi0iNmpQfNjAWeIGHX15LTrAG3KmwJ53iq6RW4WexqoLJcJT1t YGd2MA0xWahjDEhXc7Nel2P69uNhWaC5RIOV+42HzFJNNRtpG6+R8o4j/TXUEV+f15XtiG6YXMCW ZOVTLYtuI7kND/HiiKMFwYwrFdykcJRj6eMUT5wBUrc3hwkZib+EC94PAiLyTo5KeZn8bh+bC/UI M1iuxpaA0BryFNCyCDzynVeuZj+W0ydtCsK/mWXVgX/V7z39J/4kWka7C4XR0m2zcYOJsxg9lLWC kJZjw0//IIi8pT0RDgpMNIjcXz305yOYXkWXkkIIGsbwifcJR2/6G6puc53cgdt/M3GI+OBdrNv7 SgiEXj94jQ6b7Oq7qLIKvcajl18pEj1Pt4PDVPn3T1TagdEahSmrAJkxAiT28kdR3gGkFI0rhBgM fbVTpFh7OHhVBxzWAwdeysNZ/XMi7qfrQWHJfi4v4s23opGmC04aQn/PbmvzpsgPyZwM91sl3bEx cs13wiDRNvVMPHA0R9 X-QQ-XMRINFO: MSVp+SPm3vtS1Vd6Y4Mggwc= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Wed, 17 Apr 2024 12:37:42 +0800 X-OQ-MSGID: <20240417043742.505853-8-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240417043742.505853-1-quinkblack@foxmail.com> References: <20240417043742.505853-1-quinkblack@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 8/8] fftools: Fix implicit-const-int-float-conversion warning 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: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: w0OWYGRu8R5t From: Zhao Zhili --- fftools/cmdutils.c | 2 +- fftools/ffmpeg_opt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 2120fc7935..a8f5c6d89b 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -311,7 +311,7 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt, *(int *)dst = num; } else if (po->type == OPT_TYPE_INT64) { - ret = parse_number(opt, arg, OPT_TYPE_INT64, INT64_MIN, INT64_MAX, &num); + ret = parse_number(opt, arg, OPT_TYPE_INT64, INT64_MIN, (double)INT64_MAX, &num); if (ret < 0) goto finish; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 6526e8e3e8..910e4a336b 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -317,7 +317,7 @@ static int opt_filter_threads(void *optctx, const char *opt, const char *arg) static int opt_abort_on(void *optctx, const char *opt, const char *arg) { static const AVOption opts[] = { - { "abort_on" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" }, + { "abort_on" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, (double)INT64_MAX, .unit = "flags" }, { "empty_output" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = ABORT_ON_FLAG_EMPTY_OUTPUT }, .unit = "flags" }, { "empty_output_stream", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = ABORT_ON_FLAG_EMPTY_OUTPUT_STREAM }, .unit = "flags" }, { NULL },