diff options
-rw-r--r-- | Input/ICNConnectionConsumerApi.cpp | 4 | ||||
-rw-r--r-- | Managers/MultimediaManager.cpp | 5 | ||||
-rw-r--r-- | UI/DASHPlayer.cpp | 2 | ||||
-rw-r--r-- | android/AndroidManifest.xml | 6 | ||||
-rw-r--r-- | android/gradle.properties | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | android/res/drawable-hdpi/icon.png | bin | 2449 -> 127864 bytes | |||
-rw-r--r--[-rwxr-xr-x] | android/res/drawable-ldpi/icon.png | bin | 1285 -> 127864 bytes | |||
-rw-r--r--[-rwxr-xr-x] | android/res/drawable-mdpi/icon.png | bin | 1777 -> 114093 bytes | |||
-rwxr-xr-x | android/src/io/fd/viper/ViperActivity.java (renamed from android/src/org/player/viper/ViperActivity.java) | 2 | ||||
-rw-r--r-- | libdash/CMakeLists.txt | 44 | ||||
-rw-r--r-- | main.cpp | 19 | ||||
-rwxr-xr-x | qml/Viper/Options.qml | 1 | ||||
-rw-r--r-- | viper.pro | 17 |
13 files changed, 56 insertions, 48 deletions
diff --git a/Input/ICNConnectionConsumerApi.cpp b/Input/ICNConnectionConsumerApi.cpp index c93e9ed4..59330852 100644 --- a/Input/ICNConnectionConsumerApi.cpp +++ b/Input/ICNConnectionConsumerApi.cpp @@ -160,8 +160,8 @@ int ICNConnectionConsumerApi::Read(uint8_t *data, size_t len) } else { memcpy(data, (char*)response.getPayload().data() + this->dataPos, response.getPayload().size() - this->dataPos); - int length = response.getPayload().size() - this->dataPos; - if (length == 0) + int length = response.getPayload().size() - this->dataPos; + if (length == 0) { this->res = false; } diff --git a/Managers/MultimediaManager.cpp b/Managers/MultimediaManager.cpp index 81c5514e..1bbb2c65 100644 --- a/Managers/MultimediaManager.cpp +++ b/Managers/MultimediaManager.cpp @@ -112,7 +112,6 @@ bool MultimediaManager::initICN(const std::string& url) { pos = pos + 1; } - std::string downloadFile(this->downloadPath + url.substr(pos).c_str()); FILE *fp; fp = fopen(downloadFile.c_str(), "w"); @@ -131,6 +130,7 @@ bool MultimediaManager::initICN(const std::string& url) } fclose(fp); IMPD* mpd = this->manager->Open(const_cast<char*>(downloadFile.c_str()), url); + qDebug("downloadFile %s", downloadFile.c_str()); remove(downloadFile.c_str()); free(data); if(mpd == NULL) @@ -143,11 +143,10 @@ bool MultimediaManager::initICN(const std::string& url) this->mpdWrapper->updateMPD(mpd); for (size_t i = 0; i < this->managerObservers.size(); i++) this->managerObservers.at(i)->setMPDWrapper(this->mpdWrapper); - if( !strcmp(this->mpdWrapper->getType().c_str(), "static") ) + if( this->mpdWrapper->getType().compare("static") ) { delete icnConn; } - LeaveCriticalSection(&this->monitorMutex); return true; } diff --git a/UI/DASHPlayer.cpp b/UI/DASHPlayer.cpp index c53cbed7..63debc12 100644 --- a/UI/DASHPlayer.cpp +++ b/UI/DASHPlayer.cpp @@ -216,7 +216,7 @@ bool DASHPlayer::downloadMPD(const QString &adaptationLogic, bool icn) this->segmentDuration = this->mpdWrapper->onFirstDownloadMPD(this->gui); this->multimediaManager->setSegmentDuration(this->segmentDuration); - this->parametersAdaptation->segmentDuration = this->segmentDuration / 1000.0; //to have it in seconds + this->parametersAdaptation->segmentDuration = this->segmentDuration / 1000.0; //to have it in seconds this->onSettingsChanged(0,0,0,0,0); int j =0; std::string temp = adaptationLogic.toStdString(); diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index aaac206d..f8e00c3a 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> -<manifest package="org.player.viper" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="7" android:installLocation="auto"> +<manifest package="io.fd.viper" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="9" android:installLocation="auto"> <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Viper" android:icon="@drawable/icon"> - <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.player.viper.ViperActivity" android:label="Viper" android:screenOrientation="unspecified" android:launchMode="singleTop"> + <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="io.fd.viper.ViperActivity" android:label="Viper" android:screenOrientation="unspecified" android:launchMode="singleTop"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> @@ -69,7 +69,7 @@ </application> - <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="23"/> + <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="26"/> <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/> <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application. diff --git a/android/gradle.properties b/android/gradle.properties index 5582cc87..8527bcaf 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -3,6 +3,6 @@ # This file must *NOT* be checked into Version Control Systems, # as it contains information specific to your local configuration. -androidBuildToolsVersion=23.0.2 -androidCompileSdkVersion=23 +androidBuildToolsVersion=28.0.3 +androidCompileSdkVersion=28 buildDir=.build diff --git a/android/res/drawable-hdpi/icon.png b/android/res/drawable-hdpi/icon.png Binary files differindex ecd7fe96..d84d1df6 100755..100644 --- a/android/res/drawable-hdpi/icon.png +++ b/android/res/drawable-hdpi/icon.png diff --git a/android/res/drawable-ldpi/icon.png b/android/res/drawable-ldpi/icon.png Binary files differindex 8a4388e5..d84d1df6 100755..100644 --- a/android/res/drawable-ldpi/icon.png +++ b/android/res/drawable-ldpi/icon.png diff --git a/android/res/drawable-mdpi/icon.png b/android/res/drawable-mdpi/icon.png Binary files differindex a1519295..812c295f 100755..100644 --- a/android/res/drawable-mdpi/icon.png +++ b/android/res/drawable-mdpi/icon.png diff --git a/android/src/org/player/viper/ViperActivity.java b/android/src/io/fd/viper/ViperActivity.java index e046d125..0696d0d0 100755 --- a/android/src/org/player/viper/ViperActivity.java +++ b/android/src/io/fd/viper/ViperActivity.java @@ -13,7 +13,7 @@ * limitations under the License. */ -package org.player.viper; +package io.fd.viper; import org.qtproject.qt5.android.bindings.QtActivity; import android.content.Context; import android.content.Intent; diff --git a/libdash/CMakeLists.txt b/libdash/CMakeLists.txt index 1ecf7706..0e47c993 100644 --- a/libdash/CMakeLists.txt +++ b/libdash/CMakeLists.txt @@ -1,33 +1,24 @@ cmake_minimum_required(VERSION 3.5) project(libdash) - - +set(CMAKE_CXX_STANDARD 14) if(ANDROID_API) + set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${ANDROID_C_FLAGS} -std=c++0x -g -DLOG_BUILD -stdlib=libc++") set(CMAKE_FIND_ROOT_PATH "$ENV{CCNX_HOME};${CMAKE_FIND_ROOT_PATH}") - #include_directories(${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.9/include) - #include_directories(${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include) - message("ciao!!!") - option(ANDROID "Build CP api based on ANDROID log lib" ON) - find_package(LibXml2 REQUIRED) - find_package(ZLIB REQUIRED) - find_package(CURL REQUIRED) - #set(LIBXML2_INCLUDE_DIR "$ENV{DISTILLERY_ROOT_DIR}/external/libxml2_android/jni/libxml2/include") - #set(LIBXML2_LIBRARIES "$ENV{DISTILLERY_ROOT_DIR}/usr/lib/libxml2.a") - #set(CURL_INCLUDE_DIRS "$ENV{DISTILLERY_ROOT_DIR}/external/libcurl_android/jni/libcurl/include") - #set(CURL_LIBRARIES "$ENV{DISTILLERY_ROOT_DIR}/usr/lib/libcurl.a" "$ENV{DISTILLERY_ROOT_DIR}/usr/lib/libcurl-library.a") - #set(ANDROID_LIBRARIES "$ENV{NDK}/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ENV{ABI}/libgnustl_shared.so") - set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${ANDROID_C_FLAGS} -std=c++0x -g -DLOG_BUILD -DANDROID_STL=c++_shared") + find_package(LibXml2 REQUIRED) + find_package(ZLIB REQUIRED) + find_package(CURL REQUIRED) + find_package(OpenSSL REQUIRED) elseif (COMPILE_FOR_IOS) - set(CMAKE_CXX_FLAGS "-std=c++0x -g -DLOG_BUILD") - find_package(LibXml2 REQUIRED) - find_host_package(OpenSSL REQUIRED) - find_package(ZLIB REQUIRED) - find_host_package(CURL REQUIRED) + set(CMAKE_CXX_FLAGS "-std=c++0x -g -DLOG_BUILD") + find_package(LibXml2 REQUIRED) + find_host_package(OpenSSL REQUIRED) + find_package(ZLIB REQUIRED) + find_host_package(CURL REQUIRED) else () - set(CMAKE_CXX_FLAGS "-std=c++0x -g -DLOG_BUILD") - find_package(LibXml2 REQUIRED) - find_package(ZLIB REQUIRED) - find_package(CURL REQUIRED) + set(CMAKE_CXX_FLAGS "-std=c++0x -g -DLOG_BUILD") + find_package(LibXml2 REQUIRED) + find_package(ZLIB REQUIRED) + find_package(CURL REQUIRED) endif (ANDROID_API) set(DEBUG_BUILD FALSE) set(HEADER_FILES @@ -190,14 +181,13 @@ include_directories(${WLIB_INCLUDE_DIRS}) include_directories(${CURL_INCLUDE_DIRS}) include_directories(include) -if (COMPILE_FOR_IOS OR COMPILE_FOR_IOS_SIMULATOR) +if (COMPILE_FOR_IOS OR COMPILE_FOR_IOS_SIMULATOR OR ANDROID_API) add_library(dash STATIC ${SOURCE_FILES}) else() add_library(dash SHARED ${SOURCE_FILES}) endif() set_target_properties(dash PROPERTIES LINKER_LANGUAGE CXX) -target_link_libraries(dash ${CURL_LIBRARIES} ${ZLIB_LIBRARIES} ${CURL_LIBRARIES} ${LIBXML2_LIBRARIES} ${CURL_LIBRARIES} ${ANDROID_LIBRARIES} ${CURL_LIBRARIES}) -message("libxml ${LIBXML2_LIBRARIES} ${LIBXML2_INCLUDE_DIR}") +target_link_libraries(dash ${CURL_LIBRARIES} ${ZLIB_LIBRARIES} ${CURL_LIBRARIES} ${LIBXML2_LIBRARIES} ${CURL_LIBRARIES} ${ANDROID_LIBRARIES} ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES}) install(TARGETS dash DESTINATION ${CMAKE_INSTALL_PREFIX}/lib PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ COMPONENT library) install(FILES ${HEADER_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/libdash COMPONENT headers) @@ -27,6 +27,7 @@ #include <QtAV/QtAV.h> #ifdef Q_OS_ANDROID #include <QAndroidJniObject> +#include <QtAndroid> #endif #include "Common/QtQuick2ApplicationViewer.h" #include "../Common/Common.h" @@ -159,7 +160,8 @@ int main(int argc, char *argv[]) viewer.setY(op.value().toInt()); if (options.value(QStringLiteral("fullscreen")).toBool()) viewer.showFullScreen(); - viewer.setTitle(QStringLiteral("Viper")); + viewer.setTitle(QStringLiteral("Viper")); + #if 1 QString json = app.arguments().join(QStringLiteral("\",\"")); json.prepend(QLatin1String("[\"")).append(QLatin1String("\"]")); @@ -171,8 +173,19 @@ int main(int argc, char *argv[]) qApp->installEventFilter(ae); QString file; #ifdef Q_OS_ANDROID - engine->rootContext()->setContextProperty("platform", 1); - file = QAndroidJniObject::callStaticObjectMethod("org.viper.com.ViperActivity" + const QVector<QString> permissions({"android.permission.INTERNET", + "android.permission.WRITE_EXTERNAL_STORAGE", + "android.permission.READ_EXTERNAL_STORAGE"}); + for(const QString &permission : permissions){ + auto result = QtAndroid::checkPermission(permission); + if(result == QtAndroid::PermissionResult::Denied){ + auto resultHash = QtAndroid::requestPermissionsSync(QStringList({permission})); + if(resultHash[permission] == QtAndroid::PermissionResult::Denied) + return 0; + } + } + + file = QAndroidJniObject::callStaticObjectMethod("io.fd.viper.ViperActivity" , "getUrl" , "()Ljava/lang/String;") .toString(); diff --git a/qml/Viper/Options.qml b/qml/Viper/Options.qml index 3f8d7ab6..64d6f45b 100755 --- a/qml/Viper/Options.qml +++ b/qml/Viper/Options.qml @@ -449,7 +449,6 @@ Rectangle { anchors.top: parent.top anchors.right: textInputv6FirstWord.left anchors.rightMargin: Utils.scaled(5) - anchors.topMargin: (textInputv6Prefix.height - height)/2 font.bold: true font.pixelSize: Utils.scaled(10); } @@ -21,8 +21,7 @@ android { CONFIG -= release CONFIG += debug CONFIG += c++14 -QMAKE_CXXFLAGS += -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DANDROID_STL=c++_static -QMAKE_CXXFLAGS += -std=c++14 -g -fpermissive -DASIO_STANDALONE=1 +QMAKE_CXXFLAGS += -std=c++14 -g -fpermissive -DASIO_STANDALONE=1 -stdlib=libc++ -DQTC_ENABLE_CLANG_LIBTOOLING=ON # Add more folders to ship with the application, here folder_01.source = qml/Viper folder_01.target = qml @@ -306,7 +305,7 @@ macx:!ios { SOURCES *= main.cpp android { DISTFILES += \ - android/src/org/player/viper/ViperActivity.java \ + android/src/io/fd/viper/ViperActivity.java \ android/gradle/wrapper/gradle-wrapper.jar \ android/AndroidManifest.xml \ android/res/values/libs.xml \ @@ -319,8 +318,16 @@ android { INCLUDEPATH += $$(DISTILLARY_INSTALLATION_PATH)/include INCLUDEPATH += $$(DISTILLARY_INSTALLATION_PATH)/include/libdash equals(TRANSPORT_LIBRARY, "HICNET") { - LIBS += -L"$$(DISTILLARY_INSTALLATION_PATH)/lib" -lhicnet -ljsoncpp -ldash -lcurl -lxml2 -lccnx_common -lparc -lhicntransport -lhicn -levent -lssl -lcrypto -lavcodec -lavutil -lavformat + LIBS += -L"$$(DISTILLARY_INSTALLATION_PATH)/lib" -ldash -lhicntransport -lhicn -lparc -lavcodec -lavutil -lavformat -lswresample -lcurl -lxml2 -lssl -lcrypto -lQtAV DEFINES += "HICNET=ON" + ANDROID_EXTRA_LIBS += $$(DISTILLARY_INSTALLATION_PATH)/lib/libswresample.so + ANDROID_EXTRA_LIBS += $$(DISTILLARY_INSTALLATION_PATH)/lib/libavresample.so + ANDROID_EXTRA_LIBS += $$(DISTILLARY_INSTALLATION_PATH)/lib/libavdevice.so + ANDROID_EXTRA_LIBS += $$(DISTILLARY_INSTALLATION_PATH)/lib/libavfilter.so + ANDROID_EXTRA_LIBS += $$(DISTILLARY_INSTALLATION_PATH)/lib/libavcodec.so + ANDROID_EXTRA_LIBS += $$(DISTILLARY_INSTALLATION_PATH)/lib/libavformat.so + ANDROID_EXTRA_LIBS += $$(DISTILLARY_INSTALLATION_PATH)/lib/libswscale.so + ANDROID_EXTRA_LIBS += $$(DISTILLARY_INSTALLATION_PATH)/lib/libavutil.so } else { LIBS += -L"$$(DISTILLARY_INSTALLATION_PATH)/lib" -licnet -ldash -lcurl -lxml2 -lccnx_api_portal -lccnx_transport_rta -lccnx_api_control -lccnx_api_notify -lccnx_common -lparc -llongbow -llongbow-ansiterm -llongbow-textplain -levent -lssl -lcrypto -lavcodec -lavutil -lavformat -lboost_system DEFINES += "ICNET=ON" @@ -336,4 +343,4 @@ DISTFILES += \ android/res/drawable-mdpi/icon.png \ android/gradle.properties \ android/src/org/qtav/qmlplayer/ViperActivity.java \ - android/src/org/player/viper/ViperActivity.java + android/src/io/fd/viper/ViperActivity.java |