replace common qcom sources with samsung ones
This commit is contained in:
27
qcom/opensource/wfd/Android.mk
Normal file
27
qcom/opensource/wfd/Android.mk
Normal file
@@ -0,0 +1,27 @@
|
||||
ifeq ($(BUILD_VIDEO_TECHPACK_SOURCE), true)
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
QMAA_DISABLES_WFD := false
|
||||
ifeq ($(TARGET_USES_QMAA),true)
|
||||
ifneq ($(TARGET_USES_QMAA_OVERRIDE_WFD),true)
|
||||
QMAA_DISABLES_WFD := true
|
||||
endif #TARGET_USES_QMAA_OVERRIDE_WFD
|
||||
endif #TARGET_USES_QMAA
|
||||
|
||||
WFD_DISABLE_PLATFORM_LIST := neo anorak sun
|
||||
|
||||
#Disable WFD for selected 32-bit targets
|
||||
ifeq ($(call is-board-platform,bengal),true)
|
||||
ifeq ($(TARGET_BOARD_SUFFIX),_32)
|
||||
WFD_DISABLE_PLATFORM_LIST += bengal
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(call is-board-platform-in-list,$(WFD_DISABLE_PLATFORM_LIST)),true)
|
||||
ifneq ($(TARGET_HAS_LOW_RAM), true)
|
||||
ifneq ($(QMAA_DISABLES_WFD),true)
|
||||
include $(call all-makefiles-under, $(LOCAL_PATH))
|
||||
endif #QMAA_DISABLES_WFD
|
||||
endif #TARGET_HAS_LOW_RAM
|
||||
endif #WFD_DISABLE_PLATFORM_LIST
|
||||
endif # BUILD_VIDEO_TECHPACK_SOURCE
|
||||
29
qcom/opensource/wfd/libaac/Android.mk
Normal file
29
qcom/opensource/wfd/libaac/Android.mk
Normal file
@@ -0,0 +1,29 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := aacEncode.cpp
|
||||
LOCAL_SRC_FILES += aacDecode.cpp
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)
|
||||
LOCAL_C_INCLUDES += $(TOP)/external/aac/libAACenc/include
|
||||
LOCAL_C_INCLUDES += $(TOP)/external/aac/libAACdec/include
|
||||
LOCAL_C_INCLUDES += $(TOP)/external/aac/libSYS/include
|
||||
|
||||
LOCAL_HEADER_LIBRARIES += libutils_headers
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := liblog
|
||||
LOCAL_SHARED_LIBRARIES += libminijail
|
||||
LOCAL_SHARED_LIBRARIES += libavservices_minijail
|
||||
LOCAL_SHARED_LIBRARIES += vendor.display.config@2.0
|
||||
LOCAL_SHARED_LIBRARIES += libdisplayconfig.qti
|
||||
LOCAL_STATIC_LIBRARIES := libFraunhoferAAC
|
||||
|
||||
LOCAL_VENDOR_MODULE := true
|
||||
|
||||
LOCAL_MULTILIB := 64
|
||||
LOCAL_MODULE := libwfdaac_vendor
|
||||
LOCAL_CFLAGS += -O0
|
||||
|
||||
LOCAL_SANITIZE := integer_overflow
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
125
qcom/opensource/wfd/libaac/aacDecode.cpp
Normal file
125
qcom/opensource/wfd/libaac/aacDecode.cpp
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* */
|
||||
|
||||
#include "aacDecode.h"
|
||||
#include "aacdecoder_lib.h"
|
||||
#include <utils/Log.h>
|
||||
#include <string.h>
|
||||
|
||||
aacDecode::aacDecode() {
|
||||
p_aacHandle = NULL;
|
||||
p_aacInfo = NULL;
|
||||
memset(&s_aacConfig, 0, sizeof(s_aacConfig));
|
||||
}
|
||||
|
||||
aacDecode::~aacDecode() {
|
||||
if(!p_aacHandle) {
|
||||
return;
|
||||
}
|
||||
|
||||
aacDecoder_Close((HANDLE_AACDECODER)p_aacHandle);
|
||||
p_aacHandle = NULL;
|
||||
}
|
||||
|
||||
bool aacDecode::aacConfigure(aacConfigType * p_aacConfig) {
|
||||
if(!p_aacConfig) {
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy(&s_aacConfig, p_aacConfig, sizeof(s_aacConfig));
|
||||
|
||||
p_aacHandle = aacDecoder_Open(TT_MP4_ADTS, 1);
|
||||
|
||||
if(!p_aacHandle) {
|
||||
ALOGE("Failed to open AAC decoder");
|
||||
return false;
|
||||
}
|
||||
|
||||
p_aacInfo = (void*)aacDecoder_GetStreamInfo((HANDLE_AACDECODER)p_aacHandle);
|
||||
|
||||
if(!p_aacInfo) {
|
||||
ALOGE("Failed to get stream info");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Configure AAC decoder */
|
||||
|
||||
aacDecoder_SetParam((HANDLE_AACDECODER)p_aacHandle,
|
||||
AAC_DRC_REFERENCE_LEVEL,
|
||||
64);
|
||||
|
||||
aacDecoder_SetParam((HANDLE_AACDECODER)p_aacHandle,
|
||||
AAC_DRC_ATTENUATION_FACTOR,
|
||||
127);
|
||||
|
||||
aacDecoder_SetParam((HANDLE_AACDECODER)p_aacHandle,
|
||||
AAC_PCM_MAX_OUTPUT_CHANNELS,
|
||||
s_aacConfig.n_channels > 6 ? -1 : s_aacConfig.n_channels);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool aacDecode::aacDecodeFrame(unsigned char* p_buffer, unsigned int n_size) {
|
||||
if(!p_buffer || n_size < 7) {
|
||||
ALOGE("No/Incorrect buffer provided for AAC decoder");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!p_aacHandle) {
|
||||
ALOGE("Decoder handle not available");
|
||||
return false;
|
||||
}
|
||||
|
||||
AAC_DECODER_ERROR err = AAC_DEC_UNKNOWN;
|
||||
|
||||
UINT nSize[] = {(UINT)n_size};
|
||||
UINT nOcc[] = {(UINT)n_size};
|
||||
UCHAR* pBuf[] = {p_buffer};
|
||||
|
||||
err = aacDecoder_Fill((HANDLE_AACDECODER)p_aacHandle, pBuf, nSize, nOcc);
|
||||
|
||||
if(err != AAC_DEC_OK || nOcc[0] != 0) {
|
||||
ALOGE("Error in aacDecoder_Fill");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Fix the alloc length being passed to AAC Decoder since it expects INT_PCM
|
||||
as input buffer but we have it as UINT8. INT_PCM is of type SHORT */
|
||||
|
||||
int factor = sizeof(INT_PCM)/sizeof(unsigned char);
|
||||
int allocLen = (factor == 0) ? n_size : n_size/factor;
|
||||
|
||||
err = aacDecoder_DecodeFrame((HANDLE_AACDECODER)p_aacHandle,
|
||||
(INT_PCM*)p_buffer, allocLen, 0);
|
||||
|
||||
if(err != AAC_DEC_OK) {
|
||||
ALOGE("Failed to decode frame");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
52
qcom/opensource/wfd/libaac/aacDecode.h
Normal file
52
qcom/opensource/wfd/libaac/aacDecode.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#ifndef __AAC_DECODE__
|
||||
#define __AAC_DECODE__
|
||||
/*
|
||||
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* */
|
||||
|
||||
typedef struct aacConfig {
|
||||
unsigned int n_sampleRate;
|
||||
unsigned int n_channels;
|
||||
unsigned int n_bitsPerSample;
|
||||
unsigned int n_bitrate;
|
||||
unsigned int n_samplesPerFrame;
|
||||
}aacConfigType;
|
||||
|
||||
class aacDecode {
|
||||
public:
|
||||
aacDecode();
|
||||
~aacDecode();
|
||||
bool aacConfigure(aacConfigType* p_aacConfig);
|
||||
bool aacDecodeFrame(unsigned char* p_Buffer, unsigned int n_size);
|
||||
|
||||
private:
|
||||
void* p_aacHandle;
|
||||
void* p_aacInfo;
|
||||
aacConfigType s_aacConfig;
|
||||
};
|
||||
#endif
|
||||
151
qcom/opensource/wfd/libaac/aacEncode.cpp
Normal file
151
qcom/opensource/wfd/libaac/aacEncode.cpp
Normal file
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* */
|
||||
|
||||
#include "aacEncode.h"
|
||||
#include "aacenc_lib.h"
|
||||
#include <utils/Log.h>
|
||||
#include <string.h>
|
||||
|
||||
struct aacInfo
|
||||
{
|
||||
AACENC_BufDesc inBuff;
|
||||
AACENC_BufDesc outBuff;
|
||||
AACENC_InArgs inArg;
|
||||
AACENC_OutArgs outArg;
|
||||
};
|
||||
|
||||
aacEncode::aacEncode() {
|
||||
p_aacHandle = NULL;
|
||||
p_aacInfo = NULL;
|
||||
memset(&s_aacConfig, 0, sizeof(s_aacConfig));
|
||||
}
|
||||
|
||||
aacEncode::~aacEncode() {
|
||||
if(!p_aacHandle) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(aacEncClose((HANDLE_AACENCODER*)(&p_aacHandle)) != AACENC_OK) {
|
||||
ALOGE("aacEncClose Failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool aacEncode::aacConfigure(aacConfigType * p_aacConfig) {
|
||||
if(!p_aacConfig) {
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy(&s_aacConfig, p_aacConfig, sizeof(s_aacConfig));
|
||||
|
||||
/* Configure AAC encoder here */
|
||||
|
||||
AACENC_ERROR err = AACENC_OK;
|
||||
|
||||
p_aacInfo = (void*)new(aacInfo);
|
||||
if(!p_aacInfo) {
|
||||
ALOGE("Failed to allocate aacInfo");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Open AAC encoder */
|
||||
err = aacEncOpen((HANDLE_AACENCODER*)(&p_aacHandle),
|
||||
0x01 /* AAC */,
|
||||
s_aacConfig.n_channels);
|
||||
|
||||
if(err != AACENC_OK) {
|
||||
ALOGE("Failed top open AAC encoder");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Set Bitrate and SampleRate */
|
||||
err = aacEncoder_SetParam((HANDLE_AACENCODER)p_aacHandle,
|
||||
AACENC_BITRATE,
|
||||
s_aacConfig.n_bitrate);
|
||||
|
||||
if(err != AACENC_OK) {
|
||||
ALOGE("Failed to set bitrate param to AAC encoder");
|
||||
return false;
|
||||
}
|
||||
|
||||
err = aacEncoder_SetParam((HANDLE_AACENCODER)p_aacHandle,
|
||||
AACENC_SAMPLERATE,
|
||||
s_aacConfig.n_sampleRate);
|
||||
|
||||
if(err != AACENC_OK) {
|
||||
ALOGE("Failed to set samplerate param to AAC encoder");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Fix Channel mode and order */
|
||||
/* TODO */
|
||||
|
||||
/* Prefill encode structures */
|
||||
/* TODO */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool aacEncode::aacEncodeFrame(unsigned char * p_inBuffer,
|
||||
unsigned int n_inSize,
|
||||
unsigned char * p_outBuffer,
|
||||
unsigned int n_outSize,
|
||||
unsigned int * p_length) {
|
||||
(void)n_inSize;
|
||||
(void)n_outSize;
|
||||
(void)p_length;
|
||||
if(!p_inBuffer || !p_outBuffer) {
|
||||
ALOGE("No buffers provided for AAC encoder");
|
||||
return false;
|
||||
}
|
||||
|
||||
aacInfo *tempAacInfo = (aacInfo*)p_aacInfo;
|
||||
tempAacInfo->inBuff.bufs = (void**) (&p_inBuffer);
|
||||
tempAacInfo->outBuff.bufs = (void**) (&p_outBuffer);
|
||||
|
||||
AACENC_ERROR err = AACENC_OK;
|
||||
|
||||
if(p_aacHandle) {
|
||||
err = aacEncEncode((HANDLE_AACENCODER)p_aacHandle,
|
||||
&tempAacInfo->inBuff,
|
||||
&tempAacInfo->outBuff,
|
||||
&tempAacInfo->inArg,
|
||||
&tempAacInfo->outArg);
|
||||
|
||||
if(err != AACENC_OK) {
|
||||
ALOGE("Failed to encode buffer");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
ALOGE("No encoder available");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
55
qcom/opensource/wfd/libaac/aacEncode.h
Normal file
55
qcom/opensource/wfd/libaac/aacEncode.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#ifndef __AAC_ENCODE__
|
||||
#define __AAC_ENCODE__
|
||||
/*
|
||||
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* */
|
||||
typedef struct aacConfig {
|
||||
unsigned int n_sampleRate;
|
||||
unsigned int n_channels;
|
||||
unsigned int n_bitsPerSample;
|
||||
unsigned int n_bitrate;
|
||||
unsigned int n_samplesPerFrame;
|
||||
}aacConfigType;
|
||||
|
||||
class aacEncode {
|
||||
public:
|
||||
aacEncode();
|
||||
~aacEncode();
|
||||
bool aacConfigure(aacConfigType* p_aacConfig);
|
||||
bool aacEncodeFrame(unsigned char* p_inBuffer,
|
||||
unsigned int n_inSize,
|
||||
unsigned char* p_outBuffer,
|
||||
unsigned int n_outSize,
|
||||
unsigned int* p_length);
|
||||
|
||||
private:
|
||||
void* p_aacHandle;
|
||||
void* p_aacInfo;
|
||||
aacConfigType s_aacConfig;
|
||||
};
|
||||
#endif
|
||||
Reference in New Issue
Block a user