DLNA-DMR-Platinum编译

1、下载Platinum源码

git clone [email protected]:plutinosoft/Platinum.git

2、配置NDK环境

打开环境变量配置文件

gedit ~/.bashrc

增加ANDROID_NDK_ROOT变量

export ANDROID_NDK_ROOT=/home/weller/software/android-ndk-r11b

3、编译Platinum静态文件

需要先安装scons

sudo apt install scons

编译命令

scons target=arm-android-linux build_config=Release

target:['arm-unknown-linux', 'x86-unknown-cygwin', 'arm-android-linux', 'x86-unknown-linux', 'arm-gp2x-linux']
build_config:['Release', 'Debug']

问题

sh: 1: arm-linux-androideabi-g++: not found

解决方法

修改Build/Targets/arm-android-linux/Config.scons的

PLATFORM_TO_TARGET_MAP = { 
'linux-i386' : 'linux-x86',
'linux2' : 'linux-x86',
...
}

-->

PLATFORM_TO_TARGET_MAP = { 
'linux-i386' : 'linux-x86_64',
'linux2' : 'linux-x86_64',
...
}
问题

ThirdParty/Neptune/Source/Core/NptUtils.h:46:19: fatal error: stdio.h: No such file or directory

解决方法

ANDROID_NDK_ROOT的版本问题,尝试android-ndk-r11b可用,最新版的ndk不可用

4、编译jni动态库

cd Source/Platform/Android/module/platinum/jni
ndk-build NDK_DEBUG=0
问题

PltTaskManager.h:45:21: fatal error: Neptune.h: No such file or directory #include "Neptune.h"

解决方法

打开Source/Platform/Android/module/platinum/jni/Android.mk
修改Neptune三方库头文件目录

$(PLT_ROOT)/../Neptune/Source/Core

--->

$(PLT_ROOT)/ThirdParty/Neptune/Source/Core

5、生成so位置

Source/Platform/Android/module/platinum/libs/

6、增加UpdateServices接口

在Source/Devices/MediaRenderer/PltMediaRenderer.h的PLT_MediaRenderer类中增加接口

virtual NPT_Result UpdateServices(const char* value,const char* data);

在Source/Devices/MediaRenderer/PltMediaRenderer.cpp增加实现

/*----------------------------------------------------------------------
|   PLT_MediaRenderer::UpdateServices add by weller
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaRenderer::UpdateServices(const char* value,const char* data){
    PLT_Service* serviceUpdate;
    if(FindServiceByType("urn:schemas-upnp-org:service:AVTransport:1", serviceUpdate) == NPT_ERROR_NO_SUCH_ITEM){
        //LOGI("cant find PLT_Service.....");
        return NPT_FAILURE;
    }
    //LOGI("\n----UpdateServices----value =%s data =%s\n",value,data);
    if(*(value+2) == ':' && *(value+5) == ':'){
        if(*(data+0) == 'd'){
            serviceUpdate->SetStateVariable("CurrentTrackDuration", value);
            serviceUpdate->SetStateVariable("CurrentMediaDuration", value);
        }
        else{
            serviceUpdate->SetStateVariable("RelativeTimePosition", value);
            serviceUpdate->SetStateVariable("AbsoluteTimePosition", value);
        }
    }else{
        serviceUpdate->SetStateVariable("TransportState", value);
    }
    return NPT_SUCCESS;
}

你可能感兴趣的:(DLNA-DMR-Platinum编译)