From 5c0a4b2f796c6acccffb64ad8d8af7e61bce1e0d Mon Sep 17 00:00:00 2001 From: gixxpunk Date: Sat, 20 Mar 2010 22:04:31 +0000 Subject: [PATCH] add getAspectRatio(); setAspectRatio(); void getMode43(); void setMode43(); to zapit. Patch by SnowHead. -> http://www.dbox2world.net/board293-coolstream-hd1/board314-coolstream-development/9240-framebuffer-blockiert/ git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@519 e54a6e83-5905-42d5-8d5c-058d10e6a962 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/342aba0a72e2fa9c5c6a13de4872cf7ae626ceca Author: gixxpunk Date: 2010-03-20 (Sat, 20 Mar 2010) Origin message was: ------------------ - add getAspectRatio(); setAspectRatio(); void getMode43(); void setMode43(); to zapit. Patch by SnowHead. -> http://www.dbox2world.net/board293-coolstream-hd1/board314-coolstream-development/9240-framebuffer-blockiert/ git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@519 e54a6e83-5905-42d5-8d5c-058d10e6a962 ------------------ This commit was generated by Migit --- src/zapit/include/zapit/client/msgtypes.h | 20 ++++--- src/zapit/include/zapit/client/zapitclient.h | 4 ++ src/zapit/lib/zapitclient.cpp | 34 ++++++++++++ src/zapit/src/pzapit.cpp | 57 +++++++++++++++++++- src/zapit/src/zapit.cpp | 50 ++++++++++++++--- 5 files changed, 150 insertions(+), 15 deletions(-) diff --git a/src/zapit/include/zapit/client/msgtypes.h b/src/zapit/include/zapit/client/msgtypes.h index 64dc14371..4a29db35b 100644 --- a/src/zapit/include/zapit/client/msgtypes.h +++ b/src/zapit/include/zapit/client/msgtypes.h @@ -136,15 +136,19 @@ class CZapitMessages CMD_TUNE_TP = 91, CMD_SB_LOCK_PLAYBACK = 92, CMD_SB_UNLOCK_PLAYBACK = 93, - CMD_GET_BOUQUET_NCHANNELS = 94, + CMD_GET_BOUQUET_NCHANNELS = 94, CMD_SET_EVENT_MODE = 95, - CMD_REZAP = 96, - CMD_GETCONFIG = 97, - CMD_SETCONFIG = 98, - CMD_SCANSTOP = 99, - CMD_GET_VOLUME = 104, - CMD_GET_AUDIO_MODE = 105, - CMD_GET_MUTE_STATUS = 106 + CMD_REZAP = 96, + CMD_GETCONFIG = 97, + CMD_SETCONFIG = 98, + CMD_SCANSTOP = 99, + CMD_GET_VOLUME = 104, + CMD_GET_AUDIO_MODE = 105, + CMD_GET_MUTE_STATUS = 106, + CMD_GET_ASPECTRATIO = 107, + CMD_SET_ASPECTRATIO = 108, + CMD_GET_MODE43 = 109, + CMD_SET_MODE43 = 110 }; diff --git a/src/zapit/include/zapit/client/zapitclient.h b/src/zapit/include/zapit/client/zapitclient.h index 93d4adce7..619b23989 100644 --- a/src/zapit/include/zapit/client/zapitclient.h +++ b/src/zapit/include/zapit/client/zapitclient.h @@ -487,6 +487,10 @@ class CZapitClient:public CBasicClient void setAudioMode(int mode); void getAudioMode(int * mode); void setVideoSystem(int video_system); + void getAspectRatio(int *ratio); + void setAspectRatio(int ratio); + void getMode43(int *m43); + void setMode43(int m43); /****************************************/ /* */ diff --git a/src/zapit/lib/zapitclient.cpp b/src/zapit/lib/zapitclient.cpp index ad470c84f..018d33801 100644 --- a/src/zapit/lib/zapitclient.cpp +++ b/src/zapit/lib/zapitclient.cpp @@ -1004,6 +1004,40 @@ bool CZapitClient::isRecordModeActive() return response.activated; } +void CZapitClient::getAspectRatio(int *ratio) +{ + CZapitMessages::commandInt msg; + send(CZapitMessages::CMD_GET_ASPECTRATIO, 0, 0); + CBasicClient::receive_data((char* )&msg, sizeof(msg)); + * ratio = msg.val; + close_connection(); +} + +void CZapitClient::setAspectRatio(int ratio) +{ + CZapitMessages::commandInt msg; + msg.val = ratio; + send(CZapitMessages::CMD_SET_ASPECTRATIO, (char*)&msg, sizeof(msg)); + close_connection(); +} + +void CZapitClient::getMode43(int *m43) +{ + CZapitMessages::commandInt msg; + send(CZapitMessages::CMD_GET_MODE43, 0, 0); + CBasicClient::receive_data((char* )&msg, sizeof(msg)); + * m43 = msg.val; + close_connection(); +} + +void CZapitClient::setMode43(int m43) +{ + CZapitMessages::commandInt msg; + msg.val = m43; + send(CZapitMessages::CMD_SET_MODE43, (char*)&msg, sizeof(msg)); + close_connection(); +} + void CZapitClient::registerEvent(const unsigned int eventID, const unsigned int clientID, const char * const udsName) { CEventServer::commandRegisterEvent msg; diff --git a/src/zapit/src/pzapit.cpp b/src/zapit/src/pzapit.cpp index 9ff9407ee..845458776 100644 --- a/src/zapit/src/pzapit.cpp +++ b/src/zapit/src/pzapit.cpp @@ -48,7 +48,7 @@ int usage (const char * basename) std::cout << "save bouquets: " << basename << " -sb" << std::endl << std::endl; std::cout << "show satellites: " << basename << " -sh" << std::endl; - std::cout << "rezap" << basename << " -rz" << std::endl; + std::cout << "rezap " << basename << " -rz" << std::endl; std::cout << "select satellites: " << basename << " -se " << std::endl; std::cout << "start transponderscan: " << basename << " -st" << std::endl << std::endl; @@ -59,6 +59,13 @@ int usage (const char * basename) std::cout << "shutdown zapit: " << basename << " -kill" << std::endl; std::cout << "enter standby: " << basename << " -esb" << std::endl; std::cout << "leave standby: " << basename << " -lsb" << std::endl; + std::cout << "get aspect ratio: " << basename << " -var" << std::endl; + std::cout << "set aspect ratio: " << basename << " -var " << std::endl; +#if 0 + //FIXME howto read aspect mode back? + std::cout << "get 4:3 mode: " << basename << " -vm43" << std::endl; +#endif + std::cout << "set 4:3 mode: " << basename << " -vm43 <4:3mode>" << std::endl; std::cout << "switch to hd 1080i mode: " << basename << " --1080" << std::endl; std::cout << "switch to pal mode: " << basename << " --pal" << std::endl; std::cout << "switch to hd 720p mode: " << basename << " --720p" << std::endl; @@ -83,6 +90,8 @@ int main (int argc, char** argv) int mute = -1; int volume = -1; int nvod = -1; + int arat = -1; + int m43 = -1; const char * channelName = NULL; bool playback = false; @@ -103,6 +112,8 @@ int main (int argc, char** argv) bool sendMotorCommand = false; bool quiet = false; bool getchannel = false; + bool aspectratio = false; + bool mode43 = false; uint8_t motorCmdType = 0; uint8_t motorCmd = 0; uint8_t motorNumParameters = 0; @@ -233,6 +244,26 @@ int main (int argc, char** argv) recordmode = true; continue; } + else if (!strncmp(argv[i], "-var", 4)) + { + aspectratio = true; + if (i < argc - 1) + sscanf(argv[++i], "%d", &arat); + continue; + } + else if (!strncmp(argv[i], "-vm43", 5)) + { + mode43 = true; + if (i < argc - 1) + { + sscanf(argv[++i], "%d", &m43); + continue; + } +#if 0 + //FIXME howto read aspect mode back? + continue; +#endif + } else if (!strncmp(argv[i], "-sb", 3)) { savebouquets = true; @@ -441,6 +472,30 @@ int main (int argc, char** argv) return 0; } + if (aspectratio) + { + if(arat >= 0) + zapit.setAspectRatio(arat); + else + { + zapit.getAspectRatio(&arat); + printf("%d\n", arat); + } + return 0; + } + + if (mode43) + { + if(m43 >= 0) + zapit.setMode43(m43); + else + { + zapit.getMode43(&m43); + printf("%d\n",m43); + } + return 0; + } + if (savebouquets) { zapit.saveBouquets(); diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index cd49be7fb..363e98f72 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -82,6 +82,8 @@ map::iterator audio_map_it; unsigned int volume_left = 0, volume_right = 0; unsigned int def_volume_left = 0, def_volume_right = 0; int audio_mode = 0; +int aspectratio=0; +int mode43=0; int def_audio_mode = 0; t_channel_id live_channel_id; static t_channel_id rec_channel_id; @@ -1443,12 +1445,48 @@ printf("[zapit] recording mode: %d\n", msgSetRecordMode.activate);fflush(stdout) audio_mode = msg.val; break; } - case CZapitMessages::CMD_GET_AUDIO_MODE: { - CZapitMessages::commandInt msg; - msg.val = (int) audio_mode; - CBasicServer::send_data(connfd, &msg, sizeof(msg)); - break; - } + + case CZapitMessages::CMD_GET_AUDIO_MODE: { + CZapitMessages::commandInt msg; + msg.val = (int) audio_mode; + CBasicServer::send_data(connfd, &msg, sizeof(msg)); + break; + } + + case CZapitMessages::CMD_SET_ASPECTRATIO: { + CZapitMessages::commandInt msg; + CBasicServer::receive_data(connfd, &msg, sizeof(msg)); + aspectratio=(int) msg.val; + if(videoDecoder) videoDecoder->setAspectRatio(aspectratio, -1); + break; + } + + case CZapitMessages::CMD_GET_ASPECTRATIO: { + CZapitMessages::commandInt msg; + if(videoDecoder) aspectratio=videoDecoder->getAspectRatio(); + msg.val = aspectratio; + CBasicServer::send_data(connfd, &msg, sizeof(msg)); + break; + } + + case CZapitMessages::CMD_SET_MODE43: { + CZapitMessages::commandInt msg; + CBasicServer::receive_data(connfd, &msg, sizeof(msg)); + mode43=(int) msg.val; + if(videoDecoder) videoDecoder->setAspectRatio(-1, mode43); + break; + } + +#if 0 + //FIXME howto read aspect mode back? + case CZapitMessages::CMD_GET_MODE43: { + CZapitMessages::commandInt msg; + if(videoDecoder) mode43=videoDecoder->getCroppingMode(); + msg.val = mode43; + CBasicServer::send_data(connfd, &msg, sizeof(msg)); + break; + } +#endif case CZapitMessages::CMD_GETPIDS: { if (channel) {