]> git.sesse.net Git - vlc/blobdiff - modules/access/pvr.c
DVB: separate CA management
[vlc] / modules / access / pvr.c
index 33f42c918f502cf2e16a8cd99e2f8c6ee037d43f..c45ddc6b18963cf181693d5c701084fc7bd4a6b2 100644 (file)
 #include <vlc_access.h>
 #include <vlc_fs.h>
 #include <vlc_url.h>
+#include <vlc_network.h>
 
 #include <sys/types.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <linux/types.h>
 #include <sys/ioctl.h>
-#include <sys/poll.h>
-#ifdef HAVE_NEW_LINUX_VIDEODEV2_H
-#   ifdef VIDEODEV2_H_FILE
-#   include VIDEODEV2_H_FILE
-#   else
+#if defined(HAVE_LINUX_VIDEODEV2_H)
 #   include <linux/videodev2.h>
-#   endif
+#elif defined(HAVE_SYS_VIDEOIO_H)
+#   include <sys/videoio.h>
 #else
-#include "videodev2.h"
+#   error "No Video4Linux2 headers found."
 #endif
 
 /*****************************************************************************
@@ -307,8 +305,6 @@ static int ConfigureIVTV( access_t * p_access )
     return VLC_SUCCESS;
 }
 
-#ifdef HAVE_NEW_LINUX_VIDEODEV2_H
-
 #define MAX_V4L2_CTRLS (6)
 /*****************************************************************************
  * AddV4L2Ctrl: adds a control to the v4l2 controls list
@@ -536,8 +532,6 @@ static int ConfigureV4L2( access_t * p_access )
     return VLC_SUCCESS;
 }
 
-#endif /* HAVE_NEW_LINUX_VIDEODEV2_H */
-
 /*****************************************************************************
  * Open: open the device
  *****************************************************************************/
@@ -856,17 +850,12 @@ static int Open( vlc_object_t * p_this )
     {
         if( p_sys->b_v4l2_api )
         {
-#ifdef HAVE_NEW_LINUX_VIDEODEV2_H
             result = ConfigureV4L2( p_access );
             if( result != VLC_SUCCESS )
             {
                 Close( VLC_OBJECT(p_access) );
                 return result;
             }
-#else
-            msg_Warn( p_access, "You have new ivtvdrivers, "
-                      "but this vlc was built against an old v4l2 version." );
-#endif
         }
         else
         {
@@ -905,31 +894,12 @@ static void Close( vlc_object_t * p_this )
 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;
-    int i_ret;
-
-    ufd.fd = p_sys->i_fd;
-    ufd.events = POLLIN;
+    ssize_t i_ret;
 
     if( p_access->info.b_eof )
         return 0;
 
-    do
-    {
-        if( !vlc_object_alive (p_access) )
-            return 0;
-
-        ufd.revents = 0;
-    }
-    while( ( i_ret = poll( &ufd, 1, 500 ) ) == 0 );
-
-    if( i_ret < 0 )
-    {
-        msg_Err( p_access, "Polling error (%m)." );
-        return -1;
-    }
-
-    i_ret = read( p_sys->i_fd, p_buffer, i_len );
+    i_ret = net_Read( p_access, p_sys->i_fd, NULL, p_buffer, i_len, false );
     if( i_ret == 0 )
     {
         p_access->info.b_eof = true;