changeset 15626:941b1a71351f

printf converted to mp_msg; made static many unnecessarily global symbols
author nicodvb
date Fri, 03 Jun 2005 15:33:26 +0000
parents 4be161b8e0ef
children 2c191764e8d9
files libmpdemux/asf_mmst_streaming.c libmpdemux/asf_streaming.c libmpdemux/pnm.c libmpdemux/realrtsp/rtsp.c
diffstat 4 files changed, 115 insertions(+), 126 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/asf_mmst_streaming.c	Fri Jun 03 14:52:15 2005 +0000
+++ b/libmpdemux/asf_mmst_streaming.c	Fri Jun 03 15:33:26 2005 +0000
@@ -112,7 +112,7 @@
     memset(&cmd.buf[48 + length], 0, 8 - (length & 7));
 
   if (send (s, cmd.buf, len8*8+48, 0) != (len8*8+48)) {
-    printf ("write error\n");
+    mp_msg(MSGT_NETWORK,MSGL_ERR,"write error\n");
   }
 }
 
@@ -160,7 +160,7 @@
 
     len = recv (s, data, BUF_SIZE, 0) ;
     if (!len) {
-      printf ("\nalert! eof\n");
+      mp_msg(MSGT_NETWORK,MSGL_ERR,"\nalert! eof\n");
       return;
     }
 
@@ -188,7 +188,7 @@
     total += len;
 
     if (len != 0) {
-//      printf ("[%d/%d]", total, count);
+//      mp_msg(MSGT_NETWORK,MSGL_INFO,"[%d/%d]", total, count);
       fflush (stdout);
     }
 
@@ -207,7 +207,7 @@
 
   while (1) {
     if (!get_data (s, pre_header, 8)) {
-      printf ("pre-header read failed\n");
+      mp_msg(MSGT_NETWORK,MSGL_ERR,"pre-header read failed\n");
       return 0;
     }
     if (pre_header[4] == 0x02) {
@@ -216,7 +216,7 @@
       
       packet_len = (pre_header[7] << 8 | pre_header[6]) - 8;
 
-//      printf ("asf header packet detected, len=%d\n", packet_len);
+//      mp_msg(MSGT_NETWORK,MSGL_INFO,"asf header packet detected, len=%d\n", packet_len);
 
       if (packet_len < 0 || packet_len > HDR_BUF_SIZE - header_len) {
         mp_msg(MSGT_NETWORK, MSGL_FATAL, "Invalid header size, giving up\n");
@@ -224,7 +224,7 @@
       }
 
       if (!get_data (s, &header[header_len], packet_len)) {
-	printf ("header data read failed\n");
+	mp_msg(MSGT_NETWORK,MSGL_ERR,"header data read failed\n");
 	return 0;
       }
 
@@ -237,7 +237,7 @@
 				return -1;
  	 }
 
-     //	printf ("get header packet finished\n");
+     //	mp_msg(MSGT_NETWORK,MSGL_INFO,"get header packet finished\n");
 
 	return (header_len);
 
@@ -250,13 +250,13 @@
       char data[BUF_SIZE];
 
       if (!get_data (s, (char*)&packet_len, 4)) {
-	printf ("packet_len read failed\n");
+	mp_msg(MSGT_NETWORK,MSGL_ERR,"packet_len read failed\n");
 	return 0;
       }
       
       packet_len = get_32 ((unsigned char*)&packet_len, 0) + 4;
       
-//      printf ("command packet detected, len=%d\n", packet_len);
+//      mp_msg(MSGT_NETWORK,MSGL_INFO,"command packet detected, len=%d\n", packet_len);
 
       if (packet_len < 0 || packet_len > BUF_SIZE) {
         mp_msg(MSGT_NETWORK, MSGL_FATAL,
@@ -265,20 +265,20 @@
       }
       
       if (!get_data (s, data, packet_len)) {
-	printf ("command data read failed\n");
+	mp_msg(MSGT_NETWORK,MSGL_ERR,"command data read failed\n");
 	return 0;
       }
       
       command = get_32 (data, 24) & 0xFFFF;
       
-//      printf ("command: %02x\n", command);
+//      mp_msg(MSGT_NETWORK,MSGL_INFO,"command: %02x\n", command);
       
       if (command == 0x1b) 
 	send_command (s, 0x1b, 0, 0, 0, data);
       
     }
 
-//    printf ("get header packet succ\n");
+//    mp_msg(MSGT_NETWORK,MSGL_INFO,"get header packet succ\n");
   }
 }
 
