From e8e50a84f252adb57eeada567dc373d2fda275d7 Mon Sep 17 00:00:00 2001 From: yjogol Date: Sat, 13 Mar 2010 07:44:07 +0000 Subject: [PATCH] nhttpd:controlapi: add aspectratio to API again git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@477 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/nhttpd/tuxboxapi/coolstream/Makefile.am | 1 + .../tuxboxapi/coolstream/controlapi.cpp | 9 ++++- src/nhttpd/tuxboxapi/coolstream/controlapi.h | 1 + .../tuxboxapi/coolstream/neutrinoapi.cpp | 35 +++++++++++++++++-- src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h | 4 +-- .../tuxboxapi/coolstream/neutrinoyparser.cpp | 8 +---- 6 files changed, 45 insertions(+), 13 deletions(-) diff --git a/src/nhttpd/tuxboxapi/coolstream/Makefile.am b/src/nhttpd/tuxboxapi/coolstream/Makefile.am index 4c4c5681d..16982530d 100644 --- a/src/nhttpd/tuxboxapi/coolstream/Makefile.am +++ b/src/nhttpd/tuxboxapi/coolstream/Makefile.am @@ -11,6 +11,7 @@ INCLUDES = \ -I$(top_srcdir)/lib/libeventserver \ -I$(top_srcdir)/lib/libconfigfile \ -I$(top_srcdir)/lib/xmltree \ + -I$(top_srcdir)/lib/libcoolstream \ @FREETYPE_CFLAGS@ noinst_LIBRARIES = libnhttpd_tuxboxapi.a diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index 566950c76..8ec03ae7d 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -170,6 +170,7 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]= {"exec", &CControlAPI::ExecCGI, "+xml"}, {"yweb", &CControlAPI::YWebCGI, "text/plain"}, // video handling + {"aspectratio", &CControlAPI::AspectRatioCGI, "text/plain"}, {"videoformat", &CControlAPI::VideoFormatCGI, "text/plain"}, {"videooutput", &CControlAPI::VideoOutputCGI, "text/plain"}, {"vcroutput", &CControlAPI::VCROutputCGI, "text/plain"}, @@ -701,10 +702,16 @@ void CControlAPI::RCEmCGI(CyhookHandler *hh) { hh->SendOk(); } //----------------------------------------------------------------------------- +void CControlAPI::AspectRatioCGI(CyhookHandler *hh) +{ + hh->printf("%s",(NeutrinoAPI->getVideoAspectRatioAsString()).c_str()); +} +//----------------------------------------------------------------------------- void CControlAPI::VideoFormatCGI(CyhookHandler *hh) { // FIXME: not implemented - hh->SendOk(); + hh->printf("Videoformat:%s\n",(NeutrinoAPI->getVideoAspectRatioAsString()).c_str()); +// hh->SendOk(); } //----------------------------------------------------------------------------- diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.h b/src/nhttpd/tuxboxapi/coolstream/controlapi.h index 1b6732a7f..5c766fb4e 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.h +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.h @@ -78,6 +78,7 @@ private: void YWebCGI(CyhookHandler *hh); void RebootCGI(CyhookHandler *hh); void RCEmCGI(CyhookHandler *hh); + void AspectRatioCGI(CyhookHandler *hh); void VideoFormatCGI(CyhookHandler *hh); void VideoOutputCGI(CyhookHandler *hh); void VCROutputCGI(CyhookHandler *hh); diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp index 4b88ca4f5..51a10960b 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp @@ -19,12 +19,32 @@ // tuxbox #include - +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include + extern tallchans allchans; extern CBouquetManager *g_bouquetManager; +extern CFrontend * frontend; +extern cVideo * videoDecoder; +extern cAudio * audioDecoder; + +extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */ +extern CZapitClient::SatelliteList satList; // yhttpd #include "ylogging.h" @@ -38,7 +58,7 @@ void sectionsd_getChannelEvents(CChannelEventList &eList, const bool tv_mode = t // No Class Helpers //============================================================================= -static std::map iso639; +//static std::map iso639; #ifndef initialize_iso639_map bool _initialize_iso639_map(void) { @@ -77,7 +97,7 @@ const char * _getISO639Description(const char * const iso) //============================================================================= std::string CNeutrinoAPI::Dbox_Hersteller[4] = {"none", "Nokia", "Philips", "Sagem"}; std::string CNeutrinoAPI::videooutput_names[5] = {"CVBS", "RGB with CVBS", "S-Video", "YUV with VBS", "YUV with CVBS"}; -std::string CNeutrinoAPI::videoformat_names[4] = {"automatic", "16:9", "4:3 (LB)", "4:3 (PS)"}; +std::string CNeutrinoAPI::videoformat_names[5] = {"automatic", "4:3", "14:9", "16:9", "20:9"}; std::string CNeutrinoAPI::audiotype_names[5] = {"none", "single channel","dual channel","joint stereo","stereo"}; //============================================================================= @@ -385,3 +405,12 @@ std::string CNeutrinoAPI::timerEventRepeat2Str(CTimerd::CTimerEventRepeat rep) return result; } +//------------------------------------------------------------------------- +std::string CNeutrinoAPI::getVideoAspectRatioAsString() { + int aspectRatio = videoDecoder->getAspectRatio(); + if (aspectRatio >= 0 && aspectRatio <= 4) + return videoformat_names[aspectRatio]; + else + return "unknown"; +} + diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h index 39383a9b4..11fd7ce84 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h @@ -46,7 +46,7 @@ class CNeutrinoAPI // some constants static std::string Dbox_Hersteller[4]; static std::string videooutput_names[5]; - static std::string videoformat_names[4]; + static std::string videoformat_names[5]; static std::string audiotype_names[5]; // get functions to collect data @@ -68,7 +68,7 @@ class CNeutrinoAPI std::string timerEventType2Str(CTimerd::CTimerEventTypes type); std::string timerEventRepeat2Str(CTimerd::CTimerEventRepeat rep); - + std::string getVideoAspectRatioAsString(); public: CNeutrinoAPI(); ~CNeutrinoAPI(void); diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp index 64fd44c0c..a81c3b990 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp @@ -679,13 +679,7 @@ std::string CNeutrinoYParser::func_get_current_stream_info(CyhookHandler *hh, s hh->ParamList["VideoFormat"] = string_printf("%d x %d", bitInfo[0], bitInfo[1] ); hh->ParamList["BitRate"] = string_printf("%d\n", bitInfo[4]*50); - switch ( bitInfo[2] ) //format - { - case 2: hh->ParamList["AspectRatio"] = "4:3"; break; - case 3: hh->ParamList["AspectRatio"] = "16:9"; break; - case 4: hh->ParamList["AspectRatio"] = "2.21:1"; break; - default: hh->ParamList["AspectRatio"]= "unknown"; break; - } + hh->ParamList["AspectRatio"] = NeutrinoAPI->getVideoAspectRatioAsString(); switch ( bitInfo[3] ) //fps {