]> git.sesse.net Git - vlc/blobdiff - modules/access_output/http.c
Use var_Inherit* instead of var_CreateGet*.
[vlc] / modules / access_output / http.c
index b45ffe06744ebc3824bebbbbffc41df53d7762b9..6b13455e452bd691b8bcd93bffed099f425588e8 100644 (file)
 # include "config.h"
 #endif
 
-#include <assert.h>
-
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_sout.h>
 #include <vlc_block.h>
+
+
 #include <vlc_input.h>
 #include <vlc_playlist.h>
-#include <vlc_memory.h>
 
 #if 0 //def HAVE_AVAHI_CLIENT
     #include "bonjour.h"
@@ -96,9 +95,7 @@ vlc_module_begin ()
     set_description( N_("HTTP stream output") )
     set_capability( "sout access", 0 )
     set_shortname( "HTTP" )
-    add_shortcut( "http" )
-    add_shortcut( "https" )
-    add_shortcut( "mmsh" )
+    add_shortcut( "http", "https", "mmsh" )
     set_category( CAT_SOUT )
     set_subcategory( SUBCAT_SOUT_ACO )
     add_string( SOUT_CFG_PREFIX "user", "", NULL,
@@ -280,10 +277,10 @@ static int Open( vlc_object_t *p_this )
     }
 
 #if 0 //def HAVE_AVAHI_CLIENT
-    if( config_GetInt(p_this, SOUT_CFG_PREFIX "bonjour") )
+    if( var_InheritBool(p_this, SOUT_CFG_PREFIX "bonjour") )
     {
         char                *psz_txt, *psz_name;
-        playlist_t          *p_playlist = pl_Hold( p_access );
+        playlist_t          *p_playlist = pl_Get( p_access );
 
         char *psz_uri = input_item_GetURI( p_playlist->status.p_item->p_input );
         char *psz_newuri = psz_uri;
@@ -294,7 +291,6 @@ static int Open( vlc_object_t *p_this )
         if( psz_file_name &&
             asprintf( &psz_txt, "path=%s", psz_file_name ) == -1 )
             {
-                pl_Release( p_access );
                 free( psz_uri );
                 return VLC_ENOMEM;
             }
@@ -308,7 +304,6 @@ static int Open( vlc_object_t *p_this )
 
         if( p_sys->p_bonjour == NULL )
             msg_Err( p_access, "unable to start requested Bonjour announce" );
-        pl_Release( p_access );
     }
     else
         p_sys->p_bonjour = NULL;
@@ -318,18 +313,13 @@ static int Open( vlc_object_t *p_this )
 
     p_sys->i_header_allocated = 1024;
     p_sys->i_header_size      = 0;
-    p_sys->p_header           = malloc( p_sys->i_header_allocated );
+    p_sys->p_header           = xmalloc( p_sys->i_header_allocated );
     p_sys->b_header_complete  = false;
-    if( !p_sys->p_header )
-        p_sys->i_header_allocated = 0;
 
     p_access->pf_write       = Write;
     p_access->pf_seek        = Seek;
     p_access->pf_control     = Control;
 
-    /* XXX Do we deal gracefully with p_sys->p_header == NULL? */
-    assert( p_sys->p_header );
-
     return VLC_SUCCESS;
 }
 
@@ -399,9 +389,8 @@ static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
             {
                 p_sys->i_header_allocated =
                     p_buffer->i_buffer + p_sys->i_header_size + 1024;
-                p_sys->p_header = realloc_or_free( p_sys->p_header,
+                p_sys->p_header = xrealloc( p_sys->p_header,
                                                   p_sys->i_header_allocated );
-                assert( p_sys->p_header );
             }
             memcpy( &p_sys->p_header[p_sys->i_header_size],
                     p_buffer->p_buffer,