diff --git a/tools/player-video/appl/MediaDecoder.hpp b/tools/player-video/appl/MediaDecoder.hpp index 1355aa7..bb48374 100644 --- a/tools/player-video/appl/MediaDecoder.hpp +++ b/tools/player-video/appl/MediaDecoder.hpp @@ -116,6 +116,11 @@ namespace appl { AVCodecContext* m_videoDecoderContext; AVCodecContext* m_audioDecoderContext; ivec2 m_size; + public: + ivec2 getSize() { + return m_size; + } + private: enum AVPixelFormat m_pixelFormat; AVStream *m_videoStream; AVStream *m_audioStream; diff --git a/tools/player-video/appl/widget/VideoPlayer.cpp b/tools/player-video/appl/widget/VideoPlayer.cpp index e2833f8..5bbacfa 100644 --- a/tools/player-video/appl/widget/VideoPlayer.cpp +++ b/tools/player-video/appl/widget/VideoPlayer.cpp @@ -208,26 +208,27 @@ void appl::widget::VideoDisplay::onDraw() { m_GLprogram->unUse(); } -void appl::widget::VideoDisplay::printPart(const vec2& _size, +void appl::widget::VideoDisplay::printPart(const vec2& _displayStart, + const vec2& _size, const vec2& _sourcePosStart, const vec2& _sourcePosStop) { //EWOL_ERROR("Debug image " << m_filename << " ==> " << m_position << " " << _size << " " << _sourcePosStart << " " << _sourcePosStop); - vec3 point = m_position; + vec3 point(_displayStart.x(),_displayStart.y(), 0.0f); vec2 tex(_sourcePosStart.x(),_sourcePosStop.y()); m_VBO->pushOnBuffer(m_vboIdCoord, point); m_VBO->pushOnBuffer(m_vboIdCoordTex, tex); m_VBO->pushOnBuffer(m_vboIdColor, m_color); tex.setValue(_sourcePosStop.x(),_sourcePosStop.y()); - point.setX(m_position.x() + _size.x()); - point.setY(m_position.y()); + point.setX(_displayStart.x() + _size.x()); + point.setY(_displayStart.y()); m_VBO->pushOnBuffer(m_vboIdCoord, point); m_VBO->pushOnBuffer(m_vboIdCoordTex, tex); m_VBO->pushOnBuffer(m_vboIdColor, m_color); tex.setValue(_sourcePosStop.x(),_sourcePosStart.y()); - point.setX(m_position.x() + _size.x()); - point.setY(m_position.y() + _size.y()); + point.setX(_displayStart.x() + _size.x()); + point.setY(_displayStart.y() + _size.y()); m_VBO->pushOnBuffer(m_vboIdCoord, point); m_VBO->pushOnBuffer(m_vboIdCoordTex, tex); m_VBO->pushOnBuffer(m_vboIdColor, m_color); @@ -237,15 +238,15 @@ void appl::widget::VideoDisplay::printPart(const vec2& _size, m_VBO->pushOnBuffer(m_vboIdColor, m_color); tex.setValue(_sourcePosStart.x(),_sourcePosStart.y()); - point.setX(m_position.x()); - point.setY(m_position.y() + _size.y()); + point.setX(_displayStart.x()); + point.setY(_displayStart.y() + _size.y()); m_VBO->pushOnBuffer(m_vboIdCoord, point); m_VBO->pushOnBuffer(m_vboIdCoordTex, tex); m_VBO->pushOnBuffer(m_vboIdColor, m_color); tex.setValue(_sourcePosStart.x(),_sourcePosStop.y()); - point.setX(m_position.x()); - point.setY(m_position.y()); + point.setX(_displayStart.x()); + point.setY(_displayStart.y()); m_VBO->pushOnBuffer(m_vboIdCoord, point); m_VBO->pushOnBuffer(m_vboIdCoordTex, tex); m_VBO->pushOnBuffer(m_vboIdColor, m_color); @@ -261,7 +262,32 @@ void appl::widget::VideoDisplay::onRegenerateDisplay() { m_VBO->clear(); // set the somposition properties : m_position = vec3(0,0,0); - printPart(m_size, vec2(0,0), vec2(float(m_videoSize.x())/float(m_imageSize.x()), float(m_videoSize.y())/float(m_imageSize.y()))); + + if (m_decoder != nullptr) { + ivec2 tmp = m_decoder->getSize(); + vec2 realSize(tmp.x(), tmp.y()); + vec2 displaySize = m_size; + float aspectRatioReal = realSize.x() / realSize.y(); + float displayRatioReal = displaySize.x() / displaySize.y(); + vec2 startPos(0,0); + if (aspectRatioReal == displayRatioReal) { + // nothing to do ... + } else if (aspectRatioReal < displayRatioReal) { + // the display is more width than the video + displaySize.setX(displaySize.y()*realSize.x()/realSize.y()); + startPos.setX((m_size.x()-displaySize.x())*0.5f); + } else { + // The display is more height than the video + displaySize.setY(displaySize.x()*realSize.y()/realSize.x()); + startPos.setY((m_size.y()-displaySize.y())*0.5f); + } + printPart(startPos, + displaySize, + vec2(0,0), + vec2(float(m_videoSize.x())/float(m_imageSize.x()), float(m_videoSize.y())/float(m_imageSize.y()))); + } else { + // nothing to display ... + } } void appl::widget::VideoDisplay::periodicEvent(const ewol::event::Time& _event) { diff --git a/tools/player-video/appl/widget/VideoPlayer.hpp b/tools/player-video/appl/widget/VideoPlayer.hpp index 8d13e05..1c604b6 100644 --- a/tools/player-video/appl/widget/VideoPlayer.hpp +++ b/tools/player-video/appl/widget/VideoPlayer.hpp @@ -77,7 +77,7 @@ namespace appl { public: void periodicEvent(const ewol::event::Time& _event); private: - void printPart(const vec2& _size, const vec2& _sourcePosStart, const vec2& _sourcePosStop); + void printPart(const vec2& _displayStart,const vec2& _size, const vec2& _sourcePosStart, const vec2& _sourcePosStop); void loadProgram(); private: // Audio Property: ememory::SharedPtr m_audioManager; //!< River manager interface diff --git a/tools/router/appl/Router.cpp b/tools/router/appl/Router.cpp index e122126..4be4744 100644 --- a/tools/router/appl/Router.cpp +++ b/tools/router/appl/Router.cpp @@ -134,6 +134,7 @@ void appl::Router::newClient(enet::Tcp _connection) { appl::Router::Router() : m_clientUID(2), + propertyStdOut(this, "stdout", false, "Set the Log of the output"), propertyClientIp(this, "client-ip", "127.0.0.1", "Ip to listen client", &appl::Router::onPropertyChangeClientIp), propertyClientPort(this, "client-port", 1983, "Port to listen client", &appl::Router::onPropertyChangeClientPort), propertyClientMax(this, "client-max", 8000, "Maximum of client at the same time", &appl::Router::onPropertyChangeClientMax), @@ -222,10 +223,9 @@ ememory::SharedPtr appl::Router::get(const std::string& std::string binary = etk::FSNodeGetApplicationPath() + "/zeus-gateway"; std::string userConf = "--user=" + it.m_name; std::string basePath = "--base-path=" + it.m_basePath; - #if 0 - std::string logFile = "--elog-file=\"/tmp/zeus.gateway." + it.m_name + ".log\""; - #else - std::string logFile = it.m_basePath + "/log/gateway.log"; + std::string logFile; + if (*propertyStdOut == false) { + logFile = it.m_basePath + "/log/gateway.log"; if ( logFile.size() != 0 && logFile[0] == '~') { logFile = etk::FSNodeGetHomePath() + &logFile[1]; @@ -234,7 +234,7 @@ ememory::SharedPtr appl::Router::get(const std::string& //std::string logFile = "--elog-file=/home/heero/.local/share/zeus-DATA/SDFGHTHBSDFGSQDHZSRDFGSDFGSDFGSDFG/log/gateway.log"; //std::string logFile = " "; APPL_INFO("New Child log in = " << logFile); - #endif + } std::string delay = "--router-delay=" + etk::to_string(*propertyDelayToStop); int ret = execlp( binary.c_str(), binary.c_str(), // must repeate the binary name to have the name as first argument ... diff --git a/tools/router/appl/Router.hpp b/tools/router/appl/Router.hpp index 3ac2273..abb0f46 100644 --- a/tools/router/appl/Router.hpp +++ b/tools/router/appl/Router.hpp @@ -21,6 +21,7 @@ namespace appl { ememory::SharedPtr m_interfaceGateWayServer; ejson::Document m_listUser; public: + eproperty::Value propertyStdOut; //!< not set the log in the stdout or in the local file eproperty::Value propertyClientIp; eproperty::Value propertyClientPort; eproperty::Value propertyClientMax; diff --git a/tools/router/appl/main-router.cpp b/tools/router/appl/main-router.cpp index f3d110d..43e2436 100644 --- a/tools/router/appl/main-router.cpp +++ b/tools/router/appl/main-router.cpp @@ -22,7 +22,9 @@ int main(int _argc, const char *_argv[]) { appl::Router basicRouter; for (int32_t iii=0; iii<_argc ; ++iii) { std::string data = _argv[iii]; - if (etk::start_with(data, "--client-ip=") == true) { + if (data == "--stdout") { + basicRouter.propertyStdOut.set(true); + } else if (etk::start_with(data, "--client-ip=") == true) { basicRouter.propertyClientIp.set(std::string(&data[12])); } else if (etk::start_with(data, "--client-port=") == true) { basicRouter.propertyClientPort.set(etk::string_to_uint16_t(std::string(&data[14]))); @@ -40,10 +42,11 @@ int main(int _argc, const char *_argv[]) { || data == "--help") { APPL_PRINT(etk::getApplicationName() << " - help : "); APPL_PRINT(" " << _argv[0] << " [options]"); - APPL_PRINT(" --client-ip=XXX Client connection IP (default: 1.7.0.0.1)"); + APPL_PRINT(" --stdout stdout log"); + APPL_PRINT(" --client-ip=XXX Client connection IP (default: 127.0.0.1)"); APPL_PRINT(" --client-port=XXX Client connection PORT (default: 1983)"); APPL_PRINT(" --client-max=XXX Client Maximum parallele connection (default: 80)"); - APPL_PRINT(" --gw-ip=XXX Gateway connection IP (default: 1.7.0.0.1)"); + APPL_PRINT(" --gw-ip=XXX Gateway connection IP (default: 127.0.0.1)"); APPL_PRINT(" --gw-port=XXX Gateway connection PORT (default: 1984)"); APPL_PRINT(" --gw-max=XXX Gateway Maximum IO (default: 15)"); APPL_PRINT(" --delay-stop-user=XXX Delay before the client stop the connection in second (default: 0=automatic set by the gateway; -1=never disconnect; other the time )"); diff --git a/tools/service-video/appl/main-service-video.cpp b/tools/service-video/appl/main-service-video.cpp index 0f63880..35f93d9 100644 --- a/tools/service-video/appl/main-service-video.cpp +++ b/tools/service-video/appl/main-service-video.cpp @@ -214,7 +214,6 @@ namespace appl { std::vector getSQL(std::string _sqlLikeRequest) override { std::vector out; - /* if (_sqlLikeRequest == "") { throw std::invalid_argument("empty request"); } @@ -243,11 +242,14 @@ namespace appl { } std::unique_lock lock(g_mutex); for (auto &it : m_listFile) { + if (it == nullptr) { + continue; + } bool isCorrectElement = true; for (auto &itCheck : listAndParsed) { // find matadataValue: - auto itM = it.m_metadata.find(itCheck[0]); - if (itM == it.m_metadata.end()) { + auto itM = it->getMetadataDirect().find(itCheck[0]); + if (itM == it->getMetadataDirect().end()) { // not find key ==> no check to do ... isCorrectElement = false; break; @@ -285,17 +287,16 @@ namespace appl { } } if (isCorrectElement == true) { - out.push_back(it.m_id); + out.push_back(it->getUniqueId()); } } - */ return out; } std::vector getMetadataValuesWhere(std::string _keyName, std::string _sqlLikeRequest) override { std::unique_lock lock(g_mutex); std::vector out; - + // 'type' == 'film' AND 'production-methode' == 'picture' return out; } diff --git a/tools/service-video/appl/zeus-service-video.srv.zeus.idl b/tools/service-video/appl/zeus-service-video.srv.zeus.idl index 9f75ccc..5f341de 100644 --- a/tools/service-video/appl/zeus-service-video.srv.zeus.idl +++ b/tools/service-video/appl/zeus-service-video.srv.zeus.idl @@ -34,9 +34,9 @@ void remove(uint32) /* - The SQL-like is now: ['AND','='] only... - 'serie-name' = 'stargate' - AND 'saison' = '2' + The SQL-like is now: ['AND', ==,!=,<=,>=,<,>] only... + 'serie-name' == 'stargate' + AND 'saison' <= '2' */ #brief:Get a meta-data research elements with a SQL-like request #param:sqlLikeRequest:A string containing the request on the data diff --git a/zeus/zeus-Media.impl.hpp b/zeus/zeus-Media.impl.hpp index 607189b..6639344 100644 --- a/zeus/zeus-Media.impl.hpp +++ b/zeus/zeus-Media.impl.hpp @@ -48,6 +48,9 @@ namespace zeus { return m_fileName; } bool erase(); + const std::map& getMetadataDirect() { + return m_metadata; + } }; }