[vlc-devel] commit: raop: Always pass dictionaries for request and response headers ( 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:43 2009 +0200| [be1e8e5917d9c8fc5f0bf4e07f3d0eb9c37bd780] | committer: Rémi Denis-Courmont
raop: Always pass dictionaries for request and response headers
Authentication will need this.
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=be1e8e5917d9c8fc5f0bf4e07f3d0eb9c37bd780
---
modules/stream_out/raop.c | 37 ++++++++++++++++++++++++-------------
1 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/modules/stream_out/raop.c b/modules/stream_out/raop.c
index 24771b9..27d60a4 100644
--- a/modules/stream_out/raop.c
+++ b/modules/stream_out/raop.c
@@ -644,7 +644,7 @@ static int ReadHeader( vlc_object_t *p_this,
/* Empty line for response end */
if ( psz_line[0] == '\0' )
*done = 1;
- else if ( p_resp_headers )
+ else
{
psz_original = strdup( psz_line );
psz_next = psz_line;
@@ -755,12 +755,9 @@ static int SendRequest( vlc_object_t *p_this, const char *psz_method,
}
}
- if ( p_req_headers )
- {
- i_err = WriteAuxHeaders( p_this, p_req_headers );
- if ( i_err != VLC_SUCCESS )
- goto error;
- }
+ i_err = WriteAuxHeaders( p_this, p_req_headers );
+ if ( i_err != VLC_SUCCESS )
+ goto error;
i_rc = net_Write( p_this, p_sys->i_control_fd, NULL,
psz_headers_end, sizeof( psz_headers_end ) - 1 );
@@ -810,8 +807,7 @@ static int ExecRequest( vlc_object_t *p_this, const char *psz_method,
goto error;
}
- if ( p_resp_headers )
- vlc_dictionary_clear( p_resp_headers, FreeHeader, NULL );
+ vlc_dictionary_clear( p_resp_headers, FreeHeader, NULL );
/* Read headers */
headers_done = 0;
@@ -1044,34 +1040,46 @@ error:
static int SendFlush( vlc_object_t *p_this )
{
VLC_UNUSED( p_this );
-
+ vlc_dictionary_t resp_headers;
vlc_dictionary_t req_headers;
int i_err = VLC_SUCCESS;
vlc_dictionary_init( &req_headers, 0 );
+ vlc_dictionary_init( &resp_headers, 0 );
vlc_dictionary_insert( &req_headers, "RTP-Info",
(void *)"seq=0;rtptime=0" );
- i_err = ExecRequest( p_this, "FLUSH", NULL, NULL, &req_headers, NULL );
+ i_err = ExecRequest( p_this, "FLUSH", NULL, NULL,
+ &req_headers, &resp_headers );
if ( i_err != VLC_SUCCESS )
goto error;
error:
vlc_dictionary_clear( &req_headers, NULL, NULL );
+ vlc_dictionary_clear( &resp_headers, FreeHeader, NULL );
return i_err;
}
static int SendTeardown( vlc_object_t *p_this )
{
+ vlc_dictionary_t resp_headers;
+ vlc_dictionary_t req_headers;
int i_err = VLC_SUCCESS;
- i_err = ExecRequest( p_this, "TEARDOWN", NULL, NULL, NULL, NULL );
+ vlc_dictionary_init( &req_headers, 0 );
+ vlc_dictionary_init( &resp_headers, 0 );
+
+ i_err = ExecRequest( p_this, "TEARDOWN", NULL, NULL,
+ &req_headers, &resp_headers );
if ( i_err != VLC_SUCCESS )
goto error;
error:
+ vlc_dictionary_clear( &req_headers, NULL, NULL );
+ vlc_dictionary_clear( &resp_headers, FreeHeader, NULL );
+
return i_err;
}
@@ -1080,12 +1088,14 @@ static int UpdateVolume( 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;
vlc_dictionary_t req_headers;
+ vlc_dictionary_t resp_headers;
char *psz_parameters = NULL;
double d_volume;
int i_err = VLC_SUCCESS;
int i_rc;
vlc_dictionary_init( &req_headers, 0 );
+ vlc_dictionary_init( &resp_headers, 0 );
/* Our volume is 0..255, RAOP is -144..0 (-144 off, -30..0 on) */
@@ -1110,12 +1120,13 @@ static int UpdateVolume( vlc_object_t *p_this )
i_err = ExecRequest( p_this, "SET_PARAMETER",
"text/parameters", psz_parameters,
- &req_headers, NULL );
+ &req_headers, &resp_headers );
if ( i_err != VLC_SUCCESS )
goto error;
error:
vlc_dictionary_clear( &req_headers, NULL, NULL );
+ vlc_dictionary_clear( &resp_headers, FreeHeader, NULL );
free( psz_parameters );
return i_err;
More information about the vlc-devel
mailing list