Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#1133 closed task (fixed)

Support pcHDTV analog tuner

Reported by: danielk Owned by: danielk
Priority: minor Milestone: 0.20
Component: mythtv Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

With the LiveTV changes it shouldn't be too hard to add support for the analog portion of the pcHDTV cards. Currently you must choose whether to use your pcHDTV card as a digital or analog card. But this is strictly a MythTV limitation.

Attachments (3)

1133-v1.patch (34.4 KB) - added by danielk 14 years ago.
Start of support for different tuner types on each input
1133-v7.patch (28.0 KB) - added by danielk 14 years ago.
updated patch
1133-v8.patch (33.1 KB) - added by danielk 14 years ago.
Some fixes

Download all attachments as: .zip

Change History (15)

Changed 14 years ago by danielk

Attachment: 1133-v1.patch added

Start of support for different tuner types on each input

comment:1 Changed 14 years ago by danielk

The patch is not very usable at the moment, but it does allow you to define a DVB source with another device and type on another input and switch to it by pressing 'C'. The switching from the analog input to the digital input doesn't work yet.

comment:2 Changed 14 years ago by danielk

(In [8973]) References #1133. Card input refactoring; bumps MYTH_PROTO_VERSION.

The V4L Channel class enumated the inputs available on a card differently from the other channel classes. This unifies that enumeration, which allows us to put more of the support for inputs in the ChannelBase? class. I also changed the name of the currentcapchannel variable to 'currentInputID' which should be less confusing to people writing new recorder (this confused Jafa when he was writing the hdhomerun recorder).

This also helps with #1133 because we enumerate the inputs based on the inputid in all the channel classes, so an input on a seperate piece of hardware can be added to the list (though we don't do that yet in this commit).

This also changes the protocol for input switching by replacing "TOGGLE_INPUTS" with three new commands "GET_CONNECTED_INPUTS", "GET_INPUT" and "SET_INPUT". This means we can add menu item for each inpt that allows you to switch to a particular input, but the immediate improvement is that we can ignore the request to switch inputs when there is only one input on the card. Though my longer term plan is to implement a 'switch channel lineup' key rather than the current 'Y' and 'C' commands, which presume that you know which card and input on that card that you are currently on.

comment:3 Changed 14 years ago by danielk

(In [8994]) References #1133. two small refactorings.

  • Break out channel creation from TVRec::Init() into TVRec::CreateChannel?()
  • Simplify recordingprofile loading. This eliminates function in TVRec, and replaces loadByCardID() with loadByCardType() in RecordingProfile?.

The first one makes it possible for us to recreate the channel classes, and the second change just makes the code simpler by eliminating some unnesessary code.

Changed 14 years ago by danielk

Attachment: 1133-v7.patch added

updated patch

comment:4 Changed 14 years ago by danielk

(In [8999]) References #1133. Refactoring, moves CheckChannel? from TVRec to ChannelBase?.

Changed 14 years ago by danielk

Attachment: 1133-v8.patch added

Some fixes

comment:5 Changed 14 years ago by danielk

(In [9022]) References #1133.

Basic support for using both the analog and digital parts of the pcHDTV cards.

Define a DVB card entry for the ATSC portion first in mythtv-setup, then click on the "Analog Options" button and define the NTSC portion.

I'm still working on the configuration UI and testing (esp audio on analog side), but this should already be useful as is.

I'm working on extending this to other dual function cards, but that part isn't ready yet. (You can manually enter the DB entries if you want to try that now).

comment:6 Changed 14 years ago by foom@…

I've updated to this and tried it on my pcHDTV 3000 card. It works nicely. Two issues, though: 1) the check for "pcHDTV" doesn't work, so I had to remove the check. I'm not sure what name it's supposed to be checking; my card identifies itself as: DVB#0 Using DVB card 0, with frontend 'Oren OR51132 VSB/QAM Frontend'.

2) When switching to analog from digital (with recordings back to back, or in livetv), the channel change doesn't work the first time, even though the v4l2 call appears to succeed and the frequency returned from VIDIOC_G_FREQUENCY is the proper one. I did the following workaround, which gets the current frequency and re-sets it to the same thing every time a VIDIOC_DQBUF error happens. I know it isn't the "right" fix, but it at least makes things work for me. With this fix, there is static for the first couple seconds after the digital->analog change, then it's fine.

