From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 75F8C495D7 for ; Tue, 13 Feb 2024 23:05:08 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EA3D368CB57; Wed, 14 Feb 2024 01:04:52 +0200 (EET) Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 30CEA68D17B for ; Wed, 14 Feb 2024 01:04:47 +0200 (EET) Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6e0a5472e7cso2043511b3a.2 for ; Tue, 13 Feb 2024 15:04:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707865485; x=1708470285; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=W+yHBKMj0b+ak/bFXoP9nSnxmjfg28Qeu+efMNfq8Vw=; b=FZDL6ZXtDSh8cpGZzUyd1VJlna4LJWu1xd7tPaK5BFDnAoXtJhfdhxSaDuV7Js9i4j heyhFCApVo5wAYf/RpkoNcXmy8NHqfiB2Gpcbk2gi8cdgtErgCyAeoFxgY3vwGubYRtL cdpMdXGyat1p6vgGLxPojiF16NGAX4uYDo/KMgmwM+3L1lu2tRhdA+GdChrbQtlsZwEU YwsWWbYGeR8F/2i8NjDsSkj4+sMBCFUoFm1sH3zy1WSBenHjas0j6+BMj6l1UwD93j7+ 1ArOLbQLdB8H9+QNjz0yR0O3lZyT4Qht/QWDeEYDjeQ9fJ5m5sH3aES2chfDCgHCt3Od 0bnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707865485; x=1708470285; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W+yHBKMj0b+ak/bFXoP9nSnxmjfg28Qeu+efMNfq8Vw=; b=iFbkFyLgJQjzpkQjpKOvzaZB917L8spvA2WwMCzlOcvT0kmnbiDLSZwEHOjUIjlneW oesBqWAwu1RUI802hNdx88v9fRNS7FHjiQcS8rLH3MepZRZo6Puzi/teNUKHgTTnKPuw OMynVvY1ib6/4sVfFh9jlVHJeZp43B2qiGxL8asw7LWgv3AXR+NwrLVckSCxZDjPodlG eoZmBg2RxbdRMVkNP51SpQWsLXpp0GLUGmDj1UireP+2PcptXswxjuBP8O5FDOTxFQ7t Kgg6nvV+7IDxQOUJYHU6/pKIj7Pd+vNH1pZP6i9G4N8dJNG5H9m2Ks2njIEJ0F+tCrEB pqEg== X-Gm-Message-State: AOJu0YykCfC5Nji9eD0l5iiI+yfiLoElQ/N0609Osa4xAIyK91mnNuJw 2JWq5N/zi64FmXnzUVe7knfOytI12wCYigDCnIP6z/mDt0BpIi7hcpcQyMSE X-Google-Smtp-Source: AGHT+IF//PWDtIEbM8SsQp5SOw/EOuiCYPhuqTakJucSZ/BMJmx3vzYtJqDFY85Vg53VwzqD4wad9Q== X-Received: by 2002:a05:6a21:1644:b0:19e:cf31:6a04 with SMTP id no4-20020a056a21164400b0019ecf316a04mr1108399pzb.59.1707865485430; Tue, 13 Feb 2024 15:04:45 -0800 (PST) Received: from localhost.localdomain (2a01cb040b6872000000000000000afa.ipv6.abo.wanadoo.fr. [2a01:cb04:b68:7200::afa]) by smtp.gmail.com with ESMTPSA id l13-20020a170903244d00b001da294ff6d5sm2580098pls.189.2024.02.13.15.04.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 15:04:45 -0800 (PST) From: Matthieu Bouron To: ffmpeg-devel@ffmpeg.org Date: Tue, 13 Feb 2024 23:50:10 +0100 Message-ID: <20240213230418.457056-3-matthieu.bouron@gmail.com> X-Mailer: git-send-email 2.43.1 In-Reply-To: <20240213230418.457056-1-matthieu.bouron@gmail.com> References: <20240213230418.457056-1-matthieu.bouron@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/7] avutil: add av_jni_{get, set}_android_app_ctx helper 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: Matthieu Bouron Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: This will allow users to pass the Android ApplicationContext which is mandatory to retrieve the ContentResolver responsible to resolve/open Android content-uri. --- libavutil/jni.c | 28 ++++++++++++++++++++++++++++ libavutil/jni.h | 17 +++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/libavutil/jni.c b/libavutil/jni.c index 541747cb20..d6f96717b0 100644 --- a/libavutil/jni.c +++ b/libavutil/jni.c @@ -34,6 +34,7 @@ #include "libavutil/jni.h" static void *java_vm; +static void *android_app_ctx; static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; int av_jni_set_jvm(void *vm, void *log_ctx) @@ -63,6 +64,24 @@ void *av_jni_get_jvm(void *log_ctx) return vm; } +void av_jni_set_android_app_ctx(void *app_ctx) +{ + pthread_mutex_lock(&lock); + android_app_ctx = app_ctx; + pthread_mutex_unlock(&lock); +} + +void *av_jni_get_android_app_ctx(void) +{ + void *ctx; + + pthread_mutex_lock(&lock); + ctx = android_app_ctx; + pthread_mutex_unlock(&lock); + + return ctx; +} + #else int av_jni_set_java_vm(void *vm, void *log_ctx) @@ -75,4 +94,13 @@ void *av_jni_get_java_vm(void *log_ctx) return NULL; } +void av_jni_set_android_app_ctx(void *app_ctx) +{ +} + +void *av_jni_get_android_app_ctx(void) +{ + return NULL; +} + #endif diff --git a/libavutil/jni.h b/libavutil/jni.h index 700960dbb8..630f4074a1 100644 --- a/libavutil/jni.h +++ b/libavutil/jni.h @@ -43,4 +43,21 @@ int av_jni_set_jvm(void *vm, void *log_ctx); */ void *av_jni_get_jvm(void *log_ctx); +/* + * Set the Android application context which will be used to retrieve the Android + * content resolver to resolve content uris. + * + * @param app_ctx global JNI reference to the Android application context + */ +void av_jni_set_android_app_ctx(void *app_ctx); + +/* + * Get the Android application context that has been set with + * av_jni_set_android_app_ctx. + * + * @return a pointer the the Android application context + */ +void *av_jni_get_android_app_ctx(void); + + #endif /* AVUTIL_JNI_H */ -- 2.43.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".