{
logger->log("Command", Log::DEBUG, "processing message %i", m->message);
- switch(m->message)
+ // Timer handling is very weird at the mo. Take them out here and convert
+ if (m->message == Message::TIMER)
{
- case Message::STANDBY:
- {
- doStandby();
- break;
- }
- case Message::STOP_PLAYBACK:
- {
- handleCommand(Remote::STOP); // an odd way of doing it, but so simple
- break;
- }
- case Message::STREAM_END:
- {
- VVideoLive::getInstance()->streamEnd();
- break;
- }
- case Message::VDR_CONNECTED:
- {
- doJustConnected((VConnect*)m->from);
- break;
- }
- case Message::TIMER:
- {
- // FIXME - go to one message queue only - then instead of having
- // objects deriving from messagequeues, make them derive from
- // messagereceiver - then one messagequeue can deliver any message to anywhere
+ // FIXME - go to one message queue only - then instead of having
+ // objects deriving from messagequeues, make them derive from
+ // messagereceiver - then one messagequeue can deliver any message to anywhere
- // deliver timer
+ // deliver timer
- ((TimerReceiver*)m->to)->timercall(m->parameter);
- handleCommand(Remote::NA_NONE); // in case any timer has posted messages to viewman,
- // run viewman message queue here. FIXME improve this!
- break;
- }
- case Message::SCREENSHOT:
- {
- Osd::getInstance()->screenShot("/out.jpg");
- break;
- }
- case Message::CONNECTION_LOST:
- {
- doFromTheTop(true);
- break;
- }
- case Message::UDP_BUTTON:
+ logger->log("Command", Log::DEBUG, "sending timer");
+ ((TimerReceiver*)m->to)->timercall(m->parameter);
+// handleCommand(Remote::NA_NONE); // in case any timer has posted messages to viewman,
+// // run viewman message queue here. FIXME improve this!
+// break;
+ }
+ else if (m->to == this)
+ {
+ switch(m->message)
{
- handleCommand(m->parameter);
- break;
+ case Message::STANDBY:
+ {
+ doStandby();
+ break;
+ }
+
+
+ // << FIXME OBSELETE
+ case Message::STOP_PLAYBACK:
+ {
+ handleCommand(Remote::STOP); // an odd way of doing it, but so simple
+ break;
+ }
+ case Message::STREAM_END:
+ {
+ VVideoLive::getInstance()->streamEnd();
+ break;
+ }
+
+ // Also connection_lost comes from player - anywhere else?
+ // FIXME OBSELETE >>
+
+
+ case Message::VDR_CONNECTED:
+ {
+ doJustConnected((VConnect*)m->from);
+ break;
+ }
+ case Message::SCREENSHOT:
+ {
+ Osd::getInstance()->screenShot("/out.jpg");
+ break;
+ }
+ case Message::CONNECTION_LOST:
+ {
+ doFromTheTop(true);
+ break;
+ }
+ case Message::UDP_BUTTON:
+ {
+ handleCommand(m->parameter);
+ break;
+ }
}
}
+ else
+ {
+ logger->log("Command", Log::DEBUG, "Sending message to viewman");
+ viewman->processMessage(m);
+ }
}
void Command::handleCommand(int button)
const static ULONG CONNECTION_LOST = 19;
const static ULONG MOVE_RECORDING = 20;
const static ULONG UDP_BUTTON = 21;
+ const static ULONG PLAYER_EVENT = 22;
};
#endif
vchannellist.o vwelcome.o vvideolive.o vvideorec.o vepgsettimer.o \\r
vchannelselect.o vserverselect.o vconnect.o vepg.o vrecmove.o \\r
widget.o wselectlist.o wjpeg.o wsymbol.o wbutton.o \\r
- woptionbox.o wtextbox.o \\r
+ woptionbox.o wtextbox.o wwss.o \\r
fonts/helvB24.o fonts/helvB18.o \\r
remote.o led.o mtd.o video.o audio.o osd.o surface.o\r
// ----------------------------------- Called from outside, one offs or info funcs
-Player::Player(MessageQueue* messageQueue, bool tIsRecording, bool tIsRadio)
+Player::Player(MessageQueue* tmessageQueue, void* tmessageReceiver, bool tIsRecording, bool tIsRadio)
: vfeed(this), afeed(this)
{
- commandMessageQueue = messageQueue;
+ messageQueue = tmessageQueue;
+ messageReceiver = tmessageReceiver;
audio = Audio::getInstance();
video = Video::getInstance();
logger = Log::getInstance();
void Player::doConnectionLost()
{
+ logger->log("Player", Log::DEBUG, "Connection lost, sending message");
Message* m = new Message();
- m->message = Message::CONNECTION_LOST;
- m->to = this;
- commandMessageQueue->postMessage(m);
+ m->to = messageReceiver;
+ m->from = this;
+ m->message = Message::PLAYER_EVENT;
+ m->parameter = Player::CONNECTION_LOST;
+ messageQueue->postMessage(m);
}
// ----------------------------------- Callback
{
logger->log("Player", Log::DEBUG, "Demuxer said video is 4:3 aspect, switching TV");
video->setAspectRatio(Video::ASPECT4X3);
+
+ Message* m = new Message();
+ m->from = this;
+ m->to = messageReceiver;
+ m->message = Message::PLAYER_EVENT;
+ m->parameter = Player::ASPECT43;
+ messageQueue->postMessage(m);
}
else if (dxCurrentAspect == Demuxer::ASPECT_16_9)
{
logger->log("Player", Log::DEBUG, "Demuxer said video is 16:9 aspect, switching TV");
video->setAspectRatio(Video::ASPECT16X9);
+
+ Message* m = new Message();
+ m->from = this;
+ m->to = messageReceiver;
+ m->message = Message::PLAYER_EVENT;
+ m->parameter = Player::ASPECT169;
+ messageQueue->postMessage(m);
}
else
{
{
threadCheckExit();
Message* m = new Message(); // Must be done after this thread finishes, and must break into master mutex
- m->message = Message::STOP_PLAYBACK;
- logger->log("Player", Log::DEBUG, "Posting message to %p...", commandMessageQueue);
- commandMessageQueue->postMessage(m);
+ m->to = messageReceiver;
+ m->from = this;
+ m->message = Message::PLAYER_EVENT;
+ m->parameter = STOP_PLAYBACK;
+ logger->log("Player", Log::DEBUG, "Posting message to %p...", messageQueue);
+ messageQueue->postMessage(m);
logger->log("Player", Log::DEBUG, "Message posted...");
return;
}
threadCheckExit();
Message* m = new Message(); // Must be done after this thread finishes, and must break into master mutex
- m->message = Message::STREAM_END;
- logger->log("Player", Log::DEBUG, "Posting message to %p...", commandMessageQueue);
- commandMessageQueue->postMessage(m);
+ m->to = messageReceiver;
+ m->from = this;
+ m->message = Message::PLAYER_EVENT;
+ m->parameter = Player::STREAM_END;
+ logger->log("Player", Log::DEBUG, "Posting message to %p...", messageQueue);
+ messageQueue->postMessage(m);
logger->log("Player", Log::DEBUG, "Message posted...");
}
threadCheckExit();
+
Message* m = new Message(); // Must be done after this thread finishes, and must break into master mutex
- m->message = Message::STOP_PLAYBACK; // recording
- logger->log("Player", Log::DEBUG, "Posting message to %p...", commandMessageQueue);
- commandMessageQueue->postMessage(m);
- logger->log("Player", Log::DEBUG, "Message posted...");
+ m->to = messageReceiver;
+ m->from = this;
+ m->message = Message::PLAYER_EVENT;
+ m->parameter = Player::STOP_PLAYBACK;
+ logger->log("Player", Log::DEBUG, "Posting message to %p...", messageQueue);
+ messageQueue->postMessage(m);
}
void Player::threadFeedScan()
class Player : public Thread_TYPE, public Callback
{
public:
- Player(MessageQueue* messageQueue, bool isRecording, bool isRadio);
+ Player(MessageQueue* messageQueue, void* messageReceiver, bool isRecording, bool isRadio);
virtual ~Player();
int init();
const static UCHAR S_STOP = 6;
const static UCHAR S_JUMP = 7;
+ // Player events
+
+ // FIXME so far this just duplicates the old system + the wss
+
+ const static UCHAR CONNECTION_LOST = 1;
+ const static UCHAR STOP_PLAYBACK = 2;
+ const static UCHAR STREAM_END = 3;
+ const static UCHAR ASPECT43 = 4;
+ const static UCHAR ASPECT169 = 5;
+
#ifdef DEV
void test1();
void test2();
void doConnectionLost();
void restartAtFrame(ULONG newFrame);
- MessageQueue* commandMessageQueue;
+ MessageQueue* messageQueue;
+ void* messageReceiver;
Log* logger;
Audio* audio;
Video* video;
{
public:
virtual ~TimerReceiver() {}
- virtual void timercall(int clientReference)=0;
+ virtual void timercall(int clientReference)=0; // Master lock will be locked!
};
#endif
m->to = videoLive;
m->message = Message::CHANNEL_CHANGE;
m->parameter = (first * 100) + (second * 10) + third;
- ViewMan::getInstance()->postMessage(m);
+ Command::getInstance()->postMessageNoLock(m);
}
return 4;
m->from = this;
m->to = ViewMan::getInstance();
m->message = Message::CLOSE_ME;
- ViewMan::getInstance()->postMessage(m);
+ Command::getInstance()->postMessageNoLock(m);
// Is there valid data?
if ((first > 0) || (second > 0) || (third > 0))
m->to = videoLive;
m->message = Message::CHANNEL_CHANGE;
m->parameter = newChannel;
- ViewMan::getInstance()->postMessage(m);
+ Command::getInstance()->postMessage(m);
}
}
Message* m = new Message(); // Must be done after this thread ends
m->from = this;
+ m->to = Command::getInstance();
m->message = Message::VDR_CONNECTED;
Command::getInstance()->postMessage(m);
}
m->from = this;
m->to = videoLive;
m->message = Message::EPG_CLOSE;
- ViewMan::getInstance()->postMessage(m);
+ Command::getInstance()->postMessageNoLock(m);
}
return 4;\r
}\r
m->message = Message::ADD_VIEW;
m->to = viewman;
m->parameter = (ULONG)vi;
-
- viewman->postMessage(m);
+ Command::getInstance()->postMessageNoLock(m);
}
virtual void draw();
virtual int handleCommand(int command);
- virtual void processMessage(Message* m);
+ virtual void processMessage(Message* m); // The master lock will be locked
void setBorderOn(UCHAR on);
void setTitleBarOn(UCHAR on);
// Log::getInstance()->log("ViewMan", Log::DEBUG, "out of handlecommand code, now on to messages");
- processMessageQueue();
+// processMessageQueue();
return retVal2;
}
return;
}
}
+ return;
}
Log::getInstance()->log("ViewMan", Log::DEBUG, "it's for meeee!");
typedef list<Region> RegionList;
-class ViewMan : public MessageQueue
+class ViewMan
{
public:
ViewMan();
void updateView(View* toUpdate, Region* regionToUpdate = NULL);
int handleCommand(UCHAR command);
+ void processMessage(Message* m);
private:
static ViewMan* instance;
View* views[20];
int numViews;
- void processMessage(Message* m);
-
// New windowing stuff
void deleteView(int z);
void repaintRevealed(int x, Region r);
m->message = Message::EPG;
m->to = vvideoLive;
m->from = this;
- ViewMan::getInstance()->postMessage(m);
+ Command::getInstance()->postMessageNoLock(m);
return 4;
}
}
m->message = Message::CLOSE_ME;
m->to = ViewMan::getInstance();
m->from = this;
- ViewMan::getInstance()->postMessage(m);
+ Command::getInstance()->postMessageNoLock(m);
}
else if (clientReference == 2)
{
m->message = Message::CLOSE_ME;
m->to = ViewMan::getInstance();
m->from = this;
- ViewMan::getInstance()->postMessage(m);
+ Command::getInstance()->postMessageNoLock(m);
}
int VMute::handleCommand(int command)
m->message = Message::CLOSE_ME;
m->from = this;
m->to = viewman;
- viewman->postMessage(m);
+ Command::getInstance()->postMessageNoLock(m);
return 2;
}
m->message = Message::CHANGED_OPTIONS;
m->to = parent;
m->parameter = (ULONG)optionChanges;
- viewman->postMessage(m);
+ Command::getInstance()->postMessageNoLock(m);
}
m->from = this;
m->to = replyTo;
m->message = Message::QUESTION_YES;
- ViewMan::getInstance()->postMessage(m);
+ Command::getInstance()->postMessageNoLock(m);
return 4;
}
#include "viewman.h"
#include "colour.h"
#include "i18n.h"
+#include "command.h"
class VQuestion : public View
{
m->message = Message::MOVE_RECORDING;
m->to = parent;
m->parameter = sl.getCurrentOptionData();
- ViewMan::getInstance()->postMessage(m);
+ Command::getInstance()->postMessageNoLock(m);
return 4;
}
m->from = this;
m->to = vRecList;
m->message = Message::PLAY_SELECTED_RECORDING;
- ViewMan::getInstance()->postMessage(m);
+ Command::getInstance()->postMessageNoLock(m);
return 4;
}
m->from = this;
m->to = vRecList;
m->message = Message::RESUME_SELECTED_RECORDING;
- ViewMan::getInstance()->postMessage(m);
+ Command::getInstance()->postMessageNoLock(m);
return 4;
}
m2->from = this;
m2->to = ViewMan::getInstance();
m2->message = Message::CLOSE_ME;
- ViewMan::getInstance()->postMessage(m2);
+ Command::getInstance()->postMessageNoLock(m2);
m2 = new Message(); // OK. Want this to delete before this message does its job
m2->from = this;
m2->to = vRecList;
m2->message = Message::DELETE_SELECTED_RECORDING;
- ViewMan::getInstance()->postMessage(m2);
+ Command::getInstance()->postMessageNoLock(m2);
}
}
else if (m->message == Message::MOVE_RECORDING)
m2->from = this;
m2->to = ViewMan::getInstance();
m2->message = Message::CLOSE_ME;
- ViewMan::getInstance()->postMessage(m2);
+ Command::getInstance()->postMessageNoLock(m2);
m2 = new Message();
m2->from = this;
m2->to = vRecList;
m2->message = Message::MOVE_RECORDING;
m2->parameter = m->parameter;
- ViewMan::getInstance()->postMessage(m2);
+ Command::getInstance()->postMessageNoLock(m2);
}
}
m->to = replyTo;
m->message = Message::SERVER_SELECTED;
m->parameter = sl.getCurrentOption();
- ViewMan::getInstance()->postMessage(m);
+ Command::getInstance()->postMessageNoLock(m);
return 4;
}
}
#include "viewman.h"
#include "i18n.h"
#include "vdr.h"
+#include "command.h"
using namespace std;
unavailableView = NULL;
streamType = tstreamType;
videoMode = video->getMode();
- if (streamType == VDR::RADIO) player = new Player(Command::getInstance(), false, true);
- else player = new Player(Command::getInstance(), false, false);
+ if (streamType == VDR::RADIO) player = new Player(Command::getInstance(), this, false, true);
+ else player = new Player(Command::getInstance(), this, false, false);
player->init();
create(video->getScreenWidth(), video->getScreenHeight());
video->setMode(videoMode);
if (saveUnavailable) showUnavailable(1);
}
+ else if (m->message == Message::PLAYER_EVENT)
+ {
+ switch(m->parameter)
+ {
+ case Player::CONNECTION_LOST: // connection lost detected
+ {
+ Log::getInstance()->log("VVideoLive", Log::DEBUG, "Received connection lost from player");
+ // I can't handle this, send it to command
+ Message* m = new Message();
+ m->to = Command::getInstance();
+ m->message = Message::CONNECTION_LOST;
+ Command::getInstance()->postMessageNoLock(m);
+ break;
+ }
+ case Player::STREAM_END:
+ {
+ // I can't handle this, send it to command - improve this
+ Message* m = new Message(); // Must be done after this thread finishes, and must break into master mutex
+ m->to = Command::getInstance();
+ m->message = Message::STREAM_END;
+ Command::getInstance()->postMessageNoLock(m);
+ break;
+ }
+ case Player::ASPECT43:
+ {
+ Log::getInstance()->log("VVideoLive", Log::DEBUG, "Received do WSS 43");
+ break;
+ }
+ case Player::ASPECT169:
+ {
+ Log::getInstance()->log("VVideoLive", Log::DEBUG, "Received do WSS 169");
+ break;
+ }
+ }
+ }
}
void VVideoLive::doBanner(bool bannerTakesCommands)
// TODO Work out if is a radio stream
- player = new Player(Command::getInstance(), true, false);
+ player = new Player(Command::getInstance(), this, true, false);
player->init();
videoMode = video->getMode();
clocksRegion.w = 170;
clocksRegion.h = surface->getFontHeight();
+
barBlue.set(0, 0, 150, 150);
barShowing = false;
stickyBar = false;
+
+ wss.setSurface(surface);
+ wss.setWide(true);
+
+ wssRegion.x = 0;
+ wssRegion.y = 0;
+ wssRegion.w = video->getScreenWidth();
+ wssRegion.h = 10;
}
VVideoRec::~VVideoRec()
void VVideoRec::draw()
{
View::draw();
+ wss.draw();
}
void VVideoRec::go(ULONG startFrameNum)
m->message = Message::CLOSE_ME;
m->from = this;
m->to = viewman;
- viewman->postMessage(m);
+ Command::getInstance()->postMessageNoLock(m);
VInfo* vi = new VInfo();
vi->create(400, 150);
m->message = Message::ADD_VIEW;
m->to = viewman;
m->parameter = (ULONG)vi;
- viewman->postMessage(m);
+ Command::getInstance()->postMessageNoLock(m);
}
}
return 1;
}
+void VVideoRec::processMessage(Message* m)
+{
+ if (m->from != player) return;
+ if (m->message != Message::PLAYER_EVENT) return;
+
+ Log::getInstance()->log("VVideoRec", Log::DEBUG, "Message received");
+
+ switch(m->parameter)
+ {
+ case Player::CONNECTION_LOST: // connection lost detected
+ {
+ // I can't handle this, send it to command
+ Message* m = new Message();
+ m->to = Command::getInstance();
+ m->message = Message::CONNECTION_LOST;
+ Command::getInstance()->postMessageNoLock(m);
+ break;
+ }
+ case Player::STOP_PLAYBACK:
+ {
+ // Obselete ish - improve this
+ Message* m = new Message(); // Must be done after this thread finishes, and must break into master mutex
+ m->to = Command::getInstance();
+ m->message = Message::STOP_PLAYBACK;
+ Command::getInstance()->postMessageNoLock(m);
+ break;
+ }
+ case Player::ASPECT43:
+ {
+ Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 43");
+ wss.setWide(false);
+ wss.draw();
+ ViewMan::getInstance()->updateView(this, &wssRegion);
+ Log::getInstance()->log("VVideoRec", Log::DEBUG, "WSS done");
+ break;
+ }
+ case Player::ASPECT169:
+ {
+ Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 169");
+ wss.setWide(true);
+ wss.draw();
+ ViewMan::getInstance()->updateView(this, &wssRegion);
+ Log::getInstance()->log("VVideoRec", Log::DEBUG, "WSS done");
+ break;
+ }
+ }
+}
+
void VVideoRec::stopPlay()
{
Log::getInstance()->log("VVideoRec", Log::DEBUG, "Pre stopPlay");
}
else
{
-// timers->setTimerD(this, 1, 4); // only set the getridofbar timer if not ffwd/fbwd
-// stickyBar = false;
+ timers->setTimerD(this, 1, 4); // only set the getridofbar timer if not ffwd/fbwd
+ stickyBar = false;
}
timers->setTimerD(this, 2, 0, 200000000);
}
#include "osd.h"
#include "timers.h"
#include "timerreceiver.h"
+#include "message.h"
+#include "wwss.h"
//#include "vepg.h" // for testing EPG in NTSC with a NTSC test video
void go(ULONG startPosition);
void timercall(int clientReference);
+ void processMessage(Message* m);
private:
VDR* vdr;
UINT startMargin;
UINT endMargin;
+
+ Wwss wss;
+ Region wssRegion;
};
#endif
m->message = Message::CLOSE_ME;
m->to = ViewMan::getInstance();
m->from = this;
- ViewMan::getInstance()->postMessage(m);
+ Command::getInstance()->postMessageNoLock(m);
}
int VVolume::handleCommand(int command)