diff options
author | rtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-04-09 13:44:43 +0000 |
---|---|---|
committer | rtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-04-09 13:44:43 +0000 |
commit | a319fea77f8d24be3a6662b4b8a65ceca1f7b254 (patch) | |
tree | 74720f76ba111a70b0f8dbe91f38776b57df1c98 /libmpdemux | |
parent | 4493ca432177c8fc54ee051144335b697b77aa0c (diff) | |
download | mpv-a319fea77f8d24be3a6662b4b8a65ceca1f7b254.tar.bz2 mpv-a319fea77f8d24be3a6662b4b8a65ceca1f7b254.tar.xz |
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".
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15077 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/pnm.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libmpdemux/pnm.c b/libmpdemux/pnm.c index 2a1850ee6b..6eb4148287 100644 --- a/libmpdemux/pnm.c +++ b/libmpdemux/pnm.c @@ -301,7 +301,7 @@ static void hexdump (char *buf, int length) { * 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 @@ static int pnm_get_stream_chunk(pnm_t *p) { 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 @@ int pnm_read (pnm_t *this, char *data, int len) { 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 @@ int pnm_read (pnm_t *this, char *data, int len) { 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; |