X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faccess%2Frtsp%2Freal.c;h=7743491bca4cfdcecdb06652d7a2f2582c9bdf02;hb=520eaf2ff5ccc48efd800dae1fffa628ca5ec0aa;hp=4b55261bc76a65bbe537129a67a9e46d000d7c51;hpb=9e595c955f1aebae18435f0f5c740802ce347852;p=vlc diff --git a/modules/access/rtsp/real.c b/modules/access/rtsp/real.c index 4b55261bc7..7743491bca 100644 --- a/modules/access/rtsp/real.c +++ b/modules/access/rtsp/real.c @@ -23,7 +23,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include #include "rtsp.h" #include "real.h" @@ -158,37 +162,37 @@ static void hash(char *field, char *param) b = ((b << 0x17) | (b >> 0x09)) + c; a = ((~d | b) ^ c) + LE_32((param+0x00)) + a - 0x0BD6DDBC; - a = ((a << 0x06) | (a >> 0x1a)) + b; + a = ((a << 0x06) | (a >> 0x1a)) + b; d = ((~c | a) ^ b) + LE_32((param+0x1c)) + d + 0x432AFF97; - d = ((d << 0x0a) | (d >> 0x16)) + a; + d = ((d << 0x0a) | (d >> 0x16)) + a; c = ((~b | d) ^ a) + LE_32((param+0x38)) + c - 0x546BDC59; - c = ((c << 0x0f) | (c >> 0x11)) + d; + c = ((c << 0x0f) | (c >> 0x11)) + d; b = ((~a | c) ^ d) + LE_32((param+0x14)) + b - 0x036C5FC7; - b = ((b << 0x15) | (b >> 0x0b)) + c; + b = ((b << 0x15) | (b >> 0x0b)) + c; a = ((~d | b) ^ c) + LE_32((param+0x30)) + a + 0x655B59C3; - a = ((a << 0x06) | (a >> 0x1a)) + b; + a = ((a << 0x06) | (a >> 0x1a)) + b; d = ((~c | a) ^ b) + LE_32((param+0x0C)) + d - 0x70F3336E; - d = ((d << 0x0a) | (d >> 0x16)) + a; + d = ((d << 0x0a) | (d >> 0x16)) + a; c = ((~b | d) ^ a) + LE_32((param+0x28)) + c - 0x00100B83; - c = ((c << 0x0f) | (c >> 0x11)) + d; + c = ((c << 0x0f) | (c >> 0x11)) + d; b = ((~a | c) ^ d) + LE_32((param+0x04)) + b - 0x7A7BA22F; - b = ((b << 0x15) | (b >> 0x0b)) + c; + b = ((b << 0x15) | (b >> 0x0b)) + c; a = ((~d | b) ^ c) + LE_32((param+0x20)) + a + 0x6FA87E4F; - a = ((a << 0x06) | (a >> 0x1a)) + b; + a = ((a << 0x06) | (a >> 0x1a)) + b; d = ((~c | a) ^ b) + LE_32((param+0x3c)) + d - 0x01D31920; - d = ((d << 0x0a) | (d >> 0x16)) + a; + d = ((d << 0x0a) | (d >> 0x16)) + a; c = ((~b | d) ^ a) + LE_32((param+0x18)) + c - 0x5CFEBCEC; - c = ((c << 0x0f) | (c >> 0x11)) + d; + c = ((c << 0x0f) | (c >> 0x11)) + d; b = ((~a | c) ^ d) + LE_32((param+0x34)) + b + 0x4E0811A1; - b = ((b << 0x15) | (b >> 0x0b)) + c; + b = ((b << 0x15) | (b >> 0x0b)) + c; a = ((~d | b) ^ c) + LE_32((param+0x10)) + a - 0x08AC817E; - a = ((a << 0x06) | (a >> 0x1a)) + b; + a = ((a << 0x06) | (a >> 0x1a)) + b; d = ((~c | a) ^ b) + LE_32((param+0x2c)) + d - 0x42C50DCB; - d = ((d << 0x0a) | (d >> 0x16)) + a; + d = ((d << 0x0a) | (d >> 0x16)) + a; c = ((~b | d) ^ a) + LE_32((param+0x08)) + c + 0x2AD7D2BB; - c = ((c << 0x0f) | (c >> 0x11)) + d; + c = ((c << 0x0f) | (c >> 0x11)) + d; b = ((~a | c) ^ d) + LE_32((param+0x24)) + b - 0x14792C6F; - b = ((b << 0x15) | (b >> 0x0b)) + c; + b = ((b << 0x15) | (b >> 0x0b)) + c; lprintf("hash output: %x %x %x %x\n", a, b, c, d); @@ -435,7 +439,7 @@ rmff_header_t *real_parse_sdp(char *data, char **stream_rules, uint32_t bandwidt desc=sdpplin_parse(data); if( !desc ) return NULL; - buf= (char *)malloc(sizeof(char)*2048); + buf= (char *)malloc(2048); if( !buf ) goto error; header = (rmff_header_t*)malloc(sizeof(rmff_header_t)); @@ -476,7 +480,7 @@ rmff_header_t *real_parse_sdp(char *data, char **stream_rules, uint32_t bandwidt if (!desc->stream[i]->mlti_data) { len = 0; - if( buf ) free( buf ); + free( buf ); buf = NULL; } else len=select_mlti_data(desc->stream[i]->mlti_data, @@ -527,13 +531,13 @@ rmff_header_t *real_parse_sdp(char *data, char **stream_rules, uint32_t bandwidt rmff_fix_header(header); if( desc ) sdpplin_free( desc ); - if( buf ) free(buf); + free( buf ); return header; error: if( desc ) sdpplin_free( desc ); if( header ) rmff_free_header( header ); - if( buf ) free( buf ); + free( buf ); return NULL; } @@ -611,7 +615,7 @@ rmff_header_t *real_setup_and_get_header(rtsp_client_t *rtsp_session, int bandw char challenge2[64]; char checksum[34]; char *subscribe=NULL; - char *buf=(char*)malloc(sizeof(char)*256); + char *buf=(char*)malloc(256); char *mrl=rtsp_get_mrl(rtsp_session); unsigned int size; int status; @@ -637,11 +641,10 @@ rmff_header_t *real_setup_and_get_header(rtsp_client_t *rtsp_session, int bandw if (alert) { lprintf("real: got message from server:\n%s\n", alert); } - printf( "bou\n"); - rtsp_send_ok(rtsp_session); - if( challenge1 ) free(challenge1); - if( alert ) free(alert); - if( buf ) free(buf); + rtsp_send_ok( rtsp_session ); + free( challenge1 ); + free( alert ); + free( buf ); return NULL; } @@ -665,7 +668,7 @@ rmff_header_t *real_setup_and_get_header(rtsp_client_t *rtsp_session, int bandw lprintf("Stream description size: %i\n", size); - description = (char*)malloc(sizeof(char)*(size+1)); + description = (char*)malloc(size+1); if( !description ) goto error; if( rtsp_read_data(rtsp_session, (uint8_t*)description, size) <= 0) @@ -674,7 +677,7 @@ rmff_header_t *real_setup_and_get_header(rtsp_client_t *rtsp_session, int bandw //fprintf(stderr, "%s", description); /* parse sdp (sdpplin) and create a header and a subscribe string */ - subscribe = (char *) malloc(sizeof(char)*256); + subscribe = (char *) malloc(256); if( !subscribe ) goto error; @@ -720,19 +723,19 @@ rmff_header_t *real_setup_and_get_header(rtsp_client_t *rtsp_session, int bandw rtsp_schedule_field(rtsp_session, "Range: npt=0-"); rtsp_request_play(rtsp_session,NULL); - if( challenge1 ) free( challenge1 ); - if( session_id ) free( session_id ); - if( description ) free(description); - if( subscribe ) free(subscribe); - if( buf ) free(buf); + free( challenge1 ); + free( session_id ); + free( description ); + free( subscribe ); + free( buf ); return h; error: if( h ) rmff_free_header( h ); - if( challenge1 ) free( challenge1 ); - if( session_id ) free( session_id ); - if( description ) free(description); - if( subscribe ) free(subscribe); - if( buf ) free(buf); + free( challenge1 ); + free( session_id ); + free( description ); + free( subscribe ); + free( buf ); return NULL; }