From f779a333374d6678d146385e7d76602c9d3397c4 Mon Sep 17 00:00:00 2001 From: yjogol Date: Sat, 13 Mar 2010 08:10:06 +0000 Subject: [PATCH] nhttpd:controlapi: activate videoformat to API again git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@478 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/nhttpd/tuxboxapi/coolstream/controlapi.cpp | 11 ++++++++--- src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp | 15 +++++++++++++-- src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h | 3 ++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index 8ec03ae7d..9c23ac235 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -709,9 +709,14 @@ void CControlAPI::AspectRatioCGI(CyhookHandler *hh) //----------------------------------------------------------------------------- void CControlAPI::VideoFormatCGI(CyhookHandler *hh) { -// FIXME: not implemented - hh->printf("Videoformat:%s\n",(NeutrinoAPI->getVideoAspectRatioAsString()).c_str()); -// hh->SendOk(); + if (hh->ParamList.empty() || hh->ParamList["1"] == "status") { + hh->printf("%s",(NeutrinoAPI->getVideoAspectRatioAsString()).c_str()); + return; + } + if (NeutrinoAPI->setVideoAspectRatioAsString(hh->ParamList["1"]) != -1) + hh->SendOk(); + else + hh->SendError(); } //----------------------------------------------------------------------------- diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp index 51a10960b..027b721ee 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp @@ -406,11 +406,22 @@ std::string CNeutrinoAPI::timerEventRepeat2Str(CTimerd::CTimerEventRepeat rep) } //------------------------------------------------------------------------- -std::string CNeutrinoAPI::getVideoAspectRatioAsString() { +std::string CNeutrinoAPI::getVideoAspectRatioAsString(void) { int aspectRatio = videoDecoder->getAspectRatio(); if (aspectRatio >= 0 && aspectRatio <= 4) return videoformat_names[aspectRatio]; else return "unknown"; } - +//------------------------------------------------------------------------- +int CNeutrinoAPI::setVideoAspectRatioAsString(std::string newRatioString) { + int newRatioInt = -1; + for(int i=0;isetAspectRatio(newRatioInt, -1); + return newRatioInt; +} diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h index 11fd7ce84..3af516d51 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h @@ -68,7 +68,8 @@ class CNeutrinoAPI std::string timerEventType2Str(CTimerd::CTimerEventTypes type); std::string timerEventRepeat2Str(CTimerd::CTimerEventRepeat rep); - std::string getVideoAspectRatioAsString(); + std::string getVideoAspectRatioAsString(void); + int setVideoAspectRatioAsString(std::string newRatioString); public: CNeutrinoAPI(); ~CNeutrinoAPI(void);