Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#5619 closed defect (fixed)

pvrusb2 only produces empty files

Reported by: mythdev@… Owned by: Janne Grunau
Priority: minor Milestone: 0.22
Component: mythtv Version: unknown
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Yesterday I added a Hauppauge pvrusb2 tuner to my MythTV backend. It was correctly recognized by the drivers and "cat /dev/video1 > test.mpg" produced a watchable file. (My /dev/video0 belongs to my pvr150 capture card (using the ivtv driver))

Unfortunately MythBackend? does not handle the pvrusb2 very well:

[...]
2008-08-13 12:40:21.695 Scheduled 52 items in 0.3 = 0.01 match + 0.30 place
2008-08-13 12:40:21.700 TVRec(2): ASK_RECORDING 2 0 0 0
2008-08-13 12:40:21.834 TVRec(2): Changing from None to RecordingOnly
2008-08-13 12:40:21.838 TVRec(2): HW Tuner: 2->2
2008-08-13 12:40:21.985

Not ivtv or hdpvr driver??

2008-08-13 12:40:21.995 AutoExpire: CalcParams(): Max required Free Space: 3.0 GB w/freq: 15 min
2008-08-13 12:40:21.998 Started recording: Sporza "Olympische Spelen": channel 1001 on cardid 2, sourceid 1
2008-08-13 12:40:22.088 MPEGRec(/dev/v4l/video1) Warning: Can't enable VBI recording (3)
[...]
2008-08-13 12:59:36.034 Current Schema Version: 1223
2008-08-13 12:59:36.036 New DB connection, total: 2
2008-08-13 12:59:36.038 Connected to database 'mythconverg' at host: server1
2008-08-13 12:59:36.046 Preview Error: Previewer file '/mnt/store/1001_20080813124000.mpg' is not valid.
2008-08-13 12:59:36.049 Preview Error: Run() file not local: '/mnt/store/1001_20080813124000.mpg'
2008-08-13 12:59:36.056 Preview Error: Preview process not ok.
[...]

I located the "Not ivtv or hdpvr driver??" message in the mpegrecorder.cpp file. Because the driver is not recognized, the buffersize is also never set. The following patch seems to resolve this issue for me.

Index: libs/libmythtv/mpegrecorder.cpp
===================================================================
--- libs/libmythtv/mpegrecorder.cpp     (revision 18141)
+++ libs/libmythtv/mpegrecorder.cpp     (working copy)
@@ -399,9 +399,17 @@
             bzero(_pid_status, sizeof(_pid_status));
             memset(_continuity_counter, 0xff, sizeof(_continuity_counter));
         }
+        else if (driver == "pvrusb2")
+        {
+            bufferSize    = 4096;
+            usingv4l2     = true;
+            has_v4l2_vbi  = true;
+            has_buggy_vbi = true;
+            requires_special_pause = false;
+        }
         else
         {
-            VERBOSE(VB_IMPORTANT, "\n\nNot ivtv or hdpvr driver??\n\n");
+            VERBOSE(VB_IMPORTANT, LOC + QString("\n\nNot ivtv, pvrusb2 or hdpvr driver??\n\n (%1)").arg(driver));
             usingv4l2 = has_v4l2_vbi = true;
             has_buggy_vbi = requires_special_pause = false;
         }

But it might even be better to set the buffersize in the constructor of the mpegrecorder.

$ mythbackend --version
Please include all output in bug reports.
MythTV Version   : 18141M
MythTV Branch    : trunk
Library API      : 0.22.20080812-1
Network Protocol : 40
QT Version       : 4.4.1
Options compiled in:
 linux release using_alsa using_backend using_dvb using_frontend using_ivtv using_v4l using_x11 using_xv using_bindings_perl using_bindings_python using_opengl using_ffmpeg_threads

Change History (3)

comment:1 Changed 11 years ago by Janne Grunau

Milestone: unknown0.22
Owner: changed from Isaac Richards to Janne Grunau
Status: newaccepted

comment:2 Changed 11 years ago by Janne Grunau

Resolution: fixed
Status: acceptedclosed

(In [18143]) Fixes #5619. adds pvrusb2 driver to the V4L2 device init

The pvrusb2 uses the same hardware as cards suppported by the ivtv driver. So set the same options as ivtv for in-kernel drivers.

Also fixes not setting buffersize in the "unknown driver cases

based on patch from < mythdev [at] telfort <dot> nl >

comment:3 Changed 11 years ago by Janne Grunau

(In [20293]) Hopefully fixes pvrusb2 recording after [19989]

the pvrusb2 driver does not support VIDIOC_ENCODER_CMD i.e. StartEncoding? and StopEncoding? will always fail. corrects the incorrectly set requires_special_pause in [18143] and makes sure VIDIOC_ENCODER_CMD is only called if requires_special_pause is true Refs #5619, Refs #5866

Note: See TracTickets for help on using tickets.