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;
	}
}