- Changed library icnet - application interface 07/7007/3
authorMauro Sardara <[email protected]>
Mon, 5 Jun 2017 16:59:26 +0000 (18:59 +0200)
committerMauro Sardara <[email protected]>
Mon, 5 Jun 2017 18:51:15 +0000 (18:51 +0000)
Change-Id: I25112ab1e1401a21ed2530d3874a7b4bf740ec5d
Signed-off-by: Mauro Sardara <[email protected]>
18 files changed:
CMakeLists.txt
Common/Config.cpp
Common/ViperBuffer.cpp
Input/DASHReceiver.cpp
Input/ICNConnectionConsumerApi.cpp
Input/ICNConnectionConsumerApi.h
MPD/AdaptationSetHelper.h
MPD/TimeResolver.h
Managers/MultimediaManager.cpp
UI/DASHPlayer.cpp
UI/DASHPlayer.h
Websocket/query.cpp
Websocket/query.h
android/AndroidManifest.xml
android/gradle.properties
dockerfile.ubuntu.xenial [new file with mode: 0644]
libdash/CMakeLists.txt
viper.pro

index fdd6dbf..45fbe61 100644 (file)
@@ -18,8 +18,17 @@ set(CMAKE_VERBOSE_MAKEFILE true)
 
 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/qmake_build)
 
+option(ICNET "Link against Libicnet." ON)
+option(HICNET "Link against Libhicnet." OFF)
+if (HICNET)
+    set (TRANSPORT_LIBRARY HICNET)
+    set(ICNET OFF)
+
+else()
+    set (TRANSPORT_LIBRARY ICNET)
+endif()
 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/qmake_build/viper_
-                  COMMAND /opt/qt57/bin/qmake ${CMAKE_SOURCE_DIR}/viper.pro
+                  COMMAND /opt/qt57/bin/qmake ${CMAKE_SOURCE_DIR}/viper.pro "TRANSPORT_LIBRARY = ${TRANSPORT_LIBRARY}"
                   COMMAND make
                   COMMAND mv viper viper_
                   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/qmake_build
index 04d999c..8527825 100644 (file)
@@ -527,7 +527,7 @@ void Config::reload()
     settings.endGroup();
 
     settings.beginGroup(QString::fromLatin1("backend"));
-    setIcnPrefix(settings.value(QString::fromLatin1("icn_prefix"), QString::fromLatin1("ccnx:/webserver/get/")).toString());
+    setIcnPrefix(settings.value(QString::fromLatin1("icn_prefix"), QString::fromLatin1("http://webserver/")).toString());
     setHttpPrefix(settings.value(QString::fromLatin1("http_prefix"), QString::fromLatin1("http://10.60.17.153:8080/")).toString());
     setIcnSuffix(settings.value(QString::fromLatin1("icn_suffix"), QString::fromLatin1("/mpd")).toString());
     setHttpSuffix(settings.value(QString::fromLatin1("http_suffix"), QString::fromLatin1("/mpd")).toString());
