]> git.sesse.net Git - vlc/blobdiff - modules/access/dvb/access.c
Removes trailing spaces. Removes tabs.
[vlc] / modules / access / dvb / access.c
index 977b0a1bc9fb584c77a863c55d723ba8b8cc0ccb..d08a7a2dedfd530eca44e4af136b0076acc245d9 100644 (file)
@@ -28,7 +28,8 @@
  * Preamble
  *****************************************************************************/
 #include <vlc/vlc.h>
-#include <vlc/input.h>
+#include <vlc_access.h>
+#include <vlc_interface.h>
 
 #ifdef HAVE_UNISTD_H
 #   include <unistd.h>
@@ -36,6 +37,7 @@
 
 #include <fcntl.h>
 #include <sys/types.h>
+#include <sys/poll.h>
 
 #include <errno.h>
 
@@ -179,7 +181,7 @@ static void Close( vlc_object_t *p_this );
 
 vlc_module_begin();
     set_shortname( _("DVB") );
-    set_description( N_("DVB input with v4l2 support") );
+    set_description( _("DVB input with v4l2 support") );
     set_category( CAT_INPUT );
     set_subcategory( SUBCAT_INPUT_ACCESS );
 
@@ -251,14 +253,21 @@ vlc_module_begin();
 #endif
 
     set_capability( "access2", 0 );
-    add_shortcut( "dvb" );
-    add_shortcut( "dvb-s" );
+    add_shortcut( "dvb" );      /* Generic name */
+
+    add_shortcut( "dvb-s" );    /* Satellite */
     add_shortcut( "qpsk" );
-    add_shortcut( "dvb-c" );
+    add_shortcut( "satellite" );
+
+    add_shortcut( "dvb-c" );    /* Cable */
     add_shortcut( "cable" );
-    add_shortcut( "dvb-t" );
+
+    add_shortcut( "dvb-t" );    /* Terrestrial */
     add_shortcut( "terrestrial" );
-    add_shortcut( "satellite" );    /* compatibility with the interface. */
+
+    add_shortcut( "atsc" );     /* Atsc */
+    add_shortcut( "usdigital" );
+
     set_callbacks( Open, Close );
 vlc_module_end();
 
@@ -306,6 +315,9 @@ static int Open( vlc_object_t *p_this )
     p_access->info.i_seekpoint = 0;
 
     p_access->p_sys = p_sys = malloc( sizeof( access_sys_t ) );
+    if( !p_sys )
+        return VLC_ENOMEM;
+
     memset( p_sys, 0, sizeof( access_sys_t ) );
 
     /* Create all variables */
@@ -399,35 +411,29 @@ static block_t *Block( access_t *p_access )
 
     for ( ; ; )
     {
-        struct timeval timeout;
-        fd_set fds, fde;
+        struct pollfd ufds[2];
         int i_ret;
-        int i_max_handle = p_sys->i_handle;
 
         /* Initialize file descriptor sets */
-        FD_ZERO( &fds );
-        FD_ZERO( &fde );
-        FD_SET( p_sys->i_handle, &fds );
-        FD_SET( p_sys->i_frontend_handle, &fde );
-        if ( p_sys->i_frontend_handle > i_max_handle )
-            i_max_handle = p_sys->i_frontend_handle;
+        memset (ufds, 0, sizeof (ufds));
+        ufds[0].fd = p_sys->i_handle;
+        ufds[0].events = POLLIN;
+        ufds[1].fd = p_sys->i_frontend_handle;
+        ufds[1].events = POLLPRI;
 
         /* We'll wait 0.5 second if nothing happens */
-        timeout.tv_sec = 0;
-        timeout.tv_usec = 500000;
-
         /* Find if some data is available */
-        i_ret = select( i_max_handle + 1, &fds, NULL, &fde, &timeout );
+        i_ret = poll( ufds, 2, 500 );
 
         if ( p_access->b_die )
             return NULL;
 
-        if ( i_ret < 0 && errno == EINTR )
-            continue;
-
         if ( i_ret < 0 )
         {
-            msg_Err( p_access, "select error (%s)", strerror(errno) );
+            if( errno == EINTR )
+                continue;
+
+            msg_Err( p_access, "poll error: %s", strerror(errno) );
             return NULL;
         }
 
@@ -437,7 +443,7 @@ static block_t *Block( access_t *p_access )
             p_sys->i_ca_next_event = mdate() + p_sys->i_ca_timeout;
         }
 
-        if ( FD_ISSET( p_sys->i_frontend_handle, &fde ) )
+        if ( ufds[1].revents )
         {
             E_(FrontendPoll)( p_access );
         }
@@ -479,7 +485,7 @@ static block_t *Block( access_t *p_access )
             E_(FrontendSet)( p_access );
         }
 
-        if ( FD_ISSET( p_sys->i_handle, &fds ) )
+        if ( ufds[0].revents )
         {
             p_block = block_New( p_access,
                                  p_sys->i_read_once * TS_PACKET_SIZE );
@@ -717,6 +723,9 @@ static int ParseMRL( access_t *p_access )
     {
         msg_Err( p_access, "the DVB input old syntax is deprecated, use vlc "
                           "-p dvb to see an explanation of the new syntax" );
+        intf_UserFatal( p_access, VLC_TRUE, _("Input syntax is deprecated"),
+            _("The given syntax is deprecated. Run \"vlc -p dvb\" to see an " \
+                "explanation of the new syntax.") );
         free( psz_dup );
         return VLC_EGENERIC;
     }
@@ -761,6 +770,9 @@ static int ParseMRL( access_t *p_access )
             else
             {
                 msg_Err( p_access, "illegal polarization %c", *psz_parser );
+                intf_UserFatal( p_access, VLC_FALSE, _("Illegal Polarization"),
+                                _("The provided polarization \"%c\" is not valid."),
+                                *psz_parser );
                 free( psz_dup );
                 return VLC_EGENERIC;
             }