[mythtv-users] A very simple VCD, SVCD (and DVD) player script for the PVR-350 decoder

Torsten Schenkel torsten.schenkel at web.de
Sun Nov 2 07:54:51 EST 2003


Hi,

having lots of VCDs and SVCD that I want to be able to watch on my
MythBox (VIA Epia ME6000, PVR350 running the ivtv framebuffer and
decoder) I created a set of small and simple skripts that integrate a
very simple player (based on splicer.c posted by Chris Kennedy on the
ivtv-devel mailing list) into mythdvd and can be used as a simple
standalone, "not a gui at all" vcd/svcd/dvd player.

All it can do is playback, pause, fast forward and stop. No rewind yet,
I guess there's no ivtv control for rewind since all operates on the
decoding stream, maybe Chris can tell something about that.

It's not the player we all are waiting for, but at least I can watch my
Enterprise VCDs every week :-)

Everything is "as is", no guarantee it will work for you, and it
definitely isn't up to the art of programming, but I am only a rude
shell hacker. 

I hope somebody will find it useful:
 
 

1. First find Chris Kennedy's mail on the ivtv-devel list:

Re: [ivtv-devel] Re: 28/10/03 ivtv patches

attached is some c code. Follow the instructions in the mail.


Or, simpler, get his whole dvr tarball. 

http://iland.net/~ckennedy/dvr.tgz


You'll only need the splicer_0 that's generated when you say "make" in
the sbin subdirectory. The /opt/dvr/ path is hardcoded and can be
changed in the source.

(I only compiled splicer_0 using:

cc -Wall -DVIDEO_PORT=0 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -o
splicer_0 splicer.c

and created the /opt/dvr/include and /opt/dvr/lock directories
manually.)

2. Put the splicer_0 binary someplace where it's in your path.

3. Make sure splicer_0 gets started with mythfrontend (after all the
ivtv drivers are in place).

I use the following script to start mythfrontend:

/home/tv/bin/startmythfrontend: 

#!/bin/bash

# (Re-)starts mythfrontend and splicer_0
# This script gets executed when the "Go" button on the remote is
pressed
#
# Torsten Schenkel


# Reset the alpha values for ivtv-fb so we can see the X desktop (not
always done automatically)
# Should get obsolete as ivtv and mythtv mature

sudo ivtvfbctl /dev/fb0 -globalalpha
sudo ivtvfbctl /dev/fb0 -nolocalalpha



# Kill and start mythfrontend
# sudo shouldn't be necessary if the devices have the proper permission,
but I trust in Isaac and Co :-)

killall mythfrontend
sudo nice --10 mythfrontend > /var/log/mythfrontend.log 2>&1 &


# Kill and start splicer_0 for vcd/svcd and dvd playback
#
# Kill splicer_0 if running
#
killall splicer_0
#
# Remove old lockfiles (unsafe, but works, should do some checking if
splicer_0 really gets killed)
#
sudo rm /opt/dvr/lock/bb_lock*
#
# and finally start the playback daemon
#
sudo splicer_0 > /var/log/splicer.log 2>&1 &

-------------------------------------------------------------------------

4. Create the following two (three) scripts:

/usr/local/splicer_playvcd:

#!/bin/sh

#
# Plays back vcds and svcds on the pvr 350 decoder
#
# Torsten Schenkel

#
# kill mplayer, if running (only use this on a dedicated myth or
multimedia machine
# where you can be sure there is only one instance of mplayer allowed)
#
killall mplayer

#
# This shouldn't be necessary, just a precaution, splicer does funny
things, when it finds an old ctllist
# 
rm -f /opt/vdr/lock/ctllist.0


#
# Change to your spool dir and start mplayer to dump the video stream
from vcd to disk
# Somehow I cant read the .dat file from vcd directly.
#
cd /hda2 # change this to fit your system
#
mplayer -dumpstream vcd://0 &
#
# Give mplayer time to initialize and create some buffer, I need between
5 and 10 seconds, depending on
# your system speed you might have to change this value
#
sleep 10

