|
|
2010-08-05
, 18:01
|
|
|
Posts: 451 |
Thanked: 424 times |
Joined on Apr 2010
@ England
|
#2
|
|
|
2010-08-05
, 20:32
|
|
|
Posts: 4,707 |
Thanked: 4,643 times |
Joined on Oct 2007
@ Bulgaria
|
#3
|
|
|
2010-08-05
, 22:47
|
|
Posts: 45 |
Thanked: 45 times |
Joined on Jul 2010
@ Berlin
|
#4
|
This looks neat. Any chance you can post the sources? I'd prefer to look at them before installing.
mkdir test cd test wget http://torsten-traenkner.de/wissen/n900/mplayer-touchcontrol_1.0_armel.deb ar xv mplayer-touchcontrol_1.0_armel.deb tar xzvf data.tar.gz cd opt/maemo/usr/bin/mplayer-touchcontrol/ cat touchscreenEvents.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# needed for pack and unpack
import struct
# needed to execute process
import subprocess
# needed to flush
import sys
# positions/buttons on the touch screen:
#
# 1 | 2 | 3
# ---+---+---
# 4 | 5 | 6
# ---+---+---
# 7 | 8 | 9
x = 0
y = 0
z = 0
touchScreenDeviceName = "/dev/input/ts"
# int, int, short, short, int
format = 'iihhi'
def touchScreenpressed(x, y):
# print "pressed: ",x," ",y
if x > 530:
position = 3
elif x > 300:
position = 2
else:
position = 1
if y > 315:
position = position + 6
elif y > 170:
position = position + 3
print "position: ",position
sys.stdout.flush()
subprocess.call(\
["su user -c /opt/maemo/usr/bin/mplayer-touchcontrol/"+str(position)+".sh &",
""], shell=True)
# open file in binary mode
touchScreenDevice = open(touchScreenDeviceName,"rb")
event = touchScreenDevice.read(16)
while event:
# read single values from the 16 bytes
(time1, time2, type, code, value) = \
struct.unpack(format, event)
# absolute coordinates
if type == 3:
if code == 0:
x = value
if code == 1:
y = value
if code == 2:
z = value
# synchronisation of coordinates ready
# if type == 0 and code == 0:
# print x, ":", y
# touchscreen
if type == 1 and code == 0x014a:
# pressed
if value == 1:
x = x / 5
y = 500 - (y / 8)
#print "pressed : ", x, ":", y
touchScreenpressed(x, y)
# read next event
event = touchScreenDevice.read(16)
| The Following User Says Thank You to TorstenT For This Useful Post: | ||
|
|
2010-08-06
, 04:26
|
|
|
Posts: 3,404 |
Thanked: 4,474 times |
Joined on Oct 2005
@ Germany
|
#5
|
Meanwhile, I have found MediaBox. Maybe the touchscreen interface would fit best into MediaBox since it has a better performance than mplayer.
As far as I know the media player is closed source and you have no chance to change the user interface.
But mplayer is flexible. Therefore I have written a python script and some shell scripts which control mplayer in slave mode via touch-screen. The keyboard is not necessary.
You can switch between the two menus by touching the lower left corner of the touch screen.
Here is an image how to control mplayer in virtual menu 1:
Here is an image how to control mplayer in virtual menu 2:
To quit mplayer press menu 2 (lower left corner) and then press quit (upper left corner).
Since I created the package by hand without scratchbox I am not sure if all dependencies are met. Let me know if something is missing.
Here is the package:
http://torsten-traenkner.de/wissen/n..._1.0_armel.deb
Local installation:
Currently mplayer is slow. Therefore the scripts might not be that useful. Maybe it is better to integrate the touch-screen interface in vlc.
The code can also be used for other applications.
Last edited by TorstenT; 2010-07-30 at 22:33.