Notices


Reply
Thread Tools
Posts: 45 | Thanked: 45 times | Joined on Jul 2010 @ Berlin
#1
Yet another mplayer interface !


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:
Code:
wget http://torsten-traenkner.de/wissen/n900/mplayer-touchcontrol_1.0_armel.deb
sudo gainroot
dpkg -i mplayer-touchcontrol_1.0_armel.deb
To use the scripts open a terminal and use "mm". For example:
Code:
mm /home/user/MyDocs/.videos/Nokia_N900.mp4

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.
Code:
The main script is:
/opt/maemo/usr/bin/mplayer-touchcontrol/touchscreenEvents.py

it reads the touch screen events from the touch screen device

/dev/input/ts
Torsten

Last edited by TorstenT; 2010-07-30 at 22:33.
 

The Following 7 Users Say Thank You to TorstenT For This Useful Post:
jd4200's Avatar
Posts: 451 | Thanked: 424 times | Joined on Apr 2010 @ England
#2
This looks neat. Any chance you can post the sources? I'd prefer to look at them before installing.
__________________
BTC:
19ePiXZUdxqNAq9tStLzZV4dduSQeGPJzj
 
Bundyo's Avatar
Posts: 4,708 | Thanked: 4,649 times | Joined on Oct 2007 @ Bulgaria
#3
They are probably in the package (python + shell?).
__________________
Technically, there are three determinate states the cat could be in: Alive, Dead, and Bloody Furious.
 
Posts: 45 | Thanked: 45 times | Joined on Jul 2010 @ Berlin
#4
Originally Posted by jd4200 View Post
This looks neat. Any chance you can post the sources? I'd prefer to look at them before installing.
Read the sources without installation:

Code:
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
Basically, I read the events from /dev/input/ts. These are 16 byte for each touch on the screen.

Meanwhile, I have found MediaBox. Maybe the touchscreen interface would fit best into MediaBox since it has a better performance than mplayer.

Here is the code of the main script:

Code:
#!/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)
Torsten

Last edited by TorstenT; 2010-08-05 at 23:10.
 

The Following User Says Thank You to TorstenT For This Useful Post:
pycage's Avatar
Posts: 3,404 | Thanked: 4,474 times | Joined on Oct 2005 @ Germany
#5
Originally Posted by TorstenT View Post
Meanwhile, I have found MediaBox. Maybe the touchscreen interface would fit best into MediaBox since it has a better performance than mplayer.
Thanks for sharing. This could really be useful as a full screen control interface for MediaBox.
__________________
Tidings - RSS and Podcast aggregator for Jolla - https://github.com/pycage/tidings
Cargo Dock - file/cloud manager for Jolla - https://github.com/pycage/cargodock
 
Reply


 
Forum Jump


All times are GMT. The time now is 15:49.