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

Written by:		Dominic Morris <dom@suborbital.org.uk> (Original Author),
                        Andreas Schaefers <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 ivtv-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)
- Reinhard Nissl for the code that generates black video for audio-only streams
- and of course to Andreas Schaefers, who rewrote a lot of parts of the plugin and introduced
  ac3 conversion and the mp2 recode stuff. 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:
-------------

- vdr 1.4., 1.6. or >= 1.7.9

- ivtv driver version >= 1.x.x
  You need both ivtv (included in kernel since 2.6.22) and ivtvfb (included in kernel since 2.6.24).
  If you have a kernel < 2.6.24 have a look at http://ivtvdriver.org/index.php/Download to see what
  you need to compile.

- twolame >= 0.3.9 from http://www.twolame.org/
  For Debian/Ubuntu the package name is libtwolame-dev.

- a52dec from http://liba52.sourceforge.net/ (tested with a 0.7.5-cvs snapshot, but 0.7.4 should also work)

- libmpg123 from http://www.mpg123.de. For Debian/Ubuntu have a look for libmpg123-dev.
  (see below in "Problems/Troubleshooting" about problems with mpg123 version 1.11.0)

- plugin pvrinput (you don`t need it, if you only want to use the pvr350 decoder part, e.g. with DVB cards) 
  You can find the latest sources at http://projects.vdr-developer.org/git/?p=vdr-plugin-pvrinput.git;a=summary

- Be sure you have a recent version of videodev2.h in your /usr/include/linux.
  You also need recent versions of /usr/include/linux/dvb/video.h and /usr/include/linux/dvb/video.h
  Furthermore, you need current versions of /usr/include/linux/ivtv.h and /usr/include/linux/ivtvfb.h.
  You may already have the last two in /usr/include/media, but the location has been changed
  to /usr/include/linux in August 2007.
  All files can be found at http://linuxtv.org/hg/v4l-dvb. Click on "manifest" and browse
  to linux/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")
- If you don't have a DVB device and use the PVR350 for analogue TV only (with pvrinput), you should
  turn off "Recode MP2" in the plugin settings to avoid unnecessary CPU load. 
  (The hardware decoder is not able to properly play audio frames if they contain RDS data. There also
  seem to be other problems with some radio stations and with ZDF since May 2012. Therefore the plugin does
  at default a recoding of mp2 audio.
 

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

- The PVR350 can`t play PCM audio like it is delivered from the mp3-plugin with output mode=DVB.
  Solution: Compile the mp3-plugin with OSS support (see its Makefile), set it to OSS output mode and
  use your soundcard.

- 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.

- After loading ivtvfb the console locks: To avoid the console being taken over
  by ivtvfb, 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.

  If all does not help, there is another way: have a look in /lib/modules/<kernelversion>/kernel/drivers/video/console
  If there is a module named fbcon.ko, deactivate it by renaming it to fbcon.ko.HIDE. Don't forget to make a depmod.

  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. A patch for this problem was posted here by Ian Armstrong:
  http://www.gossamer-threads.com/lists/ivtv/devel/40194
  This patch is included in kernel 2.6.31.2 

- 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
  may notice a much lower audio volume. This is because ac3 has more dynamic range (the difference
  between loud and soft). You can adjust the AC3 Gain level in the plugin setup menu, which is also
  useful for DVB channels with AC3 sound.

- When switching from fast forward to Play, it always skips a few seconds (vdr versions prior 1.7.9). 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. You can patch vdr 1.4 and 1.6 (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; 

  This is not necessary with vdr >= 1.7.9!

- radio Plugin does not work: 
  Turn off "Black video for audio-only streams" in the pvr350 plugin menu. (The hardware cannot play
  audio-only streams, so the plugin sends black video frames by default if audio-only is detected.)

- After compiling ld fails:
  /usr/bin/ld: cannot find -lmpg123
  collect2: ld returned 1 exit status
  This happens with mpg123 version 1.11.0. The maintainer decided to rename libmpg123 into libmpg123_64
  on systems with large file support.
  As this breaks compatibilty also with other applications, this may be reverted in future mpg123 versions.
  (See discussion on http://bugs.winehq.org/show_bug.cgi?id=22132).
  Solution: Change the Makefile from
  LIBS = -ltwolame -la52 -lm -lmpg123
  to
  LIBS = -ltwolame -la52 -lm -lmpg123_64 
