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;