@@ -308,7 +308,7 @@
       | ((uint64_t)header[i+6]<<48) | ((uint64_t)header[i+7]<<56);
     i += 8;
     
-//    printf ("guid found: %016llx%016llx\n", guid_1, guid_2);
+//    mp_msg(MSGT_NETWORK,MSGL_INFO,"guid found: %016llx%016llx\n", guid_1, guid_2);
 
     length = (uint64_t)header[i] | ((uint64_t)header[i+1]<<8) 
       | ((uint64_t)header[i+2]<<16) | ((uint64_t)header[i+3]<<24)
@@ -318,14 +318,14 @@
     i += 8;
 
     if ( (guid_1 == 0x6cce6200aa00d9a6ULL) && (guid_2 == 0x11cf668e75b22630ULL) ) {
-      printf ("header object\n");
+      mp_msg(MSGT_NETWORK,MSGL_INFO,"header object\n");
     } else if ((guid_1 == 0x6cce6200aa00d9a6ULL) && (guid_2 == 0x11cf668e75b22636ULL)) {
-      printf ("data object\n");
+      mp_msg(MSGT_NETWORK,MSGL_INFO,"data object\n");
     } else if ((guid_1 == 0x6553200cc000e48eULL) && (guid_2 == 0x11cfa9478cabdca1ULL)) {
 
       packet_length = get_32(header, i+92-24);
 
-      printf ("file object, packet length = %d (%d)\n",
+      mp_msg(MSGT_NETWORK,MSGL_INFO,"file object, packet length = %d (%d)\n",
 	      packet_length, get_32(header, i+96-24));
 
 
@@ -333,20 +333,20 @@
 
       int stream_id = header[i+48] | header[i+49] << 8;
 
-      printf ("stream object, stream id: %d\n", stream_id);
+      mp_msg(MSGT_NETWORK,MSGL_INFO,"stream object, stream id: %d\n", stream_id);
 
       if (num_stream_ids < MAX_STREAMS) {
       stream_ids[num_stream_ids] = stream_id;
       num_stream_ids++;
       } else {
-        printf ("too many id, stream skipped");
+        mp_msg(MSGT_NETWORK,MSGL_ERR,"too many id, stream skipped");
       }
       
     } else {
-      printf ("unknown object\n");
+      mp_msg(MSGT_NETWORK,MSGL_WARN,"unknown object\n");
     }
 
-//    printf ("length    : %lld\n", length);
+//    mp_msg(MSGT_NETWORK,MSGL_INFO,"length    : %lld\n", length);
 
     i += length-24;
 
@@ -362,12 +362,12 @@
   char           data[BUF_SIZE];
 
   if (!get_data (s, pre_header, 8)) {
-    printf ("pre-header read failed\n");
+    mp_msg(MSGT_NETWORK,MSGL_ERR,"pre-header read failed\n");
     return 0;
   }
 
 //  for (i=0; i<8; i++)
-//    printf ("pre_header[%d] = %02x (%d)\n",
+//    mp_msg(MSGT_NETWORK,MSGL_INFO,"pre_header[%d] = %02x (%d)\n",
 //	    i, pre_header[i], pre_header[i]);
 
   if (pre_header[4] == 0x04) {
@@ -376,7 +376,7 @@
 
     packet_len = (pre_header[7] << 8 | pre_header[6]) - 8;
 
-//    printf ("asf media packet detected, len=%d\n", packet_len);
+//    mp_msg(MSGT_NETWORK,MSGL_INFO,"asf media packet detected, len=%d\n", packet_len);
 
     if (packet_len < 0 || packet_len > BUF_SIZE) {
       mp_msg(MSGT_NETWORK, MSGL_FATAL,
@@ -385,7 +385,7 @@
     }
       
     if (!get_data (s, data, packet_len)) {
-      printf ("media data read failed\n");
+      mp_msg(MSGT_NETWORK,MSGL_ERR,"media data read failed\n");
       return 0;
     }
 
@@ -397,7 +397,7 @@
     int command;
 
     if (!get_data (s, (char*)&packet_len, 4)) {
-      printf ("packet_len read failed\n");
+      mp_msg(MSGT_NETWORK,MSGL_ERR,"packet_len read failed\n");
       return 0;
     }
 
@@ -410,25 +410,25 @@
     }
 
     if (!get_data (s, data, packet_len)) {
-      printf ("command data read failed\n");
+      mp_msg(MSGT_NETWORK,MSGL_ERR,"command data read failed\n");
       return 0;
     }
 
     if ( (pre_header[7] != 0xb0) || (pre_header[6] != 0x0b)
 	 || (pre_header[5] != 0xfa) || (pre_header[4] != 0xce) ) {
 
-      printf ("missing signature\n");
+      mp_msg(MSGT_NETWORK,MSGL_ERR,"missing signature\n");
       return -1;
     }
 
     command = get_32 (data, 24) & 0xFFFF;
 
-//    printf ("\ncommand packet detected, len=%d  cmd=0x%X\n", packet_len, command);
+//    mp_msg(MSGT_NETWORK,MSGL_INFO,"\ncommand packet detected, len=%d  cmd=0x%X\n", packet_len, command);
 
     if (command == 0x1b) 
       send_command (s, 0x1b, 0, 0, 0, data);
     else if (command == 0x1e) {
-      printf ("everything done. Thank you for downloading a media file containing proprietary and patentend technology.\n");
+      mp_msg(MSGT_NETWORK,MSGL_INFO,"everything done. Thank you for downloading a media file containing proprietary and patentend technology.\n");
       return 0;
     }
     else if (command == 0x21 ) {
@@ -437,12 +437,12 @@
 	return 0;
     }
     else if (command != 0x05) {
-      printf ("unknown command %02x\n", command);
+      mp_msg(MSGT_NETWORK,MSGL_ERR,"unknown command %02x\n", command);
       return -1;
     }
   }
 
-//  printf ("get media packet succ\n");
+//  mp_msg(MSGT_NETWORK,MSGL_INFO,"get media packet succ\n");
 
   return 1;
 }
