X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faccess%2Fpvr.c;h=b2ff451de43086ab1c350e4be6c386c1fea4a9ab;hb=d68c695968e92438e1787bed350617799c6d350c;hp=ab80c7f5cedb873a7fab9db917e984bd3553bf4e;hpb=1af4a45f7e38147fa82f502196c281300e97f002;p=vlc diff --git a/modules/access/pvr.c b/modules/access/pvr.c index ab80c7f5ce..b2ff451de4 100644 --- a/modules/access/pvr.c +++ b/modules/access/pvr.c @@ -28,7 +28,6 @@ #include #include -#include #include #include #include @@ -38,7 +37,11 @@ #include #include #ifdef HAVE_NEW_LINUX_VIDEODEV2_H -#include VIDEODEV2_H_FILE +# ifdef VIDEODEV2_H_FILE +# include VIDEODEV2_H_FILE +# else +# include +# endif #else #include "videodev2.h" #endif @@ -163,7 +166,7 @@ vlc_module_end(); /***************************************************************************** * Prototypes *****************************************************************************/ -static int Read ( access_t *, uint8_t *, int ); +static ssize_t Read ( access_t *, uint8_t *, size_t ); static int Control( access_t *, int, va_list ); /* ivtv specific ioctls */ @@ -828,7 +831,7 @@ static int Open( vlc_object_t * p_this ) p_sys->i_fd = open( p_sys->psz_videodev, O_RDWR ); if( p_sys->i_fd < 0 ) { - msg_Err( p_access, "Cannot open device (%s).", strerror( errno ) ); + msg_Err( p_access, "Cannot open device (%m)." ); Close( VLC_OBJECT(p_access) ); return VLC_EGENERIC; } @@ -838,17 +841,21 @@ static int Open( vlc_object_t * p_this ) result = ioctl( p_sys->i_fd, VIDIOC_QUERYCAP, &device_capability ); if( result < 0 ) { - msg_Err( p_access, "unknown ivtv driver version in use" ); + msg_Err( p_access, "unknown ivtv/pvr driver version in use" ); Close( VLC_OBJECT(p_access) ); return VLC_EGENERIC; } - msg_Dbg( p_access, "ivtv driver version %02x.%02x.%02x", + msg_Dbg( p_access, "%s driver (%s on %s) version %02x.%02x.%02x", + device_capability.driver, + device_capability.card, + device_capability.bus_info, ( device_capability.version >> 16 ) & 0xff, ( device_capability.version >> 8 ) & 0xff, ( device_capability.version ) & 0xff); - if ( device_capability.version >= 0x000800 ) + if ( strncmp( (char *) device_capability.driver, "ivtv", 4 ) + || device_capability.version >= 0x000800 ) { /* Drivers > 0.8.0 use v4l2 API instead of IVTV ioctls */ msg_Dbg( p_access, "this driver uses the v4l2 API" ); @@ -933,8 +940,7 @@ static int Open( vlc_object_t * p_this ) p_sys->i_radio_fd = open( p_sys->psz_radiodev, O_RDWR ); if( p_sys->i_radio_fd < 0 ) { - msg_Err( p_access, "Cannot open radio device (%s).", - strerror( errno ) ); + msg_Err( p_access, "Cannot open radio device (%m)." ); Close( VLC_OBJECT(p_access) ); return VLC_EGENERIC; } @@ -951,8 +957,7 @@ static int Open( vlc_object_t * p_this ) result = ioctl( i_fd, VIDIOC_G_TUNER, &vt ); if ( result < 0 ) { - msg_Warn( p_access, "Failed to read tuner information (%s).", - strerror( errno ) ); + msg_Warn( p_access, "Failed to read tuner information (%m)." ); } else { @@ -964,8 +969,7 @@ static int Open( vlc_object_t * p_this ) result = ioctl( i_fd, VIDIOC_G_FREQUENCY, &vf ); if ( result < 0 ) { - msg_Warn( p_access, "Failed to read tuner frequency (%s).", - strerror( errno ) ); + msg_Warn( p_access, "Failed to read tuner frequency (%m)." ); } else { @@ -977,8 +981,7 @@ static int Open( vlc_object_t * p_this ) result = ioctl( i_fd, VIDIOC_S_FREQUENCY, &vf ); if( result < 0 ) { - msg_Warn( p_access, "Failed to set tuner frequency (%s).", - strerror( errno ) ); + msg_Warn( p_access, "Failed to set tuner frequency (%m)." ); } else { @@ -1064,7 +1067,7 @@ static void Close( vlc_object_t * p_this ) /***************************************************************************** * Read *****************************************************************************/ -static int Read( access_t * p_access, uint8_t * p_buffer, int i_len ) +static ssize_t Read( access_t * p_access, uint8_t * p_buffer, size_t i_len ) { access_sys_t *p_sys = (access_sys_t *) p_access->p_sys; struct pollfd ufd; @@ -1087,7 +1090,7 @@ static int Read( access_t * p_access, uint8_t * p_buffer, int i_len ) if( i_ret < 0 ) { - msg_Err( p_access, "Select error (%s).", strerror( errno ) ); + msg_Err( p_access, "Polling error (%m)." ); return -1; } @@ -1150,6 +1153,7 @@ static int Control( access_t *p_access, int i_query, va_list args ) case ACCESS_SET_TITLE: case ACCESS_SET_SEEKPOINT: case ACCESS_SET_PRIVATE_ID_STATE: + case ACCESS_GET_CONTENT_TYPE: return VLC_EGENERIC; default: