Control MPlayer with Hauppauge IR remote

Jukka Simila home at jukkis.net
Sun May 11 15:50:01 PDT 2003


Long story with some (IMHO) great news:
A while ago when I upgraded my mobo, fxtv stopped working 
(I wrote about it to this list but never got it work)

Then I discovered that MPlayer -tv works beautifully.

Only thing missing was the remote control, which I really
like to use, since I like to channelsurf.

I couldn't figure out how to add hauppauge remote as input
source to MPlayer,so I wrote this piece of software URMon,
"Universal Remote Monitor" (working title :P).

The program is still in *VERY* early alpha, I have no idea
how ugly the code might look to someone's eyes, but in the
hopes that it is useful to someone, I rolled a tarball
and put it to http://www.jukkis.net/urmon.tar.gz

It consists of two separate programs, 'urmon', which monitors
an IPC message queue, and when it receives a message, it 
translates it to keyboard keypresses, and sends them to 
X with XTestFakeKeyEvent. 
Second program, in this case 'urmon_hauppauge', handles the
hauppauge remote, ie. opens bktr device and polls it, and 
when it detects a keypress, it sends it to the message queue
that urmon is listening. 

This approach (I hope) allows *very* easy addition of other
IR remotes, like PixelView's. They just need to be separate
programs that send keypresses to the message queue.

At the moment, the remotekey->keypress translations are hard-
coded to source (see util.c), and I can successfully control 
MPlayer with it. (read: I can change channels, toggle 
fullscreen and close mplayer :)

Also, at the moment, urmon_hauppauge leaves TVCards audio 
unmuted, and urmon/urmon_hauppauge exit when 'TV' key is pressed. 
I will have to figure a way to control the muting/unmuting, perhaps 
thru mixer instead of bktr, but in the meanwhile this leaves the 
program usable practically only for controlling mplayer in TV mode.
(As in 'start urmon when mplayer -tv starts, close tv with remote')

So if you are adventurous/eager to use MPlayer with remote, feel 
free to try the program.

My plan is to have the translations user configurable, so that
there's a config file for MPlayer, XMMS, Xine, Ogle, whatever, 
you name it. All the program does is effectively change the 
remote control to a limited keyboard. I'm just cooling off from 
the coding mode and transforming back to designing mode, I 
need to figure a good way to switch between the translation
tables, and I'm thinking I'll add a possibility to run commands,
like start tv, or radio, or dvdplayer.. but I need to think about
that first. Well designed is 50% done, or something.

Some example configs, if you have trouble getting mplayer -tv 
to work (I did):
Here's my ~/.mplayer/input.conf:
1 tv_set_channel 1
2 tv_set_channel 2
3 tv_set_channel 3
4 tv_set_channel 4
5 tv_set_channel 5
6 tv_set_channel 6
7 tv_set_channel 7
8 tv_set_channel 8

(I only got 8 channels..)

I start mplayer with a shell script tvmplayer:
>cat ~/bin/tvmplayer
#!/bin/sh
~/bin/urmon > /dev/null&
~/bin/urmon_hauppauge >/dev/null&
mplayer -tv on:driver=bsdbt848:input=1:norm=PAL:\
chanlist=europe-west:channel=5:width=768:height=576:\
channels=E4-SVT1,E5-SVT2,E12-Kanal_3,E7-TV4,E10-Kanal_5,\
E8-MTV,E9-Discovery,E11-Eurosport -really-quiet


If you reply please cc to me, for some reason I don't
get mail from multimedia list althou I'm supposed to be subscribed.

FWIW,
//Jukkis



More information about the freebsd-multimedia mailing list