[DEV] play video from server ==> copy and play... (TODO: copy by part)
This commit is contained in:
parent
6792ab72c8
commit
557545b74a
@ -9,6 +9,9 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <zeus/service/ProxyVideo.hpp>
|
||||||
|
#include <zeus/ProxyFile.hpp>
|
||||||
|
|
||||||
#include <appl/debug.hpp>
|
#include <appl/debug.hpp>
|
||||||
#include <appl/widget/VideoPlayer.hpp>
|
#include <appl/widget/VideoPlayer.hpp>
|
||||||
#include <ewol/object/Manager.hpp>
|
#include <ewol/object/Manager.hpp>
|
||||||
@ -310,6 +313,38 @@ double appl::MediaDecoder::getFps(AVCodecContext *_avctx) {
|
|||||||
return 1.0 / av_q2d(_avctx->time_base) / FFMAX(_avctx->ticks_per_frame, 1);
|
return 1.0 / av_q2d(_avctx->time_base) / FFMAX(_avctx->ticks_per_frame, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void appl::MediaDecoder::init(ememory::SharedPtr<ClientProperty> _property, uint32_t _mediaId) {
|
||||||
|
// TODO : Correct this later ... We first download the media and after we play it
|
||||||
|
// TODO : We need to down load only a small part ...
|
||||||
|
// get the requested node:
|
||||||
|
if (_property == nullptr) {
|
||||||
|
APPL_ERROR("Request play of not handle property ==> nullptr");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_property->connection.isAlive() == false) {
|
||||||
|
APPL_ERROR("Request play of not connected handle ==> 'not alive'");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
zeus::service::ProxyVideo remoteServiceVideo = _property->connection.getService("video");
|
||||||
|
// remove all media (for test)
|
||||||
|
if (remoteServiceVideo.exist() == false) {
|
||||||
|
APPL_ERROR("Vide servie is ==> 'not alive'");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// TODO : Do it better ...
|
||||||
|
zeus::ProxyFile dataFile = remoteServiceVideo.mediaGet(_mediaId).wait().get();
|
||||||
|
|
||||||
|
std::string mimeType = dataFile.getMineType().wait().get();
|
||||||
|
// create temporary file:
|
||||||
|
etk::FSNode tmpFile("CACHE:videoPlayer." + zeus::getExtention(mimeType));
|
||||||
|
APPL_WARNING("Store in tmpFile : " << tmpFile << " ==> " << tmpFile.getName());
|
||||||
|
std::string sha512String = zeus::storeInFile(dataFile, tmpFile.getName());
|
||||||
|
APPL_WARNING("Store in tmpFile : " << tmpFile << " ==> " << tmpFile.getFileSystemName() << " DONE");
|
||||||
|
|
||||||
|
init(tmpFile.getFileSystemName());
|
||||||
|
// TODO : init(tmpFile);
|
||||||
|
}
|
||||||
|
|
||||||
void appl::MediaDecoder::init(const std::string& _filename) {
|
void appl::MediaDecoder::init(const std::string& _filename) {
|
||||||
m_updateVideoTimeStampAfterSeek = false;
|
m_updateVideoTimeStampAfterSeek = false;
|
||||||
m_sourceFilename = _filename;
|
m_sourceFilename = _filename;
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <gale/Thread.hpp>
|
#include <gale/Thread.hpp>
|
||||||
#include <audio/channel.hpp>
|
#include <audio/channel.hpp>
|
||||||
#include <audio/format.hpp>
|
#include <audio/format.hpp>
|
||||||
|
#include <appl/widget/ListViewer.hpp>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <libavutil/imgutils.h>
|
#include <libavutil/imgutils.h>
|
||||||
@ -104,6 +105,7 @@ namespace appl {
|
|||||||
int open_codec_context(int *_streamId, AVFormatContext *_formatContext, enum AVMediaType _type);
|
int open_codec_context(int *_streamId, AVFormatContext *_formatContext, enum AVMediaType _type);
|
||||||
double getFps(AVCodecContext *_avctx);
|
double getFps(AVCodecContext *_avctx);
|
||||||
void init(const std::string& _filename);
|
void init(const std::string& _filename);
|
||||||
|
void init(ememory::SharedPtr<appl::ClientProperty> _property, uint32_t _mediaId);
|
||||||
bool onThreadCall() override;
|
bool onThreadCall() override;
|
||||||
void uninit();
|
void uninit();
|
||||||
|
|
||||||
|
@ -226,8 +226,9 @@ void appl::Windows::onCallbackConnectConnect() {
|
|||||||
m_clientProp->fromUser = login;
|
m_clientProp->fromUser = login;
|
||||||
m_clientProp->toUser = login;
|
m_clientProp->toUser = login;
|
||||||
m_clientProp->pass = m_password;
|
m_clientProp->pass = m_password;
|
||||||
bool ret = client1.connect(login, m_password);
|
m_clientProp->connect();
|
||||||
if (ret == false) {
|
|
||||||
|
if (m_clientProp->connection.isAlive() == false) {
|
||||||
APPL_ERROR(" ==> NOT Authentify to '" << login << "'");
|
APPL_ERROR(" ==> NOT Authentify to '" << login << "'");
|
||||||
ewol::tools::message::displayError("Can not connect the server with <br/>'" + login + "'");
|
ewol::tools::message::displayError("Can not connect the server with <br/>'" + login + "'");
|
||||||
} else {
|
} else {
|
||||||
|
@ -24,6 +24,38 @@
|
|||||||
#include <zeus/FutureGroup.hpp>
|
#include <zeus/FutureGroup.hpp>
|
||||||
#include <etk/stdTools.hpp>
|
#include <etk/stdTools.hpp>
|
||||||
#include <ejson/ejson.hpp>
|
#include <ejson/ejson.hpp>
|
||||||
|
void appl::ClientProperty::connect() {
|
||||||
|
|
||||||
|
// Generate IP and Port in the client interface
|
||||||
|
connection.propertyIp.set(address);
|
||||||
|
connection.propertyPort.set(port);
|
||||||
|
// Connection depending on the mode requested
|
||||||
|
if (fromUser == toUser) {
|
||||||
|
bool ret = connection.connect(fromUser, pass);
|
||||||
|
if (ret == false) {
|
||||||
|
APPL_ERROR(" ==> NOT Authentify with '" << toUser << "'");
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
APPL_INFO(" ==> Authentify with '" << toUser << "'");
|
||||||
|
}
|
||||||
|
} else if (fromUser != "") {
|
||||||
|
bool ret = connection.connect(fromUser, toUser, pass);
|
||||||
|
if (ret == false) {
|
||||||
|
APPL_ERROR(" ==> NOT Connected to '" << toUser << "' with '" << fromUser << "'");
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
APPL_INFO(" ==> Connected with '" << toUser << "'");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
bool ret = connection.connect(toUser);
|
||||||
|
if (ret == false) {
|
||||||
|
APPL_ERROR(" ==> NOT Connected with 'anonymous' to '" << toUser << "'");
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
APPL_INFO(" ==> Connected with 'anonymous' to '" << toUser << "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
appl::widget::ListViewer::ListViewer() :
|
appl::widget::ListViewer::ListViewer() :
|
||||||
signalSelect(this, "select", "Select a media to view") {
|
signalSelect(this, "select", "Select a media to view") {
|
||||||
@ -68,39 +100,13 @@ void appl::widget::ListViewer::searchElements(std::string _filter) {
|
|||||||
_filter = "";
|
_filter = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// check connection is correct:
|
if (m_clientProp->connection.isAlive() == false) {
|
||||||
zeus::Client client1;
|
APPL_ERROR("Conection is not alive anymore ...");
|
||||||
// Generate IP and Port in the client interface
|
return;
|
||||||
client1.propertyIp.set(m_clientProp->address);
|
|
||||||
client1.propertyPort.set(m_clientProp->port);
|
|
||||||
// Connection depending on the mode requested
|
|
||||||
if (m_clientProp->fromUser == m_clientProp->toUser) {
|
|
||||||
bool ret = client1.connect(m_clientProp->fromUser, m_clientProp->pass);
|
|
||||||
if (ret == false) {
|
|
||||||
APPL_ERROR(" ==> NOT Authentify with '" << m_clientProp->toUser << "'");
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
APPL_INFO(" ==> Authentify with '" << m_clientProp->toUser << "'");
|
|
||||||
}
|
|
||||||
} else if (m_clientProp->fromUser != "") {
|
|
||||||
bool ret = client1.connect(m_clientProp->fromUser, m_clientProp->toUser, m_clientProp->pass);
|
|
||||||
if (ret == false) {
|
|
||||||
APPL_ERROR(" ==> NOT Connected to '" << m_clientProp->toUser << "' with '" << m_clientProp->fromUser << "'");
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
APPL_INFO(" ==> Connected with '" << m_clientProp->toUser << "'");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
bool ret = client1.connect(m_clientProp->toUser);
|
|
||||||
if (ret == false) {
|
|
||||||
APPL_ERROR(" ==> NOT Connected with 'anonymous' to '" << m_clientProp->toUser << "'");
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
APPL_INFO(" ==> Connected with 'anonymous' to '" << m_clientProp->toUser << "'");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// get all the data:
|
// get all the data:
|
||||||
zeus::service::ProxyVideo remoteServiceVideo = client1.getService("video");
|
zeus::service::ProxyVideo remoteServiceVideo = m_clientProp->connection.getService("video");
|
||||||
// remove all media (for test)
|
// remove all media (for test)
|
||||||
if (remoteServiceVideo.exist() == false) {
|
if (remoteServiceVideo.exist() == false) {
|
||||||
APPL_ERROR(" ==> Service does not exist : 'video'");
|
APPL_ERROR(" ==> Service does not exist : 'video'");
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
#include <ewol/widget/Manager.hpp>
|
#include <ewol/widget/Manager.hpp>
|
||||||
#include <esignal/Signal.hpp>
|
#include <esignal/Signal.hpp>
|
||||||
|
|
||||||
|
#include <zeus/Client.hpp>
|
||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
class ClientProperty {
|
class ClientProperty {
|
||||||
public:
|
public:
|
||||||
@ -21,6 +23,9 @@ namespace appl {
|
|||||||
std::string pass;
|
std::string pass;
|
||||||
std::string address;
|
std::string address;
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
|
zeus::Client connection;
|
||||||
|
void connect();
|
||||||
|
void disconnect();
|
||||||
};
|
};
|
||||||
class ElementProperty {
|
class ElementProperty {
|
||||||
public:
|
public:
|
||||||
|
@ -88,6 +88,21 @@ void appl::widget::VideoDisplay::setFile(const std::string& _filename) {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void appl::widget::VideoDisplay::setZeusMedia(ememory::SharedPtr<ClientProperty> _property, uint32_t _mediaId) {
|
||||||
|
// Stop playing in all case...
|
||||||
|
stop();
|
||||||
|
// Clear the old interface
|
||||||
|
m_decoder.reset();
|
||||||
|
// Create a new interface
|
||||||
|
m_decoder = ememory::makeShared<appl::MediaDecoder>();
|
||||||
|
if (m_decoder == nullptr) {
|
||||||
|
APPL_ERROR("Can not create sharedPtr on decoder ...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_decoder->init(_property, _mediaId);
|
||||||
|
markToRedraw();
|
||||||
|
}
|
||||||
|
|
||||||
bool appl::widget::VideoDisplay::isPlaying() {
|
bool appl::widget::VideoDisplay::isPlaying() {
|
||||||
return m_isPalying;
|
return m_isPalying;
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <audio/river/Manager.hpp>
|
#include <audio/river/Manager.hpp>
|
||||||
#include <audio/river/Interface.hpp>
|
#include <audio/river/Interface.hpp>
|
||||||
#include <appl/MediaDecoder.hpp>
|
#include <appl/MediaDecoder.hpp>
|
||||||
|
#include <appl/widget/ListViewer.hpp>
|
||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
namespace widget {
|
namespace widget {
|
||||||
@ -62,7 +63,7 @@ namespace appl {
|
|||||||
void onRegenerateDisplay() override;
|
void onRegenerateDisplay() override;
|
||||||
public:
|
public:
|
||||||
void setFile(const std::string& _fileName);
|
void setFile(const std::string& _fileName);
|
||||||
void setZeusMedia(ememory::SharedPtr<ClientProperty> _property, uint32_t _mediaId) { };
|
void setZeusMedia(ememory::SharedPtr<ClientProperty> _property, uint32_t _mediaId);
|
||||||
protected:
|
protected:
|
||||||
bool m_isPalying;
|
bool m_isPalying;
|
||||||
public:
|
public:
|
||||||
|
@ -1,66 +1,88 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<wslider name="view-selection" fill="true,true" expand="true,true">
|
<sizer mode="vert" fill="true,true" expand="true,true" addmode="invert">
|
||||||
<PopUp name="ws-name-connect" >
|
<sizer mode="hori" fill="true,true" expand="true,false">
|
||||||
<sizer mode="vert" fill="true,true" expand="false,false" lock="true,true" addmode="invert" min-size="45,10%">
|
<button name="menu-bt">
|
||||||
<label>login</label>
|
<image src="DATA:List.svg" size='8,8mm'/>
|
||||||
<entry name="connect-login" fill="true,false" expand="true,false"/>
|
|
||||||
<label>password</label>
|
|
||||||
<entry name="connect-password" fill="true,false" expand="true,false"/>
|
|
||||||
<button name="connect-bt" toggle="false" fill="false,false" expand="true,false" gravity="right">
|
|
||||||
<label>Connect</label>
|
|
||||||
</button>
|
|
||||||
</sizer>
|
|
||||||
</PopUp>
|
|
||||||
<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>
|
|
||||||
</button>
|
</button>
|
||||||
<button name="bt-film-draw" expand="true,false" fill="true,true">
|
<entry name="search-entry" fill="true,false" expand="true,false"/>
|
||||||
<label>Annimated films</label>
|
<button name="search-bt">
|
||||||
|
<image src="DATA:Search.svg" size='8,8mm' />
|
||||||
</button>
|
</button>
|
||||||
<button name="bt-tv-picture" expand="true,false" fill="true,true">
|
|
||||||
<label>TV Show</label>
|
|
||||||
</button>
|
|
||||||
<button name="bt-tv-draw" expand="true,false" fill="true,true">
|
|
||||||
<label>Annimated TV Show</label>
|
|
||||||
</button>
|
|
||||||
<button name="bt-theater" expand="true,false" fill="true,true">
|
|
||||||
<label>Teather</label>
|
|
||||||
</button>
|
|
||||||
<button name="bt-one-man-show" expand="true,false" fill="true,true">
|
|
||||||
<label>One-man show</label>
|
|
||||||
</button>
|
|
||||||
<button name="bt-courses" expand="true,false" fill="true,true">
|
|
||||||
<label>Courses</label>
|
|
||||||
</button>
|
|
||||||
<spacer fill="true,true" expand="true,true"/>
|
|
||||||
</sizer>
|
</sizer>
|
||||||
<ListViewer name="ws-name-list-viewer" fill="true,true" expand="true,true"/>
|
<sizer mode="hori" fill="true,true" expand="true,false">
|
||||||
<sizer mode="vert" name="ws-name-player" fill="true,true" expand="true,true">
|
<button name="access-fast-home">
|
||||||
<sizer mode="hori" fill="true,true" expand="true,true">
|
<image src="DATA:Home.svg" size='8,8mm' />
|
||||||
<button name="bt-previous">
|
</button>
|
||||||
<label>
|
<button name="access-fast-page-previous">
|
||||||
previous
|
<image src="DATA:Previous.svg" size='8,8mm' />
|
||||||
</label>
|
</button>
|
||||||
</button>
|
<button name="access-fast-page-next">
|
||||||
<button name="bt-play" toggle="true">
|
<image src="DATA:Next.svg" size='8,8mm' />
|
||||||
<label>play</label>
|
</button>
|
||||||
<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>
|
</sizer>
|
||||||
</wslider>
|
<wslider name="view-selection" fill="true,true" expand="true,true">
|
||||||
|
<PopUp name="ws-name-connect" >
|
||||||
|
<sizer mode="vert" fill="true,true" expand="false,false" lock="true,true" addmode="invert" min-size="45,10%">
|
||||||
|
<label>login</label>
|
||||||
|
<entry name="connect-login" fill="true,false" expand="true,false"/>
|
||||||
|
<label>password</label>
|
||||||
|
<entry name="connect-password" fill="true,false" expand="true,false"/>
|
||||||
|
<button name="connect-bt" toggle="false" fill="false,false" expand="true,false" gravity="right">
|
||||||
|
<label>Connect</label>
|
||||||
|
</button>
|
||||||
|
</sizer>
|
||||||
|
</PopUp>
|
||||||
|
<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>
|
||||||
|
</button>
|
||||||
|
<button name="bt-film-draw" expand="true,false" fill="true,true">
|
||||||
|
<label>Annimated films</label>
|
||||||
|
</button>
|
||||||
|
<button name="bt-tv-picture" expand="true,false" fill="true,true">
|
||||||
|
<label>TV Show</label>
|
||||||
|
</button>
|
||||||
|
<button name="bt-tv-draw" expand="true,false" fill="true,true">
|
||||||
|
<label>Annimated TV Show</label>
|
||||||
|
</button>
|
||||||
|
<button name="bt-theater" expand="true,false" fill="true,true">
|
||||||
|
<label>Teather</label>
|
||||||
|
</button>
|
||||||
|
<button name="bt-one-man-show" expand="true,false" fill="true,true">
|
||||||
|
<label>One-man show</label>
|
||||||
|
</button>
|
||||||
|
<button name="bt-courses" expand="true,false" fill="true,true">
|
||||||
|
<label>Courses</label>
|
||||||
|
</button>
|
||||||
|
<spacer fill="true,true" expand="true,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,true">
|
||||||
|
<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>
|
||||||
|
</wslider>
|
||||||
|
</sizer>
|
Loading…
x
Reference in New Issue
Block a user