[DEV] not work display player, but need to same on git

This commit is contained in:
Edouard DUPIN 2017-02-15 21:04:13 +01:00
parent 3b0a4cd27c
commit 8a92ef772b
19 changed files with 384 additions and 197 deletions

View File

@ -49,6 +49,12 @@ void appl::ClientProperty::fromJson(ejson::Object _obj) {
}
void appl::ClientProperty::connect() {
if (connection.isAlive() == true) {
connection.pingIsAlive();
if (connection.isAlive() == true) {
return;
}
}
// Generate IP and Port in the client interface
if (address == "") {
connection.propertyIp.set("127.0.0.1");

View File

@ -16,6 +16,7 @@
#include <ewol/context/Context.hpp>
#include <appl/widget/VideoPlayer.hpp>
#include <appl/widget/ListViewer.hpp>
#include <appl/widget/Player.hpp>
#include <zeus/zeus.hpp>
namespace appl {
@ -70,6 +71,7 @@ namespace appl {
// set application widget:
appl::widget::VideoDisplay::createManagerWidget(_context.getWidgetManager());
appl::widget::ListViewer::createManagerWidget(_context.getWidgetManager());
appl::widget::Player::createManagerWidget(_context.getWidgetManager());
// Create the windows
ememory::SharedPtr<appl::Windows> basicWindows = appl::Windows::create();
// configure the ewol context to use the new windows

View File

@ -22,7 +22,6 @@
#define BUFFER_SIZE_GET_SLOT (1024*512)
static int g_readFunc(void* _opaque, uint8_t* _buf, int _bufSize) {
if (_opaque == nullptr) {
return 0;
@ -354,38 +353,33 @@ void appl::MediaDecoder::init(ememory::SharedPtr<ClientProperty> _property, uint
APPL_ERROR("Request play of not connected handle ==> 'not alive'");
return;
}
APPL_ERROR("AAAAAAAAAAAA");
zeus::service::ProxyVideo remoteServiceVideo = _property->connection.getService("video");
// remove all media (for test)
if (remoteServiceVideo.exist() == false) {
APPL_ERROR("Video service is ==> 'not alive'");
return;
}
APPL_ERROR("AAAA 222");
m_remote = ememory::makeShared<appl::StreamBuffering>();
m_remote->m_bufferReadPosition = 0;
m_remote->m_property = _property;
m_remote->m_mediaId = _mediaId;
APPL_ERROR("AAAA 333");
remoteServiceVideo.mediaGet(_mediaId).andThen(
[=](zeus::Future<zeus::ProxyFile> _fut) mutable {
APPL_ERROR("Receive ProxyFile");
APPL_INFO("Receive ProxyFile");
m_remote->m_fileHandle = _fut.get();
m_remote->m_fileHandle.getSize().andThen(
[=](zeus::Future<uint64_t> _fut) mutable {
APPL_ERROR("Receive FileSize to index property");
APPL_INFO("Receive FileSize to index property");
m_remote->m_buffer.resize(_fut.get(), 0);
m_remote->checkIfWeNeedMoreDataFromNetwork();
return true;
});
return true;
});
init();
}
int appl::MediaDecoder::readFunc(uint8_t* _buf, int _bufSize) {
APPL_ERROR("call read ... " << m_remote->m_bufferReadPosition << " size=" << _bufSize);
APPL_INFO("call read ... " << m_remote->m_bufferReadPosition << " size=" << _bufSize);
// check if enought data:
int64_t readableSize = m_remote->sizeReadable();
if (_bufSize > readableSize) {
@ -400,6 +394,7 @@ int appl::MediaDecoder::readFunc(uint8_t* _buf, int _bufSize) {
memcpy(_buf, &m_remote->m_buffer[m_remote->m_bufferReadPosition], _bufSize);
m_remote->m_bufferReadPosition += _bufSize;
}
m_remote->startStream();
m_remote->checkIfWeNeedMoreDataFromNetwork();
return _bufSize;
}
@ -522,9 +517,17 @@ bool appl::StreamBuffering::addDataCallback(zeus::Future<zeus::Raw> _fut, int64_
appl::StreamBuffering::StreamBuffering() {
m_callInProgress = false;
m_stopRequested = false;
m_mediaId = 0;
m_bufferReadPosition = 0;
}
void appl::StreamBuffering::stopStream() {
m_stopRequested = true;
}
void appl::StreamBuffering::startStream() {
m_stopRequested = false;
}
void appl::StreamBuffering::checkIfWeNeedMoreDataFromNetwork() {
std::unique_lock<std::mutex> lock(m_mutex);
@ -533,18 +536,21 @@ void appl::StreamBuffering::checkIfWeNeedMoreDataFromNetwork() {
if (m_callInProgress == true) {
return;
}
if (m_stopRequested == true) {
return;
}
int32_t preDownloadBufferSlot = BUFFER_SIZE_GET_SLOT*3;
// When file is < 200Mo ==> just download all...
if (m_buffer.size() < 300*1024*1024) {
preDownloadBufferSlot = m_buffer.size()+10;
}
APPL_INFO("Request DATA ...");
APPL_VERBOSE("Request DATA ...");
auto it = m_bufferFillSection.begin();
if (it == m_bufferFillSection.end()) {
// no data in the buffer...
//Get some
// start with loading of 1 Mo
APPL_INFO("Request DATA : " << 0 << " size=" << BUFFER_SIZE_GET_SLOT);
APPL_VERBOSE("Request DATA : " << 0 << " size=" << BUFFER_SIZE_GET_SLOT);
auto futData = m_fileHandle.getPart(0, BUFFER_SIZE_GET_SLOT);
auto localShared = ememory::dynamicPointerCast<appl::StreamBuffering>(sharedFromThis());
futData.andThen([=](zeus::Future<zeus::Raw> _fut) mutable {
@ -554,10 +560,9 @@ void appl::StreamBuffering::checkIfWeNeedMoreDataFromNetwork() {
return;
}
while (it != m_bufferFillSection.end()) {
APPL_INFO("Check : " << it->first << " -> " << it->second << " read-pos=" << m_bufferReadPosition);
APPL_VERBOSE("Check : " << it->first << " -> " << it->second << " read-pos=" << m_bufferReadPosition);
if ( m_bufferReadPosition >= it->first
&& m_bufferReadPosition < it->second) {
APPL_INFO("Request DATA AAAA ");
find = true;
// part already download... ==> check if we need more data after end position
if (it->second == m_buffer.size()) {
@ -575,7 +580,7 @@ void appl::StreamBuffering::checkIfWeNeedMoreDataFromNetwork() {
&& it->second + sizeRequest >= it2->first) {
sizeRequest = it2->first - it->second;
}
APPL_INFO("Request DATA : " << it->second << " size=" << sizeRequest);
APPL_VERBOSE("Request DATA : " << it->second << " size=" << sizeRequest);
auto futData = m_fileHandle.getPart(it->second, it->second + sizeRequest);
auto localShared = ememory::dynamicPointerCast<appl::StreamBuffering>(sharedFromThis());
futData.andThen([=](zeus::Future<zeus::Raw> _fut) mutable {
@ -586,12 +591,11 @@ void appl::StreamBuffering::checkIfWeNeedMoreDataFromNetwork() {
// nothing more to do ...
return;
} else if (m_bufferReadPosition < it->first) {
APPL_INFO("Request DATA KKKKK ");
int32_t sizeRequest = BUFFER_SIZE_GET_SLOT;
if (m_bufferReadPosition + sizeRequest >= it->first) {
sizeRequest = it->first - m_bufferReadPosition;
}
APPL_INFO("Request DATA : " << m_bufferReadPosition << " size=" << sizeRequest);
APPL_VERBOSE("Request DATA : " << m_bufferReadPosition << " size=" << sizeRequest);
auto futData = m_fileHandle.getPart(m_bufferReadPosition, m_bufferReadPosition+sizeRequest);
auto localShared = ememory::dynamicPointerCast<appl::StreamBuffering>(sharedFromThis());
futData.andThen([=](zeus::Future<zeus::Raw> _fut) mutable {
@ -603,8 +607,7 @@ void appl::StreamBuffering::checkIfWeNeedMoreDataFromNetwork() {
}
++it;
}
APPL_INFO("Request DATA RRRRR ");
APPL_INFO("Request DATA : " << m_bufferReadPosition << " size=" << BUFFER_SIZE_GET_SLOT);
APPL_VERBOSE("Request DATA : " << m_bufferReadPosition << " size=" << BUFFER_SIZE_GET_SLOT);
auto futData = m_fileHandle.getPart(m_bufferReadPosition, m_bufferReadPosition + BUFFER_SIZE_GET_SLOT);
auto localShared = ememory::dynamicPointerCast<appl::StreamBuffering>(sharedFromThis());
futData.andThen([=](zeus::Future<zeus::Raw> _fut) mutable {
@ -618,13 +621,13 @@ void appl::StreamBuffering::checkIfWeNeedMoreDataFromNetwork() {
}
void appl::MediaDecoder::init() {
//APPL_ERROR("AAAAAAAAAAAA " << m_isInit << " " << m_remote->sizeReadable());
if ( m_isInit == true
|| m_remote == nullptr
|| m_remote->sizeReadable() < 1024*1024) {// Need to wait at lease 1MB
return;
}
m_remote->startStream();
m_updateVideoTimeStampAfterSeek = false;
//m_sourceFilename = _filename;
ethread::setName("ffmpegThread");
@ -635,13 +638,12 @@ void appl::MediaDecoder::init() {
return;
}
#else
if (!(m_formatContext = avformat_alloc_context())) {
APPL_ERROR("Could not create Format context");
return;
}
m_bufferFFMPEG.resize(1024*1024); // 1Mo buffer is good enought
m_IOContext = avio_alloc_context(&m_bufferFFMPEG[0], m_bufferFFMPEG.size(), 0 /* can not write */, this, g_readFunc, g_writeFunc, g_seekFunc);
uint8_t* ploooooo = (uint8_t*)av_malloc(1024*1024);
m_IOContext = avio_alloc_context(ploooooo, 1024*1024, 0 /* can not write */, this, g_readFunc, g_writeFunc, g_seekFunc);
if (m_IOContext == nullptr) {
APPL_ERROR("Could not create IO stream");
return;
@ -805,15 +807,37 @@ void appl::MediaDecoder::uninit() {
return;
}
APPL_PRINT("Demuxing & Decoding succeeded...");
flushMessage();
avcodec_close(m_videoDecoderContext);
avcodec_close(m_audioDecoderContext);
m_formatContext->pb = nullptr;
avformat_close_input(&m_formatContext);
av_frame_free(&m_frame);
av_free(m_IOContext);
m_IOContext = nullptr;
m_audioPool.clear();
m_videoPool.clear();
m_updateVideoTimeStampAfterSeek = false;
m_videoStream = nullptr;
m_audioStream = nullptr;
m_sourceFilename = "";
m_videoStream_idx = 0;
m_audioStream_idx = 0;
m_videoFrameCount = 0;
m_audioFrameCount = 0;
// output format convertion:
m_convertContext = nullptr;
m_remote.reset();
m_isInit = false;
APPL_PRINT("Demuxing & Decoding succeeded... (DONE)");
}
void appl::MediaDecoder::stop() {
m_stopRequested = true;
if (m_remote != nullptr) {
m_remote->stopStream();
}
gale::Thread::stop();
}
void appl::MediaDecoder::flushMessage() {

View File

@ -66,6 +66,7 @@ namespace appl {
int32_t m_bufferReadPosition; //!< Current position that is read
std::vector<std::pair<uint32_t,uint32_t>> m_bufferFillSection; //!< List of <start-stop> position that contain data
bool m_callInProgress;
bool m_stopRequested;
public:
bool addDataCallback(zeus::Future<zeus::Raw> _fut, int64_t _positionRequest);
void checkIfWeNeedMoreDataFromNetwork();
@ -76,6 +77,8 @@ namespace appl {
return m_bufferFillSection;
}
int32_t sizeReadable();
void stopStream();
void startStream();
};
class MediaDecoder : public gale::Thread {
bool m_stopRequested;
@ -102,7 +105,6 @@ namespace appl {
int32_t audioGetEmptySlot();
private:
AVIOContext* m_IOContext;
std::vector<uint8_t> m_bufferFFMPEG;
AVFormatContext* m_formatContext;
AVCodecContext* m_videoDecoderContext;
AVCodecContext* m_audioDecoderContext;

View File

@ -36,8 +36,6 @@ void appl::Windows::store_db() {
if (m_clientProp != nullptr) {
database.add("access", m_clientProp->toJson());
}
//database.add("login", ejson::String(m_login));
//database.add("pass", ejson::String(m_password));
bool retGenerate = database.storeSafe(g_baseDBName);
APPL_ERROR("Store database [STOP] : " << (g_baseDBName) << " ret = " << retGenerate);
}
@ -59,8 +57,6 @@ void appl::Windows::load_db() {
if (m_clientProp != nullptr) {
m_clientProp->fromJson(database["access"].toObject());
}
//m_login = database["login"].toString().get();
//m_password = database["pass"].toString().get();
}
@ -92,11 +88,6 @@ void appl::Windows::init() {
subBind(appl::widget::VideoDisplay, "displayer", signalPosition, sharedFromThis(), &appl::Windows::onCallbackPosition);
subBind(ewol::widget::Slider, "progress-bar", signalChange, sharedFromThis(), &appl::Windows::onCallbackSeekRequest);
/*
subBind(ewol::widget::Entry, "connect-login", signalModify, sharedFromThis(), &appl::Windows::onCallbackConnectLogin);
subBind(ewol::widget::Entry, "connect-password", signalModify, sharedFromThis(), &appl::Windows::onCallbackConnectPassword);
subBind(ewol::widget::Button, "connect-bt", signalPressed, sharedFromThis(), &appl::Windows::onCallbackConnectConnect);
subBind(ewol::widget::Button, "bt-film-picture", signalPressed, sharedFromThis(), &appl::Windows::onCallbackSelectFilms);
subBind(ewol::widget::Button, "bt-film-draw", signalPressed, sharedFromThis(), &appl::Windows::onCallbackSelectAnnimation);
@ -105,10 +96,9 @@ void appl::Windows::init() {
subBind(ewol::widget::Button, "bt-theater", signalPressed, sharedFromThis(), &appl::Windows::onCallbackSelectTeather);
subBind(ewol::widget::Button, "bt-one-man-show", signalPressed, sharedFromThis(), &appl::Windows::onCallbackSelectOneManShow);
subBind(ewol::widget::Button, "bt-courses", signalPressed, sharedFromThis(), &appl::Windows::onCallbackSelectSourses);
*/
propertySetOnWidgetNamed("connect-login", "value", m_login);
propertySetOnWidgetNamed("connect-password", "value", m_password);
subBind(ewol::widget::Button, "access-fast-home", signalPressed, sharedFromThis(), &appl::Windows::onCallbackSelectHome);
subBind(ewol::widget::Button, "access-fast-group", signalPressed, sharedFromThis(), &appl::Windows::onCallbackSelectGroup);
// Direct display list:
ewol::propertySetOnObjectNamed("view-selection", "select", "ws-name-list-viewer");
@ -156,6 +146,45 @@ void appl::Windows::onCallbackMenuEvent(const std::string& _value) {
popUpWidgetPush(tmpWidget);
} else if (_value == "menu:exit") {
gale::getContext().stop();
} else if (_value == "menu:home") {
ewol::propertySetOnObjectNamed("view-selection", "select", "ws-name-list-viewer");
m_listViewer->searchElements("");
} else if (_value == "menu:group") {
ewol::propertySetOnObjectNamed("view-selection", "select", "ws-name-list-group");
} else if (_value == "menu:tv") {
ewol::propertySetOnObjectNamed("view-selection", "select", "ws-name-list-tv");
} else if (_value == "menu:films") {
ewol::propertySetOnObjectNamed("view-selection", "select", "ws-name-list-viewer");
m_listViewer->searchElements("film");
} else if (_value == "menu:animation-films") {
ewol::propertySetOnObjectNamed("view-selection", "select", "ws-name-list-viewer");
m_listViewer->searchElements("annimation");
} else if (_value == "menu:tv-show") {
ewol::propertySetOnObjectNamed("view-selection", "select", "ws-name-list-viewer");
m_listViewer->searchElements("tv-show");
} else if (_value == "menu:animation-tv-show") {
ewol::propertySetOnObjectNamed("view-selection", "select", "ws-name-list-viewer");
m_listViewer->searchElements("tv-annimation");
} else if (_value == "menu:teather") {
ewol::propertySetOnObjectNamed("view-selection", "select", "ws-name-list-viewer");
m_listViewer->searchElements("teather");
} else if (_value == "menu:one-man-show") {
ewol::propertySetOnObjectNamed("view-selection", "select", "ws-name-list-viewer");
m_listViewer->searchElements("one-man");
} else if (_value == "menu:courses") {
ewol::propertySetOnObjectNamed("view-selection", "select", "ws-name-list-viewer");
m_listViewer->searchElements("courses");
} else if (_value == "menu:TV-child") {
ewol::propertySetOnObjectNamed("view-selection", "select", "ws-name-list-viewer");
m_listViewer->searchElements("");
// TODO: ...
} else if (_value == "menu:TV-adult") {
ewol::propertySetOnObjectNamed("view-selection", "select", "ws-name-list-viewer");
m_listViewer->searchElements("");
// TODO: ...
} else if (_value == "menu:reload-shader") {
ewol::getContext().getResourcesManager().reLoadResources();
ewol::getContext().forceRedrawAll();
@ -272,65 +301,6 @@ void appl::Windows::onCallbackSeekRequest(const float& _value) {
}
}
void appl::Windows::onCallbackConnectLogin(const std::string& _value) {
m_login = _value;
store_db();
}
void appl::Windows::onCallbackConnectPassword(const std::string& _value) {
m_password = _value;
store_db();
}
void appl::Windows::onCallbackConnectConnect() {
APPL_INFO("Connect with : '" << m_login << "' ... '" << m_password << "'");
m_clientProp = ememory::makeShared<ClientProperty>();
if (m_clientProp == nullptr) {
APPL_ERROR("Can not create property");
return;
}
m_clientProp->address = "127.0.0.1";
m_clientProp->port = 1983;
// check connection is correct:
zeus::Client client1;
// separate loggin and IP adress ...
std::string login;
std::vector<std::string> listElem = etk::split(m_login, '~');
login = listElem[0];
if (listElem.size() == 1) {
// connnect on local host ... nothing to do
} else {
std::vector<std::string> listElem2 = etk::split(listElem[0], ':');
client1.propertyIp.set(listElem2[0]);
m_clientProp->address = listElem2[0];
if (listElem2.size() >= 1) {
client1.propertyPort.set(etk::string_to_uint32_t(listElem2[1]));
m_clientProp->port = etk::string_to_uint32_t(listElem2[1]);
}
}
m_clientProp->fromUser = login;
m_clientProp->toUser = login;
m_clientProp->pass = m_password;
m_clientProp->connect();
if (m_clientProp->connection.isAlive() == false) {
APPL_ERROR(" ==> NOT Authentify to '" << login << "'");
ewol::tools::message::displayError("Can not connect the server with <br/>'" + login + "'");
} else {
APPL_INFO(" ==> Authentify with '" << login << "'");
ewol::propertySetOnObjectNamed("view-selection", "select", "ws-name-list");
// set the client property interface:
if (m_listViewer == nullptr) {
APPL_ERROR("Nullptr in the viewer ...");
} else {
m_listViewer->setClientProperty(m_clientProp);
}
}
}
void appl::Windows::onCallbackSelectFilms() {
ewol::propertySetOnObjectNamed("view-selection", "select", "ws-name-list-viewer");
m_listViewer->searchElements("film");

View File

@ -41,11 +41,6 @@ namespace appl {
void onCallbackShortCut(const std::string& _value);
void onCallbackMenuEvent(const std::string& _value);
protected:
std::string m_login;
std::string m_password;
void onCallbackConnectLogin(const std::string& _value);
void onCallbackConnectPassword(const std::string& _value);
void onCallbackConnectConnect();
void load_db();
void store_db();
void onCallbackSelectFilms();
@ -56,6 +51,12 @@ namespace appl {
void onCallbackSelectOneManShow();
void onCallbackSelectSourses();
void onCallbackSelectMedia(const uint32_t& _value);
void onCallbackSelectGroup() {
onCallbackMenuEvent("menu:group");
}
void onCallbackSelectHome() {
onCallbackMenuEvent("menu:home");
}
};
}

View File

@ -29,7 +29,7 @@ appl::widget::ListViewer::ListViewer() :
signalSelect(this, "select", "Select a media to view") {
addObjectType("appl::widget::ListViewer");
propertyCanFocus.setDirectCheck(true);
// Limit event at 1:
setLimitScrolling(0.2);
setMouseLimit(1);
}
@ -46,6 +46,7 @@ appl::widget::ListViewer::~ListViewer() {
void appl::widget::ListViewer::searchElements(std::string _filter) {
m_listElement.clear();
m_listDisplay.clear();
if (m_clientProp == nullptr) {
APPL_ERROR("No client Availlable ...");
return;
@ -68,6 +69,7 @@ void appl::widget::ListViewer::searchElements(std::string _filter) {
_filter = "*";
}
m_clientProp->connect();
if (m_clientProp->connection.isAlive() == false) {
APPL_ERROR("Conection is not alive anymore ...");
return;
@ -148,6 +150,26 @@ void appl::widget::ListViewer::searchElements(std::string _filter) {
tmpWidget->markToRedraw();
return true;
});
remoteServiceVideo.mediaMetadataGetKey(it, "production-methode")
.andThen([=](zeus::Future<std::string> _fut) mutable {
APPL_INFO(" [" << elem->m_id << "] get production-methode: " << _fut.get());
{
std::unique_lock<std::mutex> lock(elem->m_mutex);
elem->m_productMethode = _fut.get();
}
tmpWidget->markToRedraw();
return true;
});
remoteServiceVideo.mediaMetadataGetKey(it, "type")
.andThen([=](zeus::Future<std::string> _fut) mutable {
APPL_INFO(" [" << elem->m_id << "] get type: " << _fut.get());
{
std::unique_lock<std::mutex> lock(elem->m_mutex);
elem->m_type = _fut.get();
}
tmpWidget->markToRedraw();
return true;
});
remoteServiceVideo.mediaMineTypeGet(it)
.andThen([=](zeus::Future<std::string> _fut) mutable {
APPL_INFO(" [" << elem->m_id << "] get mine-type: " << _fut.get());
@ -165,22 +187,6 @@ void appl::widget::ListViewer::searchElements(std::string _filter) {
tmpWidget->markToRedraw();
return true;
});
/*
elem->m_title = remoteServiceVideo.mediaMetadataGetKey(it, "title").wait().get();
elem->m_serie = remoteServiceVideo.mediaMetadataGetKey(it, "series-name").wait().get();
elem->m_saison = remoteServiceVideo.mediaMetadataGetKey(it, "saison").wait().get();
elem->m_episode = remoteServiceVideo.mediaMetadataGetKey(it, "episode").wait().get();
elem->m_description = remoteServiceVideo.mediaMetadataGetKey(it, "description").wait().get();
elem->m_mineType = remoteServiceVideo.mediaMineTypeGet(it).wait().get();
if (etk::start_with(elem->m_mineType, "video") == true) {
// TODO : Optimise this ...
elem->m_thumb = egami::load("DATA:Video.svg", ivec2(128,128));
} else if (etk::start_with(elem->m_mineType, "audio") == true) {
// TODO : Optimise this ...
elem->m_thumb = egami::load("DATA:MusicNote.svg", ivec2(128,128));
}
elem->m_metadataUpdated = true;
*/
elem->m_metadataUpdated = true;
//elem->m_thumb = remoteServiceVideo.mediaThumbGet(it, 128).wait().get();
m_listElement.push_back(elem);
@ -286,7 +292,7 @@ void appl::widget::ListViewer::onRegenerateDisplay() {
if (iii < m_listElement.size()) {
elem->m_property = m_listElement[iii];
}
switch(iii) {
switch(iii%6) {
case 0:
elem->m_bgColor = etk::color::red;
break;
@ -315,13 +321,18 @@ void appl::widget::ListViewer::onRegenerateDisplay() {
}
// Now we request display of the elements:
vec2 elementSize = vec2(m_size.x(), int32_t(realPixelSize.y()));
vec2 startPos = vec2(0, m_size.y()) - vec2(0, elementSize.y());
vec2 startPos = vec2(-m_originScrooled.x(), m_size.y()) - vec2(0, elementSize.y()-m_originScrooled.y());
for (auto &it : m_listDisplay) {
if (it == nullptr) {
startPos -= vec2(0, elementSize.y());
continue;
}
it->generateDisplay(startPos, elementSize);
if ( startPos.y() - elementSize.y() <= m_size.y()
&& startPos.y() + elementSize.y() >= 0) {
it->generateDisplay(startPos, elementSize);
} else {
it->clear();
}
startPos -= vec2(0, elementSize.y());
}
m_maxSize.setX(m_size.x());
@ -392,6 +403,13 @@ void appl::ElementDisplayed::generateDisplay(vec2 _startPos, vec2 _size) {
textToDisplay += "<i>Episode: <b>" + m_property->m_episode + "</b></i> ";
newLine = true;
}
if (m_property->m_type != "") {
textToDisplay += " <i>type: <b>" + m_property->m_type + "</b></i> ";
if (m_property->m_productMethode != "") {
textToDisplay += " / " + m_property->m_productMethode + " ";
}
newLine = true;
}
if (newLine == true) {
textToDisplay += "<br/>";
}
@ -415,7 +433,10 @@ void appl::ElementDisplayed::generateDisplay(vec2 _startPos, vec2 _size) {
bool appl::widget::ListViewer::onEventInput(const ewol::event::Input& _event) {
APPL_VERBOSE("Event on BT : " << _event);
if (ewol::widget::WidgetScrolled::onEventInput(_event) == true) {
return true;
}
APPL_VERBOSE("Event on BT : " << _event << " size=" << m_size << " maxSize=" << m_maxSize);
vec2 relativePos = relativePosition(_event.getPos());
int32_t findId = -1;
for (size_t iii=0; iii<m_listDisplay.size(); ++iii) {
@ -436,7 +457,7 @@ bool appl::widget::ListViewer::onEventInput(const ewol::event::Input& _event) {
}
if (_event.getId() == 1) {
if(_event.getStatus() == gale::key::status::pressSingle) {
APPL_WARNING("Select element : " << findId << " " << m_listDisplay[findId]->m_idCurentElement);
APPL_DEBUG("Select element : " << findId << " " << m_listDisplay[findId]->m_idCurentElement);
ememory::SharedPtr<appl::ElementProperty> prop = m_listDisplay[findId]->m_property;
if (prop != nullptr) {
std::string fullTitle;
@ -450,7 +471,7 @@ bool appl::widget::ListViewer::onEventInput(const ewol::event::Input& _event) {
fullTitle += "e" + prop->m_episode + "-";
}
fullTitle += prop->m_title;
APPL_WARNING("info element : " << prop->m_id << " title: " << fullTitle);
APPL_DEBUG("info element : " << prop->m_id << " title: " << fullTitle);
signalSelect.emit(prop->m_id);
}
return true;

View File

@ -29,6 +29,8 @@ namespace appl {
std::string m_episode; //!< Id of the Episode or empty
std::string m_saison; //!< id of the saison or empty
std::string m_mineType; //!< mine type: video/audio/image/...
std::string m_type; //!< type of the element
std::string m_productMethode; //!< Methode of production
// TODO: float m_globalNote; //!< note over [0,0..1,0]
// TODO: int32_t m_countPersonalView; //!< number of view this media
// TODO: int64_t m_globalPersonalView; //!< number of time this media has been viewed
@ -51,6 +53,11 @@ namespace appl {
m_text.draw();
}
void generateDisplay(vec2 _startPos, vec2 _size);
void clear() {
m_image.clear();
m_text.clear();
m_draw.clear();
}
};
namespace widget {

View File

@ -0,0 +1,66 @@
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
#include <appl/widget/Player.hpp>
#include <ewol/widget/Sizer.hpp>
#include <ewol/widget/List.hpp>
#include <ewol/widget/Button.hpp>
#include <ewol/widget/CheckBox.hpp>
#include <ewol/widget/ListFileSystem.hpp>
#include <ewol/widget/Entry.hpp>
#include <ewol/widget/Spacer.hpp>
#include <ewol/widget/Image.hpp>
#include <ewol/widget/Composer.hpp>
#include <ewol/widget/Manager.hpp>
//#include <vector>
#include <vector>
#include <etk/tool.hpp>
#include <appl/debug.hpp>
#include <ewol/ewol.hpp>
#include <ewol/tools/message.hpp>
appl::widget::Player::Player() {
addObjectType("appl::widget::Player");
}
void appl::widget::Player::init() {
ewol::widget::Composer::init();
if (loadFromFile("DATA:gui-player.xml", getId()) == false) {
APPL_ERROR("Can not load Player GUI from file ...");
return;
}
subBind(ewol::widget::Button, "[" + etk::to_string(getId()) + "]appl-player-bt-previous", signalPressed, sharedFromThis(), &appl::widget::Player::onCallbackButtonPrevious);
subBind(ewol::widget::Button, "[" + etk::to_string(getId()) + "]appl-player-bt-play", signalValue, sharedFromThis(), &appl::widget::Player::onCallbackButtonPlay);
subBind(ewol::widget::Button, "[" + etk::to_string(getId()) + "]appl-player-bt-next", signalPressed, sharedFromThis(), &appl::widget::Player::onCallbackButtonNext);
propertyCanFocus.set(true);
markToRedraw();
}
void appl::widget::Player::onGetFocus() {
// transfert focus on a specific widget...
propertySetOnWidgetNamed("[" + etk::to_string(getId()) + "]appl-player-bt-play", "focus", "true");
}
appl::widget::Player::~Player() {
}
void appl::widget::Player::onCallbackButtonPrevious() {
}
void appl::widget::Player::onCallbackButtonPlay(const bool& _value) {
}
void appl::widget::Player::onCallbackButtonNext() {
}

View File

@ -0,0 +1,39 @@
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
#pragma once
#include <etk/types.hpp>
#include <ewol/debug.hpp>
#include <ewol/widget/Composer.hpp>
#include <esignal/Signal.hpp>
#include <appl/ClientProperty.hpp>
namespace appl {
namespace widget {
class Player;
using PlayerShared = ememory::SharedPtr<appl::widget::Player>;
using PlayerWeak = ememory::WeakPtr<appl::widget::Player>;
class Player : public ewol::widget::Composer {
public: // properties
public: // signals
protected:
Player();
void init() override;
public:
DECLARE_WIDGET_FACTORY(Player, "Player");
virtual ~Player();
public:
void onGetFocus() override;
private:
// callback functions:
void onCallbackButtonPrevious();
void onCallbackButtonNext();
void onCallbackButtonPlay(const bool& _value);
};
};
};

View File

@ -53,7 +53,6 @@ void appl::widget::VideoDisplay::init() {
}
// Create the River manager for tha application or part of the application.
m_audioManager = audio::river::Manager::create("river_sample_read");
//! [audio_river_sample_create_write_interface]
}
appl::widget::VideoDisplay::~VideoDisplay() {
@ -93,10 +92,16 @@ void appl::widget::VideoDisplay::setFile(const std::string& _filename) {
void appl::widget::VideoDisplay::setZeusMedia(ememory::SharedPtr<ClientProperty> _property, uint32_t _mediaId) {
// Stop playing in all case...
stop();
if (m_decoder != nullptr) {
m_decoder->uninit();
}
// Clear the old interface
m_decoder.reset();
// Create a new interface
m_decoder = ememory::makeShared<appl::MediaDecoder>();
if (m_decoder == nullptr) {
m_decoder = ememory::makeShared<appl::MediaDecoder>();
}
if (m_decoder == nullptr) {
APPL_ERROR("Can not create sharedPtr on decoder ...");
return;
@ -126,7 +131,7 @@ void appl::widget::VideoDisplay::play() {
m_decoder->audioGetFormat(),
"speaker");
if(m_audioInterface == nullptr) {
APPL_ERROR("Can not creata Audio interface");
APPL_ERROR("Can not create Audio interface");
}
m_audioInterface->setReadwrite();
m_audioInterface->start();
@ -145,9 +150,8 @@ void appl::widget::VideoDisplay::stop() {
if ( m_decoder != nullptr
&& m_decoder->getState() != gale::Thread::state::stop) {
APPL_ERROR("Stop Decoder");
// stop it ... and request seet at 0 position ...
m_decoder->seek(echrono::Duration(0));
m_decoder->stop();
m_currentTime = 0;
}
if (m_audioInterface != nullptr) {
APPL_ERROR("Stop audio interface");

View File

@ -1,13 +1,13 @@
<PopUp >
<sizer mode="vert" fill="true,true" expand="false,false" lock="true,true" addmode="invert" min-size="45,10%">
<sizer mode="vert" fill="true" expand="false" lock="true" addmode="invert" min-size="45,10%">
<label>_T{Login}</label>
<entry name="[{ID}]connect-login" fill="true,false" expand="true,false"/>
<label>_T{Password}</label>
<entry name="[{ID}]connect-password" fill="true,false" expand="true,false"/>
<button name="[{ID}]connect-bt" toggle="false" fill="false,false" expand="true,false" gravity="right">
<button name="[{ID}]connect-bt" toggle="false" fill="false" expand="true,false" gravity="right">
<label>_T{Connect}</label>
</button>
<button name="[{ID}]cancel-bt" toggle="false" fill="false,false" expand="true,false" gravity="right">
<button name="[{ID}]cancel-bt" toggle="false" fill="false" expand="true,false" gravity="right">
<label>_T{Cancel}</label>
</button>
</sizer>

View File

@ -0,0 +1,21 @@
<layer fill="true" expand="true">
<sizer mode="vert" fill="true" expand="true">
<sizer mode="hori" fill="true" expand="true,false">
<button name="[{ID}]appl-player-bt-previous">
<label>_T{Previous}</label>
</button>
<button name="[{ID}]appl-player-bt-play" toggle="true">
<label>_T{Play}</label>
<label>_T{Pause}</label>
</button>
<button name="[{ID}]appl-player-bt-next">
<label>_T{Next}</label>
</button>
<spacer expand="true,false" fill="true"/>
<label name="[{ID}]appl-player-lb-time"/>
</sizer>
<slider name="progress-bar" expand="true,false" fill="true" step="0.01" min="0"/>
<spacer expand="true" fill="true"/>
</sizer>
<VideoDisplay name="[{ID}]appl-player-display" expand="true" fill="true"/>
</layer>

View File

@ -1,84 +1,83 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<sizer mode="vert" fill="true,true" expand="true,true">
<wslider name="view-selection" fill="true,true" expand="true,true">
<!--
<sizer mode="vert" name="ws-name-list" fill="true,true" expand="true,true" addmode="invert">
<button name="bt-film-picture" expand="true,false" fill="true,true">
<label>Films</label>
<sizer mode="vert" fill="true" expand="true">
<wslider name="view-selection" fill="true" expand="true" speed="0.250">
<sizer mode="vert" name="ws-name-list-group" fill="true" expand="true" addmode="invert">
<button name="bt-film-picture" expand="true,false" fill="true">
<label>_T{Films}</label>
</button>
<button name="bt-film-draw" expand="true,false" fill="true,true">
<label>Annimated films</label>
<button name="bt-film-draw" expand="true,false" fill="true">
<label>_T{Annimated films}</label>
</button>
<button name="bt-tv-picture" expand="true,false" fill="true,true">
<label>TV Show</label>
<button name="bt-tv-picture" expand="true,false" fill="true">
<label>_T{TV Show}</label>
</button>
<button name="bt-tv-draw" expand="true,false" fill="true,true">
<label>Annimated TV Show</label>
<button name="bt-tv-draw" expand="true,false" fill="true">
<label>_T{Annimated TV Show}</label>
</button>
<button name="bt-theater" expand="true,false" fill="true,true">
<label>Teather</label>
<button name="bt-theater" expand="true,false" fill="true">
<label>_T{Teather}</label>
</button>
<button name="bt-one-man-show" expand="true,false" fill="true,true">
<label>One-man show</label>
<button name="bt-one-man-show" expand="true,false" fill="true">
<label>_T{One-man show}</label>
</button>
<button name="bt-courses" expand="true,false" fill="true,true">
<label>Courses</label>
<button name="bt-courses" expand="true,false" fill="true">
<label>_T{Courses}</label>
</button>
<spacer fill="true,true" expand="true,true"/>
<spacer fill="true" expand="true"/>
</sizer>
-->
<ListViewer name="ws-name-list-viewer" fill="true,true" expand="true,true"/>
<sizer mode="vert" name="ws-name-player" fill="true,true" expand="true,true">
<sizer mode="hori" fill="true,true" expand="true,false">
<button name="bt-previous">
<label>
previous
</label>
</button>
<button name="bt-play" toggle="true">
<label>play</label>
<label>pause</label>
</button>
<button name="bt-next">
<label>
Next
</label>
</button>
<label name="lb-fps"/>
<label name="lb-time"/>
<button name="bt-back">
<label>
back
</label>
</button>
</sizer>
<slider name="progress-bar" expand="true,false" fill="true" step="0.01" min="0"/>
<VideoDisplay name="displayer" expand="true" fill="true"/>
<sizer mode="vert" name="ws-name-list-tv" fill="true" expand="true" addmode="invert">
<button name="bt-tv-child" expand="true,false" fill="true">
<label>_T{Child TV}</label>
</button>
<button name="bt-tv-adult" expand="true,false" fill="true">
<label>_T{Adult TV}</label>
</button>
<spacer fill="true" expand="true"/>
</sizer>
<ListViewer name="ws-name-list-viewer" fill="true" expand="true"/>
<player name="ws-name-player" fill="true" expand="true"/>
</wslider>
<sizer mode="hori" fill="true,true" expand="true,false" lock="true,true">
<sizer mode="hori" fill="true" expand="true,false" lock="true">
<button name="access-fast-home">
<image src="DATA:Home.svg" size='8,8mm' />
</button>
<button name="access-fast-group">
<image src="DATA:Group.svg" size='8,8mm' />
</button>
<!--
<button name="access-fast-tv">
<image src="DATA:Tv.svg" size='8,8mm' />
</button>
<button name="access-fast-page-previous">
<image src="DATA:Previous.svg" size='8,8mm' />
</button>
<button name="access-fast-page-next">
<image src="DATA:Next.svg" size='8,8mm' />
</button>
-->
</sizer>
<sizer mode="hori" fill="true,false" expand="true,false" lock="true,true">
<sizer mode="hori" fill="true,false" expand="true,false" lock="true">
<menu name="menu-bar">
<elem title="" image="DATA:List.svg" event="">
<elem title="_T{Connect}" image="" event="menu:connect"/>
<elem title="_T{Home}" image="DATA:Home.svg" event="menu:home"/>
<elem title="_T{Connect}" image="DATA:Connect.svg" event="menu:connect"/>
<elem title="_T{Home}" image="DATA:Home.svg" event="menu:home"/>
<elem title="_T{Group}" image="DATA:Group.svg" event="menu:group">
<elem title="_T{Films}" image="" event="menu:films"/>
<elem title="_T{Annimated films}" image="" event="menu:animation-films"/>
<elem title="_T{TV Show}" image="" event="menu:tv-show"/>
<elem title="_T{Annimated TV Show}" image="" event="menu:animation-tv-show"/>
<elem title="_T{Teather}" image="" event="menu:teather"/>
<elem title="_T{One-man show}" image="" event="menu:one-man-show"/>
<elem title="_T{Courses}" image="" event="menu:courses"/>
</elem>
<elem title="_T{TV}" image="DATA:Tv.svg" event="menu:tv">
<elem title="_T{Child TV}" image="" event="menu:TV-child"/>
<elem title="_T{Adult TV}" image="" event="menu:TV-adult"/>
</elem>
<separator/>
<elem title="_T{Exit}" image="" event="menu:exit"/>
<elem title="_T{Exit}" image="DATA:Exit.svg" event="menu:exit"/>
</elem>
</menu>
<button name="menu-bt">
<image src="DATA:List.svg" size='8,8mm'/>
</button>
<entry name="search-entry" fill="true,false" expand="true,false"/>
<button name="search-bt">
<image src="DATA:Search.svg" size='8,8mm' />

View File

@ -37,6 +37,7 @@ def configure(target, my_module):
'appl/widget/ListViewer.cpp',
'appl/ClientProperty.cpp',
'appl/widget/Connection.cpp',
'appl/widget/Player.cpp',
])
my_module.add_depend([
'ffmpeg-libs',

View File

@ -74,7 +74,17 @@ void appl::ClientInterface::stop() {
bool appl::ClientInterface::isAlive() {
//APPL_INFO("is alive : " << m_interfaceClient.isActive());
return m_interfaceClient.isActive();
bool ret = m_interfaceClient.isActive();
if (ret == true) {
if (m_userGateWay == nullptr) {
return false;
}
m_userGateWay->clientAlivePing();
if (m_userGateWay->isAlive() == false) {
return false;
}
}
return ret;
}
void appl::ClientInterface::answerProtocolError(uint32_t _transactionId, const std::string& _errorHelp) {

View File

@ -136,4 +136,15 @@ void appl::GateWayInterface::onServiceData(ememory::SharedPtr<zeus::Message> _va
void appl::GateWayInterface::answerProtocolError(uint32_t _transactionId, const std::string& _errorHelp) {
m_interfaceClient.answerError(_transactionId, 0, 0, protocolError, _errorHelp);
m_interfaceClient.disconnect(true);
}
}
void appl::GateWayInterface::clientAlivePing() {
echrono::Steady now = echrono::Steady::now();
if ((now - m_interfaceClient.getLastTimeSend()) >= echrono::seconds(5)) {
m_interfaceClient.ping();
return;
}
if ((now - m_interfaceClient.getLastTimeReceive()) >= echrono::seconds(5)) {
m_interfaceClient.ping();
}
}

View File

@ -25,6 +25,7 @@ namespace appl {
void start();
void stop();
void onServiceData(ememory::SharedPtr<zeus::Message> _value);
void clientAlivePing();
public:
uint16_t addClient(ememory::SharedPtr<appl::ClientInterface> _value);
void rmClient(ememory::SharedPtr<appl::ClientInterface> _value);

View File

@ -248,17 +248,20 @@ ememory::SharedPtr<appl::GateWayInterface> appl::Router::get(const std::string&
APPL_ERROR("Must never appear ... child of fork killed ...");
}
#endif
std::this_thread::sleep_for(std::chrono::milliseconds(600));
APPL_ERROR("must be connected ???");
for (auto &it : m_GateWayList) {
if (it == nullptr) {
continue;
int32_t nbCheckDelayMax = 24;
while (nbCheckDelayMax-- > 0) {
std::this_thread::sleep_for(std::chrono::milliseconds(25));
for (auto &it : m_GateWayList) {
if (it == nullptr) {
continue;
}
if (it->getName() != _userName) {
continue;
}
return it;
}
if (it->getName() != _userName) {
continue;
}
return it;
}
APPL_ERROR("must be connected ==> and it is not ...");
break;
}
}
@ -296,7 +299,6 @@ void appl::Router::cleanIO() {
}
++it;
}
auto it2 = m_clientList.begin();
while (it2 != m_clientList.end()) {
if (*it2 != nullptr) {