Skip to content

Commit

Permalink
[droidmedia] Add support for Android 11 base. JB#55673
Browse files Browse the repository at this point in the history
  • Loading branch information
mlehtima committed Sep 30, 2021
1 parent 8829b9d commit 6b0bce9
Show file tree
Hide file tree
Showing 8 changed files with 853 additions and 12 deletions.
46 changes: 37 additions & 9 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,27 @@ LOCAL_SHARED_LIBRARIES += [email protected] \
libmedia_omx
endif

ifeq ($(shell test $(ANDROID_MAJOR) -ge 11 && echo true),true)
LOCAL_SHARED_LIBRARIES += libmedia_codeclist
endif

LOCAL_CPPFLAGS=-DANDROID_MAJOR=$(ANDROID_MAJOR) -DANDROID_MINOR=$(ANDROID_MINOR) -DANDROID_MICRO=$(ANDROID_MICRO) $(FORCE_HAL_PARAM) -Wno-unused-parameter
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libdroidmedia

ifeq ($(strip $(ANDROID_MAJOR)),7)
ifeq ($(shell test $(ANDROID_MAJOR) -ge 7 && echo true),true)
LOCAL_C_INCLUDES := frameworks/native/include/media/openmax \
frameworks/native/include/media/hardware
else ifeq ($(shell test $(ANDROID_MAJOR) -ge 8 && echo true),true)
LOCAL_C_INCLUDES := frameworks/native/include/media/openmax \
frameworks/native/include/media/hardware \
frameworks/native/libs/nativewindow/include \
ifeq ($(shell test $(ANDROID_MAJOR) -ge 8 && echo true),true)
LOCAL_C_INCLUDES += frameworks/native/libs/nativewindow/include \
frameworks/av/media/libstagefright/omx/include \
frameworks/av/media/libstagefright/xmlparser/include
endif
ifeq ($(shell test $(ANDROID_MAJOR) -ge 11 && echo true),true)
LOCAL_C_INCLUDES += frameworks/av/media/libmediametrics/include \
frameworks/av/media/libstagefright/include \
frameworks/av/drm/libmediadrm/interface
endif
else
LOCAL_C_INCLUDES := frameworks/native/include/media/openmax
endif
Expand Down Expand Up @@ -145,9 +153,16 @@ ifeq ($(ANDROID_MAJOR),$(filter $(ANDROID_MAJOR),8 9))
LOCAL_SHARED_LIBRARIES += [email protected]
endif

ifeq ($(ANDROID_MAJOR),$(filter $(ANDROID_MAJOR),10))
LOCAL_SHARED_LIBRARIES += [email protected]
endif

ifeq ($(ANDROID_MAJOR),$(filter $(ANDROID_MAJOR),11))
LOCAL_SHARED_LIBRARIES += [email protected]
endif

ifeq ($(shell test $(ANDROID_MAJOR) -ge 10 && echo true),true)
LOCAL_SHARED_LIBRARIES += [email protected] \
[email protected] \
LOCAL_SHARED_LIBRARIES += [email protected] \
libsensorprivacy
LOCAL_AIDL_INCLUDES := frameworks/native/libs/sensorprivacy/aidl
endif
Expand All @@ -168,6 +183,12 @@ ifeq ($(shell test $(ANDROID_MAJOR) -ge 9 && echo true),true)
LOCAL_SHARED_LIBRARIES += [email protected]
endif

ifeq ($(shell test $(ANDROID_MAJOR) -ge 11 && echo true),true)
LOCAL_SHARED_LIBRARIES += libmedia_codeclist \
libresourcemanagerservice \
libbinder_ndk
endif

LOCAL_MODULE_TAGS := optional
LOCAL_CPPFLAGS=-DANDROID_MAJOR=$(ANDROID_MAJOR) -DANDROID_MINOR=$(ANDROID_MINOR) -DANDROID_MICRO=$(ANDROID_MICRO) -Wno-unused-parameter
ifeq ($(MINIMEDIA_SENSORSERVER_DISABLE),1)
Expand Down Expand Up @@ -248,9 +269,16 @@ ifeq ($(ANDROID_MAJOR),$(filter $(ANDROID_MAJOR),8 9))
LOCAL_SHARED_LIBRARIES += [email protected]
endif

ifeq ($(ANDROID_MAJOR),$(filter $(ANDROID_MAJOR),10))
LOCAL_SHARED_LIBRARIES += [email protected]
endif

ifeq ($(ANDROID_MAJOR),$(filter $(ANDROID_MAJOR),11))
LOCAL_SHARED_LIBRARIES += [email protected]
endif

