mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 16:01:10 +02:00
rework streaming part3
Origin commit data
------------------
Branch: ni/coolstream
Commit: b7bb3447bd
Author: TangoCash <eric@loxat.de>
Date: 2022-10-07 (Fri, 07 Oct 2022)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -306,7 +306,10 @@ bool CStreamManager::SetPort(int newport)
|
|||||||
#endif
|
#endif
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
if (listenfd >= 0)
|
if (listenfd >= 0)
|
||||||
|
{
|
||||||
close(listenfd);
|
close(listenfd);
|
||||||
|
listenfd = -1;
|
||||||
|
}
|
||||||
ret = Listen();
|
ret = Listen();
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
}
|
}
|
||||||
|
@@ -51,6 +51,7 @@
|
|||||||
|
|
||||||
#include <driver/screen_max.h>
|
#include <driver/screen_max.h>
|
||||||
#include <driver/scanepg.h>
|
#include <driver/scanepg.h>
|
||||||
|
#include <driver/streamts.h>
|
||||||
|
|
||||||
#include <zapit/femanager.h>
|
#include <zapit/femanager.h>
|
||||||
#include <eitd/sectionsd.h>
|
#include <eitd/sectionsd.h>
|
||||||
@@ -734,7 +735,7 @@ int CMiscMenue::showMiscSettingsMenuStreaming()
|
|||||||
ms_sservices->addIntroItems(LOCALE_MISCSETTINGS_STREAMING);
|
ms_sservices->addIntroItems(LOCALE_MISCSETTINGS_STREAMING);
|
||||||
|
|
||||||
// port
|
// port
|
||||||
CIntInput * miscSettings_streamingport = new CIntInput(LOCALE_STREAMING_PORT, &g_settings.streaming_port, 5);
|
CIntInput * miscSettings_streamingport = new CIntInput(LOCALE_STREAMING_PORT, &g_settings.streaming_port, 5, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, this);
|
||||||
CMenuForwarder * mf = new CMenuDForwarder(LOCALE_STREAMING_PORT, true, to_string(g_settings.streaming_port), miscSettings_streamingport);
|
CMenuForwarder * mf = new CMenuDForwarder(LOCALE_STREAMING_PORT, true, to_string(g_settings.streaming_port), miscSettings_streamingport);
|
||||||
ms_sservices->addItem(mf);
|
ms_sservices->addItem(mf);
|
||||||
|
|
||||||
@@ -745,7 +746,7 @@ int CMiscMenue::showMiscSettingsMenuStreaming()
|
|||||||
|
|
||||||
// ecm
|
// ecm
|
||||||
dec_onoff = new CMenuOptionChooser(LOCALE_STREAMING_DECRYPTMODE, &g_settings.streaming_decryptmode, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true);
|
dec_onoff = new CMenuOptionChooser(LOCALE_STREAMING_DECRYPTMODE, &g_settings.streaming_decryptmode, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true);
|
||||||
//ecm_onoff->setHint(NEUTRINO_ICON_HINT_SETTINGS, LOCALE_MENU_HINT_DECRYPTMODE_ENABLED);
|
//dec_onoff->setHint(NEUTRINO_ICON_HINT_SETTINGS, LOCALE_MENU_HINT_DECRYPTMODE_ENABLED);
|
||||||
ms_sservices->addItem(dec_onoff);
|
ms_sservices->addItem(dec_onoff);
|
||||||
|
|
||||||
int res = ms_sservices->exec(NULL, "");
|
int res = ms_sservices->exec(NULL, "");
|
||||||
@@ -876,5 +877,9 @@ bool CMiscMenue::changeNotify(const neutrino_locale_t OptionName, void */*data*/
|
|||||||
shoutcast_dev_id_short.clear();
|
shoutcast_dev_id_short.clear();
|
||||||
shoutcast_onoff->setActive(CApiKey::check_shoutcast_dev_id());
|
shoutcast_onoff->setActive(CApiKey::check_shoutcast_dev_id());
|
||||||
}
|
}
|
||||||
|
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_STREAMING_PORT))
|
||||||
|
{
|
||||||
|
CStreamManager::getInstance()->SetPort(g_settings.streaming_port);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@@ -3412,7 +3412,9 @@ void CControlAPI::xmltvm3uCGI(CyhookHandler *hh)
|
|||||||
std::string url = host;
|
std::string url = host;
|
||||||
if (url.rfind(":") != 4)
|
if (url.rfind(":") != 4)
|
||||||
url = url.substr(0, url.rfind(":")); // strip off optional custom port
|
url = url.substr(0, url.rfind(":")); // strip off optional custom port
|
||||||
url += ":31339/id=";
|
url += ":";
|
||||||
|
url += std::to_string(g_settings.streaming_port);
|
||||||
|
url += "/id=";
|
||||||
|
|
||||||
for (unsigned int i = 0; i < g_bouquetManager->Bouquets.size(); i++)
|
for (unsigned int i = 0; i < g_bouquetManager->Bouquets.size(); i++)
|
||||||
{
|
{
|
||||||
@@ -3521,45 +3523,10 @@ void CControlAPI::xmltvlistCGI(CyhookHandler *hh)
|
|||||||
hh->SendOk();
|
hh->SendOk();
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// audio_no : (optional) audio channel
|
|
||||||
// host : (optional) ip of dbox
|
// host : (optional) ip of dbox
|
||||||
void CControlAPI::build_live_url(CyhookHandler *hh)
|
void CControlAPI::build_live_url(CyhookHandler *hh)
|
||||||
{
|
{
|
||||||
std::string xpids;
|
|
||||||
int mode = NeutrinoAPI->Zapit->getMode();
|
int mode = NeutrinoAPI->Zapit->getMode();
|
||||||
|
|
||||||
if ( mode == CZapitClient::MODE_TV)
|
|
||||||
{
|
|
||||||
CZapitClient::responseGetPIDs pids;
|
|
||||||
int apid=0,apid_no=0,apid_idx=0;
|
|
||||||
pids.PIDs.vpid=0;
|
|
||||||
|
|
||||||
if(!hh->ParamList["audio_no"].empty())
|
|
||||||
apid_no = atoi(hh->ParamList["audio_no"].c_str());
|
|
||||||
NeutrinoAPI->Zapit->getPIDS(pids);
|
|
||||||
|
|
||||||
if( apid_no < (int)pids.APIDs.size())
|
|
||||||
apid_idx=apid_no;
|
|
||||||
if(!pids.APIDs.empty())
|
|
||||||
apid = pids.APIDs[apid_idx].pid;
|
|
||||||
xpids = string_printf("0x%04x,0x%04x,0x%04x",pids.PIDs.pmtpid,pids.PIDs.vpid,apid);
|
|
||||||
if (pids.PIDs.pcrpid != pids.PIDs.vpid)
|
|
||||||
xpids += string_printf(",0x%04x", pids.PIDs.pcrpid);
|
|
||||||
}
|
|
||||||
else if ( mode == CZapitClient::MODE_RADIO)
|
|
||||||
{
|
|
||||||
CZapitClient::responseGetPIDs pids;
|
|
||||||
int apid=0;
|
|
||||||
|
|
||||||
NeutrinoAPI->Zapit->getPIDS(pids);
|
|
||||||
if(!pids.APIDs.empty())
|
|
||||||
apid = pids.APIDs[0].pid;
|
|
||||||
|
|
||||||
//xpids = string_printf("0x%04x",apid);
|
|
||||||
xpids = string_printf("0x%04x,0x%04x",pids.PIDs.pmtpid,apid);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
hh->SendError();
|
|
||||||
// build url
|
// build url
|
||||||
std::string url = "";
|
std::string url = "";
|
||||||
if(!hh->ParamList["host"].empty())
|
if(!hh->ParamList["host"].empty())
|
||||||
@@ -3570,21 +3537,71 @@ void CControlAPI::build_live_url(CyhookHandler *hh)
|
|||||||
if (url.rfind(":") != 4)
|
if (url.rfind(":") != 4)
|
||||||
url = url.substr(0, url.rfind(":"));
|
url = url.substr(0, url.rfind(":"));
|
||||||
|
|
||||||
//url += (mode == CZapitClient::MODE_TV) ? ":31339/0," : ":31338/";
|
url += ":";
|
||||||
url += ":31339/0,";
|
url += std::to_string(g_settings.streaming_port);
|
||||||
url += xpids;
|
url += "/id=";
|
||||||
|
|
||||||
// response url
|
// response url
|
||||||
if(!hh->ParamList["vlc_link"].empty())
|
if(!hh->ParamList["vlc_link"].empty())
|
||||||
{
|
{
|
||||||
write_to_file("/tmp/vlc.m3u", url);
|
write_to_file("/tmp/vlc.m3u", "#EXTM3U\n");
|
||||||
|
for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++) {
|
||||||
|
ZapitChannelList chanlist;
|
||||||
|
if (mode == CZapitClient::MODE_RADIO)
|
||||||
|
g_bouquetManager->Bouquets[i]->getRadioChannels(chanlist);
|
||||||
|
else
|
||||||
|
g_bouquetManager->Bouquets[i]->getTvChannels(chanlist);
|
||||||
|
if(!chanlist.empty() && !g_bouquetManager->Bouquets[i]->bHidden && g_bouquetManager->Bouquets[i]->bUser) {
|
||||||
|
for(int j = 0; j < (int) chanlist.size(); j++) {
|
||||||
|
CZapitChannel * channel = chanlist[j];
|
||||||
|
//printf("---> %s/n",channel->getName().c_str());
|
||||||
|
write_to_file("/tmp/vlc.m3u", "#EXTINF:-1,"+channel->getName()+"\n",true);
|
||||||
|
write_to_file("/tmp/vlc.m3u", url+string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->getChannelID())+"\n",true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
hh->SendRedirect("/tmp/vlc.m3u");
|
hh->SendRedirect("/tmp/vlc.m3u");
|
||||||
}
|
} else
|
||||||
|
hh->SendError();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
void CControlAPI::build_playlist(CyhookHandler *hh)
|
||||||
|
{
|
||||||
|
// build url
|
||||||
|
std::string url = "";
|
||||||
|
if(!hh->ParamList["host"].empty())
|
||||||
|
url = "http://"+hh->ParamList["host"];
|
||||||
else
|
else
|
||||||
{
|
url = "http://"+hh->HeaderList["Host"];
|
||||||
hh->SetHeader(HTTP_OK, "text/html; charset=UTF-8");
|
/* strip off optional custom port */
|
||||||
hh->Write(url);
|
if (url.rfind(":") != 4)
|
||||||
}
|
url = url.substr(0, url.rfind(":"));
|
||||||
|
|
||||||
|
url += ":";
|
||||||
|
url += std::to_string(g_settings.streaming_port);
|
||||||
|
url += "/id=";
|
||||||
|
|
||||||
|
if(!hh->ParamList["id"].empty()) {
|
||||||
|
url += hh->ParamList["id"];
|
||||||
|
t_channel_id channel_id;
|
||||||
|
sscanf(hh->ParamList["id"].c_str(), SCANF_CHANNEL_ID_TYPE, &channel_id);
|
||||||
|
std::string chan_name = NeutrinoAPI->Zapit->getChannelName(channel_id);
|
||||||
|
std::string illegalChars = "\\/:?\"<>|+ ";
|
||||||
|
std::string::iterator it;
|
||||||
|
for (it = chan_name.begin() ; it < chan_name.end() ; ++it){
|
||||||
|
bool found = illegalChars.find(*it) != std::string::npos;
|
||||||
|
if(found){
|
||||||
|
*it = '_';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::string m3u = "/tmp/" + chan_name + ".m3u";
|
||||||
|
write_to_file(m3u, "#EXTM3U\n");
|
||||||
|
write_to_file(m3u, "#EXTINF:-1,"+NeutrinoAPI->Zapit->getChannelName(channel_id)+"\n",true);
|
||||||
|
write_to_file(m3u, url, true);
|
||||||
|
hh->SendRedirect(m3u);
|
||||||
|
} else
|
||||||
|
hh->SendError();
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
void CControlAPI::logoCGI(CyhookHandler *hh)
|
void CControlAPI::logoCGI(CyhookHandler *hh)
|
||||||
|
Reference in New Issue
Block a user