Plugins
tv.ivtv_xine_tv
File: tv/plugins/ivtv_xine_tv.py
Description
Plugin to watch live tv with xine. The plugin supports:
Live TV: pause & continue, seek forward & backward
- Multiple digit channel selection: '1', '12, '123'
- Channel stack: jump to previously viewed channel
- Automatic jump: undo time shift on channel change
- OSD messges: volume and channel info
- Progressive seek: automatically increase seek speed
- Video groups: enable svideo and composite inputs
- Stop confirmation: press STOP twice to return to menu
- Record stream: press RECORD to record the current show
Requirements:
The following software must be installed:
- - ivtv driver (for e.g. Haupage x50 series TV card)
version ivtv: >= 0.10.6
version xine-lib: >= 1.1.9 version xine-ui: >= 0.99.6
Configuration:
The following items should be configured in local_conf.py:
Freevo General Config Items
- TV_CHANNELS
- MIXER_VOLUME_TV_IN
- MIXER_MAJOR_CTRL
- XINE_COMMAND
- XINE_ARGS_DEF
Plugin Specific Config Items
- XINE_TV_VO_DEV
- XINE_TV_AO_DEV
- XINE_TV_TIMESHIFT_FILEMASK
- XINE_TV_CONFIRM_STOP
- XINE_TV_PROGRESSIVE_SEEK
- XINE_TV_PROGRESSIVE_SEEK_THRESHOLD
- XINE_TV_PROGRESSIVE_SEEK_INCREMENT
- XINE_TV_INPUT_REAL_CHANNELS
- XINE_TV_LIVE_RECORD
- XINE_TV_INDENT_OSD
Plugin Specific Events
The following additional events can be defined:
1 # go back to the previous viewed channel
2 EVENTS['tv']['SOME_LIRC_CMD'] = Event('POPCHANNEL')
3
4 # show program info
5 EVENTS['tv']['SOME_LIRC_CMD'] = Event('TOGGLE_OSD')
6
7 # normal seek forward/backward by 1 second
8 EVENTS['tv']['SOME_LIRC_CMD'] = Event(SEEK, arg=-1)
9 EVENTS['tv']['SOME_LIRC_CMD'] = Event(SEEK, arg=+1)
Timeshift Filemask
The LIVE TV functionality requires a large buffer on disk where the TV stream is being recorded while watching.
1 # This specifies the path and filemask that xine uses for
2 # timeshifting. File can get quite big (several gigabytes)
3 XINE_TV_TIMESHIFT_FILEMASK = '/local/tmp/xine-buf-!/local/saved/!20'
Note: the format is 'a!b!c', where: a = prefix (with path) for temporary file buffers b = prefix (with path) for saved recordings c = number of file buffers (200MB each) to use
The path for saved recordings must be on the same partition as the path for temporary file buffers. If the save path is empty then the saved files will be stored in the path for temporary files.
STOP Confirmation
The STOP event will cancel the history of the TV stream. To prevent that this happens by accident, a confirmation can be requested.
1 # Stop confirmation: press STOP twice to return to menu
2 XINE_TV_CONFIRM_STOP = True
Progressive Seek
If progressive is enabled, then seeking in the TV stream will speed up by 'increment' seconds every 'threshold' seconds. Note, set the starting seek event to 1 second to allow fine control.
1 # This enables the progressive seek feature. The speed
2 # for seeking (fast forward and rewind) is increased
3 # automatically. The speed is increased every [THRESHOLD]
4 # seconds in steps of [INCREMENT] secnds.
5 XINE_TV_PROGRESSIVE_SEEK = True
6 XINE_TV_PROGRESSIVE_SEEK_THRESHOLD = 2
7 XINE_TV_PROGRESSIVE_SEEK_INCREMENT = 5
Live Record
If live record is enabled, then the RECORD button will cause the current show to be recorded permanently. Freevo will set marks in the video stream when a new show starts (according to the program guide) and when the channel is changed. Recording will stop automatically (1) on a channel change, (2) when a new show starts according to the program guide or (3) when returning to the program guide.
1 XINE_TV_LIVE_RECORD = True
Note: the performance of channel changes will noticably suffer on slow (<1GHz) machines when live recording is enabled. Using a fast disk and a fast filesystem will help.
Input Real Channels
When pressing numbers on the remote control, Freevo will jump to a different channel, an index in the TV_CHANNELS array by default. Set this to true to use real (cable) channel numbers instead.
1 XINE_TV_INPUT_REAL_CHANNELS = False
Indent OSD
When using overscan mode, the OSD text in xine may be displayed too far to the left. Set this to indent the text somewhat to the right.
1 XINE_TV_INDENT_OSD = False
Video Groups Setup Example
The following shows an example of a configuration for a 1-tuner PVR 250 card and adds S-VIDEO and Composite Inputs. Note that the audio input is selected automatically by ivtv.
1 TV_VIDEO_GROUPS = [
2 VideoGroup(
3 vdev='/dev/video0',
4 adev=None,
5 input_type='Tuner 1',
6 tuner_norm='pal',
7 tuner_chanlist='europe-west',
8 desc='Regular Cable',
9 group_type='ivtv',
10 record_group = None
11 ),
12 VideoGroup(
13 vdev='/dev/video0',
14 adev=None,
15 input_type='S-Video 1',
16 tuner_type='external',
17 desc='S-Video Input',
18 group_type='ivtv',
19 record_group = None
20 ),
21 VideoGroup(
22 vdev='/dev/video0',
23 adev=None,
24 input_type='Composite 2',
25 tuner_type='external',
26 desc='Composite Input',
27 group_type='ivtv',
28 record_group = None
29 ),
30 ]
31
32 TV_CHANNELS = [
33 ('ned1', 'NED 1', 'C22', '', 0),
34 ...
35 ('natg', 'National Geographic', 'C47', '', 0),
36 ...
37 ('svideo', 'S-Video Input', 'EX1', '', 1),
38 ('composite', 'Composite Input', 'EX2', '', 2),
39 ]
Configurable items in the xine config file
The xine config file is located in '~/.xine/config'.
Items that change the OSD text appearance:
1 gui.osd_enabled (set this to '1')
2 gui.osd.fontsize (set this to '28' or '32' for a TV setup)
3 gui.osd.fontcolor (choose one: white, yellow, green, cyan)
4 gui.osd.background (set this to '1' for better readibility)
Owners of VIA EPIA boards might want to set the following:
1 video.device.unichrome_cpu_save
2
3
4 Refer to the config file for further explanation.
Configuration
Refer to the config file for further explanation.
Plugin configuration variables:
TV_CHANNELS: TV Channels Default: None
MIXER_MAJOR_CTRL: Main Mixer control (mandatory) Default: None
MIXER_VOLUME_TV_IN: TV Line In Volume Default: 50
XINE_COMMAND: xine command Default: '/usr/bin/xine'
XINE_ARGS_DEF: xine default arguments Default: '-D -pfhq'
XINE_TV_VO_DEV: xine video output device Default: 'xv'
XINE_TV_AO_DEV: xine audio output device Default: 'oss'
XINE_TV_TIMESHIFT_FILEMASK: xine time shift parameters Default: '/tmp/xinebuf'
XINE_TV_CONFIRM_STOP: require a stop confirmation Default: True
XINE_TV_PROGRESSIVE_SEEK: use progressive seek mode Default: True
XINE_TV_PROGRESSIVE_SEEK_THRESHOLD: progressive seek mode threshold (seconds) Default: 2
XINE_TV_PROGRESSIVE_SEEK_INCREMENT: progressive seek mode steps (seconds) Default: 5
XINE_TV_INPUT_REAL_CHANNELS: handle direct input numbers as real channels Default: False
XINE_TV_LIVE_RECORD: enable recording (make permanent) of live video Default: True
XINE_TV_INDENT_OSD: indent OSD text Default: False
The plugin is loaded with the following settings: type=default, level=10, args=None