A while back I posted a message about some problems I saw with the
slang library, which TRPlayer is using for keyboard input.  I recently
revisited this issue and found that for each of the problems I
mentioned, either I could solve the problem or it wasn't a problem at
all.  So I'll comment on each of them:

1.  On some systems (especially non-Linux systems), slang is a non-standard
library.

I'm not worried about this one now.  I'll explain later in this
message.

2.  slang assumes that the terminal is VT100-compatible and therefore uses
hard-coded escape sequences instead of termcap or terminfo.

That is actually not true.  I looked more closely at the slang source
code and found that it does use the terminfo database, though it also
has hard-coded escape sequences in case the information from the
terminfo database isn't available.  It uses its own routines to access
the terminfo database instead of using the routines from the ncurses
library.

3.  When waiting for the characters in the escape sequence for an extended
key, slang has no timeout.

I haven't solved this one yet, but I'm going to write to the author of
slang about a possible solution.  I could solve it on my own, but it
would involve substantial duplication of code that is in the slang
library, and since TRPlayer isn't licensed under the GPL, I don't know
under what conditions I can include code from slang in TRPlayer.

4.  slang reads its input directly from the terminal device (possibly
through /dev/tty), not from standard input.

I solved this problem by adding one line of code to TRPlayer.  This
change is checked into the CVS repository.

Now, here's the exciting part.  The slang library includes more than
just terminal I/O routines; it includes a complete scripting language
with a syntax similar to C.  If I use this scripting language in
TRPlayer, it could give TRPlayer great flexibility.  Users would have
complete control over how the keyboard commands work and the format of
TRPlayer's output during playback.  Scripts could be written to do
some arbitrary action when certain events occur in TRPlayer (for
example, when buffering starts or when the player is paused).  Perhaps
there are possibilities I haven't thought of yet.  And as far as I
know, TRPlayer would be the first media player with a built-in
scripting language.  Is this a good idea?

-- 
Matt Campbell <http://www.pobox.com/~mattcampbell/>  ICQ #:  33005941

Reply via email to