[vlc-devel] commit: raop: Keep original response status line (Michael Hanselmann )

git version control git at videolan.org
Wed Jul 29 18:18:45 CEST 2009


vlc | branch: master | Michael Hanselmann <public at hansmi.ch> | Wed Jul 22 01:06:39 2009 +0200| [11258e424cb1bc6cb9fe47e32bc23cf38ad083c2] | committer: Rémi Denis-Courmont 

raop: Keep original response status line

It'll be used by another patch.

Signed-off-by: Michael Hanselmann <public at hansmi.ch>
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=11258e424cb1bc6cb9fe47e32bc23cf38ad083c2
---

 modules/stream_out/raop.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/modules/stream_out/raop.c b/modules/stream_out/raop.c
index 1559f66..9a20e95 100644
--- a/modules/stream_out/raop.c
+++ b/modules/stream_out/raop.c
@@ -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;
 }
 




More information about the vlc-devel mailing list