@@ -450,8 +450,7 @@
 
 static int packet_length1;
 
-int
-asf_mmst_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctrl ) 
+static int asf_mmst_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctrl ) 
 {
   int len;
   
@@ -459,7 +458,7 @@
           // buffer is empty - fill it!
 	  int ret = get_media_packet( fd, packet_length1, stream_ctrl);
 	  if( ret<0 ) {
-		  printf("get_media_packet error : %s\n",strerror(errno));
+		  mp_msg(MSGT_NETWORK,MSGL_ERR,"get_media_packet error : %s\n",strerror(errno));
 		  return -1;
 	  } else if (ret==0) //EOF?
 		  return ret;
@@ -479,8 +478,7 @@
 
 }
 
-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
@@ -528,7 +526,7 @@
 	  free(path);
 	  return s;
   }
-  printf ("connected\n");
+  mp_msg(MSGT_NETWORK,MSGL_INFO,"connected\n");
   
   seq_num=0;
 
@@ -592,7 +590,7 @@
   /* get_headers(s, asf_header);  */
 
   asf_header_len = get_header (s, asf_header, stream->streaming_ctrl);
-//  printf("---------------------------------- asf_header %d\n",asf_header);
+//  mp_msg(MSGT_NETWORK,MSGL_INFO,"---------------------------------- asf_header %d\n",asf_header);
   if (asf_header_len==0) return -1; //error reading header
   packet_length = interp_header (asf_header, asf_header_len);
 
@@ -642,7 +640,7 @@
   stream->streaming_ctrl->status = streaming_playing_e;
 
   packet_length1 = packet_length;
-  printf("mmst packet_length = %d\n",packet_length);
+  mp_msg(MSGT_NETWORK,MSGL_INFO,"mmst packet_length = %d\n",packet_length);
 
 #ifdef USE_ICONV
   if (url_conv != (iconv_t)(-1))
--- a/libmpdemux/asf_streaming.c	Fri Jun 03 14:52:15 2005 +0000
+++ b/libmpdemux/asf_streaming.c	Fri Jun 03 15:33:26 2005 +0000
@@ -87,8 +87,7 @@
 	return -1;
 }
 
-int 
-asf_streaming(ASF_stream_chunck_t *stream_chunck, int *drop_packet ) {
+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 );
@@ -157,8 +156,7 @@
   return best;
 }
 
-static int
-asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl) {
+static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl) {
   ASF_header_t asfh;
   ASF_stream_chunck_t chunk;
   asf_http_streaming_ctrl_t* asf_ctrl = (asf_http_streaming_ctrl_t*) streaming_ctrl->data;
@@ -407,8 +405,7 @@
   return -1;
 }
 
-int
-asf_http_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *streaming_ctrl ) {
+static int asf_http_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *streaming_ctrl ) {
   static ASF_stream_chunck_t chunk;
   int read,chunk_size = 0;
   static int rest = 0, drop_chunk = 0, waiting = 0;
@@ -483,8 +480,7 @@
   return read;
 }
 
