aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Sardara <msardara+fdio@cisco.com>2017-06-05 18:59:26 +0200
committerMauro Sardara <msardara+fdio@cisco.com>2017-06-05 18:51:15 +0000
commit473e4b514ff411a1d4372f29eccea616d7ea4c60 (patch)
tree6632c5dc686df63546dbf7b0bb5d171d4707e5d7
parent1ae6dc57663401973bbbdd090776494b194957d1 (diff)
- Changed library icnet - application interface
Change-Id: I25112ab1e1401a21ed2530d3874a7b4bf740ec5d Signed-off-by: Mauro Sardara <msardara+fdio@cisco.com>
-rw-r--r--CMakeLists.txt11
-rw-r--r--Common/Config.cpp2
-rw-r--r--Common/ViperBuffer.cpp1
-rw-r--r--Input/DASHReceiver.cpp2
-rw-r--r--Input/ICNConnectionConsumerApi.cpp149
-rw-r--r--Input/ICNConnectionConsumerApi.h21
-rw-r--r--MPD/AdaptationSetHelper.h1
-rw-r--r--MPD/TimeResolver.h6
-rw-r--r--Managers/MultimediaManager.cpp3
-rw-r--r--UI/DASHPlayer.cpp4
-rw-r--r--UI/DASHPlayer.h1
-rw-r--r--Websocket/query.cpp36
-rw-r--r--Websocket/query.h4
-rw-r--r--android/AndroidManifest.xml2
-rw-r--r--android/gradle.properties1
-rw-r--r--dockerfile.ubuntu.xenial47
-rw-r--r--libdash/CMakeLists.txt80
-rw-r--r--viper.pro43
18 files changed, 220 insertions, 194 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fdd6dbf0..45fbe615 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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
diff --git a/Common/Config.cpp b/Common/Config.cpp
index 04d999c5..85278251 100644
--- a/Common/Config.cpp
+++ b/Common/Config.cpp
@@ -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());
diff --git a/Common/ViperBuffer.cpp b/Common/ViperBuffer.cpp
index 27ec8b5e..90d10d63 100644
--- a/Common/ViperBuffer.cpp
+++ b/Common/ViperBuffer.cpp
@@ -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);
diff --git a/Input/DASHReceiver.cpp b/Input/DASHReceiver.cpp
index e7a5c5c2..df9d019b 100644
--- a/Input/DASHReceiver.cpp
+++ b/Input/DASHReceiver.cpp
@@ -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;
diff --git a/Input/ICNConnectionConsumerApi.cpp b/Input/ICNConnectionConsumerApi.cpp
index d38642e4..62e9ecdf 100644
--- a/Input/ICNConnectionConsumerApi.cpp
+++ b/Input/ICNConnectionConsumerApi.cpp
@@ -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()
{
diff --git a/Input/ICNConnectionConsumerApi.h b/Input/ICNConnectionConsumerApi.h
index a62f6b01..0ee5cba7 100644
--- a/Input/ICNConnectionConsumerApi.h
+++ b/Input/ICNConnectionConsumerApi.h
@@ -16,6 +16,13 @@
#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;
diff --git a/MPD/AdaptationSetHelper.h b/MPD/AdaptationSetHelper.h
index 41724413..683d0f0c 100644
--- a/MPD/AdaptationSetHelper.h
+++ b/MPD/AdaptationSetHelper.h
@@ -13,6 +13,7 @@
#define LIBDASH_FRAMEWORK_MPD_ADAPTATIONSETHELPER_H_
#include "IMPD.h"
+#include <QMessageLogger>
namespace libdash
{
diff --git a/MPD/TimeResolver.h b/MPD/TimeResolver.h
index fe320e8d..89ea2049 100644
--- a/MPD/TimeResolver.h
+++ b/MPD/TimeResolver.h
@@ -13,7 +13,11 @@
#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
{
diff --git a/Managers/MultimediaManager.cpp b/Managers/MultimediaManager.cpp
index faab66cf..52dbd6a7 100644
--- a/Managers/MultimediaManager.cpp
+++ b/Managers/MultimediaManager.cpp
@@ -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;
}
diff --git a/UI/DASHPlayer.cpp b/UI/DASHPlayer.cpp
index 52b45b0b..b87dde74 100644
--- a/UI/DASHPlayer.cpp
+++ b/UI/DASHPlayer.cpp
@@ -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);
}
diff --git a/UI/DASHPlayer.h b/UI/DASHPlayer.h
index f63dfbb5..8913a843 100644
--- a/UI/DASHPlayer.h
+++ b/UI/DASHPlayer.h
@@ -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>
diff --git a/Websocket/query.cpp b/Websocket/query.cpp
index d7221ff8..c0bcaf66 100644
--- a/Websocket/query.cpp
+++ b/Websocket/query.cpp
@@ -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();
diff --git a/Websocket/query.h b/Websocket/query.h
index 193610b4..a1d2e222 100644
--- a/Websocket/query.h
+++ b/Websocket/query.h
@@ -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;
diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
index 9090f9c0..aaac206d 100644
--- a/android/AndroidManifest.xml
+++ b/android/AndroidManifest.xml
@@ -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>
diff --git a/android/gradle.properties b/android/gradle.properties
index a694f3fa..5582cc87 100644
--- a/android/gradle.properties
+++ b/android/gradle.properties
@@ -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
index 00000000..74e6d2fb
--- /dev/null
+++ b/dockerfile.ubuntu.xenial
@@ -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
diff --git a/libdash/CMakeLists.txt b/libdash/CMakeLists.txt
index 7041a005..4b9e73ce 100644
--- a/libdash/CMakeLists.txt
+++ b/libdash/CMakeLists.txt
@@ -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
diff --git a/viper.pro b/viper.pro
index c1c95df9..2bac7446 100644
--- 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"
+ }
}