index 27ec8b5..90d10d6 100644 (file)
@@ -85,6 +85,7 @@ qint64 ViperBuffer::writeData(libdash::framework::input::MediaObject* media)
     ret = media->Read(readBuffer,readMax);
     while(ret)
     {
+        printf("ret %d\n", ret);
         total += ret;
         this->writeData((const char *)readBuffer, ret);
         ret = media->Read(readBuffer,readMax);
index e7a5c5c..df9d019 100644 (file)
@@ -133,7 +133,7 @@ MediaObject*        DASHReceiver::GetNextSegment    ()
 
     if(this->segmentNumber >= this->representationStream->getSize())
     {
-        //qDebug("looping? : %s\n", this->isLooping ? "YES" : "NO");
+        qDebug("looping? : %s\n", this->isLooping ? "YES" : "NO");
         if(this->isLooping)
         {
             this->segmentNumber = 0;
index d38642e..62e9ecd 100644 (file)
@@ -23,7 +23,7 @@
 using namespace dash;
 using namespace dash::network;
 using namespace dash::metrics;
-using namespace icnet;
+//using namespace icnet;
 
 using std::bind;
 using std::placeholders::_1;
@@ -37,7 +37,6 @@ namespace libdash {
 namespace framework {
 namespace input {
 ICNConnectionConsumerApi::ICNConnectionConsumerApi(double alpha, float beta, float drop) :
-    m_recv_name(ccnx::Name()),
     m_first(1),
     m_isFinished(false),
     sizeDownloaded (0),
@@ -53,11 +52,12 @@ ICNConnectionConsumerApi::ICNConnectionConsumerApi(double alpha, float beta, flo
     this->deezDataSize = 0;
     this->datSize = 0;
     this->dataPos = 0;
+    this->res = false;
     InitializeConditionVariable (&this->contentRetrieved);
     InitializeCriticalSection   (&this->monitorMutex);
-
-    this->myConsumer = new ConsumerSocket(ccnx::Name(), TransportProtocolAlgorithms::RAAQM);
-    this->myConsumer->setSocketOption(RaaqmTransportOptions::GAMMA_VALUE, (int)gamma);
+       this->hTTPClientConnection = new libl4::http::HTTPClientConnection();
+    //this->myConsumer = new ConsumerSocket(ccnx::Name(), TransportProtocolAlgorithms::RAAQM);
+    //this->myConsumer->setSocketOption(RaaqmTransportOptions::GAMMA_VALUE, (int)gamma);
 
     bool configFile = false;
     //CHECK if we are not going to override the configuration file. (if !autotune)
@@ -68,12 +68,13 @@ ICNConnectionConsumerApi::ICNConnectionConsumerApi(double alpha, float beta, flo
     }
     if(!configFile)
     {
-        this->myConsumer->setSocketOption(RaaqmTransportOptions::BETA_VALUE, this->beta);
-        this->myConsumer->setSocketOption(RaaqmTransportOptions::DROP_FACTOR, this->drop);
+        qDebug("beta %f, drop %f", this->beta, this->drop);
+   //     this->myConsumer->setSocketOption(RaaqmTransportOptions::BETA_VALUE, this->beta);
+   //     this->myConsumer->setSocketOption(RaaqmTransportOptions::DROP_FACTOR, this->drop);
     }
-    this->myConsumer->setSocketOption(RateEstimationOptions::RATE_ESTIMATION_OBSERVER, this);
-    this->myConsumer->setSocketOption(ConsumerCallbacksOptions::CONTENT_RETRIEVED, (ConsumerContentCallback) bind(&ICNConnectionConsumerApi::processPayload, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
-    this->myConsumer->setSocketOption(ConsumerCallbacksOptions::CONTENT_OBJECT_TO_VERIFY, (ConsumerContentObjectVerificationCallback)bind(&ICNConnectionConsumerApi::onPacket, this, std::placeholders::_1, std::placeholders::_2));
+    //this->myConsumer->setSocketOption(RateEstimationOptions::RATE_ESTIMATION_OBSERVER, this);
+    //this->myConsumer->setSocketOption(ConsumerCallbacksOptions::CONTENT_RETRIEVED, (ConsumerContentCallback) bind(&ICNConnectionConsumerApi::processPayload, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
+    //this->myConsumer->setSocketOption(ConsumerCallbacksOptions::CONTENT_OBJECT_TO_VERIFY, (ConsumerContentObjectVerificationCallback)bind(&ICNConnectionConsumerApi::onPacket, this, std::placeholders::_1, std::placeholders::_2));
 #ifdef NO_GUI
     if(this->icnAlpha != 20)
         this->icnRateBased = true;
@@ -85,7 +86,7 @@ ICNConnectionConsumerApi::ICNConnectionConsumerApi(double alpha, float beta, flo
 }
 
 ICNConnectionConsumerApi::~ICNConnectionConsumerApi() {
-    delete this->myConsumer;
+    delete this->hTTPClientConnection;
     if(this->deezData)
     {
         free(this->deezData);
@@ -99,42 +100,27 @@ void ICNConnectionConsumerApi::Init(IChunk *chunk) {
     Debug("ICN Connection:     STARTING\n");
     m_first = 1;
     sizeDownloaded = 0;
-    m_name = "ccnx:/" + chunk->Host() + chunk->Path();
+    m_name = chunk->AbsoluteURI().c_str();
     m_isFinished = false;
 
     res = false;
-    dataPos = 0;
-    datSize = 0;
-    if(this->deezData)
-    {
-        memset(this->deezData, 0, this->deezDataSize);
-    }
-
+    qDebug("ICN_Connection:\tINTIATED_to_name %s\n", m_name.c_str());
+    qDebug("ICN_Connection:\tSTARTING DOWNLOAD %s\n", m_name.c_str());
 }
 
 void ICNConnectionConsumerApi::InitForMPD(const std::string& url)
 {
     m_first = 1;
     sizeDownloaded = 0;
-
-    if(url.find("//") != std::string::npos)
-    {
-        int pos = url.find("//");
-        char* myName = (char*)malloc(strlen(url.c_str()) - 1);
-        strncpy(myName, url.c_str(), pos + 1);
-        strncpy(myName + pos + 1, url.c_str() + pos + 2, strlen(url.c_str()) - pos - 2);
-        m_name = std::string(myName);
-        free(myName);
-    }
-    else
-    {
-        m_name = url;
-    }
+    printf("initmpd %s\n", url.c_str());
+    m_name = url;
     m_isFinished = false;
 
     res = false;
     dataPos = 0;
     datSize = 0;
+
+    printf("initiated for mpd\n");
     Debug("ICN_Connection:\tINTIATED_for_mpd %s\n", m_name.c_str());
 }
 
@@ -146,60 +132,30 @@ int       ICNConnectionConsumerApi::Read(uint8_t* data, size_t len, IChunk *chunk)
 int    ICNConnectionConsumerApi::Read(uint8_t *data, size_t len)
 {
     if(!res)
-        m_start_time = std::chrono::system_clock::now();
-
-    if(res)
     {
-        if(this->dataPos == this->datSize)
-        {
-            this->dnltime = std::chrono::duration_cast<duration_in_seconds>(std::chrono::system_clock::now() - m_start_time).count();
-            if(speed == 0 || !this->icnRateBased)
-                speed = (double) (sizeDownloaded * 8 / this->dnltime);
-            cumulativeBytesReceived += sizeDownloaded;
-            Debug("ICN_Connection:\tFINISHED DOWNLOADING %s Average_DL: %f size: %lu cumulative: %lu Throughput: %f\n", m_name.c_str(), speed, sizeDownloaded, cumulativeBytesReceived, (double) (sizeDownloaded * 8 / this->dnltime));
-            return 0;
-        }
-        if((this->datSize - this->dataPos) > (int)len)
-        {
-            memcpy(data, this->deezData + this->dataPos, len);
-            this->dataPos += len;
-            sizeDownloaded += len;
-            return len;
-        }
-        else
-        {
-            assert(this->datSize - this->dataPos > 0);
-            memcpy(data, this->deezData + this->dataPos, this->datSize - this->dataPos);
-            int temp = this->datSize - this->dataPos;
-            this->dataPos += this->datSize - this->dataPos;
-            sizeDownloaded += temp;
-            return temp;
-        }
+       std::string s(m_name.c_str());
+       hTTPClientConnection->get(s);
+       response  = hTTPClientConnection->response();
+       std::cout << m_name.c_str()<< " SIZE:" << response.size() << std::endl;
+       this->res = true;
+       this->dataPos = 0;
     }
-
-    Debug("will consume: %s\n", m_name.c_str());
-    this->myConsumer->consume(m_name);
-    EnterCriticalSection(&this->monitorMutex);
-
-    while(this->m_isFinished == false)
-        SleepConditionVariableCS(&this->contentRetrieved, &this->monitorMutex, INFINITE);
-
-    assert(this->datSize != 0);
-    this->res = true;
-    LeaveCriticalSection(&this->monitorMutex);
-    if(this->datSize > (int)len)
+    if (response.size() - this->dataPos > (int)len)
     {
-        memcpy(data, this->deezData, len);
-        this->dataPos += len;
-        sizeDownloaded += len;
-        return len;
-    }
-    else
+       memcpy(data, (char*)response.data() + this->dataPos, len);
+       this->dataPos += len;
+       return len;
+    } else
     {
-        memcpy(data, this->deezData, this->datSize);
-        this->dataPos += this->datSize;
-        sizeDownloaded += this->datSize;
-        return this->datSize;
+        printf("minore uguale\n");
+        memcpy(data, (char*)response.data() + this->dataPos, response.size() - this->dataPos);
+        int length = response.size() - this->dataPos;
+       if (length == 0)
+        {
+          this->res = false;
+        }
+        this->dataPos = response.size();
+        return length;
     }
 }
 
@@ -207,33 +163,6 @@ int             ICNConnectionConsumerApi::Peek(uint8_t *data, size_t len, IChunk
     return -1;
 }
 
-bool   ICNConnectionConsumerApi::onPacket(ConsumerSocket& c, const ContentObject& data)
-{
-    return true;
-}
-
-void   ICNConnectionConsumerApi::processPayload(ConsumerSocket& c, const uint8_t* buffer, size_t bufferSize)
-{
-    EnterCriticalSection(&this->monitorMutex);
-    if(this->deezData == NULL)
-    {
-        this->deezData = (char *)malloc(bufferSize*sizeof(uint8_t));
-        this->deezDataSize = bufferSize;
-    }
-    else
-    {
-        if(bufferSize > this->deezDataSize)
-        {
-            this->deezData = (char *)realloc(this->deezData, bufferSize * (sizeof(uint8_t)));
-            this->deezDataSize = bufferSize;
-        }
-    }
-    memcpy(this->deezData, buffer, bufferSize*sizeof(uint8_t));
-    this->m_isFinished = true;
-    this->datSize = (int) bufferSize;
-    WakeAllConditionVariable(&this->contentRetrieved);
-    LeaveCriticalSection(&this->monitorMutex);
-}
 
 double ICNConnectionConsumerApi::GetAverageDownloadingSpeed()
 {
index a62f6b0..0ee5cba 100644 (file)
 #ifndef QTPLAYER_INPUT_ICNCONNECTIONCONSUMERAPI_H_
 #define QTPLAYER_INPUT_ICNCONNECTIONCONSUMERAPI_H_
 
+#if defined(HICNET)
+#include <hicnet/hicnet_http_facade.h>
+#else
+#include <icnet/icnet_http_facade.h>
+#endif
+
+#include <QMessageLogger>
 #include "../Portable/Networking.h"
 #include "IICNConnection.h"
 #include "../debug.h"
@@ -30,8 +37,7 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <algorithm>
-#include <icnet/icnet_socket_consumer.h>
-#include <icnet/icnet_download_observer.h>
+
 #include <future>
 #include <inttypes.h>
 #include <time.h>
@@ -50,7 +56,7 @@ namespace libdash {
 namespace framework {
 namespace input {
 
-class ICNConnectionConsumerApi : public IICNConnection, public icnet::IcnObserver {
+class ICNConnectionConsumerApi : public IICNConnection {
 public:
     ICNConnectionConsumerApi(double alpha, float beta, float drop);
     virtual ~ICNConnectionConsumerApi();
@@ -69,10 +75,6 @@ public:
 
     virtual double GetDownloadingTime();
 
-    void processPayload(icnet::ConsumerSocket& , const uint8_t*, size_t);
-
-    bool onPacket(icnet::ConsumerSocket& , const icnet::ContentObject&);
-
     const std::vector<dash::metrics::ITCPConnection *> &GetTCPConnectionList() const;
 
     const std::vector<dash::metrics::IHTTPTransaction *> &GetHTTPTransactionList() const;
@@ -81,6 +83,8 @@ public:
     virtual void notifyStats(double throughput);
 
 private:
+    libl4::http::HTTPClientConnection *hTTPClientConnection;
+    libl4::http::HTTPResponse response;
     float beta;
     float drop;
     uint64_t i_chunksize;
@@ -89,8 +93,6 @@ private:
     /**< number of content objects we missed in ICNBlock */
 
     std::string m_name;
-    icnet::ccnx::Name m_recv_name;
-    icnet::ccnx::Portal m_portal;
     int m_first;
     bool m_isFinished;
     uint64_t m_nextSeg;
@@ -109,7 +111,6 @@ private:
     unsigned int nchunks; // XXX chunks=-1 means: download the whole file!
     bool output;
     bool report_path;
-    icnet::ConsumerSocket* myConsumer;
     bool res;
     std::vector<char> mdata;
     char* deezData;
index 4172441..683d0f0 100644 (file)
@@ -13,6 +13,7 @@
 #define LIBDASH_FRAMEWORK_MPD_ADAPTATIONSETHELPER_H_
 
 #include "IMPD.h"
+#include <QMessageLogger>
 
 namespace libdash
 {
index fe320e8..89ea204 100644 (file)
 #define LIBDASH_FRAMEWORK_MPD_TIMERESOLVER_H_
 
 #include <time.h>
-#include "config.h"
+#include <string>
+#include <vector>
+#include <stdlib.h>
+#include <stdio.h>
+//#include "config.h"
 
 namespace libdash
 {
index faab66c..52dbd6a 100644 (file)
@@ -117,10 +117,12 @@ bool    MultimediaManager::initICN(const std::string& url)
         return false;
     }
     ret = icnConn->Read((uint8_t*)data, 4096);
+    printf("downloaded %d\n", ret);
     while(ret)
     {
         fwrite(data, sizeof(char), ret, fp);
         ret = icnConn->Read((uint8_t*)data,4096);
+        printf("downloaded %d\n", ret);
     }
     fclose(fp);
     this->mpd = this->manager->Open(const_cast<char*>(downloadFile.c_str()), url);
@@ -136,6 +138,7 @@ bool    MultimediaManager::initICN(const std::string& url)
     free(data);
     delete icnConn;
     LeaveCriticalSection(&this->monitorMutex);
+    printf("return true\n");
     return true;
 }
 
index 52b45b0..b87dde7 100644 (file)
@@ -371,7 +371,7 @@ void DASHPlayer::onStopped()
                 }
 
             } else {
-                //qDebug("wrong position");
+                qDebug("wrong position");
             }
         }
         else
@@ -915,7 +915,7 @@ void DASHPlayer::setRateEstimator(int rateEstimator)
 
 void DASHPlayer::error(const QtAV::AVError &e)
 {
-    //qDebug("error in the player!");
+    qDebug("error in the player!");
     seekVideo(0);
 }
 
index f63dfbb..8913a84 100644 (file)
@@ -23,6 +23,7 @@
 #include "../Buffer/IBufferObserver.h"
 #include "../MPD/AdaptationSetHelper.h"
 #include "../Common/Config.h"
+#include <QMessageLogger>
 #include <qimage.h>
 #include<map>
 #include<tuple>
index d7221ff..c0bcaf6 100644 (file)
@@ -23,7 +23,7 @@ const std::string QueryKeys::FIELD_NAMES  = "field_names";
 const std::string QueryKeys::LAST         = "last";
 
 Query::Query()
-    : query(Json::object())
+    : query(Json2::object())
 {
 }
 
@@ -43,9 +43,9 @@ Query::Query(const std::string &action, const std::string &objectName, const std
 
   query[QueryKeys::ACTION] = action;
   query[QueryKeys::OBJECT_NAME] = objectName;
-  query[QueryKeys::FILTER] = Json(filter);
-  query[QueryKeys::PARAMS] = Json(params);
-  query[QueryKeys::FIELD_NAMES] = Json(fields);
+  query[QueryKeys::FILTER] = Json2(filter);
+  query[QueryKeys::PARAMS] = Json2(params);
+  query[QueryKeys::FIELD_NAMES] = Json2(fields);
   query[QueryKeys::LAST] = last;
 }
 
@@ -53,7 +53,7 @@ Query
 Query::fromJsonString(const std::string &jsonString)
 {
   Query query;
-  Json jsonQuery = Json::parse(jsonString);
+  Json2 jsonQuery = Json2::parse(jsonString);
 
   std::cout << jsonQuery << std::endl;
 
@@ -63,9 +63,9 @@ Query::fromJsonString(const std::string &jsonString)
   query.setLast(jsonQuery[QueryKeys::LAST]);
   query.setObjectName(jsonQuery[QueryKeys::OBJECT_NAME]);
 
-  Json list = jsonQuery[QueryKeys::FIELD_NAMES];
+  Json2 list = jsonQuery[QueryKeys::FIELD_NAMES];
 
-  for (Json::iterator it =list.begin(); it != list.end(); ++it) {
+  for (Json2::iterator it =list.begin(); it != list.end(); ++it) {
     query.fields.push_back(*it);
   }
 
@@ -73,24 +73,24 @@ Query::fromJsonString(const std::string &jsonString)
     query.fields.push_back("*");
   }
 
-  Json list2 = jsonQuery[QueryKeys::FILTER];
+  Json2 list2 = jsonQuery[QueryKeys::FILTER];
 
-  for (Json::iterator it = list2.begin(); it != list2.end(); ++it) {
+  for (Json2::iterator it = list2.begin(); it != list2.end(); ++it) {
     query.filter.push_back(*it);
   }
 
-  Json map = jsonQuery[QueryKeys::PARAMS];
+  Json2 map = jsonQuery[QueryKeys::PARAMS];
 
-  for (Json::iterator it = map.begin(); it != map.end(); ++it) {
+  for (Json2::iterator it = map.begin(); it != map.end(); ++it) {
     std::cout << it.key() << " " << it.value().dump() << std::endl;
     query.params[it.key()] = it.value().dump();
   }
 
   query.query[QueryKeys::ACTION] = query.action;
   query.query[QueryKeys::OBJECT_NAME] = query.objectName;
-  query.query[QueryKeys::FILTER] = Json(query.filter);
-  query.query[QueryKeys::PARAMS] = Json(query.params);
-  query.query[QueryKeys::FIELD_NAMES] = Json(query.fields);
+  query.query[QueryKeys::FILTER] = Json2(query.filter);
+  query.query[QueryKeys::PARAMS] = Json2(query.params);
+  query.query[QueryKeys::FIELD_NAMES] = Json2(query.fields);
   query.query[QueryKeys::LAST] = query.last;
 
   return query;
@@ -113,13 +113,13 @@ std::string
 Query::toJsonString(const std::string &action, const  std::string &objectName, const  std::list<std::vector<std::string>> &filter,
                     const std::map<std::string, std::string> &params, const  std::list<std::string> &fields, bool last)
 {
-  Json jsonQuery;
+  Json2 jsonQuery;
 
   jsonQuery[QueryKeys::ACTION] = action;
   jsonQuery[QueryKeys::OBJECT_NAME] = objectName;
-  jsonQuery[QueryKeys::FILTER] = Json(filter);
-  jsonQuery[QueryKeys::PARAMS] = Json(params);
-  jsonQuery[QueryKeys::FIELD_NAMES] = Json(fields);
+  jsonQuery[QueryKeys::FILTER] = Json2(filter);
+  jsonQuery[QueryKeys::PARAMS] = Json2(params);
+  jsonQuery[QueryKeys::FIELD_NAMES] = Json2(fields);
   jsonQuery[QueryKeys::LAST] = last;
 
   return jsonQuery.dump();
index 193610b..a1d2e22 100644 (file)
@@ -33,7 +33,7 @@ typedef struct QueryKeys {
 } QueryKeys;
 
 // for convenience
-typedef nlohmann::json Json;
+typedef nlohmann::json Json2;
 
 class Query
 {
@@ -107,7 +107,7 @@ public:
   isEmpty();
 
 private:
-  Json query;
+  Json2 query;
 
   std::string action;
   std::string objectName;
index 9090f9c..aaac206 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<manifest package="org.qtav.qmlplayer" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="7" android:installLocation="auto">
+<manifest package="org.player.viper" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="7" 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">
             <intent-filter>
index a694f3f..5582cc8 100644 (file)
@@ -6,4 +6,3 @@
 androidBuildToolsVersion=23.0.2
 androidCompileSdkVersion=23
 buildDir=.build
-qt5AndroidDir=/Users/angelomantellini/Qt/5.7/android_armv7/src/android/java
diff --git a/dockerfile.ubuntu.xenial b/dockerfile.ubuntu.xenial
new file mode 100644 (file)
index 0000000..74e6d2f
--- /dev/null
@@ -0,0 +1,47 @@
+# Ubuntu Dockerfile
+#
+#  https://github.com/dockerfile/ubuntu
+#
+
+# Pull base image.
+FROM ubuntu:xenial
+
+# Building tools and dependencies
+RUN \
+  sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \
+  apt-get update && \
+  apt-get -y upgrade && \
+  apt-get install -y git build-essential curl software-properties-common apt-transport-https && \
+  echo "deb [trusted=yes] http://nexus.fd.io/content/repositories/fd.io.master.ubuntu.xenial.main ./" | tee /etc/apt/sources.list.d/99fd.io.master.list && \
+  echo "deb [trusted=yes] https://engci-maven-master.cisco.com/artifactory/icn-debian xenial main" | tee /etc/apt/sources.list.d/artifactory.icndebian.list && \
+  add-apt-repository --yes ppa:beineri/opt-qt571-xenial && \
+  curl http://archive.getdeb.net/getdeb-archive.key | apt-key add - && \
+  sh -c "echo 'deb http://archive.getdeb.net/ubuntu xenial-getdeb apps' >> /etc/apt/sources.list.d/getdeb.list" && \
+  apt-get update && \
+  apt-get install -y zlib1g-dev git-core build-essential libdash-dev libxml2-dev libcurl4-openssl-dev \
+    qt57base qt57svg qt57charts-no-lgpl qt57multimedia libqtav-dev libhicnet-dev libhicnet libhicn-dev \
+    libavcodec-dev libavformat-dev libswscale-dev  libavresample-dev libqml-module-qtav \
+  qt57quickcontrols qt57quickcontrols2 libboost-system-dev && \
+  rm -rf /var/lib/apt/lists/* && \
+  ln -sf /usr/include/x86_64-linux-gnu/qt5/QtAV                                /opt/qt57/include/QtAV && \
+  ln -sf /usr/include/x86_64-linux-gnu/qt5/QtAVWidgets                         /opt/qt57/include/QtAVWidgets && \
+  ln -sf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/av.prf                 /opt/qt57/mkspecs/features/av.prf && \
+  ln -sf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/avwidgets.prf          /opt/qt57/mkspecs/features/avwidgets.prf && \
+  ln -sf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_avwidgets.pri    /opt/qt57/mkspecs/modules/qt_lib_avwidgets.pri && \
+  ln -sf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_av.pri           /opt/qt57/mkspecs/modules/qt_lib_av.pri && \
+  ln -sf /usr/lib/x86_64-linux-gnu/libQtAV.prl                                 /opt/qt57/lib/libQtAV.prl && \
+  ln -sf /usr/lib/x86_64-linux-gnu/libQtAVWidgets.prl                          /opt/qt57/lib/libQtAVWidgets.prl && \
+  ln -sf /usr/lib/x86_64-linux-gnu/libQtAVWidgets.so                           /opt/qt57/lib/libQt5AVWidgets.so && \
+  ln -sf /usr/lib/x86_64-linux-gnu/libQt5AV.so                                 /opt/qt57/lib/libQt5AV.so && \
+  ln -sf /usr/lib/x86_64-linux-gnu/libQtAV.so                                  /opt/qt57/lib/libQtAV.so && \
+  ln -sf /usr/lib/x86_64-linux-gnu/libQt5AVWidgets.so                          /opt/qt57/lib/libQtAVWidgets.so && \
+  ln -sf /usr/lib/x86_64-linux-gnu/qt5/qml/QtAV                                /opt/qt57/qml/QtAV
+
+# Cmake version 3.8
+ENV CMAKE_INSTALL_SCRIPT_URL="https://cmake.org/files/v3.8/cmake-3.8.0-Linux-x86_64.sh"
+ENV CMAKE_INSTALL_SCRIPT="/tmp/install_cmake.sh"
+ENV CMAKE_INSTALL_LOCATION="/usr"
+
+RUN curl ${CMAKE_INSTALL_SCRIPT_URL} > ${CMAKE_INSTALL_SCRIPT}
+RUN mkdir -p ${CMAKE_INSTALL_LOCATION}
+RUN bash ${CMAKE_INSTALL_SCRIPT} --skip-license --prefix=${CMAKE_INSTALL_LOCATION} --exclude-subdir
index 7041a00..4b9e73c 100644 (file)
@@ -1,7 +1,23 @@
 cmake_minimum_required(VERSION 3.2)
 project(libdash)
 
-set(CMAKE_CXX_FLAGS "-std=c++0x -g -DLOG_BUILD")
+
+if(ANDROID_API)
+       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)
+       option(ANDROID "Build CP api based on ANDROID log lib" ON)
+       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 "${ANDROID_NDK}/platforms/android-23/arch-arm/usr/lib/libz.a" "$ENV{NDK}/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ENV{ABI}/libgnustl_shared.so"  "${ANDROID_NDK}/platforms/android-23/arch-arm/usr/lib/liblog.so")
+       set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${ANDROID_C_FLAGS} -std=c++0x -g -DLOG_BUILD")
+else ()
+       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
         include/config.h
@@ -168,7 +184,7 @@ include_directories(include)
 
 add_library(dash SHARED ${SOURCE_FILES})
 set_target_properties(dash PROPERTIES LINKER_LANGUAGE CXX)
-target_link_libraries(dash ${CURL_LIBRARIES} ${ZLIB_LIBRARIES} ${LIBXML2_LIBRARIES})
+target_link_libraries(dash ${CURL_LIBRARIES} ${ZLIB_LIBRARIES} ${LIBXML2_LIBRARIES} ${ANDROID_LIBRARIES})
 message("libxml ${LIBXML2_LIBRARIES} ${LIBXML2_INCLUDE_DIR}")
 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)
@@ -191,50 +207,50 @@ set(CPACK_COMPONENTS_ALL library headers documentation)
 
 # Get the version
 execute_process(COMMAND bash ${CMAKE_SOURCE_DIR}/../scripts/version
-        OUTPUT_VARIABLE PACKAGE_VERSION)
+               OUTPUT_VARIABLE PACKAGE_VERSION)
 
 if (PACKAGE_VERSION)
-    string(STRIP ${PACKAGE_VERSION} PACKAGE_VERSION)
+       string(STRIP ${PACKAGE_VERSION} PACKAGE_VERSION)
 else()
-    set(PACKAGE_VERSION 1.0)
+       set(PACKAGE_VERSION 1.0)
 endif()
 
 if(DEB_PACKAGE)
-    set(TYPE "DEBIAN")
-    set(GENERATOR "DEB")
+       set(TYPE "DEBIAN")
+       set(GENERATOR "DEB")
 
-    set(CPACK_${TYPE}_LIBRARY_PACKAGE_NAME "${PACKAGE_NAME}")
-    set(CPACK_${TYPE}_HEADERS_PACKAGE_NAME "${PACKAGE_NAME}-dev")
-    set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_NAME "${PACKAGE_NAME}-doc")
+       set(CPACK_${TYPE}_LIBRARY_PACKAGE_NAME "${PACKAGE_NAME}")
+       set(CPACK_${TYPE}_HEADERS_PACKAGE_NAME "${PACKAGE_NAME}-dev")
+       set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_NAME "${PACKAGE_NAME}-doc")
 
-    set(CPACK_${TYPE}_LIBRARY_FILE_NAME "${PACKAGE_NAME}_${PACKAGE_VERSION}_${ARCHITECTURE}.deb")
-    set(CPACK_${TYPE}_HEADERS_FILE_NAME "${PACKAGE_NAME}-dev_${PACKAGE_VERSION}_${ARCHITECTURE}.deb")
-    set(CPACK_${TYPE}_DOCUMENTATION_FILE_NAME "${PACKAGE_NAME}-doc_${PACKAGE_VERSION}_${ARCHITECTURE}.deb")
+       set(CPACK_${TYPE}_LIBRARY_FILE_NAME "${PACKAGE_NAME}_${PACKAGE_VERSION}_${ARCHITECTURE}.deb")
+       set(CPACK_${TYPE}_HEADERS_FILE_NAME "${PACKAGE_NAME}-dev_${PACKAGE_VERSION}_${ARCHITECTURE}.deb")
+       set(CPACK_${TYPE}_DOCUMENTATION_FILE_NAME "${PACKAGE_NAME}-doc_${PACKAGE_VERSION}_${ARCHITECTURE}.deb")
 
-    set(CPACK_${TYPE}_PACKAGE_SHLIBDEPS ON)
-    set(CPACK_${TYPE}_LIBRARY_PACKAGE_DEPENDS "")
-    set(CPACK_${TYPE}_HEADERS_PACKAGE_DEPENDS "libdash (>= 1.0), libxml2-dev, libcurl4-openssl-dev")
-    set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_DEPENDS "")
+       set(CPACK_${TYPE}_PACKAGE_SHLIBDEPS ON)
+       set(CPACK_${TYPE}_LIBRARY_PACKAGE_DEPENDS "")
+       set(CPACK_${TYPE}_HEADERS_PACKAGE_DEPENDS "libdash (>= 1.0), libxml2-dev, libcurl4-openssl-dev")
+       set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_DEPENDS "")
 elseif(RPM_PACKAGE)
-    set(TYPE "RPM")
-    set(GENERATOR "RPM")
+       set(TYPE "RPM")
+       set(GENERATOR "RPM")
 
-    set(CPACK_${TYPE}_LIBRARY_PACKAGE_NAME "${PACKAGE_NAME}")
-    set(CPACK_${TYPE}_HEADERS_PACKAGE_NAME "${PACKAGE_NAME}-devel")
-    set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_NAME "${PACKAGE_NAME}-doc")
+       set(CPACK_${TYPE}_LIBRARY_PACKAGE_NAME "${PACKAGE_NAME}")
+       set(CPACK_${TYPE}_HEADERS_PACKAGE_NAME "${PACKAGE_NAME}-devel")
+       set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_NAME "${PACKAGE_NAME}-doc")
 
-    set(CPACK_${TYPE}_LIBRARY_FILE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}.${ARCHITECTURE}.rpm")
-    set(CPACK_${TYPE}_HEADERS_FILE_NAME "${PACKAGE_NAME}-devel-${PACKAGE_VERSION}.${ARCHITECTURE}.rpm")
-    set(CPACK_${TYPE}_DOCUMENTATION_FILE_NAME "${PACKAGE_NAME}-doc-${PACKAGE_VERSION}.${ARCHITECTURE}.rpm")
+       set(CPACK_${TYPE}_LIBRARY_FILE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}.${ARCHITECTURE}.rpm")
+       set(CPACK_${TYPE}_HEADERS_FILE_NAME "${PACKAGE_NAME}-devel-${PACKAGE_VERSION}.${ARCHITECTURE}.rpm")
+       set(CPACK_${TYPE}_DOCUMENTATION_FILE_NAME "${PACKAGE_NAME}-doc-${PACKAGE_VERSION}.${ARCHITECTURE}.rpm")
 
-    set(CPACK_${TYPE}_PACKAGE_AUTOREQ ON)
-    set(CPACK_${TYPE}_LIBRARY_PACKAGE_REQUIRES "")
-    set(CPACK_${TYPE}_HEADERS_PACKAGE_REQUIRES "libdash >= 1.0, libxml2-devel, libcurl-openssl-devel")
-    set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_REQUIRES "")
+       set(CPACK_${TYPE}_PACKAGE_AUTOREQ ON)
+       set(CPACK_${TYPE}_LIBRARY_PACKAGE_REQUIRES "")
+       set(CPACK_${TYPE}_HEADERS_PACKAGE_REQUIRES "libdash >= 1.0, libxml2-devel, libcurl-openssl-devel")
+       set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_REQUIRES "")
 
-    set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/etc" "/usr/lib/python2.7" "/usr/lib/python2.7/site-packages")
+       set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/etc" "/usr/lib/python2.7" "/usr/lib/python2.7/site-packages")
 else()
-    return()
+       return()
 endif()
 
 set(CPACK_GENERATOR ${GENERATOR})
@@ -247,4 +263,4 @@ set(CPACK_${TYPE}_PACKAGE_RELEASE 1)
 set(CPACK_${TYPE}_PACKAGE_VENDOR ${VENDOR})
 set(CPACK_${TYPE}_PACKAGE_DESCRIPTION "Open-source library that provides an object orient (OO) interface to the MPEG-DASH standard")
 
-include(CPack)
+include(CPack)
\ No newline at end of file
index c1c95df..2bac744 100644 (file)
--- a/viper.pro
+++ b/viper.pro
@@ -18,18 +18,15 @@ android {
   QT += androidextras
 }
 
-CONFIG += release
+message($$TRANSPORT_LIBRARY)
+CONFIG -= release
+CONFIG += debug
 CONFIG += c++11
-
-
-INCLUDEPATH += /usr/include/libdash
-INCLUDEPATH += /usr/include/libxml2
 QMAKE_CXXFLAGS += -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DANDROID_STL=c++_static #-DICNICPDOWNLOAD
 QMAKE_CXXFLAGS += -std=c++11 -g -fpermissive
 # Add more folders to ship with the application, here
 folder_01.source = qml/Viper
 folder_01.target = qml
-LIBS += -licnet
 
 
 RESOURCES += \
@@ -273,17 +270,29 @@ SOURCES *= \
 
 unix:!macx:!android {
     INCLUDEPATH += /usr/local/include
-    INCLUDEPATH += /usr/local/include/libdash
+    INCLUDEPATH += /usr/include
+    INCLUDEPATH += /usr/include/libdash
+    equals(TRANSPORT_LIBRARY, "HICNET") {
+           LIBS += -L/usr/local/lib -ldash -lboost_system -lhicnet -lavcodec -lavutil -lavformat
+       DEFINES += "HICNET=ON"
+    } else {
+        LIBS += -L/usr/local/lib -ldash -lboost_system -licnet -lavcodec -lavutil -lavformat
+       DEFINES += "ICNET=ON"
+    }
 
-    LIBS += -L/usr/local/lib -ldash -lboost_system -licnet -lavcodec -lavutil -lavformat
 }
 
 macx:!ios {
 
-#SOURCE is ok
     INCLUDEPATH += /usr/local/include
     INCLUDEPATH += /usr/local/include/libdash
-    LIBS +=  -framework CoreServices -L"/usr/local/lib"  -ldash -lavformat -lavutil -lavcodec -lboost_system -lboost_regex -lswscale -licnet -lssl -lcrypto
+    equals(TRANSPORT_LIBRARY, "HICNET") {
+        LIBS += -L"/usr/local/lib" -framework CoreServices -ldash -lavformat -lavutil -lavcodec -lboost_system -lboost_regex -lswscale -lhicnet -lssl -lcrypto
+               DEFINES += "HICNET=ON"
+       } else {
+           LIBS += -L"/usr/local/lib" -framework CoreServices -ldash -lavformat -lavutil -lavcodec -lboost_system -lboost_regex -lswscale -licnet -lssl -lcrypto
+               DEFINES += "ICNET=ON"
+       }
 }
 SOURCES *= main.cpp
 android {
@@ -296,11 +305,17 @@ android {
     android/gradle/wrapper/gradle-wrapper.properties \
     android/gradlew \
     android/gradlew.bat
+
     ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
-    INCLUDEPATH += $$(QT_HOME)/5.7/android_armv7/include
-    INCLUDEPATH += $$(QT_HOME)/5.7/android_armv7/include/libdash
-    LIBS += -lstdc++  -licnet -lgnustl_shared -ldash  -lavcodec -lavutil -lavformat   -lboost_system # -lccnx_api_control -lccnx_api_notify -lccnx_api_portal -lccnx_common -lccnx_transport_rta #-lparc -lcrypto  #-llongbow-textplain -llongbow-ansiterm -llongbow
-#user can put fonts in android/assets/fonts
+    INCLUDEPATH += $$(CCNX_HOME)/include
+       INCLUDEPATH += $$(CCNX_HOME)/include/libdash
+    equals(TRANSPORT_LIBRARY, "HICNET") {
+        LIBS += -L"$$(CCNX_HOME)/lib" -lhicnet -ljsoncpp -ldash -lcurl-library -lcurl  -lxml2 -lccnx_hicn_api_portal -lccnx_hicn_transport_rta -lccnx_hicn_api_control -lccnx_hicn_api_notify -lccnx_common -lparc -llongbow -llongbow-ansiterm -llongbow-textplain -lhicn -levent -lssl -lcrypto -ldash  -lavcodec -lavutil -lavformat   -lboost_system
+               DEFINES += "HICNET=ON"
+       } else {
+           LIBS +=  -lconsumer-producer -ldash  -lavcodec -lavutil -lavformat   -lboost_system
+               DEFINES += "ICNET=ON"
+       }
 }