index = -1;
vpid = 0;
+ tpid = 0;
numAPids = 0;
+ numDPids = 0;
+ numSPids = 0;
+
}
Channel::~Channel()
index = -1; // just in case
for(ULONG i = 0; i < numAPids; i++) delete[] apids[i].name;
+ for(ULONG i = 0; i < numDPids; i++) delete[] dpids[i].name;
+ for(ULONG i = 0; i < numSPids; i++) delete[] spids[i].name;
}
void Channel::loadPids()
{
for(ULONG i = 0; i < numAPids; i++) delete[] apids[i].name;
apids.clear();
+ for(ULONG i = 0; i < numDPids; i++) delete[] dpids[i].name;
+ dpids.clear();
+ for(ULONG i = 0; i < numSPids; i++) delete[] spids[i].name;
+ spids.clear();
vpid = 0;
+ tpid = 0;
numAPids = 0;
+ numDPids = 0;
+ numSPids = 0;
}
VDR::getInstance()->getChannelPids(this); // FIXME sort out this system
- Log::getInstance()->log("Channel", Log::DEBUG, "C.%lu loaded, VPid=%lu, numApids=%lu", number, vpid, numAPids);
+ Log::getInstance()->log("Channel", Log::DEBUG, "C.%lu loaded, VPid=%lu, numApids=%lu, numDpids=%lu, numSpids=%lu TPid=%lu",
+ number, vpid, numAPids, numDPids, numSPids, tpid);
for (ULONG i = 0; i < numAPids; i++)
{
Log::getInstance()->log("Channel", Log::DEBUG, "APid %lu %s", apids[i].pid, apids[i].name);
}
+ for (ULONG i = 0; i < numDPids; i++)
+ {
+ Log::getInstance()->log("Channel", Log::DEBUG, "DPid %lu %s", dpids[i].pid, dpids[i].name);
+ }
+ for (ULONG i = 0; i < numSPids; i++)
+ {
+ Log::getInstance()->log("Channel", Log::DEBUG, "SPid %lu %s", spids[i].pid, spids[i].name);
+ }
}
ULONG vpid;
ULONG numAPids;
APidList apids;
+ ULONG numDPids;
+ APidList dpids;
+ ULONG numSPids;
+ APidList spids;
+ ULONG tpid;
};
#endif
boxstack->update(vw);
// Enter pre-keys here
-// handleCommand(Remote::THREE);
+// handleCommand(Remote::OK);
+// handleCommand(Remote::ONE);
+// handleCommand(Remote::ZERO);
+// handleCommand(Remote::OK);
// handleCommand(Remote::UP);
// handleCommand(Remote::PLAY);
// handleCommand(Remote::DOWN);
// handleCommand(Remote::DOWN);
// handleCommand(Remote::DOWN);
// handleCommand(Remote::OK);
-// handleCommand(Remote::OK);
// handleCommand(Remote::RED);
}
}
init(0);
}
-void PESPacket::init(UCHAR type)
+void PESPacket::init(UCHAR type, UCHAR sub)
{
- length = 0; size = 6;
+ length = 0;
+ size = 6;
data[3] = type;
data[4] = data[5] = 0;
packetType = type;
- substream = 0;
+ substream = sub;
seq_header = 1; // Unknown seq_header status
}
void PESPacket::truncate()
{
- init(packetType);
+ init(packetType,substream);
}
int PESPacket::write(UCHAR *buf, int len)
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
+pre_1_3_19_Recording: //This is for old recordings stuff and live TV
if (ispre_1_3_19)
{
substream_id = PESTYPE_PRIVATE_1;
default:
if (!ispre_1_3_19)
{
- ispre_1_3_19=true; //switching to compat mode
+ ispre_1_3_19=true; //switching to compat mode and live tv mode
goto pre_1_3_19_Recording;
}
else
{
public:
PESPacket();
- void init(UCHAR type);
+ void init(UCHAR type, UCHAR sub=0);
void truncate();
int write(UCHAR* buf, int len);
{
}
-void DemuxerAudio::setAID(int p_aID)
+void DemuxerAudio::setAID(int p_aID,int type)
{
}
virtual int scan(UCHAR* buf, int len);
virtual int findPTS(UCHAR* buf, int len, ULLONG* dest);
virtual void setVID(int p_vID);
- virtual void setAID(int p_aID);
+ virtual void setAID(int p_aID,int type);
virtual int put(UCHAR* buf, int len);
//special functions for the audioplayer
{
vID = p_vID;
aID = p_aID;
+ atype = 0;
}
void DemuxerTS::flush()
parsed = false;
Demuxer::flush();
vPacket.init(PESTYPE_VID0);
- aPacket.init(PESTYPE_AUD0);
+ switch (atype) {
+ case 1:
+ aPacket.init(PESTYPE_PRIVATE_1,PESTYPE_SUBSTREAM_AC30);break;
+ default:
+ case 0:
+ aPacket.init(PESTYPE_AUD0);break;
+ };
vActive = false;
aActive = false;
}
int DemuxerTS::scan(UCHAR *buf, int len)
{
+ switch (atype) {
+ case 1:
+ return PESTYPE_PRIVATE_1;
+ default:
+ case 0:
return PESTYPE_AUD0;
+ };
+
}
void DemuxerTS::setVID(int p_vID)
vActive = false;
}
-void DemuxerTS::setAID(int p_aID)
+void DemuxerTS::setAID(int p_aID, int type)
{
aID = p_aID;
+ atype = type;
+ switch (atype) {
+ case 1:
+ aPacket.init(PESTYPE_PRIVATE_1,PESTYPE_SUBSTREAM_AC30);
+ setAudioStream(PESTYPE_SUBSTREAM_AC30);break;
+ default:
+ case 0:
aPacket.init(PESTYPE_AUD0);
+ setAudioStream(PESTYPE_AUD0);
+ break;
+ };
aActive = false;
}
}
if (pid == aID)
{
- aPacket.init(PESTYPE_AUD0);
+ switch (atype) {
+ case 1:
+ aPacket.init(PESTYPE_PRIVATE_1,PESTYPE_SUBSTREAM_AC30);break;
+ default:
+ case 0:
+ aPacket.init(PESTYPE_AUD0);break;
+ };
buf += 6; datalen -= 6;
}
}
int scan(UCHAR* buf, int len);
int findPTS(UCHAR* buf, int len, ULLONG* dest);
void setVID(int p_vID);
- void setAID(int p_aID);
+ void setAID(int p_aID, int type);
int getVID() { return vID; }
int getAID() { return aID; }
int put(UCHAR* buf, int len);
PESPacket vPacket; // Video PES packet under construction
PESPacket aPacket; // Audio PES packet under construction
int vID, aID; // TS IDs for video/audio
+ int atype;
bool vActive, aActive; // Whether video/audio is actively being captured
};
return ((DemuxerTS*)demuxer)->getAID();
}
-void Player::setAudioChannel(int newChannel)
+void Player::setAudioChannel(int newChannel, int type)
{
if (isRecording)
demuxer->setAudioChannel(newChannel);
else
- ((DemuxerTS*)demuxer)->setAID(newChannel);
+ ((DemuxerTS*)demuxer)->setAID(newChannel,type);
}
// ----------------------------------- Externally called events
// TS mode
DemuxerTS* dts = (DemuxerTS*)demuxer;
dts->setVID(Vpid);
- dts->setAID(Apid);
+ dts->setAID(Apid,0);
play();
}
void setStartFrame(ULONG frameNum);
void setLengthBytes(ULLONG length);
void setLengthFrames(ULONG length);
- void setAudioChannel(int newChannel);
+ void setAudioChannel(int newChannel, int type);
void play(); // Recording
void play(ULONG vpid, ULONG apid); // Live TV
virtual void go(ULONG index)=0;
virtual void setChannel(ULONG index)=0;
virtual void stop()=0;
- virtual void setAudioChannel(int newChannel)=0;
+ virtual void setAudioChannel(int newChannel,int type)=0;
virtual bool* getDemuxerMpegAudioChannels()=0;
virtual bool* getDemuxerAc3AudioChannels()=0;
return demuxer->getAID();
}
-void PlayerLiveRadio::setAudioChannel(int newChannel)
+void PlayerLiveRadio::setAudioChannel(int newChannel, int type)
{
- return demuxer->setAID(newChannel);
+ return demuxer->setAID(newChannel, type);
}
// ----------------------------------- Externally called events
if (chan->numAPids > 0)
{
- demuxer->setAID(chan->apids[0].pid);
+ demuxer->setAID(chan->apids[0].pid,0);
logger->log("PlayerLiveRadio", Log::DEBUG, "Demuxer pids: %u %u", chan->vpid, chan->apids[0].pid);
}
else
virtual void go(ULONG index);
virtual void setChannel(ULONG index);
virtual void stop();
- virtual void setAudioChannel(int newChannel);
+ virtual void setAudioChannel(int newChannel, int type);
virtual bool* getDemuxerMpegAudioChannels();
virtual bool* getDemuxerAc3AudioChannels();
return demuxer->getAID();
}
-void PlayerLiveTV::setAudioChannel(int newChannel)
+void PlayerLiveTV::setAudioChannel(int newChannel, int type)
{
- return demuxer->setAID(newChannel);
+ return demuxer->setAID(newChannel,type);
}
// ----------------------------------- Externally called events
demuxer->setVID(chan->vpid);
if (chan->numAPids > 0)
{
- demuxer->setAID(chan->apids[0].pid);
+ demuxer->setAID(chan->apids[0].pid,0);
logger->log("PlayerLiveTV", Log::DEBUG, "Demuxer pids: %u %u", chan->vpid, chan->apids[0].pid);
}
else
chunkToDemuxer();
if (state == S_PREBUFFERING)
- {
- if (++preBufferCount == preBufferAmount)
+ {
+ ++preBufferCount;
+ ULONG percentDone = (ULONG)(preBufferCount / (float)preBufferAmount * 100);
+
+ Message* m = new Message();
+ m->from = this;
+ m->to = messageReceiver;
+ m->message = Message::PLAYER_EVENT;
+ m->parameter = PlayerLiveTV::PREBUFFERING;
+ m->tag = percentDone;
+ messageQueue->postMessageFromOuterSpace(m);
+
+ if (preBufferCount == preBufferAmount)
{
switchState(S_PLAY);
}
virtual void go(ULONG index);
virtual void setChannel(ULONG index);
virtual void stop();
- virtual void setAudioChannel(int newChannel);
+ virtual void setAudioChannel(int newChannel,int type);
virtual bool* getDemuxerMpegAudioChannels();
virtual bool* getDemuxerAc3AudioChannels();
const static UCHAR STREAM_END = 3;
const static UCHAR ASPECT43 = 4;
const static UCHAR ASPECT169 = 5;
+ const static UCHAR PREBUFFERING = 6;
protected:
void threadMethod();
{
// TS mode
DemuxerTS* dts = (DemuxerTS*)demuxer;
- dts->setAID(Apid);
+ dts->setAID(Apid,0/*Radio is always mpeg?*/);
play();
}
{
protected:
// Override this method in derived classes
+
virtual void threadMethod()=0;
virtual void threadPostStopCleanup()=0;
-
- ThreadWin();
+ ThreadWin();
~ThreadWin();
// Methods to use from outside the thread
};
#endif
+
#include "remote.h"
#include "colour.h"
#include "video.h"
+#include "audio.h"
#include "boxstack.h"
#include "i18n.h"
#include "message.h"
ac->pestype = channel->apids[i].pid;
acl.push_back(ac);
}
+ if (Audio::getInstance()->supportsAc3()) {
+ for (UINT i = 0; i < channel->numDPids; i++)
+ {
+ AudioChannel* ac = new AudioChannel();
+ ac->type = 1;
+ ac->name = new char[strlen(channel->dpids[i].name) + 1];
+ strcpy(ac->name, channel->dpids[i].name);
+ ac->pestype = channel->dpids[i].pid;
+ acl.push_back(ac);
+ }
+ }
int audioChannelListSize = acl.size();
m->from = this;
m->to = parent;
m->message = Message::AUDIO_CHANGE_CHANNEL;
- m->parameter = ((AudioChannel*)sl.getCurrentOptionData())->pestype;
+ m->parameter = (((AudioChannel*)sl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioChannel*)sl.getCurrentOptionData())->type &0xFF)<<16 ;
Command::getInstance()->postMessageNoLock(m);
return 2;
m->from = this;
m->to = parent;
m->message = Message::AUDIO_CHANGE_CHANNEL;
- m->parameter = ((AudioChannel*)sl.getCurrentOptionData())->pestype;
+ m->parameter = (((AudioChannel*)sl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioChannel*)sl.getCurrentOptionData())->type &0xFF)<<16 ;
Command::getInstance()->postMessageNoLock(m);
return 2;
{
sl.draw();
BoxStack::getInstance()->update(this);
- if ((int)lastsel!=sl.getCurrentOption()) {
+ if ((int)lastsel!=sl.getCurrentOption())
+ {
Message* m2 = new Message();
m2->from = this;
m2->to = parent;
m2->message = Message::AUDIO_CHANGE_CHANNEL;
- m2->parameter = (((AudioChannel*)sl.getCurrentOptionData())->pestype&0xFF)|(((AudioChannel*)sl.getCurrentOptionData())->type &0xFF)<<8 ;
+ m2->parameter = (((AudioChannel*)sl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioChannel*)sl.getCurrentOptionData())->type &0xFF)<<16 ;
Command::getInstance()->postMessageNoLock(m2);
}
}
channel->apids.push_back(newapid);
}
+ channel->numDPids = vresp->extractULONG();
+
+ for (ULONG i = 0; i < channel->numDPids; i++)
+ {
+ apid newdpid;
+ newdpid.pid = vresp->extractULONG();
+ newdpid.name = vresp->extractString();
+ channel->dpids.push_back(newdpid);
+ }
+
+ channel->numSPids = vresp->extractULONG();
+
+ for (ULONG i = 0; i < channel->numSPids; i++)
+ {
+ apid newspid;
+ newspid.pid = vresp->extractULONG();
+ newspid.name = vresp->extractString();
+ channel->spids.push_back(newspid);
+ }
+ channel->tpid = vresp->extractULONG();
+
delete vresp;
return ;
return 1;
}
#endif
- return 1;
+ return 1;
}
int VideoWin::setAudioStreamType(UCHAR type)
else if (m->message == Message::AUDIO_CHANGE_CHANNEL)
{
Log::getInstance()->log("VVideoLive", Log::DEBUG, "Received change audio channel to %i", m->parameter);
- ((Player*)player)->setAudioChannel(m->parameter);
+ ((Player*)player)->setAudioChannel(m->parameter&0xFFFF,(m->parameter&0xFF0000)>>16);
}
else if (m->message == Message::PLAYER_EVENT)
{
summaryBlackLine.setSize(summary.getWidth(), 4);
summary.add(&summaryBlackLine);
+ sAspectRatio.setPosition(osd.getWidth() - 90, clock.getY2()+4);
+ sAspectRatio.nextColour = Colour::YELLOW;
+ sAspectRatio.setVisible(false);
+ osd.add(&sAspectRatio);
+
// FIXME painful
Region r1 = summary.getRegionR();
Region r2 = osd.getRegionR();
else if (m->message == Message::AUDIO_CHANGE_CHANNEL)
{
Log::getInstance()->log("VVideoLiveTV", Log::DEBUG, "Received change audio channel to %i", m->parameter);
- player->setAudioChannel(m->parameter);
+ player->setAudioChannel((m->parameter & 0xFFFF),(m->parameter & 0xFF0000)>>16);
}
else if (m->message == Message::PLAYER_EVENT)
{
wss.draw();
BoxStack::getInstance()->update(this, &wssRegion);
}
+
+ sAspectRatio.nextSymbol = WSymbol::VIDEOASPECT43;
+ sAspectRatio.setVisible(true);
+ osd.draw();
+ BoxStack::getInstance()->update(this, osd.getRegion());
+
break;
}
case PlayerLiveTV::ASPECT169:
wss.draw();
BoxStack::getInstance()->update(this, &wssRegion);
}
+
+ sAspectRatio.nextSymbol = WSymbol::VIDEOASPECT169;
+ sAspectRatio.setVisible(true);
+ osd.draw();
+ BoxStack::getInstance()->update(this, osd.getRegion());
+
break;
}
+ case PlayerLiveTV::PREBUFFERING:
+ {
+ Log::getInstance()->log("VVideoRec", Log::DEBUG, "Prebuffering - %u", m->tag);
+ }
}
}
}
#include "wtextbox.h"
#include "wselectlist.h"
#include "timerreceiver.h"
+#include "wsymbol.h"
class VChannelList;
class Video;
WTextbox textGreen;
WTextbox textYellow;
WTextbox textBlue;
+ WSymbol sAspectRatio;
Boxx summary;
WTextbox textSummary;
else if (m->message == Message::AUDIO_CHANGE_CHANNEL)
{
Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received change audio channel to %i", m->parameter);
- player->setAudioChannel(m->parameter);
+ player->setAudioChannel(m->parameter&0xFFFF,(m->parameter&0xFF0000)>> 16 );
}
else if (m->message == Message::CHILD_CLOSE)
{
#include "colour.h"
-UCHAR WSymbol::widths[] = { 2, 2, 4, 4, 1, 1, 3, 3, 3, 3, 3, 4, 4, 2, 2, 3, 5, 5, 4, 4, 2, 2};
-UCHAR WSymbol::heights[] = { 8, 8, 12, 12, 24, 4, 18, 18, 18, 18, 18, 30, 30, 16, 16, 18, 18, 18, 16, 16, 8, 8};
+UCHAR WSymbol::widths[] = { 2, 2, 4, 4, 1, 1, 3, 3, 3, 3, 3, 4, 4, 2, 2, 3, 5, 5, 4, 4, 2, 2, 5, 5};
+UCHAR WSymbol::heights[] = { 8, 8, 12, 12, 24, 4, 18, 18, 18, 18, 18, 30, 30, 16, 16, 18, 18, 18, 16, 16, 8, 8, 16, 16};
UCHAR WSymbol::symbols[] = {
0x03, 0xC0,
0x01, 0x80,
+/*
+11111111 11111111 11111111 11111111 11111111
+11111111 11111111 11111111 11111111 11111111
+11000000 01111111 11111111 11111110 00000011
+11000000 01111111 11111111 11111110 00000011
+11000000 01111111 11111111 11111110 00000011
+11000000 01111111 11111111 11111110 00000011
+11000000 01111111 11111111 11111110 00000011
+11000000 01111111 11111111 11111110 00000011
+
+11000000 01111111 11111111 11111110 00000011
+11000000 01111111 11111111 11111110 00000011
+11000000 01111111 11111111 11111110 00000011
+11000000 01111111 11111111 11111110 00000011
+11000000 01111111 11111111 11111110 00000011
+11000000 01111111 11111111 11111110 00000011
+11111111 11111111 11111111 11111111 11111111
+11111111 11111111 11111111 11111111 11111111
+*/
+
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+0xC0, 0x1F, 0xFF, 0xF8, 0x03,
+0xC0, 0x1F, 0xFF, 0xF8, 0x03,
+0xC0, 0x1F, 0xFF, 0xF8, 0x03,
+0xC0, 0x1F, 0xFF, 0xF8, 0x03,
+0xC0, 0x1F, 0xFF, 0xF8, 0x03,
+0xC0, 0x1F, 0xFF, 0xF8, 0x03,
+
+0xC0, 0x1F, 0xFF, 0xF8, 0x03,
+0xC0, 0x1F, 0xFF, 0xF8, 0x03,
+0xC0, 0x1F, 0xFF, 0xF8, 0x03,
+0xC0, 0x1F, 0xFF, 0xF8, 0x03,
+0xC0, 0x1F, 0xFF, 0xF8, 0x03,
+0xC0, 0x1F, 0xFF, 0xF8, 0x03,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+
+/*
+11111111 11111111 11111111 11111111 11111111
+11111111 11111111 11111111 11111111 11111111
+11111110 01111111 11111111 11111110 01111111
+11111110 01111111 11111111 11111110 01111111
+11111110 01111111 11111111 11111110 01111111
+11111110 01111111 11111111 11111110 01111111
+11111110 01111111 11111111 11111110 01111111
+11111110 01111111 11111111 11111110 01111111
+
+11111110 01111111 11111111 11111110 01111111
+11111110 01111111 11111111 11111110 01111111
+11111110 01111111 11111111 11111110 01111111
+11111110 01111111 11111111 11111110 01111111
+11111110 01111111 11111111 11111110 01111111
+11111110 01111111 11111111 11111110 01111111
+11111111 11111111 11111111 11111111 11111111
+11111111 11111111 11111111 11111111 11111111
+*/
+
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFE, 0x7F, 0xFF, 0xFE, 0x7F,
+0xFE, 0x7F, 0xFF, 0xFE, 0x7F,
+0xFE, 0x7F, 0xFF, 0xFE, 0x7F,
+0xFE, 0x7F, 0xFF, 0xFE, 0x7F,
+0xFE, 0x7F, 0xFF, 0xFE, 0x7F,
+0xFE, 0x7F, 0xFF, 0xFE, 0x7F,
+
+0xFE, 0x7F, 0xFF, 0xFE, 0x7F,
+0xFE, 0x7F, 0xFF, 0xFE, 0x7F,
+0xFE, 0x7F, 0xFF, 0xFE, 0x7F,
+0xFE, 0x7F, 0xFF, 0xFE, 0x7F,
+0xFE, 0x7F, 0xFF, 0xFE, 0x7F,
+0xFE, 0x7F, 0xFF, 0xFE, 0x7F,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+
};
WSymbol::WSymbol()
const static UCHAR FFWD = 19;
const static UCHAR SMALLUP = 20;
const static UCHAR SMALLDOWN = 21;
-
+ const static UCHAR VIDEOASPECT43 = 22;
+ const static UCHAR VIDEOASPECT169 = 23;
+
private:
static UCHAR symbols[];
static UCHAR widths[];