]> git.sesse.net Git - vlc/blobdiff - modules/access/udp.c
Include vlc_plugin.h as needed
[vlc] / modules / access / udp.c
index 7daf4dd94c977aab1e8cbffd44851c60bc863269..b2c877f695e8966a17215377b98a90379711ad6c 100644 (file)
  * Preamble
  *****************************************************************************/
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/vlc.h>
+#include <vlc_plugin.h>
 #include <vlc_access.h>
 #include <vlc_network.h>
 
@@ -75,13 +80,11 @@ vlc_module_begin();
     set_subcategory( SUBCAT_INPUT_ACCESS );
 
     add_integer( "udp-caching", DEFAULT_PTS_DELAY / 1000, NULL, CACHING_TEXT,
-                 CACHING_LONGTEXT, VLC_TRUE );
-        change_safe();
-    add_integer( "rtp-late", 100, NULL, RTP_LATE_TEXT, RTP_LATE_LONGTEXT, VLC_TRUE );
-        change_safe();
+                 CACHING_LONGTEXT, true );
+    add_integer( "rtp-late", 100, NULL, RTP_LATE_TEXT, RTP_LATE_LONGTEXT, true );
     add_obsolete_bool( "udp-auto-mtu" );
 
-    set_capability( "access2", 0 );
+    set_capability( "access", 0 );
     add_shortcut( "udp" );
     add_shortcut( "udpstream" );
     add_shortcut( "udp4" );
@@ -111,7 +114,7 @@ struct access_sys_t
 {
     int fd;
 
-    vlc_bool_t b_framed_rtp, b_comedia;
+    bool b_framed_rtp, b_comedia;
 
     /* reorder rtp packets when out-of-sequence */
     uint16_t i_last_seqno;
@@ -138,7 +141,7 @@ static int Open( vlc_object_t *p_this )
     /* Set up p_access */
     access_InitFields( p_access );
     ACCESS_SET_CALLBACKS( NULL, BlockStartRTP, Control, NULL );
-    p_access->info.b_prebuffered = VLC_FALSE;
+    p_access->info.b_prebuffered = false;
     MALLOC_ERR( p_access->p_sys, access_sys_t ); p_sys = p_access->p_sys;
     memset (p_sys, 0, sizeof (*p_sys));
 
@@ -225,18 +228,20 @@ static int Open( vlc_object_t *p_this )
         case IPPROTO_TCP:
             p_sys->fd = net_ConnectTCP( p_access, psz_server_addr, i_server_port );
             p_access->pf_block = BlockRTP;
-            p_sys->b_comedia = p_sys->b_framed_rtp = VLC_TRUE;
+            p_sys->b_comedia = p_sys->b_framed_rtp = true;
             break;
 
         case IPPROTO_DCCP:
 #ifdef SOCK_DCCP
+            var_Create( p_access, "dccp-service", VLC_VAR_STRING );
+            var_SetString( p_access, "dccp-service", "RTPV" );
             p_sys->fd = net_Connect( p_access, psz_server_addr, i_server_port,
                                      SOCK_DCCP, IPPROTO_DCCP );
 #else
             p_sys->fd = -1;
             msg_Err( p_access, "DCCP support not compiled-in!" );
 #endif
-            p_sys->b_comedia = VLC_TRUE;
+            p_sys->b_comedia = true;
             break;
     }
     free (psz_name);
