diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index 9c23ac235..ad9cddc2d 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -169,12 +169,13 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]= {"startplugin", &CControlAPI::StartPluginCGI, "text/plain"}, {"exec", &CControlAPI::ExecCGI, "+xml"}, {"yweb", &CControlAPI::YWebCGI, "text/plain"}, - // video handling + // video & Audio handling {"aspectratio", &CControlAPI::AspectRatioCGI, "text/plain"}, {"videoformat", &CControlAPI::VideoFormatCGI, "text/plain"}, {"videooutput", &CControlAPI::VideoOutputCGI, "text/plain"}, {"vcroutput", &CControlAPI::VCROutputCGI, "text/plain"}, {"scartmode", &CControlAPI::ScartModeCGI, "text/plain"}, + {"audio", &CControlAPI::AudioCGI, "text/plain"}, // timer {"timer", &CControlAPI::TimerCGI, "text/plain"}, // bouquet editing @@ -740,6 +741,16 @@ void CControlAPI::ScartModeCGI(CyhookHandler *hh) hh->SendOk(); } +//----------------------------------------------------------------------------- +void CControlAPI::AudioCGI(CyhookHandler *hh) +{ + if (hh->ParamList.empty() || hh->ParamList["1"] == "info") { + hh->printf("%s",(NeutrinoAPI->getAudioInfoAsString()).c_str()); + return; + } + //TODO: more +} + //------------------------------------------------------------------------- void CControlAPI::VolumeCGI(CyhookHandler *hh) { diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.h b/src/nhttpd/tuxboxapi/coolstream/controlapi.h index 5c766fb4e..6f70007aa 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.h +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.h @@ -83,6 +83,7 @@ private: void VideoOutputCGI(CyhookHandler *hh); void VCROutputCGI(CyhookHandler *hh); void ScartModeCGI(CyhookHandler *hh); + void AudioCGI(CyhookHandler *hh); void setBouquetCGI(CyhookHandler *hh); void saveBouquetCGI(CyhookHandler *hh); void moveBouquetCGI(CyhookHandler *hh); diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp index 027b721ee..45ea31d1c 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp @@ -16,6 +16,7 @@ #include #include #include +#include // tuxbox #include @@ -99,6 +100,8 @@ std::string CNeutrinoAPI::Dbox_Hersteller[4] = {"none", "Nokia", "Philips", "Sag std::string CNeutrinoAPI::videooutput_names[5] = {"CVBS", "RGB with CVBS", "S-Video", "YUV with VBS", "YUV with CVBS"}; 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"}; +std::string CNeutrinoAPI::mpegmodes[] = { "stereo", "joint_st", "dual_ch", "single_ch" }; +std::string CNeutrinoAPI::ddmodes[] = { "CH1/CH2", "C", "L/R", "L/C/R", "L/R/S", "L/C/R/S", "L/R/SL/SR", "L/C/R/SL/SR" }; //============================================================================= // Constructor & Destructor @@ -416,7 +419,7 @@ std::string CNeutrinoAPI::getVideoAspectRatioAsString(void) { //------------------------------------------------------------------------- int CNeutrinoAPI::setVideoAspectRatioAsString(std::string newRatioString) { int newRatioInt = -1; - for(int i=0;isetAspectRatio(newRatioInt, -1); return newRatioInt; } +//------------------------------------------------------------------------- +std::string CNeutrinoAPI::getVideoResolutionAsString(void) { + int xres, yres, framerate; + videoDecoder->getPictureInfo(xres, yres, framerate); + std::stringstream out; + out << xres << "x" << yres; + return out.str(); +} + +//------------------------------------------------------------------------- +std::string CNeutrinoAPI::getVideoFramerateAsString(void) { + int xres, yres, framerate; + std::string sframerate="unknown"; + videoDecoder->getPictureInfo(xres, yres, framerate); + switch(framerate){ + case 2: + sframerate="25fps";break; + case 5: + sframerate="50fps";break; + } + return sframerate; +} + +//------------------------------------------------------------------------- +std::string CNeutrinoAPI::getAudioInfoAsString(void) { + int type, layer, freq, mode, lbitrate; + audioDecoder->getAudioInfo(type, layer, freq, lbitrate, mode); + std::stringstream out; + if(type == 0) + out << "MPEG " << mpegmodes[mode] << " (" << freq <<")"; + else + out << "DD " << ddmodes[mode] << " (" << freq <<")"; + return out.str(); +} + diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h index 3af516d51..969fa0252 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h @@ -48,6 +48,8 @@ class CNeutrinoAPI static std::string videooutput_names[5]; static std::string videoformat_names[5]; static std::string audiotype_names[5]; + static std::string mpegmodes[]; + static std::string ddmodes[]; // get functions to collect data bool GetChannelEvents(void); @@ -70,6 +72,9 @@ class CNeutrinoAPI std::string timerEventRepeat2Str(CTimerd::CTimerEventRepeat rep); std::string getVideoAspectRatioAsString(void); int setVideoAspectRatioAsString(std::string newRatioString); + std::string getVideoResolutionAsString(void); + std::string getVideoFramerateAsString(void); + std::string getAudioInfoAsString(void); public: CNeutrinoAPI(); ~CNeutrinoAPI(void); diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp index a81c3b990..c0fc71ae6 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp @@ -660,7 +660,6 @@ std::string CNeutrinoYParser::func_get_boxtype(CyhookHandler *, std::string) //------------------------------------------------------------------------- std::string CNeutrinoYParser::func_get_current_stream_info(CyhookHandler *hh, std::string) { - int bitInfo[10]; CZapitClient::CCurrentServiceInfo serviceinfo; serviceinfo = NeutrinoAPI->Zapit->getCurrentServiceInfo(); @@ -674,37 +673,11 @@ std::string CNeutrinoYParser::func_get_current_stream_info(CyhookHandler *hh, s hh->ParamList["tsfrequency"] = string_printf("%d.%d MHz", serviceinfo.tsfrequency/1000, serviceinfo.tsfrequency%1000); hh->ParamList["polarisation"] = serviceinfo.polarisation==1?"h":"v"; hh->ParamList["ServiceName"] = NeutrinoAPI->GetServiceName(live_channel_id);//NeutrinoAPI->Zapit->getCurrentServiceID()); - NeutrinoAPI->GetStreamInfo(bitInfo); - - hh->ParamList["VideoFormat"] = string_printf("%d x %d", bitInfo[0], bitInfo[1] ); - hh->ParamList["BitRate"] = string_printf("%d\n", bitInfo[4]*50); - + hh->ParamList["VideoFormat"] = NeutrinoAPI->getVideoResolutionAsString(); +// hh->ParamList["BitRate"] = NeutrinoAPI->getVideoFramerateAsString(); hh->ParamList["AspectRatio"] = NeutrinoAPI->getVideoAspectRatioAsString(); - - switch ( bitInfo[3] ) //fps - { - case 3: hh->ParamList["FPS"] = "25"; break; - case 6: hh->ParamList["FPS"] = "50"; break; - default: hh->ParamList["FPS"]= "unknown"; - } - - if (!bitInfo[7]) hh->ParamList["AudioType"]="unknown"; - else { - const char* layernames[4]={"res","III","II","I"}; - const char* sampfreqnames[4]={"44,1k","48k","32k","res"}; - const char* modenames[4]={"stereo","joint_st","dual_ch","single_ch"}; - - long header = bitInfo[7]; - - unsigned char layer = (header>>17)&3; - unsigned char sampfreq =(header>>10)&3; - unsigned char mode = (header>> 6)&3; - unsigned char copy = (header>> 3)&1; - - hh->ParamList["AudioType"] = - string_printf("%s (%s/%s) %s", modenames[mode], sampfreqnames[sampfreq], - layernames[layer], copy?"c":""); - } + hh->ParamList["FPS"] = NeutrinoAPI->getVideoFramerateAsString(); + hh->ParamList["AudioType"] = NeutrinoAPI->getAudioInfoAsString(); return ""; } //-------------------------------------------------------------------------