[Live-devel] interactive support
adrian hornsby
adrian_hornsby at yahoo.co.uk
Thu Sep 29 12:40:00 PDT 2005
Hey thanks so much Ross.
You readly are a great help !
adrian
--- Ross Finlayson <finlayson at live555.com> 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