Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/addons/pvr.hts/resources/language/English/strings.xml b/addons/pvr.hts/resources/language/English/strings.xml
- index 5b69906..d05fdfd 100644
- --- a/addons/pvr.hts/resources/language/English/strings.xml
- +++ b/addons/pvr.hts/resources/language/English/strings.xml
- @@ -8,6 +8,14 @@
- <string id="30004">Password</string>
- <string id="30006">Connect timeout in seconds</string>
- <string id="30007">Response timeout in seconds</string>
- + <string id="30008">Enable transcoding</string>
- + <string id="30009">Audio codec</string>
- + <string id="30010">Video codec</string>
- + <string id="30011">Resolution</string>
- +
- + <!-- category labels -->
- + <string id="30040">Connection</string>
- + <string id="30041">Transcoding</string>
- <!-- notifications -->
- <string id="30500">Disconnected from '%s'</string>
- diff --git a/addons/pvr.hts/resources/settings.xml b/addons/pvr.hts/resources/settings.xml
- index 3ef0839..43aa760 100644
- --- a/addons/pvr.hts/resources/settings.xml
- +++ b/addons/pvr.hts/resources/settings.xml
- @@ -1,5 +1,8 @@
- <?xml version="1.0" encoding="utf-8" standalone="yes"?>
- <settings>
- +
- + <!-- Connection -->
- + <category label="30040">
- <setting id="host" type="text" label="30000" default="127.0.0.1" />
- <setting id="http_port" type="number" label="30001" default="9981" />
- <setting id="htsp_port" type="number" label="30002" default="9982" />
- @@ -7,4 +10,13 @@
- <setting id="pass" type="text" label="30004" option="hidden" default="" />
- <setting id="connect_timeout" type="enum" label="30006" values="1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60" default="29" />
- <setting id="response_timeout" type="enum" label="30007" values="1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60" default="1" />
- + </category>
- +
- + <!-- Transcoding -->
- + <category label="30041">
- + <setting id="transcode" type="bool" label="30008" default="false" />
- + <setting id="audio_codec" type="enum" label="30009" values="MPEG2 Audio|AAC" default="1"/>
- + <setting id="video_codec" type="enum" label="30010" values="MPEG2 Video|H264" default="1"/>
- + <setting id="video_res" type="enum" label="30011" values="288p|384p|480p|576p|720p|1080p" default="2"/>
- + </category>
- </settings>
- diff --git a/xbmc/pvrclients/tvheadend/HTSPDemux.cpp b/xbmc/pvrclients/tvheadend/HTSPDemux.cpp
- index ce11fc1..25a4cdb 100644
- --- a/xbmc/pvrclients/tvheadend/HTSPDemux.cpp
- +++ b/xbmc/pvrclients/tvheadend/HTSPDemux.cpp
- @@ -444,6 +444,13 @@ bool CHTSPDemux::SendSubscribe(int subscription, int channel)
- htsmsg_add_str(m, "method" , "subscribe");
- htsmsg_add_s32(m, "channelId" , channel);
- htsmsg_add_s32(m, "subscriptionId", subscription);
- + if(g_bTranscode)
- + {
- + htsmsg_add_u32(m, "maxWidth" , g_iResolution * 16 / 9);
- + htsmsg_add_u32(m, "maxHeight" , g_iResolution);
- + htsmsg_add_str(m, "audioCodec" , g_strAudioCodec.c_str());
- + htsmsg_add_str(m, "videoCodec" , g_strVideoCodec.c_str());
- + }
- return m_session->ReadSuccess(m, true, "subscribe to channel");
- }
- diff --git a/xbmc/pvrclients/tvheadend/client.cpp b/xbmc/pvrclients/tvheadend/client.cpp
- index d9a89e6..5602fa4 100644
- --- a/xbmc/pvrclients/tvheadend/client.cpp
- +++ b/xbmc/pvrclients/tvheadend/client.cpp
- @@ -45,21 +45,34 @@ std::string g_strUsername = "";
- std::string g_strPassword = "";
- std::string g_strUserPath = "";
- std::string g_strClientPath = "";
- +bool g_bTranscode = DEFAULT_TRANSCODE;
- +std::string g_strAudioCodec = "";
- +std::string g_strVideoCodec = "";
- +int g_iResolution = DEFAULT_RESOLUTION;
- CHelper_libXBMC_addon *XBMC = NULL;
- CHelper_libXBMC_pvr *PVR = NULL;
- CHTSPDemux * HTSPDemuxer = NULL;
- CHTSPData * HTSPData = NULL;
- +#define VIDEO_CODEC_LIST_SIZE 2
- +#define AUDIO_CODEC_LIST_SIZE 2
- +#define RESOLUTION_LIST_SIZE 6
- +
- +static const char *pVideoCodecList[VIDEO_CODEC_LIST_SIZE] = {"MPEG2VIDEO", "H264"};
- +static const char *pAudioCodecList[AUDIO_CODEC_LIST_SIZE] = {"MPEG2AUDIO", "AAC"};
- +static const int pResolutionList[RESOLUTION_LIST_SIZE] = {288, 384, 480, 576, 720, 1080};
- +
- extern "C" {
- void ADDON_ReadSettings(void)
- {
- - /* read setting "host" from settings.xml */
- + uint32_t iEnumIndex;
- char * buffer;
- buffer = (char*) malloc (1024);
- buffer[0] = 0; /* Set the end of string */
- + /* read setting "host" from settings.xml */
- if (XBMC->GetSetting("host", buffer))
- g_strHostname = buffer;
- else
- @@ -96,6 +109,34 @@ void ADDON_ReadSettings(void)
- /* read setting "read_timeout" from settings.xml */
- if (!XBMC->GetSetting("response_timeout", &g_iResponseTimeout))
- g_iResponseTimeout = DEFAULT_RESPONSE_TIMEOUT;
- +
- + /* read setting "transcode" from settings.xml */
- + if (!XBMC->GetSetting("transcode", &g_bTranscode))
- + g_bTranscode = DEFAULT_TRANSCODE;
- +
- + /* read setting "audio_codec" from settings.xml */
- + if (!XBMC->GetSetting("audio_codec", &iEnumIndex))
- + g_strAudioCodec = "";
- + else if (iEnumIndex < AUDIO_CODEC_LIST_SIZE)
- + g_strAudioCodec = pAudioCodecList[iEnumIndex];
- + else
- + g_strAudioCodec = "";
- +
- + /* read setting "video_codec" from settings.xml */
- + if (!XBMC->GetSetting("video_codec", &iEnumIndex))
- + g_strVideoCodec = "";
- + else if (iEnumIndex < VIDEO_CODEC_LIST_SIZE)
- + g_strVideoCodec = pVideoCodecList[iEnumIndex];
- + else
- + g_strVideoCodec = "";
- +
- + /* read setting "video_res" from settings.xml */
- + if (!XBMC->GetSetting("video_res", &iEnumIndex))
- + g_iResolution = DEFAULT_RESOLUTION;
- + else if (iEnumIndex < RESOLUTION_LIST_SIZE)
- + g_iResolution = pResolutionList[iEnumIndex];
- + else
- + g_iResolution = DEFAULT_RESOLUTION;
- }
- ADDON_STATUS ADDON_Create(void* hdl, void* props)
- @@ -266,6 +307,67 @@ ADDON_STATUS ADDON_SetSetting(const char *settingName, const void *settingValue)
- return ADDON_STATUS_OK;
- }
- }
- + else if (str == "transcode")
- + {
- + bool bNewValue = *(bool*) settingValue;
- + if (g_bTranscode != bNewValue)
- + {
- + XBMC->Log(LOG_INFO, "%s - Changed Setting 'transcode' from %u to %u", __FUNCTION__, g_bTranscode, bNewValue);
- + g_bTranscode = bNewValue;
- + return ADDON_STATUS_OK;
- + }
- + }
- + else if (str == "audio_codec")
- + {
- + uint32_t iEnumIndex = *(uint32_t*) settingValue;
- + string tmp_sAudioCodec = g_strAudioCodec;
- +
- + if (iEnumIndex < AUDIO_CODEC_LIST_SIZE)
- + tmp_sAudioCodec = pAudioCodecList[iEnumIndex];
- + else
- + tmp_sAudioCodec = "";
- +
- + if (tmp_sAudioCodec != g_strAudioCodec)
- + {
- + XBMC->Log(LOG_INFO, "%s - Changed Setting 'audio_codec' from %s to %s", __FUNCTION__, tmp_sAudioCodec.c_str(), g_strAudioCodec.c_str());
- + g_strAudioCodec = tmp_sAudioCodec;
- + return ADDON_STATUS_OK;
- + }
- + }
- + else if (str == "video_codec")
- + {
- + uint32_t iEnumIndex = *(uint32_t*) settingValue;
- + string tmp_sVideoCodec = g_strVideoCodec;
- +
- + if (iEnumIndex < VIDEO_CODEC_LIST_SIZE)
- + tmp_sVideoCodec = pVideoCodecList[iEnumIndex];
- + else
- + tmp_sVideoCodec = "";
- +
- + if (tmp_sVideoCodec != g_strVideoCodec)
- + {
- + XBMC->Log(LOG_INFO, "%s - Changed Setting 'video_codec' from %s to %s", __FUNCTION__, tmp_sVideoCodec.c_str(), g_strVideoCodec.c_str());
- + g_strVideoCodec = tmp_sVideoCodec;
- + return ADDON_STATUS_OK;
- + }
- + }
- + else if (str == "video_res")
- + {
- + uint32_t iEnumIndex = *(uint32_t*) settingValue;
- + int iNewValue = g_iResolution;
- +
- + if (iEnumIndex < RESOLUTION_LIST_SIZE)
- + iNewValue = pResolutionList[iEnumIndex];
- + else
- + iNewValue = DEFAULT_RESOLUTION;
- +
- + if (g_iResolution != iNewValue)
- + {
- + XBMC->Log(LOG_INFO, "%s - Changed Setting 'video_res' from %u to %u", __FUNCTION__, g_iResolution, iNewValue);
- + g_iResolution = iNewValue;
- + return ADDON_STATUS_OK;
- + }
- + }
- return ADDON_STATUS_OK;
- }
- diff --git a/xbmc/pvrclients/tvheadend/client.h b/xbmc/pvrclients/tvheadend/client.h
- index 27c8a81..f812c88 100644
- --- a/xbmc/pvrclients/tvheadend/client.h
- +++ b/xbmc/pvrclients/tvheadend/client.h
- @@ -28,6 +28,8 @@
- #define DEFAULT_HTSP_PORT 9982
- #define DEFAULT_CONNECT_TIMEOUT 30
- #define DEFAULT_RESPONSE_TIMEOUT 3
- +#define DEFAULT_TRANSCODE false
- +#define DEFAULT_RESOLUTION 480
- extern bool m_bCreated;
- extern std::string g_strHostname;
- @@ -37,6 +39,10 @@ extern std::string g_strUsername;
- extern std::string g_strPassword;
- extern int g_iConnectTimeout;
- extern int g_iResponseTimeout;
- +extern bool g_bTranscode;
- +extern std::string g_strAudioCodec;
- +extern std::string g_strVideoCodec;
- +extern int g_iResolution;
- extern int g_iClientId;
- extern unsigned int g_iPacketSequence;
- extern bool g_bShowTimerNotifications;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement