This is a "plugin" for the Video Disk Recorder (VDR).

Written by:		Dominic Morris <dom@suborbital.org.uk> (Original Author),
                        Andreas Schäfers <Andreas_Schaefers@gmx.de>,
                        Martin Dauskardt <directorskinner@arcor.de> ("Dr. Seltsam")


Latest version available at:  http://drseltsam.device.name/vdr/pvr/src/pvr350/

The pvr350-plugin was originally written by Dominic Morris, but he stopped development.
Based on the last version 0.0.5 from December 2005 (which was only sent to a few people),
I adapted the plugin during the years to ivtv changes. Although I have only very limited knowledge
about C++, I also managed to improve some things. Special thanks to
- Jon Burgess (for helping me to convert the ivtv fwcall 0x56 to IVTVFB_IOCTL_SET_WINDOW)
- Ian Armstrong (for adapting the code to the vtv-fb changes)
- Hans Verkuil (for a lot of tips how to convert the code to the new V4L2 API. I also used
  a lot of code found in his ivtvtv-tool)
- and of course to Andreas Schäfers, who rewrote a lot of parts of the plugin and introduced
  ac3 conversion. Without his help the plugin wouldn`t be like it is.

Dr. Seltsam


See the file COPYING for license information.

Description:
------------

This plugin implements an output device for the PVR350 TV out.


Requirements:
-------------
- ivtv driver version >= 0.10

- twolame from http://www.twolame.org/ (tested with 0.3.10)

- plugin pvrinput (you don`t need it, if you only want to use the pvr350 decoder part, e.g. with DVB cards) 
  The maintainer of the pvrinput plugin stopped development, but "Wirbel" Winfried Koehler
  <handygewinnspiel AET gmx dOt de> adapted the plugin to ivtv driver changes and improved it.
  You cand find the latest sources at
  http://drseltsam.device.name/vdr/pvr/src/pvrinput/
  or
  http://free.pages.at/wirbel4vdr/unofficial_stuff/index2.html

- Be sure you have a recent version of videodev2.h in your /usr/include/linux

Installation:
-------------
- Unpack the package into "PLUGINS/SRC" directory.
- Make a symbolic link to this pvr350-plugin (ln -s pvr350-x.x.x pvr350).
- Call "make plugins" in the VDR root directory.
- Make sure ivtv and ivtv-fb modules are loaded. (In newer driver versions ivtv-fb has been renamend to ivtvfb !)
- If you want to use the remote, load lirc-i2c
- Start vdr with plugin pvr350 (for example "vdr -Ppvr350")
 

Problems/Troubleshooting:
-------------------------

- Playing audio without video (eg. Radio or mp3) isn't supported yet. Earlier plugin versions sent
  a blank video frame, but it never worked. A workaround for analogue radio (you need a recent
  pvrinput version) is to set the VPID to 301. For DVB radio you could try the radio plugin, which
  creates a still picture as background. 

- Changing audio volume is not possible due to a hardware limitation. A solution could be to connect
  the audio output of the pvr350 with the line input of your soundcard and to use the sndctl-plugin or avolctl-plugin.

- The plugin uses /dev/video16 at default. If you have other videocards 
  (for example an additional PVR card or a DVB device with analogue tuner and/or video input)
  your pvr350 may get /dev/video17 or higher. In most cases you won`t be able to set the right
  device number of your PVR350 in the plugin menu, because you can`t start vdr.
  Solution: If your PVR350 is /dev/video17, edit vdr`s setup.conf:
  pvr350.DeviceNumber = 17

- After loading ivtv-fb the console locks: To avoid the console being taken over
  by ivtv-fb, try the following: Add a valid vga mode to the kernel options, so that the console
  display driver gets fb0. Add also "video=vc:64-64 video=map:0".
  Example for boot/grub/menu.lst:
       kernel /boot/vmlinuz vga=0x317 video=vc:64-64 video=map:0 root=/dev/hda1 quiet
  You may also try the kernel option 'fbcon=vc:0-0' . This ensures that only
  the first framebuffer device (that of your graphics card) is used.
  If you don't use a framebuffer at all for your console, then try the option
  'fbcon=vc:64-63', this will prevent any framebuffer device from being used
  for the console. However, in kernel 2.6.23 the 'vc:64-63' trick no longer works. Instead
  enable the VT_HW_CONSOLE_BINDING configuration option when compiling
  the kernel: 'Device Drivers', 'Character devices', 'Support for binding and
  unbinding console drivers'. You can now unload ivtvfb by running
  'rmmod -f ivtvfb' and the standard console will automatically be reattached.
  WARNING: There is obviously a kernel bug: After unloading ivtvfb this way, the /proc/dev/fb0 
  does still exist, but loading ivtvfb again will create a new /proc/dev/fb0. At least vdr will crash,
  you may also get a kernel oops. So use this as last solution and avoid unloading/reloading ivtvfb
  without a reboot.

- playing an ac3-DVD with the dvd-plugin: You need to set "Use Dolby Digital" to "yes" in the vdr
  settings, otherwise you won`t hear anything. The pvr350-plugin converts ac3 internally to mp2. You
  will notice a much lower audio volume. This is because ac3 has more dynamic range (the difference
  between loud and soft). I think we need a different "dynamic range compression" method,
  which cuts the dynamic range, effectively boosting the low level audio so everything sounds a little
  bit louder (saving your neighbours from the loud explosions etc.). If you know how to do this,
  feel free to contribute a patch :-)

- When switching from fast forward to Play, it always skips a few seconds. The reason
  is, that vdr calls "Clear()" to clear the decoder buffers. For DVB cards (which have a smaller buffer)
  vdr`s dvbplayer uses cBacktrace to compensate this. Until a better solution (e.g. by using GetSTC)
  is not implemented in vdr, you need to patch vdr (dvbplayer.c):
  
	int cBackTrace::Get(bool Forward)
	{
	  int p = pos;
	  int n = num;
	//  int l = DVB_BUF_SIZE + (Forward ? 0 : 256 * 1024); //XXX (256 * 1024) == DVB_BUF_SIZE ???
	  int l = (2560 * 1024); //fix for PVR350
	  int i = -1; 

