TV-Out, KDE and Xine

Friday, February 24th, 2006 - Español English

If, like me, you happen to be using an NVidia based graphics adapter with TV-Out, you might find useful the following instructions to configure it, adding a KDE service menu to watch your movies on the TV with a single click.

Three steps are necessary:

  1. Configure your X server, creating a TV dedicated layout. We’ll later start X using this setup.
  2. Create a script to start X, running xine with the file we want.
  3. Create a .desktop file which inokes this script for the MIME types video/*.

1. First we must have NVidia’s driver installed and running. This has already been discused elsewhere, so there is no need to elaborate. Once it is done (I recommend applying NVidia’s patches, which are posted on the forums), append the following to your /etc/X11/xorg.conf file:

  1. #### Configuración para la salida de TV de NVidia <nonick AT 8027 DOT org>
  2. #
  3. # ATENCIÓN: aquí se hace referencia a las secciones "Mouse[2]" y "Keyboard[0]"
  4. # Deberás sustituir estos identificadores por los tuyos.
  5. #
  6.  
  7. Section "Monitor"
  8. HorizSync 30-50
  9. VertRefresh 60
  10. Identifier "tv"
  11. EndSection
  12.  
  13. Section "Screen"
  14. Identifier "Screen_tv"
  15. Device "Card_tv"
  16. Monitor "tv"
  17. DefaultDepth 24
  18. EndSection
  19.  
  20. Section "Device"
  21. Identifier "Card_tv"
  22. Driver "nvidia"
  23. BusID "1:0:0" # May differ (not needed unless you have two or more cards)
  24. Option "TVOutFormat" "COMPOSITE" # or "SVIDEO" ?
  25. Option "TVStandard" "PAL-B"
  26. Option "ConnectedMonitor" "TV"
  27. EndSection
  28.  
  29. Section "ServerLayout"
  30. Identifier "tv"
  31. Screen 0 "Screen_tv" 0 0
  32. InputDevice "Mouse[2]" "CorePointer"
  33. InputDevice "Keyboard[0]" "CoreKeyboard"
  34. EndSection

2. Now you need the script to start the X server using the new tv layout. You can use the following if you like it; just save it somewhere and set it executable with chmod +x /path/to/your/file/tvout.sh:

  1. #!/bin/bash
  2. #
  3. # v0.1 [ Thu May 19 09:23:04 CET 2005 <nonick AT 8027 DOT org> ]
  4. # v0.2 [ Fri Feb 24 03:52:39 CET 2006 <nonick AT 8027 DOT org> ]
  5. # v0.3 [ Mon Jul 10 12:02:50 CEST 2006 <nonick AT 8027 DOT org> ]
  6.  
  7. xineexec="/usr/bin/xine"
  8. fileexec="/usr/bin/file"
  9. wmanager="/usr/X11R6/bin/twm"
  10. tvlayout="tv"
  11.  
  12. if [ ! -z "$1" ]
  13. then
  14. run="$xineexec -f -g"
  15. arg=$1
  16. # Se trata de una imagen ISO?
  17. if expr match "$arg" '.*\(\.iso\)'
  18. then
  19. # Es una imagen válida? Sólo lo comprobamos si existe $fileexec
  20. if [ -x "$fileexec" ] && file=$(file --brief "$arg") && \
  21. ! expr match "$file" '\(ISO 9660\)'
  22. then
  23. kdialog --error "'$arg' no es una imagen ISO válida.\n$fileexec dijo: $file"
  24. exit 1
  25. fi
  26. msg="¿Quieres ver la imagen ISO '$arg' en la TV mediante xine?"
  27. arg="dvd://$arg"
  28. # Es un fichero normal:
  29. else
  30. msg="¿Quieres ver '$arg' en la TV mediante xine?"
  31. fi
  32. else
  33. run=$wmanager
  34. arg=""
  35. msg="¿Quieres activar la salida de televisión?"
  36. fi
  37.  
  38. kdialog --warningyesno "$msg"
  39.  
  40. if (( $? == 0 ))
  41. then
  42. # Comprobamos que se puede ver
  43. if [ ! -z "$arg" ] && [ -d "$arg" ] && [ ! -f "$arg" ] && [ -z "${arg#dvd:}" ]
  44. then
  45. kdialog --error "'$arg' no es un directorio o fichero válido."
  46. exit 1
  47. fi
  48.  
  49. exec /usr/X11R6/bin/xinit $run "$arg" -- /usr/X11R6/bin/X :9 -layout $tvlayout
  50. fi

3. Finally, we add the konqueror context menu entry which will show when clicking thr right mouse button over a video file. Save the following file in .kde/share/apps/konqueror/servicemenus, just changing the path to your script:

  1. #
  2. # View file via TV out
  3. #
  4. # v0.1 [ Fri Feb 24 09:26:15 CET 2006 <nonick AT 8027 DOT org> ]
  5. # v0.2 [ Mon Jul 10 11:42:50 CEST 2006 <nonick AT 8027 DOT org> ]
  6.  
  7. [Desktop Entry]
  8. Encoding=UTF-8
  9. ServiceTypes=video/*,application/x-iso
  10. TryExec=tvout.sh
  11. Icon=tv
  12. Actions=ViewOnTV
  13.  
  14. [Desktop Action ViewOnTV]
  15. Name=View on TV
  16. Name[fr]=Voir à la télé
  17. Name[es]=Ver por la TV
  18. Icon=tv
  19. Exec=tvout.sh "%U"

4. Have fun!

One Response to “ TV-Out, KDE and Xine ”

  1. nonick Says:

    UPDATE: I just added the ability to view DVD ISO 9660 images. The context menu will appear when right-clicking one of those and xine will try to open it as a dvd. The script tries to check for file validity but cannot go as far as checking whether it actually is a movie or not.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>