]> git.sesse.net Git - vlc/commitdiff
raop: Keep original response status line
authorMichael Hanselmann <public@hansmi.ch>
Tue, 21 Jul 2009 23:06:39 +0000 (01:06 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Wed, 29 Jul 2009 16:00:24 +0000 (19:00 +0300)
It'll be used by another patch.

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
modules/stream_out/raop.c

index 1559f66dccd2a9eb26ae7833ba8d0e812bb0f53d..9a20e956d2eeff989820aeb425ad2b45e3efa869 100644 (file)
@@ -115,6 +115,7 @@ struct sout_stream_sys_t
     char *psz_url;
     char *psz_client_instance;
     char *psz_session;
+    char *psz_last_status_line;
 
     int i_cseq;
     int i_server_port;
@@ -187,6 +188,7 @@ static void FreeSys( vlc_object_t *p_this, sout_stream_sys_t *p_sys )
     free( p_sys->psz_url );
     free( p_sys->psz_session );
     free( p_sys->psz_client_instance );
+    free( p_sys->psz_last_status_line );
     free( p_sys );
 }
 
@@ -573,27 +575,29 @@ static int ReadStatusLine( vlc_object_t *p_this )
 {
     sout_stream_t *p_stream = (sout_stream_t*)p_this;
     sout_stream_sys_t *p_sys = p_stream->p_sys;
-    char *psz_original = NULL;
     char *psz_line = NULL;
     char *psz_token;
     char *psz_next;
     int i_err = VLC_SUCCESS;
 
-    psz_line = net_Gets( p_this, p_sys->i_control_fd, NULL );
-    if ( !psz_line )
+    p_sys->psz_last_status_line = net_Gets( p_this, p_sys->i_control_fd,
+                                            NULL );
+    if ( !p_sys->psz_last_status_line )
     {
         i_err = VLC_EGENERIC;
         goto error;
     }
 
-    psz_original = strdup( psz_line );
+    /* Create working copy */
+    psz_line = strdup( p_sys->psz_last_status_line );
     psz_next = psz_line;
 
     /* Protocol field */
     psz_token = strsep( &psz_next, psz_delim_space );
     if ( !psz_token || strncmp( psz_token, "RTSP/1.", 7 ) != 0 )
     {
-        msg_Err( p_this, "Unknown protocol (%s)", psz_original );
+        msg_Err( p_this, "Unknown protocol (%s)",
+                 p_sys->psz_last_status_line );
         i_err = VLC_EGENERIC;
         goto error;
     }
@@ -602,13 +606,13 @@ static int ReadStatusLine( vlc_object_t *p_this )
     psz_token = strsep( &psz_next, psz_delim_space );
     if ( !psz_token || strcmp( psz_token, "200" ) != 0 )
     {
-        msg_Err( p_this, "Request failed (%s)", psz_original );
+        msg_Err( p_this, "Request failed (%s)",
+                 p_sys->psz_last_status_line );
         i_err = VLC_EGENERIC;
         goto error;
     }
 
 error:
-    free( psz_original );
     free( psz_line );
 
     return i_err;
@@ -813,6 +817,8 @@ static int ExecRequest( vlc_object_t *p_this, const char *psz_method,
     }
 
 error:
+    FREENULL( p_sys->psz_last_status_line );
+
     return i_err;
 }