diff options
| author | root <root@elwms02.(none)> | 2010-04-06 16:13:08 +0200 |
|---|---|---|
| committer | root <root@elwms02.(none)> | 2010-04-06 16:13:08 +0200 |
| commit | 0e7005fcc7483c01aa102fbea358c5ac65a48d62 (patch) | |
| tree | 11517ce0d3d2977c6732b3aa583b0008083e0bd3 /utilities | |
| download | x-vdr-0e7005fcc7483c01aa102fbea358c5ac65a48d62.tar.gz x-vdr-0e7005fcc7483c01aa102fbea358c5ac65a48d62.tar.bz2 | |
hello world
Diffstat (limited to 'utilities')
59 files changed, 13291 insertions, 0 deletions
diff --git a/utilities/LCDproc/LCDd.conf b/utilities/LCDproc/LCDd.conf new file mode 100644 index 0000000..f519d60 --- /dev/null +++ b/utilities/LCDproc/LCDd.conf @@ -0,0 +1,787 @@ +# LCDd.conf +# +# This file contains the configuration for the LCDd server. +# +# The format is ini-file-like. It is divided into sections that start at +# markers that look like [section]. Comments are all line-based comments, +# and are lines that start with '#' or ';'. +# +# The server has a 'central' section named [server]. For the menu there is +# a section called [menu]. Further each driver has a section which +# defines how the driver acts. +# +# The drivers are activated by specifiying them in a driver= line in the +# server section, like: +# +# Driver=curses +# +# This tells LCDd to use the curses driver. +# The first driver that is loaded and is capable of output defines the +# size of the display. The default driver to use is curses. +# If -d is specified on the command line, the Driver= options in the +# config file are ignored. +# +# The drivers read their own options from the respective sections. + + + +## Server section with all kinds of settings for the LCDd server ## +[server] + +# Tells the server to load the given drivers. Multiple lines can be given. +# The name of the driver is exactly the same as the name of the driver +# module that is to be loaded, including the case of the letters ! +# (That is: unless a file= option is given in the driver section) +#Driver=curses +Driver=CFontzPacket +#Driver=hd44780 +#Driver=IOWarrior +#Driver=MtxOrb +#Driver=CFontz633 +#Driver=CwLnx +#Driver=glcdlib +#Driver=imon +#Driver=NoritakeVFD +#Driver=serialVFD + +# Tells the driver to bind to the given interface +Bind=127.0.0.1 + +# Listen on this specified port; defaults to 13666. +Port=13666 + +# Sets the reporting level; defaults to 2 (warnings and errors only). +#ReportLevel=3 + +# Should we report to syslog instead of stderr ? Default: no +#ReportToSyslog=yes + +# Sets the default time in seconds to displays a screen. +WaitTime=5 + +# User to run as. LCDd will drop its root priviledges, +# if any, and run as this user instead. +User=nobody + +# If yes, the the serverscreen will be rotated as a usual info screen. If no, +# it will be a background screen, only visible when no other screens are +# active. +ServerScreen=no + +# The server will stay in the foreground if set to true. +Foreground=no + +# Where can we find the driver modules ? +# IMPORTANT: Make sure to change this setting to reflect your +# specific setup! Otherwise LCDd won't be able to find +# the driver modules and will thus not be able to +# function properly. +# NOTE: Always place a slash as last character ! +DriverPath=/usr/lib/lcdproc/ + +# The "...Key=" lines define what the server does with keypresses that +# don't go to any client. +# These are the defaults: +ToggleRotateKey=Enter +PrevScreenKey=Left +NextScreenKey=Right +#ScrollUpKey=Up +#ScrollDownKey=Down + +# If you have only 4 keys, you can choose to use this: +#ToggleRotateKey=Enter +#PrevScreenKey=Up +#NextScreenKey=Down + +# If you have only 3 keys, you can choose to use this: +#ToggleRotateKey=Enter +#PrevScreenKey=Up + + + +## The menu section. The menu is an internal LCDproc client. ## +[menu] +# You can configure what keys the menu should use. Note that the MenuKey +# will be reserved exclusively, the others work in shared mode. + +# The following works excellent with 4 keys or more. +MenuKey=Escape +EnterKey=Enter +UpKey=Up +DownKey=Down +# If you have 6 keys you may define these as well +#LeftKey=Left +#RightKey=Right + +# If you have only 3 keys, you could use something like this: +#MenuKey=Escape +#EnterKey=Enter +#DownKey=Down + + + +### Driver sections are below this line, in alphabetical order ### + + +## EMAC BayRAD driver ## +[bayrad] + +# Select the output device to use [default: /dev/lcd] +Device=/dev/lcd + +# Set the communication speed [default: 9600; legal: 1200, 2400, 9600, 19200] +Speed=9600 + + + +## CrystalFontz driver (for CF632 & CF634) ## +[CFontz] + +# Select the output device to use [default: /dev/lcd] +Device=/dev/ttyS0 +# Select the LCD size [default: 20x4] +Size=20x4 +# Set the initial contrast [default: 140; legal: 0 - 1000] +Contrast=140 +# Set the initial brightness [default: 255; legal: 0 - 255] +Brightness=255 +# Set the initial off-brightness [default: 0; legal: 0 - 255] +# This value is used when the display is normally +# switched off in case LCDd is inactive +OffBrightness=0 +# Set the communication speed [default: 9600; legal: 1200, 2400, 9600, 19200i or 115200] +Speed=9600 +# Set the firmware version (New means >= 2.0) [default: no; legal: yes, no] +NewFirmware=no +# Reinitialize the LCD's BIOS [default: no; legal: yes, no] +# normally you shouldn't need this +Reboot=no + + + +## CrystalFontz633 driver (for CF633 only) ## +[CFontz633] + +# Select the output device to use [default: /dev/lcd] +Device=/dev/ttyS0 +# Select the LCD type (size) [default: 16x2] +Size=16x2 +# Set the initial contrast [default: 560; legal: 0 - 1000] +Contrast=140 +# Set the initial brightness [default: 1000; legal: 0 - 1000] +Brightness=1000 +# Set the initial off-brightness [default: 0; legal: 0 - 1000] +# This value is used when the display is normally +# switched off in case LCDd is inactive +OffBrightness=50 +# Set the communication speed [default: 9600; legal: 1200, 2400, 9600, 19200, 115200] +Speed=19200 +# Set the firmware version (New means >= 2.0) [default: no; legal: yes, no] +# Currently this flag is not in use, there is no such thing as NewFirmware. ;=) +#NewFirmware=no +# Reinitialize the LCD's BIOS [default: no; legal: yes, no] +# I want to reboot the LCD to make sure we start from a known state +Reboot=yes + + + +## CrystalFontz packet driver (for CF631, CF633 & CF635) ## +[CFontzPacket] + +# Select the LCD model [default: 633; legal: 631, 633, 635] +Model=635 +# Select the output device to use [default: /dev/lcd] +Device=/dev/ttyUSB0 +# Select the LCD size [default: depending on model: 635: 20x4, 631 & 633: 16x2] +Size=20x4 +# Set the initial contrast [default: 560; legal: 0 - 1000] +Contrast=350 +# Set the initial brightness [default: 1000; legal: 0 - 1000] +Brightness=1000 +# Set the initial off-brightness [default: 0; legal: 0 - 1000] +# This value is used when the display is normally +# switched off in case LCDd is inactive +OffBrightness=50 +# Set the communication speed [default: 9600; legal: 1200, 2400, 9600, 19200, 115200] +Speed=115200 +# Set the firmware version (New means >= 2.0) [default: no; legal: yes, no] +# Currently this flag is not in use, there is no such thing as NewFirmware. ;=) +#NewFirmware=no +# Reinitialize the LCD's BIOS [default: no; legal: yes, no] +# I want to reboot the LCD to make sure we start from a known state +Reboot=yes + + + +## Curses driver ## +[curses] + +# color settings +# foreground color [default: blue] +Foreground=blue +# background color when "backlight" is ff [default: cyan] +Background=cyan +# background color when "backlight" is on [default: red] +Backlight=red + +# display size [default: 20x4] +Size=20x4 + +# What position (X,Y) to start the left top corner at... +# Default: (7,7) +TopLeftX=7 +TopLeftY=7 + +# use ASC symbols for icons & bars [default: no; legal, yes, no] +UseACS=no + + + +## Cwlinux driver ## +[CwLnx] + +# Select the output device to use [default: /dev/lcd] +#Device=/dev/ttyS0 +Device=/dev/ttyUSB0 + +# Select the LCD size [default: 20x4] +Size=20x4 + +# Set the communication speed [default: 19200; legal: 9600, 19200] +Speed=19200 + +# Reinitialize the LCD's BIOS [default: no; legal: yes, no] +# normally you shouldn't need this +Reboot=no + +# If you have a keypad connected. Keypad layout is currently not +# configureable from the config file. +Keypad=yes + +# If you have a non standard keypad you can associate any keystrings to keys. +# There are 6 input key in the CwLnx hardware that generate characters +# from 'A' to 'F'. +# +# The following it the built-in default mapping hardcoded in the driver. +# You can leave those unchanged if you have a standard keypad. +# You can change it if you want to report other keystrings or have a non +# standard keypad. +# KeyMap_A=Up +# KeyMap_B=Down +# KeyMap_C=Left +# KeyMap_D=Right +# KeyMap_E=Enter +# KeyMap_F=Escape + +# keypad_test_mode permit to test keypad assignement +# Default value is no +#keypad_test_mode=yes + + + +## glcdlib meta driver for graphical LCDs ## +[glcdlib] + +## mandatory: + +# which graphical display supported by graphlcd-base to use [default: image] +# (see /etc/graphlcd.conf for possible drivers) +Driver=noritake800 + +# no=use graphlcd bitmap fonts (they have only one size / font file) +# yes=use fonts supported by FreeType2 (needs Freetype2 support in libglcdprocdriver and its dependants) +UseFT2=yes + +# text resolution in fixed width characters [default: 16x4] +# (if it won't fit according to available physical pixel resolutioni +# and the minimum available font face size in pixels, then +# 'DebugBorder' will automatically be turned on) +TextResolution=20x4 + +# path to font file to use +FontFile=/usr/share/fonts/corefonts/courbd.ttf + + +## these only apply if UseFT2=yes: + +# character encoding to use +CharEncoding=iso8859-2 + +# minumum size in pixels in which fonts should be rendered +MinFontFaceSize=7x12 + + +## optional: +Brightness=50 # Brightness (in %) if applicable +Contrast=50 # Contrast (in %) if applicable +Backlight=no # Backlight if applicable +UpsideDown=no # flip image upside down +Invert=no # invert light/dark pixels +ShowDebugFrame=no # turns on/off 1 pixel thick debugging + # border whithin the usable text area, + # for setting up TextResolution and + # MinFontFaceSize (if using FT2); +ShowBigBorder=no # border around the unused area +ShowThinBorder=yes # border around the unused area +PixelShiftX=0 +PixelShiftY=2 + + + +## Matrix Orbital GLK driver ## +[glk] + +# select the serial device to use [default: /dev/lcd] +Device=/dev/lcd + +# set the initial contrast value [default: 560; legal: 0 - 1000] +Contrast=560 + +# set the serial port speed [default: 19200; legal: 9600, 19200, 38400] +Speed=19200 + + + +## Hitachi HD44780 driver ## +[hd44780] + +# Port where the LPT is. Usual values are 0x278, 0x378 and 0x3BC +Port=0x378 + +# Select what type of connection. See documentation for types. +ConnectionType=4bit + +# If you have a keypad connected. +# You may also need to configure the keypad layout further on in this file. +Keypad=no + +# set the initial contrast (for bwctusb only) [default: 0; legal: 0 - 1000] +Contrast=0 + +# If you have a switchable backlight. +Backlight=no + +# If you have the additional output port ("bargraph") and you want to +# be able to control it with the lcdproc OUTPUT command +OutputPort=no + +# Specifies if the last line is pixel addressable or it controls an +# underline effect. [default: true (= pixel addressable); legal: yes, no] +#Lastline=true + +# Specifies the size of the LCD. +# In case of multiple combined displays, this should be the total size. +Size=20x4 + +# For multiple combined displays: how many lines does each display have. +# Vspan=2,2 means both displays have 2 lines. +#vspan=2,2 + +# If you have a KS0073 or an other 'almost HD44780-compatible', set this +# flag to get into extended mode (4-line linear). +# This flag is NOT the old obsolete Extended option. +#ExtendedMode=yes + +# If your display is slow and cannot keep up with the flow of data from +# LCDd, garbage can appear on the LCDd. Set this delay factor to 2 or 4 +# to increase the delays. Default: 1. +#DelayMult=2 + +# You can reduce the inserted delays by setting this to false. +# On fast PCs it is possible your LCD does not respond correctly. +# Default: true. +DelayBus=true + +# If you have a keypad you can assign keystrings to the keys. +# See documentation for used terms and how to wire it. +# For example to give directly connected key 4 the string "Enter", use: +# KeyDirect_4=Enter +# For matrix keys use the X and Y coordinates of the key: +# KeyMatrix_1_3=Enter +KeyMatrix_4_1=Enter +KeyMatrix_4_2=Up +KeyMatrix_4_3=Down +KeyMatrix_4_4=Escape + + + +## ICP A106 driver ## +[icp_a106] +Device=/dev/ttyS1 + + + +## Code Mercenaries IO-Warrior driver ## +[IOWarrior] + +# display dimensions +Size=20x4 + +# serial number [exactly as listed by usbview] +# (if not given, the 1st IOWarrior found gets used) +#SerialNumber=00000674 + +# Specifies if the last line is pixel addressable or it controls an +# underline effect. [default: true (= pixel addressable); legal: yes, no] +#Lastline=true + + + +## Soundgraph/Ahanix/Silverstone/Uneed/Accent iMON driver ## +[imon] + +# select the device to use +Device=/dev/lcd0 + +# display dimensions +Size=16x2 + + + +## IrMan driver ## +[IrMan] +#if in trouble with IrMan, try Lirc emulator for IrMan + +# Select the input device to use +#Device=/dev/irman + +# Select the configuration file to use +#Config=/etc/irman.cfg + + + +## Joystick driver ## +[joy] + +# Select the input device to use [default: /dev/js0] +Device=/dev/js0 + +# set the axis map +Map_Axis1neg=Left +Map_Axis1pos=Right +Map_Axis2neg=Up +Map_Axis2pos=Down + +# set the button map +Map_Button1=Enter +Map_Button2=Escape + + + +## LB216 driver ## +[lb216] + +# Select the output device to use [default: /dev/lcd] +Device=/dev/lcd + +# Set the initial brightness [default: 255; legal: 0 - 255] +Brightness=255 + +# Set the communication speed [default: 9600; legal: 2400, 9600] +Speed=9600 + +# Reinitialize the LCD's BIOS [default: no; legal: yes, no] +Reboot=no + + + +## LCDM001 driver ## +[lcdm001] + +Device=/dev/ttyS1 + +# keypad settings +# Keyname Function +# Normal context Menu context +# ------- -------------- ------------ +# PauseKey Pause/Continue Enter/select +# BackKey Back(Go to previous screen) Up/Left +# ForwardKey Forward(Go to next screen) Down/Right +# MainMenuKey Open main menu Exit/Cancel +PauseKey=LeftKey +BackKey=UpKey +ForwardKey=DownKey +MainMenuKey=RightKey + +# You can rearrange the settings here. +# If your device is broken, have a look at server/drivers/lcdm001.h + + + +## HNE LCTerm driver ## +[lcterm] +Device=/dev/ttyS1 +Size=16x2 + + + +## LIRC input driver ## +[lirc] + +# Specify an alternative location of the lircrc file [default: ~/.lircrc] +#lircrc=/etc/lircrc.lcdproc + +# Must be the same as in your lircrc +#prog=lcdd + + + +## MSI MS-6931 driver for displays in 1HU servers ## +[ms6931] + +# device to use [default: /dev/ttyS1] +Device=/dev/ttyS1 + +# display size [default: 16x2] +#Size=16x2 + + + +## MTC-S16209x driver ## +[mtc_s16209x] + +# Select the output device to use [default: /dev/lcd] +Device=/dev/lcd + +# Set the initial brightness [default: 255; legal: 0 - 255] +Brightness=255 + +# Reinitialize the LCD's BIOS [default: no; legal: yes, no] +Reboot=no + + + +## Matrix Orbital driver ## +[MtxOrb] + +# Select the output device to use [default: /dev/lcd] +Device=/dev/ttyS0 + +# Set the display size [default: 20x4] +Size=20x4 + +# Switch on the backlight? [default: yes] +# NOTE: The driver will ignore this if the display is a vfd or vkd +# as they crash if the backlight is turned off +Backlight=yes + +# Set the initial contrast [default: 480] +# NOTE: The driver will ignore this if the display +# is a vfd or vkd as they don't have this feature +Contrast=800 + +# Set the communication speed [default: 19200; legal: 1200, 2400, 9600, 19200] +Speed=19200 + +# Set the display type [default: lcd; legal: lcd, lkd, vfd, vkd] +Type=lkd + +# The following table translate from MtxOrb Key to Logical Key. +# See [input] section for an explanation of the key mappings +# This is a new implementation in 0.5 +LeftKey=A +RightKey=B +EnterKey=C +UpKey=D +DownKey=E +EscapeKey=F + +# You can find out which key of your display sends which +# character by setting keypad_test_mode to yes and running +# LCDd. LCDd will output all characters it receives. +# Afterwards you can modify the settings above and set +# keypad_set_mode to no again. +keypad_test_mode=no + + + +## Noritake VFD driver ## +[NoritakeVFD] +# device where the VFD is. Usual values are /dev/ttyS0 and /dev/ttyS1 [default: /dev/lcd] +Device=/dev/ttyS0 + +# Specifies the size of the LCD. +Size=20x4 + +# set the brightness +Brightness=255 + +# set the serial port speed [default: 9600, legal: 1200, 2400, 9600, 19200, 115200] +Speed=9600 + +# re-initialize VFD ? +#Reboot=yes + + + +## Pyramid LCD driver ## +[pyramid] + +# device to connect to [default: /dev/lcd] +Device=/dev/ttyUSB0 + + + +## Seiko Epson 1330 driver ## +[sed1330] + +# Port where the LPT is. Common values are 0x278, 0x378 and 0x3BC +Port=0x378 + +# Type of LCD module (legal: G321D, G121C, G242C, G191D, G2446) +# Note: G321D is the only one that is tested currently. +Type=G321D + + + +## Seiko Epson 1520 driver ## +[sed1520] + +# Port where the LPT is. Usual values are 0x278, 0x378 and 0x3BC +Port=0x378 + + + +## Serial VFD driver ## +## Drives various (see below) serial 5x7dot VFD's. ## +[serialVFD] +# device where the VFD is. Usual values are /dev/ttyS0 and /dev/ttyS1 +Device=/dev/ttyS1 + +# Specifies the size of the VFD. +Size=20x2 + +# Specifies the display type [default: 0] +# 0 NEC (FIPC8367 based) VFDs. +# 1 KD Rev 2.1. +# 2 Noritake VFDs (*). +# 3 Futaba VFDs (*). +# (* most should work, not testet yet.) +Type=1 + +# Display brightness [default: 255]. +# 0 min ... 255 max ... 1000 also max +# (4 steps 0-64, 65-128, 129-192, 193-1000) +Brightness=255 + +# set the serial port speed [default: 9600; legal: 1200, 2400, 9600, 19200, 115200] +Speed=9600 + +# enable ISO 8859 1 compatibility [default: yes; legal: yes, no] +ISO_8859_1=yes + + + +## stv5730 driver ## +[stv5730] + +# Port the device is connected to [default: 0x378] +Port=0x378 + + + +## SVGAlib driver ## +[svga] + +# svgalib mode to use [default: G320x240x256; legal: supported svgalib modes] +#Mode=G640x480x256 + +# set display size [default: 20x4] +Size=20x4 + +# Set the initial contrast [default: 500; legal: 0 - 1000] +# Can be set but does not change anything internally +Contrast=500 + +# Set the initial brightness [default: 1000; legal: 1 - 1000] +Brightness=1000 + +# Set the initial off-brightness [default: 500; legal: 1 - 1000] +# This value is used when the display is normally +# switched off in case LCDd is inactive +OffBrightness=500 + + + +## Text driver ## +[text] +# Set the display size [default: 20x4] +Size=20x4 + + + +## Toshiba T6963 driver ## +[t6963] + +# set display size [default: 20x6] +Size=20x6 + +# port to use [default: 0x378; legal: 0x200 - 0x400] +Port=0x378 + +# Is ECP mode on? [default: yes; legal: yes, no] +#ECPlpt=yes + +# Use graphics? [default: no; legal: yes, no] +#graphic=no + + + +## Tyan Barebones LCD driver (GS series; others too?) ## +[tyan] + +# Select the output device to use [default: /dev/lcd] +Device=/dev/lcd + +# Set the communication speed [default: 9600; legal: 4800, 9600] +Speed=9600 + +# set display size [default: 16x2] +Size=16x2 + + + +## ELV ula200 driver ## +[ula200] + +# Select the LCD size [default: 20x4] +Size=20x4 + +# If you have a non standard keypad you can associate any keystrings to keys. +# There are 6 input key in the CwLnx hardware that generate characters +# from 'A' to 'F'. +# +# The following it the built-in default mapping hardcoded in the driver. +# You can leave those unchanged if you have a standard keypad. +# You can change it if you want to report other keystrings or have a non +# standard keypad. +# KeyMap_A=Up +# KeyMap_B=Down +# KeyMap_C=Left +# KeyMap_D=Right +# KeyMap_E=Enter +# KeyMap_F=Escape + + + +## Wirz SLI LCD driver ## +[sli] + +# Select the output device to use [default: /dev/lcd] +Device=/dev/lcd + +# Set the communication speed [default: 19200; legal: 1200, 2400, 9600, 19200, 38400, 57600, 115200] +Speed=19200 + + + +## OnScreen Display using libxosd ## +[xosd] + +# set display size [default: 20x4] +Size=20x4 + +# font to use +Font=-*-terminus-*-r-*-*-*-320-*-*-*-*-* + +# EOF diff --git a/utilities/LCDproc/_LCDd.conf b/utilities/LCDproc/_LCDd.conf new file mode 100644 index 0000000..9318e3c --- /dev/null +++ b/utilities/LCDproc/_LCDd.conf @@ -0,0 +1,791 @@ +# LCDd.conf +# +# This file contains the configuration for the LCDd server. +# +# The format is ini-file-like. It is divided into sections that start at +# markers that look like [section]. Comments are all line-based comments, +# and are lines that start with '#' or ';'. +# +# The server has a 'central' section named [server]. For the menu there is +# a section called [menu]. Further each driver has a section which +# defines how the driver acts. +# +# The drivers are activated by specifiying them in a driver= line in the +# server section, like: +# +# Driver=curses +# +# This tells LCDd to use the curses driver. +# The first driver that is loaded and is capable of output defines the +# size of the display. The default driver to use is curses. +# If -d is specified on the command line, the Driver= options in the +# config file are ignored. +# +# The drivers read their own options from the respective sections. + + + +## Server section with all kinds of settings for the LCDd server ## +[server] + +# Tells the server to load the given drivers. Multiple lines can be given. +# The name of the driver is exactly the same as the name of the driver +# module that is to be loaded, including the case of the letters ! +# (That is: unless a file= option is given in the driver section) +#Driver=curses +Driver=CFontzPacket +#Driver=hd44780 +#Driver=IOWarrior +#Driver=MtxOrb +#Driver=CFontz633 +#Driver=CwLnx +#Driver=glcdlib +#Driver=imon +#Driver=NoritakeVFD +#Driver=serialVFD + +# Tells the driver to bind to the given interface +Bind=127.0.0.1 + +# Listen on this specified port; defaults to 13666. +Port=13666 + +# Sets the reporting level; defaults to 2 (warnings and errors only). +#ReportLevel=3 + +# Should we report to syslog instead of stderr ? Default: no +#ReportToSyslog=yes + +# Sets the default time in seconds to displays a screen. +WaitTime=5 + +# User to run as. LCDd will drop its root priviledges, +# if any, and run as this user instead. +User=nobody + +# If yes, the the serverscreen will be rotated as a usual info screen. If no, +# it will be a background screen, only visible when no other screens are +# active. +ServerScreen=no + +# The server will stay in the foreground if set to true. +Foreground=no + +# Where can we find the driver modules ? +# IMPORTANT: Make sure to change this setting to reflect your +# specific setup! Otherwise LCDd won't be able to find +# the driver modules and will thus not be able to +# function properly. +# NOTE: Always place a slash as last character ! +DriverPath=/usr/lib/lcdproc/ + +# GoodBye message: each entry represents a display line; default: builtin +#GoodBye="Thanks for using" +#GoodBye=" LCDproc!" + +# The "...Key=" lines define what the server does with keypresses that +# don't go to any client. +# These are the defaults: +ToggleRotateKey=Enter +PrevScreenKey=Left +NextScreenKey=Right +#ScrollUpKey=Up +#ScrollDownKey=Down + +# If you have only 4 keys, you can choose to use this: +#ToggleRotateKey=Enter +#PrevScreenKey=Up +#NextScreenKey=Down + +# If you have only 3 keys, you can choose to use this: +#ToggleRotateKey=Enter +#PrevScreenKey=Up + + + +## The menu section. The menu is an internal LCDproc client. ## +[menu] +# You can configure what keys the menu should use. Note that the MenuKey +# will be reserved exclusively, the others work in shared mode. + +# The following works excellent with 4 keys or more. +MenuKey=Escape +EnterKey=Enter +UpKey=Up +DownKey=Down +# If you have 6 keys you may define these as well +#LeftKey=Left +#RightKey=Right + +# If you have only 3 keys, you could use something like this: +#MenuKey=Escape +#EnterKey=Enter +#DownKey=Down + + + +### Driver sections are below this line, in alphabetical order ### + + +## EMAC BayRAD driver ## +[bayrad] + +# Select the output device to use [default: /dev/lcd] +Device=/dev/lcd + +# Set the communication speed [default: 9600; legal: 1200, 2400, 9600, 19200] +Speed=9600 + + + +## CrystalFontz driver (for CF632 & CF634) ## +[CFontz] + +# Select the output device to use [default: /dev/lcd] +Device=/dev/ttyS0 +# Select the LCD size [default: 20x4] +Size=20x4 +# Set the initial contrast [default: 140; legal: 0 - 1000] +Contrast=140 +# Set the initial brightness [default: 255; legal: 0 - 255] +Brightness=255 +# Set the initial off-brightness [default: 0; legal: 0 - 255] +# This value is used when the display is normally +# switched off in case LCDd is inactive +OffBrightness=0 +# Set the communication speed [default: 9600; legal: 1200, 2400, 9600, 19200i or 115200] +Speed=9600 +# Set the firmware version (New means >= 2.0) [default: no; legal: yes, no] +NewFirmware=no +# Reinitialize the LCD's BIOS [default: no; legal: yes, no] +# normally you shouldn't need this +Reboot=no + + + +## CrystalFontz633 driver (for CF633 only) ## +[CFontz633] + +# Select the output device to use [default: /dev/lcd] +Device=/dev/ttyS0 +# Select the LCD type (size) [default: 16x2] +Size=16x2 +# Set the initial contrast [default: 560; legal: 0 - 1000] +Contrast=140 +# Set the initial brightness [default: 1000; legal: 0 - 1000] +Brightness=1000 +# Set the initial off-brightness [default: 0; legal: 0 - 1000] +# This value is used when the display is normally +# switched off in case LCDd is inactive +OffBrightness=50 +# Set the communication speed [default: 9600; legal: 1200, 2400, 9600, 19200, 115200] +Speed=19200 +# Set the firmware version (New means >= 2.0) [default: no; legal: yes, no] +# Currently this flag is not in use, there is no such thing as NewFirmware. ;=) +#NewFirmware=no +# Reinitialize the LCD's BIOS [default: no; legal: yes, no] +# I want to reboot the LCD to make sure we start from a known state +Reboot=yes + + + +## CrystalFontz packet driver (for CF631, CF633 & CF635) ## +[CFontzPacket] + +# Select the LCD model [default: 633; legal: 631, 633, 635] +Model=631 +# Select the output device to use [default: /dev/lcd] +Device=/dev/ttyUSB0 +# Select the LCD size [default: depending on model: 635: 20x4, 631 & 633: 16x2] +Size=20x2 +# Set the initial contrast [default: 560; legal: 0 - 1000] +Contrast=350 +# Set the initial brightness [default: 1000; legal: 0 - 1000] +Brightness=1000 +# Set the initial off-brightness [default: 0; legal: 0 - 1000] +# This value is used when the display is normally +# switched off in case LCDd is inactive +OffBrightness=50 +# Set the communication speed [default: 9600; legal: 1200, 2400, 9600, 19200, 115200] +Speed=115200 +# Set the firmware version (New means >= 2.0) [default: no; legal: yes, no] +# Currently this flag is not in use, there is no such thing as NewFirmware. ;=) +#NewFirmware=no +# Reinitialize the LCD's BIOS [default: no; legal: yes, no] +# I want to reboot the LCD to make sure we start from a known state +Reboot=yes + + + +## Curses driver ## +[curses] + +# color settings +# foreground color [default: blue] +Foreground=blue +# background color when "backlight" is ff [default: cyan] +Background=cyan +# background color when "backlight" is on [default: red] +Backlight=red + +# display size [default: 20x4] +Size=20x4 + +# What position (X,Y) to start the left top corner at... +# Default: (7,7) +TopLeftX=7 +TopLeftY=7 + +# use ASC symbols for icons & bars [default: no; legal, yes, no] +UseACS=no + + + +## Cwlinux driver ## +[CwLnx] + +# Select the output device to use [default: /dev/lcd] +#Device=/dev/ttyS0 +Device=/dev/ttyUSB0 + +# Select the LCD size [default: 20x4] +Size=20x4 + +# Set the communication speed [default: 19200; legal: 9600, 19200] +Speed=19200 + +# Reinitialize the LCD's BIOS [default: no; legal: yes, no] +# normally you shouldn't need this +Reboot=no + +# If you have a keypad connected. Keypad layout is currently not +# configureable from the config file. +Keypad=yes + +# If you have a non standard keypad you can associate any keystrings to keys. +# There are 6 input key in the CwLnx hardware that generate characters +# from 'A' to 'F'. +# +# The following it the built-in default mapping hardcoded in the driver. +# You can leave those unchanged if you have a standard keypad. +# You can change it if you want to report other keystrings or have a non +# standard keypad. +# KeyMap_A=Up +# KeyMap_B=Down +# KeyMap_C=Left +# KeyMap_D=Right +# KeyMap_E=Enter +# KeyMap_F=Escape + +# keypad_test_mode permit to test keypad assignement +# Default value is no +#keypad_test_mode=yes + + + +## glcdlib meta driver for graphical LCDs ## +[glcdlib] + +## mandatory: + +# which graphical display supported by graphlcd-base to use [default: image] +# (see /etc/graphlcd.conf for possible drivers) +Driver=noritake800 + +# no=use graphlcd bitmap fonts (they have only one size / font file) +# yes=use fonts supported by FreeType2 (needs Freetype2 support in libglcdprocdriver and its dependants) +UseFT2=yes + +# text resolution in fixed width characters [default: 16x4] +# (if it won't fit according to available physical pixel resolutioni +# and the minimum available font face size in pixels, then +# 'DebugBorder' will automatically be turned on) +TextResolution=20x4 + +# path to font file to use +FontFile=/usr/share/fonts/corefonts/courbd.ttf + + +## these only apply if UseFT2=yes: + +# character encoding to use +CharEncoding=iso8859-2 + +# minumum size in pixels in which fonts should be rendered +MinFontFaceSize=7x12 + + +## optional: +Brightness=50 # Brightness (in %) if applicable +Contrast=50 # Contrast (in %) if applicable +Backlight=no # Backlight if applicable +UpsideDown=no # flip image upside down +Invert=no # invert light/dark pixels +ShowDebugFrame=no # turns on/off 1 pixel thick debugging + # border whithin the usable text area, + # for setting up TextResolution and + # MinFontFaceSize (if using FT2); +ShowBigBorder=no # border around the unused area +ShowThinBorder=yes # border around the unused area +PixelShiftX=0 +PixelShiftY=2 + + + +## Matrix Orbital GLK driver ## +[glk] + +# select the serial device to use [default: /dev/lcd] +Device=/dev/lcd + +# set the initial contrast value [default: 560; legal: 0 - 1000] +Contrast=560 + +# set the serial port speed [default: 19200; legal: 9600, 19200, 38400] +Speed=19200 + + + +## Hitachi HD44780 driver ## +[hd44780] + +# Port where the LPT is. Usual values are 0x278, 0x378 and 0x3BC +Port=0x378 + +# Select what type of connection. See documentation for types. +ConnectionType=4bit + +# If you have a keypad connected. +# You may also need to configure the keypad layout further on in this file. +Keypad=no + +# set the initial contrast (for bwctusb only) [default: 0; legal: 0 - 1000] +Contrast=0 + +# If you have a switchable backlight. +Backlight=no + +# If you have the additional output port ("bargraph") and you want to +# be able to control it with the lcdproc OUTPUT command +OutputPort=no + +# Specifies if the last line is pixel addressable or it controls an +# underline effect. [default: true (= pixel addressable); legal: yes, no] +#Lastline=true + +# Specifies the size of the LCD. +# In case of multiple combined displays, this should be the total size. +Size=20x4 + +# For multiple combined displays: how many lines does each display have. +# Vspan=2,2 means both displays have 2 lines. +#vspan=2,2 + +# If you have a KS0073 or an other 'almost HD44780-compatible', set this +# flag to get into extended mode (4-line linear). +# This flag is NOT the old obsolete Extended option. +#ExtendedMode=yes + +# If your display is slow and cannot keep up with the flow of data from +# LCDd, garbage can appear on the LCDd. Set this delay factor to 2 or 4 +# to increase the delays. Default: 1. +#DelayMult=2 + +# You can reduce the inserted delays by setting this to false. +# On fast PCs it is possible your LCD does not respond correctly. +# Default: true. +DelayBus=true + +# If you have a keypad you can assign keystrings to the keys. +# See documentation for used terms and how to wire it. +# For example to give directly connected key 4 the string "Enter", use: +# KeyDirect_4=Enter +# For matrix keys use the X and Y coordinates of the key: +# KeyMatrix_1_3=Enter +KeyMatrix_4_1=Enter +KeyMatrix_4_2=Up +KeyMatrix_4_3=Down +KeyMatrix_4_4=Escape + + + +## ICP A106 driver ## +[icp_a106] +Device=/dev/ttyS1 + + + +## Code Mercenaries IO-Warrior driver ## +[IOWarrior] + +# display dimensions +Size=20x4 + +# serial number [exactly as listed by usbview] +# (if not given, the 1st IOWarrior found gets used) +#SerialNumber=00000674 + +# Specifies if the last line is pixel addressable or it controls an +# underline effect. [default: true (= pixel addressable); legal: yes, no] +#Lastline=true + + + +## Soundgraph/Ahanix/Silverstone/Uneed/Accent iMON driver ## +[imon] + +# select the device to use +Device=/dev/lcd0 + +# display dimensions +Size=16x2 + + + +## IrMan driver ## +[IrMan] +#if in trouble with IrMan, try Lirc emulator for IrMan + +# Select the input device to use +#Device=/dev/irman + +# Select the configuration file to use +#Config=/etc/irman.cfg + + + +## Joystick driver ## +[joy] + +# Select the input device to use [default: /dev/js0] +Device=/dev/js0 + +# set the axis map +Map_Axis1neg=Left +Map_Axis1pos=Right +Map_Axis2neg=Up +Map_Axis2pos=Down + +# set the button map +Map_Button1=Enter +Map_Button2=Escape + + + +## LB216 driver ## +[lb216] + +# Select the output device to use [default: /dev/lcd] +Device=/dev/lcd + +# Set the initial brightness [default: 255; legal: 0 - 255] +Brightness=255 + +# Set the communication speed [default: 9600; legal: 2400, 9600] +Speed=9600 + +# Reinitialize the LCD's BIOS [default: no; legal: yes, no] +Reboot=no + + + +## LCDM001 driver ## +[lcdm001] + +Device=/dev/ttyS1 + +# keypad settings +# Keyname Function +# Normal context Menu context +# ------- -------------- ------------ +# PauseKey Pause/Continue Enter/select +# BackKey Back(Go to previous screen) Up/Left +# ForwardKey Forward(Go to next screen) Down/Right +# MainMenuKey Open main menu Exit/Cancel +PauseKey=LeftKey +BackKey=UpKey +ForwardKey=DownKey +MainMenuKey=RightKey + +# You can rearrange the settings here. +# If your device is broken, have a look at server/drivers/lcdm001.h + + + +## HNE LCTerm driver ## +[lcterm] +Device=/dev/ttyS1 +Size=16x2 + + + +## LIRC input driver ## +[lirc] + +# Specify an alternative location of the lircrc file [default: ~/.lircrc] +#lircrc=/etc/lircrc.lcdproc + +# Must be the same as in your lircrc +#prog=lcdd + + + +## MSI MS-6931 driver for displays in 1HU servers ## +[ms6931] + +# device to use [default: /dev/ttyS1] +Device=/dev/ttyS1 + +# display size [default: 16x2] +#Size=16x2 + + + +## MTC-S16209x driver ## +[mtc_s16209x] + +# Select the output device to use [default: /dev/lcd] +Device=/dev/lcd + +# Set the initial brightness [default: 255; legal: 0 - 255] +Brightness=255 + +# Reinitialize the LCD's BIOS [default: no; legal: yes, no] +Reboot=no + + + +## Matrix Orbital driver ## +[MtxOrb] + +# Select the output device to use [default: /dev/lcd] +Device=/dev/ttyS0 + +# Set the display size [default: 20x4] +Size=20x4 + +# Switch on the backlight? [default: yes] +# NOTE: The driver will ignore this if the display is a vfd or vkd +# as they crash if the backlight is turned off +Backlight=yes + +# Set the initial contrast [default: 480] +# NOTE: The driver will ignore this if the display +# is a vfd or vkd as they don't have this feature +Contrast=800 + +# Set the communication speed [default: 19200; legal: 1200, 2400, 9600, 19200] +Speed=19200 + +# Set the display type [default: lcd; legal: lcd, lkd, vfd, vkd] +Type=lkd + +# The following table translate from MtxOrb Key to Logical Key. +# See [input] section for an explanation of the key mappings +# This is a new implementation in 0.5 +LeftKey=A +RightKey=B +EnterKey=C +UpKey=D +DownKey=E +EscapeKey=F + +# You can find out which key of your display sends which +# character by setting keypad_test_mode to yes and running +# LCDd. LCDd will output all characters it receives. +# Afterwards you can modify the settings above and set +# keypad_set_mode to no again. +keypad_test_mode=no + + + +## Noritake VFD driver ## +[NoritakeVFD] +# device where the VFD is. Usual values are /dev/ttyS0 and /dev/ttyS1 [default: /dev/lcd] +Device=/dev/ttyS0 + +# Specifies the size of the LCD. +Size=20x4 + +# set the brightness +Brightness=255 + +# set the serial port speed [default: 9600, legal: 1200, 2400, 9600, 19200, 115200] +Speed=9600 + +# re-initialize VFD ? +#Reboot=yes + + + +## Pyramid LCD driver ## +[pyramid] + +# device to connect to [default: /dev/lcd] +Device=/dev/ttyUSB0 + + + +## Seiko Epson 1330 driver ## +[sed1330] + +# Port where the LPT is. Common values are 0x278, 0x378 and 0x3BC +Port=0x378 + +# Type of LCD module (legal: G321D, G121C, G242C, G191D, G2446) +# Note: G321D is the only one that is tested currently. +Type=G321D + + + +## Seiko Epson 1520 driver ## +[sed1520] + +# Port where the LPT is. Usual values are 0x278, 0x378 and 0x3BC +Port=0x378 + + + +## Serial VFD driver ## +## Drives various (see below) serial 5x7dot VFD's. ## +[serialVFD] +# device where the VFD is. Usual values are /dev/ttyS0 and /dev/ttyS1 +Device=/dev/ttyS1 + +# Specifies the size of the VFD. +Size=20x2 + +# Specifies the display type [default: 0] +# 0 NEC (FIPC8367 based) VFDs. +# 1 KD Rev 2.1. +# 2 Noritake VFDs (*). +# 3 Futaba VFDs (*). +# (* most should work, not testet yet.) +Type=1 + +# Display brightness [default: 255]. +# 0 min ... 255 max ... 1000 also max +# (4 steps 0-64, 65-128, 129-192, 193-1000) +Brightness=255 + +# set the serial port speed [default: 9600; legal: 1200, 2400, 9600, 19200, 115200] +Speed=9600 + +# enable ISO 8859 1 compatibility [default: yes; legal: yes, no] +ISO_8859_1=yes + + + +## stv5730 driver ## +[stv5730] + +# Port the device is connected to [default: 0x378] +Port=0x378 + + + +## SVGAlib driver ## +[svga] + +# svgalib mode to use [default: G320x240x256; legal: supported svgalib modes] +#Mode=G640x480x256 + +# set display size [default: 20x4] +Size=20x4 + +# Set the initial contrast [default: 500; legal: 0 - 1000] +# Can be set but does not change anything internally +Contrast=500 + +# Set the initial brightness [default: 1000; legal: 1 - 1000] +Brightness=1000 + +# Set the initial off-brightness [default: 500; legal: 1 - 1000] +# This value is used when the display is normally +# switched off in case LCDd is inactive +OffBrightness=500 + + + +## Text driver ## +[text] +# Set the display size [default: 20x4] +Size=20x4 + + + +## Toshiba T6963 driver ## +[t6963] + +# set display size [default: 20x6] +Size=20x6 + +# port to use [default: 0x378; legal: 0x200 - 0x400] +Port=0x378 + +# Is ECP mode on? [default: yes; legal: yes, no] +#ECPlpt=yes + +# Use graphics? [default: no; legal: yes, no] +#graphic=no + + + +## Tyan Barebones LCD driver (GS series; others too?) ## +[tyan] + +# Select the output device to use [default: /dev/lcd] +Device=/dev/lcd + +# Set the communication speed [default: 9600; legal: 4800, 9600] +Speed=9600 + +# set display size [default: 16x2] +Size=16x2 + + + +## ELV ula200 driver ## +[ula200] + +# Select the LCD size [default: 20x4] +Size=20x4 + +# If you have a non standard keypad you can associate any keystrings to keys. +# There are 6 input key in the CwLnx hardware that generate characters +# from 'A' to 'F'. +# +# The following it the built-in default mapping hardcoded in the driver. +# You can leave those unchanged if you have a standard keypad. +# You can change it if you want to report other keystrings or have a non +# standard keypad. +# KeyMap_A=Up +# KeyMap_B=Down +# KeyMap_C=Left +# KeyMap_D=Right +# KeyMap_E=Enter +# KeyMap_F=Escape + + + +## Wirz SLI LCD driver ## +[sli] + +# Select the output device to use [default: /dev/lcd] +Device=/dev/lcd + +# Set the communication speed [default: 19200; legal: 1200, 2400, 9600, 19200, 38400, 57600, 115200] +Speed=19200 + + + +## OnScreen Display using libxosd ## +[xosd] + +# set display size [default: 20x4] +Size=20x4 + +# font to use +Font=-*-terminus-*-r-*-*-*-320-*-*-*-*-* + +# EOF diff --git a/utilities/LCDproc/lcdd b/utilities/LCDproc/lcdd new file mode 100644 index 0000000..effd7df --- /dev/null +++ b/utilities/LCDproc/lcdd @@ -0,0 +1,47 @@ +#!/bin/sh +# /etc/init.d/lcdd + +KILL="/usr/bin/killall -q -e -TERM" + +# load VDR configuration +. /etc/default/vdr + +if [ "$LCDproc" != "on" ]; then + echo "LCDd - exit 0" + echo "#####################################################" + echo "## To Start the LCD-Daemon you may set ##" + echo "## LCDproc=\"on\" in /etc/default/vdr ##" + echo "#####################################################" + exit 0 +fi + +case "$1" in + start) + # starting LCD-Daemon + echo "Starting LCDd" + LCDd -c /etc/LCDd.conf & +# sleep 1 +# lcdexec -c /etc/lcdexec.conf & + ;; + stop) + # stopping LCD-Daemon + echo "Stopping LCDd" +# $KILL lcdexec + $KILL LCDd + ;; + restart | force-reload) + $0 stop + for i in `seq 1 5`; do + echo -n "#" + sleep 1 + done + echo "" + $0 start + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload}" + exit 1 + ;; +esac + +exit 0 diff --git a/utilities/LCDproc/lcdexec.conf b/utilities/LCDproc/lcdexec.conf new file mode 100644 index 0000000..a9422ed --- /dev/null +++ b/utilities/LCDproc/lcdexec.conf @@ -0,0 +1,75 @@ +# lcdexec LCDproc client configuration file + +## general options for lcdexec ## +[lcdexec] +# address of the LCDd server to connect to +Address=localhost + +# Port of the server to connect to +Port=13666 + +# set reporting level +ReportLevel=2 + +# report to to syslog ? +ReportToSyslog=false + +# run in foreground [default: false; legal: true, false] +Foreground=false + +# display name for the main menu [default: lcdexec HOST] +DisplayName=lcdexec + + +# main menu definition +[MainMenu] +Entry=MenuA +Entry=MenuB + +# menu definition +[MenuA] +DisplayName="VDR" +Entry=CmdA +Entry=CmdB +Entry=CmdC + +[CmdA] +DisplayName="VDR neustarten" +Exec="/usr/lib/vdr/scripts/vdr2root vdr-restart" + +[CmdB] +DisplayName="VDR starten" +Exec="/usr/lib/vdr/scripts/vdr2root vdr-start" + +[CmdC] +DisplayName="VDR beenden" +Exec="/usr/lib/vdr/scripts/vdr2root vdr-stop" + +# menu definition +[MenuB] +DisplayName="System" +Entry=CmdD +Entry=CmdE + +[CmdD] +DisplayName="System beenden" +Exec="/usr/lib/vdr/scripts/vdr2root shutdown" + +[CmdE] +DisplayName="System neustarten" +Exec="/usr/lib/vdr/scripts/vdr2root reboot" + + +# Further Extensions: +# - shell selectable in command sections +# - type definitions instead implicit depending on Exec/Entry +# (the latter only as fallback) +# - use input for parameters e.g. IP-Adresses, Sliders +# e.g. Exec="ifconfig ${IF} ${IP} netmask ${MASK} broadcast ${BCAST}" +# where +# - ${IF} is the result of a selection input screen +# - ${IP}, ${MASK}n ${BCAST} are the results of IP input screens +# - display result if a command on the display +# - jump to other menus depending on the output/result of a command + +# EOF diff --git a/utilities/LCDproc/utilitie.sh b/utilities/LCDproc/utilitie.sh new file mode 100644 index 0000000..f7901c9 --- /dev/null +++ b/utilities/LCDproc/utilitie.sh @@ -0,0 +1,109 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 24.01.2009 + +# LCDproc - LCD Daemon und Module + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +WEB="http://dfn.dl.sourceforge.net/sourceforge/lcdproc/lcdproc-0.5.2.tar.gz" +VERSION="lcdproc-0.5.2" +LINK="lcdproc" +VAR=`basename $WEB` +DIR=`pwd` + +# install +function make_util() { + # pre install + status=`status_util` + if [ "$status" != "0" ]; then + apt_remove "lcdproc" + fi + download_util + extract_util + + # setzen des symlinks + cd $SOURCEDIR + rm -f $LINK + ln -vfs $VERSION $LINK + + # LCDproc + cd $SOURCEDIR/$LINK + ./configure --prefix=$PREFIX --enable-drivers=all + make && checkinstall --fstrans=no --install=yes --pkgname=lcdproc --pkgversion "0.5.2-xvdr" --default + + # test + TEST=`which LCDd` + if [ "$TEST" ]; then + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + return 1 + fi + + # save deb file + [ -d "$DIR/packages" ] || mkdir -p $DIR/packages + cp -f lcdproc*.deb $DIR/packages + + if [ -f $DIR/LCDd.conf ]; then + cp -f $DIR/LCDd.conf /etc + else + cp -f LCDd.conf /etc + fi + + # autostart LCDd + cp -f $DIR/lcdd /etc/init.d + chmod 0755 /etc/init.d/lcdd + unfreeze_rc + update-rc.d lcdd defaults 20 + freeze_rc + + ldconfig + +} + +# uninstall +function clean_util() { + apt_remove "lcdproc" + + # remove source + cd $SOURCEDIR + [ -L "$LINK" ] && rm -rf "$LINK" + [ -d "$VERSION" ] && rm -rf "$VERSION" + + rm -f /etc/LCDd.conf + unfreeze_rc + update-rc.d -f lcdd remove + freeze_rc + rm -f /etc/init.d/lcdd + + ldconfig +} + +# test +function status_util() { + TEST=`which LCDd` + if [ "$TEST" ]; then + [ -d $SOURCEDIR/$LINK ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/a_vidix b/utilities/a_vidix new file mode 120000 index 0000000..9ca7fad --- /dev/null +++ b/utilities/a_vidix @@ -0,0 +1 @@ +vidix
\ No newline at end of file diff --git a/utilities/dvb/liplianindvb/dvb-driver.sh b/utilities/dvb/liplianindvb/dvb-driver.sh new file mode 100644 index 0000000..2ecb725 --- /dev/null +++ b/utilities/dvb/liplianindvb/dvb-driver.sh @@ -0,0 +1,102 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 09.02.2009 + +# liplianindvb + +source ./../../../x-vdr.conf +source ./../../../setup.conf +source ./../../../functions + + +VERSION="liplianindvb" +WEB="http://mercurial.intuxication.org/hg/$VERSION" +LINK="DVB" + +DIR=`pwd` + +# install +function make_util() { + + apt-get update + apt_install "mercurial" + apt_install "linux-headers-`uname -r`" + [ -L /usr/src/linux ] && rm -f /usr/src/linux + if [ ! -d /usr/src/linux ]; then + cd /usr/src + ln -vfs /usr/src/linux-headers-`uname -r` linux + fi + + # download und symlink + cd $SOURCEDIR + hg clone $WEB + + rm -f $LINK + ln -vfs $VERSION $LINK + + cd $SOURCEDIR/$LINK/linux/include/linux + if [ -f /usr/src/linux/include/linux/compiler.h ]; then + ln -s /usr/src/linux/include/linux/compiler.h compiler.h + elif [ -f /usr/src/$(uname -r)/include/linux/compiler.h ]; then + ln -s /usr/src/$(uname -r)/include/linux/compiler.h compiler.h + elif [ -f /usr/src/linux-headers-$(uname -r)/include/linux/compiler.h ]; then + ln -s /usr/src/linux-headers-$(uname -r)/include/linux/compiler.h compiler.h + else + log "ERROR - /usr/src/linux/include/linux/compiler.h nicht gefunden" + fi + + # install + cd $SOURCEDIR/$LINK + + # search for *.diff + for i in `ls $DIR/patches | grep ".diff$"`; do + log "apply $i" + patch -p 1 < $DIR/patches/$i + done + + make menuconfig + make + if [ $? = 0 ] ; then + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + return 1 + fi + + dialog --title " x-vdr - $VERSION " --yesno "Die DVB-Treiber wurden in $SOURCEDIR/$VERSION erstellt. \nSollen sie jetzt installiert werden?" 19 70 + [ $? = 0 ] || return 0 + make install && cp -rf $SOURCEDIR/$VERSION/linux/include/linux/dvb /usr/include/linux && log "SUCCESS - $VERSION installiert" +} + +# uninstall +function clean_util() { + # remove source + cd $SOURCEDIR + rm -rf $LINK + rm -rf $VERSION +} + +# test +function status_util() { + if [ -d "$SOURCEDIR/$VERSION" ]; then + [ -d "$SOURCEDIR/$VERSION" ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/dvb/mantis/dvb-driver.sh b/utilities/dvb/mantis/dvb-driver.sh new file mode 100644 index 0000000..86755dd --- /dev/null +++ b/utilities/dvb/mantis/dvb-driver.sh @@ -0,0 +1,102 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 19.06.2008 + +# mantis + +source ./../../../x-vdr.conf +source ./../../../setup.conf +source ./../../../functions + + +VERSION="mantis" +WEB="http://jusst.de/hg/$VERSION" +LINK="DVB" + +DIR=`pwd` + +# install +function make_util() { + + apt-get update + apt_install "mercurial" + apt_install "linux-headers-`uname -r`" + [ -L /usr/src/linux ] && rm -f /usr/src/linux + if [ ! -d /usr/src/linux ]; then + cd /usr/src + ln -vfs /usr/src/linux-headers-`uname -r` linux + fi + + # download und symlink + cd $SOURCEDIR + hg clone $WEB + + rm -f $LINK + ln -vfs $VERSION $LINK + + cd $SOURCEDIR/$LINK/linux/include/linux + if [ -f /usr/src/linux/include/linux/compiler.h ]; then + ln -s /usr/src/linux/include/linux/compiler.h compiler.h + elif [ -f /usr/src/$(uname -r)/include/linux/compiler.h ]; then + ln -s /usr/src/$(uname -r)/include/linux/compiler.h compiler.h + elif [ -f /usr/src/linux-headers-$(uname -r)/include/linux/compiler.h ]; then + ln -s /usr/src/linux-headers-$(uname -r)/include/linux/compiler.h compiler.h + else + log "ERROR - /usr/src/linux/include/linux/compiler.h nicht gefunden" + fi + + # install + cd $SOURCEDIR/$LINK + + # search for *.diff + for i in `ls $DIR/patches | grep ".diff$"`; do + log "apply $i" + patch -p 1 < $DIR/patches/$i + done + + make menuconfig + make + if [ $? = 0 ] ; then + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + return 1 + fi + + dialog --title " x-vdr - $VERSION " --yesno "Die DVB-Treiber wurden in $SOURCEDIR/$VERSION erstellt. \nSollen sie jetzt installiert werden?" 19 70 + [ $? = 0 ] || return 0 + make install && cp -rf $SOURCEDIR/$VERSION/linux/include/linux/dvb /usr/include/linux && log "SUCCESS - $VERSION installiert" +} + +# uninstall +function clean_util() { + # remove source + cd $SOURCEDIR + rm -rf $LINK + rm -rf $VERSION +} + +# test +function status_util() { + if [ -d "$SOURCEDIR/$VERSION" ]; then + [ -d "$SOURCEDIR/$VERSION" ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/dvb/multiproto/dvb-driver.sh b/utilities/dvb/multiproto/dvb-driver.sh new file mode 100644 index 0000000..2334ed6 --- /dev/null +++ b/utilities/dvb/multiproto/dvb-driver.sh @@ -0,0 +1,102 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 03.05.2008 + +# multiproto + +source ./../../../x-vdr.conf +source ./../../../setup.conf +source ./../../../functions + + +VERSION="multiproto" +WEB="http://jusst.de/hg/$VERSION" +LINK="DVB" + +DIR=`pwd` + +# install +function make_util() { + + apt-get update + apt_install "mercurial" + apt_install "linux-headers-`uname -r`" + [ -L /usr/src/linux ] && rm -f /usr/src/linux + if [ ! -d /usr/src/linux ]; then + cd /usr/src + ln -vfs /usr/src/linux-headers-`uname -r` linux + fi + + # download und symlink + cd $SOURCEDIR + hg clone $WEB + + rm -f $LINK + ln -vfs $VERSION $LINK + + cd $SOURCEDIR/$LINK/linux/include/linux + if [ -f /usr/src/linux/include/linux/compiler.h ]; then + ln -s /usr/src/linux/include/linux/compiler.h compiler.h + elif [ -f /usr/src/$(uname -r)/include/linux/compiler.h ]; then + ln -s /usr/src/$(uname -r)/include/linux/compiler.h compiler.h + elif [ -f /usr/src/linux-headers-$(uname -r)/include/linux/compiler.h ]; then + ln -s /usr/src/linux-headers-$(uname -r)/include/linux/compiler.h compiler.h + else + log "ERROR - /usr/src/linux/include/linux/compiler.h nicht gefunden" + fi + + # install + cd $SOURCEDIR/$LINK + + # search for *.diff + for i in `ls $DIR/patches | grep ".diff$"`; do + log "apply $i" + patch -p 1 < $DIR/patches/$i + done + + make menuconfig + make + if [ $? = 0 ] ; then + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + return 1 + fi + + dialog --title " x-vdr - $VERSION " --yesno "Die DVB-Treiber wurden in $SOURCEDIR/$VERSION erstellt. \nSollen sie jetzt installiert werden?" 19 70 + [ $? = 0 ] || return 0 + make install && cp -rf $SOURCEDIR/$VERSION/linux/include/linux/dvb /usr/include/linux && log "SUCCESS - $VERSION installiert" +} + +# uninstall +function clean_util() { + # remove source + cd $SOURCEDIR + rm -rf $LINK + rm -rf $VERSION +} + +# test +function status_util() { + if [ -d "$SOURCEDIR/$VERSION" ]; then + [ -d "$SOURCEDIR/$VERSION" ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/dvb/multiproto_plus/dvb-driver.sh b/utilities/dvb/multiproto_plus/dvb-driver.sh new file mode 100644 index 0000000..baed692 --- /dev/null +++ b/utilities/dvb/multiproto_plus/dvb-driver.sh @@ -0,0 +1,102 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 03.05.2008 + +# multiproto_plus + +source ./../../../x-vdr.conf +source ./../../../setup.conf +source ./../../../functions + + +VERSION="multiproto_plus" +WEB="http://jusst.de/hg/$VERSION" +LINK="DVB" + +DIR=`pwd` + +# install +function make_util() { + + apt-get update + apt_install "mercurial" + apt_install "linux-headers-`uname -r`" + [ -L /usr/src/linux ] && rm -f /usr/src/linux + if [ ! -d /usr/src/linux ]; then + cd /usr/src + ln -vfs /usr/src/linux-headers-`uname -r` linux + fi + + # download und symlink + cd $SOURCEDIR + hg clone $WEB + + rm -f $LINK + ln -vfs $VERSION $LINK + + cd $SOURCEDIR/$LINK/linux/include/linux + if [ -f /usr/src/linux/include/linux/compiler.h ]; then + ln -s /usr/src/linux/include/linux/compiler.h compiler.h + elif [ -f /usr/src/$(uname -r)/include/linux/compiler.h ]; then + ln -s /usr/src/$(uname -r)/include/linux/compiler.h compiler.h + elif [ -f /usr/src/linux-headers-$(uname -r)/include/linux/compiler.h ]; then + ln -s /usr/src/linux-headers-$(uname -r)/include/linux/compiler.h compiler.h + else + log "ERROR - /usr/src/linux/include/linux/compiler.h nicht gefunden" + fi + + # install + cd $SOURCEDIR/$LINK + + # search for *.diff + for i in `ls $DIR/patches | grep ".diff$"`; do + log "apply $i" + patch -p 1 < $DIR/patches/$i + done + + make menuconfig + make + if [ $? = 0 ] ; then + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + return 1 + fi + + dialog --title " x-vdr - $VERSION " --yesno "Die DVB-Treiber wurden in $SOURCEDIR/$VERSION erstellt. \nSollen sie jetzt installiert werden?" 19 70 + [ $? = 0 ] || return 0 + make install && cp -rf $SOURCEDIR/$VERSION/linux/include/linux/dvb /usr/include/linux && log "SUCCESS - $VERSION installiert" +} + +# uninstall +function clean_util() { + # remove source + cd $SOURCEDIR + rm -rf $LINK + rm -rf $VERSION +} + +# test +function status_util() { + if [ -d "$SOURCEDIR/$VERSION" ]; then + [ -d "$SOURCEDIR/$VERSION" ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/dvb/s2-liplianin/dvb-driver.sh b/utilities/dvb/s2-liplianin/dvb-driver.sh new file mode 100644 index 0000000..3f64d54 --- /dev/null +++ b/utilities/dvb/s2-liplianin/dvb-driver.sh @@ -0,0 +1,102 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 09.02.2009 + +# v4l-dvb + +source ./../../../x-vdr.conf +source ./../../../setup.conf +source ./../../../functions + + +VERSION="s2-liplianin" +WEB="http://mercurial.intuxication.org/hg/$VERSION" +LINK="DVB" + +DIR=`pwd` + +# install +function make_util() { + + apt-get update + apt_install "mercurial" + apt_install "linux-headers-`uname -r`" + [ -L /usr/src/linux ] && rm -f /usr/src/linux + if [ ! -d /usr/src/linux ]; then + cd /usr/src + ln -vfs /usr/src/linux-headers-`uname -r` linux + fi + + # download und symlink + cd $SOURCEDIR + hg clone $WEB + + rm -f $LINK + ln -vfs $VERSION $LINK + + cd $SOURCEDIR/$LINK/linux/include/linux + if [ -f /usr/src/linux/include/linux/compiler.h ]; then + ln -s /usr/src/linux/include/linux/compiler.h compiler.h + elif [ -f /usr/src/$(uname -r)/include/linux/compiler.h ]; then + ln -s /usr/src/$(uname -r)/include/linux/compiler.h compiler.h + elif [ -f /usr/src/linux-headers-$(uname -r)/include/linux/compiler.h ]; then + ln -s /usr/src/linux-headers-$(uname -r)/include/linux/compiler.h compiler.h + else + log "ERROR - /usr/src/linux/include/linux/compiler.h nicht gefunden" + fi + + # install + cd $SOURCEDIR/$LINK + + # search for *.diff + for i in `ls $DIR/patches | grep ".diff$"`; do + log "apply $i" + patch -p 1 < $DIR/patches/$i + done + + make menuconfig + make + if [ $? = 0 ] ; then + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + return 1 + fi + + dialog --title " x-vdr - $VERSION " --yesno "Die DVB-Treiber wurden in $SOURCEDIR/$VERSION erstellt. \nSollen sie jetzt installiert werden?" 19 70 + [ $? = 0 ] || return 0 + make install && cp -rf $SOURCEDIR/$VERSION/linux/include/linux/dvb /usr/include/linux && log "SUCCESS - $VERSION installiert" +} + +# uninstall +function clean_util() { + # remove source + cd $SOURCEDIR + rm -rf $LINK + rm -rf $VERSION +} + +# test +function status_util() { + if [ -d "$SOURCEDIR/$VERSION" ]; then + [ -d "$SOURCEDIR/$VERSION" ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/dvb/v4l-dvb/dvb-driver.sh b/utilities/dvb/v4l-dvb/dvb-driver.sh new file mode 100644 index 0000000..912a288 --- /dev/null +++ b/utilities/dvb/v4l-dvb/dvb-driver.sh @@ -0,0 +1,102 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 03.05.2008 + +# v4l-dvb + +source ./../../../x-vdr.conf +source ./../../../setup.conf +source ./../../../functions + + +VERSION="v4l-dvb" +WEB="http://linuxtv.org/hg/$VERSION" +LINK="DVB" + +DIR=`pwd` + +# install +function make_util() { + + apt-get update + apt_install "mercurial" + apt_install "linux-headers-`uname -r`" + [ -L /usr/src/linux ] && rm -f /usr/src/linux + if [ ! -d /usr/src/linux ]; then + cd /usr/src + ln -vfs /usr/src/linux-headers-`uname -r` linux + fi + + # download und symlink + cd $SOURCEDIR + hg clone $WEB + + rm -f $LINK + ln -vfs $VERSION $LINK + + cd $SOURCEDIR/$LINK/linux/include/linux + if [ -f /usr/src/linux/include/linux/compiler.h ]; then + ln -s /usr/src/linux/include/linux/compiler.h compiler.h + elif [ -f /usr/src/$(uname -r)/include/linux/compiler.h ]; then + ln -s /usr/src/$(uname -r)/include/linux/compiler.h compiler.h + elif [ -f /usr/src/linux-headers-$(uname -r)/include/linux/compiler.h ]; then + ln -s /usr/src/linux-headers-$(uname -r)/include/linux/compiler.h compiler.h + else + log "ERROR - /usr/src/linux/include/linux/compiler.h nicht gefunden" + fi + + # install + cd $SOURCEDIR/$LINK + + # search for *.diff + for i in `ls $DIR/patches | grep ".diff$"`; do + log "apply $i" + patch -p 1 < $DIR/patches/$i + done + + make menuconfig + make + if [ $? = 0 ] ; then + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + return 1 + fi + + dialog --title " x-vdr - $VERSION " --yesno "Die DVB-Treiber wurden in $SOURCEDIR/$VERSION erstellt. \nSollen sie jetzt installiert werden?" 19 70 + [ $? = 0 ] || return 0 + make install && cp -rf $SOURCEDIR/$VERSION/linux/include/linux/dvb /usr/include/linux && log "SUCCESS - $VERSION installiert" +} + +# uninstall +function clean_util() { + # remove source + cd $SOURCEDIR + rm -rf $LINK + rm -rf $VERSION +} + +# test +function status_util() { + if [ -d "$SOURCEDIR/$VERSION" ]; then + [ -d "$SOURCEDIR/$VERSION" ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/dvb/v4l-dvb/v4l-dvb-header-fix.diff b/utilities/dvb/v4l-dvb/v4l-dvb-header-fix.diff new file mode 100644 index 0000000..5086ced --- /dev/null +++ b/utilities/dvb/v4l-dvb/v4l-dvb-header-fix.diff @@ -0,0 +1,155 @@ +diff -ruN linux/include/linux/dvb/audio.h linux/include/linux/dvb/audio.h +--- linux/include/linux/dvb/audio.h 2009-04-09 13:21:42.000000000 +0200 ++++ linux/include/linux/dvb/audio.h 2008-12-31 18:26:57.000000000 +0100 +@@ -24,7 +24,12 @@ + #ifndef _DVBAUDIO_H_ + #define _DVBAUDIO_H_ + ++#ifdef __KERNEL__ + #include <linux/types.h> ++#else ++#include <stdint.h> ++#endif ++ + + typedef enum { + AUDIO_SOURCE_DEMUX, /* Select the demux as the main source */ +@@ -76,7 +81,7 @@ + } audio_karaoke_t; /* into left and right */ + + +-typedef __u16 audio_attributes_t; ++typedef uint16_t audio_attributes_t; + /* bits: descr. */ + /* 15-13 audio coding mode (0=ac3, 2=mpeg1, 3=mpeg2ext, 4=LPCM, 6=DTS, */ + /* 12 multichannel extension */ +diff -ruN linux/include/linux/dvb/dmx.h linux/include/linux/dvb/dmx.h +--- linux/include/linux/dvb/dmx.h 2009-04-09 13:21:42.000000000 +0200 ++++ linux/include/linux/dvb/dmx.h 2008-12-31 18:26:57.000000000 +0100 +@@ -24,7 +24,7 @@ + #ifndef _DVBDMX_H_ + #define _DVBDMX_H_ + +-#include <linux/types.h> ++#include <asm/types.h> + #ifdef __KERNEL__ + #include <linux/time.h> + #else +diff -ruN linux/include/linux/dvb/frontend.h linux/include/linux/dvb/frontend.h +--- linux/include/linux/dvb/frontend.h 2009-04-09 13:21:42.000000000 +0200 ++++ linux/include/linux/dvb/frontend.h 2008-12-31 18:26:57.000000000 +0100 +@@ -26,7 +26,8 @@ + #ifndef _DVBFRONTEND_H_ + #define _DVBFRONTEND_H_ + +-#include <linux/types.h> ++#include <asm/types.h> ++ + + typedef enum fe_type { + FE_QPSK, +diff -ruN linux/include/linux/dvb/net.h linux/include/linux/dvb/net.h +--- linux/include/linux/dvb/net.h 2009-04-09 13:21:42.000000000 +0200 ++++ linux/include/linux/dvb/net.h 2008-12-31 18:26:57.000000000 +0100 +@@ -24,7 +24,8 @@ + #ifndef _DVBNET_H_ + #define _DVBNET_H_ + +-#include <linux/types.h> ++#include <asm/types.h> ++ + + struct dvb_net_if { + __u16 pid; +diff -ruN linux/include/linux/dvb/video.h linux/include/linux/dvb/video.h +--- linux/include/linux/dvb/video.h 2009-04-09 13:21:42.000000000 +0200 ++++ linux/include/linux/dvb/video.h 2008-12-31 18:26:57.000000000 +0100 +@@ -24,14 +24,17 @@ + #ifndef _DVBVIDEO_H_ + #define _DVBVIDEO_H_ + +-#include <linux/types.h> +-#ifdef __KERNEL__ + #include <linux/compiler.h> ++ ++#ifdef __KERNEL__ ++#include <linux/types.h> + #else ++#include <asm/types.h> + #include <stdint.h> + #include <time.h> + #endif + ++ + typedef enum { + VIDEO_FORMAT_4_3, /* Select 4:3 format */ + VIDEO_FORMAT_16_9, /* Select 16:9 format. */ +@@ -132,12 +135,12 @@ + #define VIDEO_VSYNC_FIELD_PROGRESSIVE (3) + + struct video_event { +- __s32 type; ++ int32_t type; + #define VIDEO_EVENT_SIZE_CHANGED 1 + #define VIDEO_EVENT_FRAME_RATE_CHANGED 2 + #define VIDEO_EVENT_DECODER_STOPPED 3 + #define VIDEO_EVENT_VSYNC 4 +- __kernel_time_t timestamp; ++ time_t timestamp; + union { + video_size_t size; + unsigned int frame_rate; /* in frames per 1000sec */ +@@ -157,25 +160,25 @@ + + struct video_still_picture { + char __user *iFrame; /* pointer to a single iframe in memory */ +- __s32 size; ++ int32_t size; + }; + + + typedef + struct video_highlight { + int active; /* 1=show highlight, 0=hide highlight */ +- __u8 contrast1; /* 7- 4 Pattern pixel contrast */ ++ uint8_t contrast1; /* 7- 4 Pattern pixel contrast */ + /* 3- 0 Background pixel contrast */ +- __u8 contrast2; /* 7- 4 Emphasis pixel-2 contrast */ ++ uint8_t contrast2; /* 7- 4 Emphasis pixel-2 contrast */ + /* 3- 0 Emphasis pixel-1 contrast */ +- __u8 color1; /* 7- 4 Pattern pixel color */ ++ uint8_t color1; /* 7- 4 Pattern pixel color */ + /* 3- 0 Background pixel color */ +- __u8 color2; /* 7- 4 Emphasis pixel-2 color */ ++ uint8_t color2; /* 7- 4 Emphasis pixel-2 color */ + /* 3- 0 Emphasis pixel-1 color */ +- __u32 ypos; /* 23-22 auto action mode */ ++ uint32_t ypos; /* 23-22 auto action mode */ + /* 21-12 start y */ + /* 9- 0 end y */ +- __u32 xpos; /* 23-22 button color number */ ++ uint32_t xpos; /* 23-22 button color number */ + /* 21-12 start x */ + /* 9- 0 end x */ + } video_highlight_t; +@@ -189,17 +192,17 @@ + + typedef struct video_spu_palette { /* SPU Palette information */ + int length; +- __u8 __user *palette; ++ uint8_t __user *palette; + } video_spu_palette_t; + + + typedef struct video_navi_pack { + int length; /* 0 ... 1024 */ +- __u8 data[1024]; ++ uint8_t data[1024]; + } video_navi_pack_t; + + +-typedef __u16 video_attributes_t; ++typedef uint16_t video_attributes_t; + /* bits: descr. */ + /* 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */ + /* 13-12 TV system (0=525/60, 1=625/50) */ diff --git a/utilities/dvb/v4l-dvb/v4l-dvb_include-fix.diff b/utilities/dvb/v4l-dvb/v4l-dvb_include-fix.diff new file mode 100644 index 0000000..34bd420 --- /dev/null +++ b/utilities/dvb/v4l-dvb/v4l-dvb_include-fix.diff @@ -0,0 +1,10 @@ +--- ./linux/include/linux/dvb/video.h.orig 2009-03-03 09:54:58.000000000 +0100 ++++ ./linux/include/linux/dvb/video.h 2009-03-03 09:45:30.000000000 +0100 +@@ -28,6 +28,7 @@ + #ifdef __KERNEL__ + #include <linux/compiler.h> + #else ++#include <linux/compiler.h> + #include <stdint.h> + #include <time.h> + #endif diff --git a/utilities/em8300/em8300 b/utilities/em8300/em8300 new file mode 100644 index 0000000..ca08b33 --- /dev/null +++ b/utilities/em8300/em8300 @@ -0,0 +1,6 @@ +# configuration for adv717x bt865 em8300 +alias char-major-121 em8300 +install em8300 /sbin/modprobe adv717x && /sbin/modprobe --ignore-install em8300 +remove em8300 /sbin/modprobe -r --ignore-remove em8300 && /sbin/modprobe -r adv717x +options adv717x pixelport_16bit=1 pixelport_other_pal=1 +options em8300 use_bt865=0 bt865_ucode_timeout=1 dicom_fix=0 dicom_control=0 dicom_other_pal=1 activate_loopback=0 audio_driver=oss diff --git a/utilities/em8300/ldm b/utilities/em8300/ldm new file mode 100644 index 0000000..84ff10b --- /dev/null +++ b/utilities/em8300/ldm @@ -0,0 +1,17 @@ +#!/bin/sh + +# make devices +[ ! -e /dev/em8300-0 ] && mknod /dev/em8300-0 c 121 0 +[ ! -e /dev/em8300_mv-0 ] && mknod /dev/em8300_mv-0 c 121 1 +[ ! -e /dev/em8300_ma-0 ] && mknod /dev/em8300_ma-0 c 121 2 +[ ! -e /dev/em8300_sp-0 ] && mknod /dev/em8300_sp-0 c 121 3 +chmod 666 /dev/em8300* + +# load modules +KERNEL=`uname -r` +EM8300=/lib/modules/$KERNEL/em8300 +insmod $EM8300/adv717x.ko pixelport_16bit=1 pixelport_other_pal=1 #swap_redblue_pal=0 color_bars=1 +insmod $EM8300/bt865.ko # color_bars=1 +insmod $EM8300/em8300.ko use_bt865=0 bt865_ucode_timeout=1 dicom_fix=0 dicom_control=0 dicom_other_pal=1 activate_loopback=0 audio_driver=oss + + diff --git a/utilities/em8300/rmm b/utilities/em8300/rmm new file mode 100644 index 0000000..b68a659 --- /dev/null +++ b/utilities/em8300/rmm @@ -0,0 +1,14 @@ +#!/bin/sh + +# kill processes accessing em8300 devices +[ ! -e /dev/em8300-0 ] && fuser -k /dev/em8300-0 +[ ! -e /dev/em8300_mv-0 ] && fuser -k /dev/em8300_mv-0 +[ ! -e /dev/em8300_ma-0 ] && fuser -k /dev/em8300_ma-0 + +# unload modules +[ `lsmod | grep em8300 | wc -l` -ne 0 ] && rmmod em8300 +[ `lsmod | grep adv717x | wc -l` -ne 0 ] && rmmod adv717x +[ `lsmod | grep bt865 | wc -l` -ne 0 ] && rmmod bt865 +#rmmod i2c-algo-bit +#rmmod i2c-core + diff --git a/utilities/em8300/utilitie.sh b/utilities/em8300/utilitie.sh new file mode 100644 index 0000000..9b503e3 --- /dev/null +++ b/utilities/em8300/utilitie.sh @@ -0,0 +1,155 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 25.11.2007 + +# em8300 - module fuer dxr3 + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +WEB="http://www.zulu-entertainment.de/files/em8300/em8300-cvs20071122.tar.bz2" +VERSION="em8300-cvs20071122" +LINK="em8300" +CVS="2" + +if [ "$CVS" = "1" ]; then + VERSION="em8300-cvs" +fi + +KERNEL=`uname -r` +EM8300="/lib/modules/$KERNEL/em8300" +VAR=`basename $WEB` +DIR=`pwd` + +function make_util() { + if [ "$CVS" = "1" ]; then + [ ! -d "$DIR/em8300-cvs" ] && mkdir -p $DIR/em8300-cvs + cd $DIR/em8300-cvs + echo "CVS password: [Just press enter]" + cvs -d:pserver:anonymous@dxr3.cvs.sourceforge.net:/cvsroot/dxr3 login + cvs -z3 -d:pserver:anonymous@dxr3.cvs.sourceforge.net:/cvsroot/dxr3 co -P em8300 + [ -d "$DIR/em8300-cvs/em8300" ] || return 1 + [ -d "$SOURCEDIR/$VERSION" ] && rm -rf "$SOURCEDIR/$VERSION" + cp -R em8300 $SOURCEDIR/$VERSION + [ -d "$SOURCEDIR/$VERSION" ] || return 1 + else + download_util + extract_util + fi + + cd $SOURCEDIR + rm -f $LINK + ln -vfs $VERSION $LINK + + # install tools + cd $SOURCEDIR/$LINK + [ "$CVS" != "0" ] && ./bootstrap + ./configure --prefix=$PREFIX + make + make install + + # install modules + cd $SOURCEDIR/$LINK/modules + make + make install + # copy microcode + cp em8300.uc /usr/share/misc + # make devices + #./devices.sh + + # Scripte kopieren + cp -f $DIR/ldm $VDRSCRIPTDIR + chmod 0744 $VDRSCRIPTDIR/ldm + + cp -f $DIR/rmm $VDRSCRIPTDIR + chmod 0744 $VDRSCRIPTDIR/rmm + chown $VDRUSER:$VDRGROUP $VDRSCRIPTDIR/ldm $VDRSCRIPTDIR/rmm + + ldconfig + + if [ -f $DIR/em8300 ]; then + cp -f $DIR/em8300 /etc/modprobe.d + elif [ -x /usr/sbin/dxr3config ]; then + dxr3config + fi + + if [ -f /etc/modprobe.d/em8300 ] && [ `grep -cw '^options em8300 .*audio_driver=oss' /etc/modprobe.d/em8300` -eq 0 ]; then + em8300_options=`grep -m 1 '^options em8300'` + if [ -n "$em8300_options" ]; then + sed -i /etc/modprobe.d/em8300 -e s/"$em8300_options"/"$em8300_options audio_driver=oss"/g + else + echo "options em8300 audio_driver=oss" >> /etc/modprobe.d/em8300 + fi + elif [ ! -f /etc/modprobe.d/em8300 ]; then + echo "options em8300 audio_driver=oss" > /etc/modprobe.d/em8300 + fi + + depmod + + # test + if [ -f $EM8300/adv717x.ko ] && [ -f $EM8300/bt865.ko ] && [ -f $EM8300/em8300.ko ]; then + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + fi +# Module laden +#cd $VDRSCRIPTDIR +#./rmm +#./ldm +#em8300setup +} + +# uninstall +function clean_util() { + # uninstall + if [ -d $SOURCEDIR/em8300 ]; then + cd $SOURCEDIR/em8300 + make uninstall + cd $SOURCEDIR + rm -rf em8300* + else + # remove source + cd $SOURCEDIR + rm -rf em8300* + fi + + # remove modules + rm -rf $EM8300 + + # remove microcode + rm -f /usr/share/misc/em8300.uc + + # remove scripts + rm -f $VDRSCRIPTDIR/ldm + rm -f $VDRSCRIPTDIR/rmm + + + + ldconfig +} + +# test +function status_util() { + if [ -f $EM8300/adv717x.ko ] && [ -f $EM8300/bt865.ko ] && [ -f $EM8300/em8300.ko ]; then + [ -d $SOURCEDIR/$LINK ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/ffmpeg/utilitie.sh b/utilities/ffmpeg/utilitie.sh new file mode 100755 index 0000000..22bda89 --- /dev/null +++ b/utilities/ffmpeg/utilitie.sh @@ -0,0 +1,169 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 30.03.2009 + +# ffmpeg-svn + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +#WEB="ffmpeg-svn" +VERSION="ffmpeg-svn" +LINK="ffmpeg" + +#VAR=`basename $WEB` +DIR=`pwd` + +DATE=`date +%Y%m%d` +DUMMY_LIBS="libavcodec51 libavcodec52 libavdevice52 libavfilter0 libavformat52 libavutil49 libpostproc51 libswscale0" + +LIBS="$(apt-cache search "libavcodec" | grep "libavcodec" | cut -d" " -f1) \ + $(apt-cache search "libavdevice" | grep "libavdevice" | cut -d" " -f1) \ + $(apt-cache search "libavfilter" | grep "libavfilter" | cut -d" " -f1) \ + $(apt-cache search "libavformat" | grep "libavformat" | cut -d" " -f1) \ + $(apt-cache search "libavutil" | grep "libavutil" | cut -d" " -f1) \ + $(apt-cache search "libpostproc" | grep "libpostproc" | cut -d" " -f1) \ + $(apt-cache search "libswscale" | grep "libswscale" | cut -d" " -f1)" + +# install +function make_util() { + # pre install + status=`status_util` + if [ "$status" != "0" ]; then + apt_remove "ffmpeg $LIBS" + [ -d /usr/include/ffmpeg ] && rm -rf /usr/include/ffmpeg + fi + + apt_install "libgsm1-dev" + if [ "$LINUXVERSION" = "ubuntu" ]; then + apt_install "libvorbis-perl libogg-vorbis-decoder-perl" + else + apt_install "libogg-vorbis-perl" + fi + + # x264 + if [ "`apt_installed x264`" != "xvdr" ]; then + cd $DIR/../x264 + chmod 744 utilitie-x264.sh + ./utilitie-x264.sh || { + log "ERROR - ffmpeg konnte x264 nicht finden" + return 1 + } + fi + + # download_util + cd $SOURCEDIR + [ -d $VERSION ] || svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk $VERSION + [ ! -d $VERSION ] && echo "1" && exit 1 + + # setzen des symlinks + cd $SOURCEDIR + rm -f $LINK + ln -vfs $VERSION $LINK + + cd $SOURCEDIR/$LINK + + # check options + all_options=$(./configure --help) + checked_options="" + my_options="--enable-shared --enable-pthreads --enable-postproc --enable-avfilter --enable-avfilter-lavf \ + --enable-gpl --enable-x11grab --enable-libfaac --enable-libfaad --enable-libgsm --enable-libmp3lame \ + --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid" + + for option in $my_options; do + echo "$all_options" | grep "\\$option" >null && checked_options="$checked_options $option" + done + + # install + ./configure --prefix=$PREFIX $checked_options && + make && checkinstall --fstrans=no --install=yes --pkgname=ffmpeg --pkgversion "4:0.5.svn${DATE}-xvdr" --default && TEST=ok + + # test + if [ "$TEST" != "ok" ]; then + log "ERROR - $VERSION konnte nicht erstellt werden" + return 1 + fi + + # save deb file + [ -d "$DIR/packages" ] || mkdir -p $DIR/packages + cp -f ffmpeg*.deb $DIR/packages + + # dummys + cd $DIR/packages + + for package in $DUMMY_LIBS; do + echo "Section: misc +Priority: optional +Standards-Version: 3.6.2 + +Package: $package +Version: 4:0.5.svn${DATE}-xvdr-1 +Maintainer: Musterman <Musterman@musterman.de> +Depends: ffmpeg +Provides: ffmpeg +Architecture: all +Description: Dummy-$package +" > ./$package + + equivs-build $package + dpkg -i ${package}_0.5.svn${DATE}-xvdr-1_all.deb + + done + # we need libavcodec51 for vlc + cd $PREFIX/lib + ln -vfs libavcodec.so libavcodec.so.51 + + log "SUCCESS - $VERSION erstellt" + ldconfig +} + +# uninstall +function clean_util() { + for package in ffmpeg $DUMMY_LIBS; do + apt_remove "$package" + done + + [ -d "$PREFIX/include/ffmpeg" ] && rm -rf "$PREFIX/include/ffmpeg" + + # remove source + cd $SOURCEDIR + [ -L "$LINK" ] && rm -rf "$LINK" + [ -d "$VERSION" ] && rm -rf "$VERSION" + + ldconfig +} + +# test +function status_util() { + LIBTEST="" + for package in ffmpeg $LIBS; do + TEST=`apt_installed $package` + [ "$TEST" = "debian" ] && LIBTEST="debian" + [ "$TEST" = "xvdr" ] && LIBTEST="xvdr" && break + done + + if [ "$LIBTEST" = "xvdr" ]; then + [ -d $SOURCEDIR/$LINK ] && echo "2" && return 0 + echo "1" + elif [ "$LIBTEST" = "debian" ]; then + echo "3" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/genindex/utilitie-test.sh b/utilities/genindex/utilitie-test.sh new file mode 100644 index 0000000..89feb98 --- /dev/null +++ b/utilities/genindex/utilitie-test.sh @@ -0,0 +1,81 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 23.03.2009 + +# genindex + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +WEB="http://www.muempf.de/down/genindex-0.1.3.tar.gz" +VERSION="genindex-0.1.3" +LINK="genindex" + +VAR=`basename $WEB` +DIR=`pwd` + +# install +function make_util() { + download_util + extract_util + + # setzen des symlinks + cd $SOURCEDIR + rm -f $LINK + ln -vfs $VERSION $LINK + + # install + cd $SOURCEDIR/$LINK + make + cp -f genindex $PREFIX/bin + + ldconfig + + # test + TEST=`which genindex` + if [ "$TEST" ]; then + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + fi +} + +# uninstall +function clean_util() { + # remove bin + rm -f $PREFIX/bin/genindex + + # remove source + cd $SOURCEDIR + rm -rf $LINK + rm -rf $VERSION + + ldconfig +} + +# test +function status_util() { + TEST=`which genindex` + if [ "$TEST" ]; then + [ -d $SOURCEDIR/$LINK ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/graphlcd_base/graphlcd-base-0.1.5-gcc43.patch b/utilities/graphlcd_base/graphlcd-base-0.1.5-gcc43.patch new file mode 100644 index 0000000..5ec1fa2 --- /dev/null +++ b/utilities/graphlcd_base/graphlcd-base-0.1.5-gcc43.patch @@ -0,0 +1,312 @@ +diff -NrU5 graphlcd-base-0.1.5.orig/glcddrivers/avrctl.c graphlcd-base-0.1.5/glcddrivers/avrctl.c +--- graphlcd-base-0.1.5.orig/glcddrivers/avrctl.c 2008-06-15 14:01:50.000000000 +0200 ++++ graphlcd-base-0.1.5/glcddrivers/avrctl.c 2008-06-15 14:02:15.000000000 +0200 +@@ -9,10 +9,11 @@ + * (c) 2005 Andreas Regel <andreas.regel AT powarman.de> + */ + + #include <stdint.h> + #include <syslog.h> ++#include <cstring> + + #include "common.h" + #include "config.h" + #include "port.h" + #include "avrctl.h" +diff -NrU5 graphlcd-base-0.1.5.orig/glcddrivers/config.c graphlcd-base-0.1.5/glcddrivers/config.c +--- graphlcd-base-0.1.5.orig/glcddrivers/config.c 2008-06-15 14:01:52.000000000 +0200 ++++ graphlcd-base-0.1.5/glcddrivers/config.c 2008-06-15 14:02:15.000000000 +0200 +@@ -9,10 +9,12 @@ + * (c) 2004 Andreas Regel <andreas.regel AT powarman.de> + */ + + #include <syslog.h> + #include <fstream> ++#include <cstring> ++#include <cstdlib> + + #include "common.h" + #include "config.h" + #include "drivers.h" + +diff -NrU5 graphlcd-base-0.1.5.orig/glcddrivers/framebuffer.c graphlcd-base-0.1.5/glcddrivers/framebuffer.c +--- graphlcd-base-0.1.5.orig/glcddrivers/framebuffer.c 2008-06-15 14:01:53.000000000 +0200 ++++ graphlcd-base-0.1.5/glcddrivers/framebuffer.c 2008-06-15 14:02:15.000000000 +0200 +@@ -14,10 +14,12 @@ + #include <stdio.h> + #include <syslog.h> + #include <unistd.h> + #include <sys/mman.h> + #include <sys/ioctl.h> ++#include <cstdlib> ++#include <cstring> + + #include "common.h" + #include "config.h" + #include "framebuffer.h" + +diff -NrU5 graphlcd-base-0.1.5.orig/glcddrivers/g15daemon.c graphlcd-base-0.1.5/glcddrivers/g15daemon.c +--- graphlcd-base-0.1.5.orig/glcddrivers/g15daemon.c 2008-06-15 13:47:31.000000000 +0200 ++++ graphlcd-base-0.1.5/glcddrivers/g15daemon.c 2008-06-15 14:07:32.000000000 +0200 +@@ -17,10 +17,11 @@ + #include <sys/ioctl.h> + #include <sys/socket.h> + #include <poll.h> + #include <arpa/inet.h> + #include <unistd.h> ++#include <cstring> + + #include "common.h" + #include "config.h" + + #include "g15daemon.h" +diff -NrU5 graphlcd-base-0.1.5.orig/glcddrivers/gu126x64D-K610A4.c graphlcd-base-0.1.5/glcddrivers/gu126x64D-K610A4.c +--- graphlcd-base-0.1.5.orig/glcddrivers/gu126x64D-K610A4.c 2008-06-15 13:47:31.000000000 +0200 ++++ graphlcd-base-0.1.5/glcddrivers/gu126x64D-K610A4.c 2008-06-15 14:08:52.000000000 +0200 +@@ -23,10 +23,12 @@ + + #include <errno.h> + #include <syslog.h> + #include <unistd.h> + #include <sys/time.h> ++#include <cstring> ++#include <cstdlib> + + #include "common.h" + #include "config.h" + #include "gu126x64D-K610A4.h" + #include "port.h" +diff -NrU5 graphlcd-base-0.1.5.orig/glcddrivers/gu140x32f.c graphlcd-base-0.1.5/glcddrivers/gu140x32f.c +--- graphlcd-base-0.1.5.orig/glcddrivers/gu140x32f.c 2008-06-15 14:01:53.000000000 +0200 ++++ graphlcd-base-0.1.5/glcddrivers/gu140x32f.c 2008-06-15 14:02:15.000000000 +0200 +@@ -19,10 +19,11 @@ + + #include <errno.h> + #include <syslog.h> + #include <unistd.h> + #include <sys/time.h> ++#include <cstring> + + #include "common.h" + #include "config.h" + #include "gu140x32f.h" + #include "port.h" +diff -NrU5 graphlcd-base-0.1.5.orig/glcddrivers/gu256x64-372.c graphlcd-base-0.1.5/glcddrivers/gu256x64-372.c +--- graphlcd-base-0.1.5.orig/glcddrivers/gu256x64-372.c 2008-06-15 14:01:54.000000000 +0200 ++++ graphlcd-base-0.1.5/glcddrivers/gu256x64-372.c 2008-06-15 14:02:15.000000000 +0200 +@@ -21,10 +21,11 @@ + + #include <errno.h> + #include <syslog.h> + #include <unistd.h> + #include <sys/time.h> ++#include <cstring> + + #include "common.h" + #include "config.h" + #include "gu256x64-372.h" + #include "port.h" +diff -NrU5 graphlcd-base-0.1.5.orig/glcddrivers/gu256x64-3900.c graphlcd-base-0.1.5/glcddrivers/gu256x64-3900.c +--- graphlcd-base-0.1.5.orig/glcddrivers/gu256x64-3900.c 2008-06-15 14:01:54.000000000 +0200 ++++ graphlcd-base-0.1.5/glcddrivers/gu256x64-3900.c 2008-06-15 14:02:15.000000000 +0200 +@@ -27,10 +27,11 @@ + #include <fcntl.h> + #include <syslog.h> + #include <unistd.h> + #include <termios.h> + #include <sys/time.h> ++#include <cstring> + + #include "common.h" + #include "config.h" + #include "gu256x64-3900.h" + #include "port.h" +diff -NrU5 graphlcd-base-0.1.5.orig/glcddrivers/hd61830.c graphlcd-base-0.1.5/glcddrivers/hd61830.c +--- graphlcd-base-0.1.5.orig/glcddrivers/hd61830.c 2008-06-15 13:47:31.000000000 +0200 ++++ graphlcd-base-0.1.5/glcddrivers/hd61830.c 2008-06-15 14:03:34.000000000 +0200 +@@ -9,10 +9,11 @@ + * (c) 2001-2004 Carsten Siebholz <c.siebholz AT t-online.de> + */ + + #include <syslog.h> + #include <sys/time.h> ++#include <cstring> + + #include "common.h" + #include "config.h" + #include "hd61830.h" + #include "port.h" +diff -NrU5 graphlcd-base-0.1.5.orig/glcddrivers/image.c graphlcd-base-0.1.5/glcddrivers/image.c +--- graphlcd-base-0.1.5.orig/glcddrivers/image.c 2008-06-15 13:47:31.000000000 +0200 ++++ graphlcd-base-0.1.5/glcddrivers/image.c 2008-06-15 14:04:11.000000000 +0200 +@@ -10,10 +10,11 @@ + * (c) 2004 Andreas Regel <andreas.regel AT powarman.de> + */ + + #include <stdio.h> + #include <syslog.h> ++#include <cstring> + + #include "common.h" + #include "config.h" + #include "image.h" + +diff -NrU5 graphlcd-base-0.1.5.orig/glcddrivers/ks0108.c graphlcd-base-0.1.5/glcddrivers/ks0108.c +--- graphlcd-base-0.1.5.orig/glcddrivers/ks0108.c 2008-06-15 13:47:31.000000000 +0200 ++++ graphlcd-base-0.1.5/glcddrivers/ks0108.c 2008-06-15 14:03:45.000000000 +0200 +@@ -9,10 +9,11 @@ + * (c) 2003 Andreas 'randy' Weinberger <vdr AT smue.org> + */ + + #include <syslog.h> + #include <sys/time.h> ++#include <cstring> + + #include "common.h" + #include "config.h" + #include "ks0108.h" + #include "port.h" +diff -NrU5 graphlcd-base-0.1.5.orig/glcddrivers/network.c graphlcd-base-0.1.5/glcddrivers/network.c +--- graphlcd-base-0.1.5.orig/glcddrivers/network.c 2008-06-15 13:47:31.000000000 +0200 ++++ graphlcd-base-0.1.5/glcddrivers/network.c 2008-06-15 14:08:05.000000000 +0200 +@@ -16,10 +16,11 @@ + #include <sys/types.h> + #include <sys/socket.h> + #include <netinet/in.h> + #include <arpa/inet.h> + #include <errno.h> ++#include <cstring> + + #include "common.h" + #include "config.h" + #include "network.h" + +diff -NrU5 graphlcd-base-0.1.5.orig/glcddrivers/noritake800.c graphlcd-base-0.1.5/glcddrivers/noritake800.c +--- graphlcd-base-0.1.5.orig/glcddrivers/noritake800.c 2008-06-15 13:47:31.000000000 +0200 ++++ graphlcd-base-0.1.5/glcddrivers/noritake800.c 2008-06-15 14:07:04.000000000 +0200 +@@ -32,10 +32,11 @@ + + #include <errno.h> + #include <syslog.h> + #include <unistd.h> + #include <sys/time.h> ++#include <cstring> + + #include "common.h" + #include "config.h" + #include "noritake800.h" + #include "port.h" +diff -NrU5 graphlcd-base-0.1.5.orig/glcddrivers/sed1330.c graphlcd-base-0.1.5/glcddrivers/sed1330.c +--- graphlcd-base-0.1.5.orig/glcddrivers/sed1330.c 2008-06-15 13:47:31.000000000 +0200 ++++ graphlcd-base-0.1.5/glcddrivers/sed1330.c 2008-06-15 14:05:55.000000000 +0200 +@@ -17,10 +17,12 @@ + * (c) 2003 Roland Praml <praml.roland AT t-online.de> + */ + + #include <syslog.h> + #include <sys/time.h> ++#include <cstring> ++#include <cstdlib> + + #include "common.h" + #include "config.h" + #include "port.h" + #include "sed1330.h" +diff -NrU5 graphlcd-base-0.1.5.orig/glcddrivers/sed1520.c graphlcd-base-0.1.5/glcddrivers/sed1520.c +--- graphlcd-base-0.1.5.orig/glcddrivers/sed1520.c 2008-06-15 13:47:31.000000000 +0200 ++++ graphlcd-base-0.1.5/glcddrivers/sed1520.c 2008-06-15 14:05:31.000000000 +0200 +@@ -9,10 +9,11 @@ + * (c) 2003 Andreas 'randy' Weinberger <vdr AT smue.org> + */ + + #include <syslog.h> + #include <sys/time.h> ++#include <cstring> + + #include "common.h" + #include "config.h" + #include "port.h" + #include "sed1520.h" +diff -NrU5 graphlcd-base-0.1.5.orig/glcddrivers/simlcd.c graphlcd-base-0.1.5/glcddrivers/simlcd.c +--- graphlcd-base-0.1.5.orig/glcddrivers/simlcd.c 2008-06-15 14:01:55.000000000 +0200 ++++ graphlcd-base-0.1.5/glcddrivers/simlcd.c 2008-06-15 14:02:15.000000000 +0200 +@@ -11,10 +11,11 @@ + * (c) 2001-2004 Carsten Siebholz <c.siebholz AT t-online.de> + */ + + #include <stdio.h> + #include <syslog.h> ++#include <cstring> + + #include "common.h" + #include "config.h" + #include "simlcd.h" + +diff -NrU5 graphlcd-base-0.1.5.orig/glcddrivers/t6963c.c graphlcd-base-0.1.5/glcddrivers/t6963c.c +--- graphlcd-base-0.1.5.orig/glcddrivers/t6963c.c 2008-06-15 13:47:31.000000000 +0200 ++++ graphlcd-base-0.1.5/glcddrivers/t6963c.c 2008-06-15 14:06:33.000000000 +0200 +@@ -10,10 +10,12 @@ + * + * (c) 2003, 2004 Andreas Regel <andreas.regel AT powarman.de> + */ + + #include <syslog.h> ++#include <cstring> ++#include <cstdlib> + + #include "common.h" + #include "config.h" + #include "port.h" + #include "t6963c.h" +diff -NrU5 graphlcd-base-0.1.5.orig/glcdgraphics/glcd.c graphlcd-base-0.1.5/glcdgraphics/glcd.c +--- graphlcd-base-0.1.5.orig/glcdgraphics/glcd.c 2008-06-15 14:01:55.000000000 +0200 ++++ graphlcd-base-0.1.5/glcdgraphics/glcd.c 2008-06-15 14:02:15.000000000 +0200 +@@ -14,11 +14,11 @@ + + #include <stdio.h> + #include <stdint.h> + #include <syslog.h> + +-#include <string> ++#include <cstring> + + #include "bitmap.h" + #include "glcd.h" + #include "image.h" + +diff -NrU5 graphlcd-base-0.1.5.orig/glcdgraphics/pbm.c graphlcd-base-0.1.5/glcdgraphics/pbm.c +--- graphlcd-base-0.1.5.orig/glcdgraphics/pbm.c 2008-06-15 14:01:55.000000000 +0200 ++++ graphlcd-base-0.1.5/glcdgraphics/pbm.c 2008-06-15 14:02:15.000000000 +0200 +@@ -10,12 +10,13 @@ + */ + + #include <stdio.h> + #include <stdint.h> + #include <syslog.h> ++#include <cstdlib> + +-#include <string> ++#include <cstring> + + #include "bitmap.h" + #include "pbm.h" + #include "image.h" + +diff -NrU5 graphlcd-base-0.1.5.orig/tools/convpic/bmp.c graphlcd-base-0.1.5/tools/convpic/bmp.c +--- graphlcd-base-0.1.5.orig/tools/convpic/bmp.c 2008-06-15 13:47:31.000000000 +0200 ++++ graphlcd-base-0.1.5/tools/convpic/bmp.c 2008-06-15 14:09:57.000000000 +0200 +@@ -27,12 +27,12 @@ + ***************************************************************************/ + + #include <stdio.h> + #include <stdint.h> + #include <string.h> +- +-#include <string> ++#include <cstring> ++#include <cstdlib> + + #include <glcdgraphics/bitmap.h> + #include <glcdgraphics/image.h> + + #include "bmp.h" diff --git a/utilities/graphlcd_base/graphlcd.conf b/utilities/graphlcd_base/graphlcd.conf new file mode 100644 index 0000000..873f569 --- /dev/null +++ b/utilities/graphlcd_base/graphlcd.conf @@ -0,0 +1,459 @@ +# graphlcd.conf.sample +# +# This file contains a sample configuration for the graphlcd driver +# library. +# +# The format is ini-file-like. It is divided into sections that start +# at markers that look like [section]. Comments are all line-based +# comments, and are lines that start with '#'. +# +# The file starts with general settings, that are used by several +# drivers, followed by the sections. Each section represents a single +# display with a driver definition and specific settings which define +# how the driver acts. Some of these parameters like device, port and +# size are already parsed by the library but the drivers can also read +# their own options from the config file. The library passes them to +# the drivers. + +# WaitMethod +# Select the method that is used for sleeping. +# Possible values: +# 0 - usleep +# 1 - nanosleep +# 2 - nanosleep (sched_rr) - This is recommended on kernel 2.4 systems +# 3 - gettimeofday - This is recommended on kernel 2.6 systems +# Defaukt value: 2 +WaitMethod=3 + +# WaitPriority +# Select the process priority that is used when sleeping. +# Possible values: -20 <= x <= 19 +# Default value: 0 +WaitPriority=0 + +# General driver settings +# This section lists the display settings that are parsed and +# recognized by the driver library. +# +# Driver +# Sets the display's driver. +# Currently available are: framebuffer, gu140x32f, gu256x64-372, +# gu256x64C-3xx0, hd61830, image, ks0108, +# sed1520, sed1330, simlcd, t6963c +# +# Device +# Instead of using the direct output via port address (see Port), you +# can use the parport device (/dev/parportX). The advantage over the +# direct output via port address is that this works for non-root users +# also. But it's a little bit slower. The modules ppdev.o, parport.o +# and parport_pc.o must be loaded or compiled into the kernel. +# +# Port +# Sets the port address of the parallel port. If this parameter is not +# given, 0x378 is used. To use this direct output, the program that +# uses the driver library has to be started with user 'root'. +# +# Width +# Sets the horizontal size of the display. If this parameter is not +# given, a default one specific to the driver is used. +# +# Height +# Sets the vertical size of the display. If this parameter is not +# given, a default one specific to the driver is used. +# +# UpsideDown +# Rotates the display output by 180 degrees. This might be useful, if +# the LCD is mounted upside-down. +# Possible values: 'yes', 'no' +# Default value: 'no' +# +# Invert +# Inverts the display. +# Possible values: 'yes', 'no' +# Default value: 'no' +# +# Brightness +# Sets the brightness of your display's backlight if supported by its +# driver. +# Supported by: gu140x32f, gu256x64-372, gu256x64-3900 +# Possible values: 0 <= x <= 100) +# Default value: 100 +# +# Contrast +# Sets the contrast of your display if supported by its driver. +# Supported by: serdisplib +# Possible values: 0 <= x <= 10 +# Default value: 5 +# +# Backlight +# Switches the backlight of your display on and off if supported by +# its driver. +# Supported by: serdisplib +# Possible values: 'yes', 'no' +# Default value: 'yes' +# +# AdjustTiming +# To get a timing that is as accurate as possible, the drivers measure +# the time for port commands (see: benchmark in syslog). You might +# decrease or increase the time to wait after port commands with this +# parameter. Normally, there is no need to change this parameter. +# (used by gu140x32f, gu256x64-372, gu256x64-3900, hd61830, ks0108, +# sed1330, sed1520) +# Possible values: -50 <= x <= 50 +# Default value: 0 +# +# RefreshDisplay +# Normally, most of the drivers do not update the whole display, but +# only the areas that have changed since last update. So it might be, +# that some faulty pixels would stay a longer time. To avoid this, the +# plugin makes a complete refresh from time to time. This parameter +# defines how often a complete refresh will be done. +# e.g.: A value of 5 means, that the plugin will make a complete +# refresh on every 5th update. +# A value of 0 completely disables complete refreshs. +# Possible values: 0 <= x <= 50 +# Default value: 5 + +######################################################################## + +[framebuffer] +# framebuffer driver +# Output goes to a framebuffer device +# Default size: 320 x 240 +Driver=framebuffer + +#Width=320 +#Height=240 +#UpsideDown=no +#Invert=no + +# Zoom +# Determines if pixels should be drawn double sized. +# Possible values: 0, 1 +Zoom=1 + +######################################################################## + +[gu140x32f] +# gu140x32f driver +# This is an 8-bit driver module for Noritake GU140x32-F7806 VFD +# displays. The VFD is operating in it's 8 bit-mode connected to a +# single PC parallel port. +# Default size: 140 x 32 +Driver=gu140x32f + +#Port=0x378 +Device=/dev/parport0 +#Width=140 +#Height=32 +#UpsideDown=no +#Invert=no +#Brightness=100 +#AdjustTiming=0 +#RefreshDisplay=1 + +# Wiring +# Select the type of wiring your display is connected with. +# Possible values: 'Standard', 'Windows' +# Default value: 'Standard' +Wiring=Standard + +######################################################################## + +[gu256x64-372] +# gu256x64-372 driver +# This is an 8-bit driver module for Noritake GU256x64-372 VFD +# displays. The VFD is operating in it's 8 bit-mode connected to a +# single PC parallel port. +# Default size: 256 x 64 +Driver=gu256x64-372 + +#Port=0x378 +Device=/dev/parport0 +#Width=256 +#Height=64 +#UpsideDown=no +#Invert=no +#Brightness=100 +#AdjustTiming=0 +#RefreshDisplay=1 + +######################################################################## + +[gu256x64-3900] +# gu256x64-3900 driver +# This is a driver module for Noritake GU256X64x-3900 VFD displays. The +# VFD is either operating in 8 bit-mode connected to a single PC +# parallel port or in serial mode connected to a single PC serial port. +# Default size: 256 x 64 +Driver=gu256x64-3900 + +#Port=0x378 +Device=/dev/parport0 +#Width=256 +#Height=64 +#UpsideDown=no +#Invert=no +#Brightness=100 +#AdjustTiming=0 +#RefreshDisplay=1 + +# Wiring +# Select the type of wiring your display is connected with. +# Possible values: 'Standard', 'Satyr' +# Default value: 'Standard' +Wiring=Standard + +# Interface +# Select the interface your display is connnected to. +# Possible values: 'Parallel', 'Serial' +# Default value: 'Parallel' +Interface=Parallel + +# DMA +# Enables/disables the usage of the controller's DMA mode which +# increases writing speed. This only works in parallel interface mode. +# Possible values: 'yes', 'no' +# Default value: 'yes' +DMA=yes + +######################################################################## + +[hd61830] +# hd61830 driver +# This is a driver module for the Hitachi HD61830 LCD controller. +# Default size: 240 x 128 +Driver=hd61830 +#Port=0x378 +Device=/dev/parport0 +#Width=240 +#Height=128 +#UpsideDown=no +#Invert=no +#AdjustTiming=0 +#RefreshDisplay=1 + +######################################################################## + +[image] +# image driver +# This is a driver module for writing image sequences in PBM (Portable +# Bit Map) format that show the plugin's output. +# Default size: 240 x 128 +Driver=image +#Width=240 +#Height=128 +#UpsideDown=no +#Invert=no + +######################################################################## + +[ks0108] +# ks0108 driver +# This is a driver module for the Samsung KS0108 LCD controller. +# Default size: 128 x 64 +Driver=ks0108 +#Port=0x378 +Device=/dev/parport0 +Width=128 +Height=64 +#UpsideDown=no +#Invert=no +#AdjustTiming=0 +RefreshDisplay=1 + +# Control +# Select the variant of triggering the display's control lines. +# Possible values: '0', '1' +# Default value: '1' +Control=0 + +######################################################################## + +[sed1330] +# sed1330 driver +# This is a driver module for the Epson SED1330/1335 LCD controller. +# Default size: 320 x 240 +Driver=sed1330 +#Port=0x378 +Device=/dev/parport0 +Width=240 +Height=64 +#UpsideDown=no +#Invert=no +#AdjustTiming=0 +refreshDisplay=1 + +# Wiring +# Select the type of wiring your display is connected with. +# Possible values: 'Original', 'PowerLCD', 'LCDProc', 'Tweakers', +# 'YASEDW' +# Default value: 'Original' +Wiring=PowerLCD + +# OscillatorFrequency +# Select the frequency the oscillator on your LCD board uses in kHz. +# Possible values: 1000 <= x <= 15000) +# Default value: 9600 +OscillatorFrequency=9600 + +# Interface +# Select the interface mode your display is connected with. +# Possible values: '6800', '8080' +# Default value: '6800' +Interface=8080 + +######################################################################## + +[sed1520] +# sed1520 driver +# This is a driver module for the Epson SED1520 LCD controller. +# Default size: 120 x 32 +Driver=sed1520 +#Port=0x378 +Device=/dev/parport0 +#Width=120 +#Height=32 +#UpsideDown=no +#Invert=no +#AdjustTiming=0 +#RefreshDisplay=1 + +######################################################################## + +[simlcd] +# simlcd driver +# This is the SimLCD driver module. Output goes to a file instead of +# LCD. Use SimLCD tool to view this file. +# Default size: 240 x 128 +Driver=simlcd +#Width=240 +#Height=128 +#UpsideDown=no +#Invert=no + +######################################################################## + +[t6963c] +# t6963c driver +# This is a driver module for the Toshiba T6963C LCD controller. +# Default size: 240 x 128 +Driver=t6963c +#Port=0x378 +Device=/dev/parport0 +#Width=240 +#Height=128 +#UpsideDown=no +#Invert=no +#RefreshDisplay=1 + +# Wiring +# Select the type of wiring your display is connected with. +# Possible values: 'Standard', 'Windows' +# Default value: 'Standard' +Wiring=Standard + +# FontSelect +# Select the font width your display uses for text mode. In most cases +# this is selectable through one of the pins of your LCD board +# Possible values: '6', '8' +# Default value: '6' +FontSelect=6 + +# AutoMode +# Enables or disables the usage of T6963C's auto mode which doubles +# writing speed when enabled. +# Possible values: 'yes', 'no' +# Default value: 'yes' +AutoMode=yes + +# StatusCheck +# Enables or disables the usage of T6963C's status check. When using a +# shielded cable for connecting your display, the disabling may be +# possible. This results in doubling the speed of writing data to the +# LCD. +# Possible values: 'yes', 'no' +# Default value: 'yes' +StatusCheck=yes + +######################################################################## + +[serdisp] +# Controller +# Select the serdisplib name of your display. +# Possible values: See README in serdisplib package or http://serdisplib.sourceforge.net +#Controller=nokia7110 +#Controller=sed1335 +Controller=optrex323 + +# Options +# Pass display specific options +# Possible values: See driver-specific hardware page at http://serdisplib.sourceforge.net +# +# IMPORTANT: when using generic controllers like sed1330,sed1335,t6963c, width and height +# need to be set here (if different from default settings)! +# (serdisplib needs to be extended to be able to use 'Width' and 'Height' +# settings directly - this will be added later) +# +#Options=MODE=8080 +#Options=DELAY=2000;FONTWIDTH=8;CHECK=1 +#Options=WIDTH=128;HEIGHT=64 +#Options=WIDTH=128;HEIGHT=64;DELAY=2000;FONTWIDTH=8;CHECK=1 + +# Wiring +# Select Wiring +# Possible values: See driver-specific hardware page at http://serdisplib.sourceforge.net +#Wiring=1 +#Wiring=PowerLCD +#Wiring=DATA8,CS:nAUTO,A0:INIT,WR:nSTRB,RD:nSELIN + +#Port=0x378 +Device=/dev/parport0 +#UpsideDown=no +#Invert=no +Contrast=5 +Backlight=yes + +# Settings 'Width' and 'Height' are ignored at the moment. For generic controllers # (sed1330/1335, t6963) width and height need to be set using setting 'Options' (look above) +##Width=240 +##Height=128 + +######################################################################## + +[noritake800] +# noritake800 driver +# This is an 8-bit driver module for Noritake Noritake 800(A) series VFD +# displays. The VFD is operating in it's 8 bit-mode connected to a +# single PC parallel port. +# Default size: 128 x 64 +Driver=noritake800 +#Port=0x378 +Device=/dev/parport0 +Width=128 +Height=64 +#UpsideDown=no +#Invert=no +Brightness=50 +#AdjustTiming=0 # not used +#RefreshDisplay=0 # not used + +# Wiring +# Select the type of wiring your display is connected with. +# Possible values: 'LiquidMp3', 'MZ' +# Default value: 'LiquidMp3' +Wiring=LiquidMp3 + +[avrctl] +# avrctl driver +# This is an driver module for my AVR controlled LCD display connected via +# USB port. It uses some simple commands to update the display content. +# Default size: 256 x 128 +Driver=avrctl +Device=/dev/ttyUSB0 +Width=256 +Height=128 +#UpsideDown=no +#Invert=no +Brightness=50 +RefreshDisplay=1 + diff --git a/utilities/graphlcd_base/utilitie.sh b/utilities/graphlcd_base/utilitie.sh new file mode 100644 index 0000000..9b4c1e1 --- /dev/null +++ b/utilities/graphlcd_base/utilitie.sh @@ -0,0 +1,130 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 23.06.2008 + +# graphlcd-base - module fuer graphlcd + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +WEB="http://download.berlios.de/graphlcd/graphlcd-base-0.1.5.tgz" +VERSION="graphlcd-base-0.1.5" +LINK="graphlcd-base" +VAR=`basename $WEB` +DIR=`pwd` + +# Make.config fuer graphlcd +function make_makeconfig() { +MAKECONFIG="$SOURCEDIR/$LINK/Make.config" + +if [ -f $MAKECONFIG ] ; then + cp $MAKECONFIG $MAKECONFIG.old + rm -f $MAKECONFIG +fi + +echo "# +# User defined Makefile options for graphlcd daemon and tools + +### The C compiler and options: + +CC = gcc +CFLAGS = -O2 + +CXX = g++ +CXXFLAGS = -g -O2 -Wall -Woverloaded-virtual +#CXXFLAGS = -g -ggdb -O0 -Wall -Woverloaded-virtual + +#LDFLAGS = -g -ggdb -O0 + +LDCONFIG = ldconfig + +### The directory environment: + +BINDIR = $PREFIX/bin +LIBDIR = $PREFIX/lib +INCDIR = $PREFIX/include +MANDIR = $PREFIX/man + +### Includes and defines + +#INCLUDES += -I + +DEFINES += -D_GNU_SOURCE + +HAVE_FREETYPE2=1" >> $MAKECONFIG +} + +# install +function make_util() { + download_util + extract_util + + # setzen des symlinks + cd $SOURCEDIR + rm -f $LINK + ln -vfs $VERSION $LINK + + make_makeconfig + + patch -p0 < $DIR/graphlcd-base-0.1.5-gcc43.patch + + # graphlcd-base + cd $SOURCEDIR/$LINK + make all + make install + + if [ -f $DIR/graphlcd.conf ] ; then + cp -f $DIR/graphlcd.conf /etc + else + cp -f graphlcd.conf /etc + fi + + ldconfig + + # test + if [ -f /usr/lib/libglcddrivers.so ]; then + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + fi +} + +# uninstall +function clean_util() { + cd $SOURCEDIR/$LINK + make uninstall + make clean + + # remove source + cd $SOURCEDIR + rm -rf $LINK + rm -rf $VERSION + + ldconfig +} + +# test +function status_util() { + if [ -f /usr/lib/libglcddrivers.so ]; then + [ -d $SOURCEDIR/$LINK ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/kernel_update/utilitie-test.sh b/utilities/kernel_update/utilitie-test.sh new file mode 100644 index 0000000..d3265e9 --- /dev/null +++ b/utilities/kernel_update/utilitie-test.sh @@ -0,0 +1,100 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 04.02.2007 + +# kernel-update + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +[ "$LINUXVERSION" = "debian" ] || exit 2 + +SOURCEDIR="/usr/src" + +kernel="$(wget -O - http://www.kernel.org/kdist/finger_banner | awk '/latest stable version/ {printf("%s",$NF);}')" +WEB="http://www.kernel.org/pub/linux/kernel/v2.6/linux-${kernel}.tar.bz2" +VERSION="linux-${kernel}" +LINK="linux" + +VAR=`basename $WEB` +DIR=`pwd` + +# install +function make_util() { + + apt_install "build-essential libncurses5-dev dpkg-dev gcc g++ libc6-dev make patch debhelper bzip2 kernel-package sudo cdbs quilt patchutils yaird dh-buildinfo xmlto cramfsprogs" + + + # download und symlink + download_util + extract_util + + cd $SOURCEDIR + rm -f $LINK + ln -vfs $VERSION $LINK + + # install + cd $SOURCEDIR/$LINK + + # eigene config kopieren + [ -f "$DIR/.config" ] && cp -f $DIR/.config $SOURCEDIR/$LINK + + # search for *.diff + for i in `ls $DIR/patches | grep ".diff$"`; do + log "apply $i" + patch -p 1 < $DIR/patches/$i + done + + # einfach mit exit wieder raus und speichern + make menuconfig + ## kernel bauen + # aenderungen an der .config vorgenommen wurden (make-kphg clean). + make-kpkg kernel_image --revision=dvb.0 + # make-kpkg kernel_image kernel_headers kernel_source kernel_doc --revision=dvb.0 --initrd + # installieren + dpkg -i ../linux-image-$kernel\_dvb.0_i386.deb + + # test + if [ -d "$SOURCEDIR/$VERSION" ]; then + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + fi +} + +# uninstall +function clean_util() { + cd $SOURCEDIR/$LINK + make uninstall + + # remove source + cd $SOURCEDIR + rm -rf $LINK + rm -rf $VERSION +} + +# test +function status_util() { + if [ -d "$SOURCEDIR/$VERSION" ]; then + [ -d "$SOURCEDIR/$VERSION" ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/libdvd/utilitie-libdvdnav.sh b/utilities/libdvd/utilitie-libdvdnav.sh new file mode 100644 index 0000000..5926f67 --- /dev/null +++ b/utilities/libdvd/utilitie-libdvdnav.sh @@ -0,0 +1,95 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 02.03.2009 + +# libdvdnav + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +#WEB="libdvdnav-svn" +VERSION="libdvdnav-svn" +LINK="libdvdnav" + +#VAR=`basename $WEB` +DIR=`pwd` + +# install +function make_util() { + # pre install + status=`status_util` + if [ "$status" != "0" ]; then + apt_remove "$(apt-cache search libdvdnav | cut -d" " -f1 | grep libdvdnav)" + fi + + # download_util + cd $SOURCEDIR + [ -d $VERSION ] || svn checkout svn://svn.mplayerhq.hu/dvdnav/trunk/libdvdnav $VERSION + [ ! -d $VERSION ] && echo "1" && exit 1 + + # setzen des symlinks + cd $SOURCEDIR + rm -f $LINK + ln -vfs $VERSION $LINK + + # install + cd $SOURCEDIR/$LINK + ./configure2 --prefix=$PREFIX --enable-shared + make && checkinstall --fstrans=no --install=yes --pkgname=libdvdnav4 --pkgversion "4.1.2-3-xvdr" --default && TEST=ok + + # test + if [ "$TEST" != "ok" ]; then + log "ERROR - $VERSION konnte nicht erstellt werden" + return 1 + fi + log "SUCCESS - $VERSION erstellt" + + # save deb file + [ -d "$DIR/packages" ] || mkdir -p $DIR/packages + cp -f libdvdnav*.deb $DIR/packages + + ldconfig +} + +# uninstall +function clean_util() { + apt_remove "$(apt-cache search libdvdnav | cut -d" " -f1 | grep libdvdnav)" + + # remove source + cd $SOURCEDIR + [ -L "$LINK" ] && rm -rf "$LINK" + [ -d "$VERSION" ] && rm -rf "$VERSION" + + ldconfig +} + +# test +function status_util() { + LIBS="$(apt-cache search libdvdnav | cut -d" " -f1 | grep libdvdnav)" + for package in $LIBS; do + TEST=`apt_installed $package` + if [ "$TEST" = "xvdr" ]; then + [ -d $SOURCEDIR/$LINK ] && echo "2" && return 0 + echo "1" && return 0 + elif [ "$TEST" = "debian" ]; then + echo "3" && return 0 + fi + done + echo "0" +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/libdvd/utilitie-libdvdread.sh b/utilities/libdvd/utilitie-libdvdread.sh new file mode 100644 index 0000000..89b90bc --- /dev/null +++ b/utilities/libdvd/utilitie-libdvdread.sh @@ -0,0 +1,95 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 02.03.2009 + +# libdvdread + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +#WEB="libdvdread-svn" +VERSION="libdvdread-svn" +LINK="libdvdread" + +#VAR=`basename $WEB` +DIR=`pwd` + +# install +function make_util() { + # pre install + status=`status_util` + if [ "$status" != "0" ]; then + apt_remove "$(apt-cache search libdvdread | cut -d" " -f1 | grep libdvdread | grep -v libdvdread3)" + fi + + # download_util + cd $SOURCEDIR + [ -d $VERSION ] || svn checkout svn://svn.mplayerhq.hu/dvdnav/trunk/libdvdread $VERSION + [ ! -d $VERSION ] && echo "1" && exit 1 + + # setzen des symlinks + cd $SOURCEDIR + rm -f $LINK + ln -vfs $VERSION $LINK + + # install + cd $SOURCEDIR/$LINK + ./configure2 --prefix=$PREFIX --enable-static=no + make && checkinstall --fstrans=no --install=yes --pkgname=libdvdread4 --pkgversion "4.1.2-3-xvdr" --default && TEST=ok + + # test + if [ "$TEST" != "ok" ]; then + log "ERROR - $VERSION konnte nicht erstellt werden" + return 1 + fi + log "SUCCESS - $VERSION erstellt" + + # save deb file + [ -d "$DIR/packages" ] || mkdir -p $DIR/packages + cp -f libdvdread*.deb $DIR/packages + + ldconfig +} + +# uninstall +function clean_util() { + apt_remove "$(apt-cache search libdvdread | cut -d" " -f1 | grep libdvdread | grep -v libdvdread3)" + + # remove source + cd $SOURCEDIR + [ -L "$LINK" ] && rm -rf "$LINK" + [ -d "$VERSION" ] && rm -rf "$VERSION" + + ldconfig +} + +# test +function status_util() { + LIBS="$(apt-cache search libdvdread | cut -d" " -f1 | grep libdvdread)" + for package in $LIBS; do + TEST=`apt_installed $package` + if [ "$TEST" = "xvdr" ]; then + [ -d $SOURCEDIR/$LINK ] && echo "2" && return 0 + echo "1" && return 0 + elif [ "$TEST" = "debian" ]; then + echo "3" && return 0 + fi + done + echo "0" +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/lirc/lirc/lircd.conf b/utilities/lirc/lirc/lircd.conf new file mode 100644 index 0000000..88250b4 --- /dev/null +++ b/utilities/lirc/lirc/lircd.conf @@ -0,0 +1,73 @@ +# brand: Technisat +# model no. of remote control: TTS35AI +# devices being controlled by this remote: Skystar 2.6D +# + +begin remote + + name TTS35AI + bits 13 + flags RC5|CONST_LENGTH + eps 30 + aeps 100 + + one 882 803 + zero 882 803 + plead 905 + gap 112766 + toggle_bit 2 + min_repeat 3 + + begin codes + Power 0x1A8C + Mute 0x1A8D + 1 0x1281 + 2 0x1A82 + 3 0x1283 + 4 0x1A84 + 5 0x1285 + 6 0x1A86 + 7 0x1287 + 8 0x1A88 + 9 0x1289 + 0 0x1A80 +# -/-- 0x128A + User1 0x128A +# A/B 0x1AA3 + User2 0x1AA3 + Red 0x0AAB + Green 0x02AC + Yellow 0x0AAD + Blue 0x02AE + Ok 0x0A97 + Up 0x12A0 + Down 0x1AA1 + Left 0x1291 + Right 0x1A90 +# SFI 0x12AF + User3 0x12AF +# Exit 0x1AA2 + Back 0x1AA2 +# INFO 0x028F + User4 0x028F + Prog+ 0x1AA0 + Prog- 0x12A1 +# TV/Radio 0x0293 + User5 0x0293 + Volume+ 0x1A90 + Volume- 0x1291 + Menu 0x0A92 +# Hilfe 0x1A8F + User6 0x1A8F +# TXT 0x12BC + User7 0x12BC +# STOP 0x1AA9 + User8 0x1AA9 +# EXT 0x12B8 + User9 0x12B8 +# HILFE2 0x0AB6 + end codes + +end remote + + diff --git a/utilities/lirc/lirc/lircd.conf.hauppauge b/utilities/lirc/lirc/lircd.conf.hauppauge new file mode 100644 index 0000000..0dacd15 --- /dev/null +++ b/utilities/lirc/lirc/lircd.conf.hauppauge @@ -0,0 +1,199 @@ +# +# this config file was automatically generated +# using lirc-0.5.5pre8 on Sun Apr 18 11:43:45 1999 +# +# contributed by Jens Leuschner <leuschner@gmx.net> +# +# brand: Hauppauge +# model: +# supported devices: WinTV primo; WinTV pci; WinTV radio +# +# This config file will work with both homebrew receivers and +# original Hauppauge TV cards !!! +# + +begin remote + + name Hauppauge + bits 13 + flags SHIFT_ENC + eps 30 + aeps 100 + + one 950 830 + zero 950 830 + plead 960 + gap 89584 + repeat_bit 2 + + begin codes + Red 0x000000000000100F + Green 0x000000000000100C + Ok 0x000000000000102E + Up 0x0000000000001020 + Down 0x0000000000001021 + Left 0x0000000000001011 + Right 0x0000000000001010 + Yellow 0x000000000000100D + Blue 0x0000000000001022 + 1 0x0000000000001001 + 2 0x0000000000001002 + 3 0x0000000000001003 + 4 0x0000000000001004 + 5 0x0000000000001005 + 6 0x0000000000001006 + 7 0x0000000000001007 + 8 0x0000000000001008 + 9 0x0000000000001009 + 0 0x0000000000001000 + Back 0x000000000000101E + Menu 0x0000000000001026 + end codes + +end remote + + +# +# this config file was automatically generated +# using lirc-0.6.6(animax) on Tue Apr 15 19:50:27 2003 +# +# contributed by +# +# brand: Hauppauge +# model no. of remote control: +# devices being controlled by this remote: PVR 2/350 +# + +begin remote + + name hauppauge_pvr + bits 13 + flags RC5|CONST_LENGTH + eps 30 + aeps 100 + + one 969 811 + zero 969 811 + plead 1097 + gap 114605 + toggle_bit 2 + + + begin codes + Power 0x00000000000017FD + Go 0x00000000000017FB + 1 0x00000000000017C1 + 2 0x00000000000017C2 + 3 0x00000000000017C3 + 4 0x00000000000017C4 + 5 0x00000000000017C5 + 6 0x00000000000017C6 + 7 0x00000000000017C7 + 8 0x00000000000017C8 + 9 0x00000000000017C9 + Back/Exit 0x00000000000017DF + 0 0x00000000000017C0 + Menu 0x00000000000017CD + Red 0x00000000000017CB + Green 0x00000000000017EE + Yellow 0x00000000000017F8 + Blue 0x00000000000017E9 + Ch+ 0x00000000000017E0 + Ch- 0x00000000000017E1 + Vol- 0x00000000000017D1 + Vol+ 0x00000000000017D0 + Ok 0x00000000000017E5 + Mute 0x00000000000017CF + Blank 0x00000000000017CC + Full 0x00000000000017FC + Rewind 0x00000000000017F2 + Play 0x00000000000017F5 + Forward 0x00000000000017F4 + Record 0x00000000000017F7 + Stop 0x00000000000017F6 + Pause 0x00000000000017F0 + Replay 0x00000000000017E4 + Skip 0x00000000000017DE + end codes + +end remote + + +# +# this config file was automatically generated +# using lirc-0.7.0(any) on Sun Nov 28 20:25:09 2004 +# +# contributed by +# +# brand: Hauppauge 350 +# Created: G.J. Werler (The Netherlands) +# Project: Mythtv Fedora Pundit-R www.mythtvportal.com +# Date: 2004/11/28 +# model no. of remote control: Hauppauge A415-HPG +# devices being controlled by this remote: PVR-350 +# + +begin remote + + name Hauppauge_350 + bits 13 + flags RC5|CONST_LENGTH + eps 30 + aeps 100 + + one 969 811 + zero 969 811 + plead 1097 + gap 114605 + toggle_bit 2 + + + begin codes + Go 0x00000000000017BB + Power 0x00000000000017BD + TV 0x000000000000179C + Videos 0x0000000000001798 + Music 0x0000000000001799 + Pictures 0x000000000000179A + Guide 0x000000000000179B + Radio 0x000000000000178C + Up 0x0000000000001794 + Left 0x0000000000001796 + Right 0x0000000000001797 + Down 0x0000000000001795 + OK 0x00000000000017A5 + Back/Exit 0x000000000000179F + Menu/i 0x000000000000178D + Vol+ 0x0000000000001790 + Vol- 0x0000000000001791 + Prev.Ch 0x0000000000001792 + Mute 0x000000000000178F + Ch+ 0x00000000000017A0 + Ch- 0x00000000000017A1 + Record 0x00000000000017B7 + Stop 0x00000000000017B6 + Rewind 0x00000000000017B2 + Play 0x00000000000017B5 + Forward 0x00000000000017B4 + Replay/SkipBackward 0x00000000000017A4 + Pause 0x00000000000017B0 + SkipForward 0x000000000000179E + 1 0x0000000000001781 + 2 0x0000000000001782 + 3 0x0000000000001783 + 4 0x0000000000001784 + 5 0x0000000000001785 + 6 0x0000000000001786 + 7 0x0000000000001787 + 8 0x0000000000001788 + 9 0x0000000000001789 + Asterix 0x000000000000178A + 0 0x0000000000001780 + # 0x000000000000178E + Red 0x000000000000178B + Green 0x00000000000017AE + Yellow 0x00000000000017B8 + Blue 0x00000000000017A9 + end codes + +end remote diff --git a/utilities/lirc/lirc/lircd.conf.rcx115 b/utilities/lirc/lirc/lircd.conf.rcx115 new file mode 100644 index 0000000..a5cb30c --- /dev/null +++ b/utilities/lirc/lirc/lircd.conf.rcx115 @@ -0,0 +1,83 @@ + +# Please make this file available to others +# by sending it to <lirc@bartelmus.de> +# +# this config file was automatically generated +# using lirc-0.8.2(default) on Thu Feb 14 15:05:16 2008 +# +# contributed by +# +# brand: medion +# model no. of remote control: rcx115 +# devices being controlled by this remote: sat-receiver (md 24242) +# + +begin remote + + name rcx115 + bits 16 + flags SPACE_ENC|CONST_LENGTH + eps 30 + aeps 100 + + header 9132 4432 + one 652 1607 + zero 652 478 + ptrail 653 + repeat 9134 2171 + pre_data_bits 16 + pre_data 0x10EF + gap 108758 +# toggle_bit_mask 0x0 + + begin codes + Power 0x50AF + Mute 0xD02F + 1 0x807F + 2 0x40BF + 3 0xC03F + 4 0x20DF + 5 0xA05F + 6 0x609F + 7 0xE01F + 8 0x10EF + 9 0x906F + 0 0x00FF +# Prog+ 0xF807 +# Prog- 0x708F + Channel+ 0xF807 + Channel- 0x708F + Volume+ 0x04FB + Volume- 0x08F7 + Menu 0x30CF +# Opt 0xB04F +# FF 0xF00F +# RW 0xE817 + User1 0xB04F + User2 0xF00F + User3 0xE817 + Up 0x8877 + Down 0x48B7 + Left 0xC837 + Right 0x28D7 + Ok 0xA857 +# Exit 0x6897 + Back 0x6897 + Info 0x18E7 +# EPG 0xD827 +# TV/Radio 0x9867 +# Pr 0x14EB +# Text 0x58A7 + User4 0xD827 + User5 0x9867 + User6 0x14EB + User7 0x58A7 + Red 0x7887 + Green 0x847B + Yellow 0x38C7 + Blue 0xB847 + end codes + +end remote + + diff --git a/utilities/lirc/lirc/lircd.conf.technisat b/utilities/lirc/lirc/lircd.conf.technisat new file mode 100644 index 0000000..88250b4 --- /dev/null +++ b/utilities/lirc/lirc/lircd.conf.technisat @@ -0,0 +1,73 @@ +# brand: Technisat +# model no. of remote control: TTS35AI +# devices being controlled by this remote: Skystar 2.6D +# + +begin remote + + name TTS35AI + bits 13 + flags RC5|CONST_LENGTH + eps 30 + aeps 100 + + one 882 803 + zero 882 803 + plead 905 + gap 112766 + toggle_bit 2 + min_repeat 3 + + begin codes + Power 0x1A8C + Mute 0x1A8D + 1 0x1281 + 2 0x1A82 + 3 0x1283 + 4 0x1A84 + 5 0x1285 + 6 0x1A86 + 7 0x1287 + 8 0x1A88 + 9 0x1289 + 0 0x1A80 +# -/-- 0x128A + User1 0x128A +# A/B 0x1AA3 + User2 0x1AA3 + Red 0x0AAB + Green 0x02AC + Yellow 0x0AAD + Blue 0x02AE + Ok 0x0A97 + Up 0x12A0 + Down 0x1AA1 + Left 0x1291 + Right 0x1A90 +# SFI 0x12AF + User3 0x12AF +# Exit 0x1AA2 + Back 0x1AA2 +# INFO 0x028F + User4 0x028F + Prog+ 0x1AA0 + Prog- 0x12A1 +# TV/Radio 0x0293 + User5 0x0293 + Volume+ 0x1A90 + Volume- 0x1291 + Menu 0x0A92 +# Hilfe 0x1A8F + User6 0x1A8F +# TXT 0x12BC + User7 0x12BC +# STOP 0x1AA9 + User8 0x1AA9 +# EXT 0x12B8 + User9 0x12B8 +# HILFE2 0x0AB6 + end codes + +end remote + + diff --git a/utilities/lirc/lirc/lircd.conf.vivcontrol6 b/utilities/lirc/lirc/lircd.conf.vivcontrol6 new file mode 100644 index 0000000..5a7cebe --- /dev/null +++ b/utilities/lirc/lirc/lircd.conf.vivcontrol6 @@ -0,0 +1,63 @@ +# +# this config file was automatically generated +# using WinLIRC 0.6.5 (LIRC 0.6.1pre3) on Mon May 03 13:45:32 2004 +# +# contributed by +# +# brand: Vivanco +# model: Viv.Control6 +# supported devices: DVD player (code 278) +# + +begin remote + + name Viv.Control6 + bits 11 + flags SPACE_ENC + eps 25 + aeps 100 + + header 2479 466 + one 1279 466 + zero 673 466 + ptrail 673 + post_data_bits 8 + post_data 0xC9 + gap 13186 + toggle_bit 0 + + + begin codes + Power 0x0000000000000545 + Up 0x0000000000000465 + Down 0x0000000000000065 + 1 0x0000000000000005 + 2 0x0000000000000405 + 3 0x0000000000000205 + 4 0x0000000000000605 + 5 0x0000000000000105 + 6 0x0000000000000505 + 7 0x0000000000000305 + 8 0x0000000000000705 + 9 0x0000000000000085 + 0 0x0000000000000485 + User1 0x0000000000000655 + User2 0x0000000000000155 + Mute 0x0000000000000255 + Menu 0x00000000000006C5 + Ok 0x0000000000000685 + Back 0x0000000000000785 + Up 0x00000000000004F5 + Down 0x00000000000002F5 + Left 0x00000000000006F5 + Right 0x00000000000001F5 + Red 0x0000000000000665 + Yellow 0x0000000000000265 + Blue 0x0000000000000165 + User3 0x0000000000000385 + Green 0x00000000000000E5 + User4 0x00000000000004E5 + end codes + +end remote + diff --git a/utilities/lirc/lirc/lircmd.conf b/utilities/lirc/lirc/lircmd.conf new file mode 100644 index 0000000..8aa0168 --- /dev/null +++ b/utilities/lirc/lirc/lircmd.conf @@ -0,0 +1,5 @@ +#UNCONFIGURED +# +# To find out how to get a proper configuration file please read: +# +# /usr/share/doc/lirc/README.Debian diff --git a/utilities/lirc/lirc/lircrc b/utilities/lirc/lirc/lircrc new file mode 100644 index 0000000..96e9124 --- /dev/null +++ b/utilities/lirc/lirc/lircrc @@ -0,0 +1,142 @@ +# Zum starten diverser Programme kann irexec benutzt werden: irexec -d +# "remote" muss mit "name" in lircd.conf übereinstimmen +# +# +# + + +begin + remote = TTS35AI + button = Power + prog = irexec + repeat = 0 + config = mplayer -vo xv -ao oss dvd://1 +end + +begin + remote = TTS35AI + prog = xmms + button = One + repeat = 0 + config = PLAY + +end + +begin + remote = TTS35AI + prog = xmms + button = Stop + repeat = 0 + config = STOP + +end + +begin + remote = TTS35AI + prog = xmms + button = VolU + repeat = 0 + config = VOL_UP 5 + +end + +begin + remote = TTS35AI + prog = xmms + button = VolD + repeat = 0 + config = VOL_DOWN 5 + +end + +begin + remote = TTS35AI + prog = xmms + button = ProgU + repeat = 0 + config = PREV + +end + +begin + remote = TTS35AI + prog = xmms + button = ProgD + repeat = 0 + config = NEXT + +end + +begin + remote = TTS35AI + prog = xmms + button = Forward + repeat = 1 + config = FWD 5 + +end + +begin + remote = TTS35AI + prog = xmms + button = Rewind + repeat = 1 + config = BWD 5 + +end + +begin + remote = TTS35AI + button = Volume+ + prog = mplayer + config = volume 1 + repeat = 1 +end + +begin + remote = TTS35AI + button = Volume+ + prog = mplayer + config = volume -1 + repeat = 1 +end + +begin + remote = TTS35AI + button = Up + prog = mplayer + config = pause + repeat = 0 +end + +begin + remote = TTS35AI + button = Down + prog = mplayer + config = quit + repeat = 0 +end + +begin + remote = TTS35AI + button = OK + prog = mplayer + config = vo_fullscreen + repeat = 0 +end + +begin + remote = TTS35AI + button = Left + prog = mplayer + config = seek -50 + repeat = 1 +end + +begin + remote = TTS35AI + button = Right + prog = mplayer + config = seek 50 + repeat = 1 +end diff --git a/utilities/lirc/lirc_init b/utilities/lirc/lirc_init new file mode 100644 index 0000000..05afcb0 --- /dev/null +++ b/utilities/lirc/lirc_init @@ -0,0 +1,130 @@ +#! /bin/sh +# +# This is an init script for Debian. +# Copy it to /etc/init.d/lirc and type +# > update-rc.d lirc defaults 20 +# + +# default configuration +DEVICE="/dev/lirc0" +DRIVER="default" +LOAD_MODULES=true +MODULES="lirc_dev lirc_serial" + +LIRCD="/usr/sbin/lircd" +LIRCD_ARGS="--permission=666" +#LIRCD_CONF="/etc/lirc/lircd.conf" + +LIRCMD="/usr/sbin/lircd" +#LIRCMD_CONF="/etc/lirc/lircmd.conf" + +START_LIRCD=true +START_LIRCMD=true + +# load configuration if any +if [ -f /etc/default/lirc ] ; then + . /etc/default/lirc +fi + +[ ! -n "$LIRCD_CONF" ] && LIRCD_CONF="/etc/lirc/lircd.conf" +[ ! -n "$LIRCMD_CONF" ] && LIRCMD_CONF="/etc/lirc/lircmd.conf" + +# functions +load_modules () +{ + local MODULES_MISSING=false + + for mod in $* + do + modprobe -k $mod 2> /dev/null || MODULES_MISSING=true + done + + if $MODULES_MISSING; then + echo "#####################################################" + echo "## I couldn't load the required kernel modules ##" + echo "## You should install lirc-modules-source to build ##" + echo "## kernel support for your hardware. ##" + echo "#####################################################" + echo "## If this message is not appropriate you may set ##" + echo "## LOAD_MODULES=false in /etc/default/lirc ##" + echo "#####################################################" + START_LIRCMD=false + START_LIRCD=false + fi +} + +build_args () +{ + local ARGS="$*" + if [ -n "$DEVICE" ] && [ "$DEVICE" != "none" ]; then + if [ -d /dev/lirc ] && [ "$DEVICE" = "/dev/lirc" ];then + #new device names + DEVICE="/dev/lirc/0" + fi + ARGS="--device=$DEVICE $ARGS" + fi + if [ -n "$DRIVER" ] && [ "$DRIVER" != "none" ]; then + ARGS="--driver=$DRIVER $ARGS" + fi + echo $ARGS +} + +# test +test -f $LIRCD || exit 0 +test -f $LIRCMD || exit 0 + +if [ ! -f $LIRCD_CONF ] || grep -q "^#UNCONFIGURED" $LIRCD_CONF ; then + if [ "$1" = "start" ] ; then + echo "##################################################" + echo "## LIRC IS NOT CONFIGURED ##" + echo "## ##" + echo "## read /usr/share/doc/lirc/html/configure.html ##" + echo "##################################################" + fi + START_LIRCD=false + START_LIRCMD=false +fi +if [ ! -f $LIRCMD_CONF ] || grep -q "^#UNCONFIGURED" $LIRCMD_CONF ; then + START_LIRCMD=false +fi + +# run +case "$1" in + start) + if $LOAD_MODULES && $START_LIRCD ; then + load_modules $MODULES + fi + if $START_LIRCD ; then + echo -n "Starting lirc daemon: lircd" + LIRCD_ARGS=`build_args $LIRCD_ARGS` + start-stop-daemon --start --quiet --exec $LIRCD -- $LIRCD_ARGS $LIRCD_CONF < /dev/null + fi + if $START_LIRCMD ; then + echo -n " lircmd" + start-stop-daemon --start --quiet --exec $LIRCMD -- $LIRCMD_CONF < /dev/null + fi + echo "." + ;; + stop) + echo -n "Stopping lirc daemon: lircmd" + start-stop-daemon --stop --quiet --exec $LIRCMD + echo -n " lircd" + start-stop-daemon --stop --quiet --exec $LIRCD + echo "." + ;; + reload|force-reload) + start-stop-daemon --stop --quiet --signal 1 --exec $LIRCD + start-stop-daemon --stop --quiet --signal 1 --exec $LIRCMD + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "Usage: /etc/init.d/lircd {start|stop|reload|restart|force-reload}" + exit 1 + ;; +esac + +exit 0 diff --git a/utilities/lirc/utilitie.sh b/utilities/lirc/utilitie.sh new file mode 100644 index 0000000..230ca0c --- /dev/null +++ b/utilities/lirc/utilitie.sh @@ -0,0 +1,214 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 17.03.2009 + +# lirc + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +# uncomment to reset LINUXVERSION +#LINUXVERSION= + +# if you got into trouble, try again with a newer version like +# http://www.lirc.org/software/snapshots/lirc-0.8.5pre1.tar.bz2 + +WEB="http://prdownloads.sourceforge.net/lirc/lirc-0.8.4a.tar.bz2" +VERSION="lirc-0.8.4a" +LINK="lirc" + +VAR=`basename $WEB` +DIR=`pwd` + +KERNEL=`uname -r` +LIRC_MODULES="/lib/modules/$KERNEL/misc" +[ "$LINUXVERSION" = "sidux" ] && LIRC_MODULES="/lib/modules/$KERNEL/extra/lirc-modules" +LIRC_DRIVER="serial" +AUTOSERIAL="/var/lib/setserial/autoserial.conf" +MODPROBE="/etc/modprobe.d/lirc" +if [ "$lirc_port" = "2" ]; then + LIRC_PORT="0x2f8" + LIRC_IRQ="3" + SERIAL="/dev/ttyS1" +else + LIRC_PORT="0x3f8" + LIRC_IRQ="4" + SERIAL="/dev/ttyS0" +fi + +# make +function make_util() { + if [ "$LINUXVERSION" != "sidux" ]; then + # pre install + if [ "`apt_installed lirc`" != "xvdr" ]; then + apt_remove "lirc $(apt-cache search liblircclient | cut -d" " -f1 | grep liblircclient)" + fi + + # download and untar + download_util + extract_util + + # symlink + cd $SOURCEDIR + rm -f $LINK + ln -vfs $VERSION $LINK + + # install + WITH_LIRC_DRIVER= + for i in $LIRC_DRIVER; do + WITH_LIRC_DRIVER="$WITH_LIRC_DRIVER --with-driver=$i" + done + if [ ! "$WITH_LIRC_DRIVER" ]; then + LIRC_DRIVER="serial" + WITH_LIRC_DRIVER="--with-driver=serial" + fi + + cd $SOURCEDIR/$LINK + ./configure --prefix=$PREFIX $WITH_LIRC_DRIVER --with-port=$LIRC_PORT --with-irq=$LIRC_IRQ --enable-debug + make && checkinstall --fstrans=no --install=yes --pkgname=lirc --pkgversion "0.8.4a-xvdr" --default && TEST=ok + + # test + if [ "$TEST" != "ok" ]; then + log "ERROR - $VERSION konnte nicht erstellt werden" + return 1 + fi + + # save deb file + [ -d "$DIR/packages" ] || mkdir -p $DIR/packages + cp -f lirc*.deb $DIR/packages + + # dummy + cd $DIR/packages + echo "Section: misc +Priority: optional +Standards-Version: 3.6.2 + +Package: liblircclient0 +Version: 0.8.4a-xvdr-1 +Maintainer: Musterman <Musterman@musterman.de> +Depends: ffmpeg +Provides: ffmpeg +Architecture: all +Description: Dummy-liblircclient0 +" > ./liblircclient0 + + equivs-build liblircclient0 + dpkg -i liblircclient0_0.8.4a-xvdr-1_all.deb + + ldconfig + fi + + # config + TEST=`which lircd` + if [ "$TEST" ] && [ -f $LIRC_MODULES/lirc_dev.ko ]; then + # lirc_serial + if [ -f $LIRC_MODULES/lirc_serial.ko ]; then + setserial $SERIAL uart none + echo "#KERNEL" > /var/lib/setserial/autoserial.conf + echo "$SERIAL uart none" >> /var/lib/setserial/autoserial.conf + echo "" >> /var/lib/setserial/autoserial.conf + + echo "alias char-major-61 lirc_serial" > /etc/modprobe.d/lirc + echo "options lirc_serial irq=$LIRC_IRQ io=$LIRC_PORT" >> /etc/modprobe.d/lirc + echo "" >> /etc/modprobe.d/lirc + depmod + fi + + # /etc/default/lirc + MODULES="lirc_dev" + for i in $LIRC_DRIVER; do + MODULES="$MODULES lirc_$i" + done + + echo "# /etc/default/lirc +# +# Arguments which will be used when launching lircd +LIRCD_ARGS=\"--permission=666\" + +#Don't start lircmd even if there seems to be a good config file +#START_LIRCMD=false + +#Try to load appropriate kernel modules +LOAD_MODULES=true + +# Run \"lircd --driver=help\" for a list of supported drivers. +DRIVER=\"default\" +# If DEVICE is set to /dev/lirc and devfs is in use /dev/lirc/0 will be +# automatically used instead +DEVICE=\"/dev/lirc0\" +MODULES=\"$MODULES\" + +# Default configuration files for your hardware +LIRCD_CONF=\"/etc/lirc/lircd.conf\" +LIRCMD_CONF=\"/etc/lirc/lircmd.conf\" +" > /etc/default/lirc + + # copy files + cd $DIR + cp -rf lirc /etc + cp -f lirc_init /etc/init.d/lirc + chmod 0755 /etc/init.d/lirc + + # autostart + unfreeze_rc + update-rc.d lirc defaults 20 + freeze_rc + + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + fi +} + +# clean +function clean_util() { + if [ "$LINUXVERSION" != "sidux" ]; then + # uninstall + apt_remove "lirc liblircclient0" + + # remove source + cd $SOURCEDIR + [ -L "$LINK" ] && rm -rf "$LINK" + [ -d "$VERSION" ] && rm -rf "$VERSION" + + ldconfig + fi + + # remove config + rm -rf /etc/lirc + rm -f /etc/default/lirc + rm -f /etc/modprobe.d/lirc + depmod + + # remove autostart + unfreeze_rc + update-rc.d -f lirc remove + freeze_rc + rm -f /etc/init.d/lirc +} + +# test +function status_util() { + TEST=`which lircd` + if [ "$TEST" ] && [ -f $LIRC_MODULES/lirc_dev.ko ]; then + [ "$LINUXVERSION" = "sidux" ] && [ -f /etc/default/lirc ] && echo "2" && return 0 + [ -d $SOURCEDIR/$LINK ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/m2vrequantizer/utilitie-test.sh b/utilities/m2vrequantizer/utilitie-test.sh new file mode 100644 index 0000000..44fa435 --- /dev/null +++ b/utilities/m2vrequantizer/utilitie-test.sh @@ -0,0 +1,81 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 27.07.2006 + +# M2VRequantizer (requant) + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +WEB="http://www.xeatre.tv/community/burn/contrib/M2VRequantizer.tar.gz" +VERSION="M2VRequantizer" +LINK="m2vrequantizer" + +VAR=`basename $WEB` +DIR=`pwd` + +# install +function make_util() { + download_util + extract_util + + # setzen des symlinks + cd $SOURCEDIR + rm -f $LINK + ln -vfs $VERSION $LINK + + # install + cd $SOURCEDIR/$LINK +# gcc -o requant main.c -lm + cp requant /usr/bin + + ldconfig + + # test + TEST=`which genindex` + if [ "$TEST" ]; then + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + fi +} + +# uninstall +function clean_util() { + # remove bin + rm -f /usr/bin/requant + + # remove source + cd $SOURCEDIR + rm -rf $LINK + rm -rf $VERSION + + ldconfig +} + +# test +function status_util() { + TEST=`which requant` + if [ "$TEST" ]; then + [ -d $SOURCEDIR/$LINK ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/mplayer/mplayer.sh b/utilities/mplayer/mplayer.sh new file mode 100644 index 0000000..6f00776 --- /dev/null +++ b/utilities/mplayer/mplayer.sh @@ -0,0 +1,607 @@ +#!/bin/bash +# +# $Id: mplayer.sh,v 1.41.2.7 2007/02/11 15:33:29 juri Exp $ +# + +unset LANG +declare VERSION="0.8.7-zulu-edition" + +# History (as always in the source code :-) +# 0.8.7 - zulu-edition +# - added USEAC3 autodetection from VDRs setup.conf +# - added workaround for mp4 / mov +# - added playlist support +# +# 0.8.7 - added 544x480 as valid NTSC resolution (thanks to C.Y.M) +# - removed 688x576 from the valid PAL resolutions; +# - calculate USE_SPEED with 30 fps instead of 29.97 +# - use '-vf' and '-af' instead of '-vop' and '-aop', as the +# latter are deprecated +# +# 0.8.6 - fixed a copy'n'paste bug regarding the subtitle background +# alpha color (thanks to Christian Haider) +# - changed the fps values from rational values to integer ones +# - fixed a typo setting DETC (thanks to Soeren Sonnenburg) +# - disabled the use of -forceidx for RealVideos, because since +# mplayer-1.0pre5 it isn't necessary anymore +# +# 0.8.5 - changed the check for the existence of the video file to check also +# that it can actually be read +# - added a new PAL height: 544 +# - [experimental] use detelicining (detc) filter to play NTSC as PAL; +# thanks to Martin Hoffmann for this one +# - [experimental] make the detelecinig filter configurable via conf-file +# - changed the warning messages about wrong DVD options to be displayed +# only when DEBUG is set to true +# - added a comment to mplayer.sh.conf that the DVD dummy files MUST be +# named DVD/VCD in capital letters +# - removed '-afm 9' from AO defaults, because audio filters by numbers are +# removed from MPlayer (9 meant hwac, it is handeled differently anyway) +# - changed the the use of the -speed parameter: the man pages says one +# should use a value between 0.01 and 100, not something like 25:24 +# +# 0.8.4 - added some more debugging info +# - changed the MPlayer option that is used to play DVDs and VCDs from +# -vcd/-dvd to VCD:// and DVD:// +# - added cuefile support for MPlayer version 1.0x +# - added new config option to distinguish MPlayer versions (0.9x or 1.0) +# important for playing cuefiles +# - fixed bug in detecting empty CACHE option +# - fixed a bug where USE_SPEED is ignored and '-speed' always used +# - added a check for the return value of 'mplayer -identify' +# - added support for AC3 sound when playing a DVD +# - make audio output configurable via config file (e.g. for DXR3) +# +# 0.8.3 - changed the default value of USERDEF from '-really-quiet' to '-quiet', +# because it suppressed the progressbar messages from mplayer +# - added '-dvd 1' to the DVD call to reliably play a DVD +# (though only the first one) +# +# 0.8.2 - changed the way mplayer is called to identify files; +# should prevent the opening of a X window, that happens +# on some systems +# - play mpeg files without any scaling if possible +# - added config line for AC3 out via DVB card (thanks to Christian Jacobsen) +# - added a new config option to choose the video out device; +# intended for dx3 users +# - added config options for subtitles (thanks to Martin �kerstr�m) +# - fixed a bug when SLOW_CPU is set to "false" instead of being +# just commented out +# - minor code clean-up +# - cleanup some comments and messages +# +# 0.8.1 - fixed a bug when DVDFiles or DVD not set correctly +# - if path to mplayer is incorrect, log an error and exit +# - cue file support; you can now choose a cue file as input; +# after I did this on user request, I asked myself, for what +# do one needs this, as mplayer can play .bin files directly... +# - support for 16/9 TV sets (thanks to Vaclav Janecek) +# +# 0.8.0 - bumped the version number to be more flexible +# - added VCD/DVD support +# +# 0.0.7 - clear LANG variable +# - added support for slow computers: reduces the Y +# resolution to the half of the possible maximum +# - use kind of a window for detecting the frames_per_sec +# +# 0.0.6a-jha +# - fixed a bug that prevented the SLAVE mode from working +# +# 0.0.6-jha +# - major rework +# - added config option to disable either NTSC or PAL support +# - added mplayer's '-speed' option; is disabled by default (see +# config file), because it didn't work as expected for me +# - rudimentary sub titles support: +# if a sub titles file (.sub suffix) with exactly the +# same name as the played video file exists, it is used +# (not really useful yet) +# - changed the was the config file is parsed: +# let's do it the simple way, just source the file +# ================================================= +# ---> IMPORTANT! you MUST use the new config file +# ================================================= +# +# 0.0.5d-jha +# - added AC3 support (thanks to Christian Jacobsen +# <christian.jacobsen -at- stageholding.de>) +# - better support for mplayers SLAVE mode +# - fixed some scaling problems +# - some minor clean-ups +# +# 0.0.5c-jha +# - play videos with 24 or 23.976 fps as NTSC, not PAL +# +# 0.0.5b-jha +# - Improved getvidxy - thanks to new mplayer option '-identify' +# it gets now the correct values for X-/Y-resolution +# and the framerate (if defined in the video file) +# for all media files +# - reworked the scaling calculation to scale only if needed +# and if so, scale as little as possible to save CPU power +# - distinguish between NTSC and PAL files; play them with +# the right TV norm +# +# 0.0.4 Improved getvidxy - No Temp Files needed anymore! +# +# 0.0.3 Seems to work fine - still lacks support for X x 432 Files +# What about MPEG Files ? +# + + +function initialize () { + # source config file + source "$CFGFIL" + + # Debug Mode ? + if test -z "$DEBUG" -o "$DEBUG" != "true"; then DEBUG=false; fi + + # use AC3? + VAR=$( grep "^UseDolbyDigital =" /var/lib/vdr/setup.conf | tail -n1 | sed -e "s/^UseDolbyDigital =//" -e 's/ //g' -e 's/#.*//') + if test -z "$VAR" -o "$VAR" != "1"; then USEAC3=false; else USEAC3=true; fi +# if test -z "$USEAC3" -o "$USEAC3" != "true"; then USEAC3=false; fi + debugvar USEAC3 "$USEAC3" + + # AC3 command line + if test -z "$AC3AOUT"; then + errorcfg AC3AOUT + exit + else + debugvar AC3AOUT "$AC3AOUT" + fi + + # TV aspect ratio + if test -z "$TV_ASPECT"; then errorcfg TV_ASPECT; fi + debugvar TV_ASPECT "$TV_ASPECT" + + # can do PAL? + if test -z "$PAL" -o "$PAL" != "true"; then PAL=false; fi + debugvar PAL "$PAL" + + # can do NTSC? + if test -z "$NTSC" -o "$NTSC" != "true"; then NTSC=false; fi + debugvar NTSC "$NTSC" + + if test $NTSC == "false" -a $PAL == "false"; then + echolog "*** FATAL: Config Options NTSC and PAL both set to false ... Exiting." + exit + fi + + # use speed setting? + SPEED="" + if test -z "$USE_SPEED"; then USE_SPEED=false; fi + debugvar USE_SPEED "$USE_SPEED" + + # which detelecining filter should be used, if configured + # to play NTSC as PAL + if test -z "$DETC_FILTER"; then DETC_FILTER="detc=dr=2:am=1"; fi + debugvar DETC_FILTER "$DETC_FILTER" + + # where is Mplayer + if ! test -x "$MPLAYER" -a -f "$MPLAYER"; then + echolog "*** Option MPLAYER not found in config file or not set correctly" + exit + else + debugvar MPLAYER "$MPLAYER" + fi + + if test -z "$VOP"; then errorcfg VOP; exit; else debugvar VOP "$VOP"; fi + + if test -z "$VO"; then errorcfg VO; exit; else debugvar VO "$VO"; fi + + if test -z "$AO"; then errorcfg AO; exit; else debugvar AO "$AO"; fi + AOUT="-ao $AO" + + if test -z $CACHE; then + echolog "*** Option CACHE not set in config file - calling mplayer without Cache!" + CACHESTR="-nocache" + else + CACHESTR="-cache $CACHE"; debugvar CACHE "$CACHE"; debugvar CACHESTR "$CACHESTR" + fi + + if test -z "$FRAMEDROP" -o "$FRAMEDROP" != "true"; then FRAMEDROP=false; fi + debugvar FRAMEDROP "$FRAMEDROP" + if $FRAMEDROP; then FDSTR="-framedrop"; fi + debugvar FDSTR "$FDSTR" + + declare LIRCSTR="" # no extra Lirc option! + if ! test -z "$LIRCRC"; then LIRCSTR="-lircconf $LIRCRC"; fi + debugvar LIRCRC "$LIRCRC"; debugvar LIRCSTR "$LIRCSTR" + + if ! test -z "$SUBPOS"; then SUBTITLES=" -subpos $SUBPOS"; fi + if ! test -z "$SUBCOLOR"; then SUBTITLES="$SUBTITLES -sub-bg-color $SUBCOLOR"; fi + if ! test -z "$SUBALPHA"; then SUBTITLES="$SUBTITLES -sub-bg-alpha $SUBALPHA"; fi + + debugvar SUBTITLE "$SUBTITLES" + + if test "$SLAVE" != "SLAVE"; then + REMOTE="$LIRCSTR" + else + REMOTE="-slave -nolirc" + fi + debugvar REMOTE "$REMOTE" + + if ! test -z "$USERDEF"; then echolog "*** Use Option USERDEF at your own risk!"; fi + debugvar USERDEF "$USERDEF" + + if test -z $XResPAL; then errorcfg XResPAL; exit; else debugvar XResPAL "${XResPAL[*]}"; fi + if test -z $XResNTSC; then errorcfg XResNTSC; exit; else debugvar XResNTSC "${XResNTSC[*]}"; fi + + # do we run on a slow computer? + if test -z "$SLOW_CPU" -o "$SLOW_CPU" == "false"; then + SLOW_CPU=false + else + XResPAL=(352) + XResNTSC=(352) + debugvar XResPAL "${XResPAL[*]}" + debugvar XResNTSC "${XResNTSC[*]}" + fi + debugvar SLOW_CPU "$SLOW_CPU" + + if ! test -d "$DVDFiles"; then debugmsg "*** Option DVDFiles not set correctly! You will not be able to play VCD/DVD" ""; DVDFiles=""; fi + debugvar DVDFiles "$DVDFiles" + if ! test -b "$DVD"; then debugmsg "*** Option DVD not set correctly! You will not be able to play VCD/DVD" ""; DVD=""; fi + debugvar DVD "$DVD" + if test -z $DVDLANG; then DVDLANG="en"; fi + debugvar DVDLANG "$DVDLANG" + + # extra DVD options + debugvar DVDOPTIONS "$DVDOPTIONS" + + # extra VCD options + debugvar VCDOPTIONS "$VCDOPTIONS" + + # play MPEG files without rescaling? + if test -z "$MPEG_DIRECT" -o "$MPEG_DIRECT" != "false"; then MPEG_DIRECT="true"; fi + debugvar MPEG_DIRECT "$MPEG_DIRECT" + + # get the file extension of the video + SUFFIX=$(echo -e "${FILE:$[${#FILE}-4]:4}" | tr [A-Z] [a-z]) + debugvar SUFFIX $SUFFIX + + if test -z "$MPLAYER_V1"; then + echolog "*** MPLAYER_V1 not set! Setting it to 'false'." + echolog "*** If you cannot play cue-files, then set it to 'true'." + MPLAYER_V1="false" + fi + debugvar MPLAYER_V1 "$MPLAYER_V1" + + return; +} + + +function getvidxy () { + + # call: getvidxy + # determine x and y resolution of the file! + # output: variable ORIG_X and ORIG_Y (global) + + # variable definitions + local TEMP1 MPLAYER_RETURN TEMP_ASPECT + ORIG_X=0; ORIG_Y=0 + + TEMP1=`$MPLAYER -identify -vo null -ao null -frames 0 "$FILE" 2>/dev/null | grep -i -e "^ID_"` + MPLAYER_RETURN=$? + debugmsg "OutputFromMPLAYER:" "$TEMP1" + debugmsg "MPLAYER_RETURN: " "$MPLAYER_RETURN" + + if test $MPLAYER_RETURN -ne 0; then + echolog "*** FATAL: something went wrong analyzing the video; mplayer reported an error!" + echolog "*** FATAL: check your mplayer installation. Exiting..." + exit + fi + + ORIG_X=`echo "$TEMP1"|grep ID_VIDEO_WIDTH|cut -d"=" -f2` + debugmsg "parsed output for ORIG_X:" $ORIG_X + + ORIG_Y=`echo "$TEMP1"|grep ID_VIDEO_HEIGHT|cut -d"=" -f2` + debugmsg "parsed output for ORIG_Y:" $ORIG_Y + + ORIG_FPS=`echo "$TEMP1"|grep ID_VIDEO_FPS|cut -d"=" -f2` + debugmsg "parsed output for ORIG_FPS:" $ORIG_FPS + + ORIG_ASPECT=`echo "$TEMP1"|grep ID_VIDEO_ASPECT|cut -d"=" -f2` + debugmsg "parsed output for ORIG_ASPECT:" $ORIG_ASPECT + +# TEMP_ASPECT=`echo $ORIG_ASPECT | sed 's/\.//'` +# if test $TEMP_ASPECT -eq 0; then +# TEMP_ASPECT=$((100 * $ORIG_X / $ORIG_Y)) +# case $TEMP_ASPECT in +# 1333) ORIG_ASPECT=1.3333 ;; +# *) ORIG_ASPECT=1.7777 ;; +# esac +# debugmsg "New ORIG_ASPECT:" $ORIG_ASPECT +# fi + + VIDEO_FORMAT=`echo "$TEMP1"|grep ID_VIDEO_FORMAT|cut -d"=" -f2` + debugmsg "parsed output for VIDEO_FORMAT:" $VIDEO_FORMAT + + AUDIO_CODEC=`echo "$TEMP1"|grep ID_AUDIO_CODEC|cut -d"=" -f2` + debugmsg "parsed output for AUDIO_CODEC:" $AUDIO_CODEC + + return; +} + + +function calcnewxy () { + local -i MAX_X + + if test $ORIG_X -gt 352 -o $ORIG_Y -gt $HALF_Y; then + MAX_X=$(($FULL_Y*$TV_ASPECT)) + else + MAX_X=$(($HALF_Y*$TV_ASPECT)) + fi + debugvar MAX_X $MAX_X + + NEW_Y=$(($MAX_X*$ORIG_Y/$ORIG_X)); debugvar NEW_Y $NEW_Y + echolog "*** INFO: For Sqare Pixels we would scale to $MAX_X x $NEW_Y ..." + test $NEW_Y -gt $FULL_Y && NEW_Y=$FULL_Y # force full screen/ ignore aspect ratio! + + return; +} + + +function choosebestx () { + local -i MAX_X INDEX + local XResTEMP + declare repeat=true + INDEX=0 + + if $SLOW_CPU; then + XResTEMP=(352) + else + if test $HALF_Y -eq 240; then + XResTEMP=(${XResNTSC[*]}) + else + if test $HALF_Y -eq 288; then + XResTEMP=(${XResPAL[*]}) + else + echolog "*** FATAL: HALF_Y not set or unknown: \"$HALF_Y\" ... Exiting." + exit + fi + fi + fi + debugvar XResTEMP "${XResTEMP[*]}" + + ANZAHL=${#XResTEMP[*]} + debugvar AnzahlVonXResTEMP $ANZAHL + + until ! $repeat; do + if test ${XResTEMP[$INDEX]} -ge $ORIG_X; then repeat=false; NEW_X=${XResTEMP[$INDEX]}; fi + INDEX=$(($INDEX+1)) + if test $INDEX -ge $ANZAHL; then repeat=false; NEW_X=${XResTEMP[$ANZAHL-1]}; fi + done + debugvar NEW_X $NEW_X + + return; +} + + +function choosebesty () { + if test \( $ORIG_Y -eq $HALF_Y -a $ORIG_X -eq 352 \) -o \( $ORIG_Y -eq $FULL_Y -a ! $SLOW_CPU \); then + REAL_Y=$ORIG_Y + NEW_Y=$ORIG_Y + NEW_X=$ORIG_X + debugmsg "setting NEW = ORIG" + else + if test $ORIG_X -gt 352 -o $ORIG_Y -gt $HALF_Y; then + REAL_Y=$FULL_Y + debugmsg "setting REAL_Y = FULL_Y" + else + REAL_Y=$HALF_Y + debugmsg "setting REAL_Y = HALF_Y" + fi + fi + return; +} + + +function set_ntsc () { + HALF_Y=240 + if $SLOW_CPU; then + FULL_Y=$HALF_Y + else + FULL_Y=480 + fi + NEW_FPS="30" + return; +} + + +function set_pal () { + HALF_Y=288 + if $SLOW_CPU; then + FULL_Y=$HALF_Y + else + FULL_Y=576 + fi + NEW_FPS="25" + return; +} + + +function checkforac3 () { + if test "X$AUDIO_CODEC" == "Xa52" && $USEAC3; then AOUT="$AC3AOUT"; fi + return; +} + + +function checktvnorm () { +local -i TEMP_FPS +TEMP_FPS=`echo $ORIG_FPS|sed 's/\.//'` + if test $TEMP_FPS -ge "23000" -a $TEMP_FPS -le "24499"; then + debugmsg "Film" + if $NTSC; then + set_ntsc + else + set_pal + $USE_SPEED && SPEED="-speed 1.04" # 25/24 = 1.04 + fi + else + if test \( $TEMP_FPS -ge "14000" -a $TEMP_FPS -le "16000" \) -o \( $TEMP_FPS -ge "29000" -a $TEMP_FPS -le "30499" \); then + debugmsg "NTSC" + if $NTSC; then + set_ntsc + else + set_pal + if $USE_SPEED; then + SPEED="-speed 1.04" # 25/24 = 1.04 + DETC=",$DETC_FILTER" + fi + fi + else + debugmsg "PAL or unknown" $ORIG_FPS + if $PAL; then + set_pal + else + set_ntsc + $USE_SPEED && SPEED="-speed 1.20" # 30/25 = 1.20 + fi + fi + fi + return; +} + + +function echolog () { + # prints the string on stdout and into /var/log/messages using logger! + logger -s -- "$1" + return; +} + + +function errorcfg () { + echolog "*** FATAL: Config Option $1 not found in config file ... Exiting." + exit; +} + + +function debugvar () { + if $DEBUG; then echolog "*** DEBUG: Variable $1 has value \"$2\""; fi + return; +} + + +function debugmsg () { + if $DEBUG; then echolog "*** DEBUG: $1 \"$2\""; fi + return; +} + +function newscale () { + + return; +} + +# begin main! +# +# +# --------------------------------------------------------------------------- +# +# + +declare -i ORIG_X ORIG_Y +declare -i NEW_X NEW_Y +declare -i HALF_Y FULL_Y +declare ORIG_FPS NEW_FPS ORIG_ASPECT VIDEO_FORMAT AUDIO_CODEC +declare CMDLINE AOUT REMOTE USERDEF SUFFIX +declare FILE="$1" +declare SLAVE="$2" +declare -a XResPAL[0] +declare -a XResNTSC[0] +declare FDSTR="" +declare SUBTITLES="" +declare DETC="" + +echolog "*** Starting mplayer.sh Version $VERSION" + +if test -z "$FILE"; then echolog "*** USAGE: mplayer.sh <File_to_be_played>"; exit; fi +if ! test -r "$FILE"; then echolog "*** ERROR: Make sure $FILE exists and is readable - otherwise it cannot be played ;-)"; exit; fi + +# Check if config file exists! +declare CFGFIL="${0}.conf" +debugvar CFGFIL $CFGFIL +if ! test -f $CFGFIL; then echolog "*** FATAL: mplayer.sh.conf not found!!! Exiting." ; exit; fi + +# read config file and initialize the variables +initialize +PLAYLIST_FILES="" + +if test \( "$FILE" == "$DVDFiles/DVD" -o "$FILE" == "$DVDFiles/VCD" \) -a -n "$DVDFiles" -a -n "$DVD"; then + if test "$FILE" == "$DVDFiles/DVD"; then + $USEAC3 && AOUT="$AC3AOUT" + CMDLINE="$MPLAYER -vo $VO $AOUT -alang $DVDLANG $DVDOPTIONS $FDSTR $CACHESTR $REMOTE $USERDEF -dvd-device $DVD dvd://" + fi + if test "$FILE" == "$DVDFiles/VCD"; then + CMDLINE="$MPLAYER -vo $VO $AOUT $VCDOPTIONS $FDSTR $CACHESTR $REMOTE $USERDEF -cdrom-device $DVD vcd://" + fi + unset FILE +elif test "${SUFFIX}" == ".cue"; then + if $MPLAYER_V1; then + CMDLINE="$MPLAYER -vo $VO $AOUT $FDSTR $CACHESTR $REMOTE $USERDEF cue://$FILE:2" + unset FILE + else + CMDLINE="$MPLAYER -vo $VO $AOUT $FDSTR $CACHESTR $REMOTE $USERDEF -vcd 2 -cuefile" + fi +else + # Playlist support + if test "${SUFFIX}" == ".asx" -o "${SUFFIX}" == ".m3u" -o "${SUFFIX}" == ".pls" ; then + LINES=`cat $FILE` + for LINE in $LINES; do + [ -f "$LINE" ] && PLAYLIST_FILES="$PLAYLIST_FILES $LINE" + done + debugvar PLAYLIST_FILES "$PLAYLIST_FILES" +# for PLAYFILE in $PLAYLIST_FILES; do +# [ -f "$PLAYFILE" ] && exec ${0} "$PLAYFILE" +# done +# exit + first=`grep -v -m1 "^#" $FILE` + FILE="$first" + debugvar FILE "$FILE" + fi + + # Try to determine the video attributes + if $DEBUG; then echolog "*** DEBUG: Calling getvidxy function to analyze source video stream ..."; fi + getvidxy + echolog "*** INFO: Source Video has Resolution of $ORIG_X x $ORIG_Y ..." + if test $ORIG_X -eq 0 -o $ORIG_Y -eq 0; then echolog "*** FATAL: something went wrong analyzing the video; check your mplayer version ..."; exit; fi + + NEW_FPS=$ORIG_FPS + +# if `echo "$VIDEO_FORMAT"| egrep -q "RV??"`; then +# FORCEIDX="-forceidx" +# else +# FORCEIDX="" +# fi + + checkforac3 + checktvnorm + calcnewxy + choosebestx + choosebesty + if test $NEW_X -eq 0 -o $NEW_Y -eq 0; then echolog "*** FATAL: Illegal Resolution ..."; exit; fi + + if test $MPEG_DIRECT == "true" -a \( $VIDEO_FORMAT == "0x10000001" -o $VIDEO_FORMAT == "0x10000002" \) -a \( \ + \( $PAL -a $NEW_FPS == "25" -a \( \( $ORIG_X == "352" -a $ORIG_Y == "288" \) -o \( $ORIG_Y == "576" -a \ + \( $ORIG_X == "352" -o $ORIG_X == "480" -o $ORIG_X == "528" -o $ORIG_X == "544" -o $ORIG_X == "704" -o $ORIG_X == "720" \) \) \) \) -o \ + \( $NTSC -a $NEW_FPS == "30" -a \( \( $ORIG_X == "352" -a $ORIG_Y == "240" \) -o \( $ORIG_Y == "480" -a \ + \( $ORIG_X == "352" -o $ORIG_X == "480" -o $ORIG_X == "512" -o $ORIG_X == "544" -o $ORIG_X == "640" -o $ORIG_X == "704" -o $ORIG_X == "720" \) \) \) \) \ + \) ; then + CMDLINE="$MPLAYER -vo $VO $AOUT $FDSTR $CACHESTR $REMOTE $USERDEF" + else + # Workaround for mp4 / mov + if test "${SUFFIX}" == ".mov" -o "${SUFFIX}" == ".MOV" -o "${SUFFIX}" == ".mp4" || `echo "$VIDEO_FORMAT"| egrep -q "avc1"` || `echo "$VIDEO_FORMAT"| egrep -q "jpeg"`; then + CMDLINE="$MPLAYER -vo $VO $AOUT -demuxer mov -vf scale=656:492${DETC},expand=720:576:-1:-1:0,$VOP:$NEW_FPS $SPEED $FDSTR $CACHESTR $REMOTE $SUBTITLES $USERDEF $FORCEIDX" + else + CMDLINE="$MPLAYER -vo $VO $AOUT -vf scale=$NEW_X:${NEW_Y}${DETC},expand=$NEW_X:$REAL_Y:-1:-1:0,$VOP:$NEW_FPS $SPEED $FDSTR $CACHESTR $REMOTE $SUBTITLES $USERDEF $FORCEIDX" + fi + fi +fi + +debugvar CMDLINE "$CMDLINE" +if [ -n "$PLAYLIST_FILES" ]; then + exec $CMDLINE $PLAYLIST_FILES +else + exec $CMDLINE "$FILE" +fi +exit diff --git a/utilities/mplayer/mplayer.sh.conf b/utilities/mplayer/mplayer.sh.conf new file mode 100644 index 0000000..12f0288 --- /dev/null +++ b/utilities/mplayer/mplayer.sh.conf @@ -0,0 +1,147 @@ +## Config File for mplayer.sh ... +# +# $Id: mplayer.sh.conf,v 1.24.2.3 2007/02/11 15:19:35 juri Exp $ +# +# *** +# *** Mandatory Values +# *** +# +# Where to find mplayer executable ? +# it must be the full path *including* the binary, e.g. +# MPLAYER="/usr/bin/mplayer" +# or just the name of the binary, e.g.: +# MPLAYER="mplayer" +MPLAYER="/usr/bin/mplayer" + +# Video Out Filter lavc or fame - see mplayer DVB docs for details ! +#VOP="lavc=9000" +VOP="lavc=5000" + +# Video out device +# most users will want the default of 'mpegpes', but users with a dxr3 +# need to use 'dxr3', or users using softdevice might need 'dfbmga' +# If the DVB card with the MPEG decoder is not the first device as seen +# by the drivers/VDR, then you have to specify which card it actually is. +# Do so with 'mpegpes:card=X', where X is the card number (see also AO) +#VO="dxr3" +#VO="dfbmga" +#VO="mpegpes:card=1" +VO="mpegpes" + +# Audio output device and possible additional options +# most users will want the default of 'mpegpes', but users with a dxr3 +# need to use 'oss:/dev/em8300_ma-0' +# users using softdevice might want to use 'oss' or 'alsa' +# If the DVB card with the MPEG decoder is not the first device as seen +# by the drivers/VDR, then you have to specify which card it actually is. +# Do so with 'mpegpes:card=X', where X is the card number (see also VO) +#AO="oss:/dev/em8300_ma-0" +#AO="alsa" +#AO="mpegpes:card=1" +AO="mpegpes" + +# X-Resolutions for the DVBs card (smallest value first!) +# +XResPAL=(352 480 528 544 704 720) +XResNTSC=(352 480 512 544 640 704 720) + +# Set the following to 'true' or 'false' according to +# the capabilities of your TV set. +# +# In case of NTSC="false", see also DETC_FILTER below +# +# At least _one_ has to be true! +# If your TV can do both, I strongly recommend to keep both set to "true"! +PAL="true" +NTSC="false" + +# Use mplayer's -speed option for videos with a different +# frames/s value than the selected TV norm +# +# this setting is only used if either PAL or NTSC +# is set to false! +USE_SPEED="true" + +# set to true if you want to use AC3 output +USEAC3="true" + +# how to play AC3 audio? +# for AC3 via sound card (ALSA driver): +#AC3AOUT="-ao alsa9 -ac hwac3" +# for AC3 via DVB (doesn't need AC3overDVB patch); +# needs MPlayer 0.90 final, or newer: +AC3AOUT="-ac hwac3" + +# what aspect ratio has your TV set? +# either 4/3 (conventional) or 16/9 (widescreen) +#TV_ASPECT="16/9" +TV_ASPECT="4/3" + +# *** +# *** Optional Setting *** Simply Remove them if they do not fit your needs... +# *** + +# What detelecinig filter should we use to play NTSC material as PAL? +# This is only used if you have set NTSC to false and PAL to true. +# If you use MPlayer versions 1.0 or higher I recommend to use the +# following setting "ivtc=1", but this is not supported by MPlayer 0.9x +DETC_FILTER="ivtc=1" +#DETC_FILTER="detc=dr=2:am=1" + +# What version of MPlayer do you have? +# if you have 0.9x then choose 'false' +# if you have 1.0(pre) then choose 'true' +MPLAYER_V1="true" + +# Cache Option for MPlayer +CACHE="4096" + +# Framedrop +FRAMEDROP="true" + +# Lirc RC File +#LIRCRC="/video/.lircrc" + +# do we have a slow CPU? +# if so, reduce the Y resolution to the half of the possible maximum: +# NTSC: 240 +# PAL: 288 +# uncomment the following line if you have a slow CPU: +#SLOW_CPU="true" + +# Where to find DVD/VCD dummy files? (just a fake and empty text file for the plugin) +# Example: create two empty text files (DVD and VCD) in /video/plugins/DVD-VCD/ +# !!!The files must be named VCD and DVD (all capital letters)!!! +DVDFiles="/var/lib/vdrmedia/DVD-VCD" + +# What is your DVD-ROM device ? +DVD="/dev/dvd" + +# What languages do your DVD's use ? +DVDLANG="de" + +# extra DVD options +#DVDOPTIONS="-af volume=+10" + +# extra VCD options +VCDOPTIONS="" + +# should MPEG files be played directly (without rescaling) if possible? +MPEG_DIRECT="true" + +#Subtitle options +SUBPOS="80" #Vertical position 0-100 +SUBCOLOR="0" #Background color 0=black 255=white +SUBALPHA="30" #Background transparency (0-255) + +# Userdefined Options - make sure they do not collide with options +# used in mplayer.sh +# Only for experienced users +# USERDEF="-what -option you ever -like to give -to mplayer" +USERDEF="-quiet" +#USERDEF="" + +# set to true to enable debugging output +DEBUG="false" + +# End of Options diff --git a/utilities/mplayer/utilitie.sh b/utilities/mplayer/utilitie.sh new file mode 100644 index 0000000..34afd29 --- /dev/null +++ b/utilities/mplayer/utilitie.sh @@ -0,0 +1,243 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 08.03.2009 + +# mplayer + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +snapshot=`date '+%F'` + +WEB="http://www.mplayerhq.hu/MPlayer/releases/mplayer-checkout-snapshot.tar.bz2" +VERSION="mplayer-checkout-$snapshot" +LINK="mplayer" + +VAR=`basename $WEB` +DIR=`pwd` + +DATE=`date +%Y%m%d` + +# install +function make_util() { + status=`status_util` + if [ "$status" != "0" ]; then + apt_remove "$(apt-cache search mplayer | cut -d" " -f1 | grep mplayer)" + apt_remove "$(apt-cache search mencoder | cut -d" " -f1 | grep mencoder)" + fi + + # download and extract snapshot + path_to_snapshot="$DIR/../../files/utilities" + if [ ! -f $path_to_snapshot/mplayer-checkout-$snapshot.tar.bz2 ]; then + download_util + mkdir -p /tmp/mplayer-checkout-$snapshot + tar xjfv $path_to_snapshot/mplayer-checkout-snapshot.tar.bz2 -C /tmp/mplayer-checkout-$snapshot + VERSION="$(ls /tmp/mplayer-checkout-$snapshot)" + VAR="${VERSION}.tar.bz2" + mv -f $path_to_snapshot/mplayer-checkout-snapshot.tar.bz2 $path_to_snapshot/$VAR + rm -rf /tmp/mplayer-checkout-$snapshot + else + log "mplayer-checkout-$snapshot.tar.bz2 gefunden" + VAR="mplayer-checkout-$snapshot.tar.bz2" + fi + + extract_util + + # setzen des symlinks + cd $SOURCEDIR + rm -f $LINK + ln -vfs $VERSION $LINK + + # mplayer + cd $SOURCEDIR/$LINK + + if [ -d $SOURCEDIR/DVB/linux/include/linux/dvb ]; then # v4l-dvb or multiproto are installed + ./configure --prefix=$PREFIX --enable-dvb --enable-dvbhead --with-extraincdir=$SOURCEDIR/DVB/linux/include \ + --language=de,en --enable-gui --enable-largefiles --enable-menu --win32codecsdir=/usr/lib/win32 + else + ./configure --prefix=$PREFIX --enable-dvb --enable-dvbhead \ + --language=de,en --enable-gui --enable-largefiles --enable-menu --win32codecsdir=/usr/lib/win32 + fi + + make && checkinstall --fstrans=no --install=yes --pkgname=mplayer --pkgversion "2:1.0.svn${DATE}-xvdr" --default + + # test + TEST=`which mplayer` + if [ "$TEST" ] ; then + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + return 1 + fi + + # save deb file + [ -d "$DIR/packages" ] || mkdir -p $DIR/packages + cp -f mplayer*.deb $DIR/packages + + # create mencoder dummy package + cd $DIR/packages + echo "Section: misc +Priority: optional +Standards-Version: 3.6.2 + +Package: mencoder +Version: 2:1.0svn${DATE}-xvdr-1 +Maintainer: Musterman <Musterman@musterman.de> +Depends: mplayer +Provides: mplayer +Architecture: all +Description: Dummy-mencoder +" > ./mencoder + + equivs-build mencoder + dpkg -i mencoder_1.0svn${DATE}-xvdr-1_all.deb + + ldconfig + + # mplayer font + cd $DIR + WEB="\ +ftp://ftp.fu-berlin.de/unix/X11/multimedia/MPlayer/releases/fonts/font-arial-iso-8859-1.tar.bz2 +http://www1.mplayerhq.hu/MPlayer/releases/fonts/font-arial-iso-8859-1.tar.bz2" + VAR=`basename $WEB` + if [ -f "$FILES/utilities/$VAR" ]; then + log "$VAR gefunden" + elif [ -f "$VAR" ]; then + log "$VAR gefunden" + cp "$VAR" "$FILES/utilities" + else + log "$VAR nicht gefunden" + log "Starte download" + for i in $WEB; do + wget --tries=2 "$i" --directory-prefix="$FILES/utilities" && log "Download von $VAR erfolgreich" && break + done + [ ! -f "$FILES/utilities/$VAR" ] && log "Download von $VAR nicht erfolgreich" + fi + if [ -f "$FILES/utilities/$VAR" ]; then + [ ! -d $PREFIX/share/mplayer/font ] && mkdir -p $PREFIX/share/mplayer/font + tar xjfv "$FILES/utilities/$VAR" -C $DIR + cp $DIR/font-arial-iso-8859-1/font-arial-18-iso-8859-1/* $PREFIX/share/mplayer/font/ + else + log "Installation von $VAR nicht erfolgreich" + fi + + # mplayer skin + cd $DIR + WEB="\ +ftp://ftp.fu-berlin.de/unix/X11/multimedia/MPlayer/skins/Blue-1.7.tar.bz2 +http://www.mplayerhq.hu/MPlayer/skins/Blue-1.7.tar.bz2" + VAR=`basename $WEB` + if [ -f "$FILES/utilities/$VAR" ]; then + log "$VAR gefunden" + elif [ -f "$VAR" ]; then + log "$VAR gefunden" + cp "$VAR" "$FILES/utilities" + else + log "$VAR nicht gefunden" + log "Starte download" + for i in $WEB; do + wget --tries=2 "$i" --directory-prefix="$FILES/utilities" && log "Download von $VAR erfolgreich" && break + done + [ ! -f "$FILES/utilities/$VAR" ] && log "Download von $VAR nicht erfolgreich" + fi + + if [ -f "$FILES/utilities/$VAR" ]; then + [ ! -d $PREFIX/share/mplayer/skins ] && mkdir -p $PREFIX/share/mplayer/skins + tar xjfv "$FILES/utilities/$VAR" -C $PREFIX/share/mplayer/skins/ + cd $PREFIX/share/mplayer/skins/ + ln -sf Blue default + else + log "Installation von $VAR nicht erfolgreich" + fi + + # mplayer.sh + cd $DIR + WEB="http://batleth.sapienti-sat.org/projects/VDR/versions/mplayer.sh-0.8.7.tar.gz" + VAR=`basename $WEB` + if [ -f mplayer.sh ] && [ -f mplayer.sh.conf ]; then + cp mplayer.sh mplayer.sh.conf $VDRSCRIPTDIR + else + if [ -f "$FILES/utilities/$VAR" ]; then + log "$VAR gefunden" + elif [ -f "$VAR" ]; then + log "$VAR gefunden" + cp "$VAR" "$FILES/utilities" + else + log "$VAR nicht gefunden" + log "Starte download" + for i in $WEB; do + wget --tries=2 "$i" --directory-prefix="$FILES/utilities" && log "Download von $VAR erfolgreich" && break + done + [ ! -f "$FILES/utilities/$VAR" ] && log "Download von $VAR nicht erfolgreich" + fi + if [ -f "$FILES/utilities/$VAR" ]; then + tar xjfv "$FILES/utilities/$VAR" -C $DIR + cp mplayer.sh mplayer.sh.conf $VDRSCRIPTDIR + else + log "Installation von $VAR nicht erfolgreich" + fi + fi + + if [ -f $VDRSCRIPTDIR/mplayer.sh ] && [ -f $VDRSCRIPTDIR/mplayer.sh.conf ] ; then + chown $VDRUSER.$VDRGROUP $VDRSCRIPTDIR/mplayer.sh $VDRSCRIPTDIR/mplayer.sh.conf + chmod 0744 $VDRSCRIPTDIR/mplayer.sh + fi + + # mkdir DVD-VCD + if [ ! -d $MEDIADIR/DVD-VCD ] ; then + mkdir -p $MEDIADIR/DVD-VCD + touch $MEDIADIR/DVD-VCD/DVD $MEDIADIR/DVD-VCD/VCD + chmod 0666 $MEDIADIR/DVD-VCD/DVD $MEDIADIR/DVD-VCD/VCD + chown -R $VDRUSER:$VDRGROUP $MEDIADIR/DVD-VCD + fi + + # mkdir divx verzeichnis erstellen + [ ! -d $DIVXDIR ] && mkdir -p $DIVXDIR && log "Erstelle $DIVXDIR" +} + +# uninstall +function clean_util() { + # remove files + rm -f $VDRSCRIPTDIR/mplayer.sh + rm -f $VDRSCRIPTDIR/mplayer.sh.conf + rm -rf $PREFIX/share/mplayer + + # uninstall + apt_remove "mplayer" + apt_remove "mencoder" + + # remove source + cd $SOURCEDIR + [ -L "$LINK" ] && rm -rf "$LINK" + [ -d "$VERSION" ] && rm -rf "$VERSION" +# rm -rf mplayer-checkout-* + + ldconfig +} + +# test +function status_util() { + TEST=`which mplayer` + if [ "$TEST" ]; then + [ -d $SOURCEDIR/$LINK ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/noad/noad_0.6.1_all-patches.diff b/utilities/noad/noad_0.6.1_all-patches.diff new file mode 100644 index 0000000..f1c5ba4 --- /dev/null +++ b/utilities/noad/noad_0.6.1_all-patches.diff @@ -0,0 +1,120 @@ +diff -aurwB ../noad-0.6.1/audiotools.cpp ./audiotools.cpp +--- ../noad-0.6.1/audiotools.cpp 2005-02-13 16:00:31.000000000 +0100 ++++ ./audiotools.cpp 2008-09-25 23:46:49.000000000 +0200 +@@ -3,7 +3,9 @@ + #ifdef HAVE_LIBAVCODEC + + #include "mpeg2wrap.h" ++extern "C" { + #include "avcodec.h" ++} + + #define MIN_LOWVALS 3 + #define CUT_VAL 10 +@@ -97,8 +99,13 @@ + inbuf_ptr = mbuf; + while (size > 0) + { ++#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) + len = avcodec_decode_audio(c, (short *)outbuf, &out_size, + inbuf_ptr, size); ++#else ++ len = avcodec_decode_audio2(c, (short *)outbuf, &out_size, ++ inbuf_ptr, size); ++#endif + if (len < 0) + { + fprintf(stderr, "Error while decoding\n"); +diff -aurwB ../noad-0.6.1/main.cpp ./main.cpp +--- ../noad-0.6.1/main.cpp 2005-03-02 20:12:29.000000000 +0100 ++++ ./main.cpp 2008-09-13 01:00:16.000000000 +0200 +@@ -566,10 +566,17 @@ + signal(SIGABRT, signal_handler); + signal(SIGSEGV, signal_handler); + signal(SIGUSR1, signal_handler); ++ signal(SIGALRM, signal_handler); + + // do cleanup at exit... + atexit(cleanUp); + ++ ++ if (!bOnline) { ++ // now start alarm timer to kill hanging noad (hardcoded 30min timeout) ++ alarm(30*60); ++ } ++ + // now do the work.., + doNoad(bBefore, recDir); + +diff -aurwB ../noad-0.6.1/svdrpc.cpp ./svdrpc.cpp +--- ../noad-0.6.1/svdrpc.cpp 2005-02-12 18:32:10.000000000 +0100 ++++ ./svdrpc.cpp 2008-09-13 01:41:26.000000000 +0200 +@@ -189,6 +189,10 @@ + { + select(1, &set, NULL, NULL, &timeout); + n = read(filedes, buf + rbytes, 1); ++ if(n<0) { ++ filedes=-1; ++ break; ++ } + rbytes += n; + if (rbytes == size) + break; +@@ -214,7 +218,8 @@ + while( i < 100 && outstandingReply > 0 ) + { + usleep(10000); +- ReadReply(); ++ if( !ReadReply() ) ++ break; + i++; + } + return( outstandingReply <= 0 ); +@@ -272,10 +277,10 @@ char *noadMsg(const char *msg, const cha + + void noadStartMessage( const char *s) + { +- noadMsg("starte noad für ",s); ++ noadMsg("noad starts for ",s); + } + + void noadEndMessage( const char *s) + { +- noadMsg("noad done für ",s); ++ noadMsg("noad done for ",s); + } +diff -aurwB ../noad-0.6.1/tools.cpp ./tools.cpp +--- ../noad-0.6.1/tools.cpp 2005-09-01 13:07:29.000000000 +0200 ++++ ./tools.cpp 2008-09-13 00:59:45.000000000 +0200 +@@ -17,6 +17,8 @@ + #include <time.h> + #include <unistd.h> + #include <execinfo.h> ++#include <sys/types.h> ++#include <signal.h> + + extern int SysLogLevel; + +@@ -1157,6 +1159,10 @@ + esyslog(LOG_ERR, "ERROR: frame larger than buffer (%d > %d)", Length, Max); + Length = Max; + } ++ if (f == -1) { ++ esyslog(LOG_ERR, "ERROR: cannot open video-file (recording deleted while scanning or bad index-file)"); ++ kill(getpid(),SIGTERM); ++ } + int r = ReadStream(f,b,Length); + //int r = safe_read(f, b, Length); + //int r = read( f,b,Length); +diff -aurwB ../noad-0.6.1/vdr_cl.h ./vdr_cl.h +--- ../noad-0.6.1/vdr_cl.h 2005-03-06 09:26:00.000000000 +0100 ++++ ./vdr_cl.h 2008-09-13 01:04:51.000000000 +0200 +@@ -52,7 +52,7 @@ + + #define KILOBYTE(n) ((n) * 1024) + // The maximum size of a single frame: +-#define MAXFRAMESIZE KILOBYTE(192) ++#define MAXFRAMESIZE KILOBYTE(512) + + #define FRAMESPERSEC 25 + #define FRAMESPERMIN (FRAMESPERSEC*60) diff --git a/utilities/noad/utilitie.sh b/utilities/noad/utilitie.sh new file mode 100644 index 0000000..20347f1 --- /dev/null +++ b/utilities/noad/utilitie.sh @@ -0,0 +1,102 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 02.03.2009 + +# noad + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +WEB="http://vdr-wiki.de/vdr/noad/noad-0.6.1.tar.bz2" +VERSION="noad-0.6.1" +LINK="noad" + +VAR=`basename $WEB` +DIR=`pwd` + +# install +function make_util() { + # pre install + status=`status_util` + if [ "$status" != "0" ]; then + apt_remove "noad" + fi + + download_util + extract_util + + # setzen des symlinks + cd $SOURCEDIR + rm -f $LINK + ln -vfs $VERSION $LINK + + # install + cd $SOURCEDIR/$LINK + + [ -f "$DIR/noad_0.6.1_all-patches.diff" ] && patch -p0 < $DIR/noad_0.6.1_all-patches.diff + + ./configure --prefix=$PREFIX \ + --with-ffmpeg \ + --with-ffmpeglibdir=$PREFIX/lib \ + --with-ffmpeginclude=$PREFIX/include/libavcodec \ + --with-mpeginclude=$PREFIX/include/mpeg2dec + + + make && checkinstall --fstrans=no --install=yes --pkgname=noad --pkgversion "0.6.1-xvdr" --default + + # test + TEST=`which noad` + if [ "$TEST" ]; then + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + return 1 + fi + + # save deb file + [ -d "$DIR/packages" ] || mkdir -p $DIR/packages + cp -f noad*.deb $DIR/packages + + ldconfig + +} + +# uninstall +function clean_util() { + # uninstall noad + apt_remove "noad" + + # remove source + cd $SOURCEDIR + [ -L "$LINK" ] && rm -rf "$LINK" + [ -d "$VERSION" ] && rm -rf "$VERSION" + + ldconfig +} + +# test +function status_util() { + TEST=`which noad` + if [ "$TEST" ]; then + [ -d $SOURCEDIR/$LINK ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/projectx/utilitie.sh b/utilities/projectx/utilitie.sh new file mode 100644 index 0000000..56bbf9f --- /dev/null +++ b/utilities/projectx/utilitie.sh @@ -0,0 +1,81 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 24.03.2009 + +# projectx + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +WEB="http://www.zulu-entertainment.de/files/projectx/ProjectX-0.90.4.tar.bz2" +VERSION="ProjectX-0.90.4" +LINK="ProjectX" + +VAR=`basename $WEB` +DIR=`pwd` + +# install +function make_util() { + # java libs + apt_install "sun-java6-plugin libcommons-net-java" + apt_remove sun-j2re1.4 + + # java bin + JAVA="/usr/lib/jvm/java-6-sun/jre/bin/java" + [ ! -f $JAVA ] && JAVA=`which java` + + # projectx + download_util + extract_util + + # move dir + mv -f $SOURCEDIR/$VERSION $PREFIX/bin/ProjectX + +# # commons-net +# [ -f /usr/share/java/commons-net-1.3.0.jar ] && cp -f /usr/share/java/commons-net-1.3.0.jar $LINK/lib + + # projectx starter + if [ -f $PREFIX/bin/ProjectX/ProjectX.jar ] && [ -f $JAVA ]; then + { + echo "#!/bin/sh" + echo "exec $JAVA -jar $PREFIX/bin/ProjectX/ProjectX.jar" + } > $PREFIX/bin/projectx + chmod 755 $PREFIX/bin/projectx + fi +} + +# uninstall +function clean_util() { + # remove script + rm -f $PREFIX/bin/projectx + + # remove source + rm -rf $PREFIX/bin/ProjectX +} + +# test +function status_util() { + if [ -f "$PREFIX/bin/ProjectX/ProjectX.jar" ]; then +# [ -d $SOURCEDIR/$VERSION ] && echo "2" && return 0 +# echo "1" + echo "2" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/tcmplex_panteltje/utilitie-test.sh b/utilities/tcmplex_panteltje/utilitie-test.sh new file mode 100755 index 0000000..2e957a6 --- /dev/null +++ b/utilities/tcmplex_panteltje/utilitie-test.sh @@ -0,0 +1,81 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 23.03.2009 + +# tcmplex-panteltje + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +WEB="http://ip51cf87c4.direct-adsl.nl/panteltje/dvd/tcmplex-panteltje-0.4.7.tgz" +VERSION="tcmplex-panteltje-0.4.7" +LINK="tcmplex-panteltje" + +VAR=`basename $WEB` +DIR=`pwd` + +# install +function make_util() { + download_util + extract_util + + # setzen des symlinks + cd $SOURCEDIR + rm -f $LINK + ln -vfs $VERSION $LINK + + # install + cd $SOURCEDIR/$LINK + make + cp -f tcmplex-panteltje $PREFIX/bin + + ldconfig + + # test + TEST=`which tcmplex-panteltje` + if [ "$TEST" ]; then + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + fi +} + +# uninstall +function clean_util() { + # remove bin + rm -f $PREFIX/bin/tcmplex-panteltje + + # remove source + cd $SOURCEDIR + rm -rf $LINK + rm -rf $VERSION + + ldconfig +} + +# test +function status_util() { + TEST=`which tcmplex-panteltje` + if [ "$TEST" ]; then + [ -d $SOURCEDIR/$LINK ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/tvmovie2vdr/scripts/config.pl b/utilities/tvmovie2vdr/scripts/config.pl new file mode 100755 index 0000000..0d37919 --- /dev/null +++ b/utilities/tvmovie2vdr/scripts/config.pl @@ -0,0 +1,67 @@ +#!/usr/bin/perl + + +# Settings +$channelsfile = "/var/lib/vdr/channels.conf"; # path to channels-datei +$epgfile = "/var/lib/vdr/epgdata/epg.data"; # path to epg-file +$days2download = 7; # max. 8 days tvmovie, max 21-28 days tvinfo +$clearEPG = 1; # clear EPG before inserting them into VDR ? + # 1=true/0=false +$downloadprefix = "downloadfiles/"; # where to write downloaded files? +$updateprefix = "downloadupdatefiles/"; # where to write downloaded updatefiles? + # use a different folder! +$cleanupoldfiles = 1; # clean "old" cache-files ? + # 1=true/0=false +$networktries = 1; # number of retries when there are + # networkproblems +$abortonnetwork = 0; # abort, if there are + # networkproblems? +$networktimeout = 60; # networktimeout in seconds. + +$wantbottomflags = 1; # you want special flags like +$wanttopflags = 1; # [DolbyDigital] in the EPG ? + # 1=true/0=false +$wantosd = 0; # do you want the progress on OSD? + +our $writeimages = 1; # 1=true/0=false, only available for provider with images +our $imagepath = "/var/lib/vdrmedia/epgdata"; +our $imagetype = ".png"; # enter the imagetype, that your skin supports +our $imagesize = "120x120"; # the desired size of the Image + +# settings for TVMovie +our $baseurl = "http://tvmovie.kunde.serverflex.info/onlinedata/xml-gz5/"; +our $aendurl = "http://tvmovie.kunde.serverflex.info/onlinedata/xml-aend-gz5/"; +our $useupdate = 1; # use Updatefiles ? 1=true/0=false +our $marktvmupdate = ""; # Prefix for updated events. Leave + # empty, if you dont want this. +our $tvmimgurl = "http://www.tvmovie.de/imageTransfer/XL"; + + +# settings for TVInfo +# Attention: these settings are obsolete since they prohibit the use of their EPG. +our $http_base = "http://www.tvinfo.de/"; +our $loginURL = "exe.php3?"; +our $listeURL = "target=senderlist.inc"; +our $http_proxy = ""; # example: http://172.16.1.1:3128/ +our $tvicache_files = 1; # 1=true/0=false + +# settings for TVMerkzettelimport +our $username = "login"; +our $password = "password"; +our $tvinfoprefix = "(Timer von TVInfo)"; +our $prio="99"; +our $lifetime="99"; +our $MarginStart = 10; +our $MarginStop = 10; +our $merkzettelURL = "target=merk.inc"; +our $tviwantgenrefolder = 0; # you want folders like Spielfilm~Drama ? + # 1=true/0=false +our $tviwantseriesfolder = 0; # you want folders for series + # 1=true/0=false +# settings for hoerzu +# settings for hoerzu +our $hoerzuurl = "http://www.epgdata.com/index.php?action=sendPackage&dataType=xml&dayOffset="; +our $hoerzupin = ""; + +#settings for infosat +our $infosaturl="/var/lib/vdrmedia/epgdata/received_data"; diff --git a/utilities/tvmovie2vdr/utilitie-test.sh b/utilities/tvmovie2vdr/utilitie-test.sh new file mode 100644 index 0000000..8330731 --- /dev/null +++ b/utilities/tvmovie2vdr/utilitie-test.sh @@ -0,0 +1,80 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 05.05.2008 + +# tvmovie2vdr + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +WEB="http://vdr-wiki.de/vdr/tvmovie2vdr/tvmovie2vdr-0.5.13.tar.gz" +VERSION="tvmovie2vdr-0.5.13" +#LINK="tvmovie2vdr" + +VAR=`basename $WEB` +DIR=`pwd` + +TVMDIR="$(dirname $VDRSCRIPTDIR)/tvmovie2vdr" + +# install +function make_util() { + apt_install "libdate-manip-perl perlmagick" + + download_util + extract_util + + # install + cd $SOURCEDIR/$VERSION + mv -f config.pl_dist config.pl + mv -f channels.pl_dist channels.pl + mv -f channels_wanted.pl_dist channels_wanted.pl + cp -f $DIR/scripts/* . + mv -f $SOURCEDIR/$VERSION $TVMDIR + chown -R $VDRUSER:$VDRGROUP $TVMDIR + +# WEB="http://www.cpan.org/modules/by-module/LWP/GBARR/IO-1.2301.tar.gz" +# VAR=`basename $WEB` +# download_util +# extract_util +# cd $SOURCEDIR/IO-1.2301 +# perl Makefile.PL +# make +# make install + + # test + if [ -f $TVMDIR/tvm2vdr.pl ]; then + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + fi +} + +# uninstall +function clean_util() { + rm -rf $TVMDIR +} + +# test +function status_util() { + if [ -f $TVMDIR/tvm2vdr.pl ]; then + echo "2" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/vdradmin/patches/vdradmin-am-autoinstall.diff b/utilities/vdradmin/patches/vdradmin-am-autoinstall.diff new file mode 100644 index 0000000..fb356f2 --- /dev/null +++ b/utilities/vdradmin/patches/vdradmin-am-autoinstall.diff @@ -0,0 +1,25 @@ +--- install.sh.orig ++++ install.sh +@@ -93,14 +93,18 @@ + echo "" + echo "*** Optional ***" + echo "* Required for AutoTimer email notification" +- checkPerlModule Net::SMTP +- checkPerlModule Authen::SASL ++ echo "Perl module check for Net::SMTP is disabled by x-vdr" ++ echo "Perl module check for Authen::SASL is disabled by x-vdr" ++# checkPerlModule Net::SMTP ++# checkPerlModule Authen::SASL + echo "* Required for AutoTimer email notification and CRAM-MD5 authentication" +- checkPerlModule Digest::HMAC_MD5 ++ echo "Perl module check for Digest::HMAC_MD5 is disabled by x-vdr" ++# checkPerlModule Digest::HMAC_MD5 + echo "* Required if VDR and VDRAdmin-AM use different character encoding" + checkPerlModule Encode + echo "* Required for IPv6 support" +- checkPerlModule IO::Socket::INET6 ++ echo "Perl module check for IO::Socket::INET6 is disabled by x-vdr" ++# checkPerlModule IO::Socket::INET6 + echo "* Required if you want to use gzip'ed HTTP responses" + checkPerlModule Compress::Zlib + } diff --git a/utilities/vdradmin/utilitie.sh b/utilities/vdradmin/utilitie.sh new file mode 100644 index 0000000..1063fe0 --- /dev/null +++ b/utilities/vdradmin/utilitie.sh @@ -0,0 +1,190 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 24.01.2009 + +# vdradmin + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +WEB="http://andreas.vdr-developer.org/vdradmin-am/download/vdradmin-am-3.6.4.tar.bz2" +VERSION="vdradmin-am-3.6.4" +LINK="vdradmin" + +VAR=`basename $WEB` +DIR=`pwd` + +# install +function make_util() { + download_util + extract_util + + # setzen des symlinks + cd $SOURCEDIR + rm -f $LINK + ln -vfs $VERSION $LINK + # vdradmin-am + cd $SOURCEDIR/$LINK + # patch ./install.sh (comment this if you want to install the "Optional" perl-modules for vdradmin-am) + find $DIR/patches -name vdradmin-am-autoinstall.diff -exec patch -i \{} \; + + # start the original install.sh + chmod 0744 ./install.sh + if ./install.sh && [ -f /usr/bin/vdradmind ]; then + + # /etc/init.d/vdradmin-am + if [ -f $DIR/vdradmin-am ]; then + cp -f $DIR/vdradmin-am /etc/init.d + chmod 0755 /etc/init.d/vdradmin-am + [ "$AUTOSTART" = "on" ] && make_autostart vdradmin-am + fi + + # /usr/bin/vdradmind.conf +# export LANG="de_DE" && vdradmind.pl --config + if [ -f $DIR/vdradmind.conf ]; then + cp -f $DIR/vdradmind.conf /etc/vdradmin + else + +echo "AT_DESC = 0 +AT_FUNC = 1 +AT_LIFETIME = 99 +AT_MARGIN_BEGIN = 10 +AT_MARGIN_END = 10 +AT_OFFER = 0 +AT_PRIORITY = 99 +AT_SENDMAIL = 0 +AT_SORTBY = pattern +AT_TIMEOUT = 120 +AT_TOOLTIP = 1 +AUTO_SAVE_CONFIG = 1 +CACHE_LASTUPDATE = 0 +CACHE_REC_LASTUPDATE = 0 +CACHE_REC_TIMEOUT = 60 +CACHE_TIMEOUT = 60 +CHANNELS_WANTED = +CHANNELS_WANTED_AUTOTIMER = +CHANNELS_WANTED_PRG = +CHANNELS_WANTED_PRG2 = +CHANNELS_WANTED_SUMMARY = +CHANNELS_WANTED_TIMELINE = +CHANNELS_WANTED_WATCHTV = +CMD_LINES = 20 +EPG_DIRECT = 0 +EPG_FILENAME = $VDRVARDIR/epg.data +EPGIMAGES = $VDRVARDIR +EPG_PRUNE = 0 +ES_DESC = 0 +ES_SORTBY = pattern +GUEST_ACCOUNT = 0 +LANG = +LOCAL_NET = 0.0.0.0/32 +LOGFILE = vdradmind.log +LOGGING = 0 +LOGINPAGE = 0 +LOGLEVEL = 81 +MAIL_AUTH_PASS = +MAIL_AUTH_USER = +MAIL_FROM = from@address.tld +MAIL_SERVER = your.email.server +MAIL_TO = your@email.address +MOD_GZIP = 0 +NO_EVENTID = 0 +NO_EVENTID_ON = +PASSWORD = linvdr +PASSWORD_GUEST = guest +PROG_SUMMARY_COLS = 3 +PS_VIEW = ext +REC_DESC = 0 +REC_EXT = m3u +REC_MIMETYPE = video/x-mpegurl +RECORDINGS = 1 +REC_SORTBY = name +SERVERHOST = 0.0.0.0 +SERVERPORT = 8001 +SKIN = default +ST_FUNC = 1 +ST_LIVE_ON = 1 +ST_REC_ON = 0 +ST_STREAMDEV_PORT = 3000 +ST_URL = +ST_VIDEODIR = +TEMPLATE = default +TIMES = 18:00, 20:00, 21:00, 22:00 +TL_TOOLTIP = 1 +TM_DESC = 0 +TM_LIFETIME = 99 +TM_MARGIN_BEGIN = 10 +TM_MARGIN_END = 10 +TM_PRIORITY = 99 +TM_SORTBY = day +TM_TT_LIST = 1 +TM_TT_TIMELINE = 1 +TV_EXT = m3u +TV_INTERVAL = 5 +TV_MIMETYPE = video/x-mpegurl +TV_SIZE = half +USERNAME = linvdr +USERNAME_GUEST = guest +VDRCONFDIR = $VDRCONFDIR +VDR_HOST = localhost +VDR_PORT = 2001 +VDRVFAT = 1 +VIDEODIR = $VIDEODIR +ZEITRAHMEN = 1 +" > /etc/vdradmin/vdradmind.conf + fi + chown -R $VDRUSER.$VDRGROUP /etc/vdradmin + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + fi + ldconfig +} + +# uninstall +function clean_util() { + # uninstall vdradmin + cd $SOURCEDIR/$LINK + ./uninstall.sh + + # remove config + rm -rf /etc/vdradmin + + # remove init script + local AUTOSTART="off" + make_autostart vdradmin-am + rm -f /etc/init.d/vdradmin-am + + # remove source + cd $SOURCEDIR + rm -rf $LINK + rm -rf $VERSION + + ldconfig +} + +# test +function status_util() { + if [ -f /usr/bin/vdradmind ]; then + [ -d $SOURCEDIR/$LINK ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/vdradmin/vdradmin-am b/utilities/vdradmin/vdradmin-am new file mode 100644 index 0000000..74a0655 --- /dev/null +++ b/utilities/vdradmin/vdradmin-am @@ -0,0 +1,105 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 24.01.2009 + +# /etc/init.d/vdradmin-am + +# Default settings +if [ -f /etc/default/vdr ]; then + . /etc/default/vdr + USER=$VDRUSER + GROUP=$VDRGROUP +else + USER=root + GROUP=root +fi + +# Script settings +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/bin/vdradmind +NAME=vdradmin +DESC="VDR Webadministration interface" +PIDFILE=/var/run/vdradmin.pid +NICE="10" + +test -x $DAEMON || exit 0 + +set -e + +# Check if the logfile exists allready, if not, create it and set +# group and owner to $USER:$GROUP +function create_logfile () { + LOGFILE="/var/log/vdradmind.log" + if [ ! -e $LOGFILE ] ; then + touch $LOGFILE + chown $USER:$GROUP $LOGFILE + fi +} + +function init_language_environment() { + if [ -f /etc/environment ]; then + for var in LANG LC_ALL LC_CTYPE ; do + value=$(egrep "^[^#]*${var}=" /etc/environment | tail -n1 | cut -d= -f2) + eval $var=$value + done + fi +} + +function start_daemon() { + if [ "$vdradmin" != "off" ] && [ "$AUTOSTART" != "off" ]; then + init_language_environment + create_logfile + LANG=$LANG start-stop-daemon --start \ + -c $USER:$GROUP -b -m --nicelevel $NICE --pidfile $PIDFILE \ + --exec $DAEMON -- -nf + echo "$NAME." + else + echo -n "- aborted (to enable the daemon, edit /etc/default/vdr)" + fi +} + +function get_status() { + if start-stop-daemon --start --startas $DAEMON --test \ + --name $(basename $DAEMON) --pidfile $PIDFILE >/dev/null + then + echo " - is not running." + exit 3 + else + echo " - is running." + exit 0 + fi +} + +function stop_daemon() { + start-stop-daemon --stop -q -o --pidfile $PIDFILE > /dev/null +} + +case "$1" in + start) + echo -n "Starting $DESC: " + start_daemon + ;; + stop) + echo -n "Stopping $DESC: " + stop_daemon + echo "$NAME." + ;; + restart|force-reload) + echo -n "Restarting $DESC: " + stop_daemon + start_daemon + ;; + status) + echo -n "Getting status of $DESC: $NAME" + get_status + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/utilities/vdrconvert/utilitie-test.sh b/utilities/vdrconvert/utilitie-test.sh new file mode 100644 index 0000000..798e3e1 --- /dev/null +++ b/utilities/vdrconvert/utilitie-test.sh @@ -0,0 +1,142 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 05.05.2008 + +# vdrconvert + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +WEB="http://vdr-wiki.de/vdr/vdrconvert/vdrconvert-0.2.1.tar.gz" +#VERSION="vdrconvert-0.2.1" +LINK="vdrconvert" + +VAR=`basename $WEB` +DIR=`pwd` + +VDRCONVERTDIR="$(dirname $VDRSCRIPTDIR)/vdrconvert" + +# install +function make_util() { + apt_install "recode mpg321 cdparanoia vcdimager vorbis-tools cdrdao" +# apt_install "mjpegtools transcode" + + download_util + extract_util + + # setzen des symlinks + cd $SOURCEDIR + rm -f $LINK +# ln -vfs $VERSION $LINK + + # install + mkdir -p /var/log/vdrconvert + mkdir -p /var/run/vdrconvert + mkdir -p /var/spool/vdrconvert + chown -R $VDRUSER:$VDRGROUP /var/log/vdrconvert /var/run/vdrconvert /var/spool/vdrconvert + + mkdir -p $VDRCONVERTDIR/share + cp -rf $SOURCEDIR/$LINK/share/vdrconvert/* $VDRCONVERTDIR/share + cp -rf $SOURCEDIR/$LINK/bin $VDRCONVERTDIR + chown -R $VDRUSER:$VDRGROUP $VDRCONVERTDIR + chmod -R 0744 $VDRCONVERTDIR + + cp -f $DIR/vdrconvert /etc/init.d + chmod 0755 /etc/init.d/vdrconvert +# freeze_rc +# update-rc.d vdrconvert defaults 93 +# unfreeze_rc + + [ ! -d "$VDRCONFDIR/.vdrconvert" ] && mkdir -p "$VDRCONFDIR/.vdrconvert" + cp -f $DIR/vdrconvert.env $VDRCONFDIR/.vdrconvert + chown -R $VDRUSER:$VDRGROUP $VDRCONFDIR/.vdrconvert +# $DIR/commands +# $DIR/reccmds + + # tosvcd installieren +# WEB="http://vdr-wiki.de/vdr/tosvcd/tosvcd-0.9.tar.bz2" +# VERSION="tosvcd-0.9" +# LINK="tosvcd" +# VAR=`basename $WEB` +# download_util +# extract_util + +# cd $SOURCEDIR +# rm -f $LINK +# ln -vfs $VERSION + +# cd $LINK +# make +# cp -f tosvcd $PREFIX/bin + + # tcmplex-panteltje installieren + WEB="http://panteltje.com/panteltje/dvd/tcmplex-panteltje-0.4.7.tgz" + VERSION="tcmplex-panteltje-0.4.7" + LINK="tcmplex-panteltje" + VAR=`basename $WEB` + download_util + extract_util + + cd $SOURCEDIR + rm -f $LINK + ln -vfs $VERSION + + cd $LINK + make + cp -f tcmplex-panteltje $PREFIX/bin + ln -vfs $PREFIX/bin/tcmplex-panteltje $PREFIX/bin/tcmplex + + # test + if [ -f $SOURCEDIR/vdrconvert/install.sh ]; then + log "SUCCESS - vdrconvert-0.2.1 erstellt" + else + log "ERROR - vdrconvert-0.2.1 konnte nicht erstellt werden" + fi +} + +# uninstall +function clean_util() { + rm -rf /var/log/vdrconvert + rm -rf /var/run/vdrconvert + rm -rf /var/spool/vdrconvert + rm -rf "$VDRCONFDIR/.vdrconvert" + CONVERTDIR="$(dirname $VDRCONVERTDIR)" + [ "$CONVERTDIR" = "vdrconvert" ] && rm -rf "$VDRCONVERTDIR" + rm -f /etc/init.d/vdrconvert + + # remove source + cd $SOURCEDIR + rm -rf $LINK + + # tcmplex-panteltje entfernen + rm -rf tcmplex-panteltje + rm -rf tcmplex-panteltje-0.4.7 + rm -f $PREFIX/bin/tcmplex + rm -f $PREFIX/bin/tcmplex-panteltje +} + +# test +function status_util() { + if [ -f $SOURCEDIR/$LINK/install.sh ]; then + [ -d $SOURCEDIR/$LINK ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/vdrconvert/vdrconvert b/utilities/vdrconvert/vdrconvert new file mode 100644 index 0000000..1d3b911 --- /dev/null +++ b/utilities/vdrconvert/vdrconvert @@ -0,0 +1,95 @@ +#! /bin/bash +# +#set -x +# Author: Dimitrios Dimitrakos mail@dimitrios.de +# +# +### BEGIN INIT INFO +# Provides: vdrconvert +# Required-Start: +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: VDR Universalconverter based on vdrsync from Doc +# Description: +### END INIT INFO + +# VDR config +VDRSCRIPTDIR="/usr/lib/vdr/scripts" +VDRUSER="vdruser" +[ -r /etc/default/vdr ] && . /etc/default/vdr + +# Check for missing binaries/scripts (stale symlinks should not happen) +VDRCONVERTDIR="$(dirname $VDRSCRIPTDIR)/vdrconvert" +VDR2DVDSYNC=$VDRCONVERTDIR/bin/vdrconvert.sh +test -x $VDR2DVDSYNC || exit 5 + +# Source LSB init functions +# providing start_daemon, killproc, pidofproc, +# log_success_msg, log_failure_msg and log_warning_msg. +# This is currently not used by UnitedLinux based distributions and +# not needed for init scripts for UnitedLinux only. If it is used, +# the functions from rc.status should not be sourced or used. +#. /lib/lsb/init-functions + +# Shell functions sourced from /etc/rc.status: +# rc_check check and set local and overall rc status +# rc_status check and set local and overall rc status +# rc_status -v ditto but be verbose in local rc status +# rc_status -v -r ditto and clear the local rc status +# rc_status -s display "skipped" and exit with status 3 +# rc_status -u display "unused" and exit with status 3 +# rc_failed set local and overall rc status to failed +# rc_failed <num> set local and overall rc status to <num> +# rc_reset clear local rc status (overall remains) +# rc_exit exit appropriate to overall rc status +# rc_active checks whether a service is activated by symlinks +# rc_splash arg sets the boot splash screen to arg (if active) +#. /etc/rc.status + +# Reset status of this service +# rc_reset + +# Return values acc. to LSB for all commands but status: +# 0 - success +# 1 - generic or unspecified error +# 2 - invalid or excess argument(s) +# 3 - unimplemented feature (e.g. "reload") +# 4 - user had insufficient privileges +# 5 - program is not installed +# 6 - program is not configured +# 7 - program is not running +# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl) +# +# Note that starting an already running service, stopping +# or restarting a not-running service as well as the restart +# with force-reload (in case signaling is not supported) are +# considered a success. + +CONV_USER=$VDRUSER +LOGFILE=/dev/null + +# Activate only for Debug +#LOGFILE=/var/log/vdrconvert/vdrconvert.log + +case "$1" in + start) + run=`ps -aef|grep "vdrconvert.sh"|grep -v grep|wc -l` + if [ $run -eq 0 ] + then + echo -n "Starting VDRCONVERT " + su - $CONV_USER -c "(cd $VDRCONVERTDIR;./bin/vdrconvert.sh)" > $LOGFILE 2>&1 & + else + echo -n "VDRCONVERT already running" + fi + ;; + stop) + echo -n "Shutting down VDRCONVERT" + ps -aef|grep vdrconvert|grep -v grep|awk '{print($2)}'|sort -n|xargs kill -n 9 >/dev/null 2>&1 + # rc_status -v + ;; + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac +# rc_exit diff --git a/utilities/vdrconvert/vdrconvert.env b/utilities/vdrconvert/vdrconvert.env new file mode 100644 index 0000000..b0ffa28 --- /dev/null +++ b/utilities/vdrconvert/vdrconvert.env @@ -0,0 +1,255 @@ +#--------------------------------------------------------------------- +# Environment for vdrsync Scripts ! +#--------------------------------------------------------------------- +# Version: 0.0.12 pre-alpha +# Author: Dimitrios Dimitrakos mail@dimitrios.de +# Folgende umgebungsvariablen können in vdrconvert.env gesetzt werden : +# +# Template by Helmut Auer modified by Dimitri +# + +# Generell +VDRCONVERTDIR=/usr/lib/vdr/vdrconvert +VDRCONVERTBINDIR=/usr/lib/vdr/vdrconvert/bin +VCOQUEUEDIR=/var/spool/vdrconvert +VCOLOGDIR=/var/log/vdrconvert +VCORUNDIR=/var/run/vdrconvert +LOGDIR=/var/log +VDRROOT=/var/lib/vdrmedia/video +DEBUG=yes +#VERBOSE=yes +DIVX_DEBUG=yes +#SVCD_DEBUG=yes +#VCD_DEBUG=yes +#DVD_DEBUG=yes +export PATH +export LANG=de_DE@euro +export LC_CTYPE=de_DE@euro +RECODE="recode latin1" +SVDRPSEND=/usr/bin/svdrpsend.pl +DESTDIR=/var/lib/vdrmedia/divx +export VDRCONVERTDIR VDRCONVERTBINDIR VCOQUEUEDIR VCOLOGDIR VCORUNDIR VCOUSER +PATH=$PATH:$VDRCONVERTDIR/bin:/usr/bin:/usr/X11R6/bin +CONVERT_JOBS=" vdr2divx vdr2dvd vdr2vcd vdr2svcd vdr2mpg vdr2mp3 vdr2ogg ripcda vdr2handy vdr2pda vdr2ac3 burn" +TCMPLEX=tcmplex-panteltje +OLDPX="no" +PX="/usr/lib/vdr/vdrconvert/share/pX/PX.jar" +PXINI="/usr/lib/vdr/vdrconvert/share/pX/PX.ini" +JAVA="/usr/bin/java" +DEMUXER=px +#DEMUXER=vdrsync3 +VDRCONVERT_LANG=de +REQUANT=tcrequant +TCMPLEX_PANTELTJE=tcmplex-panteltje +DVBMPLEX=dvb-mplex +MPLEX=mplex +MKISOFS=mkisofs +MENCODER=mencoder +TRANSCODE=transcode +LAME=lame +DVDAUTHOR=dvdauthor +TOSVCD=tosvcd +PRIO=15 +SLEEP_TIME=5 +TEMPDIR=$DESTDIR/tmp + +PARQ=none +COMPRESS=bzip2 +CONV_TITLEDATE=no + +# VDR2DivX +DIVX_DESTDIR=$DESTDIR/divx +DIVXTYPE=xvid +DIVX_SUFFIX=avi +DIVXCCHOPT="-cache 32768" +DIVXENCOPT="" +DIVXTCMODE=s +DIVXVLAVCCODEC=mpeg4 +DIVXQUALITY=5 +DIVXMP3R=128 +DIVXMP3_OPTS="-b $DIVXMP3R -h" +DIVXSWS=2 +DIVXCDLEN=750 +DIVXMAXBITR=2480 +DIVXMINBITR=0 +DIVXHQ=no +DIVXNOAC3=no +DIVXAC3ONLY=no +DIVXBOTHMP=no +DIVXFAKTOR=2 +DIVXAUTOCROP=no +DIVXSPLIT=no +DIVX_TITLEDATE=$CONV_TITLEDATE +# DIVX_EXPANDFILENAME="yes" + + +#VDR2DVD +#DVD_FIRST_AVAILABLE_STREAM_ONLY=yes +DVD_DESTDIR=$DESTDIR/dvd +DVDTCMPLEXOPTS="-m d" +DVD_DVBMPLEXOPTS="-t DVD" +DVDALLOWEDWIDTH="720 704 352 480" +DVDTRANSCODEOPTS="-I 3 -V -y mpeg -Z 720x576 -b 192" +PPMTOY4M_OPTIONS="-n 1 -F 25:1 -A 59:54 -I t -L -r -v 0" +DVDTRANSCODEBITRATE="3300000.0" +DVDAUTHORUSERCHAP="15min" +#DVDUSESTREAMS="bd.ac3:ac3+de c0.mpa:mp2+de c1.mpa:mp2+en 0010.mpa:mp2+de 0011.mpa:mp2+en" +DVDREMOVEAUTHORDIR="yes" +DVDSIZE=4472 +CDSIZE=700 +DVDNORM="pal" +DVDMAINSILENCEFILE="/usr/lib/vdr/vdrconvert/share/images/silence-1s.mp2" +DVDSUBSILENCEFILE="/usr/lib/vdr/vdrconvert/share/images/silence-1s.mp2" +DVDTEXTPLAYMOVIE="Film starten" +DVDTEXTMENU="Hauptmenu" +DVDMAINMENUEPOSTACTION="vtsm" +DVDMENUEPOSTACTION="vtsm" +# DVDMAINBACKFILE= +#DVDSUBBACKFILE= +DVDBUTTONCOLOR="#A0A0FF" +DVDSUBBUTTONCOLOR=$DVDBUTTONCOLOR +DVDHIBUTTON2COLOR_MENU="0000ff" +DVDHIBUTTONCOLOR_MENU="ffffff" +DVDHIBUTTONCOLOR_SUBMENU=$DVDHIBUTTONCOLOR_MENU +DVDHIBUTTON2COLOR_SUBMENU=$DVDHIBUTTON2COLOR_MENU +DVDFILE_MAINBACKGROUND_COLOR="#000000" +DVDFILE_SUBBACKGROUND_COLOR=$DVDFILE_MAINBACKGROUND_COLOR +DVDFILE_MAINBACKGROUND_COLOR="#000000" +DVDFILE_SUBBACKGROUND_COLOR=$DVDFILE_MAINBACKGROUND_COLOR +DVDTEXTCOLOR_MENU="#A0A0A0" +DVDTEXTCOLOR_SUBMENU=$DVDTEXTCOLOR_MENU +DVDMENU_SHADOW=1 +DVDMAINCOLSFG="#00000000" +DVDMAINCOLSBG="#000000ff" +DVDSUBCOLSFG=$DVDMAINCOLSFG +DVDSUBCOLSBG=$DVDMAINCOLSBG +# DVDMAINMENUETIMEOUT= +# DVDMENUETIMEOUT= +DVD_USE_FONTS="yes" +PATH_FONTS="/usr/lib/vdr/vdrconvert/share/fonts/truetype" +font_title="luximb/18" +font_menu="luximb/16" +font_info="luximb/16" +font_additional="luximb/13" +font_tiny_additional="luximb/9" +font_version="luximb/10" +#DVDCDLABELGEN="/usr/lib/vdr/vdrconvert/cdlabelgen" +DVDLABELMODE="-M" +DVDLABELDATEFORMAT="-d DVD-`date +"%d-%m-%Y"`" +DVDLABELTEMPLATE="-e postscript/penguin.eps" +DVDSUBCATECORY="-s $generatedvd_version" +#DVDLABELPRINTER="lp -dhigh" +DVDDELETELABEL="yes" +DVD_TITLEDATE=$CONV_TITLEDATE +DVD_CREATEISO="yes" +MINIDVD="no" + +DVDTEXTPLAYMOVIE="Abspielen" +DVDTEXTMENU="Hauptmenü" +DVDMENU_MENU_MAIN="DVD" +DVDMAINMENUEPOSTACTION="vtsm" +DVDMENUEPOSTACTION="vtsm" +#DVDMAINBACKFILE="/video0/background.pnm" +#DVDSUBBACKFILE="/video0/subbackground.pnm" +DVDBUTTONCOLOR="#000000" +#"#A0A0FF" +DVDSUBBUTTONCOLOR=$DVDBUTTONCOLOR +DVDHIBUTTON2COLOR_MENU="E51515" +#FF9170" +#0000ff" +DVDHIBUTTONCOLOR_MENU="ffffff" +DVDHIBUTTONCOLOR_SUBMENU=$DVDHIBUTTONCOLOR_MENU +DVDHIBUTTON2COLOR_SUBMENU=$DVDHIBUTTON2COLOR_MENU +DVDFILE_MAINBACKGROUND_COLOR="#000000" +DVDFILE_SUBBACKGROUND_COLOR=$DVDFILE_MAINBACKGROUND_COLOR +DVDFILE_MAINBACKGROUND_COLOR="#000000" +DVDFILE_SUBBACKGROUND_COLOR=$DVDFILE_MAINBACKGROUND_COLOR +DVDTEXTCOLOR_MENU="#03B903" +##E5FDFD" +##A0A0A0" +DVDTEXTCOLOR_SUBMENU="#A0A0A0" +DVDMENU_SHADOW=1 +DVDMAINCOLSFG="#00000000" +DVDMAINCOLSBG="#000000ff" +DVDSUBCOLSFG=$DVDMAINCOLSFG +DVDSUBCOLSBG=$DVDMAINCOLSBG +# DVDMAINMENUETIMEOUT= +#DVDMENUETIMEOUT= +DVD_USE_FONTS="yes" +##18 +font_title="luxisb/24" +#16 +font_menu="luxisb/24" +#16 +font_info="luxisb/24" +#13 +font_additional="luxisb/16" +#9 +font_tiny_additional="luxisb/16" +#10 +font_version="luxisb/13" +# +####################################################### + +#VDR2VCD +VCD_DESTDIR=$DESTDIR/vcd +#VCD_OPTS= +VCD_TITLEDATE=$CONV_TITLEDATE + + +#VDR2SVCD +SVCD_DESTDIR=$DESTDIR/svcd +#SVCD_OPTS= +SVCD_TITLEDATE=$CONV_TITLEDATE + +#VDR2MP3 +MP3_DESTDIR=$DESTDIR/mp3 +MP3_BITRATE=192 +MP3_OPTS="-b $MP3_BITRATE -h --resample 44100" +MP3_TITLEDATE=$CONV_TITLEDATE +MP3_SPLIT=no +#MPLAYERMP3SOURCE= + +# VDR2AC3 +AC3_DESTDIR=$DESTDIR/ac3 +AC3_TITLEDATE=$CONV_TITLEDATE + +#VDR2MPG +MPG_DESTDIR=$DESTDIR/mpg +MPG_TITLEDATE=$CONV_TITLEDATE + + +#Brennen +BURN_DESTDIR=$DESTDIR/burn +MEDIAWRITER="/dev/hdc:2,0,0" +DVDPLUS_RECORD_OPTS="-Z" +DVDMIN_RECORD_OPTS="-delay 0 -dao" +DVD_RECORDCMD="sudo growisofs" +DVDMIN_RECORDCMD="sudo dvdrecord" +DAO_RECORDCMD="sudo cdrdao" +CD_RECORDCMD="sudo cdrecord" +MEDIA_RW_FORMAT="yes" +DVDPLUS_BLANK_CMD="dvd+rw-format -f" +DVDMIN_BLANK_CMD="dvdrecord -delay 0 -dao blank=fast" +DVDSTATUSPRG="dvd+rw-mediainfo" +DAO_OPTS="--driver generic-mmc" +CD_OPTS="driveropts=dao gracetime=0" +BURN_MAXRETRY=3 +DVD_USE_ONLY_PLUS_CMDS="yes" +MEDIA_MSG_OK="Medium wurde erfolgreich erstellt" +MEDIA_MSG_ERROR="Fehler beim Schreibvorgang" +MEDIA_MSG_INSERT_CD="Bitte legen sie ein CD Medium ein" +MEDIA_MSG_INSERT_DVD="Bitte legen sie ein DVD Medium ein" +MEDIA_MSG_START_FORMAT="Medium wird geloescht" +MEDIA_MSG_ISO_READYTOBURN="Isodatei ist fertig zum Brennen" +MEDIA_MSG_START_WRITE_IMAGE="Imagedatei wird gebrannt" +MEDIA_MSG_RETRY_IN_X_MINUTES="Wiederholung in 5 Minuten" + +# Autowrite +#MP3_AUTOWRITE=yes +#MPG_AUTOWRITE=yes +#DIVX_AUTOWRITE=yes +#DVD_AUTOWRITE=yes +#VCD_AUTOWRITE=yes +#SVCD_AUTOWRITE=yes + diff --git a/utilities/vdrfonts/utilitie.sh b/utilities/vdrfonts/utilitie.sh new file mode 100644 index 0000000..d3eca11 --- /dev/null +++ b/utilities/vdrfonts/utilitie.sh @@ -0,0 +1,59 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 07.03.2009 + +# vdrfonts + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +WEB="http://andreas.vdr-developer.org/fonts/download/vdrsymbols-ttf-20080905.tgz" +VERSION="vdrsymbols-ttf-20080905" + +VAR=`basename $WEB` +DIR=`pwd` + +# install +function make_util() { + download_util + [ -d /usr/share/fonts/truetype/vdrsymbols ] && rm -rf /usr/share/fonts/truetype/vdrsymbols + if echo "$FILES/utilities/$VAR" | grep "bz2$" - &>/dev/null; then + if tar xjf "$FILES/utilities/$VAR" -C /usr/share/fonts/truetype; then + log "extrahiere $VAR" + return 0 + fi + else + if tar xzf "$FILES/utilities/$VAR" -C /usr/share/fonts/truetype ; then + log "extrahiere $VAR" + return 0 + fi + fi + log "ERROR - $VERSION konnte nicht erstellt werden" +} + +# uninstall +function clean_util() { + [ -d /usr/share/fonts/truetype/vdrsymbols ] && rm -rf /usr/share/fonts/truetype/vdrsymbols +} + +# test +function status_util() { + [ -d /usr/share/fonts/truetype/vdrsymbols ] && echo "2" && return 0 + echo "0" +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/vdrsync/utilitie-test.sh b/utilities/vdrsync/utilitie-test.sh new file mode 100644 index 0000000..8973c6d --- /dev/null +++ b/utilities/vdrsync/utilitie-test.sh @@ -0,0 +1,81 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 27.07.2006 + +# vdrsync + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +WEB="http://vdrsync.vdr-portal.de/releases/vdrsync-050322.tgz" +VERSION="vdrsync-050322" +LINK="vdrsync" + +VAR=`basename $WEB` +DIR=`pwd` + +# install +function make_util() { + download_util + extract_util + + # setzen des symlinks + cd $SOURCEDIR + rm -f $LINK + ln -vfs $VERSION $LINK + + # install + cd $SOURCEDIR/$LINK + cp -f vdrsync.pl /usr/bin + chmod 0755 /usr/bin/vdrsync.pl + + ldconfig + + # test + TEST=`which vdrsync.pl` + if [ "$TEST" ]; then + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + fi +} + +# uninstall +function clean_util() { + # remove script + rm -f /usr/bin/vdrsync.pl + + # remove source + cd $SOURCEDIR + rm -rf $LINK + rm -rf $VERSION + + ldconfig +} + +# test +function status_util() { + TEST=`which vdrsync.pl` + if [ "$TEST" ]; then + [ -d $SOURCEDIR/$LINK ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/vidix/utilitie.sh b/utilities/vidix/utilitie.sh new file mode 100644 index 0000000..c9e9ef5 --- /dev/null +++ b/utilities/vidix/utilitie.sh @@ -0,0 +1,106 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 02.03.2009 + +# vidix + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +WEB="http://dfn.dl.sourceforge.net/vidix/vidix-1.0.0.tar.bz2" +VERSION="vidix-1.0.0" +LINK="vidix" + +VAR=`basename $WEB` +DIR=`pwd` + +# install +function make_util() { + # pre install + status=`status_util` + if [ "$status" != "0" ]; then + apt_remove "vidix" + fi + download_util + extract_util + + # setzen des symlinks + cd $SOURCEDIR + rm -f $LINK + ln -vfs $VERSION $LINK + + # install + cd $SOURCEDIR/$LINK + ./configure --prefix=$PREFIX + make && checkinstall --fstrans=no --install=yes --pkgname=vidix --pkgversion "1.0.0-xvdr" --default && TEST=ok + +# cd $PREFIX/lib +# [ -f libdha.so ] && ln -vfs libdha.so.1.0.0 libdha.so + + # test + if [ "$TEST" = "ok" ] && [ -f $PREFIX/include/vidix/fourcc.h ] && [ -f $PREFIX/include/vidix/vidix.h ] && [ -f $PREFIX/include/vidix/vidixlib.h ]; then + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + return + fi + + # save deb file + [ -d "$DIR/packages" ] || mkdir -p $DIR/packages + cp -f vidix*.deb $DIR/packages + + ldconfig +} + +# uninstall +function clean_util() { + apt_remove "vidix" + + # remove source + cd $SOURCEDIR + [ -L "$LINK" ] && rm -rf "$LINK" + [ -d "$VERSION" ] && rm -rf "$VERSION" + + ldconfig +} + +# test +function status_util() { + LIBS="$(apt-cache search vidix | cut -d" " -f1 | grep vidix)" + for package in $LIBS; do + TEST=`apt_installed $package` + if [ "$TEST" = "xvdr" ]; then + [ -d $SOURCEDIR/$LINK ] && echo "2" && return 0 + echo "1" && return 0 + elif [ "$TEST" = "debian" ]; then + echo "3" && return 0 + fi + done + echo "0" +} + +# test +function status_util() { + if [ -f $PREFIX/include/vidix/fourcc.h ] && [ -f $PREFIX/include/vidix/vidix.h ] && [ -f $PREFIX/include/vidix/vidixlib.h ]; then + [ -d $SOURCEDIR/$LINK ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/x264/utilitie-x264.sh b/utilities/x264/utilitie-x264.sh new file mode 100644 index 0000000..9f4a88a --- /dev/null +++ b/utilities/x264/utilitie-x264.sh @@ -0,0 +1,118 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 03.03.2009 + +# x264 + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +DIR=`pwd` +DATE=`date +%Y%m%d` + +# install +function make_util() { + # pre install + status=`status_util` + if [ "$status" != "0" ]; then + apt_remove "$(apt-cache search "libx264" | grep "libx264" | cut -d" " -f1)" + apt_remove "x264" + fi + # make & checkinstall + cd $SOURCEDIR + git clone git://git.videolan.org/x264.git + cd x264 + ./configure --prefix=$PREFIX --enable-shared + make && checkinstall --fstrans=no --install=yes --pkgname=x264 --pkgversion "1:0.svn${DATE}-xvdr" --default && TEST=ok + + # test + if [ "$TEST" != "ok" ]; then + log "ERROR - x264 konnte nicht erstellt werden" + return 1 + fi + + # save deb file + [ -d "$DIR/packages" ] || mkdir -p $DIR/packages + cp -f x264*.deb $DIR/packages + + # create dummy packages + VERSNUM=$(ls $SOURCEDIR/x264 | grep "libx264.so" | cut -f3 -d".") + cd $DIR/packages + echo "Section: misc +Priority: optional +Standards-Version: 3.6.2 + +Package: libx264-${VERSNUM} +Version: 1:0.svn${DATE}-xvdr-1 +Maintainer: Musterman <Musterman@musterman.de> +Depends: x264 +Provides: x264 +Architecture: all +Description: Dummy-libx264-${VERSNUM} +" > ./libx264-${VERSNUM} + + equivs-build libx264-${VERSNUM} + dpkg -i libx264-${VERSNUM}_0.svn${DATE}-xvdr-1_all.deb + + echo "Section: misc +Priority: optional +Standards-Version: 3.6.2 + +Package: libx264-dev +Version: 1:0.svn${DATE}-xvdr-1 +Maintainer: Musterman <Musterman@musterman.de> +Depends: x264 +Provides: x264 +Architecture: all +Description: Dummy-libx264-dev +" > ./libx264-dev + + equivs-build libx264-dev + dpkg -i libx264-dev_0.svn${DATE}-xvdr-1_all.deb + + ldconfig + log "SUCCESS - x264 erstellt" +} + +# uninstall +function clean_util() { + apt_remove "$(apt-cache search "libx264" | grep "libx264" | cut -d" " -f1)" + apt_remove "x264" + + # remove source + cd $SOURCEDIR + [ -d x264 ] && rm -rf x264 + + ldconfig +} + +# test +function status_util() { + LIBS="x264 $(apt-cache search "libx264" | grep "libx264" | cut -d" " -f1)" + for package in $LIBS; do + TEST=`apt_installed $package` + if [ "$TEST" = "xvdr" ]; then + [ -d $SOURCEDIR/x264 ] && echo "2" && return 0 + echo "1" && return 0 + elif [ "$TEST" = "debian" ]; then + echo "3" && return 0 + fi + done + echo "0" +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/xine_lib/patches/xine-lib-ffmpeg.diff b/utilities/xine_lib/patches/xine-lib-ffmpeg.diff new file mode 100644 index 0000000..4f7e119 --- /dev/null +++ b/utilities/xine_lib/patches/xine-lib-ffmpeg.diff @@ -0,0 +1,16 @@ +diff -ur xine-lib/src/libffmpeg/libavcodec/avcodec.h xine-lib/src/libffmpeg/libavcodec/avcodec.h +--- xine-lib/src/libffmpeg/libavcodec/avcodec.h ++++ xine-lib/src/libffmpeg/libavcodec/avcodec.h +@@ -31,7 +31,11 @@ + extern "C" { + #endif + +-#include "avutil.h" ++#ifdef HAVE_FFMPEG_AVUTIL_H ++# include "avutil.h" ++#else ++# include "libavutil/avutil.h" ++#endif + #include <sys/types.h> /* size_t */ + + #define AV_STRINGIFY(s) AV_TOSTRING(s) diff --git a/utilities/xine_lib/patches/xine-lib.patch b/utilities/xine_lib/patches/xine-lib.patch new file mode 100644 index 0000000..46376a8 --- /dev/null +++ b/utilities/xine_lib/patches/xine-lib.patch @@ -0,0 +1,4983 @@ +diff --git a/configure.ac b/configure.ac +--- a/configure.ac ++++ b/configure.ac +@@ -2801,6 +2801,7 @@ src/video_out/vidix/drivers/Makefile + src/video_out/vidix/drivers/Makefile + src/xine-utils/Makefile + src/xine-engine/Makefile ++src/vdr/Makefile + win32/Makefile + win32/include/Makefile]) + AC_CONFIG_COMMANDS([default],[[chmod +x ./misc/SlackBuild ./misc/build_rpms.sh ./misc/relchk.sh]],[[]]) +@@ -2843,7 +2844,7 @@ echo " - stdin_fifo - rtp" + echo " - stdin_fifo - rtp" + echo " - http - mms" + echo " - pnm - rtsp" +-echo " - dvb" ++echo " - dvb - vdr" + if test "x$external_dvdnav" = "xyes"; then + echo " - dvd (external libs)" + else +@@ -3048,6 +3049,7 @@ echo " - eq - eq2" + echo " - eq - eq2" + echo " - boxblur - denoise3d" + echo " - unsharp - tvtime" ++echo " - vdr" + echo " * SFX:" + echo " - goom - oscope" + echo " - fftscope - mosaico" +diff --git a/src/Makefile.am b/src/Makefile.am +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -27,4 +27,5 @@ SUBDIRS = \ + libfaad \ + libmusepack \ + post \ +- combined ++ combined \ ++ vdr +diff --git a/src/vdr/Makefile.am b/src/vdr/Makefile.am +new file mode 100644 +--- /dev/null ++++ b/src/vdr/Makefile.am +@@ -0,0 +1,13 @@ ++include $(top_srcdir)/misc/Makefile.common ++ ++AM_CFLAGS = -D_LARGEFILE64_SOURCE ++ ++xineplug_LTLIBRARIES = \ ++ xineplug_vdr.la ++ ++xineplug_vdr_la_SOURCES = combined_vdr.c input_vdr.c post_vdr_video.c post_vdr_audio.c ++xineplug_vdr_la_LIBADD = $(XINE_LIB) ++xineplug_vdr_la_LDFLAGS = -avoid-version -module @IMPURE_TEXT_LDFLAGS@ ++ ++xineinclude_HEADERS = vdr.h ++noinst_HEADERS = combined_vdr.h +diff --git a/src/vdr/combined_vdr.c b/src/vdr/combined_vdr.c +new file mode 100644 +--- /dev/null ++++ b/src/vdr/combined_vdr.c +@@ -0,0 +1,44 @@ ++/* ++ * Copyright (C) 2000-2004 the xine project ++ * ++ * This file is part of xine, a free video player. ++ * ++ * xine is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * xine is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA ++ */ ++ ++/* ++ * plugins for VDR ++ */ ++ ++#include "xine_internal.h" ++#include "post.h" ++#include "combined_vdr.h" ++ ++ ++ ++static const post_info_t vdr_video_special_info = { XINE_POST_TYPE_VIDEO_FILTER }; ++static const post_info_t vdr_audio_special_info = { XINE_POST_TYPE_AUDIO_FILTER }; ++ ++/* exported plugin catalog entry */ ++const plugin_info_t xine_plugin_info[] EXPORTED = ++{ ++ /* type , API, "name" , version , special_info , init_function */ ++ { PLUGIN_INPUT, 17, "VDR" , XINE_VERSION_CODE, NULL , &vdr_input_init_plugin }, ++ { PLUGIN_POST , 9, "vdr" , XINE_VERSION_CODE, &vdr_video_special_info, &vdr_video_init_plugin }, ++ { PLUGIN_POST , 9, "vdr_video", XINE_VERSION_CODE, &vdr_video_special_info, &vdr_video_init_plugin }, ++ { PLUGIN_POST , 9, "vdr_audio", XINE_VERSION_CODE, &vdr_audio_special_info, &vdr_audio_init_plugin }, ++ { PLUGIN_NONE , 0, "" , 0 , NULL , NULL } ++}; ++ +diff --git a/src/vdr/combined_vdr.h b/src/vdr/combined_vdr.h +new file mode 100644 +--- /dev/null ++++ b/src/vdr/combined_vdr.h +@@ -0,0 +1,92 @@ ++/* ++ * Copyright (C) 2000-2004 the xine project ++ * ++ * This file is part of xine, a free video player. ++ * ++ * xine is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * xine is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA ++ */ ++ ++#ifndef __COMBINED_VDR_H ++#define __COMBINED_VDR_H ++ ++ ++ ++typedef struct vdr_set_video_window_data_s { ++ int32_t x; ++ int32_t y; ++ int32_t w; ++ int32_t h; ++ int32_t w_ref; ++ int32_t h_ref; ++ ++} vdr_set_video_window_data_t; ++ ++ ++ ++typedef struct vdr_frame_size_changed_data_s { ++ int32_t x; ++ int32_t y; ++ int32_t w; ++ int32_t h; ++ double r; ++ ++} vdr_frame_size_changed_data_t; ++ ++ ++ ++typedef struct vdr_select_audio_data_s { ++ uint8_t channels; ++ ++} vdr_select_audio_data_t; ++ ++ ++ ++inline static int vdr_is_vdr_stream(xine_stream_t *stream) ++{ ++ if (!stream ++ || !stream->input_plugin ++ || !stream->input_plugin->input_class) ++ { ++ return 0; ++ } ++ ++ { ++ input_class_t *input_class = stream->input_plugin->input_class; ++ ++ if (input_class->get_identifier) ++ { ++ const char *identifier = input_class->get_identifier(input_class); ++ if (identifier ++ && 0 == strcmp(identifier, "VDR")) ++ { ++ return 1; ++ } ++ } ++ } ++ ++ return 0; ++} ++ ++ ++ ++/* plugin class initialization function */ ++void *vdr_input_init_plugin(xine_t *xine, void *data); ++void *vdr_video_init_plugin(xine_t *xine, void *data); ++void *vdr_audio_init_plugin(xine_t *xine, void *data); ++ ++ ++ ++#endif /* __COMBINED_VDR_H */ ++ +diff --git a/src/vdr/input_vdr.c b/src/vdr/input_vdr.c +new file mode 100644 +--- /dev/null ++++ b/src/vdr/input_vdr.c +@@ -0,0 +1,2656 @@ ++/* ++ * Copyright (C) 2003-2004 the xine project ++ * ++ * This file is part of xine, a free video player. ++ * ++ * xine is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * xine is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include <stdio.h> ++#include <stdlib.h> ++#include <string.h> ++#include <fcntl.h> ++#include <unistd.h> ++#include <sys/stat.h> ++#include <sys/poll.h> ++#include <errno.h> ++#include <pthread.h> ++ ++#include <sys/socket.h> ++#include <resolv.h> ++#include <netdb.h> ++ ++#define LOG_MODULE "input_vdr" ++#define LOG_VERBOSE ++/* ++#define LOG ++*/ ++#include "xine_internal.h" ++#include "xineutils.h" ++#include "input_plugin.h" ++ ++#include "vdr.h" ++#include "combined_vdr.h" ++ ++ ++ ++#define VDR_MAX_NUM_WINDOWS 16 ++#define VDR_ABS_FIFO_DIR "/tmp/vdr-xine" ++ ++#define BUF_SIZE 1024 ++ ++#define LOG_OSD(x) ++/* ++#define LOG_OSD(x) x ++*/ ++ ++ ++typedef struct vdr_input_plugin_s vdr_input_plugin_t; ++ ++typedef struct ++{ ++ metronom_t metronom; ++ metronom_t *stream_metronom; ++ vdr_input_plugin_t *input; ++} ++vdr_metronom_t; ++ ++ ++typedef struct vdr_osd_s ++{ ++ xine_osd_t *window; ++ uint8_t *argb_buffer; ++ int width; ++ int height; ++} ++vdr_osd_t; ++ ++ ++typedef struct vdr_vpts_offset_s vdr_vpts_offset_t; ++ ++struct vdr_vpts_offset_s ++{ ++ vdr_vpts_offset_t *next; ++ int64_t vpts; ++ int64_t offset; ++}; ++ ++ ++struct vdr_input_plugin_s ++{ ++ input_plugin_t input_plugin; ++ ++ xine_stream_t *stream; ++ xine_stream_t *stream_external; ++ ++ int fh; ++ int fh_control; ++ int fh_result; ++ int fh_event; ++ ++ char *mrl; ++ ++ off_t curpos; ++ char seek_buf[ BUF_SIZE ]; ++ ++ char *preview; ++ off_t preview_size; ++ ++ enum funcs cur_func; ++ off_t cur_size; ++ off_t cur_done; ++ ++ vdr_osd_t osd[ VDR_MAX_NUM_WINDOWS ]; ++ uint8_t *osd_buffer; ++ uint32_t osd_buffer_size; ++ uint8_t osd_unscaled_blending; ++ uint8_t osd_supports_custom_extent; ++ uint8_t osd_supports_argb_layer; ++ ++ uint8_t audio_channels; ++ uint8_t trick_speed_mode; ++ uint8_t mute_mode; ++ uint8_t volume_mode; ++ int last_volume; ++ vdr_frame_size_changed_data_t frame_size; ++ ++ pthread_t rpc_thread; ++ int rpc_thread_shutdown; ++ pthread_mutex_t rpc_thread_shutdown_lock; ++ pthread_cond_t rpc_thread_shutdown_cond; ++ int startup_phase; ++ ++ pthread_t metronom_thread; ++ pthread_mutex_t metronom_thread_lock; ++ int64_t metronom_thread_request; ++ int metronom_thread_reply; ++ pthread_cond_t metronom_thread_request_cond; ++ pthread_cond_t metronom_thread_reply_cond; ++ pthread_mutex_t metronom_thread_call_lock; ++ ++ xine_event_queue_t *event_queue; ++ xine_event_queue_t *event_queue_external; ++ ++ pthread_mutex_t adjust_zoom_lock; ++ uint16_t image4_3_zoom_x; ++ uint16_t image4_3_zoom_y; ++ uint16_t image16_9_zoom_x; ++ uint16_t image16_9_zoom_y; ++ ++ uint8_t find_sync_point; ++ pthread_mutex_t find_sync_point_lock; ++ ++ vdr_metronom_t metronom; ++ int last_disc_type; ++ ++ vdr_vpts_offset_t *vpts_offset_queue; ++ vdr_vpts_offset_t *vpts_offset_queue_tail; ++ pthread_mutex_t vpts_offset_queue_lock; ++ pthread_cond_t vpts_offset_queue_changed_cond; ++ int vpts_offset_queue_changes; ++}; ++ ++ ++typedef struct ++{ ++ input_class_t input_class; ++ xine_t *xine; ++ const char *mrls[ 2 ]; ++} ++vdr_input_class_t; ++ ++ ++ ++static int vdr_write(int f, void *b, int n) ++{ ++ int t = 0, r; ++ ++ while (t < n) ++ { ++ /* ++ * System calls are not a thread cancellation point in Linux ++ * pthreads. However, the RT signal sent to cancel the thread ++ * will cause recv() to return with EINTR, and we can manually ++ * check cancellation. ++ */ ++ pthread_testcancel(); ++ r = write(f, ((char *)b) + t, n - t); ++ pthread_testcancel(); ++ ++ if (r < 0 ++ && (errno == EINTR ++ || errno == EAGAIN)) ++ { ++ continue; ++ } ++ ++ if (r < 0) ++ return r; ++ ++ t += r; ++ } ++ ++ return t; ++} ++ ++ ++ ++static int internal_write_event_play_external(vdr_input_plugin_t *this, uint32_t key); ++ ++static void event_handler_external(void *user_data, const xine_event_t *event) ++{ ++ vdr_input_plugin_t *this = (vdr_input_plugin_t *)user_data; ++ uint32_t key = key_none; ++/* ++ printf("event_handler_external(): event->type: %d\n", event->type); ++*/ ++ switch (event->type) ++ { ++ case XINE_EVENT_UI_PLAYBACK_FINISHED: ++ break; ++ ++ default: ++ return; ++ } ++ ++ if (0 != internal_write_event_play_external(this, key)) ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ _("%s: input event write: %s.\n"), LOG_MODULE, strerror(errno)); ++} ++ ++static void external_stream_stop(vdr_input_plugin_t *this) ++{ ++ if (this->stream_external) ++ { ++ xine_stop(this->stream_external); ++ xine_close(this->stream_external); ++ ++ if (this->event_queue_external) ++ { ++ xine_event_dispose_queue(this->event_queue_external); ++ this->event_queue_external = 0; ++ } ++ ++ _x_demux_flush_engine(this->stream_external); ++ ++ xine_dispose(this->stream_external); ++ this->stream_external = 0; ++ } ++} ++ ++static void external_stream_play(vdr_input_plugin_t *this, char *file_name) ++{ ++ external_stream_stop(this); ++ ++ this->stream_external = xine_stream_new(this->stream->xine, this->stream->audio_out, this->stream->video_out); ++ ++ this->event_queue_external = xine_event_new_queue(this->stream_external); ++ ++ xine_event_create_listener_thread(this->event_queue_external, event_handler_external, this); ++ ++ if (!xine_open(this->stream_external, file_name) ++ || !xine_play(this->stream_external, 0, 0)) ++ { ++ uint32_t key = key_none; ++ ++ if ( 0 != internal_write_event_play_external(this, key)) ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ _("%s: input event write: %s.\n"), LOG_MODULE, strerror(errno)); ++ } ++} ++ ++static off_t vdr_read_abort(xine_stream_t *stream, int fd, char *buf, off_t todo) ++{ ++ off_t ret; ++ ++ while (1) ++ { ++ /* ++ * System calls are not a thread cancellation point in Linux ++ * pthreads. However, the RT signal sent to cancel the thread ++ * will cause recv() to return with EINTR, and we can manually ++ * check cancellation. ++ */ ++ pthread_testcancel(); ++ ret = _x_read_abort(stream, fd, buf, todo); ++ pthread_testcancel(); ++ ++ if (ret < 0 ++ && (errno == EINTR ++ || errno == EAGAIN)) ++ { ++ continue; ++ } ++ ++ break; ++ } ++ ++ return ret; ++} ++ ++#define READ_DATA_OR_FAIL(kind, log) \ ++ data_##kind##_t *data = &data_union.kind; \ ++ { \ ++ log; \ ++ n = vdr_read_abort(this->stream, this->fh_control, (char *)data + sizeof (data->header), sizeof (*data) - sizeof (data->header)); \ ++ if (n != sizeof (*data) - sizeof (data->header)) \ ++ return -1; \ ++ \ ++ this->cur_size -= n; \ ++ } ++ ++static double _now() ++{ ++ struct timeval tv; ++ ++ gettimeofday(&tv, 0); ++ ++ return (tv.tv_sec * 1000000.0 + tv.tv_usec) / 1000.0; ++} ++ ++static void adjust_zoom(vdr_input_plugin_t *this) ++{ ++ pthread_mutex_lock(&this->adjust_zoom_lock); ++ ++ if (this->image4_3_zoom_x && this->image4_3_zoom_y ++ && this->image16_9_zoom_x && this->image16_9_zoom_y) ++ { ++ int ratio = (int)(10000 * this->frame_size.r + 0.5); ++ /* fprintf(stderr, "ratio: %d\n", ratio); */ ++ if (13332 <= ratio && ratio <= 13334) ++ { ++ xine_set_param(this->stream, XINE_PARAM_VO_ZOOM_X, this->image4_3_zoom_x); ++ xine_set_param(this->stream, XINE_PARAM_VO_ZOOM_Y, this->image4_3_zoom_y); ++ } ++ else /* if (17777 <= ratio && ratio <= 17779) */ ++ { ++ xine_set_param(this->stream, XINE_PARAM_VO_ZOOM_X, this->image16_9_zoom_x); ++ xine_set_param(this->stream, XINE_PARAM_VO_ZOOM_Y, this->image16_9_zoom_y); ++ } ++ } ++ ++ pthread_mutex_unlock(&this->adjust_zoom_lock); ++} ++ ++ ++static void vdr_vpts_offset_queue_process(vdr_input_plugin_t *this, int64_t vpts) ++{ ++ while (this->vpts_offset_queue ++ && this->vpts_offset_queue->vpts <= vpts) ++ { ++ vdr_vpts_offset_t *curr = this->vpts_offset_queue; ++ this->vpts_offset_queue = curr->next; ++ ++ free(curr); ++ } ++ ++ if (!this->vpts_offset_queue) ++ this->vpts_offset_queue_tail = 0; ++} ++ ++ ++static void vdr_vpts_offset_queue_purge(vdr_input_plugin_t *this) ++{ ++ vdr_vpts_offset_queue_process(this, 1ll << 62); ++} ++ ++ ++static off_t vdr_execute_rpc_command(vdr_input_plugin_t *this) ++{ ++ data_union_t data_union; ++ off_t n; ++ ++ n = vdr_read_abort(this->stream, this->fh_control, (char *)&data_union, sizeof (data_union.header)); ++ if (n != sizeof (data_union.header)) ++ return -1; ++ ++ this->cur_func = data_union.header.func; ++ this->cur_size = data_union.header.len - sizeof (data_union.header); ++ this->cur_done = 0; ++ ++ switch (this->cur_func) ++ { ++ case func_nop: ++ { ++ READ_DATA_OR_FAIL(nop, lprintf("got NOP\n")); ++ } ++ break; ++ ++ case func_osd_new: ++ { ++ READ_DATA_OR_FAIL(osd_new, LOG_OSD(lprintf("got OSDNEW\n"))); ++/* ++ LOG_OSD(lprintf("... (%d,%d)-(%d,%d)@(%d,%d)\n", data->x, data->y, data->width, data->height, data->w_ref, data->h_ref)); ++ ++ fprintf(stderr, "vdr: osdnew %d\n", data->window); ++*/ ++ if (data->window >= VDR_MAX_NUM_WINDOWS) ++ return -1; ++ ++ if (0 != this->osd[ data->window ].window) ++ return -1; ++ ++ this->osd[ data->window ].window = xine_osd_new(this->stream ++ , data->x ++ , data->y ++ , data->width ++ , data->height); ++ ++ this->osd[ data->window ].width = data->width; ++ this->osd[ data->window ].height = data->height; ++ ++ if (0 == this->osd[ data->window ].window) ++ return -1; ++ ++#ifdef XINE_OSD_CAP_CUSTOM_EXTENT ++ if (this->osd_supports_custom_extent && data->w_ref > 0 && data->h_ref > 0) ++ xine_osd_set_extent(this->osd[ data->window ].window, data->w_ref, data->h_ref); ++#endif ++ } ++ break; ++ ++ case func_osd_free: ++ { ++ READ_DATA_OR_FAIL(osd_free, LOG_OSD(lprintf("got OSDFREE\n"))); ++/* ++ fprintf(stderr, "vdr: osdfree %d\n", data->window); ++*/ ++ if (data->window >= VDR_MAX_NUM_WINDOWS) ++ return -1; ++ ++ if (0 != this->osd[ data->window ].window) ++ xine_osd_free(this->osd[ data->window ].window); ++ ++ this->osd[ data->window ].window = 0; ++ ++ free(this->osd[ data->window ].argb_buffer); ++ this->osd[ data->window ].argb_buffer = 0; ++ } ++ break; ++ ++ case func_osd_show: ++ { ++ READ_DATA_OR_FAIL(osd_show, LOG_OSD(lprintf("got OSDSHOW\n"))); ++/* ++ fprintf(stderr, "vdr: osdshow %d\n", data->window); ++*/ ++ if (data->window >= VDR_MAX_NUM_WINDOWS) ++ return -1; ++ ++ if (0 != this->osd[ data->window ].window) ++ { ++ if (this->osd_unscaled_blending) ++ xine_osd_show_unscaled(this->osd[ data->window ].window, 0); ++ else ++ xine_osd_show(this->osd[ data->window ].window, 0); ++ } ++ } ++ break; ++ ++ case func_osd_hide: ++ { ++ READ_DATA_OR_FAIL(osd_hide, LOG_OSD(lprintf("got OSDHIDE\n"))); ++/* ++ fprintf(stderr, "vdr: osdhide %d\n", data->window); ++*/ ++ if (data->window >= VDR_MAX_NUM_WINDOWS) ++ return -1; ++ ++ if (0 != this->osd[ data->window ].window) ++ { ++ if (this->osd_unscaled_blending) ++ xine_osd_show_unscaled(this->osd[ data->window ].window, 0); ++ else ++ xine_osd_show(this->osd[ data->window ].window, 0); ++ } ++ } ++ break; ++ ++ case func_osd_flush: ++ { ++ double _t1, _t2; ++ int _n = 0; ++ int _to = 0; ++ int r = 0; ++ ++ READ_DATA_OR_FAIL(osd_flush, LOG_OSD(lprintf("got OSDFLUSH\n"))); ++/* ++ fprintf(stderr, "vdr: osdflush +\n"); ++*/ ++ _t1 = _now(); ++ ++ while ((r = _x_query_unprocessed_osd_events(this->stream))) ++ { ++ if ((_now() - _t1) > 200) ++ { ++ _to = 1; ++ break; ++ } ++/* ++ fprintf(stderr, "redraw_needed: 1\n"); ++*/ ++/* sched_yield(); */ ++ xine_usec_sleep(5000); ++ _n++; ++ } ++ ++ _t2 = _now(); ++ fprintf(stderr, "vdr: osdflush: n: %d, %.1lf, timeout: %d, result: %d\n", _n, _t2 - _t1, _to, r); ++/* ++ fprintf(stderr, "redraw_needed: 0\n"); ++ ++ fprintf(stderr, "vdr: osdflush -\n"); ++*/ ++ } ++ break; ++ ++ case func_osd_set_position: ++ { ++ READ_DATA_OR_FAIL(osd_set_position, LOG_OSD(lprintf("got OSDSETPOSITION\n"))); ++/* ++ fprintf(stderr, "vdr: osdsetposition %d\n", data->window); ++*/ ++ if (data->window >= VDR_MAX_NUM_WINDOWS) ++ return -1; ++ ++ if (0 != this->osd[ data->window ].window) ++ xine_osd_set_position(this->osd[ data->window ].window, data->x, data->y); ++ } ++ break; ++ ++ case func_osd_draw_bitmap: ++ { ++ READ_DATA_OR_FAIL(osd_draw_bitmap, LOG_OSD(lprintf("got OSDDRAWBITMAP\n"))); ++/* ++ fprintf(stderr, "vdr: osddrawbitmap %d, %d, %d, %d, %d, %d\n", data->window, data->x, data->y, data->width, data->height, data->argb); ++*/ ++ if (this->osd_buffer_size < this->cur_size) ++ { ++ if (this->osd_buffer) ++ free(this->osd_buffer); ++ ++ this->osd_buffer_size = 0; ++ ++ this->osd_buffer = xine_xmalloc(this->cur_size); ++ if (!this->osd_buffer) ++ return -1; ++ ++ this->osd_buffer_size = this->cur_size; ++ } ++ ++ n = vdr_read_abort (this->stream, this->fh_control, (char *)this->osd_buffer, this->cur_size); ++ if (n != this->cur_size) ++ return -1; ++ ++ this->cur_size -= n; ++ ++ if (data->window >= VDR_MAX_NUM_WINDOWS) ++ return -1; ++ ++ if (0 != this->osd[ data->window ].window) ++ { ++ vdr_osd_t *osd = &this->osd[ data->window ]; ++ ++ if (data->argb) ++ { ++ if (!osd->argb_buffer) ++ osd->argb_buffer = calloc(4 * osd->width, osd->height); ++ ++ { ++ int src_stride = 4 * data->width; ++ int dst_stride = 4 * osd->width; ++ ++ uint8_t *src = this->osd_buffer; ++ uint8_t *dst = osd->argb_buffer + data->y * dst_stride + data->x * 4; ++ int y; ++ ++ if (src_stride == dst_stride) ++ xine_fast_memcpy(dst, src, src_stride * data->height); ++ else ++ { ++ for (y = 0; y < data->height; y++) ++ { ++ xine_fast_memcpy(dst, src, src_stride); ++ dst += dst_stride; ++ src += src_stride; ++ } ++ } ++ } ++ ++#ifdef XINE_OSD_CAP_ARGB_LAYER ++ xine_osd_set_argb_buffer(osd->window, (uint32_t *)osd->argb_buffer, data->x, data->y, data->width, data->height); ++#endif ++ } ++ else ++ xine_osd_draw_bitmap(osd->window, this->osd_buffer, data->x, data->y, data->width, data->height, 0); ++ } ++ } ++ break; ++ ++ case func_set_color: ++ { ++ uint32_t vdr_color[ 256 ]; ++ ++ READ_DATA_OR_FAIL(set_color, lprintf("got SETCOLOR\n")); ++ ++ if (((data->num + 1) * sizeof (uint32_t)) != this->cur_size) ++ return -1; ++ ++ n = vdr_read_abort (this->stream, this->fh_control, (char *)&vdr_color[ data->index ], this->cur_size); ++ if (n != this->cur_size) ++ return -1; ++ ++ this->cur_size -= n; ++ ++ if (data->window >= VDR_MAX_NUM_WINDOWS) ++ return -1; ++ ++ if (0 != this->osd[ data->window ].window) ++ { ++ uint32_t color[ 256 ]; ++ uint8_t trans[ 256 ]; ++ ++ xine_osd_get_palette(this->osd[ data->window ].window, color, trans); ++ ++ { ++ int i; ++ ++ for (i = data->index; i <= (data->index + data->num); i++) ++ { ++ int a = (vdr_color[ i ] & 0xff000000) >> 0x18; ++ int r = (vdr_color[ i ] & 0x00ff0000) >> 0x10; ++ int g = (vdr_color[ i ] & 0x0000ff00) >> 0x08; ++ int b = (vdr_color[ i ] & 0x000000ff) >> 0x00; ++ ++ int y = (( 66 * r + 129 * g + 25 * b + 128) >> 8) + 16; ++ int cr = ((112 * r - 94 * g - 18 * b + 128) >> 8) + 128; ++ int cb = ((-38 * r - 74 * g + 112 * b + 128) >> 8) + 128; ++ ++ uint8_t *dst = (uint8_t *)&color[ i ]; ++ *dst++ = cb; ++ *dst++ = cr; ++ *dst++ = y; ++ *dst++ = 0; ++ ++ trans[ i ] = a >> 4; ++ } ++ } ++ ++ xine_osd_set_palette(this->osd[ data->window ].window, color, trans); ++ } ++ } ++ break; ++ ++ case func_play_external: ++ { ++ char file_name[ 1024 ]; ++ int file_name_len = 0; ++ ++ READ_DATA_OR_FAIL(play_external, lprintf("got PLAYEXTERNAL\n")); ++ ++ file_name_len = this->cur_size; ++ ++ if (0 != file_name_len) ++ { ++ if (file_name_len <= 1 ++ || file_name_len > sizeof (file_name)) ++ { ++ return -1; ++ } ++ ++ n = vdr_read_abort (this->stream, this->fh_control, file_name, file_name_len); ++ if (n != file_name_len) ++ return -1; ++ ++ if (file_name[ file_name_len - 1 ] != '\0') ++ return -1; ++ ++ this->cur_size -= n; ++ } ++ ++ lprintf((file_name_len > 0) ? "----------- play external: %s\n" : "---------- stop external\n", file_name); ++ ++ if (file_name_len > 0) ++ external_stream_play(this, file_name); ++ else ++ external_stream_stop(this); ++ } ++ break; ++ ++ case func_clear: ++ { ++ READ_DATA_OR_FAIL(clear, lprintf("got CLEAR\n")); ++ ++ { ++ int orig_speed = xine_get_param(this->stream, XINE_PARAM_FINE_SPEED); ++ if (orig_speed <= 0) ++ xine_set_param(this->stream, XINE_PARAM_FINE_SPEED, XINE_FINE_SPEED_NORMAL); ++/* fprintf(stderr, "+++ CLEAR(%d%c): sync point: %02x\n", data->n, data->s ? 'b' : 'a', data->i); */ ++ if (!data->s) ++ { ++ pthread_mutex_lock(&this->find_sync_point_lock); ++ this->find_sync_point = data->i; ++ pthread_mutex_unlock(&this->find_sync_point_lock); ++ } ++/* ++ if (!this->dont_change_xine_volume) ++ xine_set_param(this->stream, XINE_PARAM_AUDIO_VOLUME, 0); ++*/ ++ _x_demux_flush_engine(this->stream); ++/* fprintf(stderr, "=== CLEAR(%d.1)\n", data->n); */ ++ _x_demux_control_start(this->stream); ++/* fprintf(stderr, "=== CLEAR(%d.2)\n", data->n); */ ++ _x_demux_seek(this->stream, 0, 0, 0); ++/* fprintf(stderr, "=== CLEAR(%d.3)\n", data->n); */ ++ ++ _x_stream_info_reset(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE); ++/* fprintf(stderr, "=== CLEAR(%d.4)\n", data->n); */ ++ _x_meta_info_reset(this->stream, XINE_META_INFO_AUDIOCODEC); ++/* fprintf(stderr, "=== CLEAR(%d.5)\n", data->n); */ ++ ++ _x_trigger_relaxed_frame_drop_mode(this->stream); ++/* _x_reset_relaxed_frame_drop_mode(this->stream); */ ++/* ++ if (!this->dont_change_xine_volume) ++ xine_set_param(this->stream, XINE_PARAM_AUDIO_VOLUME, this->last_volume); ++*/ ++/* fprintf(stderr, "--- CLEAR(%d%c)\n", data->n, data->s ? 'b' : 'a'); */ ++ if (orig_speed <= 0) ++ xine_set_param(this->stream, XINE_PARAM_FINE_SPEED, orig_speed); ++ } ++ } ++ break; ++ ++ case func_first_frame: ++ { ++ READ_DATA_OR_FAIL(first_frame, lprintf("got FIRST FRAME\n")); ++ ++ _x_trigger_relaxed_frame_drop_mode(this->stream); ++/* _x_reset_relaxed_frame_drop_mode(this->stream); */ ++ } ++ break; ++ ++ case func_still_frame: ++ { ++ READ_DATA_OR_FAIL(still_frame, lprintf("got STILL FRAME\n")); ++ ++ _x_reset_relaxed_frame_drop_mode(this->stream); ++ } ++ break; ++ ++ case func_set_video_window: ++ { ++ READ_DATA_OR_FAIL(set_video_window, lprintf("got SET VIDEO WINDOW\n")); ++/* ++ fprintf(stderr, "svw: (%d, %d)x(%d, %d), (%d, %d)\n", data->x, data->y, data->w, data->h, data->wRef, data->hRef); ++*/ ++ { ++ xine_event_t event; ++ vdr_set_video_window_data_t event_data; ++ ++ event_data.x = data->x; ++ event_data.y = data->y; ++ event_data.w = data->w; ++ event_data.h = data->h; ++ event_data.w_ref = data->w_ref; ++ event_data.h_ref = data->h_ref; ++ ++ event.type = XINE_EVENT_VDR_SETVIDEOWINDOW; ++ event.data = &event_data; ++ event.data_length = sizeof (event_data); ++ ++ xine_event_send(this->stream, &event); ++ } ++ } ++ break; ++ ++ case func_select_audio: ++ { ++ READ_DATA_OR_FAIL(select_audio, lprintf("got SELECT AUDIO\n")); ++ ++ this->audio_channels = data->channels; ++ ++ { ++ xine_event_t event; ++ vdr_select_audio_data_t event_data; ++ ++ event_data.channels = this->audio_channels; ++ ++ event.type = XINE_EVENT_VDR_SELECTAUDIO; ++ event.data = &event_data; ++ event.data_length = sizeof (event_data); ++ ++ xine_event_send(this->stream, &event); ++ } ++ } ++ break; ++ ++ case func_trick_speed_mode: ++ { ++ READ_DATA_OR_FAIL(trick_speed_mode, lprintf("got TRICK SPEED MODE\n")); ++ ++ if (this->trick_speed_mode != data->on) ++ { ++ this->trick_speed_mode = data->on; ++ ++ _x_demux_seek(this->stream, 0, 0, 0); ++ ++ { ++ xine_event_t event; ++ ++ event.type = XINE_EVENT_VDR_TRICKSPEEDMODE; ++ event.data = 0; ++ event.data_length = 0; /* this->trick_speed_mode; */ ++/* fprintf(stderr, "************************: %p, %d\n", event.data, event.data_length); */ ++ xine_event_send(this->stream, &event); ++ } ++ } ++ } ++ break; ++ ++ case func_flush: ++ { ++ READ_DATA_OR_FAIL(flush, lprintf("got FLUSH\n")); ++ ++ if (!data->just_wait) ++ { ++ if (this->stream->video_fifo) ++ { ++ buf_element_t *buf = this->stream->video_fifo->buffer_pool_alloc(this->stream->video_fifo); ++ if (!buf) ++ { ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("%s: buffer_pool_alloc() failed!\n"), LOG_MODULE); ++ return -1; ++ } ++ ++ buf->type = BUF_CONTROL_FLUSH_DECODER; ++ ++ this->stream->video_fifo->put(this->stream->video_fifo, buf); ++ } ++ } ++ ++ { ++ double _t1, _t2; ++ int _n = 0; ++ ++ int vb = -1, ab = -1, vf = -1, af = -1; ++ ++ uint8_t timed_out = 0; ++ ++ struct timeval now, then; ++ ++ if (data->ms_timeout >= 0) ++ { ++ gettimeofday(&now, 0); ++ ++ then = now; ++ then.tv_usec += (data->ms_timeout % 1000) * 1000; ++ then.tv_sec += (data->ms_timeout / 1000); ++ ++ if (then.tv_usec >= 1000000) ++ { ++ then.tv_usec -= 1000000; ++ then.tv_sec += 1; ++ } ++ } ++ else ++ { ++ then.tv_usec = 0; ++ then.tv_sec = 0; ++ } ++ ++ _t1 = _now(); ++ ++ while (1) ++ { ++ _x_query_buffer_usage(this->stream, &vb, &ab, &vf, &af); ++ ++ if (vb <= 0 && ab <= 0 && vf <= 0 && af <= 0) ++ break; ++ ++ if (data->ms_timeout >= 0 ++ && timercmp(&now, &then, >=)) ++ { ++ timed_out++; ++ break; ++ } ++ ++/* sched_yield(); */ ++ xine_usec_sleep(5000); ++ _n++; ++ ++ if (data->ms_timeout >= 0) ++ gettimeofday(&now, 0); ++ } ++ ++ _t2 = _now(); ++ /* fprintf(stderr, "vdr: flush: n: %d, %.1lf\n", _n, _t2 - _t1); */ ++ ++ xprintf(this->stream->xine ++ , XINE_VERBOSITY_LOG ++ , _("%s: flush buffers (vb: %d, ab: %d, vf: %d, af: %d) %s.\n") ++ , LOG_MODULE, vb, ab, vf, af ++ , (timed_out ? "timed out" : "done")); ++ ++ { ++ result_flush_t result_flush; ++ result_flush.header.func = data->header.func; ++ result_flush.header.len = sizeof (result_flush); ++ ++ result_flush.timed_out = timed_out; ++ ++ if (sizeof (result_flush) != vdr_write(this->fh_result, &result_flush, sizeof (result_flush))) ++ return -1; ++ } ++ } ++ } ++ break; ++ ++ case func_mute: ++ { ++ READ_DATA_OR_FAIL(mute, lprintf("got MUTE\n")); ++ ++ { ++ int param_mute = (this->volume_mode == XINE_VDR_VOLUME_CHANGE_SW) ? XINE_PARAM_AUDIO_AMP_MUTE : XINE_PARAM_AUDIO_MUTE; ++ xine_set_param(this->stream, param_mute, data->mute); ++ } ++ } ++ break; ++ ++ case func_set_volume: ++ { ++double t3, t2, t1, t0; ++ READ_DATA_OR_FAIL(set_volume, lprintf("got SETVOLUME\n")); ++t0 = _now(); ++ { ++ int change_volume = (this->volume_mode != XINE_VDR_VOLUME_IGNORE); ++ int do_mute = (this->last_volume != 0 && 0 == data->volume); ++ int do_unmute = (this->last_volume <= 0 && 0 != data->volume); ++ int report_change = 0; ++ ++ int param_mute = (this->volume_mode == XINE_VDR_VOLUME_CHANGE_SW) ? XINE_PARAM_AUDIO_AMP_MUTE : XINE_PARAM_AUDIO_MUTE; ++ int param_volume = (this->volume_mode == XINE_VDR_VOLUME_CHANGE_SW) ? XINE_PARAM_AUDIO_AMP_LEVEL : XINE_PARAM_AUDIO_VOLUME; ++ ++ this->last_volume = data->volume; ++ ++ if (do_mute || do_unmute) ++ { ++ switch (this->mute_mode) ++ { ++ case XINE_VDR_MUTE_EXECUTE: ++ report_change = 1; ++ xine_set_param(this->stream, param_mute, do_mute); ++ ++ case XINE_VDR_MUTE_IGNORE: ++ if (do_mute) ++ change_volume = 0; ++ break; ++ ++ case XINE_VDR_MUTE_SIMULATE: ++ change_volume = 1; ++ break; ++ ++ default: ++ return -1; ++ }; ++ } ++t1 = _now(); ++ ++ if (change_volume) ++ { ++ report_change = 1; ++ xine_set_param(this->stream, param_volume, this->last_volume); ++ } ++t2 = _now(); ++ ++ if (report_change && this->volume_mode != XINE_VDR_VOLUME_CHANGE_SW) ++ { ++ xine_event_t event; ++ xine_audio_level_data_t data; ++ ++ data.left ++ = data.right ++ = xine_get_param(this->stream, param_volume); ++ data.mute ++ = xine_get_param(this->stream, param_mute); ++t3 = _now(); ++ ++ event.type = XINE_EVENT_AUDIO_LEVEL; ++ event.data = &data; ++ event.data_length = sizeof (data); ++ ++ xine_event_send(this->stream, &event); ++ } ++ } ++/* fprintf(stderr, "volume: %6.3lf ms, %6.3lf ms, %6.3lf ms\n", t1 - t0, t2 - t1, t3 - t2); */ ++ } ++ break; ++ ++ case func_set_speed: ++ { ++ READ_DATA_OR_FAIL(set_speed, lprintf("got SETSPEED\n")); ++ ++ lprintf("... got SETSPEED %d\n", data->speed); ++ ++ if (data->speed != xine_get_param(this->stream, XINE_PARAM_FINE_SPEED)) ++ xine_set_param(this->stream, XINE_PARAM_FINE_SPEED, data->speed); ++ } ++ break; ++ ++ case func_set_prebuffer: ++ { ++ READ_DATA_OR_FAIL(set_prebuffer, lprintf("got SETPREBUFFER\n")); ++ ++ xine_set_param(this->stream, XINE_PARAM_METRONOM_PREBUFFER, data->prebuffer); ++ } ++ break; ++ ++ case func_metronom: ++ { ++ READ_DATA_OR_FAIL(metronom, lprintf("got METRONOM\n")); ++ ++ _x_demux_control_newpts(this->stream, data->pts, data->flags); ++ } ++ break; ++ ++ case func_start: ++ { ++ READ_DATA_OR_FAIL(start, lprintf("got START\n")); ++ ++ _x_demux_control_start(this->stream); ++ _x_demux_seek(this->stream, 0, 0, 0); ++ } ++ break; ++ ++ case func_wait: ++ { ++ READ_DATA_OR_FAIL(wait, lprintf("got WAIT\n")); ++ ++ { ++ result_wait_t result_wait; ++ result_wait.header.func = data->header.func; ++ result_wait.header.len = sizeof (result_wait); ++ ++ if (sizeof (result_wait) != vdr_write(this->fh_result, &result_wait, sizeof (result_wait))) ++ return -1; ++ ++ if (data->id == 1) ++ this->startup_phase = 0; ++ } ++ } ++ break; ++ ++ case func_setup: ++ { ++ READ_DATA_OR_FAIL(setup, lprintf("got SETUP\n")); ++ ++ this->osd_unscaled_blending = data->osd_unscaled_blending; ++ this->volume_mode = data->volume_mode; ++ this->mute_mode = data->mute_mode; ++ this->image4_3_zoom_x = data->image4_3_zoom_x; ++ this->image4_3_zoom_y = data->image4_3_zoom_y; ++ this->image16_9_zoom_x = data->image16_9_zoom_x; ++ this->image16_9_zoom_y = data->image16_9_zoom_y; ++ ++ adjust_zoom(this); ++ } ++ break; ++ ++ case func_grab_image: ++ { ++ READ_DATA_OR_FAIL(grab_image, lprintf("got GRABIMAGE\n")); ++ ++ { ++ off_t ret_val = -1; ++ ++ xine_current_frame_data_t frame_data; ++ memset(&frame_data, 0, sizeof (frame_data)); ++ ++ if (xine_get_current_frame_data(this->stream, &frame_data, XINE_FRAME_DATA_ALLOCATE_IMG)) ++ { ++ if (frame_data.ratio_code == XINE_VO_ASPECT_SQUARE) ++ frame_data.ratio_code = 10000; ++ else if (frame_data.ratio_code == XINE_VO_ASPECT_4_3) ++ frame_data.ratio_code = 13333; ++ else if (frame_data.ratio_code == XINE_VO_ASPECT_ANAMORPHIC) ++ frame_data.ratio_code = 17778; ++ else if (frame_data.ratio_code == XINE_VO_ASPECT_DVB) ++ frame_data.ratio_code = 21100; ++ } ++ ++ if (!frame_data.img) ++ memset(&frame_data, 0, sizeof (frame_data)); ++ ++ { ++ result_grab_image_t result_grab_image; ++ result_grab_image.header.func = data->header.func; ++ result_grab_image.header.len = sizeof (result_grab_image) + frame_data.img_size; ++ ++ result_grab_image.width = frame_data.width; ++ result_grab_image.height = frame_data.height; ++ result_grab_image.ratio = frame_data.ratio_code; ++ result_grab_image.format = frame_data.format; ++ result_grab_image.interlaced = frame_data.interlaced; ++ result_grab_image.crop_left = frame_data.crop_left; ++ result_grab_image.crop_right = frame_data.crop_right; ++ result_grab_image.crop_top = frame_data.crop_top; ++ result_grab_image.crop_bottom = frame_data.crop_bottom; ++ ++ if (sizeof (result_grab_image) == vdr_write(this->fh_result, &result_grab_image, sizeof (result_grab_image))) ++ { ++ if (!frame_data.img_size || (frame_data.img_size == vdr_write(this->fh_result, frame_data.img, frame_data.img_size))) ++ ret_val = 0; ++ } ++ } ++ ++ free(frame_data.img); ++ ++ if (ret_val != 0) ++ return ret_val; ++ } ++ } ++ break; ++ ++ case func_get_pts: ++ { ++ READ_DATA_OR_FAIL(get_pts, lprintf("got GETPTS\n")); ++ ++ { ++ result_get_pts_t result_get_pts; ++ result_get_pts.header.func = data->header.func; ++ result_get_pts.header.len = sizeof (result_get_pts); ++ ++ pthread_mutex_lock(&this->vpts_offset_queue_lock); ++ ++ while (this->vpts_offset_queue_changes) ++ pthread_cond_wait(&this->vpts_offset_queue_changed_cond, &this->vpts_offset_queue_lock); ++ ++ if (this->last_disc_type == DISC_STREAMSTART ++ && data->ms_timeout > 0) ++ { ++ struct timespec abstime; ++ { ++ struct timeval now; ++ gettimeofday(&now, 0); ++ ++ abstime.tv_sec = now.tv_sec + data->ms_timeout / 1000; ++ abstime.tv_nsec = now.tv_usec * 1000 + (data->ms_timeout % 1000) * 1e6; ++ ++ if (abstime.tv_nsec > 1e9) ++ { ++ abstime.tv_nsec -= 1e9; ++ abstime.tv_sec++; ++ } ++ } ++ ++ while (this->last_disc_type == DISC_STREAMSTART ++ || this->vpts_offset_queue_changes) ++ { ++ if (0 != pthread_cond_timedwait(&this->vpts_offset_queue_changed_cond, &this->vpts_offset_queue_lock, &abstime)) ++ break; ++ } ++ } ++ ++ if (this->last_disc_type == DISC_STREAMSTART ++ || this->vpts_offset_queue_changes) ++ { ++ result_get_pts.pts = -1; ++ result_get_pts.queued = 0; ++ } ++ else ++ { ++ int64_t offset, vpts = xine_get_current_vpts(this->stream); ++ ++ vdr_vpts_offset_queue_process(this, vpts); ++ ++/* if(this->vpts_offset_queue) */ ++if(0) ++ { ++fprintf(stderr, "C ---------------------------------------------\n"); ++ vdr_vpts_offset_t *p = this->vpts_offset_queue; ++ while (p) ++ { ++ fprintf(stderr, "C now: %12"PRId64", vpts: %12"PRId64", offset: %12"PRId64"\n", xine_get_current_vpts(this->stream), p->vpts, p->offset); ++ p = p->next; ++ } ++fprintf(stderr, "C =============================================\n"); ++ } ++ ++ if (this->vpts_offset_queue) ++ offset = this->vpts_offset_queue->offset; ++ else ++ offset = this->stream->metronom->get_option(this->stream->metronom, METRONOM_VPTS_OFFSET); ++ ++ result_get_pts.pts = (vpts - offset) & ((1ll << 33) - 1); ++ result_get_pts.queued = !!this->vpts_offset_queue; ++/* fprintf(stderr, "vpts: %12ld, stc: %12ld, offset: %12ld\n", vpts, result_get_pts.pts, offset); */ ++ } ++ ++ pthread_mutex_unlock(&this->vpts_offset_queue_lock); ++ ++ if (sizeof (result_get_pts) != vdr_write(this->fh_result, &result_get_pts, sizeof (result_get_pts))) ++ return -1; ++ } ++ } ++ break; ++ ++ case func_get_version: ++ { ++ READ_DATA_OR_FAIL(get_version, lprintf("got GETVERSION\n")); ++ ++ { ++ result_get_version_t result_get_version; ++ result_get_version.header.func = data->header.func; ++ result_get_version.header.len = sizeof (result_get_version); ++ ++ result_get_version.version = XINE_VDR_VERSION; ++ ++ if (sizeof (result_get_version) != vdr_write(this->fh_result, &result_get_version, sizeof (result_get_version))) ++ return -1; ++ } ++ } ++ break; ++ ++ case func_video_size: ++ { ++ READ_DATA_OR_FAIL(video_size, lprintf("got VIDEO SIZE\n")); ++ ++ { ++ int format; ++ ++ result_video_size_t result_video_size; ++ result_video_size.header.func = data->header.func; ++ result_video_size.header.len = sizeof (result_video_size); ++ ++ result_video_size.top = -1; ++ result_video_size.left = -1; ++ result_video_size.width = -1; ++ result_video_size.height = -1; ++ result_video_size.ratio = 0; ++ ++ xine_get_current_frame(this->stream, &result_video_size.width, &result_video_size.height, &result_video_size.ratio, &format, 0); ++ ++ if (result_video_size.ratio == XINE_VO_ASPECT_SQUARE) ++ result_video_size.ratio = 10000; ++ else if (result_video_size.ratio == XINE_VO_ASPECT_4_3) ++ result_video_size.ratio = 13333; ++ else if (result_video_size.ratio == XINE_VO_ASPECT_ANAMORPHIC) ++ result_video_size.ratio = 17778; ++ else if (result_video_size.ratio == XINE_VO_ASPECT_DVB) ++ result_video_size.ratio = 21100; ++ ++ if (0 != this->frame_size.x ++ || 0 != this->frame_size.y ++ || 0 != this->frame_size.w ++ || 0 != this->frame_size.h) ++ { ++ result_video_size.left = this->frame_size.x; ++ result_video_size.top = this->frame_size.y; ++ result_video_size.width = this->frame_size.w; ++ result_video_size.height = this->frame_size.h; ++ } ++/* fprintf(stderr, "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n"); */ ++ result_video_size.zoom_x = xine_get_param(this->stream, XINE_PARAM_VO_ZOOM_X); ++ result_video_size.zoom_y = xine_get_param(this->stream, XINE_PARAM_VO_ZOOM_Y); ++/* fprintf(stderr, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\n"); */ ++ if (sizeof (result_video_size) != vdr_write(this->fh_result, &result_video_size, sizeof (result_video_size))) ++ return -1; ++/* fprintf(stderr, "GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG\n"); */ ++ } ++ } ++ break; ++ ++ case func_reset_audio: ++ { ++ double _t1, _t2; ++ int _n = 0; ++ ++ READ_DATA_OR_FAIL(reset_audio, lprintf("got RESET AUDIO\n")); ++ ++ if (this->stream->audio_fifo) ++ { ++ xine_set_param(this->stream, XINE_PARAM_IGNORE_AUDIO, 1); ++ xine_set_param(this->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, -2); ++ ++ _t1 = _now(); ++ ++ while (1) ++ { ++ int n = xine_get_stream_info(this->stream, XINE_STREAM_INFO_MAX_AUDIO_CHANNEL); ++ if (n <= 0) ++ break; ++ ++ /* keep the decoder running */ ++ if (this->stream->audio_fifo) ++ { ++ buf_element_t *buf = this->stream->audio_fifo->buffer_pool_alloc(this->stream->audio_fifo); ++ if (!buf) ++ { ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("%s: buffer_pool_alloc() failed!\n"), LOG_MODULE); ++ return -1; ++ } ++ ++ buf->type = BUF_CONTROL_RESET_TRACK_MAP; ++ ++ this->stream->audio_fifo->put(this->stream->audio_fifo, buf); ++ } ++ ++/* sched_yield(); */ ++ xine_usec_sleep(5000); ++ _n++; ++ } ++ ++ _t2 = _now(); ++ /* fprintf(stderr, "vdr: reset_audio: n: %d, %.1lf\n", _n, _t2 - _t1); */ ++ ++ xine_set_param(this->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, -1); ++ ++ _x_stream_info_reset(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE); ++ _x_meta_info_reset(this->stream, XINE_META_INFO_AUDIOCODEC); ++ ++ xine_set_param(this->stream, XINE_PARAM_IGNORE_AUDIO, 0); ++ } ++ } ++ break; ++ ++ case func_query_capabilities: ++ { ++ READ_DATA_OR_FAIL(query_capabilities, lprintf("got QUERYCAPABILITIES\n")); ++ ++ { ++ result_query_capabilities_t result_query_capabilities; ++ result_query_capabilities.header.func = data->header.func; ++ result_query_capabilities.header.len = sizeof (result_query_capabilities); ++ ++ result_query_capabilities.osd_max_num_windows = MAX_SHOWING; ++ result_query_capabilities.osd_palette_max_depth = 8; ++ result_query_capabilities.osd_palette_is_shared = 0; ++ result_query_capabilities.osd_supports_argb_layer = this->osd_supports_argb_layer; ++ result_query_capabilities.osd_supports_custom_extent = this->osd_supports_custom_extent; ++ ++ if (sizeof (result_query_capabilities) != vdr_write(this->fh_result, &result_query_capabilities, sizeof (result_query_capabilities))) ++ return -1; ++ } ++ } ++ break; ++ ++ default: ++ lprintf("unknown function: %d\n", this->cur_func); ++ } ++ ++ if (this->cur_size != this->cur_done) ++ { ++ off_t skip = this->cur_size - this->cur_done; ++ ++ lprintf("func: %d, skipping: %lld\n", this->cur_func, skip); ++ ++ while (skip > BUF_SIZE) ++ { ++ n = vdr_read_abort(this->stream, this->fh_control, this->seek_buf, BUF_SIZE); ++ if (n != BUF_SIZE) ++ return -1; ++ ++ skip -= BUF_SIZE; ++ } ++ ++ n = vdr_read_abort(this->stream, this->fh_control, this->seek_buf, skip); ++ if (n != skip) ++ return -1; ++ ++ this->cur_done = this->cur_size; ++ ++ return -1; ++ } ++ ++ return 0; ++} ++ ++static void *vdr_rpc_thread_loop(void *arg) ++{ ++ vdr_input_plugin_t *this = (vdr_input_plugin_t *)arg; ++ int frontend_lock_failures = 0; ++ int failed = 0; ++ int was_startup_phase = this->startup_phase; ++ ++ while (!failed ++ && !this->rpc_thread_shutdown ++ && was_startup_phase == this->startup_phase) ++ { ++ struct timeval timeout; ++ fd_set rset; ++ ++ FD_ZERO(&rset); ++ FD_SET(this->fh_control, &rset); ++ ++ timeout.tv_sec = 0; ++ timeout.tv_usec = 50000; ++ ++ if (select(this->fh_control + 1, &rset, NULL, NULL, &timeout) > 0) ++ { ++ if (!_x_lock_frontend(this->stream, 100)) ++ { ++ if (++frontend_lock_failures > 50) ++ { ++ failed = 1; ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ LOG_MODULE ": locking frontend for rpc command execution failed, exiting ...\n"); ++ } ++ } ++ else ++ { ++ frontend_lock_failures = 0; ++ ++ if (_x_lock_port_rewiring(this->stream->xine, 100)) ++ { ++ if (vdr_execute_rpc_command(this) < 0) ++ { ++ failed = 1; ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ LOG_MODULE ": execution of rpc command %d (%s) failed, exiting ...\n", this->cur_func, ""); ++ } ++ ++ _x_unlock_port_rewiring(this->stream->xine); ++ } ++ ++ _x_unlock_frontend(this->stream); ++ } ++ } ++ } ++ ++ if (!failed && was_startup_phase) ++ return (void *)1; ++ ++ /* close control and result channel here to have vdr-xine initiate a disconnect for the above error case ... */ ++ close(this->fh_control); ++ this->fh_control = -1; ++ ++ close(this->fh_result); ++ this->fh_result = -1; ++ ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ LOG_MODULE ": rpc thread done.\n"); ++ ++ pthread_mutex_lock(&this->rpc_thread_shutdown_lock); ++ this->rpc_thread_shutdown = -1; ++ pthread_cond_broadcast(&this->rpc_thread_shutdown_cond); ++ pthread_mutex_unlock(&this->rpc_thread_shutdown_lock); ++ ++ return 0; ++} ++ ++static int internal_write_event_key(vdr_input_plugin_t *this, uint32_t key) ++{ ++ event_key_t event; ++ event.header.func = func_key; ++ event.header.len = sizeof (event); ++ ++ event.key = key; ++ ++ if (sizeof (event) != vdr_write(this->fh_event, &event, sizeof (event))) ++ return -1; ++ ++ return 0; ++} ++ ++static int internal_write_event_frame_size(vdr_input_plugin_t *this) ++{ ++ event_frame_size_t event; ++ event.header.func = func_frame_size; ++ event.header.len = sizeof (event); ++ ++ event.left = this->frame_size.x; ++ event.top = this->frame_size.y; ++ event.width = this->frame_size.w, ++ event.height = this->frame_size.h; ++ event.zoom_x = xine_get_param(this->stream, XINE_PARAM_VO_ZOOM_X); ++ event.zoom_y = xine_get_param(this->stream, XINE_PARAM_VO_ZOOM_Y); ++ ++ if (sizeof (event) != vdr_write(this->fh_event, &event, sizeof (event))) ++ return -1; ++ ++ return 0; ++} ++ ++static int internal_write_event_play_external(vdr_input_plugin_t *this, uint32_t key) ++{ ++ event_play_external_t event; ++ event.header.func = func_play_external; ++ event.header.len = sizeof (event); ++ ++ event.key = key; ++ ++ if (sizeof (event) != vdr_write(this->fh_event, &event, sizeof (event))) ++ return -1; ++ ++ return 0; ++} ++ ++static int internal_write_event_discontinuity(vdr_input_plugin_t *this, int32_t type) ++{ ++ event_discontinuity_t event; ++ event.header.func = func_discontinuity; ++ event.header.len = sizeof (event); ++ ++ event.type = type; ++ ++ if (sizeof (event) != vdr_write(this->fh_event, &event, sizeof (event))) ++ return -1; ++ ++ return 0; ++} ++ ++static off_t vdr_plugin_read(input_plugin_t *this_gen, ++ char *buf_gen, off_t len) ++{ ++ vdr_input_plugin_t *this = (vdr_input_plugin_t *) this_gen; ++ uint8_t *buf = (uint8_t *)buf_gen; ++ off_t n, total; ++#ifdef LOG_READ ++ lprintf ("reading %lld bytes...\n", len); ++#endif ++ total=0; ++ if (this->curpos < this->preview_size) ++ { ++ n = this->preview_size - this->curpos; ++ if (n > (len - total)) ++ n = len - total; ++#ifdef LOG_READ ++ lprintf ("%lld bytes from preview (which has %lld bytes)\n", ++ n, this->preview_size); ++#endif ++ memcpy (&buf[total], &this->preview[this->curpos], n); ++ this->curpos += n; ++ total += n; ++ } ++ ++ if( (len-total) > 0 ) ++ { ++ int retries = 0; ++ do ++ { ++ n = vdr_read_abort (this->stream, this->fh, (char *)&buf[total], len-total); ++ if (0 == n) ++ lprintf("read 0, retries: %d\n", retries); ++ } ++ while (0 == n ++ && !this->stream_external ++ && _x_continue_stream_processing(this->stream) ++ && 200 > retries++); /* 200 * 50ms */ ++#ifdef LOG_READ ++ lprintf ("got %lld bytes (%lld/%lld bytes read)\n", ++ n,total,len); ++#endif ++ if (n < 0) ++ { ++ _x_message(this->stream, XINE_MSG_READ_ERROR, NULL); ++ return 0; ++ } ++ ++ this->curpos += n; ++ total += n; ++ } ++ ++ if (this->find_sync_point ++ && total == 6) ++ { ++ pthread_mutex_lock(&this->find_sync_point_lock); ++ ++ while (this->find_sync_point ++ && total == 6 ++ && buf[0] == 0x00 ++ && buf[1] == 0x00 ++ && buf[2] == 0x01) ++ { ++ int l, sp; ++ ++ if (buf[3] == 0xbe ++ && buf[4] == 0xff) ++ { ++/* fprintf(stderr, "------- seen sync point: %02x, waiting for: %02x\n", buf[5], this->find_sync_point); */ ++ if (buf[5] == this->find_sync_point) ++ { ++ this->find_sync_point = 0; ++ break; ++ } ++ } ++ ++ if ((buf[3] & 0xf0) != 0xe0 ++ && (buf[3] & 0xe0) != 0xc0 ++ && buf[3] != 0xbd ++ && buf[3] != 0xbe) ++ { ++ break; ++ } ++ ++ l = buf[4] * 256 + buf[5]; ++ if (l <= 0) ++ break; ++ ++ sp = this->find_sync_point; ++ this->find_sync_point = 0; ++ this_gen->seek(this_gen, l, SEEK_CUR); ++ total = this_gen->read(this_gen, buf, 6); ++ this->find_sync_point = sp; ++ } ++ ++ pthread_mutex_unlock(&this->find_sync_point_lock); ++ } ++ ++ return total; ++} ++ ++static buf_element_t *vdr_plugin_read_block(input_plugin_t *this_gen, fifo_buffer_t *fifo, ++ off_t todo) ++{ ++ off_t total_bytes; ++ buf_element_t *buf = fifo->buffer_pool_alloc(fifo); ++ ++ buf->content = buf->mem; ++ buf->type = BUF_DEMUX_BLOCK; ++ ++ total_bytes = vdr_plugin_read(this_gen, (char *)buf->content, todo); ++ ++ if (total_bytes != todo) ++ { ++ buf->free_buffer(buf); ++ return NULL; ++ } ++ ++ buf->size = total_bytes; ++ ++ return buf; ++} ++ ++/* forward reference */ ++static off_t vdr_plugin_get_current_pos(input_plugin_t *this_gen); ++ ++static off_t vdr_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) ++{ ++ vdr_input_plugin_t *this = (vdr_input_plugin_t *)this_gen; ++ ++ lprintf("seek %lld offset, %d origin...\n", ++ offset, origin); ++ ++ if ((origin == SEEK_CUR) && (offset >= 0)) ++ { ++ for ( ; ((int)offset) - BUF_SIZE > 0; offset -= BUF_SIZE) ++ { ++ if (!this_gen->read(this_gen, this->seek_buf, BUF_SIZE)) ++ return this->curpos; ++ } ++ ++ this_gen->read (this_gen, this->seek_buf, offset); ++ } ++ ++ if (origin == SEEK_SET) ++ { ++ if (offset < this->curpos) ++ { ++ if (this->curpos <= this->preview_size) ++ this->curpos = offset; ++ else ++ lprintf("cannot seek back! (%lld > %lld)\n", this->curpos, offset); ++ } ++ else ++ { ++ offset -= this->curpos; ++ ++ for ( ; ((int)offset) - BUF_SIZE > 0; offset -= BUF_SIZE) ++ { ++ if (!this_gen->read(this_gen, this->seek_buf, BUF_SIZE)) ++ return this->curpos; ++ } ++ ++ this_gen->read(this_gen, this->seek_buf, offset); ++ } ++ } ++ ++ return this->curpos; ++} ++ ++static off_t vdr_plugin_get_length(input_plugin_t *this_gen) ++{ ++ return 0; ++} ++ ++static uint32_t vdr_plugin_get_capabilities(input_plugin_t *this_gen) ++{ ++ return INPUT_CAP_PREVIEW; ++} ++ ++static uint32_t vdr_plugin_get_blocksize(input_plugin_t *this_gen) ++{ ++ return 0; ++} ++ ++static off_t vdr_plugin_get_current_pos(input_plugin_t *this_gen) ++{ ++ vdr_input_plugin_t *this = (vdr_input_plugin_t *)this_gen; ++ ++ return this->curpos; ++} ++ ++static const char *vdr_plugin_get_mrl(input_plugin_t *this_gen) ++{ ++ vdr_input_plugin_t *this = (vdr_input_plugin_t *)this_gen; ++ ++ return this->mrl; ++} ++ ++static void vdr_plugin_dispose(input_plugin_t *this_gen) ++{ ++ vdr_input_plugin_t *this = (vdr_input_plugin_t *)this_gen; ++ int i; ++ ++ external_stream_stop(this); ++ ++ if (this->event_queue) ++ xine_event_dispose_queue(this->event_queue); ++ ++ if (this->rpc_thread) ++ { ++ struct timespec abstime; ++ int ms_to_time_out = 10000; ++ ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("%s: shutting down rpc thread (timeout: %d ms) ...\n"), LOG_MODULE, ms_to_time_out); ++ ++ pthread_mutex_lock(&this->rpc_thread_shutdown_lock); ++ ++ if (this->rpc_thread_shutdown > -1) ++ { ++ this->rpc_thread_shutdown = 1; ++ ++ { ++ struct timeval now; ++ gettimeofday(&now, 0); ++ ++ abstime.tv_sec = now.tv_sec + ms_to_time_out / 1000; ++ abstime.tv_nsec = now.tv_usec * 1000 + (ms_to_time_out % 1000) * 1e6; ++ ++ if (abstime.tv_nsec > 1e9) ++ { ++ abstime.tv_nsec -= 1e9; ++ abstime.tv_sec++; ++ } ++ } ++ ++ if (0 != pthread_cond_timedwait(&this->rpc_thread_shutdown_cond, &this->rpc_thread_shutdown_lock, &abstime)) ++ { ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("%s: cancelling rpc thread in function %d...\n"), LOG_MODULE, this->cur_func); ++ pthread_cancel(this->rpc_thread); ++ } ++ } ++ ++ pthread_mutex_unlock(&this->rpc_thread_shutdown_lock); ++ ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("%s: joining rpc thread ...\n"), LOG_MODULE); ++ pthread_join(this->rpc_thread, 0); ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("%s: rpc thread joined.\n"), LOG_MODULE); ++ } ++ ++ pthread_cond_destroy(&this->rpc_thread_shutdown_cond); ++ pthread_mutex_destroy(&this->rpc_thread_shutdown_lock); ++ ++ if (this->metronom_thread) ++ { ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("%s: joining metronom thread ...\n"), LOG_MODULE); ++ ++ pthread_mutex_lock(&this->metronom_thread_call_lock); ++ ++ pthread_mutex_lock(&this->metronom_thread_lock); ++ this->metronom_thread_request = -1; ++ this->metronom_thread_reply = 0; ++ pthread_cond_broadcast(&this->metronom_thread_request_cond); ++/* ++ pthread_mutex_unlock(&this->metronom_thread_lock); ++ ++ pthread_mutex_lock(&this->metronom_thread_lock); ++ if (!this->metronom_thread_reply) ++*/ ++ pthread_cond_wait(&this->metronom_thread_reply_cond, &this->metronom_thread_lock); ++ pthread_mutex_unlock(&this->metronom_thread_lock); ++ ++ pthread_mutex_unlock(&this->metronom_thread_call_lock); ++ ++ pthread_join(this->metronom_thread, 0); ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("%s: metronom thread joined.\n"), LOG_MODULE); ++ } ++ ++ pthread_mutex_destroy(&this->metronom_thread_lock); ++ pthread_cond_destroy(&this->metronom_thread_request_cond); ++ pthread_cond_destroy(&this->metronom_thread_reply_cond); ++ ++ pthread_mutex_destroy(&this->find_sync_point_lock); ++ pthread_mutex_destroy(&this->adjust_zoom_lock); ++ ++ if (this->fh_result != -1) ++ close(this->fh_result); ++ ++ if (this->fh_control != -1) ++ close(this->fh_control); ++ ++ if (this->fh_event != -1) ++ close(this->fh_event); ++ ++ for (i = 0; i < VDR_MAX_NUM_WINDOWS; i++) ++ { ++ if (0 == this->osd[ i ].window) ++ continue; ++ ++ xine_osd_hide(this->osd[ i ].window, 0); ++ xine_osd_free(this->osd[ i ].window); ++ ++ free(this->osd[ i ].argb_buffer); ++ } ++ ++ if (this->osd_buffer) ++ free(this->osd_buffer); ++ ++ if ((this->fh != STDIN_FILENO) && (this->fh != -1)) ++ close(this->fh); ++ ++ free(this->mrl); ++ ++ this->stream->metronom = this->metronom.stream_metronom; ++ this->metronom.stream_metronom = 0; ++ ++ vdr_vpts_offset_queue_purge(this); ++ pthread_cond_destroy(&this->vpts_offset_queue_changed_cond); ++ pthread_mutex_destroy(&this->vpts_offset_queue_lock); ++ ++ free(this); ++} ++ ++static int vdr_plugin_get_optional_data(input_plugin_t *this_gen, ++ void *data, int data_type) ++{ ++ vdr_input_plugin_t *this = (vdr_input_plugin_t *)this_gen; ++ (void)this; ++ switch (data_type) ++ { ++ case INPUT_OPTIONAL_DATA_PREVIEW: ++ /* just fake what mpeg_pes demuxer expects */ ++ memcpy (data, "\x00\x00\x01\xe0\x00\x03\x80\x00\x00", 9); ++ return 9; ++ } ++ return INPUT_OPTIONAL_UNSUPPORTED; ++} ++ ++static inline const char *mrl_to_fifo (const char *mrl) ++{ ++ /* vdr://foo -> /foo */ ++ return mrl + 3 + strspn (mrl + 4, "/"); ++} ++ ++static inline const char *mrl_to_host (const char *mrl) ++{ ++ /* netvdr://host:port -> host:port */ ++ return strrchr (mrl, '/') + 1; ++} ++ ++static int vdr_plugin_open_fifo_mrl(input_plugin_t *this_gen) ++{ ++ vdr_input_plugin_t *this = (vdr_input_plugin_t *)this_gen; ++ char *filename = (char *)mrl_to_fifo (this->mrl); ++ ++ if(!strcmp(filename, "/")) { ++ filename = (char *)VDR_ABS_FIFO_DIR "/stream"; ++ } ++ ++ filename = strdup(filename); ++ ++ _x_mrl_unescape (filename); ++ this->fh = open(filename, O_RDONLY | O_NONBLOCK); ++ ++ lprintf("filename '%s'\n", filename); ++ ++ if (this->fh == -1) ++ { ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ _("%s: failed to open '%s' (%s)\n"), LOG_MODULE, ++ filename, ++ strerror(errno)); ++ free (filename); ++ return 0; ++ } ++ ++ { ++ struct pollfd poll_fh = { this->fh, POLLIN, 0 }; ++ ++ int r = poll(&poll_fh, 1, 300); ++ if (1 != r) ++ { ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ _("%s: failed to open '%s' (%s)\n"), LOG_MODULE, ++ filename, ++ _("timeout expired during setup phase")); ++ free (filename); ++ return 0; ++ } ++ } ++ ++ fcntl(this->fh, F_SETFL, ~O_NONBLOCK & fcntl(this->fh, F_GETFL, 0)); ++ ++ /* eat initial handshake byte */ ++ { ++ char b; ++ read(this->fh, &b, 1); ++ } ++ ++ { ++ char *filename_control = 0; ++ asprintf(&filename_control, "%s.control", filename); ++ ++ this->fh_control = open(filename_control, O_RDONLY); ++ ++ if (this->fh_control == -1) { ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ _("%s: failed to open '%s' (%s)\n"), LOG_MODULE, ++ filename_control, ++ strerror(errno)); ++ ++ free(filename_control); ++ free (filename); ++ return 0; ++ } ++ ++ free(filename_control); ++ } ++ ++ { ++ char *filename_result = 0; ++ asprintf(&filename_result, "%s.result", filename); ++ ++ this->fh_result = open(filename_result, O_WRONLY); ++ ++ if (this->fh_result == -1) { ++ perror("failed"); ++ ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ _("%s: failed to open '%s' (%s)\n"), LOG_MODULE, ++ filename_result, ++ strerror(errno)); ++ ++ free(filename_result); ++ free (filename); ++ return 0; ++ } ++ ++ free(filename_result); ++ } ++ ++ { ++ char *filename_event = 0; ++ asprintf(&filename_event, "%s.event", filename); ++ ++ this->fh_event = open(filename_event, O_WRONLY); ++ ++ if (this->fh_event == -1) { ++ perror("failed"); ++ ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ _("%s: failed to open '%s' (%s)\n"), LOG_MODULE, ++ filename_event, ++ strerror(errno)); ++ ++ free(filename_event); ++ free (filename); ++ return 0; ++ } ++ ++ free(filename_event); ++ } ++ ++ free (filename); ++ return 1; ++} ++ ++static int vdr_plugin_open_socket(vdr_input_plugin_t *this, struct hostent *host, unsigned short port) ++{ ++ int fd; ++ struct sockaddr_in sain; ++ struct in_addr iaddr; ++ ++ if ((fd = socket(PF_INET, SOCK_STREAM, 0)) == -1) ++ { ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ _("%s: failed to create socket for port %d (%s)\n"), LOG_MODULE, ++ port, strerror(errno)); ++ return -1; ++ } ++ ++ iaddr.s_addr = *((unsigned int *)host->h_addr_list[0]); ++ ++ sain.sin_port = htons(port); ++ sain.sin_family = AF_INET; ++ sain.sin_addr = iaddr; ++ ++ if (connect(fd, (struct sockaddr *)&sain, sizeof (sain)) < 0) ++ { ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ _("%s: failed to connect to port %d (%s)\n"), LOG_MODULE, port, ++ strerror(errno)); ++ ++ return -1; ++ } ++ ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ _("%s: socket opening (port %d) successful, fd = %d\n"), LOG_MODULE, port, fd); ++ ++ return fd; ++} ++ ++static int vdr_plugin_open_sockets(vdr_input_plugin_t *this) ++{ ++ struct hostent *host; ++ char *mrl_host = strdup (mrl_to_host (this->mrl)); ++ char *mrl_port; ++ int port = 18701; ++ ++ mrl_port = strchr(mrl_host, '#'); ++ if (mrl_port) ++ *mrl_port = 0; /* strip off things like '#demux:mpeg_pes' */ ++ ++ _x_mrl_unescape (mrl_host); ++ ++ mrl_port = strchr(mrl_host, ':'); ++ if (mrl_port) ++ { ++ port = atoi(mrl_port + 1); ++ *mrl_port = 0; ++ } ++ ++ host = gethostbyname(mrl_host); ++ ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ _("%s: connecting to vdr.\n"), LOG_MODULE); ++ ++ if (!host) ++ { ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ _("%s: failed to resolve hostname '%s' (%s)\n"), LOG_MODULE, ++ mrl_host, ++ strerror(errno)); ++ free (mrl_host); ++ return 0; ++ } ++ free (mrl_host); ++ ++ if ((this->fh = vdr_plugin_open_socket(this, host, port + 0)) == -1) ++ return 0; ++ ++ fcntl(this->fh, F_SETFL, ~O_NONBLOCK & fcntl(this->fh, F_GETFL, 0)); ++ ++ if ((this->fh_control = vdr_plugin_open_socket(this, host, port + 1)) == -1) ++ return 0; ++ ++ if ((this->fh_result = vdr_plugin_open_socket(this, host, port + 2)) == -1) ++ return 0; ++ ++ if ((this->fh_event = vdr_plugin_open_socket(this, host, port + 3)) == -1) ++ return 0; ++ ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ _("%s: connecting to all sockets (port %d .. %d) was successful.\n"), LOG_MODULE, port, port + 3); ++ ++ return 1; ++} ++ ++static int vdr_plugin_open_socket_mrl(input_plugin_t *this_gen) ++{ ++ vdr_input_plugin_t *this = (vdr_input_plugin_t *)this_gen; ++ ++ lprintf("input_vdr: connecting to vdr-xine-server...\n"); ++ ++ if (!vdr_plugin_open_sockets(this)) ++ return 0; ++ ++ return 1; ++} ++ ++static void *vdr_metronom_thread_loop(void *arg) ++{ ++ vdr_input_plugin_t *this = (vdr_input_plugin_t *)arg; ++ int run = 1; ++ ++ pthread_mutex_lock(&this->metronom_thread_lock); ++ ++ while (run) ++ { ++ if (this->metronom_thread_request == 0) ++ pthread_cond_wait(&this->metronom_thread_request_cond, &this->metronom_thread_lock); ++ ++ if (this->metronom_thread_request == -1) ++ run = 0; ++ else ++ this->metronom.metronom.handle_audio_discontinuity(&this->metronom.metronom, DISC_ABSOLUTE, this->metronom_thread_request); ++ ++ this->metronom_thread_request = 0; ++ this->metronom_thread_reply = 1; ++ pthread_cond_broadcast(&this->metronom_thread_reply_cond); ++ } ++ ++ pthread_mutex_unlock(&this->metronom_thread_lock); ++ ++ return 0; ++} ++ ++static int vdr_plugin_open(input_plugin_t *this_gen) ++{ ++ vdr_input_plugin_t *this = (vdr_input_plugin_t *)this_gen; ++ ++ lprintf("trying to open '%s'...\n", this->mrl); ++ ++ if (this->fh == -1) ++ { ++ int err = 0; ++ ++ if (!strncasecmp(&this->mrl[0], "vdr:/", 5)) ++ { ++ if (!vdr_plugin_open_fifo_mrl(this_gen)) ++ return 0; ++ } ++ else if (!strncasecmp(&this->mrl[0], "netvdr:/", 8)) ++ { ++ if (!vdr_plugin_open_socket_mrl(this_gen)) ++ return 0; ++ } ++ else ++ { ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ _("%s: MRL (%s) invalid! MRL should start with vdr://path/to/fifo/stream or netvdr://host:port where ':port' is optional.\n"), LOG_MODULE, ++ strerror(err)); ++ return 0; ++ } ++ ++ if ((err = pthread_create(&this->metronom_thread, NULL, ++ vdr_metronom_thread_loop, (void *)this)) != 0) ++ { ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ _("%s: can't create new thread (%s)\n"), LOG_MODULE, ++ strerror(err)); ++ ++ return 0; ++ } ++ ++ this->rpc_thread_shutdown = 0; ++ ++ /* let this thread handle rpc commands in startup phase */ ++ this->startup_phase = 1; ++ if (0 == vdr_rpc_thread_loop(this)) ++ return 0; ++/* fprintf(stderr, "####################################################\n"); */ ++ if ((err = pthread_create(&this->rpc_thread, NULL, ++ vdr_rpc_thread_loop, (void *)this)) != 0) ++ { ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ _("%s: can't create new thread (%s)\n"), LOG_MODULE, ++ strerror(err)); ++ ++ return 0; ++ } ++ } ++ ++ /* ++ * mrl accepted and opened successfully at this point ++ * ++ * => create plugin instance ++ */ ++ ++ this->preview = NULL; ++ this->preview_size = 0; ++ this->curpos = 0; ++ ++ return 1; ++} ++ ++static void event_handler(void *user_data, const xine_event_t *event) ++{ ++ vdr_input_plugin_t *this = (vdr_input_plugin_t *)user_data; ++ uint32_t key = key_none; ++ ++ lprintf("eventHandler(): event->type: %d\n", event->type); ++ ++ if (XINE_EVENT_VDR_FRAMESIZECHANGED == event->type) ++ { ++ memcpy(&this->frame_size, event->data, event->data_length); ++ ++ if (0 != internal_write_event_frame_size(this)) ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ _("%s: input event write: %s.\n"), LOG_MODULE, strerror(errno)); ++ ++ adjust_zoom(this); ++ return; ++ } ++ ++ if (XINE_EVENT_VDR_DISCONTINUITY == event->type) ++ { ++ if (0 != internal_write_event_discontinuity(this, event->data_length)) ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ _("%s: input event write: %s.\n"), LOG_MODULE, strerror(errno)); ++ ++ return; ++ } ++ ++ if (XINE_EVENT_VDR_PLUGINSTARTED == event->type) ++ { ++ if (0 == event->data_length) /* vdr_video */ ++ { ++ xine_event_t event; ++ ++ event.type = XINE_EVENT_VDR_TRICKSPEEDMODE; ++ event.data = 0; ++ event.data_length = 0; /* this->trick_speed_mode; */ ++ ++ xine_event_send(this->stream, &event); ++ } ++ else if (1 == event->data_length) /* vdr_audio */ ++ { ++ xine_event_t event; ++ vdr_select_audio_data_t event_data; ++ ++ event_data.channels = this->audio_channels; ++ ++ event.type = XINE_EVENT_VDR_SELECTAUDIO; ++ event.data = &event_data; ++ event.data_length = sizeof (event_data); ++ ++ xine_event_send(this->stream, &event); ++ } ++ else ++ { ++ fprintf(stderr, "input_vdr: illegal XINE_EVENT_VDR_PLUGINSTARTED: %d\n", event->data_length); ++ } ++ ++ return; ++ } ++ ++ switch (event->type) ++ { ++ case XINE_EVENT_INPUT_UP: key = key_up; break; ++ case XINE_EVENT_INPUT_DOWN: key = key_down; break; ++ case XINE_EVENT_INPUT_LEFT: key = key_left; break; ++ case XINE_EVENT_INPUT_RIGHT: key = key_right; break; ++ case XINE_EVENT_INPUT_SELECT: key = key_ok; break; ++ case XINE_EVENT_VDR_BACK: key = key_back; break; ++ case XINE_EVENT_VDR_CHANNELPLUS: key = key_channel_plus; break; ++ case XINE_EVENT_VDR_CHANNELMINUS: key = key_channel_minus; break; ++ case XINE_EVENT_VDR_RED: key = key_red; break; ++ case XINE_EVENT_VDR_GREEN: key = key_green; break; ++ case XINE_EVENT_VDR_YELLOW: key = key_yellow; break; ++ case XINE_EVENT_VDR_BLUE: key = key_blue; break; ++ case XINE_EVENT_VDR_PLAY: key = key_play; break; ++ case XINE_EVENT_VDR_PAUSE: key = key_pause; break; ++ case XINE_EVENT_VDR_STOP: key = key_stop; break; ++ case XINE_EVENT_VDR_RECORD: key = key_record; break; ++ case XINE_EVENT_VDR_FASTFWD: key = key_fast_fwd; break; ++ case XINE_EVENT_VDR_FASTREW: key = key_fast_rew; break; ++ case XINE_EVENT_VDR_POWER: key = key_power; break; ++ case XINE_EVENT_VDR_SCHEDULE: key = key_schedule; break; ++ case XINE_EVENT_VDR_CHANNELS: key = key_channels; break; ++ case XINE_EVENT_VDR_TIMERS: key = key_timers; break; ++ case XINE_EVENT_VDR_RECORDINGS: key = key_recordings; break; ++ case XINE_EVENT_INPUT_MENU1: key = key_menu; break; ++ case XINE_EVENT_VDR_SETUP: key = key_setup; break; ++ case XINE_EVENT_VDR_COMMANDS: key = key_commands; break; ++ case XINE_EVENT_INPUT_NUMBER_0: key = key_0; break; ++ case XINE_EVENT_INPUT_NUMBER_1: key = key_1; break; ++ case XINE_EVENT_INPUT_NUMBER_2: key = key_2; break; ++ case XINE_EVENT_INPUT_NUMBER_3: key = key_3; break; ++ case XINE_EVENT_INPUT_NUMBER_4: key = key_4; break; ++ case XINE_EVENT_INPUT_NUMBER_5: key = key_5; break; ++ case XINE_EVENT_INPUT_NUMBER_6: key = key_6; break; ++ case XINE_EVENT_INPUT_NUMBER_7: key = key_7; break; ++ case XINE_EVENT_INPUT_NUMBER_8: key = key_8; break; ++ case XINE_EVENT_INPUT_NUMBER_9: key = key_9; break; ++ case XINE_EVENT_VDR_USER1: key = key_user1; break; ++ case XINE_EVENT_VDR_USER2: key = key_user2; break; ++ case XINE_EVENT_VDR_USER3: key = key_user3; break; ++ case XINE_EVENT_VDR_USER4: key = key_user4; break; ++ case XINE_EVENT_VDR_USER5: key = key_user5; break; ++ case XINE_EVENT_VDR_USER6: key = key_user6; break; ++ case XINE_EVENT_VDR_USER7: key = key_user7; break; ++ case XINE_EVENT_VDR_USER8: key = key_user8; break; ++ case XINE_EVENT_VDR_USER9: key = key_user9; break; ++ case XINE_EVENT_VDR_VOLPLUS: key = key_volume_plus; break; ++ case XINE_EVENT_VDR_VOLMINUS: key = key_volume_minus; break; ++ case XINE_EVENT_VDR_MUTE: key = key_mute; break; ++ case XINE_EVENT_VDR_AUDIO: key = key_audio; break; ++ case XINE_EVENT_VDR_INFO: key = key_info; break; ++ case XINE_EVENT_VDR_CHANNELPREVIOUS: key = key_channel_previous; break; ++ case XINE_EVENT_INPUT_NEXT: key = key_next; break; ++ case XINE_EVENT_INPUT_PREVIOUS: key = key_previous; break; ++ case XINE_EVENT_VDR_SUBTITLES: key = key_subtitles; break; ++ default: ++ return; ++ } ++ ++ if (0 != internal_write_event_key(this, key)) ++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG, ++ _("%s: input event write: %s.\n"), LOG_MODULE, strerror(errno)); ++} ++ ++ ++static int64_t vdr_vpts_offset_queue_change_begin(vdr_input_plugin_t *this, int type) ++{ ++ pthread_mutex_lock(&this->vpts_offset_queue_lock); ++ this->vpts_offset_queue_changes++; ++ pthread_mutex_unlock(&this->vpts_offset_queue_lock); ++ ++ return this->metronom.metronom.get_option(&this->metronom.metronom, METRONOM_VPTS_OFFSET); ++} ++ ++static void vdr_vpts_offset_queue_change_end(vdr_input_plugin_t *this, int type, int64_t disc_off, int64_t vpts_offset) ++{ ++ pthread_mutex_lock(&this->vpts_offset_queue_lock); ++ ++if(0) ++ { ++fprintf(stderr, "A ---------------------------------------------\n"); ++ vdr_vpts_offset_t *p = this->vpts_offset_queue; ++ while (p) ++ { ++ fprintf(stderr, "A now: %12"PRId64", vpts: %12"PRId64", offset: %12"PRId64"\n", xine_get_current_vpts(this->stream), p->vpts, p->offset); ++ p = p->next; ++ } ++fprintf(stderr, "A =============================================\n"); ++ } ++ ++ if (type == DISC_ABSOLUTE) ++ { ++ int64_t vpts = this->stream->metronom->get_option(this->stream->metronom, METRONOM_VPTS_OFFSET) + disc_off; ++ ++ if (!this->vpts_offset_queue ++ || this->vpts_offset_queue_tail->vpts < vpts) ++ { ++ vdr_vpts_offset_t *curr = (vdr_vpts_offset_t *)calloc(1, sizeof (vdr_vpts_offset_t)); ++ curr->vpts = vpts; ++ curr->offset = vpts_offset; ++ ++ if (!this->vpts_offset_queue) ++ this->vpts_offset_queue = this->vpts_offset_queue_tail = curr; ++ else ++ { ++ this->vpts_offset_queue_tail->next = curr; ++ this->vpts_offset_queue_tail = curr; ++ } ++ } ++ } ++ else ++ vdr_vpts_offset_queue_purge(this); ++ ++if(0) ++ { ++fprintf(stderr, "B ---------------------------------------------\n"); ++ vdr_vpts_offset_t *p = this->vpts_offset_queue; ++ while (p) ++ { ++ fprintf(stderr, "B now: %12"PRId64", vpts: %12"PRId64", offset: %12"PRId64"\n", xine_get_current_vpts(this->stream), p->vpts, p->offset); ++ p = p->next; ++ } ++fprintf(stderr, "B =============================================\n"); ++ } ++ ++ this->vpts_offset_queue_changes--; ++ pthread_cond_broadcast(&this->vpts_offset_queue_changed_cond); ++ ++ this->last_disc_type = type; ++ ++ pthread_mutex_unlock(&this->vpts_offset_queue_lock); ++ ++ if (!this->trick_speed_mode) ++ { ++ xine_event_t event; ++ ++ event.type = XINE_EVENT_VDR_DISCONTINUITY; ++ event.data = 0; ++ event.data_length = type; ++ ++ xine_event_send(this->stream, &event); ++ } ++} ++ ++static void vdr_metronom_handle_audio_discontinuity(metronom_t *self, int type, int64_t disc_off) ++{ ++ vdr_metronom_t *this = (vdr_metronom_t *)self; ++ int64_t vpts_offset = vdr_vpts_offset_queue_change_begin(this->input, type); ++/* fprintf(stderr, "had A: %d, %"PRId64", %"PRId64", %"PRId64"\n", type, disc_off, xine_get_current_vpts(this->input->stream), this->stream_metronom->get_option(this->stream_metronom, METRONOM_VPTS_OFFSET)); */ ++ this->stream_metronom->handle_audio_discontinuity(this->stream_metronom, type, disc_off); ++/* fprintf(stderr, "had B: %d, %"PRId64", %"PRId64", %"PRId64"\n", type, disc_off, xine_get_current_vpts(this->input->stream), this->stream_metronom->get_option(this->stream_metronom, METRONOM_VPTS_OFFSET)); */ ++ vdr_vpts_offset_queue_change_end(this->input, type, disc_off, vpts_offset); ++} ++ ++static void vdr_metronom_handle_video_discontinuity(metronom_t *self, int type, int64_t disc_off) ++{ ++ vdr_metronom_t *this = (vdr_metronom_t *)self; ++ int64_t vpts_offset = vdr_vpts_offset_queue_change_begin(this->input, type); ++/* fprintf(stderr, "hvd A: %d, %"PRId64", %"PRId64", %"PRId64"\n", type, disc_off, xine_get_current_vpts(this->input->stream), this->stream_metronom->get_option(this->stream_metronom, METRONOM_VPTS_OFFSET)); */ ++ this->stream_metronom->handle_video_discontinuity(this->stream_metronom, type, disc_off); ++/* fprintf(stderr, "hvd B: %d, %"PRId64", %"PRId64", %"PRId64"\n", type, disc_off, xine_get_current_vpts(this->input->stream), this->stream_metronom->get_option(this->stream_metronom, METRONOM_VPTS_OFFSET)); */ ++ vdr_vpts_offset_queue_change_end(this->input, type, disc_off, vpts_offset); ++} ++ ++static void vdr_metronom_got_video_frame(metronom_t *self, vo_frame_t *frame) ++{ ++ vdr_metronom_t *this = (vdr_metronom_t *)self; ++ ++ if (this->input->trick_speed_mode && frame->pts) ++ { ++ pthread_mutex_lock(&this->input->metronom_thread_call_lock); ++ ++ pthread_mutex_lock(&this->input->metronom_thread_lock); ++ this->input->metronom_thread_request = frame->pts; ++ this->input->metronom_thread_reply = 0; ++ pthread_cond_broadcast(&this->input->metronom_thread_request_cond); ++ pthread_mutex_unlock(&this->input->metronom_thread_lock); ++ ++ vdr_metronom_handle_video_discontinuity(self, DISC_ABSOLUTE, frame->pts); ++ ++ pthread_mutex_lock(&this->input->metronom_thread_lock); ++ if (!this->input->metronom_thread_reply) ++ pthread_cond_wait(&this->input->metronom_thread_reply_cond, &this->input->metronom_thread_lock); ++ pthread_mutex_unlock(&this->input->metronom_thread_lock); ++ ++ pthread_mutex_unlock(&this->input->metronom_thread_call_lock); ++ } ++ ++ this->stream_metronom->got_video_frame(this->stream_metronom, frame); ++ ++ if (this->input->trick_speed_mode && frame->pts) ++ { ++/* fprintf(stderr, "vpts: %12ld, pts: %12ld, offset: %12ld\n", frame->vpts, frame->pts, this->stream_metronom->get_option(this->stream_metronom, METRONOM_VPTS_OFFSET)); */ ++ } ++} ++ ++static int64_t vdr_metronom_got_audio_samples(metronom_t *self, int64_t pts, int nsamples) ++{ ++ vdr_metronom_t *this = (vdr_metronom_t *)self; ++ return this->stream_metronom->got_audio_samples(this->stream_metronom, pts, nsamples); ++} ++ ++static int64_t vdr_metronom_got_spu_packet(metronom_t *self, int64_t pts) ++{ ++ vdr_metronom_t *this = (vdr_metronom_t *)self; ++ return this->stream_metronom->got_spu_packet(this->stream_metronom, pts); ++} ++ ++static void vdr_metronom_set_audio_rate(metronom_t *self, int64_t pts_per_smpls) ++{ ++ vdr_metronom_t *this = (vdr_metronom_t *)self; ++ this->stream_metronom->set_audio_rate(this->stream_metronom, pts_per_smpls); ++} ++ ++static void vdr_metronom_set_option(metronom_t *self, int option, int64_t value) ++{ ++ vdr_metronom_t *this = (vdr_metronom_t *)self; ++ this->stream_metronom->set_option(this->stream_metronom, option, value); ++} ++ ++static int64_t vdr_metronom_get_option(metronom_t *self, int option) ++{ ++ vdr_metronom_t *this = (vdr_metronom_t *)self; ++ return this->stream_metronom->get_option(this->stream_metronom, option); ++} ++ ++static void vdr_metronom_set_master(metronom_t *self, metronom_t *master) ++{ ++ vdr_metronom_t *this = (vdr_metronom_t *)self; ++ this->stream_metronom->set_master(this->stream_metronom, master); ++} ++ ++static void vdr_metronom_exit(metronom_t *self) ++{ ++ _x_abort(); ++} ++ ++ ++static input_plugin_t *vdr_class_get_instance(input_class_t *cls_gen, xine_stream_t *stream, ++ const char *data) ++{ ++ vdr_input_plugin_t *this; ++ char *mrl = strdup(data); ++ ++ if (!strncasecmp(mrl, "vdr:/", 5)) ++ lprintf("filename '%s'\n", mrl_to_path (mrl)); ++ else if (!strncasecmp(mrl, "netvdr:/", 5)) ++ lprintf("host '%s'\n", mrl_to_socket (mrl)); ++ else ++ { ++ free(mrl); ++ return NULL; ++ } ++ ++ /* ++ * mrl accepted and opened successfully at this point ++ * ++ * => create plugin instance ++ */ ++ ++ this = (vdr_input_plugin_t *)xine_xmalloc(sizeof (vdr_input_plugin_t)); ++ ++ this->stream = stream; ++ this->curpos = 0; ++ this->mrl = mrl; ++ this->fh = -1; ++ this->fh_control = -1; ++ this->fh_result = -1; ++ this->fh_event = -1; ++ ++ this->input_plugin.open = vdr_plugin_open; ++ this->input_plugin.get_capabilities = vdr_plugin_get_capabilities; ++ this->input_plugin.read = vdr_plugin_read; ++ this->input_plugin.read_block = vdr_plugin_read_block; ++ this->input_plugin.seek = vdr_plugin_seek; ++ this->input_plugin.get_current_pos = vdr_plugin_get_current_pos; ++ this->input_plugin.get_length = vdr_plugin_get_length; ++ this->input_plugin.get_blocksize = vdr_plugin_get_blocksize; ++ this->input_plugin.get_mrl = vdr_plugin_get_mrl; ++ this->input_plugin.dispose = vdr_plugin_dispose; ++ this->input_plugin.get_optional_data = vdr_plugin_get_optional_data; ++ this->input_plugin.input_class = cls_gen; ++ ++ this->cur_func = func_unknown; ++ this->cur_size = 0; ++ this->cur_done = 0; ++ ++ memset(this->osd, 0, sizeof (this->osd)); ++ ++ { ++ xine_osd_t *osd = xine_osd_new(this->stream, 0, 0, 16, 16); ++ uint32_t caps = xine_osd_get_capabilities(osd); ++ xine_osd_free(osd); ++ ++#ifdef XINE_OSD_CAP_ARGB_LAYER ++ this->osd_supports_argb_layer = !!(caps & XINE_OSD_CAP_ARGB_LAYER); ++#endif ++#ifdef XINE_OSD_CAP_CUSTOM_EXTENT ++ this->osd_supports_custom_extent = !!(caps & XINE_OSD_CAP_CUSTOM_EXTENT); ++#endif ++ } ++ ++ this->osd_buffer = 0; ++ this->osd_buffer_size = 0; ++ this->osd_unscaled_blending = 0; ++ this->trick_speed_mode = 0; ++ this->audio_channels = 0; ++ this->mute_mode = XINE_VDR_MUTE_SIMULATE; ++ this->volume_mode = XINE_VDR_VOLUME_CHANGE_HW; ++ this->last_volume = -1; ++ this->frame_size.x = 0; ++ this->frame_size.y = 0; ++ this->frame_size.w = 0; ++ this->frame_size.h = 0; ++ this->frame_size.r = 0; ++ ++ this->stream_external = 0; ++ this->event_queue_external = 0; ++ ++ pthread_mutex_init(&this->rpc_thread_shutdown_lock, 0); ++ pthread_cond_init(&this->rpc_thread_shutdown_cond, 0); ++ ++ pthread_mutex_init(&this->metronom_thread_lock, 0); ++ pthread_cond_init(&this->metronom_thread_request_cond, 0); ++ pthread_cond_init(&this->metronom_thread_reply_cond, 0); ++ pthread_mutex_init(&this->metronom_thread_call_lock, 0); ++ ++ pthread_mutex_init(&this->find_sync_point_lock, 0); ++ pthread_mutex_init(&this->adjust_zoom_lock, 0); ++ this->image4_3_zoom_x = 0; ++ this->image4_3_zoom_y = 0; ++ this->image16_9_zoom_x = 0; ++ this->image16_9_zoom_y = 0; ++ ++ this->event_queue = xine_event_new_queue(this->stream); ++ if (this->event_queue) ++ xine_event_create_listener_thread(this->event_queue, event_handler, this); ++ ++ this->metronom.input = this; ++ this->metronom.metronom.set_audio_rate = vdr_metronom_set_audio_rate; ++ this->metronom.metronom.got_video_frame = vdr_metronom_got_video_frame; ++ this->metronom.metronom.got_audio_samples = vdr_metronom_got_audio_samples; ++ this->metronom.metronom.got_spu_packet = vdr_metronom_got_spu_packet; ++ this->metronom.metronom.handle_audio_discontinuity = vdr_metronom_handle_audio_discontinuity; ++ this->metronom.metronom.handle_video_discontinuity = vdr_metronom_handle_video_discontinuity; ++ this->metronom.metronom.set_option = vdr_metronom_set_option; ++ this->metronom.metronom.get_option = vdr_metronom_get_option; ++ this->metronom.metronom.set_master = vdr_metronom_set_master; ++ this->metronom.metronom.exit = vdr_metronom_exit; ++ ++ this->metronom.stream_metronom = stream->metronom; ++ stream->metronom = &this->metronom.metronom; ++ ++ pthread_mutex_init(&this->vpts_offset_queue_lock, 0); ++ pthread_cond_init(&this->vpts_offset_queue_changed_cond, 0); ++ ++ return &this->input_plugin; ++} ++ ++/* ++ * vdr input plugin class stuff ++ */ ++ ++static const char *vdr_class_get_description(input_class_t *this_gen) ++{ ++ return _("VDR display device plugin"); ++} ++ ++static const char *vdr_class_get_identifier (input_class_t *this_gen) ++{ ++ return "VDR"; ++} ++ ++static void vdr_class_dispose (input_class_t *this_gen) ++{ ++ vdr_input_class_t *this = (vdr_input_class_t *)this_gen; ++ ++ free(this); ++} ++ ++static char **vdr_class_get_autoplay_list(input_class_t *this_gen, ++ int *num_files) ++{ ++ vdr_input_class_t *class = (vdr_input_class_t *)this_gen; ++ ++ *num_files = 1; ++ return (char **)class->mrls; ++} ++ ++void *vdr_input_init_plugin(xine_t *xine, void *data) ++{ ++ vdr_input_class_t *this; ++ ++ lprintf("init_class\n"); ++ ++ this = (vdr_input_class_t *)xine_xmalloc(sizeof (vdr_input_class_t)); ++ ++ this->xine = xine; ++ ++ this->mrls[ 0 ] = "vdr:/" VDR_ABS_FIFO_DIR "/stream#demux:mpeg_pes"; ++ this->mrls[ 1 ] = 0; ++ ++ this->input_class.get_instance = vdr_class_get_instance; ++ this->input_class.get_identifier = vdr_class_get_identifier; ++ this->input_class.get_description = vdr_class_get_description; ++ this->input_class.get_dir = NULL; ++ this->input_class.get_autoplay_list = vdr_class_get_autoplay_list; ++ this->input_class.dispose = vdr_class_dispose; ++ this->input_class.eject_media = NULL; ++ ++ return this; ++} +diff --git a/src/vdr/post_vdr_audio.c b/src/vdr/post_vdr_audio.c +new file mode 100644 +--- /dev/null ++++ b/src/vdr/post_vdr_audio.c +@@ -0,0 +1,285 @@ ++/* ++ * Copyright (C) 2000-2004 the xine project ++ * ++ * This file is part of xine, a free video player. ++ * ++ * xine is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * xine is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA ++ */ ++ ++/* ++ * select audio channel plugin for VDR ++ */ ++ ++#define LOG_MODULE "vdr_audio" ++#define LOG_VERBOSE ++/* ++#define LOG ++*/ ++ ++#include "xine_internal.h" ++#include "post.h" ++#include "combined_vdr.h" ++ ++ ++ ++typedef struct vdr_audio_post_plugin_s ++{ ++ post_plugin_t post_plugin; ++ ++ xine_event_queue_t *event_queue; ++ xine_stream_t *vdr_stream; ++ ++ uint8_t audio_channels; ++ int num_channels; ++ ++} ++vdr_audio_post_plugin_t; ++ ++ ++static void vdr_audio_select_audio(vdr_audio_post_plugin_t *this, uint8_t channels) ++{ ++ this->audio_channels = channels; ++} ++ ++ ++/* plugin class functions */ ++static post_plugin_t *vdr_audio_open_plugin(post_class_t *class_gen, int inputs, ++ xine_audio_port_t **audio_target, ++ xine_video_port_t **video_target); ++static char *vdr_audio_get_identifier(post_class_t *class_gen); ++static char *vdr_audio_get_description(post_class_t *class_gen); ++static void vdr_audio_class_dispose(post_class_t *class_gen); ++ ++/* plugin instance functions */ ++static void vdr_audio_dispose(post_plugin_t *this_gen); ++ ++/* replaced ao_port functions */ ++static int vdr_audio_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, ++ uint32_t bits, uint32_t rate, int mode); ++static void vdr_audio_port_put_buffer(xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream); ++ ++ ++ ++void *vdr_audio_init_plugin(xine_t *xine, void *data) ++{ ++ post_class_t *class = (post_class_t *)xine_xmalloc(sizeof (post_class_t)); ++ ++ if (!class) ++ return NULL; ++ ++ class->open_plugin = vdr_audio_open_plugin; ++ class->get_identifier = vdr_audio_get_identifier; ++ class->get_description = vdr_audio_get_description; ++ class->dispose = vdr_audio_class_dispose; ++ ++ return class; ++} ++ ++static post_plugin_t *vdr_audio_open_plugin(post_class_t *class_gen, int inputs, ++ xine_audio_port_t **audio_target, ++ xine_video_port_t **video_target) ++{ ++ vdr_audio_post_plugin_t *this = (vdr_audio_post_plugin_t *)xine_xmalloc(sizeof (vdr_audio_post_plugin_t)); ++ post_in_t *input; ++ post_out_t *output; ++ post_audio_port_t *port; ++/* ++fprintf(stderr, "~~~~~~~~~~ vdr open plugin\n"); ++*/ ++ if (!this || !audio_target || !audio_target[ 0 ]) ++ { ++ free(this); ++ return NULL; ++ } ++ ++ _x_post_init(&this->post_plugin, 1, 0); ++ this->post_plugin.dispose = vdr_audio_dispose; ++ ++ port = _x_post_intercept_audio_port(&this->post_plugin, audio_target[ 0 ], &input, &output); ++ port->new_port.open = vdr_audio_port_open; ++ port->new_port.put_buffer = vdr_audio_port_put_buffer; ++ ++ this->post_plugin.xine_post.audio_input[ 0 ] = &port->new_port; ++ ++ ++ ++ this->audio_channels = 0; ++ ++ return &this->post_plugin; ++} ++ ++static char *vdr_audio_get_identifier(post_class_t *class_gen) ++{ ++ return "vdr_audio"; ++} ++ ++static char *vdr_audio_get_description(post_class_t *class_gen) ++{ ++ return "modifies every audio frame as requested by VDR"; ++} ++ ++static void vdr_audio_class_dispose(post_class_t *class_gen) ++{ ++ free(class_gen); ++} ++ ++ ++static void vdr_audio_dispose(post_plugin_t *this_gen) ++{ ++/* ++fprintf(stderr, "~~~~~~~~~~ vdr dispose\n"); ++*/ ++ if (_x_post_dispose(this_gen)) ++ { ++ vdr_audio_post_plugin_t *this = (vdr_audio_post_plugin_t *)this_gen; ++ ++ if (this->vdr_stream) ++ xine_event_dispose_queue(this->event_queue); ++ ++ free(this_gen); ++ } ++} ++ ++static int vdr_audio_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, ++ uint32_t bits, uint32_t rate, int mode) { ++ ++ post_audio_port_t *port = (post_audio_port_t *)port_gen; ++ vdr_audio_post_plugin_t *this = (vdr_audio_post_plugin_t *)port->post; ++ ++ _x_post_rewire(&this->post_plugin); ++ _x_post_inc_usage(port); ++/* ++fprintf(stderr, "~~~~~~~~~~ vdr port open\n"); ++*/ ++ port->stream = stream; ++ port->bits = bits; ++ port->rate = rate; ++ port->mode = mode; ++ ++ this->num_channels = _x_ao_mode2channels(mode); ++ ++ return (port->original_port->open) (port->original_port, stream, bits, rate, mode ); ++} ++ ++ ++static void vdr_audio_port_put_buffer(xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream) ++{ ++ post_audio_port_t *port = (post_audio_port_t *)port_gen; ++ vdr_audio_post_plugin_t *this = (vdr_audio_post_plugin_t *)port->post; ++ xine_event_t *event; ++/* ++fprintf(stderr, "~~~~~~ vdr_audio\n"); ++*/ ++ if (this->vdr_stream ++ && !_x_continue_stream_processing(this->vdr_stream)) ++ { ++ this->vdr_stream = 0; ++ ++ xine_event_dispose_queue(this->event_queue); ++ this->event_queue = 0; ++ ++ this->audio_channels = 0; ++ } ++ ++ if (!this->vdr_stream ++ && vdr_is_vdr_stream(stream)) ++ { ++ this->event_queue = xine_event_new_queue(stream); ++ if (this->event_queue) ++ { ++ this->vdr_stream = stream; ++ ++ { ++ xine_event_t event; ++ ++ event.type = XINE_EVENT_VDR_PLUGINSTARTED; ++ event.data = 0; ++ event.data_length = 1; /* vdr_audio */ ++ ++ xine_event_send(this->vdr_stream, &event); ++ } ++ } ++ } ++ ++ if (this->event_queue) ++ { ++ while ((event = xine_event_get(this->event_queue))) ++ { ++ if (event->type == XINE_EVENT_VDR_SELECTAUDIO) ++ { ++ vdr_select_audio_data_t *data = (vdr_select_audio_data_t *)event->data; ++ ++ vdr_audio_select_audio(this, data->channels); ++ } ++ ++ xine_event_free(event); ++ } ++ } ++ ++ if (this->num_channels == 2 ++ && this->audio_channels != 0 ++ && this->audio_channels != 3) ++ { ++ audio_buffer_t *vdr_buf = port->original_port->get_buffer(port->original_port); ++ vdr_buf->num_frames = buf->num_frames; ++ vdr_buf->vpts = buf->vpts; ++ vdr_buf->frame_header_count = buf->frame_header_count; ++ vdr_buf->first_access_unit = buf->first_access_unit; ++ /* FIXME: The audio buffer should contain this info. ++ * We should not have to get it from the open call. ++ */ ++ vdr_buf->format.bits = buf->format.bits; ++ vdr_buf->format.rate = buf->format.rate; ++ vdr_buf->format.mode = buf->format.mode; ++ _x_extra_info_merge(vdr_buf->extra_info, buf->extra_info); ++ ++ { ++ int step = buf->format.bits / 8; ++ uint8_t *src = (uint8_t *)buf->mem; ++ uint8_t *dst = (uint8_t *)vdr_buf->mem; ++ ++ if (this->audio_channels == 2) ++ src += step; ++/* ++ fprintf(stderr, "~~~~~~~~~~ vdr port put buffer: channels: %d, %d\n" ++ , this->audio_channels ++ , buf->format.bits); ++*/ ++ int i, k; ++ for (i = 0; i < buf->num_frames; i++) ++ { ++ for (k = 0; k < step; k++) ++ *dst++ = *src++; ++ ++ src -= step; ++ ++ for (k = 0; k < step; k++) ++ *dst++ = *src++; ++ ++ src += step; ++ } ++ } ++ ++ /* pass data to original port */ ++ port->original_port->put_buffer(port->original_port, vdr_buf, stream); ++ ++ /* free data from origial buffer */ ++ buf->num_frames = 0; /* UNDOCUMENTED, but hey, it works! Force old audio_out buffer free. */ ++ } ++ ++ port->original_port->put_buffer(port->original_port, buf, stream); ++ ++ return; ++} +diff --git a/src/vdr/post_vdr_video.c b/src/vdr/post_vdr_video.c +new file mode 100644 +--- /dev/null ++++ b/src/vdr/post_vdr_video.c +@@ -0,0 +1,502 @@ ++/* ++ * Copyright (C) 2000-2004 the xine project ++ * ++ * This file is part of xine, a free video player. ++ * ++ * xine is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * xine is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA ++ */ ++ ++/* ++ * frame scaler plugin for VDR ++ */ ++ ++#define LOG_MODULE "vdr_video" ++/* ++#define LOG ++#define LOG_VERBOSE ++*/ ++ ++#include "xine_internal.h" ++#include "post.h" ++#include "combined_vdr.h" ++ ++ ++ ++typedef struct vdr_video_post_plugin_s ++{ ++ post_plugin_t post_plugin; ++ ++ xine_event_queue_t *event_queue; ++ xine_stream_t *vdr_stream; ++ ++ int8_t trick_speed_mode; ++ int8_t enabled; ++ ++ int32_t x; ++ int32_t y; ++ int32_t w; ++ int32_t h; ++ int32_t w_ref; ++ int32_t h_ref; ++ ++ int32_t old_frame_left; ++ int32_t old_frame_top; ++ int32_t old_frame_width; ++ int32_t old_frame_height; ++ double old_frame_ratio; ++ ++} ++vdr_video_post_plugin_t; ++ ++ ++static void vdr_video_set_video_window(vdr_video_post_plugin_t *this, int32_t x, int32_t y, int32_t w, int32_t h, int32_t w_ref, int32_t h_ref) ++{ ++ this->enabled = 0; ++ ++ this->x = x; ++ this->y = y; ++ this->w = w; ++ this->h = h; ++ this->w_ref = w_ref; ++ this->h_ref = h_ref; ++ ++ if (w != w_ref || h != h_ref) ++ this->enabled = 1; ++} ++ ++ ++/* plugin class functions */ ++static post_plugin_t *vdr_video_open_plugin(post_class_t *class_gen, int inputs, ++ xine_audio_port_t **audio_target, ++ xine_video_port_t **video_target); ++static char *vdr_video_get_identifier(post_class_t *class_gen); ++static char *vdr_video_get_description(post_class_t *class_gen); ++static void vdr_video_class_dispose(post_class_t *class_gen); ++ ++/* plugin instance functions */ ++static void vdr_video_dispose(post_plugin_t *this_gen); ++ ++/* route preprocessing functions check */ ++static int vdr_video_route_preprocessing_procs(post_video_port_t *port, vo_frame_t *frame); ++ ++/* replaced vo_frame functions */ ++static int vdr_video_draw(vo_frame_t *frame, xine_stream_t *stream); ++ ++ ++void *vdr_video_init_plugin(xine_t *xine, void *data) ++{ ++ post_class_t *class = (post_class_t *)xine_xmalloc(sizeof (post_class_t)); ++ ++ if (!class) ++ return NULL; ++ ++ class->open_plugin = vdr_video_open_plugin; ++ class->get_identifier = vdr_video_get_identifier; ++ class->get_description = vdr_video_get_description; ++ class->dispose = vdr_video_class_dispose; ++ ++ return class; ++} ++ ++static post_plugin_t *vdr_video_open_plugin(post_class_t *class_gen, int inputs, ++ xine_audio_port_t **audio_target, ++ xine_video_port_t **video_target) ++{ ++ vdr_video_post_plugin_t *this = (vdr_video_post_plugin_t *)xine_xmalloc(sizeof (vdr_video_post_plugin_t)); ++ post_in_t *input; ++ post_out_t *output; ++ post_video_port_t *port; ++ ++ if (!this || !video_target || !video_target[ 0 ]) ++ { ++ free(this); ++ return NULL; ++ } ++ ++ _x_post_init(&this->post_plugin, 0, 1); ++ this->post_plugin.dispose = vdr_video_dispose; ++ ++ port = _x_post_intercept_video_port(&this->post_plugin, video_target[ 0 ], &input, &output); ++ port->route_preprocessing_procs = vdr_video_route_preprocessing_procs; ++ port->new_frame->draw = vdr_video_draw; ++ this->post_plugin.xine_post.video_input[ 0 ] = &port->new_port; ++ ++ this->enabled = 0; ++ this->vdr_stream = 0; ++ this->event_queue = 0; ++ this->old_frame_left = 0; ++ this->old_frame_top = 0; ++ this->old_frame_width = 0; ++ this->old_frame_height = 0; ++ this->old_frame_ratio = 0; ++ this->trick_speed_mode = 0; ++ ++ return &this->post_plugin; ++} ++ ++static char *vdr_video_get_identifier(post_class_t *class_gen) ++{ ++ return "vdr"; ++} ++ ++static char *vdr_video_get_description(post_class_t *class_gen) ++{ ++ return "modifies every video frame as requested by VDR"; ++} ++ ++static void vdr_video_class_dispose(post_class_t *class_gen) ++{ ++ free(class_gen); ++} ++ ++ ++static void vdr_video_dispose(post_plugin_t *this_gen) ++{ ++ if (_x_post_dispose(this_gen)) ++ { ++ vdr_video_post_plugin_t *this = (vdr_video_post_plugin_t *)this_gen; ++ ++ if (this->vdr_stream) ++ { ++ xine_event_t event; ++ vdr_frame_size_changed_data_t event_data; ++ ++ event_data.x = 0; ++ event_data.y = 0; ++ event_data.w = 0; ++ event_data.h = 0; ++ ++ event.type = XINE_EVENT_VDR_FRAMESIZECHANGED; ++ event.data = &event_data; ++ event.data_length = sizeof (event_data); ++ ++ xine_event_send(this->vdr_stream, &event); ++ ++ xine_event_dispose_queue(this->event_queue); ++ } ++ ++ free(this_gen); ++ } ++} ++ ++static int vdr_video_route_preprocessing_procs(post_video_port_t *port, vo_frame_t *frame) ++{ ++ vdr_video_post_plugin_t *this = (vdr_video_post_plugin_t *)port->post; ++ return !this->enabled ++ || (frame->format != XINE_IMGFMT_YUY2 ++ && frame->format != XINE_IMGFMT_YV12); ++} ++ ++ ++static inline void vdr_video_scale(uint8_t *src, uint8_t *dst, int y_inc, int x_inc, int w_dst, int h_dst, int x, int y, int w, int h, int w_ref, int h_ref, int init) ++{ ++ int x0 = x * w_dst / w_ref; ++ int y0 = y * h_dst / h_ref; ++ ++ int x1 = ((x + w) * w_dst - 1 + w_ref) / w_ref; ++ int y1 = ((y + h) * h_dst - 1 + h_ref) / h_ref; ++ ++ int dx = x1 - x0; ++ int dy = y1 - y0; ++ ++ int yy, xx; ++ ++ int dy2 = dy + dy; ++ int h_dst2 = h_dst + h_dst; ++ int y_eps = h_dst - dy2; ++ ++ int dx2 = dx + dx; ++ int w_dst2 = w_dst + w_dst; ++ int x_eps0 = w_dst - dx2; ++ ++ for (yy = 0; yy < y0; yy++) ++ { ++ uint8_t *dst0 = dst; ++ ++ for (xx = 0; xx < w_dst; xx++) ++ { ++ *dst0 = init; ++ dst0 += x_inc; ++ } ++ ++ dst += y_inc; ++ } ++ ++ for (yy = y0; yy < y1; yy++) ++ { ++ uint8_t *dst0 = dst; ++ uint8_t *src0 = src; ++ ++ int x_eps = x_eps0; ++ ++ for (xx = 0; xx < x0; xx++) ++ { ++ *dst0 = init; ++ dst0 += x_inc; ++ } ++ ++ for (xx = x0; xx < x1; xx++) ++ { ++ *dst0 = *src0; ++ dst0 += x_inc; ++ ++ x_eps += w_dst2; ++ while (x_eps >= 0) ++ { ++ src0 += x_inc; ++ x_eps -= dx2; ++ } ++ } ++ ++ for (xx = x1; xx < w_dst; xx++) ++ { ++ *dst0 = init; ++ dst0 += x_inc; ++ } ++ ++ dst += y_inc; ++ ++ y_eps += h_dst2; ++ while (y_eps >= 0) ++ { ++ src += y_inc; ++ y_eps -= dy2; ++ } ++ } ++ ++ for (yy = y1; yy < h_dst; yy++) ++ { ++ uint8_t *dst0 = dst; ++ ++ for (xx = 0; xx < w_dst; xx++) ++ { ++ *dst0 = init; ++ dst0 += x_inc; ++ } ++ ++ dst += y_inc; ++ } ++} ++ ++static void vdr_video_scale_YUY2(vdr_video_post_plugin_t *this, vo_frame_t *src, vo_frame_t *dst) ++{ ++ int w = dst->width - dst->crop_left - dst->crop_right; ++ int h = dst->height - dst->crop_top - dst->crop_bottom; ++ int offset; ++ ++ if (w < 0) ++ w = 0; ++ ++ if (h < 0) ++ h = 0; ++ ++ offset = dst->pitches[ 0 ] * dst->crop_top + 2 * dst->crop_left; ++ vdr_video_scale(&src->base[ 0 ][ 0 ] + offset, &dst->base[ 0 ][ 0 ] + offset, dst->pitches[ 0 ], 2, w , h, this->x, this->y, this->w, this->h, this->w_ref, this->h_ref, 0x00); ++ offset = dst->pitches[ 0 ] * dst->crop_top + 4 * ((dst->crop_left + 1) / 2); ++ vdr_video_scale(&src->base[ 0 ][ 1 ] + offset, &dst->base[ 0 ][ 1 ] + offset, dst->pitches[ 0 ], 4, (w + 1) / 2, h, this->x, this->y, this->w, this->h, this->w_ref, this->h_ref, 0x80); ++ offset = dst->pitches[ 0 ] * dst->crop_top + 4 * ((dst->crop_left + 1) / 2); ++ vdr_video_scale(&src->base[ 0 ][ 3 ] + offset, &dst->base[ 0 ][ 3 ] + offset, dst->pitches[ 0 ], 4, (w + 1) / 2, h, this->x, this->y, this->w, this->h, this->w_ref, this->h_ref, 0x80); ++} ++ ++static void vdr_video_scale_YV12(vdr_video_post_plugin_t *this, vo_frame_t *src, vo_frame_t *dst) ++{ ++ int w = dst->width - dst->crop_left - dst->crop_right; ++ int h = dst->height - dst->crop_top - dst->crop_bottom; ++ int offset; ++ ++ if (w < 0) ++ w = 0; ++ ++ if (h < 0) ++ h = 0; ++ ++ offset = dst->pitches[ 0 ] * dst->crop_top + 1 * dst->crop_left; ++ vdr_video_scale(&src->base[ 0 ][ 0 ] + offset, &dst->base[ 0 ][ 0 ] + offset, dst->pitches[ 0 ], 1, w , h , this->x, this->y, this->w, this->h, this->w_ref, this->h_ref, 0x00); ++ offset = dst->pitches[ 1 ] * ((dst->crop_top + 1) / 2) + 1 * ((dst->crop_left + 1) / 2); ++ vdr_video_scale(&src->base[ 1 ][ 0 ] + offset, &dst->base[ 1 ][ 0 ] + offset, dst->pitches[ 1 ], 1, (w + 1) / 2, (h + 1) / 2, this->x, this->y, this->w, this->h, this->w_ref, this->h_ref, 0x80); ++ offset = dst->pitches[ 2 ] * ((dst->crop_top + 1) / 2) + 1 * ((dst->crop_left + 1) / 2); ++ vdr_video_scale(&src->base[ 2 ][ 0 ] + offset, &dst->base[ 2 ][ 0 ] + offset, dst->pitches[ 2 ], 1, (w + 1) / 2, (h + 1) / 2, this->x, this->y, this->w, this->h, this->w_ref, this->h_ref, 0x80); ++} ++ ++ ++static int vdr_video_draw(vo_frame_t *frame, xine_stream_t *stream) ++{ ++ post_video_port_t *port = (post_video_port_t *)frame->port; ++ vdr_video_post_plugin_t *this = (vdr_video_post_plugin_t *)port->post; ++ vo_frame_t *vdr_frame; ++ xine_event_t *event; ++ int skip; ++ ++ if (this->vdr_stream ++ && !_x_continue_stream_processing(this->vdr_stream)) ++ { ++ this->vdr_stream = 0; ++ ++ xine_event_dispose_queue(this->event_queue); ++ this->event_queue = 0; ++ ++ this->old_frame_left = 0; ++ this->old_frame_top = 0; ++ this->old_frame_width = 0; ++ this->old_frame_height = 0; ++ this->old_frame_ratio = 0; ++ } ++ ++ if (!this->vdr_stream ++ && vdr_is_vdr_stream(stream)) ++ { ++ this->event_queue = xine_event_new_queue(stream); ++ if (this->event_queue) ++ { ++ this->vdr_stream = stream; ++ ++ { ++ xine_event_t event; ++ ++ event.type = XINE_EVENT_VDR_PLUGINSTARTED; ++ event.data = 0; ++ event.data_length = 0; /* vdr_video */ ++ ++ xine_event_send(this->vdr_stream, &event); ++ } ++ } ++ } ++ ++ if (this->event_queue) ++ { ++ while ((event = xine_event_get(this->event_queue))) ++ { ++ if (event->type == XINE_EVENT_VDR_SETVIDEOWINDOW) ++ { ++ vdr_set_video_window_data_t *data = (vdr_set_video_window_data_t *)event->data; ++ ++ vdr_video_set_video_window(this, data->x, data->y, data->w, data->h, data->w_ref, data->h_ref); ++ } ++ else if (event->type == XINE_EVENT_VDR_TRICKSPEEDMODE) ++ { ++/* ++ fprintf(stderr, "###############################: %p, %d\n", event->data, event->data_length); ++ this->trick_speed_mode = (0 != event->data_length); ++*/ ++ } ++ ++ xine_event_free(event); ++ } ++ } ++ ++ { ++ int32_t frame_left = frame->crop_left; ++ int32_t frame_width = frame->width - frame->crop_left - frame->crop_right; ++ int32_t frame_top = frame->crop_top; ++ int32_t frame_height = frame->height - frame->crop_top - frame->crop_bottom; ++ double frame_ratio = frame->ratio; ++ ++ if (frame_left < 0) ++ frame_left = 0; ++ if (frame_width > frame->width) ++ frame_width = frame->width; ++ if (frame_top < 0) ++ frame_top = 0; ++ if (frame_height > frame->height) ++ frame_height = frame->height; ++ ++ if (this->vdr_stream ++ && frame_width != 0 ++ && frame_height != 0 ++ && (this->old_frame_left != frame_left ++ || this->old_frame_top != frame_top ++ || this->old_frame_width != frame_width ++ || this->old_frame_height != frame_height ++ || this->old_frame_ratio != frame_ratio)) ++ { ++ xine_event_t event; ++ vdr_frame_size_changed_data_t event_data; ++ ++ event_data.x = frame_left; ++ event_data.y = frame_top; ++ event_data.w = frame_width; ++ event_data.h = frame_height; ++ event_data.r = frame_ratio; ++ ++ xprintf(this->vdr_stream->xine, XINE_VERBOSITY_LOG, ++ _(LOG_MODULE ": osd: (%d, %d)-(%d, %d)@%lg\n"), frame_left, frame_top, frame_width, frame_height, frame_ratio); ++ ++ event.type = XINE_EVENT_VDR_FRAMESIZECHANGED; ++ event.data = &event_data; ++ event.data_length = sizeof (event_data); ++ ++ xine_event_send(this->vdr_stream, &event); ++ ++ this->old_frame_left = frame_left; ++ this->old_frame_top = frame_top; ++ this->old_frame_width = frame_width; ++ this->old_frame_height = frame_height; ++ this->old_frame_ratio = frame_ratio; ++ } ++ } ++/* ++ fprintf(stderr, "~~~~~~~~~~~~ trickspeedmode: %d\n", this->trick_speed_mode); ++ ++ if (this->vdr_stream ++ && this->trick_speed_mode) ++ { ++ frame->pts = 0; ++ frame->next->pts = 0; ++ } ++*/ ++#if defined(LOG) && defined(LOG_VERBOSE) ++ { ++ int a = 0, b = 0, c = 0, d = 0; ++ if (stream) ++ _x_query_buffer_usage(stream, &a, &b, &c, &d); ++ lprintf("buffer usage: %3d, %2d, %2d, %2d, %p\n", a, b, c, d, stream); ++ } ++#endif ++ ++ if (!this->enabled ++ || frame->bad_frame ++ || (frame->format != XINE_IMGFMT_YUY2 ++ && frame->format != XINE_IMGFMT_YV12) ++ || frame->proc_frame ++ || frame->proc_slice) ++ { ++ _x_post_frame_copy_down(frame, frame->next); ++ skip = frame->next->draw(frame->next, stream); ++ _x_post_frame_copy_up(frame, frame->next); ++ return skip; ++ } ++ ++ vdr_frame = port->original_port->get_frame(port->original_port, ++ frame->width, frame->height, frame->ratio, frame->format, frame->flags | VO_BOTH_FIELDS); ++ ++ _x_post_frame_copy_down(frame, vdr_frame); ++ ++ switch (vdr_frame->format) ++ { ++ case XINE_IMGFMT_YUY2: ++ vdr_video_scale_YUY2(this, frame, vdr_frame); ++ break; ++ ++ case XINE_IMGFMT_YV12: ++ vdr_video_scale_YV12(this, frame, vdr_frame); ++ break; ++ } ++ ++ skip = vdr_frame->draw(vdr_frame, stream); ++ _x_post_frame_copy_up(frame, vdr_frame); ++ vdr_frame->free(vdr_frame); ++ ++ return skip; ++} +diff --git a/src/vdr/vdr.h b/src/vdr/vdr.h +new file mode 100644 +--- /dev/null ++++ b/src/vdr/vdr.h +@@ -0,0 +1,665 @@ ++/* ++ * Copyright (C) 2000-2004 the xine project ++ * ++ * This file is part of xine, a free video player. ++ * ++ * xine is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * xine is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA ++ */ ++ ++#ifndef __VDR_H ++#define __VDR_H ++ ++ ++#define XINE_VDR_VERSION 901 ++ ++ ++enum funcs ++{ ++ func_unknown = -1 ++ , func_nop ++ , func_osd_new ++ , func_osd_free ++ , func_osd_show ++ , func_osd_hide ++ , func_osd_set_position ++ , func_osd_draw_bitmap ++ , func_set_color ++ , func_clear ++ , func_mute ++ , func_set_volume ++ , func_set_speed ++ , func_set_prebuffer ++ , func_metronom ++ , func_start ++ , func_wait ++ , func_setup ++ , func_grab_image ++ , func_get_pts ++ , func_flush ++ , func_first_frame ++ , func_still_frame ++ , func_video_size ++ , func_set_video_window ++ , func_osd_flush ++ , func_play_external ++ , func_key ++ , func_frame_size ++ , func_reset_audio ++ , func_select_audio ++ , func_trick_speed_mode ++ , func_get_version ++ , func_discontinuity ++ , func_query_capabilities ++}; ++ ++enum keys ++{ ++ key_none, ++ key_up, ++ key_down, ++ key_menu, ++ key_ok, ++ key_back, ++ key_left, ++ key_right, ++ key_red, ++ key_green, ++ key_yellow, ++ key_blue, ++ key_0, ++ key_1, ++ key_2, ++ key_3, ++ key_4, ++ key_5, ++ key_6, ++ key_7, ++ key_8, ++ key_9, ++ key_play, ++ key_pause, ++ key_stop, ++ key_record, ++ key_fast_fwd, ++ key_fast_rew, ++ key_power, ++ key_channel_plus, ++ key_channel_minus, ++ key_volume_plus, ++ key_volume_minus, ++ key_mute, ++ key_schedule, ++ key_channels, ++ key_timers, ++ key_recordings, ++ key_setup, ++ key_commands, ++ key_user1, ++ key_user2, ++ key_user3, ++ key_user4, ++ key_user5, ++ key_user6, ++ key_user7, ++ key_user8, ++ key_user9, ++ key_audio, ++ key_info, ++ key_channel_previous, ++ key_next, ++ key_previous, ++ key_subtitles, ++}; ++ ++ ++ ++typedef struct __attribute__((packed)) data_header_s ++{ ++ uint32_t func:8; ++ uint32_t len:24; ++} ++data_header_t; ++ ++ ++ ++typedef data_header_t result_header_t; ++typedef data_header_t event_header_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_nop_s ++{ ++ data_header_t header; ++} ++data_nop_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_osd_new_s ++{ ++ data_header_t header; ++ ++ uint8_t window; ++ int16_t x; ++ int16_t y; ++ uint16_t width; ++ uint16_t height; ++ uint16_t w_ref; ++ uint16_t h_ref; ++} ++data_osd_new_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_osd_free_s ++{ ++ data_header_t header; ++ ++ uint8_t window; ++} ++data_osd_free_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_osd_show_s ++{ ++ data_header_t header; ++ ++ uint8_t window; ++} ++data_osd_show_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_osd_hide_s ++{ ++ data_header_t header; ++ ++ uint8_t window; ++} ++data_osd_hide_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_osd_flush_s ++{ ++ data_header_t header; ++} ++data_osd_flush_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_play_external_s ++{ ++ data_header_t header; ++} ++data_play_external_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_osd_set_position_s ++{ ++ data_header_t header; ++ ++ uint8_t window; ++ int16_t x; ++ int16_t y; ++} ++data_osd_set_position_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_osd_draw_bitmap_s ++{ ++ data_header_t header; ++ ++ uint8_t window; ++ int16_t x; ++ int16_t y; ++ uint16_t width; ++ uint16_t height; ++ uint8_t argb; ++} ++data_osd_draw_bitmap_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_set_color_s ++{ ++ data_header_t header; ++ ++ uint8_t window; ++ uint8_t index; ++ uint8_t num; ++} ++data_set_color_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_flush_s ++{ ++ data_header_t header; ++ ++ int32_t ms_timeout; ++ uint8_t just_wait; ++} ++data_flush_t; ++ ++ ++ ++typedef struct __attribute__((packed)) result_flush_s ++{ ++ result_header_t header; ++ ++ uint8_t timed_out; ++} ++result_flush_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_clear_s ++{ ++ data_header_t header; ++ ++ int32_t n; ++ int8_t s; ++ uint8_t i; ++} ++data_clear_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_mute_s ++{ ++ data_header_t header; ++ ++ uint8_t mute; ++} ++data_mute_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_set_volume_s ++{ ++ data_header_t header; ++ ++ uint8_t volume; ++} ++data_set_volume_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_set_speed_s ++{ ++ data_header_t header; ++ ++ int32_t speed; ++} ++data_set_speed_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_set_prebuffer_s ++{ ++ data_header_t header; ++ ++ uint32_t prebuffer; ++} ++data_set_prebuffer_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_metronom_s ++{ ++ data_header_t header; ++ ++ int64_t pts; ++ uint32_t flags; ++} ++data_metronom_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_start_s ++{ ++ data_header_t header; ++} ++data_start_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_wait_s ++{ ++ data_header_t header; ++ uint8_t id; ++} ++data_wait_t; ++ ++ ++ ++typedef struct __attribute__((packed)) result_wait_s ++{ ++ result_header_t header; ++} ++result_wait_t; ++ ++ ++ ++#define XINE_VDR_VOLUME_IGNORE 0 ++#define XINE_VDR_VOLUME_CHANGE_HW 1 ++#define XINE_VDR_VOLUME_CHANGE_SW 2 ++ ++#define XINE_VDR_MUTE_IGNORE 0 ++#define XINE_VDR_MUTE_EXECUTE 1 ++#define XINE_VDR_MUTE_SIMULATE 2 ++ ++typedef struct __attribute__((packed)) data_setup_s ++{ ++ data_header_t header; ++ ++ uint8_t osd_unscaled_blending; ++ uint8_t volume_mode; ++ uint8_t mute_mode; ++ uint16_t image4_3_zoom_x; ++ uint16_t image4_3_zoom_y; ++ uint16_t image16_9_zoom_x; ++ uint16_t image16_9_zoom_y; ++} ++data_setup_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_first_frame_s ++{ ++ data_header_t header; ++} ++data_first_frame_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_still_frame_s ++{ ++ data_header_t header; ++} ++data_still_frame_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_set_video_window_s ++{ ++ data_header_t header; ++ ++ uint32_t x; ++ uint32_t y; ++ uint32_t w; ++ uint32_t h; ++ uint32_t w_ref; ++ uint32_t h_ref; ++} ++data_set_video_window_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_grab_image_s ++{ ++ data_header_t header; ++} ++data_grab_image_t; ++ ++ ++ ++typedef struct __attribute__((packed)) result_grab_image_s ++{ ++ result_header_t header; ++ ++ int32_t width; ++ int32_t height; ++ int32_t ratio; ++ int32_t format; ++ int32_t interlaced; ++ int32_t crop_left; ++ int32_t crop_right; ++ int32_t crop_top; ++ int32_t crop_bottom; ++} ++result_grab_image_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_get_pts_s ++{ ++ data_header_t header; ++ int32_t ms_timeout; ++} ++data_get_pts_t; ++ ++ ++ ++typedef struct __attribute__((packed)) result_get_pts_s ++{ ++ result_header_t header; ++ ++ int64_t pts; ++ int8_t queued; ++} ++result_get_pts_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_get_version_s ++{ ++ data_header_t header; ++} ++data_get_version_t; ++ ++ ++ ++typedef struct __attribute__((packed)) result_get_version_s ++{ ++ result_header_t header; ++ ++ int32_t version; ++} ++result_get_version_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_video_size_s ++{ ++ data_header_t header; ++} ++data_video_size_t; ++ ++ ++ ++typedef struct __attribute__((packed)) result_video_size_s ++{ ++ result_header_t header; ++ ++ int32_t left; ++ int32_t top; ++ int32_t width; ++ int32_t height; ++ int32_t ratio; ++ int32_t zoom_x; ++ int32_t zoom_y; ++} ++result_video_size_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_reset_audio_s ++{ ++ data_header_t header; ++} ++data_reset_audio_t; ++ ++ ++ ++typedef struct __attribute__((packed)) event_key_s ++{ ++ event_header_t header; ++ ++ uint32_t key; ++} ++event_key_t; ++ ++ ++ ++typedef struct __attribute__((packed)) event_frame_size_s ++{ ++ event_header_t header; ++ ++ int32_t left; ++ int32_t top; ++ int32_t width; ++ int32_t height; ++ int32_t zoom_x; ++ int32_t zoom_y; ++} ++event_frame_size_t; ++ ++ ++ ++typedef struct __attribute__((packed)) event_play_external_s ++{ ++ event_header_t header; ++ ++ uint32_t key; ++} ++event_play_external_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_select_audio_s ++{ ++ data_header_t header; ++ ++ uint8_t channels; ++} ++data_select_audio_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_trick_speed_mode_s ++{ ++ data_header_t header; ++ ++ uint8_t on; ++} ++data_trick_speed_mode_t; ++ ++ ++ ++typedef struct __attribute__((packed)) event_discontinuity_s ++{ ++ event_header_t header; ++ ++ int32_t type; ++} ++event_discontinuity_t; ++ ++ ++ ++typedef struct __attribute__((packed)) data_query_capabilities_s ++{ ++ data_header_t header; ++} ++data_query_capabilities_t; ++ ++ ++ ++typedef struct __attribute__((packed)) result_query_capabilities_s ++{ ++ result_header_t header; ++ ++ uint8_t osd_max_num_windows; ++ uint8_t osd_palette_max_depth; ++ uint8_t osd_palette_is_shared; ++ uint8_t osd_supports_argb_layer; ++ uint8_t osd_supports_custom_extent; ++} ++result_query_capabilities_t; ++ ++ ++ ++typedef union __attribute__((packed)) data_union_u ++{ ++ data_header_t header; ++ data_nop_t nop; ++ data_osd_new_t osd_new; ++ data_osd_free_t osd_free; ++ data_osd_show_t osd_show; ++ data_osd_hide_t osd_hide; ++ data_osd_set_position_t osd_set_position; ++ data_osd_draw_bitmap_t osd_draw_bitmap; ++ data_set_color_t set_color; ++ data_flush_t flush; ++ data_clear_t clear; ++ data_mute_t mute; ++ data_set_volume_t set_volume; ++ data_set_speed_t set_speed; ++ data_set_prebuffer_t set_prebuffer; ++ data_metronom_t metronom; ++ data_start_t start; ++ data_wait_t wait; ++ data_setup_t setup; ++ data_grab_image_t grab_image; ++ data_get_pts_t get_pts; ++ data_first_frame_t first_frame; ++ data_still_frame_t still_frame; ++ data_video_size_t video_size; ++ data_set_video_window_t set_video_window; ++ data_osd_flush_t osd_flush; ++ data_play_external_t play_external; ++ data_reset_audio_t reset_audio; ++ data_select_audio_t select_audio; ++ data_trick_speed_mode_t trick_speed_mode; ++ data_get_version_t get_version; ++ data_query_capabilities_t query_capabilities; ++} ++data_union_t; ++ ++ ++ ++typedef union __attribute__((packed)) result_union_u ++{ ++ result_header_t header; ++ result_grab_image_t grab_image; ++ result_get_pts_t get_pts; ++ result_flush_t flush; ++ result_video_size_t video_size; ++ result_get_version_t get_version; ++ result_wait_t wait; ++ result_query_capabilities_t query_capabilities; ++} ++result_union_t; ++ ++ ++ ++typedef union __attribute__((packed)) event_union_u ++{ ++ event_header_t header; ++ event_key_t key; ++ event_frame_size_t frame_size; ++ event_play_external_t play_external; ++ event_discontinuity_t discontinuity; ++} ++event_union_t; ++ ++ ++ ++#endif /* __VDR_H */ ++ +diff --git a/src/video_out/video_out_xvmc.c b/src/video_out/video_out_xvmc.c +--- a/src/video_out/video_out_xvmc.c ++++ b/src/video_out/video_out_xvmc.c +@@ -486,9 +486,9 @@ static void xvmc_render_macro_blocks(vo_ + int second_field, + xvmc_macroblocks_t *macroblocks) { + xvmc_driver_t *this = (xvmc_driver_t *) current_image->driver; +- xvmc_frame_t *current_frame = (xvmc_frame_t *) current_image; +- xvmc_frame_t *forward_frame = (xvmc_frame_t *) forward_ref_image; +- xvmc_frame_t *backward_frame = (xvmc_frame_t *) backward_ref_image; ++ xvmc_frame_t *current_frame = XVMC_FRAME(current_image); ++ xvmc_frame_t *forward_frame = XVMC_FRAME(forward_ref_image); ++ xvmc_frame_t *backward_frame = XVMC_FRAME(backward_ref_image); + int flags; + + lprintf ("xvmc_render_macro_blocks\n"); +@@ -561,6 +561,7 @@ static vo_frame_t *xvmc_alloc_frame (vo_ + return NULL; + + frame->vo_frame.accel_data = &frame->xvmc_data; ++ frame->xvmc_data.vo_frame = &frame->vo_frame; + + /* keep track of frames and how many frames alocated. */ + this->frames[this->num_frame_buffers++] = frame; +diff --git a/src/video_out/video_out_xxmc.c b/src/video_out/video_out_xxmc.c +--- a/src/video_out/video_out_xxmc.c ++++ b/src/video_out/video_out_xxmc.c +@@ -365,15 +365,15 @@ static int xxmc_lock_and_validate_surfac + + switch(pc_type) { + case XINE_PICT_B_TYPE: +- frame = (xxmc_frame_t *) bw_frame; ++ frame = XXMC_FRAME(bw_frame); + if (!xxmc_xvmc_surface_valid( driver, frame->xvmc_surf)) break; + /* fall through */ + case XINE_PICT_P_TYPE: +- frame = (xxmc_frame_t *) fw_frame; ++ frame = XXMC_FRAME(fw_frame); + if (!xxmc_xvmc_surface_valid( driver, frame->xvmc_surf)) break; + /* fall through */ + default: +- frame = (xxmc_frame_t *) cur_frame; ++ frame = XXMC_FRAME(cur_frame); + if (!xxmc_xvmc_surface_valid( driver, frame->xvmc_surf)) break; + return 0; + } +@@ -404,7 +404,7 @@ static void xvmc_flush(vo_frame_t *this_ + { + + xxmc_frame_t +- *frame = (xxmc_frame_t *) this_gen; ++ *frame = XXMC_FRAME(this_gen); + xxmc_driver_t + *driver = (xxmc_driver_t *) this_gen->driver; + +@@ -452,6 +452,7 @@ static void xxmc_duplicate_frame_data(vo + return; + } + this->xxmc_data = *xxmc; ++ this->xxmc_data.xvmc.vo_frame = &this->vo_frame; + this->width = original->width; + this->height = original->height; + this->format = original->format; +@@ -566,6 +567,7 @@ static vo_frame_t *xxmc_alloc_frame (vo_ + frame->vo_frame.driver = this_gen; + frame->last_sw_format = 0; + frame->vo_frame.accel_data = &frame->xxmc_data; ++ frame->xxmc_data.xvmc.vo_frame = &frame->vo_frame; + frame->image = NULL; + + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "Allocating frame\n"); +@@ -1213,10 +1215,17 @@ static void xxmc_do_update_frame(vo_driv + double ratio, int format, int flags) { + + xxmc_driver_t *this = (xxmc_driver_t *) this_gen; +- xxmc_frame_t *frame = (xxmc_frame_t *) frame_gen; ++ xxmc_frame_t *frame = XXMC_FRAME(frame_gen); + + if ( XINE_IMGFMT_XXMC == format ) { + xine_xxmc_t *xxmc = &frame->xxmc_data; ++ vo_frame_t orig_frame_content; ++ ++ if (frame_gen != &frame->vo_frame) { ++ /* this is an intercepted frame, so we need to detect and propagate any ++ * changes on the original vo_frame to all the intercepted frames */ ++ xine_fast_memcpy(&orig_frame_content, &frame->vo_frame, sizeof (vo_frame_t)); ++ } + + xvmc_context_writer_lock( &this->xvmc_lock); + if (xxmc_accel_update(this, this->last_accel_request, xxmc->acceleration) || +@@ -1232,7 +1241,7 @@ static void xxmc_do_update_frame(vo_driv + if (this->contextActive) + xxmc_frame_updates(this, frame, 1); + +- xxmc_do_update_frame_xv(this_gen, frame_gen, width, height, ratio, ++ xxmc_do_update_frame_xv(this_gen, &frame->vo_frame, width, height, ratio, + xxmc->fallback_format, flags); + + if (!this->contextActive) { +@@ -1246,6 +1255,33 @@ static void xxmc_do_update_frame(vo_driv + + xvmc_context_writer_unlock( &this->xvmc_lock); + ++ if (frame_gen != &frame->vo_frame) { ++ /* this is an intercepted frame, so we need to detect and propagate any ++ * changes on the original vo_frame to all the intercepted frames */ ++ unsigned char *p0 = (unsigned char *)&orig_frame_content; ++ unsigned char *p1 = (unsigned char *)&frame->vo_frame; ++ int i; ++ for (i = 0; i < sizeof (vo_frame_t); i++) { ++ if (*p0 != *p1) { ++ /* propagate the change */ ++ vo_frame_t *f = frame_gen; ++ while (f->next) { ++ /* serveral restrictions apply when intercepting XXMC frames. So let's check ++ * the intercepted frames before modifing them and fail otherwise. */ ++ unsigned char *p = (unsigned char *)f + i; ++ if (*p != *p0) { ++ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "xxmc_do_update_frame: a post plugin violates the restrictions on intercepting XXMC frames\n"); ++ _x_abort(); ++ } ++ ++ *p = *p1; ++ f = f->next; ++ } ++ } ++ p0++; ++ p1++; ++ } ++ } + } else { + /* switch back to an unaccelerated context */ + if (this->last_accel_request != 0xFFFFFFFF) { +@@ -1253,7 +1289,7 @@ static void xxmc_do_update_frame(vo_driv + xxmc_xvmc_update_context(this, frame, width, height, 0); + } + frame->vo_frame.proc_duplicate_frame_data = NULL; +- xxmc_do_update_frame_xv(this_gen, frame_gen, width, height, ratio, ++ xxmc_do_update_frame_xv(this_gen, &frame->vo_frame, width, height, ratio, + format, flags); + } + } +diff --git a/src/video_out/xvmc_mocomp.c b/src/video_out/xvmc_mocomp.c +--- a/src/video_out/xvmc_mocomp.c ++++ b/src/video_out/xvmc_mocomp.c +@@ -70,9 +70,9 @@ static void xvmc_render_macro_blocks(vo_ + int second_field, + xvmc_macroblocks_t *macroblocks) { + xxmc_driver_t *this = (xxmc_driver_t *) current_image->driver; +- xxmc_frame_t *current_frame = (xxmc_frame_t *) current_image; +- xxmc_frame_t *forward_frame = (xxmc_frame_t *) forward_ref_image; +- xxmc_frame_t *backward_frame = (xxmc_frame_t *) backward_ref_image; ++ xxmc_frame_t *current_frame = XXMC_FRAME(current_image); ++ xxmc_frame_t *forward_frame = XXMC_FRAME(forward_ref_image); ++ xxmc_frame_t *backward_frame = XXMC_FRAME(backward_ref_image); + int flags; + + lprintf ("xvmc_render_macro_blocks\n"); +diff --git a/src/video_out/xvmc_vld.c b/src/video_out/xvmc_vld.c +--- a/src/video_out/xvmc_vld.c ++++ b/src/video_out/xvmc_vld.c +@@ -32,12 +32,12 @@ void xvmc_vld_frame(struct vo_frame_s *t + { + vo_frame_t *this = (vo_frame_t *) this_gen; + xxmc_frame_t +- *cf = (xxmc_frame_t *) this; ++ *cf = XXMC_FRAME(this); + xine_vld_frame_t + *vft = &(cf->xxmc_data.vld_frame); + xxmc_frame_t +- *ff = (xxmc_frame_t *) vft->forward_reference_frame, +- *bf = (xxmc_frame_t *) vft->backward_reference_frame; ++ *ff = XXMC_FRAME(vft->forward_reference_frame), ++ *bf = XXMC_FRAME(vft->backward_reference_frame); + XvMCMpegControl ctl; + xxmc_driver_t + *driver = (xxmc_driver_t *) cf->vo_frame.driver; +@@ -104,7 +104,7 @@ void xvmc_vld_slice(vo_frame_t *this_gen + void xvmc_vld_slice(vo_frame_t *this_gen) + { + xxmc_frame_t +- *cf = (xxmc_frame_t *) this_gen; ++ *cf = XXMC_FRAME(this_gen); + xxmc_driver_t + *driver = (xxmc_driver_t *) cf->vo_frame.driver; + +diff --git a/src/xine-engine/accel_xvmc.h b/src/xine-engine/accel_xvmc.h +--- a/src/xine-engine/accel_xvmc.h ++++ b/src/xine-engine/accel_xvmc.h +@@ -65,6 +65,7 @@ typedef struct xine_vld_frame_s { + + + typedef struct xine_xvmc_s { ++ vo_frame_t *vo_frame; + xine_macroblocks_t *macroblocks; + void (*proc_macro_block)(int x,int y,int mb_type, + int motion_type,int (*mv_field_sel)[2], +@@ -73,6 +74,9 @@ typedef struct xine_xvmc_s { + vo_frame_t *backward_ref_frame,int picture_structure, + int second_field,int (*f_mot_pmv)[2],int (*b_mot_pmv)[2]); + } xine_xvmc_t ; ++ ++#define XVMC_DATA(frame_gen) ((frame_gen) ? (xine_xvmc_t *)(frame_gen)->accel_data : (xine_xvmc_t *)0) ++#define XVMC_FRAME(frame_gen) ((frame_gen) ? (xvmc_frame_t *)XVMC_DATA(frame_gen)->vo_frame : (xvmc_frame_t *)0) + + typedef struct xine_xxmc_s { + +@@ -108,6 +112,9 @@ typedef struct xine_xxmc_s { + void (*proc_xxmc_unlock) (vo_driver_t *this_gen); + } xine_xxmc_t; + ++#define XXMC_DATA(frame_gen) ((frame_gen) ? (xine_xxmc_t *)(frame_gen)->accel_data : (xine_xxmc_t *)0) ++#define XXMC_FRAME(frame_gen) ((frame_gen) ? (xxmc_frame_t *)XXMC_DATA(frame_gen)->xvmc.vo_frame : (xxmc_frame_t *)0) ++ + /* + * Register XvMC stream types here. + */ +diff --git a/src/xine-engine/post.c b/src/xine-engine/post.c +--- a/src/xine-engine/post.c ++++ b/src/xine-engine/post.c +@@ -144,6 +144,14 @@ static void post_video_flush(xine_video_ + if (port->port_lock) pthread_mutex_unlock(port->port_lock); + } + ++static void post_video_trigger_drawing(xine_video_port_t *port_gen) { ++ post_video_port_t *port = (post_video_port_t *)port_gen; ++ ++ if (port->port_lock) pthread_mutex_lock(port->port_lock); ++ port->original_port->trigger_drawing(port->original_port); ++ if (port->port_lock) pthread_mutex_unlock(port->port_lock); ++} ++ + static int post_video_status(xine_video_port_t *port_gen, xine_stream_t *stream, + int *width, int *height, int64_t *img_duration) { + post_video_port_t *port = (post_video_port_t *)port_gen; +@@ -187,6 +195,7 @@ static int post_video_rewire(xine_post_o + if (!new_port) + return 0; + ++ this->running_ticket->lock_port_rewiring(this->running_ticket, -1); + this->running_ticket->revoke(this->running_ticket, 1); + + if (input_port->original_port->status(input_port->original_port, input_port->stream, +@@ -197,6 +206,7 @@ static int post_video_rewire(xine_post_o + input_port->original_port = new_port; + + this->running_ticket->issue(this->running_ticket, 1); ++ this->running_ticket->unlock_port_rewiring(this->running_ticket); + + return 1; + } +@@ -218,6 +228,7 @@ post_video_port_t *_x_post_intercept_vid + port->new_port.exit = post_video_exit; + port->new_port.get_overlay_manager = post_video_get_overlay_manager; + port->new_port.flush = post_video_flush; ++ port->new_port.trigger_drawing = post_video_trigger_drawing; + port->new_port.status = post_video_status; + port->new_port.get_property = post_video_get_property; + port->new_port.set_property = post_video_set_property; +@@ -377,10 +388,11 @@ vo_frame_t *_x_post_intercept_video_fram + port->new_frame->free ? port->new_frame->free : post_frame_free; + new_frame->dispose = + port->new_frame->dispose ? port->new_frame->dispose : post_frame_dispose; +- +- if (!port->new_frame->draw) { ++ ++ if (!port->new_frame->draw || (port->route_preprocessing_procs && port->route_preprocessing_procs(port, frame))) { + /* draw will most likely modify the frame, so the decoder +- * should only request preprocessing when there is no new draw */ ++ * should only request preprocessing when there is no new draw ++ * but route_preprocessing_procs() can override this decision */ + if (frame->proc_frame && !new_frame->proc_frame) + new_frame->proc_frame = post_frame_proc_frame; + if (frame->proc_slice && !new_frame->proc_slice) +@@ -697,6 +709,7 @@ static int post_audio_rewire(xine_post_o + if (!new_port) + return 0; + ++ this->running_ticket->lock_port_rewiring(this->running_ticket, -1); + this->running_ticket->revoke(this->running_ticket, 1); + + if (input_port->original_port->status(input_port->original_port, input_port->stream, +@@ -707,6 +720,7 @@ static int post_audio_rewire(xine_post_o + input_port->original_port = new_port; + + this->running_ticket->issue(this->running_ticket, 1); ++ this->running_ticket->unlock_port_rewiring(this->running_ticket); + + return 1; + } +diff --git a/src/xine-engine/post.h b/src/xine-engine/post.h +--- a/src/xine-engine/post.h ++++ b/src/xine-engine/post.h +@@ -177,6 +177,13 @@ struct post_video_port_s { + /* the new frame function pointers */ + vo_frame_t *new_frame; + ++ /* if you want to decide yourself, whether the preprocessing functions ++ * should still be routed when draw is intercepted, fill in this ++ * function; _x_post_intercept_video_frame() acts as a template method ++ * and asks your function; return a boolean; the default is _not_ to ++ * route preprocessing functions when draw is intercepted */ ++ int (*route_preprocessing_procs)(post_video_port_t *self, vo_frame_t *frame); ++ + /* if you want to decide yourself, whether the overlay manager should + * be intercepted, fill in this function; get_overlay_manager() acts as + * a template method and asks your function; return a boolean; +diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c +--- a/src/xine-engine/video_out.c ++++ b/src/xine-engine/video_out.c +@@ -132,6 +132,9 @@ typedef struct { + int frame_drop_cpt; + int frame_drop_suggested; + int crop_left, crop_right, crop_top, crop_bottom; ++ pthread_mutex_t trigger_drawing_mutex; ++ pthread_cond_t trigger_drawing_cond; ++ int trigger_drawing; + } vos_t; + + +@@ -1068,6 +1071,32 @@ static void check_redraw_needed (vos_t * + this->redraw_needed = 1; + } + ++static int interruptable_sleep(vos_t *this, int usec_to_sleep) ++{ ++ int timedout = 0; ++ ++ struct timeval now; ++ gettimeofday(&now, 0); ++ ++ pthread_mutex_lock (&this->trigger_drawing_mutex); ++ if (!this->trigger_drawing) { ++ struct timespec abstime; ++ abstime.tv_sec = now.tv_sec + usec_to_sleep / 1000000; ++ abstime.tv_nsec = now.tv_usec * 1000 + (usec_to_sleep % 1000000) * 1000; ++ ++ if (abstime.tv_nsec > 1000000000) { ++ abstime.tv_nsec -= 1000000000; ++ abstime.tv_sec++; ++ } ++ ++ timedout = pthread_cond_timedwait(&this->trigger_drawing_cond, &this->trigger_drawing_mutex, &abstime); ++ } ++ this->trigger_drawing = 0; ++ pthread_mutex_unlock (&this->trigger_drawing_mutex); ++ ++ return timedout; ++} ++ + /* special loop for paused mode + * needed to update screen due overlay changes, resize, window + * movement, brightness adjusting etc. +@@ -1113,7 +1142,7 @@ static void paused_loop( vos_t *this, in + } + + pthread_mutex_unlock( &this->free_img_buf_queue->mutex ); +- xine_usec_sleep (20000); ++ interruptable_sleep(this, 20000); + pthread_mutex_lock( &this->free_img_buf_queue->mutex ); + } + +@@ -1243,7 +1272,10 @@ static void *video_out_loop (void *this_ + "video_out: vpts/clock error, next_vpts=%" PRId64 " cur_vpts=%" PRId64 "\n", next_frame_vpts,vpts); + + if (usec_to_sleep > 0) +- xine_usec_sleep (usec_to_sleep); ++ { ++ if (0 == interruptable_sleep(this, usec_to_sleep)) ++ break; ++ } + + if (this->discard_frames) + break; +@@ -1626,6 +1658,9 @@ static void vo_exit (xine_video_port_t * + free (this->free_img_buf_queue); + free (this->display_img_buf_queue); + ++ pthread_cond_destroy(&this->trigger_drawing_cond); ++ pthread_mutex_destroy(&this->trigger_drawing_mutex); ++ + free (this); + } + +@@ -1693,6 +1728,15 @@ static void vo_flush (xine_video_port_t + this->discard_frames--; + pthread_mutex_unlock(&this->display_img_buf_queue->mutex); + } ++} ++ ++static void vo_trigger_drawing (xine_video_port_t *this_gen) { ++ vos_t *this = (vos_t *) this_gen; ++ ++ pthread_mutex_lock (&this->trigger_drawing_mutex); ++ this->trigger_drawing = 1; ++ pthread_cond_signal (&this->trigger_drawing_cond); ++ pthread_mutex_unlock (&this->trigger_drawing_mutex); + } + + /* crop_frame() will allocate a new frame to copy in the given image +@@ -1790,6 +1834,7 @@ xine_video_port_t *_x_vo_new_port (xine_ + this->vo.enable_ovl = vo_enable_overlay; + this->vo.get_overlay_manager = vo_get_overlay_manager; + this->vo.flush = vo_flush; ++ this->vo.trigger_drawing = vo_trigger_drawing; + this->vo.get_property = vo_get_property; + this->vo.set_property = vo_set_property; + this->vo.status = vo_status; +@@ -1883,6 +1928,9 @@ xine_video_port_t *_x_vo_new_port (xine_ + "were not scheduled for display in time, xine sends a notification."), + 20, NULL, NULL); + ++ pthread_mutex_init(&this->trigger_drawing_mutex, NULL); ++ pthread_cond_init(&this->trigger_drawing_cond, NULL); ++ this->trigger_drawing = 0; + + if (grabonly) { + +diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h +--- a/src/xine-engine/video_out.h ++++ b/src/xine-engine/video_out.h +@@ -198,6 +198,9 @@ struct xine_video_port_s { + /* flush video_out fifo */ + void (*flush) (xine_video_port_t *self); + ++ /* trigger immediate drawing */ ++ void (*trigger_drawing) (xine_video_port_t *self); ++ + /* Get/Set video property + * + * See VO_PROP_* bellow +diff --git a/src/xine-engine/video_overlay.h b/src/xine-engine/video_overlay.h +--- a/src/xine-engine/video_overlay.h ++++ b/src/xine-engine/video_overlay.h +@@ -35,7 +35,7 @@ + + #define MAX_OBJECTS 50 + #define MAX_EVENTS 50 +-#define MAX_SHOWING 16 ++#define MAX_SHOWING (5 + 16) + + #define OVERLAY_EVENT_NULL 0 + #define OVERLAY_EVENT_SHOW 1 +diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c +--- a/src/xine-engine/xine.c ++++ b/src/xine-engine/xine.c +@@ -294,8 +294,37 @@ static void ticket_revoke(xine_ticket_t + pthread_mutex_unlock(&this->revoke_lock); + } + ++static int ticket_lock_port_rewiring(xine_ticket_t *this, int ms_timeout) { ++ ++ if (ms_timeout >= 0) { ++ struct timespec abstime; ++ ++ struct timeval now; ++ gettimeofday(&now, 0); ++ ++ abstime.tv_sec = now.tv_sec + ms_timeout / 1000; ++ abstime.tv_nsec = now.tv_usec * 1000 + (ms_timeout % 1000) * 1e6; ++ ++ if (abstime.tv_nsec > 1e9) { ++ abstime.tv_nsec -= 1e9; ++ abstime.tv_sec++; ++ } ++ ++ return (0 == pthread_mutex_timedlock(&this->port_rewiring_lock, &abstime)); ++ } ++ ++ pthread_mutex_lock(&this->port_rewiring_lock); ++ return 1; ++} ++ ++static void ticket_unlock_port_rewiring(xine_ticket_t *this) { ++ ++ pthread_mutex_unlock(&this->port_rewiring_lock); ++} ++ + static void ticket_dispose(xine_ticket_t *this) { + ++ pthread_mutex_destroy(&this->port_rewiring_lock); + pthread_mutex_destroy(&this->lock); + pthread_mutex_destroy(&this->revoke_lock); + pthread_cond_destroy(&this->issued); +@@ -316,12 +345,15 @@ static xine_ticket_t *XINE_MALLOC ticket + port_ticket->renew = ticket_renew; + port_ticket->issue = ticket_issue; + port_ticket->revoke = ticket_revoke; ++ port_ticket->lock_port_rewiring = ticket_lock_port_rewiring; ++ port_ticket->unlock_port_rewiring = ticket_unlock_port_rewiring; + port_ticket->dispose = ticket_dispose; + port_ticket->holder_thread_count = XINE_MAX_TICKET_HOLDER_THREADS; + port_ticket->holder_threads = calloc(XINE_MAX_TICKET_HOLDER_THREADS,sizeof(*port_ticket->holder_threads)); + + pthread_mutex_init(&port_ticket->lock, NULL); + pthread_mutex_init(&port_ticket->revoke_lock, NULL); ++ pthread_mutex_init(&port_ticket->port_rewiring_lock, NULL); + pthread_cond_init(&port_ticket->issued, NULL); + pthread_cond_init(&port_ticket->revoked, NULL); + +@@ -523,6 +555,7 @@ static int stream_rewire_audio(xine_post + if (!data) + return 0; + ++ stream->xine->port_ticket->lock_port_rewiring(stream->xine->port_ticket, -1); + stream->xine->port_ticket->revoke(stream->xine->port_ticket, 1); + + if (stream->audio_out->status(stream->audio_out, stream, &bits, &rate, &mode)) { +@@ -533,6 +566,7 @@ static int stream_rewire_audio(xine_post + stream->audio_out = new_port; + + stream->xine->port_ticket->issue(stream->xine->port_ticket, 1); ++ stream->xine->port_ticket->unlock_port_rewiring(stream->xine->port_ticket); + + return 1; + } +@@ -547,6 +581,7 @@ static int stream_rewire_video(xine_post + if (!data) + return 0; + ++ stream->xine->port_ticket->lock_port_rewiring(stream->xine->port_ticket, -1); + stream->xine->port_ticket->revoke(stream->xine->port_ticket, 1); + + if (stream->video_out->status(stream->video_out, stream, &width, &height, &img_duration)) { +@@ -557,6 +592,7 @@ static int stream_rewire_video(xine_post + stream->video_out = new_port; + + stream->xine->port_ticket->issue(stream->xine->port_ticket, 1); ++ stream->xine->port_ticket->unlock_port_rewiring(stream->xine->port_ticket); + + return 1; + } +@@ -2339,3 +2375,83 @@ int _x_query_buffer_usage(xine_stream_t + + return ticket_acquired != 0; + } ++ ++int _x_lock_port_rewiring(xine_t *xine, int ms_timeout) ++{ ++ return xine->port_ticket->lock_port_rewiring(xine->port_ticket, ms_timeout); ++} ++ ++void _x_unlock_port_rewiring(xine_t *xine) ++{ ++ xine->port_ticket->unlock_port_rewiring(xine->port_ticket); ++} ++ ++int _x_lock_frontend(xine_stream_t *stream, int ms_to_time_out) ++{ ++ if (ms_to_time_out >= 0) { ++ struct timespec abstime; ++ ++ struct timeval now; ++ gettimeofday(&now, 0); ++ ++ abstime.tv_sec = now.tv_sec + ms_to_time_out / 1000; ++ abstime.tv_nsec = now.tv_usec * 1000 + (ms_to_time_out % 1000) * 1e6; ++ ++ if (abstime.tv_nsec > 1e9) { ++ abstime.tv_nsec -= 1e9; ++ abstime.tv_sec++; ++ } ++ ++ return (0 == pthread_mutex_timedlock(&stream->frontend_lock, &abstime)); ++ } ++ ++ pthread_mutex_lock(&stream->frontend_lock); ++ return 1; ++} ++ ++void _x_unlock_frontend(xine_stream_t *stream) ++{ ++ pthread_mutex_unlock(&stream->frontend_lock); ++} ++ ++int _x_query_unprocessed_osd_events(xine_stream_t *stream) ++{ ++ video_overlay_manager_t *ovl; ++ int redraw_needed; ++ ++ if (!stream->xine->port_ticket->acquire_nonblocking(stream->xine->port_ticket, 1)) ++ return -1; ++ ++ ovl = stream->video_out->get_overlay_manager(stream->video_out); ++ redraw_needed = ovl->redraw_needed(ovl, 0); ++ ++ if (redraw_needed) ++ stream->video_out->trigger_drawing(stream->video_out); ++ ++ stream->xine->port_ticket->release_nonblocking(stream->xine->port_ticket, 1); ++ ++ return redraw_needed; ++} ++ ++int _x_demux_seek(xine_stream_t *stream, off_t start_pos, int start_time, int playing) ++{ ++ if (!stream->demux_plugin) ++ return -1; ++ return stream->demux_plugin->seek(stream->demux_plugin, start_pos, start_time, playing); ++} ++ ++int _x_continue_stream_processing(xine_stream_t *stream) ++{ ++ return stream->status != XINE_STATUS_STOP ++ && stream->status != XINE_STATUS_QUIT; ++} ++ ++void _x_trigger_relaxed_frame_drop_mode(xine_stream_t *stream) ++{ ++ stream->first_frame_flag = 2; ++} ++ ++void _x_reset_relaxed_frame_drop_mode(xine_stream_t *stream) ++{ ++ stream->first_frame_flag = 1; ++} +diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h +--- a/src/xine-engine/xine_internal.h ++++ b/src/xine-engine/xine_internal.h +@@ -169,6 +169,9 @@ struct xine_ticket_s { + * be used in combination with acquire_nonblocking() */ + void (*release_nonblocking)(xine_ticket_t *self, int irrevocable); + ++ int (*lock_port_rewiring)(xine_ticket_t *self, int ms_timeout); ++ void (*unlock_port_rewiring)(xine_ticket_t *self); ++ + void (*dispose)(xine_ticket_t *self); + + pthread_mutex_t lock; +@@ -185,6 +188,7 @@ struct xine_ticket_s { + pthread_t holder; + } *holder_threads; + unsigned holder_thread_count; ++ pthread_mutex_t port_rewiring_lock; + #endif + }; + +@@ -375,6 +379,15 @@ struct xine_stream_s { + */ + + int _x_query_buffer_usage(xine_stream_t *stream, int *num_video_buffers, int *num_audio_buffers, int *num_video_frames, int *num_audio_frames) XINE_PROTECTED; ++int _x_lock_port_rewiring(xine_t *xine, int ms_to_time_out) XINE_PROTECTED; ++void _x_unlock_port_rewiring(xine_t *xine) XINE_PROTECTED; ++int _x_lock_frontend(xine_stream_t *stream, int ms_to_time_out) XINE_PROTECTED; ++void _x_unlock_frontend(xine_stream_t *stream) XINE_PROTECTED; ++int _x_query_unprocessed_osd_events(xine_stream_t *stream) XINE_PROTECTED; ++int _x_demux_seek(xine_stream_t *stream, off_t start_pos, int start_time, int playing) XINE_PROTECTED; ++int _x_continue_stream_processing(xine_stream_t *stream) XINE_PROTECTED; ++void _x_trigger_relaxed_frame_drop_mode(xine_stream_t *stream) XINE_PROTECTED; ++void _x_reset_relaxed_frame_drop_mode(xine_stream_t *stream) XINE_PROTECTED; + + void _x_handle_stream_end (xine_stream_t *stream, int non_user) XINE_PROTECTED; + diff --git a/utilities/xine_lib/utilitie.sh b/utilities/xine_lib/utilitie.sh new file mode 100644 index 0000000..c1234e8 --- /dev/null +++ b/utilities/xine_lib/utilitie.sh @@ -0,0 +1,223 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 12.04.2009 + +# xine-lib und xine-ui + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions +DIR=`pwd` + +# xine-lib +WEB="http://home.vrweb.de/~rnissl/xine-lib-cvs-20090412200000.tar.bz2" +VERSION="xine-lib-cvs-20090412200000" +LINK="xine-lib" +PKGVERSION="1.1.cvs200904122-xvdr" + +# hg_clone = xine_lib_vers -1 +case "$xine_lib_vers" in + 2) HG_CLONE=1;; + 3) HG_CLONE=2;; + *) HG_CLONE=0;; +esac + +# zum ueberschreiben von xine_lib_vers +# xine aus dem hg HG_CLONE=1, und mit vdpau-patch HG_CLONE=2 +#HG_CLONE=2 + +# wenn ffmpeg aus dem svn kommt nehmen wir xine aus dem hg +[ "$ffmpeg" = "on" -a "$HG_CLONE" = "0" ] && HG_CLONE=1 + +if [ "$HG_CLONE" != "0" ]; then + VERSION="xine-lib-1.2" + PKGVERSION="1.2.hg`date +%Y%m%d`-xvdr" +fi + +# xine-ui +WEB_UI="http://home.vrweb.de/~rnissl/xine-ui-cvs-20090412200000.tar.bz2" +VERSION_UI="xine-ui-cvs-20090412200000" +LINK_UI="xine-ui" + +# dummys +DUMMY_LIBS="libxine1-bin libxine1-ffmpeg libxine1-x libxine-dev" + +# install +function make_util() { + # pre-install + status=`status_util` + [ "$status" != "0" ] && apt_remove "xine-ui libxine-dev $(apt-cache search "libxine1" | cut -d" " -f1)" + # x264 + if [ "$ffmpeg" = "on" ]; then + if [ "`apt_installed x264`" != "xvdr" ]; then + cd $DIR/../x264 + chmod 744 utilitie-x264.sh + ./utilitie-x264.sh || { + log "WARNING - xine-lib konnte x264 nicht finden" +# return 1 + } + fi + else + apt_install "libx264-dev" + fi + + # xine-lib + if [ "$HG_CLONE" = "0" ]; then + VAR=`basename $WEB` + download_util + extract_util + else + cd $SOURCEDIR + log "Starte download von $VERSION" + hg clone http://hg.debian.org/hg/xine-lib/$VERSION || { + log "ERROR - $VERSION konnte nicht geladen werden" + return 1 + } + # symlink + rm -rf $LINK + ln -vfs $VERSION $LINK + fi + + log "Starte mit $VERSION" + cd $SOURCEDIR/$LINK + + # patches + if [ "$HG_CLONE" = "0" ]; then + # this patch is for the xine-plugin + [ -f $DIR/patches/xine-lib.patch ] && patch -p1 < $DIR/patches/xine-lib.patch + # this patch is for external ffmpeg + [ -f $DIR/patches/xine-lib-ffmpeg.diff ] && patch -p1 < $DIR/patches/xine-lib-ffmpeg.diff + + elif [ "$HG_CLONE" = "2" ]; then + lattest_patch=xine-lib-1.2-vdpau-r247.diff.bz2 + if wget --tries=2 http://www.jusst.de/vdpau/files/xine-lib-1.2/ --directory-prefix="$DIR" && [ -f $DIR/index.html ]; then + lattest_patch=$(grep "xine-lib-1.2-vdpau-.*.diff.bz2" $DIR/index.html | tail -1 | cut -d '=' -f4 | cut -d '"' -f2) + rm -f $DIR/index.html + [ -f $DIR/patches/$lattest_patch ] || wget --tries=2 http://www.jusst.de/vdpau/files/xine-lib-1.2/$lattest_patch --directory-prefix="$DIR/patches" + fi + if [ -f $DIR/patches/$lattest_patch ]; then + if bzcat $DIR/patches/$lattest_patch | patch -p1 --dry-run ; then + bzcat $DIR/patches/$lattest_patch | patch -p1 + PKGVERSION="1.2.hg-vdpau`date +%Y%m%d`-xvdr" + fi + fi + fi + + # ffmpeg + + # make xine-lib + AUTOGEN="" + [ "$ffmpeg" = "on" ] && AUTOGEN="$AUTOGEN --with-external-ffmpeg" + ./autogen.sh --prefix=$PREFIX $AUTOGEN + make && checkinstall --fstrans=no --install=yes --pkgname=libxine1 --pkgversion "$PKGVERSION" --default && TEST=ok + + # test + if [ "$TEST" != "ok" ]; then + log "ERROR - $VERSION konnte nicht erstellt werden" + return 1 + fi + + # save deb file + [ -d "$DIR/packages" ] || mkdir -p $DIR/packages + cp -f libxine*.deb $DIR/packages + + # dummys + cd $DIR/packages + for package in $DUMMY_LIBS; do + echo "Section: misc +Priority: optional +Standards-Version: 3.6.2 + +Package: $package +Version: $PKGVERSION-1 +Maintainer: Musterman <Musterman@musterman.de> +Depends: xine +Provides: xine +Architecture: all +Description: Dummy-$package +" > ./$package + + equivs-build $package + dpkg -i ${package}_${PKGVERSION}-1_all.deb + + done + + ldconfig + + # xine-ui + WEB="$WEB_UI" + VAR=`basename $WEB` + download_util + extract_util + # symlink + cd $SOURCEDIR +# rm -rf $LINK_UI +# ln -vfs $VERSION_UI $LINK_UI + + log "Starte mit $LINK_UI" + cd $SOURCEDIR/$LINK_UI + + # make xine-ui + ./autogen.sh --prefix=$PREFIX --enable-vdr-keys + make && checkinstall --fstrans=no --install=yes --pkgname=xine-ui --pkgversion "0.99.6.cvs20090112-xvdr" --default && TEST=ok + + # test + if [ "$TEST" != "ok" ]; then + log "ERROR - $VERSION_UI konnte nicht erstellt werden" + return 1 + fi + + ldconfig + + # final test + TEST=`which xine` + if [ "$TEST" ]; then + log "SUCCESS - $VERSION_UI erstellt" + else + log "ERROR - $VERSION_UI konnte nicht erstellt werden" + fi +} + +# uninstall +function clean_util() { + # uninstall + for package in $DUMMY_LIBS; do + apt_remove "$package" + done + apt_remove "xine-ui libxine-dev $(apt-cache search "libxine1" | cut -d" " -f1)" + + # remove source + cd $SOURCEDIR + [ -d "$LINK_UI" ] && rm -rf "$LINK_UI" + [ -d "$VERSION_UI" ] && rm -rf "$VERSION_UI" + [ -L "$LINK" ] && rm -rf "$LINK" + [ -d "$VERSION" ] && rm -rf "$VERSION" + + ldconfig +} + +# test +function status_util() { + TEST=`apt_installed libxine1` + if [ "$TEST" = "xvdr" ]; then + [ -d $SOURCEDIR/xine-lib ] && echo "2" && return 0 + echo "1" + elif [ "$TEST" = "debian" ]; then + echo "3" + else + echo "0" + fi +} + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 diff --git a/utilities/y4mscaler/utilitie.sh b/utilities/y4mscaler/utilitie.sh new file mode 100644 index 0000000..3b7724e --- /dev/null +++ b/utilities/y4mscaler/utilitie.sh @@ -0,0 +1,82 @@ +#!/bin/sh + +# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis) +# von Marc Wernecke - www.zulu-entertainment.de +# 23.10.2006 + +# y4mscaler + +source ./../../x-vdr.conf +source ./../../setup.conf +source ./../../functions + +WEB="http://www.mir.com/DMG/Software/y4mscaler-9.0-src.tgz" +VERSION="y4mscaler-9.0" +LINK="y4mscaler" + +VAR=`basename $WEB` +DIR=`pwd` + +# install +function make_util() { + download_util + extract_util + + # setzen des symlinks + cd $SOURCEDIR + rm -f $LINK + ln -vfs $VERSION $LINK + + # y4mscaler + cd $SOURCEDIR/$LINK + make + cp -f ./y4mscaler /usr/bin + + ldconfig + + # test + TEST=`which y4mscaler` + if [ "$TEST" ]; then + log "SUCCESS - $VERSION erstellt" + else + log "ERROR - $VERSION konnte nicht erstellt werden" + fi +} + +# uninstall +function clean_util() { + # remove bin + bin=`which y4mscaler` + rm -f $bin + + # remove source + cd $SOURCEDIR + rm -rf $LINK + rm -rf $VERSION + + ldconfig +} + +# test +function status_util() { + TEST=`which y4mscaler` + if [ "$TEST" ]; then + [ -d $SOURCEDIR/$LINK ] && echo "2" && return 0 + echo "1" + else + echo "0" + fi +} + +# start + +# plugin commands +if [ $# \> 0 ]; then + cmd=$1 + cmd_util +else + make_util + status_util +fi + +exit 0 |