@@ -279,7 +284,7 @@ static void Close( vlc_object_t *p_this )
  *****************************************************************************/
 static int Control( access_t *p_access, int i_query, va_list args )
 {
-    vlc_bool_t   *pb_bool;
+    bool   *pb_bool;
     int          *pi_int;
     int64_t      *pi_64;
 
@@ -290,8 +295,8 @@ static int Control( access_t *p_access, int i_query, va_list args )
         case ACCESS_CAN_FASTSEEK:
         case ACCESS_CAN_PAUSE:
         case ACCESS_CAN_CONTROL_PACE:
-            pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
-            *pb_bool = VLC_FALSE;
+            pb_bool = (bool*)va_arg( args, bool* );
+            *pb_bool = false;
             break;
         /* */
         case ACCESS_GET_MTU:
@@ -336,13 +341,13 @@ static block_t *BlockUDP( access_t *p_access )
     /* Read data */
     p_block = block_New( p_access, MTU );
     len = net_Read( p_access, p_sys->fd, NULL,
-                    p_block->p_buffer, MTU, VLC_FALSE );
+                    p_block->p_buffer, MTU, false );
     if( ( len < 0 )
      || ( p_sys->b_comedia && ( len == 0 ) ) )
     {
         if( p_sys->b_comedia )
         {
-            p_access->info.b_eof = VLC_TRUE;
+            p_access->info.b_eof = true;
             msg_Dbg( p_access, "connection-oriented media hangup" );
         }
         block_Release( p_block );
@@ -376,7 +381,7 @@ static block_t *BlockTCP( access_t *p_access )
     {
         int i_read = net_Read( p_access, p_sys->fd, NULL,
                                p_block->p_buffer + p_block->i_buffer,
-                               2 - p_block->i_buffer, VLC_FALSE );
+                               2 - p_block->i_buffer, false );
         if( i_read <= 0 )
             goto error;
 
@@ -391,7 +396,7 @@ static block_t *BlockTCP( access_t *p_access )
     {
         int i_read = net_Read( p_access, p_sys->fd, NULL,
                                p_block->p_buffer + p_block->i_buffer,
-                               2 + framelen - p_block->i_buffer, VLC_FALSE );
+                               2 + framelen - p_block->i_buffer, false );
         if( i_read <= 0 )
             goto error;
 
@@ -408,7 +413,7 @@ static block_t *BlockTCP( access_t *p_access )
     return p_block;
 
 error:
-    p_access->info.b_eof = VLC_TRUE;
+    p_access->info.b_eof = true;
     block_Release( p_block );
     p_sys->p_partial_frame = NULL;
     return NULL;
@@ -419,7 +424,7 @@ error:
  * rtp_ChainInsert - insert a p_block in the chain and
  * look at the sequence numbers.
  */
-static inline vlc_bool_t rtp_ChainInsert( access_t *p_access, block_t *p_block )
+static inline bool rtp_ChainInsert( access_t *p_access, block_t *p_block )
 {
     access_sys_t *p_sys = (access_sys_t *) p_access->p_sys;
     block_t *p_prev = NULL;
@@ -431,7 +436,7 @@ static inline vlc_bool_t rtp_ChainInsert( access_t *p_access, block_t *p_block )
     {
         p_sys->p_list = p_block;
         p_sys->p_end = p_block;
-        return VLC_TRUE;
+        return true;
     }
     /* walk through the queue from top down since the new packet is in
     most cases just appended to the end */
@@ -458,7 +463,7 @@ static inline vlc_bool_t rtp_ChainInsert( access_t *p_access, block_t *p_block )
             {
                 p_sys->p_end = p_block;
             }
-            return VLC_TRUE;
+            return true;
         }
         if( p == p_sys->p_list )
         {   /* we've reached bottom of chain */
@@ -470,7 +475,7 @@ static inline vlc_bool_t rtp_ChainInsert( access_t *p_access, block_t *p_block )
                 p_block->p_next = p;
                 p->p_prev = p_block;
                 p_sys->p_list = p_block;
-                return VLC_TRUE;
+                return true;
             }
 
             if( !i_tmp )   /* trash duplicate */
@@ -483,13 +488,13 @@ static inline vlc_bool_t rtp_ChainInsert( access_t *p_access, block_t *p_block )
             p_sys->p_end->p_next = p_block;
             p_block->p_prev = p_sys->p_end;
             p_sys->p_end = p_block;
-            return VLC_TRUE;
+            return true;
         }
         p_prev = p;
         p = p->p_prev;
     }
     block_Release( p_block );
-    return VLC_FALSE;
+    return false;
 }
 
 /*****************************************************************************
@@ -682,7 +687,7 @@ static block_t *BlockPrebufferRTP( access_t *p_access, block_t *p_block )
     }
 
     msg_Dbg( p_access, "RTP: prebuffered %d packets", i_count - 1 );
-    p_access->info.b_prebuffered = VLC_TRUE;
+    p_access->info.b_prebuffered = true;
     p = p_sys->p_list;
     p_sys->p_list = p_sys->p_list->p_next;
     p_sys->i_last_seqno = (uint16_t) p->i_dts;
@@ -713,7 +718,7 @@ static block_t *BlockChoose( access_t *p_access )
     {
         msg_Dbg( p_access, "detected TS over raw UDP" );
         p_access->pf_block = BlockUDP;
-        p_access->info.b_prebuffered = VLC_TRUE;
+        p_access->info.b_prebuffered = true;
         return p_block;
     }
 
@@ -730,7 +735,7 @@ static block_t *BlockChoose( access_t *p_access )
     {
         msg_Dbg( p_access, "no supported RTP header detected" );
         p_access->pf_block = BlockUDP;
-        p_access->info.b_prebuffered = VLC_TRUE;
+        p_access->info.b_prebuffered = true;
         return p_block;
     }
 
@@ -754,7 +759,7 @@ static block_t *BlockChoose( access_t *p_access )
         default:
             msg_Dbg( p_access, "no RTP header detected" );
             p_access->pf_block = BlockUDP;
-            p_access->info.b_prebuffered = VLC_TRUE;
+            p_access->info.b_prebuffered = true;
             return p_block;
     }