# HG changeset patch # User rtognimp # Date 1113054283 0 # Node ID 1a02a23202c2b3e48c4d98d992b05d1ad3fd8972 # Parent 737cc83784fbc55da749ae296641e455e48d54b3 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". diff -r 737cc83784fb -r 1a02a23202c2 libmpdemux/pnm.c --- a/libmpdemux/pnm.c Sat Apr 09 11:30:59 2005 +0000 +++ b/libmpdemux/pnm.c Sat Apr 09 13:44:43 2005 +0000 @@ -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;