Exemplo n.º 1
0
bool CSectionsdClient::getLinkageDescriptorsUniqueKey(const event_id_t uniqueKey, CSectionsdClient::LinkageDescriptorList& descriptors)
{
	if (send(sectionsd::LinkageDescriptorsUniqueKey, (char*)&uniqueKey, sizeof(uniqueKey)))
	{
		descriptors.clear();

		int nBufSize = readResponse();

		char* pData = new char[nBufSize];
		if (!receive_data(pData, nBufSize))
		{
			/* receive_data might have timed out etc. */
			delete[] pData;
			close_connection();
			return false;
		}
		char* dp = pData;

		int count= *(int *) pData;
		dp+= sizeof(int);

		CSectionsdClient::responseGetLinkageDescriptors response;
		for (int i= 0; i<count; i++)
		{
			response.name = dp;
			dp+= strlen(dp)+1;
			response.transportStreamId = *(t_transport_stream_id *) dp;
			dp+=sizeof(t_transport_stream_id);
			response.originalNetworkId = *(t_original_network_id *) dp;
			dp+=sizeof(t_original_network_id);
			response.serviceId = *(t_service_id *) dp;
			dp+=sizeof(t_service_id);

			descriptors.insert( descriptors.end(), response);
		}
		delete[] pData;
		close_connection();
		return true;
	}
	else
	{
		close_connection();
		return false;
	}
}
Exemplo n.º 2
0
bool CSectionsdClient::getLinkageDescriptorsUniqueKey(const unsigned long long uniqueKey, CSectionsdClient::LinkageDescriptorList& descriptors)
{
	if (send(sectionsd::LinkageDescriptorsUniqueKey, (char*)&uniqueKey, sizeof(uniqueKey)))
	{
		descriptors.clear();

		int nBufSize = readResponse();

		char* pData = new char[nBufSize];
		receive_data(pData, nBufSize);
		char* dp = pData;

		int	count= *(int *) pData;
		dp+= sizeof(int);

		CSectionsdClient::responseGetLinkageDescriptors response;
		for (int i= 0; i<count; i++)
		{
			response.name = dp;
			dp+= strlen(dp)+1;
			response.transportStreamId = *(unsigned short *) dp;
			dp+=sizeof(unsigned short);
			response.originalNetworkId = *(unsigned short *) dp;
			dp+=sizeof(unsigned short);
			response.serviceId = *(unsigned short *) dp;
			dp+=sizeof(unsigned short);

			descriptors.insert( descriptors.end(), response);
		}
		close_connection();
		return true;
	}
	else
	{
		close_connection();
		return false;
	}
}
Exemplo n.º 3
0
void EventList::readEvents(const t_channel_id channel_id)
{
	evtlist.clear();
	sectionsd_getEventsServiceKey(channel_id &0xFFFFFFFFFFFFULL, evtlist);
	time_t azeit = time(NULL);

	CChannelEventList::iterator e;
	
	if ( evtlist.size() != 0 ) 
	{
		CEPGData epgData;
		
		// todo: what if there are more than one events in the Portal
		if (sectionsd_getActualEPGServiceKey(channel_id&0xFFFFFFFFFFFFULL, &epgData))
		{
			CSectionsdClient::LinkageDescriptorList	linkedServices;

			if ( sectionsd_getLinkageDescriptorsUniqueKey( epgData.eventID, linkedServices ) )
			{
				if ( linkedServices.size() > 1 )
				{
					CChannelEventList evtlist2; // stores the temporary eventlist of the subchannel channelid
					t_channel_id channel_id2;
				
					for (unsigned int i = 0; i < linkedServices.size(); i++)
					{
						channel_id2 = CREATE_CHANNEL_ID_FROM_SERVICE_ORIGINALNETWORK_TRANSPORTSTREAM_ID(
								linkedServices[i].serviceId,
								linkedServices[i].originalNetworkId,
								linkedServices[i].transportStreamId);
							
						// do not add parent events
						if (channel_id != channel_id2) 
						{
							evtlist2.clear();
							sectionsd_getEventsServiceKey(channel_id2 &0xFFFFFFFFFFFFULL, evtlist2);

							for (unsigned int loop = 0 ; loop < evtlist2.size(); loop++ )
							{
								//FIXME: bad ?evtlist2[loop].sub = true;
								evtlist.push_back(evtlist2[loop]);
							}
							evtlist2.clear();
						}
					}
				}
			}
		}
		
		// Houdini added for Private Premiere EPG, start sorted by start date/time
		sort(evtlist.begin(), evtlist.end(), sortByDateTime);
		
  		// Houdini: dirty workaround for RTL double events, remove them
  		CChannelEventList::iterator e2;
  		for ( e = evtlist.begin(); e != evtlist.end(); ++e )
  		{
  			e2 = e + 1;
  			if ( e2 != evtlist.end() && (e->startTime == e2->startTime)) 
			{
  				evtlist.erase(e2);
  			}
  		}
		timerlist.clear();
		g_Timerd->getTimerList(timerlist);

	}
	
	current_event = (unsigned int) - 1;
	for ( e = evtlist.begin(); e != evtlist.end(); ++e )
	{
		if ( e->startTime > azeit ) 
		{
			break;
		}
		current_event++;
	}

	if ( evtlist.size() == 0 )
	{
		CChannelEvent evt;

		evt.description = g_Locale->getText(LOCALE_EPGLIST_NOEVENTS);
		evt.eventID = 0;
		evtlist.push_back(evt);

	}
	
	if (current_event == (unsigned int) - 1)
		current_event = 0;
	selected = current_event;

	return;
}