[mythtv] DVB integration - first attempt!

Edward Wildgoose edward.wildgoose at frmhedge.com
Wed Apr 23 00:44:53 EDT 2003


OK, no patches yet I'm afraid.  However, I hope that Isaac is in a good mode
though because I would appreciate a few pointers on where I went wrong....

OK, I have a "fully featured" card meaning that it has an onboard mpeg
decoder and the driver presents a v4l interface (/dev/video1) which works
quite nicely under xawtv.  So my first attempt was to switch myth config to
use this.  Unfortunately switching to livetv I see nothing but horizontal
streaky grey static, and the console fills up with errors along the lines
of:

VIDIOCMCAPTURE0: Invalid argument
VIDIOCMCAPTURE1: Invalid argument
VIDIOCMCAPTURE0: Invalid argument
VIDIOCMCAPTURE1: Invalid argument
...etc...

I think I have narrowed this down to the attached chunk of code in
NuppelVideoRecorder, but I'm not quite sure what the error actually means...
Presumably the setup of the v4l device went successfully (no other log
messages on the console but these), but the actual attempt to read data from
the device failed?  Any ideas why this might be?  Do you think it is
rescuable?

On the assumption that it could be that the device only supplies in fixed
recording ratios I also made sure that I had select 720x576 which seems to
be the native resolution of the mpeg stream.

OK, so next I am wondering whether I can't actually get the raw mpeg stream
into myth via the same interface as for the PVR250 cards.  My driver
provides a device from which I can read a raw mpeg stream (actually it is a
transport stream), so this means that I can do:

cat /dev/dvb/adaptor0/dvr0 | ts2ps 0 0 | mplayer -

Is this basically what *you* get with the pvr driver?  ie can you do:

cat /dev/video | mplayer -

and see/hear live video?

OK, so the recording of the mpeg appears to be happening in the
MpegRecord.cpp file.  However, what I didn't understand is why there are all
those requirements in there for v4l2?  MpegRecord appears to have a single
ioctrl to set the width and height?  There after it appears to be a
straightforward case of grabbing output from the /dev/video device as fast
as possible.  Is it just that this one call is v4l2 only, or is there
something else that I am missing somewhere else which creates the v4l2
dependency?

So what I am thinking is that it should be possible for me to integrate my
DVB card simply by ignoring the v4l2 call to set width and height (*I* don't
get a choice), but all the rest can stay the same?  Could you please comment
on whether this is likely to work or whether I am missing something
incredibly obvious?  If yes, then I will have a bash at this tomorrow and
report back.

For those still following at home, preliminary findings are that the main
BBC channels are coming in at 15Mbit/sec at 720x576...Wow....! That
transcoding patch could be really useful!




    while (encoding) {
        if (paused)
        {
           mainpaused = true;
           usleep(50);
           if (cleartimeonpause)
               gettimeofday(&stm, &tzone);
           continue;
        }
        frame = 0;
        mm.frame = 0;
        if (ioctl(fd, VIDIOCSYNC, &frame)<0)
            perror("VIDIOCSYNC0");
        else
        {
            BufferIt(buf+vm.offsets[0], video_buffer_size);
            //memset(buf+vm.offsets[0], 0, video_buffer_size);
            if (ioctl(fd, VIDIOCMCAPTURE, &mm)<0)
                perror("VIDIOCMCAPTURE0");
        }
        frame = 1;
        mm.frame = 1;
        if (ioctl(fd, VIDIOCSYNC, &frame)<0)
            perror("VIDIOCSYNC1");
        else
        {
            BufferIt(buf+vm.offsets[1], video_buffer_size);
            //memset(buf+vm.offsets[1], 0, video_buffer_size);
            if (ioctl(fd, VIDIOCMCAPTURE, &mm)<0)
                perror("VIDIOCMCAPTURE1");
        }
    }




More information about the mythtv-dev mailing list