mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
zapit/src/zapit.cpp: simplify
This commit is contained in:
@@ -2025,16 +2025,11 @@ void CZapit::sendChannels(int connfd, const CZapitClient::channelsMode mode, con
|
|||||||
|
|
||||||
bool CZapit::StartPlayBack(CZapitChannel *thisChannel)
|
bool CZapit::StartPlayBack(CZapitChannel *thisChannel)
|
||||||
{
|
{
|
||||||
bool have_pcr = false;
|
|
||||||
bool have_audio = false;
|
|
||||||
bool have_video = false;
|
|
||||||
bool have_teletext = false;
|
|
||||||
|
|
||||||
INFO("standby %d playing %d forced %d", standby, playing, playbackStopForced);
|
INFO("standby %d playing %d forced %d", standby, playing, playbackStopForced);
|
||||||
if(!thisChannel)
|
if(!thisChannel)
|
||||||
thisChannel = current_channel;
|
thisChannel = current_channel;
|
||||||
|
|
||||||
if ((playbackStopForced == true) || (!thisChannel) || playing)
|
if (playbackStopForced || !thisChannel || playing)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(standby) {
|
if(standby) {
|
||||||
@@ -2042,65 +2037,58 @@ bool CZapit::StartPlayBack(CZapitChannel *thisChannel)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("[zapit] vpid %X apid %X pcr %X\n", thisChannel->getVideoPid(), thisChannel->getAudioPid(), thisChannel->getPcrPid());
|
unsigned short pcr_pid = thisChannel->getPcrPid();
|
||||||
if (thisChannel->getPcrPid() != 0)
|
unsigned short audio_pid = thisChannel->getAudioPid();
|
||||||
have_pcr = true;
|
unsigned short video_pid = (currentMode & TV_MODE) ? thisChannel->getVideoPid() : 0;
|
||||||
if (thisChannel->getAudioPid() != 0)
|
unsigned short teletext_pid = thisChannel->getTeletextPid();
|
||||||
have_audio = true;
|
printf("[zapit] vpid %X apid %X pcr %X\n", video_pid, audio_pid, pcr_pid);
|
||||||
if ((thisChannel->getVideoPid() != 0) && (currentMode & TV_MODE))
|
|
||||||
have_video = true;
|
|
||||||
if (thisChannel->getTeletextPid() != 0)
|
|
||||||
have_teletext = true;
|
|
||||||
|
|
||||||
if ((!have_audio) && (!have_video) && (!have_teletext))
|
if (!audio_pid && !video_pid && !teletext_pid)
|
||||||
return false;
|
return false;
|
||||||
#if 1
|
#if 1
|
||||||
if(have_video && (thisChannel->getPcrPid() == 0x1FFF)) { //FIXME
|
if(video_pid && (pcr_pid == 0x1FFF)) { //FIXME
|
||||||
thisChannel->setPcrPid(thisChannel->getVideoPid());
|
thisChannel->setPcrPid(video_pid);
|
||||||
have_pcr = true;
|
pcr_pid = video_pid;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* set demux filters */
|
/* set demux filters */
|
||||||
videoDecoder->SetStreamType((VIDEO_FORMAT)thisChannel->type);
|
videoDecoder->SetStreamType((VIDEO_FORMAT)thisChannel->type);
|
||||||
// videoDecoder->SetSync(VIDEO_PLAY_MOTION);
|
// videoDecoder->SetSync(VIDEO_PLAY_MOTION);
|
||||||
|
|
||||||
if (have_pcr) {
|
if (pcr_pid)
|
||||||
pcrDemux->pesFilter(thisChannel->getPcrPid());
|
pcrDemux->pesFilter(pcr_pid);
|
||||||
}
|
if (audio_pid)
|
||||||
if (have_audio) {
|
audioDemux->pesFilter(audio_pid);
|
||||||
audioDemux->pesFilter(thisChannel->getAudioPid());
|
if (video_pid)
|
||||||
}
|
videoDemux->pesFilter(video_pid);
|
||||||
if (have_video) {
|
|
||||||
videoDemux->pesFilter(thisChannel->getVideoPid());
|
|
||||||
}
|
|
||||||
// audioDecoder->SetSyncMode(AVSYNC_ENABLED);
|
// audioDecoder->SetSyncMode(AVSYNC_ENABLED);
|
||||||
|
|
||||||
#if 0 //FIXME hack ?
|
#if 0 //FIXME hack ?
|
||||||
if(thisChannel->getServiceType() == ST_DIGITAL_RADIO_SOUND_SERVICE) {
|
if(thisChannel->getServiceType() == ST_DIGITAL_RADIO_SOUND_SERVICE) {
|
||||||
audioDecoder->SetSyncMode(AVSYNC_AUDIO_IS_MASTER);
|
audioDecoder->SetSyncMode(AVSYNC_AUDIO_IS_MASTER);
|
||||||
have_pcr = false;
|
pcr_pid = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (have_pcr) {
|
if (pcr_pid) {
|
||||||
printf("[zapit] starting PCR 0x%X\n", thisChannel->getPcrPid());
|
//printf("[zapit] starting PCR 0x%X\n", thisChannel->getPcrPid());
|
||||||
pcrDemux->Start();
|
pcrDemux->Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* select audio output and start audio */
|
/* select audio output and start audio */
|
||||||
if (have_audio) {
|
if (audio_pid) {
|
||||||
SetAudioStreamType(thisChannel->getAudioChannel()->audioChannelType);
|
SetAudioStreamType(thisChannel->getAudioChannel()->audioChannelType);
|
||||||
audioDemux->Start();
|
audioDemux->Start();
|
||||||
audioDecoder->Start();
|
audioDecoder->Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* start video */
|
/* start video */
|
||||||
if (have_video) {
|
if (video_pid) {
|
||||||
videoDecoder->Start(0, thisChannel->getPcrPid(), thisChannel->getVideoPid());
|
videoDecoder->Start(0, pcr_pid, video_pid);
|
||||||
videoDemux->Start();
|
videoDemux->Start();
|
||||||
}
|
}
|
||||||
#ifdef USE_VBI
|
#ifdef USE_VBI
|
||||||
if(have_teletext)
|
if(teletext_pid)
|
||||||
videoDecoder->StartVBI(thisChannel->getTeletextPid());
|
videoDecoder->StartVBI(teletext_pid);
|
||||||
#endif
|
#endif
|
||||||
playing = true;
|
playing = true;
|
||||||
|
|
||||||
@@ -2236,7 +2224,6 @@ unsigned CZapit::ZapTo(const unsigned int pchannel)
|
|||||||
CBouquetManager::ChannelIterator cit = ((currentMode & RADIO_MODE) ? g_bouquetManager->radioChannelsBegin() : g_bouquetManager->tvChannelsBegin()).FindChannelNr(pchannel);
|
CBouquetManager::ChannelIterator cit = ((currentMode & RADIO_MODE) ? g_bouquetManager->radioChannelsBegin() : g_bouquetManager->tvChannelsBegin()).FindChannelNr(pchannel);
|
||||||
if (!(cit.EndOfChannels()))
|
if (!(cit.EndOfChannels()))
|
||||||
return ZapTo((*cit)->getChannelID(), false);
|
return ZapTo((*cit)->getChannelID(), false);
|
||||||
else
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user