From 0eb321bf2c1cc0e048faff26a01f86cdd3ec254f Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Tue, 7 Jul 2009 02:26:13 +0300 Subject: Remove trailing whitespace from most files --- stream/ai_alsa.c | 10 +-- stream/ai_alsa1x.c | 10 +-- stream/ai_oss.c | 6 +- stream/asf_mmst_streaming.c | 112 ++++++++++++++-------------- stream/asf_streaming.c | 47 ++++++------ stream/audio_in.c | 4 +- stream/audio_in.h | 6 +- stream/cache2.c | 46 ++++++------ stream/cdd.h | 2 +- stream/cdinfo.c | 18 ++--- stream/cookies.c | 4 +- stream/cookies.h | 2 +- stream/dvb_tune.c | 18 ++--- stream/freesdp/common.h | 4 +- stream/freesdp/parser.c | 6 +- stream/freesdp/parser.h | 16 ++-- stream/freesdp/parserpriv.h | 10 +-- stream/freesdp/priv.h | 4 +- stream/frequencies.c | 46 ++++++------ stream/frequencies.h | 4 +- stream/http.c | 42 +++++------ stream/http.h | 2 +- stream/librtsp/rtsp.c | 88 +++++++++++----------- stream/librtsp/rtsp.h | 4 +- stream/librtsp/rtsp_rtp.c | 64 ++++++++-------- stream/librtsp/rtsp_session.c | 18 ++--- stream/network.c | 20 ++--- stream/open.c | 3 +- stream/pnm.c | 122 +++++++++++++++--------------- stream/pnm.h | 2 +- stream/pvr.h | 2 +- stream/realrtsp/asmrp.c | 37 +++++---- stream/realrtsp/real.c | 38 +++++----- stream/realrtsp/real.h | 2 +- stream/realrtsp/rmff.c | 58 +++++++------- stream/realrtsp/rmff.h | 10 +-- stream/realrtsp/sdpplin.c | 29 ++++--- stream/realrtsp/sdpplin.h | 2 +- stream/realrtsp/xbuffer.c | 6 +- stream/realrtsp/xbuffer.h | 2 +- stream/rtp.c | 48 ++++++------ stream/stream.c | 24 +++--- stream/stream.h | 6 +- stream/stream_cdda.c | 16 ++-- stream/stream_cddb.c | 80 ++++++++++---------- stream/stream_cue.c | 9 +-- stream/stream_dvb.c | 56 +++++++------- stream/stream_dvd.c | 18 ++--- stream/stream_dvd_common.c | 2 +- stream/stream_dvdnav.c | 16 ++-- stream/stream_file.c | 4 +- stream/stream_ftp.c | 32 ++++---- stream/stream_live555.c | 2 +- stream/stream_mf.c | 4 +- stream/stream_nemesi.c | 1 - stream/stream_netstream.c | 22 +++--- stream/stream_netstream.h | 8 +- stream/stream_pvr.c | 170 +++++++++++++++++++++--------------------- stream/stream_radio.c | 27 ++++--- stream/stream_rtp.c | 14 ++-- stream/stream_rtsp.c | 16 ++-- stream/stream_smb.c | 34 ++++----- stream/stream_tv.c | 2 +- stream/stream_udp.c | 14 ++-- stream/stream_vcd.c | 6 +- stream/stream_vstream.c | 2 +- stream/tcp.c | 34 ++++----- stream/tv.c | 2 +- stream/tv.h | 18 ++--- stream/tvi_bsdbt848.c | 90 +++++++++++----------- stream/tvi_def.h | 4 +- stream/tvi_dshow.c | 88 +++++++++++----------- stream/tvi_dshow.h | 4 +- stream/tvi_v4l.c | 6 +- stream/tvi_v4l2.c | 56 +++++++------- stream/tvi_vbi.c | 20 ++--- stream/udp.c | 4 +- stream/url.c | 18 ++--- stream/url.h | 2 +- stream/vcd_read.h | 6 +- stream/vcd_read_darwin.h | 28 +++---- 81 files changed, 966 insertions(+), 973 deletions(-) (limited to 'stream') diff --git a/stream/ai_alsa.c b/stream/ai_alsa.c index 002ea36f71..e913dde099 100644 --- a/stream/ai_alsa.c +++ b/stream/ai_alsa.c @@ -105,19 +105,19 @@ int ai_alsa_setup(audio_in_t *ai) int ai_alsa_init(audio_in_t *ai) { int err; - + err = snd_pcm_open(&ai->alsa.handle, ai->alsa.device, SND_PCM_STREAM_CAPTURE, 0); if (err < 0) { mp_tmsg(MSGT_TV, MSGL_ERR, "Error opening audio: %s\n", snd_strerror(err)); return -1; } - + err = snd_output_stdio_attach(&ai->alsa.log, stderr, 0); - + if (err < 0) { return -1; } - + err = ai_alsa_setup(ai); return err; @@ -139,7 +139,7 @@ int ai_alsa_xrun(audio_in_t *ai) { snd_pcm_status_t *status; int res; - + snd_pcm_status_alloca(&status); if ((res = snd_pcm_status(ai->alsa.handle, status))<0) { mp_tmsg(MSGT_TV, MSGL_ERR, "ALSA status error: %s", snd_strerror(res)); diff --git a/stream/ai_alsa1x.c b/stream/ai_alsa1x.c index 625ccdf387..fa307a1cd8 100644 --- a/stream/ai_alsa1x.c +++ b/stream/ai_alsa1x.c @@ -119,19 +119,19 @@ int ai_alsa_setup(audio_in_t *ai) int ai_alsa_init(audio_in_t *ai) { int err; - + err = snd_pcm_open(&ai->alsa.handle, ai->alsa.device, SND_PCM_STREAM_CAPTURE, 0); if (err < 0) { mp_tmsg(MSGT_TV, MSGL_ERR, "Error opening audio: %s\n", snd_strerror(err)); return -1; } - + err = snd_output_stdio_attach(&ai->alsa.log, stderr, 0); - + if (err < 0) { return -1; } - + err = ai_alsa_setup(ai); return err; @@ -153,7 +153,7 @@ int ai_alsa_xrun(audio_in_t *ai) { snd_pcm_status_t *status; int res; - + snd_pcm_status_alloca(&status); if ((res = snd_pcm_status(ai->alsa.handle, status))<0) { mp_tmsg(MSGT_TV, MSGL_ERR, "ALSA status error: %s", snd_strerror(res)); diff --git a/stream/ai_oss.c b/stream/ai_oss.c index b662445128..d39454e855 100644 --- a/stream/ai_oss.c +++ b/stream/ai_oss.c @@ -75,11 +75,11 @@ int ai_oss_init(audio_in_t *ai) ai->oss.device, strerror(errno)); return -1; } - + ioctl_param = 0 ; mp_msg(MSGT_TV, MSGL_V, "ioctl dsp getfmt: %d\n", ioctl(ai->oss.audio_fd, SNDCTL_DSP_GETFMTS, &ioctl_param)); - + mp_msg(MSGT_TV, MSGL_V, "Supported formats: %x\n", ioctl_param); if (!(ioctl_param & AFMT_S16_LE)) mp_tmsg(MSGT_TV, MSGL_ERR, "unsupported format\n"); @@ -93,7 +93,7 @@ int ai_oss_init(audio_in_t *ai) } if (ai_oss_set_channels(ai) < 0) return -1; - + ioctl_param = ai->req_samplerate; mp_msg(MSGT_TV, MSGL_V, "ioctl dsp speed: %d\n", err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_SPEED, &ioctl_param)); diff --git a/stream/asf_mmst_streaming.c b/stream/asf_mmst_streaming.c index 65398c1602..ec6ba83264 100644 --- a/stream/asf_mmst_streaming.c +++ b/stream/asf_mmst_streaming.c @@ -69,7 +69,7 @@ extern int video_id; #define HDR_BUF_SIZE 8192 #define MAX_STREAMS 20 -typedef struct +typedef struct { uint8_t buf[BUF_SIZE]; int num_bytes; @@ -82,7 +82,7 @@ static int stream_ids[MAX_STREAMS]; static int get_data (int s, char *buf, size_t count); -static void put_32 (command_t *cmd, uint32_t value) +static void put_32 (command_t *cmd, uint32_t value) { cmd->buf[cmd->num_bytes ] = value % 256; value = value >> 8; @@ -95,7 +95,7 @@ static void put_32 (command_t *cmd, uint32_t value) cmd->num_bytes += 4; } -static uint32_t get_32 (unsigned char *cmd, int offset) +static uint32_t get_32 (unsigned char *cmd, int offset) { uint32_t ret; @@ -107,9 +107,9 @@ static uint32_t get_32 (unsigned char *cmd, int offset) return ret; } -static void send_command (int s, int command, uint32_t switches, +static void send_command (int s, int command, uint32_t switches, uint32_t extra, int length, - char *data) + char *data) { command_t cmd; int len8; @@ -175,7 +175,7 @@ static void string_utf16(char *dest, char *src, int len) { #endif } -static void get_answer (int s) +static void get_answer (int s) { char data[BUF_SIZE]; int command = 0x1b; @@ -191,12 +191,12 @@ static void get_answer (int s) command = get_32 (data, 36) & 0xFFFF; - if (command == 0x1b) + if (command == 0x1b) send_command (s, 0x1b, 0, 0, 0, data); } } -static int get_data (int s, char *buf, size_t count) +static int get_data (int s, char *buf, size_t count) { ssize_t len; size_t total = 0; @@ -223,7 +223,7 @@ static int get_data (int s, char *buf, size_t count) } -static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl) +static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl) { unsigned char pre_header[8]; int header_len; @@ -236,9 +236,9 @@ static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl) return 0; } if (pre_header[4] == 0x02) { - + int packet_len; - + packet_len = (pre_header[7] << 8 | pre_header[6]) - 8; // mp_msg(MSGT_NETWORK,MSGL_INFO,"asf header packet detected, len=%d\n", packet_len); @@ -256,7 +256,7 @@ static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl) header_len += packet_len; if ( (header[header_len-1] == 1) && (header[header_len-2]==1)) { - + if( streaming_bufferize( streaming_ctrl, header, header_len )<0 ) { return -1; @@ -266,7 +266,7 @@ static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl) return header_len; - } + } } else { @@ -278,9 +278,9 @@ static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl) mp_tmsg(MSGT_NETWORK,MSGL_ERR,"packet_len read failed.\n"); return 0; } - + packet_len = get_32 ((unsigned char*)&packet_len, 0) + 4; - + // mp_msg(MSGT_NETWORK,MSGL_INFO,"command packet detected, len=%d\n", packet_len); if (packet_len < 0 || packet_len > BUF_SIZE) { @@ -288,26 +288,26 @@ static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl) "Invalid RTSP packet size, giving up.\n"); return 0; } - + if (!get_data (s, data, packet_len)) { mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Command data read failed.\n"); return 0; } - + command = get_32 (data, 24) & 0xFFFF; - + // mp_msg(MSGT_NETWORK,MSGL_INFO,"command: %02x\n", command); - - if (command == 0x1b) + + if (command == 0x1b) send_command (s, 0x1b, 0, 0, 0, data); - + } // mp_msg(MSGT_NETWORK,MSGL_INFO,"get header packet succ\n"); } } -static int interp_header (uint8_t *header, int header_len) +static int interp_header (uint8_t *header, int header_len) { int i; int packet_length=-1; @@ -318,24 +318,24 @@ static int interp_header (uint8_t *header, int header_len) i = 30; while (ibuffer_size==0 ) { // buffer is empty - fill it! int ret = get_media_packet( fd, packet_length1, stream_ctrl); @@ -499,7 +499,7 @@ static int asf_mmst_streaming_read( int fd, char *buffer, int size, streaming_ct } else if (ret==0) //EOF? return ret; } - + len = stream_ctrl->buffer_size-stream_ctrl->buffer_pos; if(len>size) len=size; memcpy( buffer, (stream_ctrl->buffer)+(stream_ctrl->buffer_pos), len ); @@ -514,7 +514,7 @@ static int asf_mmst_streaming_read( int fd, char *buffer, int size, streaming_ct } -static int asf_mmst_streaming_seek( int fd, off_t pos, streaming_ctrl_t *streaming_ctrl ) +static int asf_mmst_streaming_seek( int fd, off_t pos, streaming_ctrl_t *streaming_ctrl ) { return -1; // Shut up gcc warning @@ -538,7 +538,7 @@ int asf_mmst_streaming_start(stream_t *stream) closesocket( stream->fd ); stream->fd = -1; } - + /* parse url */ path = strchr(url1->file,'/') + 1; @@ -548,11 +548,11 @@ int asf_mmst_streaming_start(stream_t *stream) unescpath=malloc(strlen(path)+1); if (!unescpath) { mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n"); - return -1; + return -1; } url_unescape_string(unescpath,path); path=unescpath; - + if( url1->port==0 ) { url1->port=1755; @@ -563,13 +563,13 @@ int asf_mmst_streaming_start(stream_t *stream) return s; } mp_tmsg(MSGT_NETWORK,MSGL_INFO,"Connected\n"); - + seq_num=0; /* - * Send the initial connect info including player version no. Client GUID (random) and the host address being connected to. - * This command is sent at the very start of protocol initiation. It sends local information to the serve - * cmd 1 0x01 + * Send the initial connect info including player version no. Client GUID (random) and the host address being connected to. + * This command is sent at the very start of protocol initiation. It sends local information to the serve + * cmd 1 0x01 * */ /* prepare for the url encoding conversion */ @@ -588,7 +588,7 @@ int asf_mmst_streaming_start(stream_t *stream) len = recv (s, data, BUF_SIZE, 0) ; - /*This sends details of the local machine IP address to a Funnel system at the server. + /*This sends details of the local machine IP address to a Funnel system at the server. * Also, the TCP or UDP transport selection is sent. * * here 192.168.0.1 is local ip address TCP/UDP states the tronsport we r using @@ -612,8 +612,8 @@ int asf_mmst_streaming_start(stream_t *stream) get_answer (s); - /* The ASF header chunk request. Includes ?session' variable for pre header value. - * After this command is sent, + /* The ASF header chunk request. Includes ?session' variable for pre header value. + * After this command is sent, * the server replies with 0x11 command and then the header chunk with header data follows. * 0x15 */ @@ -634,14 +634,14 @@ int asf_mmst_streaming_start(stream_t *stream) packet_length = interp_header (asf_header, asf_header_len); - /* - * This command is the media stream MBR selector. Switches are always 6 bytes in length. - * After all switch elements, data ends with bytes [00 00] 00 20 ac 40 [02]. - * Where: - * [00 00] shows 0x61 0x00 (on the first 33 sent) or 0xff 0xff for ASF files, and with no ending data for WMV files. - * It is not yet understood what all this means. - * And the last [02] byte is probably the header ?session' value. - * + /* + * This command is the media stream MBR selector. Switches are always 6 bytes in length. + * After all switch elements, data ends with bytes [00 00] 00 20 ac 40 [02]. + * Where: + * [00 00] shows 0x61 0x00 (on the first 33 sent) or 0xff 0xff for ASF files, and with no ending data for WMV files. + * It is not yet understood what all this means. + * And the last [02] byte is probably the header ?session' value. + * * 0x33 */ memset (data, 0, 40); @@ -665,10 +665,10 @@ int asf_mmst_streaming_start(stream_t *stream) get_answer (s); - /* Start sending file from packet xx. - * This command is also used for resume downloads or requesting a lost packet. - * Also used for seeking by sending a play point value which seeks to the media time point. - * Includes ?session' value in pre header and the maximum media stream time. + /* Start sending file from packet xx. + * This command is also used for resume downloads or requesting a lost packet. + * Also used for seeking by sending a play point value which seeks to the media time point. + * Includes ?session' value in pre header and the maximum media stream time. * 0x07 */ memset (data, 0, 40); diff --git a/stream/asf_streaming.c b/stream/asf_streaming.c index 59f2450eb7..7dfd2831b8 100644 --- a/stream/asf_streaming.c +++ b/stream/asf_streaming.c @@ -54,7 +54,7 @@ static int asf_read_wrapper(int fd, void *buffer, int len, streaming_ctrl_t *str // internet connection, the TCP connection will not get // through // * Then we can try HTTP. -// +// // Note: Using WMP sequence MMSU then MMST and then HTTP. static int asf_streaming_start( stream_t *stream, int *demuxer_type) { @@ -83,7 +83,7 @@ static int asf_streaming_start( stream_t *stream, int *demuxer_type) { if( fd==-2 ) return -1; } - //Is protocol http, http_proxy, or mms? + //Is protocol http, http_proxy, or mms? if (!strcasecmp(proto, "http_proxy") || !strcasecmp(proto, "http") || !strcasecmp(proto, "mms") || !strcasecmp(proto, "mmsh") || !strcasecmp(proto, "mmshttp")) @@ -101,7 +101,7 @@ static int asf_streaming_start( stream_t *stream, int *demuxer_type) { } static int asf_streaming(ASF_stream_chunck_t *stream_chunck, int *drop_packet ) { -/* +/* printf("ASF stream chunck size=%d\n", stream_chunck->size); printf("length: %d\n", length ); printf("0x%02X\n", stream_chunck->type ); @@ -116,7 +116,7 @@ printf("0x%02X\n", stream_chunck->type ); mp_tmsg(MSGT_NETWORK,MSGL_ERR,"size_confirm mismatch!: %d %d\n", stream_chunck->size, stream_chunck->size_confirm); return -1; } -/* +/* printf(" type: 0x%02X\n", stream_chunck->type ); printf(" size: %d (0x%02X)\n", stream_chunck->size, stream_chunck->size ); printf(" sequence_number: 0x%04X\n", stream_chunck->sequence_number ); @@ -173,7 +173,7 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl) int bw = streaming_ctrl->bandwidth; int *v_rates = NULL, *a_rates = NULL; int v_rate = 0, a_rate = 0, a_idx = -1, v_idx = -1; - + if(asf_ctrl == NULL) return -1; // The ASF header can be in several network chunks. For example if the content description @@ -194,7 +194,7 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl) mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Didn't get a header as first chunk !!!!\n"); return -1; } - + // audit: do not overflow buffer_size if (size > SIZE_MAX - buffer_size) return -1; buffer = malloc(size+buffer_size); @@ -209,7 +209,7 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl) chunk_buffer = buffer; buffer += buffer_size; buffer_size += size; - + if (asf_read_wrapper(fd, buffer, size, streaming_ctrl) <= 0) return -1; @@ -225,9 +225,9 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl) } while( buffer_size= 0) { ASF_file_header_t *fileh = (ASF_file_header_t *) &buffer[pos]; @@ -240,7 +240,7 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl) } */ asf_ctrl->packet_size = AV_RL32(&fileh->max_packet_size); - // before playing. + // before playing. // preroll: time in ms to bufferize before playing streaming_ctrl->prebuffer_size = (unsigned int)(((double)fileh->preroll/1000.0)*((double)fileh->max_bitrate/8.0)); } @@ -287,7 +287,7 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl) int stream_count; char *ptr = &buffer[pos]; char *end = &buffer[size]; - + mp_msg(MSGT_NETWORK, MSGL_V, "Stream bitrate properties object\n"); if (ptr + 2 > end) goto len_err_out; stream_count = AV_RL16(ptr); @@ -352,7 +352,7 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl) // find best audio stream a_idx = max_idx(asf_ctrl->n_audio, a_rates, bw - v_rate); - + free(v_rates); free(a_rates); @@ -401,7 +401,7 @@ static int asf_http_streaming_read( int fd, char *buffer, int size, streaming_ct if (rest == 0 && waiting == 0) { if (asf_read_wrapper(fd, &chunk, sizeof(ASF_stream_chunck_t), streaming_ctrl) <= 0) return -1; - + // Endian handling of the stream chunk le2me_ASF_stream_chunck_t(&chunk); chunk_size = asf_streaming( &chunk, &drop_chunk ); @@ -410,7 +410,7 @@ static int asf_http_streaming_read( int fd, char *buffer, int size, streaming_ct return -1; } chunk_size -= sizeof(ASF_stream_chunck_t); - + if(chunk.type != ASF_STREAMING_HEADER && (!drop_chunk)) { if (asf_http_ctrl->packet_size < chunk_size) { mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Error: chunk_size > packet_size\n"); @@ -473,7 +473,7 @@ static int asf_http_streaming_type(char *content_type, char *features, HTTP_head if( !strcasecmp(content_type, "application/octet-stream") || !strcasecmp(content_type, "application/vnd.ms.wms-hdr.asfv1") || // New in Corona, first request !strcasecmp(content_type, "application/x-mms-framed") || // New in Corana, second request - !strcasecmp(content_type, "video/x-ms-asf")) { + !strcasecmp(content_type, "video/x-ms-asf")) { if( strstr(features, "broadcast") ) { mp_msg(MSGT_NETWORK,MSGL_V,"=====> ASF Live stream\n"); @@ -558,10 +558,10 @@ static HTTP_header_t *asf_http_request(streaming_ctrl_t *streaming_ctrl) { http_set_uri( http_hdr, url->file ); sprintf( str, "Host: %.220s:%d", url->hostname, url->port ); } - + http_set_field( http_hdr, str ); http_set_field( http_hdr, "Pragma: xClientGUID={c77e7400-738a-11d2-9add-0020af0a3278}" ); - sprintf(str, + sprintf(str, "Pragma: no-cache,rate=1.000000,stream-time=0,stream-offset=%u:%u,request-context=%d,max-duration=%u", offset_hi, offset_lo, asf_http_ctrl->request, length ); http_set_field( http_hdr, str ); @@ -643,7 +643,7 @@ static int asf_http_parse_response(asf_http_streaming_ctrl_t *asf_http_ctrl, HTT char *comma_ptr=NULL; char *end; //printf("Pragma: [%s]\n", pragma ); - // The pragma line can get severals attributes + // The pragma line can get severals attributes // separeted with a comma ','. do { if( !strncasecmp( pragma, "features=", 9) ) { @@ -651,7 +651,7 @@ static int asf_http_parse_response(asf_http_streaming_ctrl_t *asf_http_ctrl, HTT end = strstr( pragma, "," ); if( end==NULL ) { len = strlen(pragma); - } else { + } else { len = (unsigned int)(end-pragma); } if(len > sizeof(features) - 1) { @@ -716,7 +716,7 @@ static int asf_http_streaming_start( stream_t *stream, int *demuxer_type ) { goto err_out; } i += r; - } + } http_free( http_hdr ); http_hdr = http_new_header(); do { @@ -781,7 +781,7 @@ static int asf_http_streaming_start( stream_t *stream, int *demuxer_type ) { mp_tmsg(MSGT_NETWORK,MSGL_ERR,"unknown ASF streaming type\n"); goto err_out; } - // Check if we got a redirect. + // Check if we got a redirect. } while(!done); stream->fd = fd; @@ -820,7 +820,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { url = url_new(stream->url); stream->streaming_ctrl->url = check4proxies(url); url_free(url); - + mp_tmsg(MSGT_OPEN, MSGL_INFO, "STREAM_ASF, URL: %s\n", stream->url); if((!strncmp(stream->url, "http", 4)) && (*file_format!=DEMUXER_TYPE_ASF && *file_format!=DEMUXER_TYPE_UNKNOWN)) { streaming_ctrl_free(stream->streaming_ctrl); @@ -834,7 +834,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { stream->streaming_ctrl = NULL; return STREAM_UNSUPPORTED; } - + if (*file_format != DEMUXER_TYPE_PLAYLIST) *file_format = DEMUXER_TYPE_ASF; stream->type = STREAMTYPE_STREAM; @@ -852,4 +852,3 @@ const stream_info_t stream_info_asf = { NULL, 0 // Urls are an option string }; - diff --git a/stream/audio_in.c b/stream/audio_in.c index c092e7f500..99b5ccf7fb 100644 --- a/stream/audio_in.c +++ b/stream/audio_in.c @@ -43,7 +43,7 @@ int audio_in_init(audio_in_t *ai, int type) int audio_in_setup(audio_in_t *ai) { - + switch (ai->type) { #ifdef CONFIG_ALSA case AUDIO_IN_ALSA: @@ -178,7 +178,7 @@ int audio_in_start_capture(audio_in_t *ai) int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer) { int ret; - + switch (ai->type) { #ifdef CONFIG_ALSA case AUDIO_IN_ALSA: diff --git a/stream/audio_in.h b/stream/audio_in.h index 855d613964..d59b3b6c89 100644 --- a/stream/audio_in.h +++ b/stream/audio_in.h @@ -27,11 +27,11 @@ typedef struct { } ai_oss_t; #endif -typedef struct +typedef struct { int type; int setup; - + /* requested values */ int req_channels; int req_samplerate; @@ -42,7 +42,7 @@ typedef struct int blocksize; int bytes_per_sample; int samplesize; - + #ifdef CONFIG_ALSA ai_alsa_t alsa; #endif diff --git a/stream/cache2.c b/stream/cache2.c index d1f047b034..aeefa73b05 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -83,7 +83,7 @@ static int cache_read(cache_vars_t* s,unsigned char* buf,int size){ int pos,newb,len; //printf("CACHE2_READ: 0x%X <= 0x%X <= 0x%X \n",s->min_filepos,s->read_filepos,s->max_filepos); - + if(s->read_filepos>=s->max_filepos || s->read_fileposmin_filepos){ // eof? if(s->eof) break; @@ -103,21 +103,21 @@ static int cache_read(cache_vars_t* s,unsigned char* buf,int size){ if(newb>s->buffer_size-pos) newb=s->buffer_size-pos; // handle wrap... if(newb>size) newb=size; - + // check: if(s->read_fileposmin_filepos) mp_msg(MSGT_CACHE,MSGL_ERR,"Ehh. s->read_fileposmin_filepos !!! Report bug...\n"); - + // len=write(mem,newb) //printf("Buffer read: %d bytes\n",newb); memcpy(buf,&s->buffer[pos],newb); buf+=newb; len=newb; // ... - + s->read_filepos+=len; size-=len; total+=len; - + } cache_fill_status=(s->max_filepos-s->read_filepos)/(s->buffer_size / 100); return total; @@ -126,7 +126,7 @@ static int cache_read(cache_vars_t* s,unsigned char* buf,int size){ static int cache_fill(cache_vars_t* s){ int back,back2,newb,space,len,pos; off_t read=s->read_filepos; - + if(readmin_filepos || read>s->max_filepos){ // seek... mp_msg(MSGT_CACHE,MSGL_DBG2,"Out of boundaries... seeking to 0x%"PRIX64" \n",(int64_t)read); @@ -141,36 +141,36 @@ static int cache_fill(cache_vars_t* s){ mp_msg(MSGT_CACHE,MSGL_DBG2,"Seek done. new pos: 0x%"PRIX64" \n",(int64_t)stream_tell(s->stream)); } } - + // calc number of back-bytes: back=read - s->min_filepos; if(back<0) back=0; // strange... if(back>s->back_size) back=s->back_size; - + // calc number of new bytes: newb=s->max_filepos - read; if(newb<0) newb=0; // strange... // calc free buffer space: space=s->buffer_size - (newb+back); - + // calc bufferpos: pos=s->max_filepos - s->offset; if(pos>=s->buffer_size) pos-=s->buffer_size; // wrap-around - + if(spacefill_limit){ // printf("Buffer is full (%d bytes free, limit: %d)\n",space,s->fill_limit); return 0; // no fill... } // printf("### read=0x%X back=%d newb=%d space=%d pos=%d\n",read,back,newb,space,pos); - + // reduce space if needed: if(space>s->buffer_size-pos) space=s->buffer_size-pos; - + // if(space>32768) space=32768; // limit one-time block size if(space>4*s->sector_size) space=4*s->sector_size; - + // if(s->seek_lock) return 0; // FIXME #if 1 @@ -180,7 +180,7 @@ static int cache_fill(cache_vars_t* s){ #else s->min_filepos=read-back; // avoid seeking-back to temp area... #endif - + // .... //printf("Buffer fill: %d bytes of %d\n",space,s->buffer_size); //len=stream_fill_buffer(s->stream); @@ -188,15 +188,15 @@ static int cache_fill(cache_vars_t* s){ // .... len=stream_read(s->stream,&s->buffer[pos],space); if(!len) s->eof=1; - + s->max_filepos+=len; if(pos+len>=s->buffer_size){ // wrap... s->offset+=s->buffer_size; } - + return len; - + } static int cache_execute_control(cache_vars_t *s) { @@ -251,7 +251,7 @@ static cache_vars_t* cache_init(int size,int sector){ cache_vars_t* s=malloc(sizeof(cache_vars_t)); #endif if(s==NULL) return NULL; - + memset(s,0,sizeof(cache_vars_t)); num=size/sector; if(num < 16){ @@ -329,7 +329,7 @@ int stream_enable_cache(stream_t *stream,int size,int min,int seek_limit){ if (min > s->buffer_size - s->fill_limit) { min = s->buffer_size - s->fill_limit; } - + #if !defined(__MINGW32__) && !defined(PTHREAD_CACHE) && !defined(__OS2__) if((stream->cache_pid=fork())){ #else @@ -364,7 +364,7 @@ int stream_enable_cache(stream_t *stream,int size,int min,int seek_limit){ mp_msg(MSGT_CACHE,MSGL_STATUS,"\n"); return 1; // parent exits } - + #if defined(__MINGW32__) || defined(PTHREAD_CACHE) || defined(__OS2__) } #ifdef PTHREAD_CACHE @@ -373,7 +373,7 @@ static void *ThreadProc( void *s ){ static void ThreadProc( void *s ){ #endif #endif - + #ifdef CONFIG_GUI use_gui = 0; // mp_msg may not use gui stuff in forked code #endif @@ -418,10 +418,10 @@ int cache_stream_seek_long(stream_t *stream,off_t pos){ cache_vars_t* s; off_t newpos; if(!stream->cache_pid) return stream_seek_long(stream,pos); - + s=stream->cache_data; // s->seek_lock=1; - + mp_msg(MSGT_CACHE,MSGL_DBG2,"CACHE2_SEEK: 0x%"PRIX64" <= 0x%"PRIX64" (0x%"PRIX64") <= 0x%"PRIX64" \n",s->min_filepos,pos,s->read_filepos,s->max_filepos); newpos=pos/s->sector_size; newpos*=s->sector_size; // align diff --git a/stream/cdd.h b/stream/cdd.h index 1208684769..97c039b3d0 100644 --- a/stream/cdd.h +++ b/stream/cdd.h @@ -11,7 +11,7 @@ #endif typedef struct { - char cddb_hello[1024]; + char cddb_hello[1024]; unsigned long disc_id; unsigned int tracks; char *cache_dir; diff --git a/stream/cdinfo.c b/stream/cdinfo.c index 48e970c72b..4da80c71a1 100644 --- a/stream/cdinfo.c +++ b/stream/cdinfo.c @@ -1,5 +1,5 @@ /* - * CD Info + * CD Info * by Bertrand Baudet * (C) 2002, MPlayer team. */ @@ -22,15 +22,15 @@ cd_info_t* cd_info_new(void) { cd_info_t *cd_info = NULL; - + cd_info = malloc(sizeof(cd_info_t)); if( cd_info==NULL ) { mp_tmsg(MSGT_DEMUX, MSGL_ERR, "Memory allocation failed.\n"); return NULL; } - + memset(cd_info, 0, sizeof(cd_info_t)); - + return cd_info; } @@ -54,16 +54,16 @@ cd_info_free(cd_info_t *cd_info) { cd_track_t* cd_info_add_track(cd_info_t *cd_info, char *track_name, unsigned int track_nb, unsigned int min, unsigned int sec, unsigned int msec, unsigned long frame_begin, unsigned long frame_length) { cd_track_t *cd_track; - + if( cd_info==NULL || track_name==NULL ) return NULL; - + cd_track = malloc(sizeof(cd_track_t)); if( cd_track==NULL ) { mp_tmsg(MSGT_DEMUX, MSGL_ERR, "Memory allocation failed.\n"); return NULL; } memset(cd_track, 0, sizeof(cd_track_t)); - + cd_track->name = malloc(strlen(track_name)+1); if( cd_track->name==NULL ) { mp_tmsg(MSGT_DEMUX, MSGL_ERR, "Memory allocation failed.\n"); @@ -86,12 +86,12 @@ cd_info_add_track(cd_info_t *cd_info, char *track_name, unsigned int track_nb, u } cd_track->prev = cd_info->last; - + cd_info->last = cd_track; cd_info->current = cd_track; cd_info->nb_tracks++; - + return cd_track; } diff --git a/stream/cookies.c b/stream/cookies.c index ea46c42419..40a5b16097 100644 --- a/stream/cookies.c +++ b/stream/cookies.c @@ -191,8 +191,8 @@ static struct cookie_list_type *load_cookies(void) if (dir) { while ((ent = readdir(dir)) != NULL) { if ((ent->d_name)[0] != '.') { - buf = malloc(strlen(getenv("HOME")) + - sizeof("/.mozilla/default/") + + buf = malloc(strlen(getenv("HOME")) + + sizeof("/.mozilla/default/") + strlen(ent->d_name) + sizeof("cookies.txt") + 1); sprintf(buf, "%s/.mozilla/default/%s/cookies.txt", getenv("HOME"), ent->d_name); diff --git a/stream/cookies.h b/stream/cookies.h index f4c2a0525e..bbfb9f0598 100644 --- a/stream/cookies.h +++ b/stream/cookies.h @@ -1,7 +1,7 @@ /* * HTTP Cookies * Reads Netscape and Mozilla cookies.txt files - * + * * by Dave Lambley */ diff --git a/stream/dvb_tune.c b/stream/dvb_tune.c index b631e13e73..8b7bdb7317 100644 --- a/stream/dvb_tune.c +++ b/stream/dvb_tune.c @@ -165,7 +165,7 @@ int dvb_fix_demuxes(dvb_priv_t *priv, int cnt) #else sprintf(demux_dev, "/dev/ost/demux%d", priv->card); #endif - + mp_msg(MSGT_DEMUX, MSGL_V, "FIX %d -> %d\n", priv->demux_fds_cnt, cnt); if(priv->demux_fds_cnt >= cnt) { @@ -189,9 +189,9 @@ int dvb_fix_demuxes(dvb_priv_t *priv, int cnt) } else priv->demux_fds_cnt++; - } + } } - + return 1; } @@ -396,7 +396,7 @@ static int check_status(int fd_frontend, int tmout) strength=0; if(ioctl(fd_frontend,FE_READ_UNCORRECTED_BLOCKS,&strength) >= 0) mp_msg(MSGT_DEMUX, MSGL_V, "UNC: %d\n",strength); - + print_status(festatus); } else @@ -415,7 +415,7 @@ static int check_status(int fd_frontend, int tmout) int32_t strength; fe_status_t festatus; FrontendEvent event; - + struct pollfd pfd[1]; i = 0; res = -1; @@ -484,12 +484,12 @@ static int check_status(int fd_frontend, int tmout) festatus=0; mp_msg(MSGT_DEMUX, MSGL_V, "FE_STATUS:"); - + if(ioctl(fd_frontend,FE_READ_STATUS,&festatus) >= 0) print_status(festatus); else mp_msg(MSGT_DEMUX, MSGL_ERR, " ERROR, UNABLE TO READ_STATUS"); - + mp_msg(MSGT_DEMUX, MSGL_V, "\n"); } else @@ -568,14 +568,14 @@ static int do_diseqc(int secfd, int sat_no, int polv, int hi_lo) scmd.u.diseqc.params[0] = 0xf0 | (((sat_no) << 2) & 0x0F) | (hi_lo ? 1 : 0) | - (polv ? 0 : 2); + (polv ? 0 : 2); if (ioctl(secfd,SEC_SEND_SEQUENCE,&scmds) < 0) { mp_msg(MSGT_DEMUX, MSGL_ERR, "Error sending DisEqC"); return -1; } - + return 0; } #endif diff --git a/stream/freesdp/common.h b/stream/freesdp/common.h index ae59406049..bd051a57a7 100644 --- a/stream/freesdp/common.h +++ b/stream/freesdp/common.h @@ -127,7 +127,7 @@ typedef enum } fsdp_error_t; /** - * @short Type of network + * @short Type of network * * Initially, SDP defines "Internet". New network types may be * registered with IANA. However, the number of types is expected to @@ -154,7 +154,7 @@ typedef enum } fsdp_address_type_t; /** - * @short Type of bandwith modifiers + * @short Type of bandwith modifiers * * Bandwidth modifiers specify the meaning of the bandwidth * value. Initially "Conference Total" and "Application Specific" are diff --git a/stream/freesdp/parser.c b/stream/freesdp/parser.c index bf6f985e94..34e6737a05 100644 --- a/stream/freesdp/parser.c +++ b/stream/freesdp/parser.c @@ -1,7 +1,7 @@ /* This file is part of FreeSDP Copyright (C) 2001,2002,2003 Federico Montesino Pouzols - + FreeSDP is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -380,7 +380,7 @@ fsdp_parse (const char *text_description, fsdp_description_t * dsc) } /* `k=' line (encryption key) [optional] */ - /* k= + /* k= k=: */ result = fsdp_parse_k (&p, &(dsc->k_encryption_method), &(dsc->k_encryption_content)); @@ -687,7 +687,7 @@ fsdp_parse (const char *text_description, fsdp_description_t * dsc) return result; /* `k=' line (encryption key) [optional] */ - /* k= + /* k= k=: */ result = fsdp_parse_k (&p, &(media->k_encryption_method), &(media->k_encryption_content)); diff --git a/stream/freesdp/parser.h b/stream/freesdp/parser.h index 80c61d0115..76d10adb5b 100644 --- a/stream/freesdp/parser.h +++ b/stream/freesdp/parser.h @@ -46,7 +46,7 @@ BEGIN_C_DECLS * functions. * * @param description a multimedia session description formatted in - * SDP. + * SDP. * @param dsc pointer that is updated to point to a fsdp_description_t * object. This fsdp_description_t object should have been previously * allocated using fsdp_description_new(); to free it, @@ -60,12 +60,12 @@ fsdp_error_t fsdp_parse (const char *description, fsdp_description_t * dsc); /** * Get the SDP protocol version of the description. * - * @return SDP protocol version number. + * @return SDP protocol version number. **/ unsigned int fsdp_get_version (const fsdp_description_t * dsc); /** - * Get the username provided by the originator of the session. + * Get the username provided by the originator of the session. * * @param dsc SDP description object. * @return username of the session owner @@ -73,7 +73,7 @@ unsigned int fsdp_get_version (const fsdp_description_t * dsc); const char *fsdp_get_owner_username (const fsdp_description_t * dsc); /** - * Get the id for the session described in dsc. + * Get the id for the session described in dsc. * * @param dsc SDP description object. * @return id string for this session. @@ -241,7 +241,7 @@ unsigned int fsdp_get_bw_modifier_count (const fsdp_description_t * dsc); * @param dsc SDP description object. * @param index number of bandwidth modifier. * - * @return global bandwidth modifier type. + * @return global bandwidth modifier type. * @retval FSDP_BW_MOD_TYPE_UNDEFINED if no global bandwith modifier * type is defined or invalid index. * @retval FSDP_BW_MOD_TYPE_UNKNOWN if an unknown bandwith modifier is @@ -254,7 +254,7 @@ fsdp_get_bw_modifier_type (const fsdp_description_t * dsc, unsigned int index); /** - * Get the textual bandwidth modifier type when it is unknown. + * Get the textual bandwidth modifier type when it is unknown. * * @param dsc SDP description object. * @param index number of bandwidth modifier. @@ -267,7 +267,7 @@ const char *fsdp_get_bw_modifier_type_unknown (const fsdp_description_t * dsc, unsigned int index); /** - * Get the value for the bandwidth modifier. + * Get the value for the bandwidth modifier. * * @param dsc SDP description object. * @param index number of bandwidth modifier. @@ -474,7 +474,7 @@ unsigned int fsdp_get_sdplang_count (const fsdp_description_t * dsc); const char *fsdp_get_sdplang (const fsdp_description_t * dsc, unsigned int index); -/** +/** * Get the mode of the conference, specified with attributes sendrecv, * sendonly, recvonly and inactive. * diff --git a/stream/freesdp/parserpriv.h b/stream/freesdp/parserpriv.h index 9d44102d31..b6762a4d55 100644 --- a/stream/freesdp/parserpriv.h +++ b/stream/freesdp/parserpriv.h @@ -33,12 +33,12 @@ * Parse a connection (c=
) line. If the textual description in p begins * with a connection line, it is parsed. If not, nothing is done. - * + * * @param p fraction of textual SDP description. * @param ntype where to store the network type. * @param atype where to store the address type. * @param address where to store the connection address as a string. - * + * * @return parse error code. **/ static fsdp_error_t @@ -51,7 +51,7 @@ fsdp_parse_c (const char **p, fsdp_network_type_t * ntype, * textual description in p begins with a bandwidth line, * it is parsed as well as all b lines inmediately after it. If not, * nothing is done. - * + * * @param p fraction of textual SDP description. * @param bw_modifiers pointer to empty array of bandwidth modifiers to fill. * @param bw_modifiers_count where to set the number of bandwidth @@ -96,11 +96,11 @@ static fsdp_error_t fsdp_parse_rtpmap (fsdp_rtpmap_t *** rtpmap, unsigned int *counter, const char *value); -/** +/** * Maximun default field len for "expected to be short" fields, like * username, session_id or inet addresses. * - * MDFLENS value must be MAXSHORTFIELDLEN - 1 + * MDFLENS value must be MAXSHORTFIELDLEN - 1 **/ #define MAXSHORTFIELDLEN 96 #define MSFLENS "95" diff --git a/stream/freesdp/priv.h b/stream/freesdp/priv.h index 4a16830356..07d6e3dfb3 100644 --- a/stream/freesdp/priv.h +++ b/stream/freesdp/priv.h @@ -51,13 +51,13 @@ /** * @example formatdemo.c - * + * * A basic SDP descriptions formatter based on FreeSDP. **/ /** * @example parsedemo.c - * + * * A basic SDP descriptions parser based on FreeSDP. **/ diff --git a/stream/frequencies.c b/stream/frequencies.c index 122cbbfe5e..5d8fe9b66a 100644 --- a/stream/frequencies.c +++ b/stream/frequencies.c @@ -75,7 +75,7 @@ static const struct CHANLIST ntsc_bcast[] = { { "67", 789250 }, { "68", 795250 }, { "69", 801250 }, - + { "70", 807250 }, { "71", 813250 }, { "72", 819250 }, @@ -115,7 +115,7 @@ static const struct CHANLIST ntsc_cable[] = { { "18", 145250 }, { "19", 151250 }, { "20", 157250 }, - + { "21", 163250 }, { "22", 169250 }, { "23", 217250 }, @@ -165,7 +165,7 @@ static const struct CHANLIST ntsc_cable[] = { { "67", 481250 }, { "68", 487250 }, { "69", 493250 }, - + { "70", 499250 }, { "71", 505250 }, { "72", 511250 }, @@ -222,7 +222,7 @@ static const struct CHANLIST ntsc_cable[] = { { "123", 787250 }, { "124", 793250 }, { "125", 799250 }, - + { "T7", 8250 }, { "T8", 14250 }, { "T9", 20250 }, @@ -236,11 +236,11 @@ static const struct CHANLIST ntsc_cable[] = { /* US HRC */ static const struct CHANLIST ntsc_hrc[] = { { "1", 72000 }, - { "2", 54000 }, - { "3", 60000 }, - { "4", 66000 }, - { "5", 78000 }, - { "6", 84000 }, + { "2", 54000 }, + { "3", 60000 }, + { "4", 66000 }, + { "5", 78000 }, + { "6", 84000 }, { "7", 174000 }, { "8", 180000 }, { "9", 186000 }, @@ -256,7 +256,7 @@ static const struct CHANLIST ntsc_hrc[] = { { "18", 144000 }, { "19", 150000 }, { "20", 156000 }, - + { "21", 162000 }, { "22", 168000 }, { "23", 216000 }, @@ -306,7 +306,7 @@ static const struct CHANLIST ntsc_hrc[] = { { "67", 480000 }, { "68", 486000 }, { "69", 492000 }, - + { "70", 498000 }, { "71", 504000 }, { "72", 510000 }, @@ -363,15 +363,15 @@ static const struct CHANLIST ntsc_hrc[] = { { "123", 786000 }, { "124", 792000 }, { "125", 798000 }, - - { "T7", 7000 }, - { "T8", 13000 }, - { "T9", 19000 }, - { "T10", 25000 }, - { "T11", 31000 }, - { "T12", 37000 }, - { "T13", 43000 }, - { "T14", 49000 }, + + { "T7", 7000 }, + { "T8", 13000 }, + { "T9", 19000 }, + { "T10", 25000 }, + { "T11", 31000 }, + { "T12", 37000 }, + { "T13", 43000 }, + { "T14", 49000 }, }; /* --------------------------------------------------------------------- */ @@ -454,7 +454,7 @@ static const struct CHANLIST ntsc_cable_jp[] = { { "18", 139250 }, { "19", 145250 }, { "20", 151250 }, - + { "21", 157250 }, { "22", 165250 }, { "23", 223250 }, @@ -840,8 +840,8 @@ static const struct CHANLIST secam_france[] = { /* --------------------------------------------------------------------- */ static const struct CHANLIST pal_newzealand[] = { - { "1", 45250 }, - { "2", 55250 }, + { "1", 45250 }, + { "2", 55250 }, { "3", 62250 }, { "4", 175250 }, { "5", 182250 }, diff --git a/stream/frequencies.h b/stream/frequencies.h index bf822d468b..25795a4899 100644 --- a/stream/frequencies.h +++ b/stream/frequencies.h @@ -3,7 +3,7 @@ * * Nathan Laredo (laredo@broked.net) * - * Frequencies are given in kHz + * Frequencies are given in kHz */ #ifndef MPLAYER_FREQUENCIES_H @@ -20,7 +20,7 @@ containing 8 bits frame sync, 5 bits control, 11 bits additional data, and 704 bits audio data. The bit rate is reduced by transmitting only 10 bits plus parity of each 14 bit sample, the largest sample in a frame determines - which 10 bits are transmitted. The parity bits for audio samples also + which 10 bits are transmitted. The parity bits for audio samples also specify the scaling factor used for that channel during that frame. The companeded audio data is interleaved to reduce the influence of dropouts and the whole frame except for sync bits is scrambled for spectrum shaping. diff --git a/stream/http.c b/stream/http.c index 3286591943..498e40473c 100644 --- a/stream/http.c +++ b/stream/http.c @@ -1,4 +1,4 @@ -/* +/* * HTTP Helper * by Bertrand Baudet * (C) 2001, MPlayer team. @@ -204,7 +204,7 @@ static int nop_streaming_start( stream_t *stream ) { fd = stream->fd; if( fd<0 ) { - fd = http_send_request( stream->streaming_ctrl->url, 0 ); + fd = http_send_request( stream->streaming_ctrl->url, 0 ); if( fd<0 ) return -1; http_hdr = http_read_response( fd ); if( http_hdr==NULL ) return -1; @@ -233,7 +233,7 @@ static int nop_streaming_start( stream_t *stream ) { if (next_url != NULL && rd_url != NULL) { mp_msg(MSGT_NETWORK,MSGL_STATUS,"Redirected: Using this url instead %s\n",next_url); stream->streaming_ctrl->url=check4proxies(rd_url); - ret=nop_streaming_start(stream); //recursively get streaming started + ret=nop_streaming_start(stream); //recursively get streaming started } else { mp_msg(MSGT_NETWORK,MSGL_ERR,"Redirection failed\n"); closesocket( fd ); @@ -333,7 +333,7 @@ int http_is_header_entire( HTTP_header_t *http_hdr ) { if( http_hdr==NULL ) return -1; if( http_hdr->buffer==NULL ) return 0; // empty - + if( strstr(http_hdr->buffer, "\r\n\r\n")==NULL && strstr(http_hdr->buffer, "\n\n")==NULL ) return 0; return 1; @@ -424,7 +424,7 @@ http_response_parse( HTTP_header_t *http_hdr ) { http_set_field( http_hdr, field ); hdr_ptr = ptr+((*ptr=='\r')?2:1); } while( hdr_ptr<(http_hdr->buffer+pos_hdr_sep) ); - + if( field!=NULL ) free( field ); if( pos_hdr_sep+hdr_sep_lenbuffer_size ) { @@ -459,7 +459,7 @@ http_build_request( HTTP_header_t *http_hdr ) { // Add the Method line len = strlen(http_hdr->method)+strlen(uri)+12; // Add the fields - field = http_hdr->first_field; + field = http_hdr->first_field; while( field!=NULL ) { len += strlen(field->field_name)+2; field = field->next; @@ -499,7 +499,7 @@ http_build_request( HTTP_header_t *http_hdr ) { } if( uri ) free( uri ); - return http_hdr->buffer; + return http_hdr->buffer; } char * @@ -522,7 +522,7 @@ http_get_next_field( HTTP_header_t *http_hdr ) { if( http_hdr==NULL ) return NULL; field = http_hdr->field_search_pos; - while( field!=NULL ) { + while( field!=NULL ) { ptr = strstr( field->field_name, ":" ); if( ptr==NULL ) return NULL; if( !strncasecmp( field->field_name, http_hdr->field_search, ptr-(field->field_name) ) ) { @@ -598,7 +598,7 @@ http_add_basic_authentication( HTTP_header_t *http_hdr, const char *username, co if( password!=NULL ) { pass_len = strlen(password); } - + usr_pass = malloc(strlen(username)+pass_len+2); if( usr_pass==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed\n"); @@ -622,22 +622,22 @@ http_add_basic_authentication( HTTP_header_t *http_hdr, const char *username, co } b64_usr_pass[out_len]='\0'; - + auth = malloc(encoded_len+22); if( auth==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed\n"); goto out; } - + sprintf( auth, "Authorization: Basic %s", b64_usr_pass); http_set_field( http_hdr, auth ); res = 0; - + out: free( usr_pass ); free( b64_usr_pass ); free( auth ); - + return res; } @@ -665,7 +665,7 @@ http_debug_hdr( HTTP_header_t *http_hdr ) { mp_msg(MSGT_NETWORK,MSGL_V,"--- HTTP DEBUG HEADER --- END ---\n"); } -int +int base64_encode(const void *enc, int encLen, char *out, int outMax) { static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; @@ -764,7 +764,7 @@ static int http_streaming_start(stream_t *stream, int* file_format) { if( mp_msg_test(MSGT_NETWORK,MSGL_V) ) { http_debug_hdr( http_hdr ); } - + // Check if we can make partial content requests and thus seek in http-streams if( http_hdr!=NULL && http_hdr->status_code==200 ) { char *accept_ranges; @@ -780,8 +780,8 @@ static int http_streaming_start(stream_t *stream, int* file_format) { switch( http_hdr->status_code ) { case 200: { // OK char *field_data; - // If content-type == video/nsv we most likely have a winamp video stream - // otherwise it should be mp3. if there are more types consider adding mime type + // If content-type == video/nsv we most likely have a winamp video stream + // otherwise it should be mp3. if there are more types consider adding mime type // handling like later if ( (field_data = http_get_field(http_hdr, "content-type")) != NULL && (!strcmp(field_data, "video/nsv") || !strcmp(field_data, "misc/ultravox"))) *file_format = DEMUXER_TYPE_NSV; @@ -810,7 +810,7 @@ static int http_streaming_start(stream_t *stream, int* file_format) { } } - // Assume standard http if not ICY + // Assume standard http if not ICY switch( http_hdr->status_code ) { case 200: // OK // Look if we can use the Content-Type @@ -858,7 +858,7 @@ static int http_streaming_start(stream_t *stream, int* file_format) { free(url->protocol); url->protocol = strdup("unsv"); } - redirect = 1; + redirect = 1; } break; case 401: // Authentication required @@ -922,7 +922,7 @@ static int open_s1(stream_t *stream,int mode, void* opts, int* file_format) { url = url_new(stream->url); stream->streaming_ctrl->url = check4proxies(url); url_free(url); - + mp_msg(MSGT_OPEN, MSGL_V, "STREAM_HTTP(1), URL: %s\n", stream->url); seekable = http_streaming_start(stream, file_format); if((seekable < 0) || (*file_format == DEMUXER_TYPE_ASF)) { @@ -951,7 +951,7 @@ static int open_s2(stream_t *stream,int mode, void* opts, int* file_format) { url = url_new(stream->url); stream->streaming_ctrl->url = check4proxies(url); url_free(url); - + mp_msg(MSGT_OPEN, MSGL_V, "STREAM_HTTP(2), URL: %s\n", stream->url); seekable = http_streaming_start(stream, file_format); if(seekable < 0) { diff --git a/stream/http.h b/stream/http.h index 345dd5bfb9..849ebf06a3 100644 --- a/stream/http.h +++ b/stream/http.h @@ -1,4 +1,4 @@ -/* +/* * HTTP Helper * by Bertrand Baudet * (C) 2001, MPlayer team. diff --git a/stream/librtsp/rtsp.c b/stream/librtsp/rtsp.c index 8012174d99..53ed233c53 100644 --- a/stream/librtsp/rtsp.c +++ b/stream/librtsp/rtsp.c @@ -59,12 +59,12 @@ /* * network utilities */ - + static int write_stream(int s, const char *buf, int len) { int total, timeout; total = 0; timeout = 30; - while (total < len){ + while (total < len){ int n; n = send (s, &buf[total], len - total, 0); @@ -87,37 +87,37 @@ static int write_stream(int s, const char *buf, int len) { } static ssize_t read_stream(int fd, void *buf, size_t count) { - + ssize_t ret, total; total = 0; while (total < count) { - + ret=recv (fd, ((uint8_t*)buf)+total, count-total, 0); if (ret<0) { if(errno == EAGAIN) { fd_set rset; struct timeval timeout; - + FD_ZERO (&rset); FD_SET (fd, &rset); - + timeout.tv_sec = 30; timeout.tv_usec = 0; - + if (select (fd+1, &rset, NULL, NULL, &timeout) <= 0) { return -1; } continue; } - + mp_msg(MSGT_OPEN, MSGL_ERR, "rtsp: read error.\n"); return ret; } else total += ret; - + /* end of stream */ if (!ret) break; } @@ -129,7 +129,7 @@ static ssize_t read_stream(int fd, void *buf, size_t count) { * rtsp_get gets a line from stream * and returns a null terminated string. */ - + static char *rtsp_get(rtsp_t *s) { int n=1; @@ -154,7 +154,7 @@ static char *rtsp_get(rtsp_t *s) { #ifdef LOG mp_msg(MSGT_OPEN, MSGL_INFO, "librtsp: << '%s'\n", string); #endif - + free(buffer); return string; @@ -163,7 +163,7 @@ static char *rtsp_get(rtsp_t *s) { /* * rtsp_put puts a line on stream */ - + static void rtsp_put(rtsp_t *s, const char *string) { int len=strlen(string); @@ -178,7 +178,7 @@ static void rtsp_put(rtsp_t *s, const char *string) { buf[len+1]=0x0a; write_stream(s->s, buf, len+2); - + #ifdef LOG mp_msg(MSGT_OPEN, MSGL_INFO, " done.\n"); #endif @@ -194,7 +194,7 @@ static int rtsp_get_code(const char *string) { char buf[4]; int code=0; - + if (!strncmp(string, RTSP_PROTOCOL_VERSION, strlen(RTSP_PROTOCOL_VERSION))) { memcpy(buf, string+strlen(RTSP_PROTOCOL_VERSION)+1, 3); @@ -218,9 +218,9 @@ static void rtsp_send_request(rtsp_t *s, const char *type, const char *what) { char **payload=s->scheduled; char *buf; - + buf = malloc(strlen(type)+strlen(what)+strlen(RTSP_PROTOCOL_VERSION)+3); - + sprintf(buf,"%s %s %s",type, what, RTSP_PROTOCOL_VERSION); rtsp_put(s,buf); free(buf); @@ -240,10 +240,10 @@ static void rtsp_send_request(rtsp_t *s, const char *type, const char *what) { static void rtsp_schedule_standard(rtsp_t *s) { char tmp[17]; - + snprintf(tmp, 17, "CSeq: %u", s->cseq); rtsp_schedule_field(s, tmp); - + if (s->session) { char *buf; buf = malloc(strlen(s->session)+15); @@ -255,7 +255,7 @@ static void rtsp_schedule_standard(rtsp_t *s) { /* * get the answers, if server responses with something != 200, return NULL */ - + static int rtsp_get_answers(rtsp_t *s) { char *answer=NULL; @@ -263,7 +263,7 @@ static int rtsp_get_answers(rtsp_t *s) { char **answer_ptr=s->answers; int code; int ans_count = 0; - + answer=rtsp_get(s); if (!answer) return 0; @@ -271,13 +271,13 @@ static int rtsp_get_answers(rtsp_t *s) { free(answer); rtsp_free_answers(s); - + do { /* while we get answer lines */ - + answer=rtsp_get(s); if (!answer) return 0; - + if (!strncasecmp(answer,"CSeq:",5)) { sscanf(answer,"%*s %u",&answer_seq); if (s->cseq != answer_seq) { @@ -315,12 +315,12 @@ static int rtsp_get_answers(rtsp_t *s) { *answer_ptr=answer; answer_ptr++; } while ((strlen(answer)!=0) && (++ans_count < MAX_FIELDS)); - + s->cseq++; - + *answer_ptr=NULL; rtsp_schedule_standard(s); - + return code; } @@ -330,7 +330,7 @@ static int rtsp_get_answers(rtsp_t *s) { int rtsp_send_ok(rtsp_t *s) { char cseq[16]; - + rtsp_put(s, "RTSP/1.0 200 OK"); sprintf(cseq,"CSeq: %u", s->cseq); rtsp_put(s, cseq); @@ -373,7 +373,7 @@ int rtsp_request_describe(rtsp_t *s, const char *what) { } rtsp_send_request(s,RTSP_METHOD_DESCRIBE,buf); free(buf); - + return rtsp_get_answers(s); } @@ -388,12 +388,12 @@ int rtsp_request_setup(rtsp_t *s, const char *what, char *control) { int len = strlen (s->host) + strlen (s->path) + 16; if (control) len += strlen (control) + 1; - + buf = malloc (len); sprintf (buf, "rtsp://%s:%i/%s%s%s", s->host, s->port, s->path, control ? "/" : "", control ? control : ""); } - + rtsp_send_request (s, RTSP_METHOD_SETUP, buf); free (buf); return rtsp_get_answers (s); @@ -412,7 +412,7 @@ int rtsp_request_setparameter(rtsp_t *s, const char *what) { } rtsp_send_request(s,RTSP_METHOD_SET_PARAMETER,buf); free(buf); - + return rtsp_get_answers(s); } @@ -420,7 +420,7 @@ int rtsp_request_play(rtsp_t *s, const char *what) { char *buf; int ret; - + if (what) { buf=strdup(what); } else @@ -430,7 +430,7 @@ int rtsp_request_play(rtsp_t *s, const char *what) { } rtsp_send_request(s,RTSP_METHOD_PLAY,buf); free(buf); - + ret = rtsp_get_answers (s); if (ret == RTSP_STATUS_OK) s->server_state = RTSP_PLAYING; @@ -441,7 +441,7 @@ int rtsp_request_play(rtsp_t *s, const char *what) { int rtsp_request_teardown(rtsp_t *s, const char *what) { char *buf; - + if (what) buf = strdup (what); else @@ -474,7 +474,7 @@ int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size) { { char *rest=rtsp_get(s); if (!rest) - return -1; + return -1; seq=-1; do { @@ -540,10 +540,10 @@ rtsp_t *rtsp_connect(int fd, char* mrl, char *path, char *host, int port, char * s->server=NULL; s->server_state=0; s->server_caps=0; - + s->cseq=0; s->session=NULL; - + if (user_agent) s->user_agent=strdup(user_agent); else @@ -587,7 +587,7 @@ char *rtsp_search_answers(rtsp_t *s, const char *tag) { char **answer; char *ptr; - + if (!s->answers) return NULL; answer=s->answers; @@ -652,7 +652,7 @@ char *rtsp_get_param(rtsp_t *s, const char *p) { } return NULL; } - + /* * schedules a field for transmission */ @@ -660,7 +660,7 @@ char *rtsp_get_param(rtsp_t *s, const char *p) { void rtsp_schedule_field(rtsp_t *s, const char *string) { int i=0; - + if (!string) return; while(s->scheduled[i]) { @@ -670,13 +670,13 @@ void rtsp_schedule_field(rtsp_t *s, const char *string) { } /* - * removes the first scheduled field which prefix matches string. + * removes the first scheduled field which prefix matches string. */ void rtsp_unschedule_field(rtsp_t *s, const char *string) { char **ptr=s->scheduled; - + if (!string) return; while(*ptr) { @@ -699,7 +699,7 @@ void rtsp_unschedule_field(rtsp_t *s, const char *string) { void rtsp_unschedule_all(rtsp_t *s) { char **ptr; - + if (!s->scheduled) return; ptr=s->scheduled; @@ -716,7 +716,7 @@ void rtsp_unschedule_all(rtsp_t *s) { void rtsp_free_answers(rtsp_t *s) { char **answer; - + if (!s->answers) return; answer=s->answers; diff --git a/stream/librtsp/rtsp.h b/stream/librtsp/rtsp.h index efca1f7779..5252f8de22 100644 --- a/stream/librtsp/rtsp.h +++ b/stream/librtsp/rtsp.h @@ -28,7 +28,7 @@ * 2006, Benjamin Zores and Vincent Mussard * fixed a lot of RFC compliance issues. */ - + #ifndef MPLAYER_RTSP_H #define MPLAYER_RTSP_H @@ -65,7 +65,7 @@ struct rtsp_s { char *server; unsigned int server_state; uint32_t server_caps; - + unsigned int cseq; char *session; diff --git a/stream/librtsp/rtsp_rtp.c b/stream/librtsp/rtsp_rtp.c index 66c7be4a36..37400e62d1 100644 --- a/stream/librtsp/rtsp_rtp.c +++ b/stream/librtsp/rtsp_rtp.c @@ -57,7 +57,7 @@ #define RTSP_NPT_NOW "npt=now-" #define RTSP_MEDIA_CONTAINER_MPEG_TS "33" #define RTSP_TRANSPORT_REQUEST "Transport: RTP/AVP;%s;%s%i-%i;mode=\"PLAY\"" - + #define RTSP_TRANSPORT_MULTICAST "multicast" #define RTSP_TRANSPORT_UNICAST "unicast" @@ -82,7 +82,7 @@ rtcp_send_rr (rtsp_t *s, struct rtp_rtsp_session_t *st) { if (st->rtcp_socket == -1) return; - + /* send RTCP RR every RTCP_SEND_FREQUENCY packets * FIXME : NOT CORRECT, HARDCODED, BUT MAKES SOME SERVERS HAPPY * not rfc compliant @@ -108,14 +108,14 @@ static struct rtp_rtsp_session_t * rtp_session_new (void) { struct rtp_rtsp_session_t *st = NULL; - + st = malloc (sizeof (struct rtp_rtsp_session_t)); - + st->rtp_socket = -1; st->rtcp_socket = -1; st->control_url = NULL; st->count = 0; - + return st; } @@ -153,7 +153,7 @@ parse_port (const char *line, const char *param, char *parse1; char *parse2; char *parse3; - + char *line_copy = strdup (line); parse1 = strstr (line_copy, param); @@ -161,14 +161,14 @@ parse_port (const char *line, const char *param, if (parse1) { parse2 = strstr (parse1, "-"); - + if (parse2) { parse3 = strstr (parse2, ";"); - + if (parse3) parse3[0] = 0; - + parse2[0] = 0; } else @@ -182,12 +182,12 @@ parse_port (const char *line, const char *param, free (line_copy); return 0; } - + *rtp_port = atoi (parse1 + strlen (param)); *rtcp_port = atoi (parse2 + 1); free (line_copy); - + return 1; } @@ -200,21 +200,21 @@ parse_destination (const char *line) char *dest = NULL; char *line_copy = strdup (line); int len; - + parse1 = strstr (line_copy, RTSP_SETUP_DESTINATION); if (!parse1) { free (line_copy); return NULL; } - + parse2 = strstr (parse1, ";"); if (!parse2) { free (line_copy); return NULL; } - + len = strlen (parse1) - strlen (parse2) - strlen (RTSP_SETUP_DESTINATION) + 1; dest = (char *) malloc (len + 1); @@ -230,7 +230,7 @@ rtcp_connect (int client_port, int server_port, const char* server_hostname) struct sockaddr_in sin; struct hostent *hp; int s; - + if (client_port <= 1023) return -1; @@ -249,7 +249,7 @@ rtcp_connect (int client_port, int server_port, const char* server_hostname) sin.sin_family = AF_INET; sin.sin_addr.s_addr = INADDR_ANY; sin.sin_port = htons (client_port); - + if (bind (s, (struct sockaddr *) &sin, sizeof (sin))) { #if !HAVE_WINSOCK2_H @@ -262,7 +262,7 @@ rtcp_connect (int client_port, int server_port, const char* server_hostname) return -1; } } - + sin.sin_family = AF_INET; memcpy (&(sin.sin_addr.s_addr), hp->h_addr, sizeof (hp->h_addr)); sin.sin_port = htons (server_port); @@ -328,7 +328,7 @@ rtp_connect (char *hostname, int port) return -1; } } - + /* datagram socket */ if (bind (s, (struct sockaddr *) &sin, sizeof (sin))) { @@ -346,10 +346,10 @@ rtp_connect (char *hostname, int port) tv.tv_sec = 1; /* 1 second timeout */ tv.tv_usec = 0; - + FD_ZERO (&set); FD_SET (s, &set); - + err = select (s + 1, &set, NULL, NULL, &tv); if (err < 0) { @@ -363,7 +363,7 @@ rtp_connect (char *hostname, int port) close (s); return -1; } - + err_len = sizeof (err); getsockopt (s, SOL_SOCKET, SO_ERROR, &err, (socklen_t *) &err_len); if (err) @@ -372,7 +372,7 @@ rtp_connect (char *hostname, int port) close (s); return -1; } - + return s; } @@ -383,7 +383,7 @@ is_multicast_address (char *addr) if (!addr) return -1; - + sin.sin_family = AF_INET;