[MPlayer-cvslog] CVS: main/libmpdemux pnm.c,1.10,1.11

Roberto Togni CVS syncmail at mplayerhq.hu
Sat Apr 9 15:44:45 CEST 2005


CVS change done by Roberto Togni CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv24289

Modified Files:
	pnm.c 
Log Message:
Stop streaming if we got a server error or message on pnm streaming.
This is needed to stop playback for pnm streams where mplayer can't 
authenticate, and avoid an endless list of "input pnm: read error".


Index: pnm.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/pnm.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- pnm.c	15 Dec 2004 21:27:14 -0000	1.10
+++ pnm.c	9 Apr 2005 13:44:43 -0000	1.11
@@ -301,7 +301,7 @@
  * and returns number of bytes read 
  */
 
-static unsigned int pnm_get_chunk(pnm_t *p, 
+static int pnm_get_chunk(pnm_t *p, 
                          unsigned int max,
                          unsigned int *chunk_type,
                          char *data, int *need_response) {
@@ -688,12 +688,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]);
-    return 0;
+    return -1;
   }
   if (p->buffer[0] == 'F')
   {
     printf("input_pnm: server error.\n");
-    return 0;
+    return -1;
   }
 
   /* skip bytewise to next chunk.
@@ -808,6 +808,7 @@
   char *dest=data;
   char *source=this->recv + this->recv_read;
   int fill=this->recv_size - this->recv_read;
+  int retval;
   
   if (len < 0) return 0;
   while (to_copy > fill) {
@@ -817,10 +818,13 @@
     dest += fill;
     this->recv_read=0;
 
-    if (!pnm_get_stream_chunk (this)) {
+    if ((retval = pnm_get_stream_chunk (this)) <= 0) {
 #ifdef LOG
       printf ("input_pnm: %d of %d bytes provided\n", len-to_copy, len);
 #endif
+      if (retval < 0)
+        return retval;
+      else
       return len-to_copy;
     }
     source = this->recv;




More information about the MPlayer-cvslog mailing list