]> git.sesse.net Git - vlc/blobdiff - modules/access/http.c
UDP: remove old RTP code
[vlc] / modules / access / http.c
index 452b381f541046b46aad5a9d7b25e0def9a5d3a5..8a04e145cab9f14b13eaefda4f753bcd993b61c7 100644 (file)
@@ -1,12 +1,13 @@
 /*****************************************************************************
  * http.c: HTTP input module
  *****************************************************************************
- * Copyright (C) 2001-2005 the VideoLAN team
+ * Copyright (C) 2001-2008 the VideoLAN team
  * $Id$
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *          Christophe Massiot <massiot@via.ecp.fr>
  *          RĂ©mi Denis-Courmont <rem # videolan.org>
+ *          Antoine Cellerier <dionoea at videolan dot org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -30,7 +31,8 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 
 
 #include <vlc_access.h>
@@ -48,6 +50,8 @@
 #   include <zlib.h>
 #endif
 
+#include <assert.h>
+
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
@@ -84,9 +88,9 @@ static void Close( vlc_object_t * );
 #define FORWARD_COOKIES_LONGTEXT N_("Forward Cookies Across http redirections ")
 
 vlc_module_begin();
-    set_description( _("HTTP input") );
+    set_description( N_("HTTP input") );
     set_capability( "access", 0 );
-    set_shortname( _( "HTTP(S)" ) );
+    set_shortname( N_( "HTTP(S)" ) );
     set_category( CAT_INPUT );
     set_subcategory( SUBCAT_INPUT_ACCESS );
 
@@ -115,7 +119,7 @@ vlc_module_end();
  * Local prototypes
  *****************************************************************************/
 
-/* RFC 2617: Basic and Digest Access Authentification */
+/* RFC 2617: Basic and Digest Access Authentication */
 typedef struct http_auth_t
 {
     char *psz_realm;
@@ -452,12 +456,21 @@ connect:
         {
             if( !strcasecmp( p_sys->psz_mime, "video/nsv" ) ||
                 !strcasecmp( p_sys->psz_mime, "video/nsa" ) )
+            {
+                free( p_access->psz_demux );
                 p_access->psz_demux = strdup( "nsv" );
+            }
             else if( !strcasecmp( p_sys->psz_mime, "audio/aac" ) ||
                      !strcasecmp( p_sys->psz_mime, "audio/aacp" ) )
+            {
+                free( p_access->psz_demux );
                 p_access->psz_demux = strdup( "m4a" );
+            }
             else if( !strcasecmp( p_sys->psz_mime, "audio/mpeg" ) )
+            {
+                free( p_access->psz_demux );
                 p_access->psz_demux = strdup( "mp3" );
+            }
 
             msg_Info( p_access, "Raw-audio server found, %s demuxer selected",
                       p_access->psz_demux );
@@ -470,8 +483,9 @@ connect:
         }
         else if( !p_sys->psz_mime )
         {
-             /* Shoutcast */
-             p_access->psz_demux = strdup( "mp3" );
+            free( p_access->psz_demux );
+            /* Shoutcast */
+            p_access->psz_demux = strdup( "mp3" );
         }
         /* else probably Ogg Vorbis */
     }
@@ -479,17 +493,22 @@ connect:
              p_sys->psz_mime &&
              !strcasecmp( p_sys->psz_mime, "misc/ultravox" ) )
     {
+        free( p_access->psz_demux );
         /* Grrrr! detect ultravox server and force NSV demuxer */
         p_access->psz_demux = strdup( "nsv" );
     }
     else if( !strcmp( p_access->psz_access, "itpc" ) )
     {
+        free( p_access->psz_demux );
         p_access->psz_demux = strdup( "podcast" );
     }
     else if( p_sys->psz_mime &&
              !strncasecmp( p_sys->psz_mime, "application/xspf+xml", 20 ) &&
              ( memchr( " ;\t", p_sys->psz_mime[20], 4 ) != NULL ) )
+    {
+        free( p_access->psz_demux );
         p_access->psz_demux = strdup( "xspf-open" );
+    }
 
     if( p_sys->b_reconnect ) msg_Dbg( p_access, "auto re-connect enabled" );
 
@@ -807,7 +826,7 @@ static ssize_t ReadCompressed( access_t *p_access, uint8_t *p_buffer,
  *****************************************************************************/
 static int Seek( access_t *p_access, int64_t i_pos )
 {
-    msg_Dbg( p_access, "trying to seek to "I64Fd, i_pos );
+    msg_Dbg( p_access, "trying to seek to %"PRId64, i_pos );
 
     Disconnect( p_access );
 
@@ -1071,7 +1090,7 @@ static int Request( access_t *p_access, int64_t i_tell )
     if( p_sys->i_version == 1 )
     {
         net_Printf( VLC_OBJECT(p_access), p_sys->fd, pvs,
-                    "Range: bytes="I64Fd"-\r\n", i_tell );
+                    "Range: bytes=%"PRId64"-\r\n", i_tell );
     }
 
     /* Cookies */
@@ -1221,7 +1240,7 @@ static int Request( access_t *p_access, int64_t i_tell )
             else
             {
                 p_access->info.i_size = i_tell + atoll( p );
-                msg_Dbg( p_access, "stream size="I64Fd, p_access->info.i_size );
+                msg_Dbg( p_access, "stream size=%"PRId64, p_access->info.i_size );
             }
         }
         else if( !strcasecmp( psz, "Location" ) )
@@ -1508,7 +1527,7 @@ static void cookie_append( vlc_array_t * cookies, char * cookie )
 }
 
 /*****************************************************************************
- * "RFC 2617: Basic and Digest Access Authentification" header parsing
+ * "RFC 2617: Basic and Digest Access Authentication" header parsing
  *****************************************************************************/
 static char *AuthGetParam( const char *psz_header, const char *psz_param )
 {