mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 16:01:10 +02:00
nhttp: re-enable threading; lock NeutrinoAPI calls
Origin commit data
------------------
Branch: ni/coolstream
Commit: 8abb547cca
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2016-02-13 (Sat, 13 Feb 2016)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -902,7 +902,9 @@ std::string CControlAPI::_GetBouquetActualEPGItem(CyhookHandler *hh, CZapitChann
|
|||||||
|
|
||||||
CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo;
|
CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo;
|
||||||
CChannelEvent *event;
|
CChannelEvent *event;
|
||||||
|
NeutrinoAPI->mutex.lock();
|
||||||
event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()];
|
event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()];
|
||||||
|
NeutrinoAPI->mutex.unlock();
|
||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
int percentage = 100;
|
int percentage = 100;
|
||||||
@@ -966,7 +968,9 @@ std::string CControlAPI::_GetBouquetWriteItem(CyhookHandler *hh, CZapitChannel *
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CChannelEvent *event;
|
CChannelEvent *event;
|
||||||
|
NeutrinoAPI->mutex.lock();
|
||||||
event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()];
|
event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()];
|
||||||
|
NeutrinoAPI->mutex.unlock();
|
||||||
|
|
||||||
if (event && isEPGdetails) {
|
if (event && isEPGdetails) {
|
||||||
result += string_printf("%u "
|
result += string_printf("%u "
|
||||||
@@ -1599,7 +1603,9 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) {
|
|||||||
CBouquetManager::ChannelIterator cit = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin() : g_bouquetManager->tvChannelsBegin();
|
CBouquetManager::ChannelIterator cit = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin() : g_bouquetManager->tvChannelsBegin();
|
||||||
for (; !(cit.EndOfChannels()); cit++) {
|
for (; !(cit.EndOfChannels()); cit++) {
|
||||||
CZapitChannel * channel = *cit;
|
CZapitChannel * channel = *cit;
|
||||||
|
NeutrinoAPI->mutex.lock();
|
||||||
event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()];
|
event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()];
|
||||||
|
NeutrinoAPI->mutex.unlock();
|
||||||
if (event) {
|
if (event) {
|
||||||
if (!isExt) {
|
if (!isExt) {
|
||||||
hh->printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
|
hh->printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
|
||||||
|
@@ -41,6 +41,7 @@
|
|||||||
#include <zapit/bouquets.h>
|
#include <zapit/bouquets.h>
|
||||||
#include <zapit/getservices.h>
|
#include <zapit/getservices.h>
|
||||||
#include <eitd/sectionsd.h>
|
#include <eitd/sectionsd.h>
|
||||||
|
#include <OpenThreads/ScopedLock>
|
||||||
|
|
||||||
extern CBouquetManager *g_bouquetManager;
|
extern CBouquetManager *g_bouquetManager;
|
||||||
extern CFrontend * frontend;
|
extern CFrontend * frontend;
|
||||||
@@ -171,6 +172,7 @@ void CNeutrinoAPI::UpdateBouquets(void)
|
|||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
void CNeutrinoAPI::ZapTo(const char * const target)
|
void CNeutrinoAPI::ZapTo(const char * const target)
|
||||||
{
|
{
|
||||||
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||||
t_channel_id channel_id;
|
t_channel_id channel_id;
|
||||||
|
|
||||||
sscanf(target,
|
sscanf(target,
|
||||||
@@ -182,6 +184,7 @@ void CNeutrinoAPI::ZapTo(const char * const target)
|
|||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
void CNeutrinoAPI::ZapToChannelId(t_channel_id channel_id)
|
void CNeutrinoAPI::ZapToChannelId(t_channel_id channel_id)
|
||||||
{
|
{
|
||||||
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||||
if (channel_id == Zapit->getCurrentServiceID())
|
if (channel_id == Zapit->getCurrentServiceID())
|
||||||
{
|
{
|
||||||
//printf("Kanal ist aktuell\n");
|
//printf("Kanal ist aktuell\n");
|
||||||
@@ -195,6 +198,7 @@ void CNeutrinoAPI::ZapToChannelId(t_channel_id channel_id)
|
|||||||
|
|
||||||
void CNeutrinoAPI::ZapToSubService(const char * const target)
|
void CNeutrinoAPI::ZapToSubService(const char * const target)
|
||||||
{
|
{
|
||||||
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||||
t_channel_id channel_id;
|
t_channel_id channel_id;
|
||||||
|
|
||||||
sscanf(target,
|
sscanf(target,
|
||||||
@@ -207,6 +211,7 @@ void CNeutrinoAPI::ZapToSubService(const char * const target)
|
|||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
t_channel_id CNeutrinoAPI::ChannelNameToChannelId(std::string search_channel_name)
|
t_channel_id CNeutrinoAPI::ChannelNameToChannelId(std::string search_channel_name)
|
||||||
{
|
{
|
||||||
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||||
//FIXME depending on mode missing
|
//FIXME depending on mode missing
|
||||||
//int mode = Zapit->getMode();
|
//int mode = Zapit->getMode();
|
||||||
t_channel_id channel_id = (t_channel_id)-1;
|
t_channel_id channel_id = (t_channel_id)-1;
|
||||||
@@ -264,6 +269,7 @@ bool CNeutrinoAPI::GetStreamInfo(int bitInfo[10])
|
|||||||
|
|
||||||
bool CNeutrinoAPI::GetChannelEvents(void)
|
bool CNeutrinoAPI::GetChannelEvents(void)
|
||||||
{
|
{
|
||||||
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||||
eList.clear();
|
eList.clear();
|
||||||
CEitManager::getInstance()->getChannelEvents(eList);
|
CEitManager::getInstance()->getChannelEvents(eList);
|
||||||
CChannelEventList::iterator eventIterator;
|
CChannelEventList::iterator eventIterator;
|
||||||
@@ -283,6 +289,7 @@ bool CNeutrinoAPI::GetChannelEvents(void)
|
|||||||
|
|
||||||
std::string CNeutrinoAPI::GetServiceName(t_channel_id channel_id)
|
std::string CNeutrinoAPI::GetServiceName(t_channel_id channel_id)
|
||||||
{
|
{
|
||||||
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||||
return CServiceManager::getInstance()->GetServiceName(channel_id);
|
return CServiceManager::getInstance()->GetServiceName(channel_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,7 +417,8 @@ std::string CNeutrinoAPI::timerEventRepeat2Str(CTimerd::CTimerEventRepeat rep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
std::string CNeutrinoAPI::getVideoAspectRatioAsString(void) {
|
std::string CNeutrinoAPI::getVideoAspectRatioAsString(void)
|
||||||
|
{
|
||||||
int aspectRatio = videoDecoder->getAspectRatio();
|
int aspectRatio = videoDecoder->getAspectRatio();
|
||||||
if (aspectRatio >= 0 && aspectRatio <= 4)
|
if (aspectRatio >= 0 && aspectRatio <= 4)
|
||||||
return videoformat_names[aspectRatio];
|
return videoformat_names[aspectRatio];
|
||||||
@@ -418,7 +426,9 @@ std::string CNeutrinoAPI::getVideoAspectRatioAsString(void) {
|
|||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
int CNeutrinoAPI::setVideoAspectRatioAsString(std::string newRatioString) {
|
int CNeutrinoAPI::setVideoAspectRatioAsString(std::string newRatioString)
|
||||||
|
{
|
||||||
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||||
int newRatioInt = -1;
|
int newRatioInt = -1;
|
||||||
for(int i=0;i<(int)sizeof(videoformat_names);i++)
|
for(int i=0;i<(int)sizeof(videoformat_names);i++)
|
||||||
if( videoformat_names[i] == newRatioString){
|
if( videoformat_names[i] == newRatioString){
|
||||||
@@ -430,7 +440,8 @@ int CNeutrinoAPI::setVideoAspectRatioAsString(std::string newRatioString) {
|
|||||||
return newRatioInt;
|
return newRatioInt;
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
std::string CNeutrinoAPI::getVideoResolutionAsString(void) {
|
std::string CNeutrinoAPI::getVideoResolutionAsString(void)
|
||||||
|
{
|
||||||
int xres, yres, framerate;
|
int xres, yres, framerate;
|
||||||
videoDecoder->getPictureInfo(xres, yres, framerate);
|
videoDecoder->getPictureInfo(xres, yres, framerate);
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
@@ -439,7 +450,8 @@ std::string CNeutrinoAPI::getVideoResolutionAsString(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
std::string CNeutrinoAPI::getVideoFramerateAsString(void) {
|
std::string CNeutrinoAPI::getVideoFramerateAsString(void)
|
||||||
|
{
|
||||||
int xres, yres, framerate;
|
int xres, yres, framerate;
|
||||||
std::string sframerate="unknown";
|
std::string sframerate="unknown";
|
||||||
videoDecoder->getPictureInfo(xres, yres, framerate);
|
videoDecoder->getPictureInfo(xres, yres, framerate);
|
||||||
@@ -453,7 +465,8 @@ std::string CNeutrinoAPI::getVideoFramerateAsString(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
std::string CNeutrinoAPI::getAudioInfoAsString(void) {
|
std::string CNeutrinoAPI::getAudioInfoAsString(void)
|
||||||
|
{
|
||||||
int type, layer, freq, mode, lbitrate;
|
int type, layer, freq, mode, lbitrate;
|
||||||
audioDecoder->getAudioInfo(type, layer, freq, lbitrate, mode);
|
audioDecoder->getAudioInfo(type, layer, freq, lbitrate, mode);
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
@@ -465,11 +478,13 @@ std::string CNeutrinoAPI::getAudioInfoAsString(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
std::string CNeutrinoAPI::getCryptInfoAsString(void) {
|
std::string CNeutrinoAPI::getCryptInfoAsString(void)
|
||||||
|
{
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
std::string casys[11]= {"Irdeto:","Betacrypt:","Seca:","Viaccess:","Nagra:","Conax: ","Cryptoworks:","Videoguard:","EBU:","XCrypt:","PowerVU:"};
|
std::string casys[11]= {"Irdeto:","Betacrypt:","Seca:","Viaccess:","Nagra:","Conax: ","Cryptoworks:","Videoguard:","EBU:","XCrypt:","PowerVU:"};
|
||||||
int caids[] = { 0x600, 0x1700, 0x0100, 0x0500, 0x1800, 0xB00, 0xD00, 0x900, 0x2600, 0x4a00, 0x0E00 };
|
int caids[] = { 0x600, 0x1700, 0x0100, 0x0500, 0x1800, 0xB00, 0xD00, 0x900, 0x2600, 0x4a00, 0x0E00 };
|
||||||
|
|
||||||
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||||
CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel();
|
CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel();
|
||||||
if(channel) {
|
if(channel) {
|
||||||
for (unsigned short i = 0; i < 11; i++) {
|
for (unsigned short i = 0; i < 11; i++) {
|
||||||
@@ -485,7 +500,8 @@ std::string CNeutrinoAPI::getCryptInfoAsString(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
std::string CNeutrinoAPI::getLogoFile(std::string _logoURL, t_channel_id channelId) {
|
std::string CNeutrinoAPI::getLogoFile(std::string _logoURL, t_channel_id channelId)
|
||||||
|
{
|
||||||
std::string channelIdAsString = string_printf( PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS , channelId & 0xFFFFFFFFFFFFULL);
|
std::string channelIdAsString = string_printf( PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS , channelId & 0xFFFFFFFFFFFFULL);
|
||||||
std::string channelName = GetServiceName(channelId);
|
std::string channelName = GetServiceName(channelId);
|
||||||
// replace(channelName, " ", "_");
|
// replace(channelName, " ", "_");
|
||||||
@@ -505,4 +521,3 @@ std::string CNeutrinoAPI::getLogoFile(std::string _logoURL, t_channel_id channel
|
|||||||
else
|
else
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
#include <helper.h>
|
#include <helper.h>
|
||||||
#include "neutrinoyparser.h"
|
#include "neutrinoyparser.h"
|
||||||
#include "controlapi.h"
|
#include "controlapi.h"
|
||||||
|
#include <OpenThreads/ScopedLock>
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// No Class Helpers
|
// No Class Helpers
|
||||||
@@ -24,6 +25,7 @@ bool _initialize_iso639_map(void);
|
|||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
class CNeutrinoAPI
|
class CNeutrinoAPI
|
||||||
{
|
{
|
||||||
|
OpenThreads::Mutex mutex;
|
||||||
// Clientlibs
|
// Clientlibs
|
||||||
CSectionsdClient *Sectionsd;
|
CSectionsdClient *Sectionsd;
|
||||||
CZapitClient *Zapit;
|
CZapitClient *Zapit;
|
||||||
|
@@ -359,7 +359,9 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
|
|||||||
{
|
{
|
||||||
CZapitChannel * channel = channels[j];
|
CZapitChannel * channel = channels[j];
|
||||||
CChannelEvent *event;
|
CChannelEvent *event;
|
||||||
|
NeutrinoAPI->mutex.lock();
|
||||||
event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()];
|
event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()];
|
||||||
|
NeutrinoAPI->mutex.unlock();
|
||||||
|
|
||||||
classname = (i++ & 1) ? 'a' : 'b';
|
classname = (i++ & 1) ? 'a' : 'b';
|
||||||
if (channel->getChannelID() == current_channel)
|
if (channel->getChannelID() == current_channel)
|
||||||
@@ -439,7 +441,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
|
|||||||
(channel->getServiceType() == ST_NVOD_REFERENCE_SERVICE) ? " (NVOD)" : "",
|
(channel->getServiceType() == ST_NVOD_REFERENCE_SERVICE) ? " (NVOD)" : "",
|
||||||
channel->getChannelID(),
|
channel->getChannelID(),
|
||||||
channel->getChannelID() & 0xFFFFFFFFFFFFULL,
|
channel->getChannelID() & 0xFFFFFFFFFFFFULL,
|
||||||
((NeutrinoAPI->ChannelListEvents[channel->getChannelID()]) ? "<img src=\"/images/elist.png\" alt=\"Program preview\" style=\"border: 0px\" />" : ""));
|
(event ? "<img src=\"/images/elist.png\" alt=\"Program preview\" style=\"border: 0px\" />" : ""));
|
||||||
|
|
||||||
if (channel->getChannelID() == current_channel)
|
if (channel->getChannelID() == current_channel)
|
||||||
yresult += string_printf("\n <a href=\"javascript:do_streaminfo()\"><img src=\"/images/streaminfo.png\" alt=\"Streaminfo\" style=\"border: 0px\" /></a>");
|
yresult += string_printf("\n <a href=\"javascript:do_streaminfo()\"><img src=\"/images/streaminfo.png\" alt=\"Streaminfo\" style=\"border: 0px\" /></a>");
|
||||||
@@ -489,7 +491,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ((event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()]))
|
else if (event)
|
||||||
{
|
{
|
||||||
bool has_current_next = true;
|
bool has_current_next = true;
|
||||||
CEitManager::getInstance()->getCurrentNextServiceKey(channel->getChannelID(), currentNextInfo);
|
CEitManager::getInstance()->getCurrentNextServiceKey(channel->getChannelID(), currentNextInfo);
|
||||||
|
@@ -62,7 +62,7 @@
|
|||||||
//#define Y_CONFIG_FEATURE_CHROOT y // Add Feature: Use Change Root for Security
|
//#define Y_CONFIG_FEATURE_CHROOT y // Add Feature: Use Change Root for Security
|
||||||
//#define Y_CONFIG_FEATURE_HTTPD_USER y // Add Feature: Set User for yhttpd-Process
|
//#define Y_CONFIG_FEATURE_HTTPD_USER y // Add Feature: Set User for yhttpd-Process
|
||||||
#define Y_CONFIG_BUILD_AS_DAEMON y // Build as a Daemon
|
#define Y_CONFIG_BUILD_AS_DAEMON y // Build as a Daemon
|
||||||
//#define Y_CONFIG_FEATURE_THREADING y // Build with possibility for multi threading
|
#define Y_CONFIG_FEATURE_THREADING y // Build with possibility for multi threading
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Define/Undefine Features forced by CONFIG_SYSTEM_xxx
|
// Define/Undefine Features forced by CONFIG_SYSTEM_xxx
|
||||||
// Dependencies
|
// Dependencies
|
||||||
|
Reference in New Issue
Block a user