Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Re: xine vs mythtv



Andrew G. Wilson wrote:
it's way more solid, doesn't fall over on bad data like myth does, and from its CPU usage, it seems to be using the HW mpeg decoder on EPIA - so I'm quite tempted to use it.
mplayer doesn't like bad data either but it does work with radio which xine doesn't.

But.. as xine is primarily a video player rather than a TV app, it's not obvious how to change channels!
Good question. The only way I found is with a playlist but it's a bit useless. So I wrote a little perl script using Xdialog; you have to exit xine to change channels - not great for channel hopping but it works. I assume it's an interim solution until xine is completed.

Can anyone who's using xine spend 5 minutes explaining how to set it up to do channel changing,
See above.

volume adjustment,

g for GUI and drive it like a video.

pause/ff/rew,

on live tv?

 and aspect
changing?
don't know - f is good for full screen mode.

Script attached - it's only small so I hope bad nettiquette is forgiven.

Dick


The best way is with Xine. You can do xine dvb://1 where the number references the line in channels.conf.

You need a channels.conf in ~/.xine. You can use scan to create it.

Alternatively you can use tzap to select a channel and in another xterm cat /dev/dvb/adaptor0/dvr0 to a file or redirect it to mplayer. In this case the channels.conf needs to be in ~/.tzap. I use symbolic link so there's only one channels.conf.

Dick


#!/usr/bin/perl

# xtv - Selects TV channel
# Copyright (C) 2004 R.J.Middleton
# e-mail: dick@lingbrae.com
# 
# This program 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.

# This program 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., 675 Mass Ave, Cambridge, MA 02139, USA.

sub help_info { print <<"End of Info;" ; }
############################################################################
#                                    
# File Name ......................... xtv
# Written By ........................ Dick Middleton
# Date .............................. 04-Feb-04
#
# Description : Reads ~/.tzap/channels.conf to get list of channel names
#
############################################################################
End of Info;

@_ = split('/', $0);		# extract program name
$pn = pop(@_);			# basename
$dr = join('/', @_);		# dirname

use Getopt::Std;
use Proc::Simple;
use Proc::Killfam;

$option_set = "h";		# valid option characters
&getopts($option_set) || die "$pn aborted: Incorrect option\n";
&help_info && exit(0) if $opt_h;

# chop($today = `date +%d-%b-%y`); # today's date

$chanfile = "$ENV{HOME}/.tzap/channels.conf";

sub MPLAYER{1;};
sub XINE{0;};
sub DEBUG{0;};

@players = qw(Xine Mplayer);
@prog =qw(TV Radio);


#BBC ONE Scot:570166670:INVERSION_OFF:BANDWIDTH_8_MHZ:FEC_3_4:FEC_3_4:QAM_16:TRANSMISSION_MODE_2K:GUARD_INTERVAL_1_32:HIERARCHY_NONE:201:202:4220

open(ZAP, $chanfile) || die "$pn failed to open file $chanfile: $!\n";

while (<ZAP>) {
    ($ident, $frq, $inv, $bw, $fec1, $fec2, $mod, $mode, $grd, $hrc, $vpid, $apid, $flag) = split(/:/);
    if ($apid) {		# must have audio
	my $type = !$vpid;
	push(@chanlist, { 
	    row => $row,	# row number of file
	    ident => $ident,	# station name
	    type => $type	# false = tv, true = radio
	    });
    }
    $row++;
}

close(ZAP);

sub listize {
    my ($num) = 1;
    my ($list, $chan);

    foreach $chan (@_) {
	$list .= qq( "$num" "$chan" off );
	$num++;
    }
    $list;
}

sub get_ident_list {
    my ($type) = @_;
    my (@list);
    @stations = ();

    foreach my $chp (@chanlist) {
	if ($$chp{type} == $type) {
	    push(@stations, $chp);
	    push(@list, $$chp{ident});
	}
    }
    @list;
}

if ($pn =~ /tv/) {
    $type = 0;
    $plist = listize(@players);
    $pargs = qq( --radiolist "Player" 0x0 3  $plist);
}
else {
    $type = 1;
    $player = $players[MPLAYER];
}
@chans = get_ident_list($type);
$clist = listize(@chans);

$title = qq(Freeview $prog[$type] Channels);
$cargs = qq( --radiolist "$title" 0x0 10 $clist);
$xargs = qq( --stdout --no-tags);

@sel = `Xdialog $xargs $pargs $cargs`;
chomp @sel;

$sel = shift(@sel);

unless ($type) {		# Choose player

    exit unless $sel;

    $sel--;
    $player = $players[$sel];

    $sel = shift(@sel);		# Selected program
}


while ($sel > 0 && $sel < $#chans) {
    my $chan;
    $sel--;

    if ($player eq $players[MPLAYER]) {
	$chan = $chans[$sel];
	if (DEBUG) {
	    print "mplayer $chan\n";
	}
	else {
	    my $tzap = Proc::Simple->new();

	    $tzap->start(qq(tzap -r "$chan" > /dev/null));

	    system(qq(mplayer -really-quiet - < /dev/dvb/adapter0/dvr0 > /dev/null 2> /dev/null));
	    killfam 'TERM', ($tzap->pid());
	    wait;
	}
    }
    elsif ($player eq $players[XINE]) {
	$chan = $stations[$sel]->{row};
	if (DEBUG) {
	    print "xine chan: $chan\n";
	}
	else {
	    `xine -p=h --no-splash  dvb://$chan`;
	}
    }

    $sel = `Xdialog $xargs $cargs`;
    chomp $sel;
    
}

# Local Variables:
# mode:perl
# End:
#                           ===//===

Home | Main Index | Thread Index