summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2002-05-06 21:40:02 +0000
committerDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2002-05-06 21:40:02 +0000
commit01336c065f6c2966dfc2d9d8e17359baa250e9ee (patch)
tree2f5190f4e77f5d8d659f8c75b54e050ad204a153
parent41f559f4978d78524bd591edb6ab5df62266408d (diff)
downloadxine-lib-01336c065f6c2966dfc2d9d8e17359baa250e9ee.tar.gz
xine-lib-01336c065f6c2966dfc2d9d8e17359baa250e9ee.tar.bz2
Few cleanups, memory leaks.
CVS patchset: 1859 CVS date: 2002/05/06 21:40:02
-rw-r--r--src/input/input_mms.c42
-rw-r--r--src/input/mms.c268
-rw-r--r--src/input/mms.h6
3 files changed, 165 insertions, 151 deletions
diff --git a/src/input/input_mms.c b/src/input/input_mms.c
index 969d534b6..cbd3501aa 100644
--- a/src/input/input_mms.c
+++ b/src/input/input_mms.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: input_mms.c,v 1.11 2002/04/28 15:33:06 guenter Exp $
+ * $Id: input_mms.c,v 1.12 2002/05/06 21:40:02 f1rmb Exp $
*
* mms input plugin based on work from major mms
*/
@@ -72,7 +72,6 @@ typedef struct {
static int mms_plugin_open (input_plugin_t *this_gen, char *mrl) {
-
mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen;
printf ("input_mms: trying to open '%s'\n", mrl);
@@ -82,6 +81,9 @@ static int mms_plugin_open (input_plugin_t *this_gen, char *mrl) {
if (!this->mms)
return 0;
+ if (this->mrl)
+ free (this->mrl);
+
this->mrl = strdup(mrl); /* FIXME: small memory leak */
this->curpos = 0;
this->nbc = nbc_init (this->xine);
@@ -110,7 +112,7 @@ static buf_element_t *mms_plugin_read_block (input_plugin_t *this_gen,
fifo_buffer_t *fifo, off_t todo) {
/*mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; */
buf_element_t *buf = fifo->buffer_pool_alloc (fifo);
- int total_bytes;
+ int total_bytes;
#ifdef LOG
printf ("mms_plugin_read_block: %lld bytes...\n",
@@ -133,10 +135,8 @@ static buf_element_t *mms_plugin_read_block (input_plugin_t *this_gen,
}
static off_t mms_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin) {
-
mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen;
-
- off_t dest = this->curpos;
+ off_t dest = this->curpos;
#ifdef LOG
printf ("mms_plugin_seek: %lld offset, %d origin...\n",
@@ -164,7 +164,6 @@ static off_t mms_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin
}
while (this->curpos<dest) {
-
int n, diff;
diff = dest - this->curpos;
@@ -174,18 +173,18 @@ static off_t mms_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin
n = mms_read (this->mms, this->scratch, diff);
this->curpos += n;
- if (n<diff)
+
+ if (n < diff)
return this->curpos;
+
}
return this->curpos;
}
static off_t mms_plugin_get_length (input_plugin_t *this_gen) {
-
mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen;
-
- off_t length;
+ off_t length;
if (!this->mms)
return 0;
@@ -201,14 +200,11 @@ static off_t mms_plugin_get_length (input_plugin_t *this_gen) {
}
static uint32_t mms_plugin_get_capabilities (input_plugin_t *this_gen) {
-
return INPUT_CAP_NOCAP;
}
static uint32_t mms_plugin_get_blocksize (input_plugin_t *this_gen) {
-
return 0;
-;
}
static off_t mms_plugin_get_current_pos (input_plugin_t *this_gen){
@@ -241,7 +237,6 @@ static void mms_plugin_close (input_plugin_t *this_gen) {
}
static void mms_plugin_stop (input_plugin_t *this_gen) {
-
mms_plugin_close(this_gen);
}
@@ -261,25 +256,32 @@ static char* mms_plugin_get_mrl (input_plugin_t *this_gen) {
static int mms_plugin_get_optional_data (input_plugin_t *this_gen,
void *data, int data_type) {
-
mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen;
switch (data_type) {
- case INPUT_OPTIONAL_DATA_PREVIEW:
+ case INPUT_OPTIONAL_DATA_PREVIEW:
return mms_peek_header (this->mms, data);
-
break;
+
+ default:
+ return INPUT_OPTIONAL_UNSUPPORTED;
+ break;
+
}
return INPUT_OPTIONAL_UNSUPPORTED;
}
static void mms_plugin_dispose (input_plugin_t *this_gen ) {
- free (this_gen);
+ mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen;
+
+ if(this->mrl)
+ free(this->mrl);
+
+ free (this);
}
-
input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
mms_input_plugin_t *this;
diff --git a/src/input/mms.c b/src/input/mms.c
index 578d74dd1..1aab8c540 100644
--- a/src/input/mms.c
+++ b/src/input/mms.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: mms.c,v 1.6 2002/04/29 23:31:59 jcdutton Exp $
+ * $Id: mms.c,v 1.7 2002/05/06 21:40:02 f1rmb Exp $
*
* based on work from major mms
* utility functions to handle communication with an mms server
@@ -40,6 +40,8 @@
#include <errno.h>
#include <stdlib.h>
+#include "xineutils.h"
+
#include "bswap.h"
#include "mms.h"
@@ -90,13 +92,21 @@ struct mms_s {
};
/* network/socket utility functions */
+/*
+ * Small sighandler ;-)
+ */
+static void die(int signal) {
+ printf("Signal %d\n", signal);
+ abort();
+}
static int host_connect_attempt(struct in_addr ia, int port) {
- int s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
+ int s;
struct sockaddr_in sin;
-
- if (s==-1) {
+
+ s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
+ if (s == -1) {
printf ("libmms: socket(): %s\n", strerror(errno));
return -1;
}
@@ -115,20 +125,21 @@ static int host_connect_attempt(struct in_addr ia, int port) {
return s;
}
-int host_connect(const char *host, int port) {
+static int host_connect(const char *host, int port) {
struct hostent *h;
- int i, s;
+ int i, s;
- h=gethostbyname(host);
- if (h==NULL) {
+ h = gethostbyname(host);
+ if (h == NULL) {
printf ("libmms: unable to resolve '%s'.\n", host);
return -1;
}
- for (i=0; h->h_addr_list[i]; i++) {
+ for (i = 0; h->h_addr_list[i]; i++) {
struct in_addr ia;
- memcpy (&ia, h->h_addr_list[i],4);
+
+ memcpy (&ia, h->h_addr_list[i], 4);
s = host_connect_attempt(ia, port);
if(s != -1)
return s;
@@ -153,14 +164,14 @@ static void put_32 (mms_t *this, uint32_t value) {
static int send_data (int s, char *buf, int len) {
int total;
- total=0;
- while (total<len){
+ total = 0;
+ while (total < len){
int n;
- n = write (s, &buf[total], len-total);
+ n = write (s, &buf[total], len - total);
if (n > 0)
total += n;
- else if (n<0 && errno!=EAGAIN)
+ else if (n < 0 && errno != EAGAIN)
return total;
}
return total;
@@ -171,19 +182,18 @@ static uint32_t get_32 (unsigned char *cmd, int offset) {
uint32_t ret;
ret = cmd[offset] ;
- ret |= cmd[offset+1]<<8 ;
- ret |= cmd[offset+2]<<16 ;
- ret |= cmd[offset+3]<<24 ;
+ ret |= cmd[offset+1] << 8 ;
+ ret |= cmd[offset+2] << 16 ;
+ ret |= cmd[offset+3] << 24 ;
return ret;
}
static void send_command (mms_t *this, int command, uint32_t switches,
uint32_t extra, int length) {
-
int len8;
- len8 = (length + (length%8)) / 8;
+ len8 = (length + (length % 8)) / 8;
this->scmd_len = 0;
@@ -192,7 +202,8 @@ static void send_command (mms_t *this, int command, uint32_t switches,
put_32 (this, length + 32);
put_32 (this, 0x20534d4d); /* protocol type "MMS " */
put_32 (this, len8 + 4);
- put_32 (this, this->seq_num); this->seq_num++;
+ put_32 (this, this->seq_num);
+ this->seq_num++;
put_32 (this, 0x0); /* unknown */
put_32 (this, 0x0);
put_32 (this, len8+2);
@@ -210,7 +221,7 @@ static void send_command (mms_t *this, int command, uint32_t switches,
{
int i;
- printf ("\nlibmms: ***************************************************\ncommand sent, %d bytes\n", length+48);
+ printf ("\nlibmms: ***************************************************\ncommand sent, %d bytes\n", length + 48);
printf ("start sequence %08x\n", get_32 (this->scmd, 0));
printf ("command id %08x\n", get_32 (this->scmd, 4));
@@ -222,10 +233,10 @@ static void send_command (mms_t *this, int command, uint32_t switches,
printf ("switches %08x\n", get_32 (this->scmd, 40));
printf ("ascii contents>");
- for (i=48; i<(length+48); i+=2) {
+ for (i = 48; i < (length + 48); i += 2) {
unsigned char c = this->scmd[i];
- if ((c>=32) && (c<=128))
+ if ((c >= 32) && (c <= 128))
printf ("%c", c);
else
printf (".");
@@ -233,7 +244,7 @@ static void send_command (mms_t *this, int command, uint32_t switches,
printf ("\n");
printf ("libmms: complete hexdump of package follows:\n");
- for (i=0; i<(length+48); i++) {
+ for (i = 0; i < (length + 48); i++) {
unsigned char c = this->scmd[i];
printf ("%02x", c);
@@ -255,13 +266,13 @@ static void string_utf16(char *dest, char *src, int len) {
memset (dest, 0, 1000);
- for (i=0; i<len; i++) {
- dest[i*2] = src[i];
- dest[i*2+1] = 0;
+ for (i = 0; i < len; i++) {
+ dest[i * 2] = src[i];
+ dest[i * 2 + 1] = 0;
}
- dest[i*2] = 0;
- dest[i*2+1] = 0;
+ dest[i * 2] = 0;
+ dest[i * 2 + 1] = 0;
}
static void print_answer (char *data, int len) {
@@ -280,10 +291,10 @@ static void print_answer (char *data, int len) {
printf ("dir | comm %08x\n", get_32 (data, 36));
printf ("switches %08x\n", get_32 (data, 40));
- for (i=48; i<len; i+=2) {
+ for (i = 48; i < len; i += 2) {
unsigned char c = data[i];
- if ((c>=32) && (c<128))
+ if ((c >= 32) && (c < 128))
printf ("%c", c);
else
printf (" %02x ", c);
@@ -306,7 +317,7 @@ static void get_answer (mms_t *this) {
printf ("\nalert! eof\n");
return;
}
-
+
print_answer (this->buf, len);
command = get_32 (this->buf, 36) & 0xFFFF;
@@ -314,6 +325,7 @@ static void get_answer (mms_t *this) {
if (command == 0x1b)
send_command (this, 0x1b, 0, 0, 0);
}
+
}
static int receive (int s, char *buf, size_t count) {
@@ -324,7 +336,7 @@ static int receive (int s, char *buf, size_t count) {
while (total < count) {
len = read (s, &buf[total], count-total);
- if (len<0) {
+ if (len < 0) {
perror ("read error:");
return 0;
}
@@ -360,7 +372,7 @@ static void get_header (mms_t *this) {
#ifdef LOG
{
int i;
- for (i=0; i<8; i++)
+ for (i = 0; i < 8; i++)
printf ("libmms: pre_header[%d] = %02x (%d)\n",
i, pre_header[i], pre_header[i]);
}
@@ -384,8 +396,8 @@ static void get_header (mms_t *this) {
this->asf_header_len += packet_len;
- if ( (this->asf_header[this->asf_header_len-1] == 1)
- && (this->asf_header[this->asf_header_len-2]==1)) {
+ if ( (this->asf_header[this->asf_header_len - 1] == 1)
+ && (this->asf_header[this->asf_header_len - 2] == 1)) {
printf ("libmms: get header packet finished\n");
@@ -440,30 +452,30 @@ static void interp_header (mms_t *this) {
*/
i = 30;
- while (i<this->asf_header_len) {
+ while (i < this->asf_header_len) {
uint64_t guid_1, guid_2, length;
- guid_2 = (uint64_t)this->asf_header[i] | ((uint64_t)this->asf_header[i+1]<<8)
- | ((uint64_t)this->asf_header[i+2]<<16) | ((uint64_t)this->asf_header[i+3]<<24)
- | ((uint64_t)this->asf_header[i+4]<<32) | ((uint64_t)this->asf_header[i+5]<<40)
- | ((uint64_t)this->asf_header[i+6]<<48) | ((uint64_t)this->asf_header[i+7]<<56);
+ guid_2 = (uint64_t)this->asf_header[i] | ((uint64_t)this->asf_header[i+1] << 8)
+ | ((uint64_t)this->asf_header[i+2]<<16) | ((uint64_t)this->asf_header[i+3] << 24)
+ | ((uint64_t)this->asf_header[i+4]<<32) | ((uint64_t)this->asf_header[i+5] << 40)
+ | ((uint64_t)this->asf_header[i+6]<<48) | ((uint64_t)this->asf_header[i+7] << 56);
i += 8;
- guid_1 = (uint64_t)this->asf_header[i] | ((uint64_t)this->asf_header[i+1]<<8)
- | ((uint64_t)this->asf_header[i+2]<<16) | ((uint64_t)this->asf_header[i+3]<<24)
- | ((uint64_t)this->asf_header[i+4]<<32) | ((uint64_t)this->asf_header[i+5]<<40)
- | ((uint64_t)this->asf_header[i+6]<<48) | ((uint64_t)this->asf_header[i+7]<<56);
+ guid_1 = (uint64_t)this->asf_header[i] | ((uint64_t)this->asf_header[i+1] << 8)
+ | ((uint64_t)this->asf_header[i+2]<<16) | ((uint64_t)this->asf_header[i+3] << 24)
+ | ((uint64_t)this->asf_header[i+4]<<32) | ((uint64_t)this->asf_header[i+5] << 40)
+ | ((uint64_t)this->asf_header[i+6]<<48) | ((uint64_t)this->asf_header[i+7] << 56);
i += 8;
#ifdef LOG
printf ("guid found: %016llx%016llx\n", guid_1, guid_2);
#endif
- length = (uint64_t)this->asf_header[i] | ((uint64_t)this->asf_header[i+1]<<8)
- | ((uint64_t)this->asf_header[i+2]<<16) | ((uint64_t)this->asf_header[i+3]<<24)
- | ((uint64_t)this->asf_header[i+4]<<32) | ((uint64_t)this->asf_header[i+5]<<40)
- | ((uint64_t)this->asf_header[i+6]<<48) | ((uint64_t)this->asf_header[i+7]<<56);
+ length = (uint64_t)this->asf_header[i] | ((uint64_t)this->asf_header[i+1] << 8)
+ | ((uint64_t)this->asf_header[i+2]<<16) | ((uint64_t)this->asf_header[i+3] << 24)
+ | ((uint64_t)this->asf_header[i+4]<<32) | ((uint64_t)this->asf_header[i+5] << 40)
+ | ((uint64_t)this->asf_header[i+6]<<48) | ((uint64_t)this->asf_header[i+7] << 56);
i += 8;
@@ -473,17 +485,17 @@ static void interp_header (mms_t *this) {
printf ("data object\n");
} else if ((guid_1 == 0x6553200cc000e48e) && (guid_2 == 0x11cfa9478cabdca1)) {
- this->packet_length = get_32(this->asf_header, i+92-24);
- this->file_length = get_32(this->asf_header, i+40-24);
+ this->packet_length = get_32(this->asf_header, i + 92 - 24);
+ this->file_length = get_32(this->asf_header, i + 40 - 24);
#ifdef LOG
printf ("file object, packet length = %d (%d)\n",
- this->packet_length, get_32(this->asf_header, i+96-24));
+ this->packet_length, get_32(this->asf_header, i + 96 - 24));
#endif
} else if ((guid_1 == 0x6553200cc000e68e) && (guid_2 == 0x11cfa9b7b7dc0791)) {
- int stream_id = this->asf_header[i+48] | this->asf_header[i+49] << 8;
+ int stream_id = this->asf_header[i + 48] | this->asf_header[i + 49] << 8;
#ifdef LOG
printf ("stream object, stream id: %d\n", stream_id);
@@ -505,23 +517,23 @@ static void interp_header (mms_t *this) {
printf ("length : %lld\n", length);
#endif
- i += length-24;
+ i += length - 24;
}
}
-char *mms_url_s[]={"MMS://","MMSU://","MMST://", NULL};
+static char *mms_url_s[] = { "MMS://", "MMSU://", "MMST://", NULL };
static int mms_valid_url (char* url, char** mms_url) {
- int i=0;
+ int i = 0;
int len;
if(!url )
return 0;
- while(mms_url[i]){
+ while(mms_url[i]) {
len = strlen(mms_url[i]);
- if(!strncasecmp(url, mms_url[i], len)){
+ if(!strncasecmp(url, mms_url[i], len)) {
return len;
}
i++;
@@ -529,88 +541,96 @@ static int mms_valid_url (char* url, char** mms_url) {
return 0;
}
-char* mms_connect_common(int *s, int port, char *url, char **host, char** hostend,
- char **path, char **file) {
-
- int hostlen;
- int proto_len;
+char* mms_connect_common(int *s, int *port, char *url, char **host, char **path, char **file) {
+ int proto_len;
+ char *hostend;
char *forport;
+ char *_url;
+ char *_host;
- if (!(proto_len=mms_valid_url(url,mms_url_s))){
-
- printf ("libmms: invalid url >%s< (should be mms:// - style)\n", url);
+ if ((proto_len = mms_valid_url(url, mms_url_s)) <= 0) {
+ /*
+ * DCB: Why warning if it isn't a mms*:// mrl like ?
+ */
+ /* printf ("libmms: invalid url >%s< (should be mms:// - style)\n", url); */
return NULL;
-
}
-
- /* extract hostname */
+ /* Create a local copy (alloca()'ed), avoid to corrupt the original URL */
+ xine_strdupa(_url, &url[proto_len]);
+
+ _host = _url;
+
+ /* extract hostname */
+#ifdef LOG
printf ("libmms: extracting host name \n");
- *hostend = strchr(&url[proto_len],'/');
- if (!(*hostend)) {
+#endif
+ hostend = strchr(_host, '/');
+ if ((!hostend) || (strlen(hostend) <= 1)) {
printf ("libmms: invalid url >%s<, failed to find hostend\n", url);
return NULL;
}
- forport=strchr(&url[proto_len],':'); /* May be they put a port here ?*/
- if( forport && forport < *hostend ){
- /*if(sscanf(forport,"%d",&port)!=1)
- port=MMS_PORT;
- */
- hostlen = forport - url - proto_len;
- }
- else
- hostlen = *hostend - url - proto_len;
-
- *host = malloc (hostlen+1);
- strncpy (*host, &url[proto_len], hostlen);
- (*host)[hostlen]=0;
+ *hostend++ = '\0';
+
+ /* Is port specified ? */
+ forport = strchr(_host, ':');
+ if(forport) {
+ *forport++ = '\0';
+ *port = atoi(forport);
+ }
- printf (" libmms: host =%s len =%d proto_len =%d\n",*host,hostlen,proto_len);
- hostlen = *hostend - url - proto_len;
+ *host = strdup(_host);
- /* extract path and file */
-
if(path)
- *path = url+hostlen+proto_len+1;
+ *path = &url[proto_len] + (hostend - _url);
+
if(file)
*file = strrchr (url, '/');
-
+
/*
* try to connect
*/
-
- printf("libmms: try to connect to %s on port %d \n", *host, port);
- *s = host_connect (*host, port);
+#ifdef LOG
+ printf("libmms: try to connect to %s on port %d \n", *host, *port);
+#endif
+ *s = host_connect (*host, *port);
+
if (*s == -1) {
- printf ("libmms: failed to connect\n");
+ printf ("libmms: failed to connect '%s'\n", *host);
free (*host);
return NULL;
}
+
+#ifdef LOG
printf ("libmms: connected\n");
-
+#endif
+
return url;
}
mms_t *mms_connect (char *url_) {
-
mms_t *this;
- int len,i;
- char *url;
- char *url1;
- char *path;
- char *file;
- char *host=NULL, *hostend;
- int s;
+ char *url = NULL;
+ char *url1 = NULL;
+ char *path = NULL;
+ char *file = NULL;
+ char *host = NULL;
+ int port;
+ int len, i, s;
+ if(!url_)
+ return NULL;
+
url = strdup (url_);
- url1 = mms_connect_common(&s,MMS_PORT,url,&host,&hostend,&path,&file);
+ port = MMS_PORT;
+ url1 = mms_connect_common(&s, &port, url, &host, &path, &file);
+
if(!url1){
free(url);
return NULL;
}
-
-
+
this = (mms_t*) malloc (sizeof (mms_t));
this->url = url;
@@ -637,25 +657,22 @@ mms_t *mms_connect (char *url_) {
sprintf (this->str, "\034\003NSPlayer/7.0.0.1956; {33715801-BAB3-9D85-24E9-03B90328270A}; Host: %s",
this->host);
- string_utf16 (this->scmd_body, this->str, strlen(this->str)+2);
+ string_utf16 (this->scmd_body, this->str, strlen(this->str) + 2);
- send_command (this, 1, 0, 0x0004000b, strlen(this->str) * 2+8);
+ send_command (this, 1, 0, 0x0004000b, strlen(this->str) * 2 + 8);
printf("libmms: before read \n");
len = read (this->s, this->buf, BUF_SIZE) ;
- if (len>0)
+ if (len > 0)
print_answer (this->buf, len);
- else {
+ else
printf ("libmms: read failed: %s\n", strerror(errno));
- }
-
/* cmd2 */
- string_utf16 (&this->scmd_body[8], "\002\000\\\\192.168.0.129\\TCP\\1037\0000",
- 28);
+ string_utf16 (&this->scmd_body[8], "\002\000\\\\192.168.0.129\\TCP\\1037\0000", 28);
memset (this->scmd_body, 0, 8);
- send_command (this, 2, 0, 0, 28*2+8);
+ send_command (this, 2, 0, 0, 28 * 2 + 8);
len = read (this->s, this->buf, BUF_SIZE) ;
if (len)
@@ -665,7 +682,7 @@ mms_t *mms_connect (char *url_) {
string_utf16 (&this->scmd_body[8], path, strlen(path));
memset (this->scmd_body, 0, 8);
- send_command (this, 5, 0, 0, strlen(path)*2+12);
+ send_command (this, 5, 0, 0, strlen(path) * 2 + 12);
get_answer (this);
@@ -687,11 +704,11 @@ mms_t *mms_connect (char *url_) {
memset (this->scmd_body, 0, 40);
- for (i=1; i<this->num_stream_ids; i++) {
- this->scmd_body [ (i-1) * 6 + 2 ] = 0xFF;
- this->scmd_body [ (i-1) * 6 + 3 ] = 0xFF;
- this->scmd_body [ (i-1) * 6 + 4 ] = this->stream_ids[i];
- this->scmd_body [ (i-1) * 6 + 5 ] = 0x00;
+ for (i = 1; i < this->num_stream_ids; i++) {
+ this->scmd_body [ (i - 1) * 6 + 2 ] = 0xFF;
+ this->scmd_body [ (i - 1) * 6 + 3 ] = 0xFF;
+ this->scmd_body [ (i - 1) * 6 + 4 ] = this->stream_ids[i];
+ this->scmd_body [ (i - 1) * 6 + 5 ] = 0x00;
}
send_command (this, 0x33, this->num_stream_ids,
@@ -705,7 +722,7 @@ mms_t *mms_connect (char *url_) {
memset (this->scmd_body, 0, 40);
- for (i=8; i<16; i++)
+ for (i = 8; i < 16; i++)
this->scmd_body[i] = 0xFF;
this->scmd_body[20] = 0x04;
@@ -719,7 +736,6 @@ mms_t *mms_connect (char *url_) {
static int get_media_packet (mms_t *this) {
-
unsigned char pre_header[8];
if (!receive (this->s, pre_header, 8)) {
@@ -728,7 +744,7 @@ static int get_media_packet (mms_t *this) {
}
#ifdef LOG
- for (i=0; i<8; i++)
+ for (i = 0; i < 8; i++)
printf ("pre_header[%d] = %02x (%d)\n",
i, pre_header[i], pre_header[i]);
#endif
@@ -814,7 +830,6 @@ int mms_peek_header (mms_t *this, char *data) {
}
int mms_read (mms_t *this, char *data, int len) {
-
int total;
total = 0;
@@ -826,12 +841,11 @@ int mms_read (mms_t *this, char *data, int len) {
#endif
if (this->asf_header_read < this->asf_header_len) {
-
int n, bytes_left ;
bytes_left = this->asf_header_len - this->asf_header_read ;
- if (len<bytes_left)
+ if (len < bytes_left)
n = len;
else
n = bytes_left;
diff --git a/src/input/mms.h b/src/input/mms.h
index c7a7e6233..daecff93f 100644
--- a/src/input/mms.h
+++ b/src/input/mms.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: mms.h,v 1.4 2002/04/28 15:33:06 guenter Exp $
+ * $Id: mms.h,v 1.5 2002/05/06 21:40:02 f1rmb Exp $
*
* libmms public header
*/
@@ -29,9 +29,7 @@
typedef struct mms_s mms_t;
-char* strupr(char *string);
-char* mms_connect_common(int *s ,int port,char *url, char **host , char** hostend,
- char **path,char **file);
+char* mms_connect_common(int *s ,int *port, char *url, char **host, char **path, char **file);
mms_t* mms_connect (char *url);
int mms_read (mms_t *this, char *data, int len);