aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@kernellabs.com>2010-05-29 19:38:03 (GMT)
committerDevin Heitmueller <dheitmueller@kernellabs.com>2010-05-29 19:38:03 (GMT)
commit2a5c4695ea29ccea70a194b24333e8a3f2d352fd (patch)
tree1bf0d4baebcea9a1d268b7be0577edf38e11b326
parent57008b16b80b8370632fdd886e7a4402494670af (diff)
Make CC parser work even if not getting the V4L1 standard number of lines
The existing code had a hard code assumption that the /dev/vbi device would *always* be sending 12 lines, even if the V4L2 call reported that it was returning some other number. Make tvtime work properly in the case where a different number of lines is sent back (for example, the HVR-950q only sends back line 21).
-rw-r--r--src/vbidata.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/vbidata.c b/src/vbidata.c
index 5886655..6b55fce 100644
--- a/src/vbidata.c
+++ b/src/vbidata.c
@@ -55,6 +55,7 @@ struct vbidata_s
/* VBI parameters negotiated by the hardware */
unsigned int linewidth;
unsigned int numlines;
+ unsigned int startline;
unsigned int vbi_clkin;
unsigned int frame_size;
@@ -1015,6 +1016,10 @@ static void vbidata_open_device( vbidata_t *vbi )
}
vbi->linewidth = vfmt.fmt.vbi.samples_per_line;
+
+ /* FIXME: assumes that we get the same lines for both fields, which
+ fortunately is what is done by every tuner I have ever seen - DJH */
+ vbi->startline = vfmt.fmt.vbi.start[0];
vbi->numlines = vfmt.fmt.vbi.count[0];
frame_rate = vfmt.fmt.vbi.sampling_rate * 2 / 1.006976 / 1000 / 1000;
@@ -1193,6 +1198,7 @@ void vbidata_capture_xds( vbidata_t *vbi, int xds )
void vbidata_process_frame( vbidata_t *vbi, int printdebug )
{
+ int scanline;
if( vbi->open ) {
if( read( vbi->fd, vbi->buf, vbi->frame_size ) < vbi->frame_size ) {
if( vbi->verbose ) {
@@ -1200,7 +1206,14 @@ void vbidata_process_frame( vbidata_t *vbi, int printdebug )
strerror( errno ) );
}
} else {
- int scanline = 11; /* Process line 21. */
+ /* Find line 21 based the lines we are receiving */
+ if ((vbi->startline > 21) ||
+ (vbi->startline + vbi->numlines < 21)) {
+ /* We don't have the required line */
+ fprintf( stderr, "vbidata: Not receiving line 21 in VBI\n" );
+ }
+ scanline = 21 - vbi->startline;
+
#ifdef DJH_DEBUG
int k;
/* Apply diz' new filter. */

Privacy Policy