ifeq ($(shell test $(ANDROID_MAJOR) -ge 10 && echo true),true)
LOCAL_SHARED_LIBRARIES += [email protected] \
[email protected] \
LOCAL_SHARED_LIBRARIES += [email protected] \
libsensorprivacy
LOCAL_AIDL_INCLUDES := frameworks/native/libs/sensorprivacy/aidl
endif
Expand Down
4 changes: 4 additions & 0 deletions AsyncDecodingSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
#include "AsyncDecodingSource.h"
#include <utils/Log.h>
#include <gui/Surface.h>
#if ANDROID_MAJOR >= 11
#include <mediadrm/ICrypto.h>
#else
#include <media/ICrypto.h>
#endif
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/foundation/ALooper.h>
#include <media/stagefright/foundation/AMessage.h>
Expand Down
2 changes: 1 addition & 1 deletion AsyncDecodingSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <media/stagefright/foundation/AString.h>
#include <media/stagefright/foundation/Mutexed.h>
#include <media/stagefright/foundation/AHandlerReflector.h>
#if ANDROID_MAJOR >= 9
#if ANDROID_MAJOR >= 9 && ANDROID_MAJOR <= 10
#include <media/MediaSource.h>
#else
#include <media/stagefright/MediaSource.h>
Expand Down
20 changes: 20 additions & 0 deletions droidmediacamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ class CameraListener : public android::CameraListener {
switch (dataMsgType) {
case CAMERA_MSG_RAW_IMAGE:
mem.size = dataPtr->size();
#if ANDROID_MAJOR >= 11
mem.data = dataPtr->unsecurePointer();
#else
mem.data = dataPtr->pointer();
#endif

if (m_cam->m_cb.raw_image_cb) {
m_cam->m_cb.raw_image_cb(m_cam->m_cb_data, &mem);
Expand All @@ -156,7 +160,11 @@ class CameraListener : public android::CameraListener {

case CAMERA_MSG_COMPRESSED_IMAGE:
mem.size = dataPtr->size();
#if ANDROID_MAJOR >= 11
mem.data = dataPtr->unsecurePointer();
#else
mem.data = dataPtr->pointer();
#endif

if (m_cam->m_cb.compressed_image_cb) {
m_cam->m_cb.compressed_image_cb(m_cam->m_cb_data, &mem);
Expand All @@ -165,7 +173,11 @@ class CameraListener : public android::CameraListener {

case CAMERA_MSG_POSTVIEW_FRAME:
mem.size = dataPtr->size();
#if ANDROID_MAJOR >= 11
mem.data = dataPtr->unsecurePointer();
#else
mem.data = dataPtr->pointer();
#endif
if (m_cam->m_cb.postview_frame_cb) {
m_cam->m_cb.postview_frame_cb(m_cam->m_cb_data, &mem);
}
Expand All @@ -179,7 +191,11 @@ class CameraListener : public android::CameraListener {

case CAMERA_MSG_PREVIEW_FRAME:
mem.size = dataPtr->size();
#if ANDROID_MAJOR >= 11
mem.data = dataPtr->unsecurePointer();
#else
mem.data = dataPtr->pointer();
#endif
if (m_cam->m_cb.preview_frame_cb) {
m_cam->m_cb.preview_frame_cb(m_cam->m_cb_data, &mem);
}
Expand Down Expand Up @@ -515,7 +531,11 @@ size_t droid_media_camera_recording_frame_get_size(DroidMediaCameraRecordingData

void *droid_media_camera_recording_frame_get_data(DroidMediaCameraRecordingData *data)
{
#if ANDROID_MAJOR >= 11
return data->mem->unsecurePointer();
#else
return data->mem->pointer();
#endif
}

bool droid_media_camera_enable_face_detection(DroidMediaCamera *camera,
Expand Down
2 changes: 1 addition & 1 deletion droidmediacodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include "AsyncDecodingSource.h"
#endif

#if ANDROID_MAJOR >= 9
#if ANDROID_MAJOR >= 9 && ANDROID_MAJOR <= 10
#include <media/MediaSource.h>
#else
#include <media/stagefright/MediaSource.h>
Expand Down
2 changes: 1 addition & 1 deletion private.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "droidmedia.h"
#include <gui/BufferQueue.h>
#include <camera/Camera.h>
#if ANDROID_MAJOR >= 9
#if ANDROID_MAJOR >= 9 && ANDROID_MAJOR <= 10
#include <media/MediaSource.h>
#else
#include <media/stagefright/MediaSource.h>
Expand Down
3 changes: 3 additions & 0 deletions services/services.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,8 @@
#include "services_10_0_0.h"
#endif

#if ANDROID_MAJOR == 11
#include "services_11_0_0.h"
#endif

#endif
Loading

0 comments on commit 6b0bce9

Please sign in to comment.