pzapit: add set and get OSD resolution

This commit is contained in:
GetAway
2018-05-13 18:07:09 +02:00
parent 3fb15ec619
commit 5c5a013266
6 changed files with 85 additions and 10 deletions

View File

@@ -144,13 +144,15 @@ class CZapitMessages
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,
CMD_STOP_PIP = 111,
CMD_ZAPTO_EPG = 112,
CMD_LOCKRC = 113
CMD_GET_OSD_RES = 107,
CMD_SET_OSD_RES = 108,
CMD_GET_ASPECTRATIO = 109,
CMD_SET_ASPECTRATIO = 110,
CMD_GET_MODE43 = 111,
CMD_SET_MODE43 = 112,
CMD_STOP_PIP = 113,
CMD_ZAPTO_EPG = 114,
CMD_LOCKRC = 115
};
struct commandBoolean

View File

@@ -506,6 +506,8 @@ class CZapitClient:public CBasicClient
void setAudioMode(int mode);
//void getAudioMode(int * mode);
void setVideoSystem(int video_system);
void getOSDres(int *mosd);
void setOSDres(int mosd);
void getAspectRatio(int *ratio);
void setAspectRatio(int ratio);
void getMode43(int *m43);

View File

@@ -114,6 +114,7 @@ class CZapit : public OpenThreads::Thread
int audio_mode;
int def_audio_mode;
int mosd;
int aspectratio;
int mode43;
#if 0

View File

@@ -1260,6 +1260,27 @@ void CZapitClient::setAspectRatio(int ratio)
close_connection();
}
void CZapitClient::getOSDres(int *mosd)
{
CZapitMessages::commandInt msg;
VALGRIND_PARANOIA;
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
send(CZapitMessages::CMD_GET_OSD_RES, 0, 0);
CBasicClient::receive_data((char* )&msg, sizeof(msg));
* mosd = msg.val;
close_connection();
}
void CZapitClient::setOSDres(int mosd)
{
CZapitMessages::commandInt msg;
VALGRIND_PARANOIA;
msg.val = mosd;
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
send(CZapitMessages::CMD_SET_OSD_RES, (char*)&msg, sizeof(msg));
close_connection();
}
void CZapitClient::getMode43(int *m43)
{
CZapitMessages::commandInt msg;

View File

@@ -45,7 +45,7 @@ int usage (const char * basename)
<< "\t-re\t\t\tswitch record mode on/off" << std::endl
<< "\t-p\t\t\tstart/stop playback" << std::endl
<< std::endl
<< "\t-a <audio-no>\tchange audio pid" << std::endl
<< "\t-a <audio-no>\t\tchange audio pid" << std::endl
<< std::endl
<< "\t-c\t\t\treload channels bouquets" << std::endl
<< "\t-sb\t\t\tsave bouquets" << std::endl
@@ -62,6 +62,10 @@ int usage (const char * basename)
<< "\t-kill\t\t\tshutdown zapit" << std::endl
<< "\t-esb\t\t\tenter standby" << std::endl
<< "\t-lsb\t\t\tleave standby" << std::endl
<< "\t-osd\t\t\tget osd resolution" << std::endl
#ifdef ENABLE_CHANGE_OSD_RESOLUTION
<< "\t-osd <resolution>\tset osd resolution" << std::endl
#endif
<< "\t-var\t\t\tget aspect ratio" << std::endl
<< "\t-var <aspectratio>\tset aspect ratio" << std::endl
<< "\t-vm43\t\t\tget 4:3 mode" << std::endl
@@ -98,6 +102,7 @@ int main (int argc, char** argv)
int arat = -1;
int m43 = -1;
int lockrc = -1;
int mosd = -1;
const char * channelName = NULL;
bool playback = false;
@@ -121,6 +126,7 @@ int main (int argc, char** argv)
bool getmode = false;
bool aspectratio = false;
bool mode43 = false;
bool osd = false;
uint8_t motorCmdType = 0;
uint8_t motorCmd = 0;
uint8_t motorNumParameters = 0;
@@ -236,6 +242,18 @@ int main (int argc, char** argv)
continue;
}
}
else if (!strncmp(argv[i], "-osd", 4))
{
osd = true;
#ifdef ENABLE_CHANGE_OSD_RESOLUTION
if (i < argc - 1)
{
sscanf(argv[++i], "%d", &mosd);
continue;
}
#endif
continue;
}
else if (!strncmp(argv[i], "-p", 2))
{
playback = true;
@@ -479,6 +497,20 @@ int main (int argc, char** argv)
return 0;
}
if (osd)
{
#ifdef ENABLE_CHANGE_OSD_RESOLUTION
if (mosd > -1)
zapit.setOSDres(mosd);
else
#endif
{
zapit.getOSDres(&mosd);
printf("%d\n", mosd);
}
return 0;
}
if (playback)
{
if (zapit.isPlayBackActive())

View File

@@ -129,8 +129,9 @@ CZapit::CZapit()
pmt_update_fd = -1;
//volume_left = 0, volume_right = 0;
audio_mode = 0;
aspectratio=0;
mode43=0;
mosd = 0;
aspectratio = 0;
mode43 = 0;
def_audio_mode = 0;
playbackStopForced = false;
standby = true;
@@ -1830,6 +1831,22 @@ bool CZapit::ParseCommand(CBasicMessage::Header &rmsg, int connfd)
}
#endif
case CZapitMessages::CMD_SET_OSD_RES: {
CZapitMessages::commandInt msg;
CBasicServer::receive_data(connfd, &msg, sizeof(msg));
mosd=(int) msg.val;
COsdHelpers::getInstance()->changeOsdResolution(mosd);
break;
}
case CZapitMessages::CMD_GET_OSD_RES: {
CZapitMessages::commandInt msg;
mosd = COsdHelpers::getInstance()->getOsdResolution();
msg.val = mosd;
CBasicServer::send_data(connfd, &msg, sizeof(msg));
break;
}
case CZapitMessages::CMD_SET_ASPECTRATIO: {
CZapitMessages::commandInt msg;
CBasicServer::receive_data(connfd, &msg, sizeof(msg));