h264 = false;
fps = 25.0;
astreamtype=4;
+ livetv=false;
}
Demuxer::~Demuxer()
h264 = false;
packetnum=0;
astreamtype=4;
+ livetv=false;
for (int i = 0; i <= (PESTYPE_AUDMAX - PESTYPE_AUD0); i++)
{
avail_ac3audchan[packet.getSubstream() - PESTYPE_SUBSTREAM_AC30] = true;
if (packet.getSubstream() == audio_current)
{
- sent = audiostream.put(&packetdata[0], packet.getSize(), (ispre_1_3_19)? MPTYPE_AC3_PRE13 : MPTYPE_AC3,packetnum);
+ sent = audiostream.put(&packetdata[0], packet.getSize(), (ispre_1_3_19 || livetv)? MPTYPE_AC3_PRE13 : MPTYPE_AC3,packetnum);
if (sent) packetnum++;
}
else
}
else if (packet.getPacketType() == PESTYPE_PRIVATE_1) // Private stream
{
- //Inspired by vdr's device.c
- int payload_begin = packet[8]+9;
- unsigned char substream_id = packet[payload_begin];
- unsigned char substream_type = substream_id & 0xF0;
- unsigned char substream_index = substream_id & 0x1F;
-pre_1_3_19_Recording: //This is for old recordings stuff and live TV
- if (ispre_1_3_19)
- {
- int old_substream=packet.getSubstream();
- if (old_substream){ //someone else already set it, this is live tv
- substream_id = old_substream;
- substream_type = substream_id & 0xF0;
- substream_index = substream_id & 0x1F;
- } else {
- substream_id = PESTYPE_PRIVATE_1;
- substream_type = 0x80;
- substream_index = 0;
- }
-
- }
- switch (substream_type)
- {
- case 0x20://SPU
- case 0x30://SPU
- packet.setSubstream(substream_id);
- break;
- case 0xA0: //LPCM //not supported yet, is there any LPCM transmissio out there?
- break;
- case 0x80: //ac3, currently only one ac3 track per recording supported
- packet.setSubstream(substream_type+substream_index);
-
- // Extract audio PTS if it exists
- if (packet.hasPTS())
- {
- audio_pts = packet.getPTS();
- // We continue to seek on the audio if the video PTS that we
- // are trying to match is ahead of the audio PTS by at most
- // SEEK_THRESHOLD. We consider the possibility of PTS wrap.
- if (aud_seeking && !vid_seeking &&
- !( (video_pts_seek > audio_pts &&
- video_pts_seek - audio_pts < SEEK_THRESHOLD)
- ||
- (video_pts_seek < audio_pts &&
- video_pts_seek + (1LL<<33) - audio_pts < SEEK_THRESHOLD) ))
- {
- aud_seeking = 0;
- Log::getInstance()->log("Demuxer", Log::DEBUG, "Leaving audio sync: Audio PTS = %llu", audio_pts);
- }
- }
- break;
- case 0x10: //Teletext Is this correct?
- packet.setSubstream(substream_id);
- // Extract teletxt PTS if it exists
- if (packet.hasPTS())
- {
- teletext_pts = packet.getPTS();
- }
- break;
- default:
- if (!ispre_1_3_19)
- {
- ispre_1_3_19=true; //switching to compat mode and live tv mode
- goto pre_1_3_19_Recording;
- }
- else
- {
- packet.setSubstream(0);
- }
- break;
- }
+ if (!livetv) {
+ //Inspired by vdr's device.c
+ int payload_begin = packet[8]+9;
+ unsigned char substream_id = packet[payload_begin];
+ unsigned char substream_type = substream_id & 0xF0;
+ unsigned char substream_index = substream_id & 0x1F;
+ pre_1_3_19_Recording: //This is for old recordings stuff and live TV
+ if (ispre_1_3_19)
+ {
+ int old_substream=packet.getSubstream();
+ if (old_substream){ //someone else already set it, this is live tv
+ substream_id = old_substream;
+ substream_type = substream_id & 0xF0;
+ substream_index = substream_id & 0x1F;
+ } else {
+ substream_id = PESTYPE_PRIVATE_1;
+ substream_type = 0x80;
+ substream_index = 0;
+ }
+
+ }
+ switch (substream_type)
+ {
+ case 0x20://SPU
+ case 0x30://SPU
+ packet.setSubstream(substream_id);
+ break;
+ case 0xA0: //LPCM //not supported yet, is there any LPCM transmissio out there?
+ break;
+ case 0x80: //ac3, currently only one ac3 track per recording supported
+ packet.setSubstream(substream_type+substream_index);
+
+ // Extract audio PTS if it exists
+ if (packet.hasPTS())
+ {
+ audio_pts = packet.getPTS();
+ // We continue to seek on the audio if the video PTS that we
+ // are trying to match is ahead of the audio PTS by at most
+ // SEEK_THRESHOLD. We consider the possibility of PTS wrap.
+ if (aud_seeking && !vid_seeking &&
+ !( (video_pts_seek > audio_pts &&
+ video_pts_seek - audio_pts < SEEK_THRESHOLD)
+ ||
+ (video_pts_seek < audio_pts &&
+ video_pts_seek + (1LL<<33) - audio_pts < SEEK_THRESHOLD) ))
+ {
+ aud_seeking = 0;
+ Log::getInstance()->log("Demuxer", Log::DEBUG, "Leaving audio sync: Audio PTS = %llu", audio_pts);
+ }
+ }
+ break;
+ case 0x10: //Teletext Is this correct?
+ packet.setSubstream(substream_id);
+ // Extract teletxt PTS if it exists
+ if (packet.hasPTS())
+ {
+ teletext_pts = packet.getPTS();
+ }
+ break;
+ default:
+ if (!ispre_1_3_19)
+ {
+ ispre_1_3_19=true; //switching to compat mode and live tv mode
+ goto pre_1_3_19_Recording;
+ }
+ else
+ {
+ packet.setSubstream(0);
+ }
+ break;
+ }
+ }
}
else if (packet.getPacketType() >= PESTYPE_VID0 &&
packet.getPacketType() <= PESTYPE_VIDMAX)
bool h264;
int video_current, audio_current, teletext_current, subtitle_current;
int astreamtype;
+ bool livetv;
// Video stream information
void setAspectRatio(enum AspectRatio, int taspectx, int taspecty);
vActive = false;
}
-void DemuxerTS::setAID(int p_aID, int type, int streamtype)
+void DemuxerTS::setAID(int p_aID, int type, int streamtype, bool slivetv)
{
aID = p_aID;
atype = type;
astreamtype = streamtype;
+ livetv=slivetv;
switch (atype)
{
case 1:
new_channelinfo.apids.push_back(newapid);
new_channelinfo.numAPids++;
if (getAID() == 0 && Audio::getInstance()->streamTypeSupported(streamtype)) { //set unset AID to first audio pid that reports itself
- setAID(foundpid,0,streamtype);
+ setAID(foundpid,0,streamtype,false);
Log::getInstance()->log("ProcessTS", Log::DEBUG, "Set audio PID to %x", foundpid);
}
} break;
while (j<channelinfo.numAPids && !found) {
if (Audio::getInstance()->streamTypeSupported(channelinfo.apids[j].type)) {
found =true;
- setAID(channelinfo.apids[j].pid,0,channelinfo.apids[j].type);
+ setAID(channelinfo.apids[j].pid,0,channelinfo.apids[j].type,false);
}
j++;
}
while (j<channelinfo.numDPids && !found) {
if (Audio::getInstance()->streamTypeSupported(channelinfo.dpids[j].type)) {
found =true;
- setAID(channelinfo.dpids[j].pid,1,channelinfo.dpids[j].type);
+ setAID(channelinfo.dpids[j].pid,1,channelinfo.dpids[j].type,false);
}
i++;
}
int findPTS(UCHAR* buf, int len, ULLONG* dest);
void setVID(int p_vID);
void setTID(int p_tID);
- void setAID(int p_aID, int type, int streamtype);
+ void setAID(int p_aID, int type, int streamtype,bool slivetv);
void setSubID(int p_subID);
int getVID() { return vID; }
int getTID() { return tID; }
PTSMap pts_map;
Mutex pts_map_mutex;
void parseTSPacketDetails(PESPacket &packet);
+
};
demuxer->setAudioStream(newChannel);
return;
} else {
- ((DemuxerTS*)demuxer)->setAID(newChannel,type,streamtype);
+ ((DemuxerTS*)demuxer)->setAID(newChannel,type,streamtype,false);
return;
}
}
void PlayerLiveRadio::setAudioChannel(int newChannel, int type,int streamtype)
{
- demuxer->setAID(newChannel, type,streamtype);
+ demuxer->setAID(newChannel, type,streamtype,true);
}
void PlayerLiveRadio::setSubtitleChannel(int newChannel)
int j=0;
while (j<chan->numAPids && !found) {
if (Audio::getInstance()->streamTypeSupported(chan->apids[j].type)) {
- demuxer->setAID(chan->apids[j].pid,0,chan->apids[j].type);
+ demuxer->setAID(chan->apids[j].pid,0,chan->apids[j].type,true);
audio->setStreamType(Audio::MPEG2_PES);
logger->log("PlayerLiveRadio", Log::DEBUG, "Demuxer pids: %u %u %u", chan->vpid, chan->apids[j].pid,chan->apids[j].type);
found=true;
int j=0;
while (j<chan->numDPids && !found) {
if (Audio::getInstance()->streamTypeSupported(chan->dpids[j].type)) {
- demuxer->setAID(chan->dpids[j].pid,1,chan->dpids[j].type);
+ demuxer->setAID(chan->dpids[j].pid,1,chan->dpids[j].type,true);
audio->setStreamType(Audio::MPEG2_PES);
logger->log("PlayerLiveRadio", Log::DEBUG, "Demuxer pids: %u %u (ac3) %u", chan->vpid, chan->dpids[j].pid,chan->dpids[j].type);
found=true;
void PlayerLiveTV::setAudioChannel(int newChannel, int type,int streamtype)
{
- demuxer->setAID(newChannel,type,streamtype);
+ demuxer->setAID(newChannel,type,streamtype,true);
}
void PlayerLiveTV::setSubtitleChannel(int newChannel)
int j=0;
while (j<chan->numAPids && !found) {
if (Audio::getInstance()->streamTypeSupported(chan->apids[j].type)) {
- demuxer->setAID(chan->apids[j].pid,0,chan->apids[j].type);
+ demuxer->setAID(chan->apids[j].pid,0,chan->apids[j].type,true);
audio->setStreamType(Audio::MPEG2_PES);
logger->log("PlayerLiveTV", Log::DEBUG, "Demuxer pids: %u %u %u", chan->vpid, chan->apids[j].pid,chan->apids[j].type);
found=true;
int j=0;
while (j<chan->numDPids && !found) {
if (Audio::getInstance()->streamTypeSupported(chan->dpids[j].type)) {
- demuxer->setAID(chan->dpids[j].pid,1,chan->dpids[j].type);
+ demuxer->setAID(chan->dpids[j].pid,1,chan->dpids[j].type,true);
audio->setStreamType(Audio::MPEG2_PES);
logger->log("PlayerLiveTV", Log::DEBUG, "Demuxer pids: %u %u (ac3) %u", chan->vpid, chan->dpids[j].pid,chan->dpids[j].type);
found=true;
}
else if (m->message == Message::AUDIO_CHANGE_CHANNEL)
{
- Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Received change audio channel to %i", m->parameter);
+ Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Received change audio channel to %x", m->parameter);
player->setAudioChannel((m->parameter & 0xFFFF),(m->parameter & 0xFF0000)>>16,(m->parameter & 0xFF000000)>>24);
}
else if (m->message == Message::SUBTITLE_CHANGE_CHANNEL)
{
if (streamType !=VDR::VIDEO) return;
- Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Received change subtitle channel to %i", m->parameter);
+ Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Received change subtitle channel to %x", m->parameter);
int type=((m->parameter & 0xFF0000)>>16);
switch (type) {
case 0x10: { //dvbsubtitle