Exemplo n.º 1
0
stream2file_error_msg_t stop_recording(void)
{
	if (exit_flag == STREAM2FILE_STATUS_RUNNING)
	{
		CMovieInfo mi;
		MI_MOVIE_INFO movieinfo; 
		mi.clearMovieInfo(&movieinfo);

		time(&record_end_time);
		printf("record time: %lu \n",record_end_time-record_start_time);
		//load MovieInfo and set record time
		movieinfo.file.Name = myfilename;
		movieinfo.file.Name += ".ts";
		mi.loadMovieInfo(&movieinfo);
		movieinfo.rec_length += record_end_time - record_start_time;
		mi.saveMovieInfo(movieinfo);

		/* reset record_start_time, so that we know the recording was not
		   aborted abnormally */
		record_start_time = 0;
		exit_flag = STREAM2FILE_STATUS_IDLE;
		return STREAM2FILE_OK;
	}
	else
	{
		record_start_time = 0;
		return STREAM2FILE_RECORDING_THREADS_FAILED;
	}
}
Exemplo n.º 2
0
std::string CVCRControl::CFileAndServerDevice::getMovieInfoString(const t_channel_id channel_id,
								  const event_id_t epgid, const time_t epg_time)
{
	std::string extMessage;
	CMovieInfo cMovieInfo;
	MI_MOVIE_INFO movieInfo;
	std::string info1, info2;

	cMovieInfo.clearMovieInfo(&movieInfo);
	CZapitClient::responseGetPIDs pids;
	g_Zapit->getPIDS (pids);
	CZapitClient::CCurrentServiceInfo si = g_Zapit->getCurrentServiceInfo ();

	std::string tmpstring = g_Zapit->getChannelName(channel_id);
	if (tmpstring.empty())
		movieInfo.epgChannel = "unknown";
	else
		movieInfo.epgChannel = ZapitTools::UTF8_to_UTF8XML(tmpstring.c_str());

	tmpstring = "not available";
	if (epgid != 0)
	{
//#define SHORT_EPG
#ifdef SHORT_EPG
		CSectionsdClient sdc;
		CShortEPGData epgdata;
		
		if (sdc.getEPGidShort(epgid, &epgdata))
		{
#warning fixme sectionsd should deliver data in UTF-8 format
			tmpstring = Latin1_to_UTF8(epgdata.title);
			info1 = Latin1_to_UTF8(epgdata.info1);
			info2 = Latin1_to_UTF8(epgdata.info2);
		}
#else
		CSectionsdClient sdc;
		CEPGData epgdata;
		if (sdc.getEPGid(epgid, epg_time,&epgdata))
		{
#warning fixme sectionsd should deliver data in UTF-8 format
			tmpstring = Latin1_to_UTF8(epgdata.title);
			info1 = Latin1_to_UTF8(epgdata.info1);
			info2 = Latin1_to_UTF8(epgdata.info2);
			
			movieInfo.parentalLockAge = epgdata.fsk;
			if(epgdata.contentClassification.size() > 0 )
				movieInfo.genreMajor = epgdata.contentClassification[0];
				
			movieInfo.length = epgdata.epg_times.dauer	/ 60;
				
			printf("fsk:%d, Genre:%d, Dauer: %d\r\n",movieInfo.parentalLockAge,movieInfo.genreMajor,movieInfo.length);	
		}
#endif
	}
	movieInfo.epgTitle = 	ZapitTools::UTF8_to_UTF8XML(tmpstring.c_str());
	movieInfo.epgId = 		channel_id;
	movieInfo.epgInfo1 = 	ZapitTools::UTF8_to_UTF8XML(info1.c_str());
	movieInfo.epgInfo2 = 	ZapitTools::UTF8_to_UTF8XML(info2.c_str());
	movieInfo.epgEpgId =  	epgid ;
	movieInfo.epgMode = 	g_Zapit->getMode();
	movieInfo.epgVideoPid = si.vpid;

	EPG_AUDIO_PIDS audio_pids;
	// super hack :-), der einfachste weg an die apid descriptions ranzukommen
	g_RemoteControl->current_PIDs = pids;
	g_RemoteControl->processAPIDnames();

	for(unsigned int i= 0; i< pids.APIDs.size(); i++)
	{
		audio_pids.epgAudioPid = pids.APIDs[i].pid;
		audio_pids.epgAudioPidName = ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc);
		movieInfo.audioPids.push_back(audio_pids);
	}
	movieInfo.epgVTXPID = si.vtxtpid;

	cMovieInfo.encodeMovieInfoXml(&extMessage,movieInfo);
	
	movieInfo.audioPids.clear();

	return extMessage;
}
Exemplo n.º 3
0
std::string CVCRControl::CFileAndServerDevice::getMovieInfoString(const t_channel_id channel_id,
								  const event_id_t epgid, const time_t epg_time,
								  const std::string& epgTitle, unsigned char apids,
								  const bool save_vtxt_pid, const bool save_sub_pids)
{
	std::string extMessage;
	CMovieInfo cMovieInfo;
	MI_MOVIE_INFO movieInfo;
	std::string info1, info2;
	event_id_t epg_id = epgid;

	cMovieInfo.clearMovieInfo(&movieInfo);
	CZapitClient::responseGetPIDs pids;
	g_Zapit->getPIDS (pids);
	CZapitClient::CCurrentServiceInfo si = g_Zapit->getCurrentServiceInfo ();

	std::string tmpstring = g_Zapit->getChannelName(channel_id);
	if (tmpstring.empty())
		movieInfo.epgChannel = "unknown";
	else
		movieInfo.epgChannel = tmpstring;

	tmpstring = (epgTitle.empty()) ? "not available" : Latin1_to_UTF8(epgTitle);
	if (epg_id != 0)
	{
//#define SHORT_EPG
#ifdef SHORT_EPG
		CShortEPGData epgdata;
		if (g_Sectionsd->getEPGidShort(epg_id, &epgdata))
		{
#warning fixme sectionsd should deliver data in UTF-8 format
			tmpstring = Latin1_to_UTF8(epgdata.title);
			info1 = Latin1_to_UTF8(epgdata.info1);
			info2 = Latin1_to_UTF8(epgdata.info2);
		}
#else
		CEPGData epgdata;
		bool has_epgdata = g_Sectionsd->getEPGid(epg_id, epg_time, &epgdata);
		if (!has_epgdata)
		{
			has_epgdata = g_Sectionsd->getActualEPGServiceKey(channel_id, &epgdata);
			if (has_epgdata && !epgTitle.empty() && epgTitle != epgdata.title)
				has_epgdata = false;
			if (has_epgdata)
				epg_id = epgdata.eventID;
		}
		if (has_epgdata)
		{
#warning fixme sectionsd should deliver data in UTF-8 format
			tmpstring = Latin1_to_UTF8(epgdata.title);
			info1 = Latin1_to_UTF8(epgdata.info1);
			info2 = Latin1_to_UTF8(epgdata.info2);
			
			movieInfo.parentalLockAge = epgdata.fsk;
			if (!epgdata.contentClassification.empty())
				movieInfo.genreMajor = epgdata.contentClassification[0];
				
			movieInfo.length = epgdata.epg_times.dauer	/ 60;
				
			printf("fsk:%d, Genre:%d, Dauer: %d\r\n",movieInfo.parentalLockAge,movieInfo.genreMajor,movieInfo.length);	
		}
#endif
	}
	movieInfo.epgTitle = 	tmpstring;
	movieInfo.epgId = 		channel_id;
	movieInfo.epgInfo1 = 	info1;
	movieInfo.epgInfo2 = 	info2;
	movieInfo.epgEpgId =  	epg_id;
	movieInfo.epgMode = 	g_Zapit->getMode();
	movieInfo.epgVideoPid = si.vpid;

	EPG_AUDIO_PIDS audio_pids;
	// super hack :-), der einfachste weg an die apid descriptions ranzukommen
	g_RemoteControl->current_EPGid = epg_id;
	g_RemoteControl->current_PIDs = pids;
	g_RemoteControl->processAPIDnames();
	APIDList apid_list;
	getAPIDs(apids,apid_list);
	for(APIDList::iterator it = apid_list.begin(); it != apid_list.end(); ++it)
	{
		audio_pids.epgAudioPid = it->apid;
		audio_pids.epgAudioPidName = g_RemoteControl->current_PIDs.APIDs[it->index].desc;
		movieInfo.audioPids.push_back(audio_pids);
	}

	if (save_vtxt_pid)
		movieInfo.epgVTXPID = si.vtxtpid;

	if (save_sub_pids)
	{
		SUB_PIDS sub_pids;
		for (unsigned int i = 0; i < pids.SubPIDs.size(); i++)
		{
			sub_pids.subPid = pids.SubPIDs[i].pid;
			sub_pids.subPage = pids.SubPIDs[i].composition_page;
			sub_pids.subName = getISO639Description(pids.SubPIDs[i].desc);
			movieInfo.subPids.push_back(sub_pids);
		}
	}

	cMovieInfo.encodeMovieInfoXml(&extMessage,movieInfo);

	return extMessage;
}