Mercurial > mplayer.hg
changeset 21022:fbf3f8cd0bf6
Add disabled EAGAIN testing code for libnut
author | ods15 |
---|---|
date | Sat, 18 Nov 2006 20:13:18 +0000 |
parents | bc0afb5afa98 |
children | f5180197d7ad |
files | libmpdemux/demux_nut.c |
diffstat | 1 files changed, 16 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demux_nut.c Sat Nov 18 19:36:28 2006 +0000 +++ b/libmpdemux/demux_nut.c Sat Nov 18 20:13:18 2006 +0000 @@ -23,10 +23,17 @@ stream_t * stream = (stream_t*)h; if(stream_eof(stream)) return 0; + //len = MIN(len, 5); return stream_read(stream, buf, len); } +static int mp_eof(void * h) { + stream_t * stream = (stream_t*)h; + if(stream_eof(stream)) return 1; + return 0; +} + static off_t mp_seek(void * h, long long pos, int whence) { stream_t * stream = (stream_t*)h; @@ -64,7 +71,7 @@ .priv = demuxer->stream, .seek = mp_seek, .read = mp_read, - .eof = NULL, + .eof = mp_eof, .file_pos = stream_tell(demuxer->stream), }, .alloc = { .malloc = NULL }, @@ -77,7 +84,8 @@ int ret; int i; - if ((ret = nut_read_headers(nut, &s, NULL))) { + while ((ret = nut_read_headers(nut, &s, NULL)) == NUT_ERR_EAGAIN); + if (ret) { mp_msg(MSGT_HEADER, MSGL_ERR, "NUT error: %s\n", nut_error(ret)); nut_demuxer_uninit(nut); free(priv); @@ -180,7 +188,7 @@ demuxer->filepos = stream_tell(demuxer->stream); if (stream_eof(demuxer->stream)) return 0; - ret = nut_read_next_packet(nut, &pd); + while ((ret = nut_read_next_packet(nut, &pd)) == NUT_ERR_EAGAIN); if (ret) { if (ret != NUT_ERR_EOF) mp_msg(MSGT_HEADER, MSGL_ERR, "NUT error: %s\n", @@ -202,7 +210,7 @@ } else { uint8_t buf[pd.len]; - ret = nut_read_frame(nut, &pd.len, buf); + while ((ret = nut_read_frame(nut, &pd.len, buf)) == NUT_ERR_EAGAIN); if (ret) { mp_msg(MSGT_HEADER, MSGL_ERR, "NUT error: %s\n", nut_error(ret)); @@ -220,7 +228,9 @@ dp->pos = demuxer->filepos; dp->flags= (pd.flags & NUT_FLAG_KEY) ? 0x10 : 0; - ret = nut_read_frame(nut, &pd.len, dp->buffer); + {int len = pd.len; + while ((ret = nut_read_frame(nut, &len, dp->buffer + pd.len-len)) == NUT_ERR_EAGAIN); + } if (ret) { mp_msg(MSGT_HEADER, MSGL_ERR, "NUT error: %s\n", nut_error(ret)); @@ -249,7 +259,7 @@ (double)priv->s[0].time_base.nom / priv->s[0].time_base.den; - ret = nut_seek(nut, time_pos, nutflags, tmp); + while ((ret = nut_seek(nut, time_pos, nutflags, tmp)) == NUT_ERR_EAGAIN); if (ret) mp_msg(MSGT_HEADER, MSGL_ERR, "NUT error: %s\n", nut_error(ret)); if (sh_audio) resync_audio_stream(sh_audio); }