#
# Blank the framebuffer 
#
sudo ivtvfbctl /dev/fb0 -localalpha

# 
# Start playback
#
echo /hda2/stream.dump > /opt/dvr/lock/playlist.0

-------------------------------------------------------------------------

Change vcd://0 to dvd://0 for dvd playback (this isn't as simple, since
not all dvd's are the same, I didn't test this, but dvd://0 or dvd://1
should work, someone can help with a detection?)

The altered script can then be /usr/local/bin/splicer_playdvd

-------------------------------------------------------------------------
/usr/local/bin/splicer_stopvcd:

#!/bin/sh

# Stops splicer vcd/svcd playback and resets X
#
# Torsten Schenkel

# Kill mplayer if still running
#
killall mplayer


# Send the stop command to splicer
#
echo stop > /opt/dvr/lock/ctllist.0

# Reset the X framebuffer alpha
sudo ivtvfbctl /dev/fb0 -nolocalalpha

-------------------------------------------------------------------------

5. Make sure lircd and irexec get started before mythfrontend and add
the following lines to your .lircrc:


# Restart mythfrontend 
begin
        prog = irexec
        button = GO
        config = /home/tv/bin/startmythfrontend &
end


# Splicer playback controls:
begin
        prog = irexec
        button = STOP
        config = splicer_stopvcd
end

begin
        prog = irexec
        button = PLAY
        config = echo play > /opt/dvr/lock/ctllist.0
end

begin
        prog = irexec
        button = PAUSE
        config = echo pause > /opt/dvr/lock/ctllist.0
end

begin
        prog = irexec
        button = FFW
        config = echo ff > /opt/dvr/lock/ctllist.0
end

-------------------------------------------------------------------

6. Put in a VCD and start splicer_playvcd and enjoy :-)
   Mythdvd integration follows from point 7 on.

All I really miss, is the rewind button, and maybe some OSD, to tell the
runtime. But the rewind is what's missing to be really useful. Maybe
someone knows how to change splicer.c to enable it.

7. Create a script to use as a vcd/svcd/dvd player (I don't use the
built in vcd-support, the script is more flexible). My version of myth
won't accept anything besides mplayer, xine or ogle as dvd player, so I
created the following script as /usr/local/bin/ogle. Make sure you don't
have ogle installed. The script mounts the disc and tests the filesystem
for characteristice of vcd/svcd or dvd unmounts the disc and starts the
appropriate player.


/usr/local/bin/ogle:

#!/bin/bash

# Script to test for VCD, SVCD or DVD and start the appropriate player
#
# Uses the filesystem structure of the inserted disc

# Torsten Schenkel


mount /mnt/cdrom # change to suite your system

if test -d "/mnt/cdrom/vcd" ; then
   echo "VideoCD found"
        umount /mnt/cdrom
#       xine -pvfhq 
        splicer_playvcd
elif test -d "/mnt/cdrom/svcd" ; then
   echo "SuperVideoCD found"
        umount /mnt/cdrom
#       xine -pvfhq
        splicer_playvcd
elif test -d "/mnt/cdrom/VIDEO_TS" ; then
   echo "DVD found"
        umount /mnt/cdrom
#       xine -pdfhq
        splicer_playdvd
else
   echo "No DVD/VCD found"
        umount /mnt/cdrom
fi

------------------------------------------------------------------


8. Change the player command to "ogle" in the mythdvd setup

9. Hope that future version of mythdvd allow a custom player command
again, so we can drop the "ogle" quick and dirty workaround.

Finished.




HTH,

Torsten
-- 
Config files for PVR350 TV-Out:
http://www-isl.mach.uni-karlsruhe.de/~hi93/ivtv-pvr-350-conf.tgz



More information about the mythtv-users mailing list