[Live-devel] interactive support
hornsby
adrian_hornsby at yahoo.co.uk
Thu Sep 29 18:42:50 PDT 2005
Hi again Ross,
I'm having little trouble to understand the watchVariable variable.
In fact, I need depending if for example the 'a' key is press,
in
void MPEG2TransportStreamSplicer::doGetNextFrame() {
//implementation of the virtual fonction
if(a_key_pressed==true){
fInputSource1->getNextFrame(fTo,fMaxSize, afterGettingFrame,
this,FramedSource::handleClosure,
this);
}
if(b_key_pressed==true){
fInputSource2->getNextFrame(fTo,fMaxSize, afterGettingFrame,
this,FramedSource::handleClosure,
this);
}
}
so I dunno how your solution can be applied here.
I have done the modification
while(1) {
watchVariable = 0;
env->taskScheduler().doEventLoop(&watchVariable);
switch (watchVariable){
case 'a': {
//handle the pressing of key 'a'
videoSource->a_key_pressed = true;
break;
}
case 'b': {
//handle the pressing of key 'b'
videoSource->b_key_pressed = true;
break;
}
}
}
But how then I get that a or b is pressed, do I have to use another function
like control.keydown event (in windows world) but for linux ?? or is it
already implemented with this watchVariable thing?
> Then, elsewhere in your program, do
> if (/* key 'a' is pressed*/) {
> watchVariable = 'a';
> }
thanks a lot again and again
On Thursday 29 September 2005 11:54, Ross Finlayson wrote:
> >Sorry if this was asked before, I checked the archive
> >without success, but I would like to know if LiveMedia
> >library has already support for interactive control ?
> >By this I mean I want to be able to start a function
> >anytime during the runtime of my program by pressing a
> >key on the keyboard.
>
> Yes, there are two possible ways to do this.
>
> The most general (but most complicated) way is to write a new
> "TaskScheduler" subclass, that implements a new event loop, and use
> this instead of "BasicTaskScheduler".
>
> A much simpler (but less general) way is to use the "watchVariable"
> feature of "TaskScheduler::doEventLoop()". E,g.
>
> replace
> env->taskScheduler().doEventLoop();
> with
> char watchVariable; // make this a global variable
> ...
> while (1) {
> watchVariable = 0;
> env->taskScheduler().doEventLoop(&watchVariable);
> switch (watchVariable) {
> case 'a': {
> // handle the pressing of key 'a'
> break;
> }
> case 'b': {
> // hande the pressing of key 'b'
> break;
> }
> // etc.
> }
> }
>
> Then, elsewhere in your program, do
> if (/* key 'a' is pressed*/) {
> watchVariable = 'a';
> }
> etc.
>
>
> Ross Finlayson
> Live Networks, Inc. (LIVE555.COM)
> <http://www.live555.com/>
>
> _______________________________________________
> live-devel mailing list
> live-devel at lists.live555.com
> http://lists.live555.com/mailman/listinfo/live-devel
___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
More information about the live-devel
mailing list