-int
-asf_http_streaming_seek( int fd, off_t pos, streaming_ctrl_t *streaming_ctrl ) {
+static int asf_http_streaming_seek( int fd, off_t pos, streaming_ctrl_t *streaming_ctrl ) {
 	return -1;
 	// to shut up gcc warning
 	fd++;
@@ -492,8 +488,7 @@
 	streaming_ctrl=NULL;
 }
 
-int
-asf_header_check( HTTP_header_t *http_hdr ) {
+static int asf_header_check( HTTP_header_t *http_hdr ) {
 	ASF_obj_header_t *objh;
 	if( http_hdr==NULL ) return -1;
 	if( http_hdr->body==NULL || http_hdr->body_size<sizeof(ASF_obj_header_t) ) return -1;
@@ -503,8 +498,7 @@
 	return -1;
 }
 
-int
-asf_http_streaming_type(char *content_type, char *features, HTTP_header_t *http_hdr ) {
+static int asf_http_streaming_type(char *content_type, char *features, HTTP_header_t *http_hdr ) {
 	if( content_type==NULL ) return ASF_Unknown_e;
 	if( 	!strcasecmp(content_type, "application/octet-stream") ||
 		!strcasecmp(content_type, "application/vnd.ms.wms-hdr.asfv1") ||        // New in Corona, first request
@@ -556,8 +550,7 @@
 	return ASF_Unknown_e;
 }
 
-HTTP_header_t *
-asf_http_request(streaming_ctrl_t *streaming_ctrl) {
+static HTTP_header_t *asf_http_request(streaming_ctrl_t *streaming_ctrl) {
 	HTTP_header_t *http_hdr;
 	URL_t *url = NULL;
 	URL_t *server_url = NULL;
@@ -655,8 +648,7 @@
 	return http_hdr;
 }
 
-int
-asf_http_parse_response(asf_http_streaming_ctrl_t *asf_http_ctrl, HTTP_header_t *http_hdr ) {
+static int asf_http_parse_response(asf_http_streaming_ctrl_t *asf_http_ctrl, HTTP_header_t *http_hdr ) {
 	char *content_type, *pragma;
 	char features[64] = "\0";
 	size_t len;
@@ -715,8 +707,7 @@
 	return 0;
 }
 
-int
-asf_http_streaming_start( stream_t *stream, int *demuxer_type ) {
+static int asf_http_streaming_start( stream_t *stream, int *demuxer_type ) {
 	HTTP_header_t *http_hdr=NULL;
 	URL_t *url = stream->streaming_ctrl->url;
 	asf_http_streaming_ctrl_t *asf_http_ctrl;
--- a/libmpdemux/pnm.c	Fri Jun 03 14:52:15 2005 +0000
+++ b/libmpdemux/pnm.c	Fri Jun 03 15:33:26 2005 +0000
@@ -121,7 +121,7 @@
 
 /* header of rm files */
 #define RM_HEADER_SIZE 0x12
-const unsigned char rm_header[]={
+static const unsigned char rm_header[]={
         0x2e, 0x52, 0x4d, 0x46, /* object_id      ".RMF" */
         0x00, 0x00, 0x00, 0x12, /* header_size    0x12   */
         0x00, 0x00,             /* object_version 0x00   */
@@ -131,7 +131,7 @@
 
 /* data chunk header */
 #define PNM_DATA_HEADER_SIZE 18
-const unsigned char pnm_data_header[]={
+static const unsigned char pnm_data_header[]={
         'D','A','T','A',
          0,0,0,0,       /* data chunk size  */
          0,0,           /* object version   */
@@ -150,14 +150,14 @@
 #define PNA_CLIENT_STRING    0x63
 #define PNA_PATH_REQUEST     0x52
 
-const unsigned char pnm_challenge[] = "0990f6b4508b51e801bd6da011ad7b56";
-const unsigned char pnm_timestamp[] = "[15/06/1999:22:22:49 00:00]";
-const unsigned char pnm_guid[]      = "3eac2411-83d5-11d2-f3ea-d7c3a51aa8b0";
-const unsigned char pnm_response[]  = "97715a899cbe41cee00dd434851535bf";
-const unsigned char client_string[] = "WinNT_9.0_6.0.6.45_plus32_MP60_en-US_686l";
+static const unsigned char pnm_challenge[] = "0990f6b4508b51e801bd6da011ad7b56";
+static const unsigned char pnm_timestamp[] = "[15/06/1999:22:22:49 00:00]";
+static const unsigned char pnm_guid[]      = "3eac2411-83d5-11d2-f3ea-d7c3a51aa8b0";
+static const unsigned char pnm_response[]  = "97715a899cbe41cee00dd434851535bf";
+static const unsigned char client_string[] = "WinNT_9.0_6.0.6.45_plus32_MP60_en-US_686l";
 
 #define PNM_HEADER_SIZE 11
-const unsigned char pnm_header[] = {
+static const unsigned char pnm_header[] = {
         'P','N','A',
         0x00, 0x0a,
         0x00, 0x14,
@@ -165,7 +165,7 @@
         0x00, 0x01 };
 
 #define PNM_CLIENT_CAPS_SIZE 126
-const unsigned char pnm_client_caps[] = {
+static const unsigned char pnm_client_caps[] = {
     0x07, 0x8a, 'p','n','r','v', 
        0, 0x90, 'p','n','r','v', 
        0, 0x64, 'd','n','e','t', 
@@ -188,18 +188,18 @@
        0, 0x12, 'l','p','c','J', 
        0, 0x07, '0','5','_','6' };
 
-const uint32_t pnm_default_bandwidth=10485800;
-const uint32_t pnm_available_bandwidths[]={14400,19200,28800,33600,34430,57600,
+static const uint32_t pnm_default_bandwidth=10485800;
+static const uint32_t pnm_available_bandwidths[]={14400,19200,28800,33600,34430,57600,
                                   115200,262200,393216,524300,1544000,10485800};
 
 #define PNM_TWENTYFOUR_SIZE 16
-unsigned char pnm_twentyfour[]={
+static unsigned char pnm_twentyfour[]={
     0xd5, 0x42, 0xa3, 0x1b, 0xef, 0x1f, 0x70, 0x24,
     0x85, 0x29, 0xb3, 0x8d, 0xba, 0x11, 0xf3, 0xd6 };
 
 /* now other data follows. marked with 0x0000 at the beginning */
-int after_chunks_length=6;
-unsigned char after_chunks[]={
+static int after_chunks_length=6;
+static unsigned char after_chunks[]={
     0x00, 0x00, /* mark */
     
     0x50, 0x84, /* seems to be fixated */
@@ -258,7 +258,7 @@
     ret=recv (fd, ((uint8_t*)buf)+total, count-total, 0);
 
     if (ret<=0) {
-      printf ("input_pnm: read error.\n");
+      mp_msg(MSGT_OPEN, MSGL_ERR, "input_pnm: read error.\n");
       return ret;
     } else
       total += ret;
@@ -275,31 +275,31 @@
 
   int i;
 
-  printf ("input_pnm: ascii>");
+  mp_msg(MSGT_OPEN, MSGL_INFO, "input_pnm: ascii>");
   for (i = 0; i < length; i++) {
     unsigned char c = buf[i];
 
     if ((c >= 32) && (c <= 128))
-      printf ("%c", c);
+      mp_msg(MSGT_OPEN, MSGL_INFO, "%c", c);
     else
-      printf (".");
+      mp_msg(MSGT_OPEN, MSGL_INFO, ".");
   }
-  printf ("\n");
+  mp_msg(MSGT_OPEN, MSGL_INFO, "\n");
 
-  printf ("input_pnm: hexdump> ");
+  mp_msg(MSGT_OPEN, MSGL_INFO, "input_pnm: hexdump> ");
   for (i = 0; i < length; i++) {
     unsigned char c = buf[i];
 
-    printf ("%02x", c);
+    mp_msg(MSGT_OPEN, MSGL_INFO, "%02x", c);
 
     if ((i % 16) == 15)
-      printf ("\npnm:         ");
+      mp_msg(MSGT_OPEN, MSGL_INFO, "\npnm:         ");
 
     if ((i % 2) == 1)
-      printf (" ");
+      mp_msg(MSGT_OPEN, MSGL_INFO, " ");
 
   }
-  printf ("\n");
+  mp_msg(MSGT_OPEN, MSGL_INFO, "\n");
 }
 
 /*
@@ -349,7 +349,7 @@
         max -= 2;
 	if (*ptr == 'X') /* checking for server message */
 	{
-	  printf("input_pnm: got a message from server:\n");
+	  mp_msg(MSGT_OPEN, MSGL_WARN, "input_pnm: got a message from server:\n");
 	  if (max < 1)
 	    return -1;
 	  rm_read (p->s, ptr+2, 1);
@@ -360,13 +360,13 @@
 	  rm_read (p->s, ptr+3, n);
 	  max -= n;
 	  ptr[3+n]=0;
-	  printf("%s\n",ptr+3);
+	  mp_msg(MSGT_OPEN, MSGL_WARN, "%s\n",ptr+3);
 	  return -1;
 	}
 	
 	if (*ptr == 'F') /* checking for server error */
 	{
-	  printf("input_pnm: server error.\n");
+	  mp_msg(MSGT_OPEN, MSGL_ERR, "input_pnm: server error.\n");
 	  return -1;
 	}
 	if (*ptr == 'i')
@@ -396,7 +396,7 @@
     case MDPR_TAG:
     case CONT_TAG:
       if (chunk_size > max || chunk_size < PREAMBLE_SIZE) {
-        printf("error: max chunk size exeeded (max was 0x%04x)\n", max);
+        mp_msg(MSGT_OPEN, MSGL_ERR, "error: max chunk size exceded (max was 0x%04x)\n", max);
 #ifdef LOG
         n=rm_read (p->s, &data[PREAMBLE_SIZE], 0x100 - PREAMBLE_SIZE);
         hexdump(data,n+PREAMBLE_SIZE);
@@ -531,7 +531,7 @@
   while(1) {
     if (HEADER_SIZE-size<=0)
     {
-      printf("input_pnm: header buffer overflow. exiting\n");
+      mp_msg(MSGT_OPEN, MSGL_ERR, "input_pnm: header buffer overflow. exiting\n");
       return 0;
     }
     chunk_size=pnm_get_chunk(p,HEADER_SIZE-size,&chunk_type,ptr,&nr);
@@ -554,7 +554,7 @@
   }
   
   if (!prop_hdr) {
-    printf("input_pnm: error while parsing headers.\n");
+    mp_msg(MSGT_OPEN, MSGL_ERR, "input_pnm: error while parsing headers.\n");
     return 0;
   }
   
@@ -639,14 +639,14 @@
         return 1;
       /* does not help, we guess type 0     */
 #ifdef LOG
-      printf("guessing stream# 0\n");
+      mp_msg(MSGT_OPEN, MSGL_INFO, "guessing stream# 0\n");
 #endif
       p->seq_num[0]=p->seq_current[0]+1;
       p->seq_num[1]=p->seq_current[1]+1;
       return 0;
       break;
   }
-  printf("input_pnm: wow, something very nasty happened in pnm_calc_stream\n");
+  mp_msg(MSGT_OPEN, MSGL_ERR, "input_pnm: wow, something very nasty happened in pnm_calc_stream\n");
   return 2;
 }
 
@@ -683,7 +683,7 @@
     n = rm_read (p->s, p->buffer, 8);
     if (n<8) return 0;
 #ifdef LOG
-    printf("input_pnm: had to seek 8 bytes on 0x62\n");
+    mp_msg(MSGT_OPEN, MSGL_WARN, "input_pnm: had to seek 8 bytes on 0x62\n");
 #endif
   }
   
@@ -694,12 +694,12 @@
 
     rm_read (p->s, &p->buffer[8], size-5);
     p->buffer[size+3]=0;
-    printf("input_pnm: got message from server while reading stream:\n%s\n", &p->buffer[3]);
+    mp_msg(MSGT_OPEN, MSGL_WARN, "input_pnm: got message from server while reading stream:\n%s\n", &p->buffer[3]);
     return -1;
   }
   if (p->buffer[0] == 'F')
   {
-    printf("input_pnm: server error.\n");
+    mp_msg(MSGT_OPEN, MSGL_ERR, "input_pnm: server error.\n");
     return -1;
   }
 
@@ -718,13 +718,13 @@
   }
 
 #ifdef LOG
-  if (n) printf("input_pnm: had to seek %i bytes to next chunk\n", n);
+  if (n) mp_msg(MSGT_OPEN, MSGL_WARN, "input_pnm: had to seek %i bytes to next chunk\n", n);
 #endif
 
   /* check for 'Z's */
   if ((p->buffer[0] != 0x5a)||(p->buffer[7] != 0x5a))
   {
-    printf("input_pnm: bad boundaries\n");
+    mp_msg(MSGT_OPEN, MSGL_ERR, "input_pnm: bad boundaries\n");
     hexdump(p->buffer, 8);
     return 0;
   }
@@ -734,7 +734,7 @@
   fof2=BE_16(&p->buffer[3]);
   if (fof1 != fof2)
   {
-    printf("input_pnm: frame offsets are different: 0x%04x 0x%04x\n",fof1,fof2);
+    mp_msg(MSGT_OPEN, MSGL_ERR, "input_pnm: frame offsets are different: 0x%04x 0x%04x\n",fof1,fof2);
     return 0;
   }
 
@@ -780,7 +780,7 @@
 }
 
 // pnm_t *pnm_connect(const char *mrl) {
-pnm_t *pnm_connect(int fd, char *path) {
+static pnm_t *pnm_connect(int fd, char *path) {
   
   pnm_t *p=malloc(sizeof(pnm_t));
   int need_response=0;
@@ -790,7 +790,7 @@
 
   pnm_send_request(p,pnm_available_bandwidths[10]);
   if (!pnm_get_headers(p, &need_response)) {
-    printf ("input_pnm: failed to set up stream\n");
+    mp_msg(MSGT_OPEN, MSGL_ERR, "input_pnm: failed to set up stream\n");
     free(p->path);
     free(p);
     return NULL;
@@ -809,7 +809,7 @@
   return p;
 }
 
-int pnm_read (pnm_t *this, char *data, int len) {
+static int pnm_read (pnm_t *this, char *data, int len) {
   
   int to_copy=len;
   char *dest=data;
@@ -827,7 +827,7 @@
 
     if ((retval = pnm_get_stream_chunk (this)) <= 0) {
 #ifdef LOG
-      printf ("input_pnm: %d of %d bytes provided\n", len-to_copy, len);
+      mp_msg(MSGT_OPEN, MSGL_INFO, "input_pnm: %d of %d bytes provided\n", len-to_copy, len);
 #endif
       if (retval < 0)
         return retval;
--- a/libmpdemux/realrtsp/rtsp.c	Fri Jun 03 14:52:15 2005 +0000
+++ b/libmpdemux/realrtsp/rtsp.c	Fri Jun 03 15:33:26 2005 +0000
@@ -119,7 +119,7 @@
 
   s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);  
   if (s == -1) {
-    printf ("rtsp: socket(): %s\n", strerror(errno));
+    mp_msg(MSGT_OPEN, MSGL_ERR, "rtsp: socket(): %s\n", strerror(errno));
     return -1;
   }
 
@@ -133,7 +133,7 @@
 #else
       && WSAGetLastError() == WSAEINPROGRESS) {
 #endif
-    printf ("rtsp: connect(): %s\n", strerror(errno));
+    mp_msg(MSGT_OPEN, MSGL_ERR, "rtsp: connect(): %s\n", strerror(errno));
     closesocket(s);
     return -1;
   }
@@ -148,7 +148,7 @@
   
   h = gethostbyname(host);
   if (h == NULL) {
-    printf ("rtsp: unable to resolve '%s'.\n", host);
+    mp_msg(MSGT_OPEN, MSGL_ERR, "rtsp: unable to resolve '%s'.\n", host);
     return -1;
   }
 
@@ -160,7 +160,7 @@
     if(s != -1)
       return s;
   }
-  printf ("rtsp: unable to connect to '%s'.\n", host);
+  mp_msg(MSGT_OPEN, MSGL_ERR, "rtsp: unable to connect to '%s'.\n", host);
   return -1;
 }
 
@@ -217,7 +217,7 @@
         continue;
       }
       
-      printf ("rtsp: read error.\n");
+      mp_msg(MSGT_OPEN, MSGL_ERR, "rtsp: read error.\n");
       return ret;
     } else
       total += ret;
@@ -237,31 +237,31 @@
 
   int i;
 
-  printf ("rtsp: ascii>");
+  mp_msg(MSGT_OPEN, MSGL_INFO, "rtsp: ascii>");
   for (i = 0; i < length; i++) {
     unsigned char c = buf[i];
 
     if ((c >= 32) && (c <= 128))
-      printf ("%c", c);
+      mp_msg(MSGT_OPEN, MSGL_INFO, "%c", c);
     else
-      printf (".");
+      mp_msg(MSGT_OPEN, MSGL_INFO, ".");
   }
-  printf ("\n");
+  mp_msg(MSGT_OPEN, MSGL_INFO, "\n");
 
-  printf ("rtsp: hexdump> ");
+  mp_msg(MSGT_OPEN, MSGL_INFO, "rtsp: hexdump> ");
   for (i = 0; i < length; i++) {
     unsigned char c = buf[i];
 
-    printf ("%02x", c);
+    mp_msg(MSGT_OPEN, MSGL_INFO, "%02x", c);
 
     if ((i % 16) == 15)
-      printf ("\nrtsp:         ");
+      mp_msg(MSGT_OPEN, MSGL_INFO, "\nrtsp:         ");
 
     if ((i % 2) == 1)
-      printf (" ");
+      mp_msg(MSGT_OPEN, MSGL_INFO, " ");
 
   }
-  printf ("\n");
+  mp_msg(MSGT_OPEN, MSGL_INFO, "\n");
 }
 #endif
 
@@ -283,7 +283,7 @@
   }
 
   if (n>=BUF_SIZE) {
-    printf("librtsp: buffer overflow in rtsp_get\n");
+    mp_msg(MSGT_OPEN, MSGL_FATAL, "librtsp: buffer overflow in rtsp_get\n");
     exit(1);
   }
   string=malloc(sizeof(char)*n);
@@ -291,7 +291,7 @@
   string[n-1]=0;
 
 #ifdef LOG
-  printf("librtsp: << '%s'\n", string);
+  mp_msg(MSGT_OPEN, MSGL_INFO, "librtsp: << '%s'\n", string);
 #endif
   
 
@@ -309,7 +309,7 @@
   char *buf=malloc(sizeof(char)*len+2);
 
 #ifdef LOG
-  printf("librtsp: >> '%s'", string);
+  mp_msg(MSGT_OPEN, MSGL_INFO, "librtsp: >> '%s'", string);
 #endif
 
   memcpy(buf,string,len);
@@ -319,7 +319,7 @@
   write_stream(s->s, buf, len+2);
   
 #ifdef LOG
-  printf(" done.\n");
+  mp_msg(MSGT_OPEN, MSGL_INFO, " done.\n");
 #endif
 
   free(buf);
@@ -344,7 +344,7 @@
     return RTSP_STATUS_SET_PARAMETER;
   }
 
-  if(code != 200) printf("librtsp: server responds: '%s'\n",string);
+  if(code != 200) mp_msg(MSGT_OPEN, MSGL_INFO, "librtsp: server responds: '%s'\n",string);
 
   return code;
 }
@@ -421,7 +421,7 @@
       sscanf(answer,"Cseq: %u",&answer_seq);
       if (s->cseq != answer_seq) {
 #ifdef LOG
-        printf("librtsp: warning: Cseq mismatch. got %u, assumed %u", answer_seq, s->cseq);
+        mp_msg(MSGT_OPEN, MSGL_WARN, "librtsp: warning: Cseq mismatch. got %u, assumed %u", answer_seq, s->cseq);
 #endif
         s->cseq=answer_seq;
       }
@@ -438,14 +438,14 @@
       sscanf(answer,"Session: %s",buf);
       if (s->session) {
         if (strcmp(buf, s->session)) {
-          printf("rtsp: warning: setting NEW session: %s\n", buf);
+          mp_msg(MSGT_OPEN, MSGL_WARN, "rtsp: warning: setting NEW session: %s\n", buf);
           free(s->session);
           s->session=strdup(buf);
         }
       } else
       {
 #ifdef LOG
-        printf("rtsp: setting session id to: %s\n", buf);
+        mp_msg(MSGT_OPEN, MSGL_INFO, "rtsp: setting session id to: %s\n", buf);
 #endif
         s->session=strdup(buf);
       }
@@ -593,7 +593,7 @@
       free(rest);
       if (seq<0) {
 #ifdef LOG
-        printf("rtsp: warning: cseq not recognized!\n");
+        mp_msg(MSGT_OPEN, MSGL_WARN, "rtsp: warning: cseq not recognized!\n");
 #endif
         seq=1;
       }
@@ -612,7 +612,7 @@
   } else
     i=read_stream(s->s, buffer, size);
 #ifdef LOG
-  printf("librtsp: << %d of %d bytes\n", i, size);
+  mp_msg(MSGT_OPEN, MSGL_INFO, "librtsp: << %d of %d bytes\n", i, size);
 #endif
 
   return i;
@@ -653,12 +653,12 @@
     path++;
   if ((s->param = strchr(s->path, '?')) != NULL)
     s->param++;
-  //printf("path=%s\n", s->path);
-  //printf("param=%s\n", s->param ? s->param : "NULL");
+  //mp_msg(MSGT_OPEN, MSGL_INFO, "path=%s\n", s->path);
+  //mp_msg(MSGT_OPEN, MSGL_INFO, "param=%s\n", s->param ? s->param : "NULL");
   s->s = fd;
 
   if (s->s < 0) {
-    printf ("rtsp: failed to connect to '%s'\n", s->host);
+    mp_msg(MSGT_OPEN, MSGL_ERR, "rtsp: failed to connect to '%s'\n", s->host);
     rtsp_close(s);
     return NULL;
   }