Index: NuppelVideoRecorder.cpp
===================================================================
--- NuppelVideoRecorder.cpp     (revision 9028)
+++ NuppelVideoRecorder.cpp     (working copy)
@@ -1424,6 +1424,23 @@
         if (ioctl(fd, VIDIOC_DQBUF, &vbuf) < 0)
         {
             perror("VIDIOC_DQBUF");
+
+            {
+                struct v4l2_frequency vf;
+                int ioctlval;
+                vf.tuner = 0; // use first tuner
+                vf.type = V4L2_TUNER_ANALOG_TV;
+                ioctlval = ioctl(fd, VIDIOC_G_FREQUENCY, &vf);
+                if (ioctlval < 0) {
+                    fprintf(stderr, "ERROR RESETTING\n");
+                } else {
+                    ioctlval = ioctl(fd, VIDIOC_S_FREQUENCY, &vf);
+                    if (ioctlval < 0) {
+                        fprintf(stderr, "ERROR RESETTING\n");
+                    }
+                }
+            }
+
             if (errno == -EINVAL)
             {
                 for (int i = 0; i < numbuffers; i++)
Index: videosource.cpp
===================================================================
--- videosource.cpp     (revision 9028)
+++ videosource.cpp     (working copy)
@@ -1932,8 +1932,7 @@
             signal_timeout->setValue(500);
             channel_timeout->setValue(3000);
 
-            if (name.left(6) == "pcHDTV")
-                buttonAnalog->setVisible(true);
+            buttonAnalog->setVisible(true);
 
             break;
         default:

comment:7 Changed 14 years ago by danielk

(In [9143]) References #1133. Fixes analog card setup for newer Linus kernel driver for pcHDTV HD-x000 cards.

comment:8 Changed 14 years ago by danielk

foom, what dvb drivers are you using (Linus kernel or dvb cvs revision) ?

I've tried several drivers, and I can't reproduce the tuning problem.

comment:9 Changed 14 years ago by foom@…

I'm using the debian kernel package linux-image-2.6.15-1-k7, version 2.6.15-3. I see there's a newer -7 release now which is based on the official 2.6.15.4 release rather than 2.6.15. I can try the newer version but I didn't see anything in the changelog obviously applicable.

I also had to download firmware images from pchdtv.com. These files have no version identifier that I can see, but their md5sum are as follows: 7702e8938612de46ccadfe9b413cb3b5 dvb-fe-or51132-qam.fw c16208e02f36fc439a557ad4c613364a dvb-fe-or51132-vsb.fw d830949c771a289505bf9eafc225d491 dvb-fe-or51211.fw

I'm using QAM mode.

comment:10 Changed 14 years ago by danielk

Resolution: fixed
Status: newclosed

foom, I just can't reproduce this.

If you can come up with a patch that doesn't break things for normal recording, or if you can create some order of dvb/analog tunings from boot that always causes this (so that I can reproduce this), then open a ticket on just this problem.

comment:11 Changed 13 years ago by danielk

(In [10987]) Refs #1133. Adds handling for EIO failure code from VIDIOC_DQBUF ioctl.

According to the V4L2 docs: EIO -- VIDIOC_DQBUF failed due to an internal error. Can also indicate temporary problems like signal loss. Note the driver might dequeue an (empty) buffer despite returning an error, or even stop capturing.

Since 2.6.15.4, capture from an analog cx88 device sometimes get this error. When it does the hardware is re-tuned to some random frequency by the driver. The fix in this commit is to call a new Channel::Retune() method which retunes to the correct frequency.

This error frequently occurs when you first tune to a new channel resulting in a recording containing only static, it was first reported by foom at fuhm dt net in February, but at the time he was using a patched kernel and I could not reproduce this with a stock kernel. Since then this bug has unfortunately been introduced into the mainline kernel.

comment:12 Changed 13 years ago by anonymous

I tried this out this morning, however I get better results setting up two input cards, a DVB card for my ATSC reception, and a "analog v4l" card that it configured for S-Video with my satellite box. This setups is currently superior to the setup with analog inputs in the DVB card, because I can do picture in picture, and I can record from the two seperate inputs at the same time.

The pcHDTV 5500 card that I use will allow recording from each of the three inputs (tuner, s-video, and composite) at the same time. It will not let you record ATSC tuner and NTSC tuner at the same time though.

Note: See TracTickets for help on using tickets.