#endif
}
+void Command::postMessageFromOuterSpace(Message* m)
+{
+ /*
+ Yet another way of getting messages into Command. This one is for events that
+ are not standard button presses (or UDP generated buttons). It is also not for
+ events that are generated as a result of other events (events that can safely
+ call postMessageNoLock and be guaranteed that the message will be processed
+ because it is known that the queue is currently being processed).
+ This is for events that come from outer space and can occur when the master
+ mutex is locked or not, they need to be queued and executed but it doesn't
+ matter when.
+ Actually so far it is for events caused by the video stream - aspect ratio
+ changes. These can occur when the master mutex is locked and so postMessage
+ doesn't work. postMessageNoLock doesn't work because if the mutex *isn't*
+ locked at the time then the message could be sat around a while before
+ being noticed.
+ The whole message system was at first supposed to prevent the problem of
+ calling a function on an object that had just been deleted, by ordering
+ messages such that all calls are done before object deletion. However,
+ because of the new centralised messaging system and the fact that ViewMan
+ locates the destination object before calling it, the messaging system now
+ allows the kind of sloppy calls it was supposed to stop. Weird huh. This
+ is mentioned here because the video stream might generate an event just as
+ the user hits stop. The mutex is locked, and by the time the message
+ is examined the vvideorec/live has been deleted. This doesn't matter because
+ viewman will drop the message if it can't find the matching object to
+ deliver it to.
+ Finally, all this is fine and dandy, except that I'm not 100% sure that
+ this sloppy postMessage and hope a queued signal will force it to be processed
+ thingy will actually work. Hmmm.
+ Lastly <g>, I will consider making the naming system a little more sane
+ if this works.
+ */
+
+ logger->log("Command", Log::DEBUG, "PMFOS called");
+ MessageQueue::postMessage(m);
+ kill(mainPid, SIGURG);
+
+ // FIXME: Marten - if this actually works on the MVP then you will need
+ // to come up with the Windows equivalent here.
+
+}
+
void Command::processMessage(Message* m)
{
logger->log("Command", Log::DEBUG, "processing message %i", m->message);
// objects deriving from messagequeues, make them derive from
// messagereceiver - then one messagequeue can deliver any message to anywhere
+ // FIXME - a slight modification - how if messagereceivers were to register
+ // themselves as receivers to avoid the calling-a-deleted-object problem
+ // then only deliver/register/unregister would have to be protected
+
// deliver timer
logger->log("Command", Log::DEBUG, "sending timer");
m->to = messageReceiver;
m->message = Message::PLAYER_EVENT;
m->parameter = Player::ASPECT43;
- messageQueue->postMessage(m);
+ messageQueue->postMessageFromOuterSpace(m);
}
else if (dxCurrentAspect == Demuxer::ASPECT_16_9)
{
m->to = messageReceiver;
m->message = Message::PLAYER_EVENT;
m->parameter = Player::ASPECT169;
- messageQueue->postMessage(m);
+ messageQueue->postMessageFromOuterSpace(m);
}
else
{