Commit 6a320d91 authored by Christophe Massiot's avatar Christophe Massiot

* modules/access/pvr/pvr.c: Be compatible with both old and new kernels.

parent d68e3479
...@@ -560,8 +560,9 @@ static int Open( vlc_object_t * p_this ) ...@@ -560,8 +560,9 @@ static int Open( vlc_object_t * p_this )
if ( p_sys->i_frequency != -1 ) if ( p_sys->i_frequency != -1 )
{ {
int i_fd; int i_fd;
struct v4l2_frequency vf; struct v4l2_tuner vt;
vf.tuner = 0; /* TODO: let the user choose the tuner */ vt.index = 0; /* TODO: let the user choose the tuner */
memset( &vt.reserved, 0, sizeof(vt.reserved) );
if ( p_sys->i_frequency >= pi_radio_range[0] if ( p_sys->i_frequency >= pi_radio_range[0]
&& p_sys->i_frequency <= pi_radio_range[1] ) && p_sys->i_frequency <= pi_radio_range[1] )
...@@ -586,6 +587,16 @@ static int Open( vlc_object_t * p_this ) ...@@ -586,6 +587,16 @@ static int Open( vlc_object_t * p_this )
p_sys->i_radio_fd = -1; p_sys->i_radio_fd = -1;
} }
if ( ioctl( i_fd, VIDIOC_G_TUNER, &vt ) < 0 )
{
msg_Warn( p_access, "VIDIOC_G_TUNER failed (%s)",
strerror( errno ) );
}
else
{
struct v4l2_frequency vf;
vf.tuner = vt.index;
if ( ioctl( i_fd, VIDIOC_G_FREQUENCY, &vf ) < 0 ) if ( ioctl( i_fd, VIDIOC_G_FREQUENCY, &vf ) < 0 )
{ {
msg_Warn( p_access, "VIDIOC_G_FREQUENCY failed (%s)", msg_Warn( p_access, "VIDIOC_G_FREQUENCY failed (%s)",
...@@ -593,10 +604,10 @@ static int Open( vlc_object_t * p_this ) ...@@ -593,10 +604,10 @@ static int Open( vlc_object_t * p_this )
} }
else else
{ {
if( p_sys->i_radio_fd == -1 ) if( vt.capability & V4L2_TUNER_CAP_LOW )
vf.frequency = (p_sys->i_frequency * 16 + 500) / 1000;
else
vf.frequency = p_sys->i_frequency * 16; vf.frequency = p_sys->i_frequency * 16;
else
vf.frequency = (p_sys->i_frequency * 16 + 500) / 1000;
if( ioctl( i_fd, VIDIOC_S_FREQUENCY, &vf ) < 0 ) if( ioctl( i_fd, VIDIOC_S_FREQUENCY, &vf ) < 0 )
{ {
...@@ -610,6 +621,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -610,6 +621,7 @@ static int Open( vlc_object_t * p_this )
} }
} }
} }
}
/* control parameters */ /* control parameters */
if ( p_sys->i_volume != -1 ) if ( p_sys->i_volume != -1 )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment