1
0
mirror of http://mpg123.de/trunk/.git synced 2025-10-29 14:09:21 +03:00

libmpg123: no MPG123_NEED_MORE for non-feeder

git-svn-id: svn://scm.orgis.org/mpg123/trunk@4622 35dc7657-300d-0410-a2e5-dc2837fedb53
This commit is contained in:
thor
2020-03-16 08:20:45 +00:00
parent b3a03cd800
commit 78a175b662
4 changed files with 13 additions and 17 deletions

5
NEWS
View File

@@ -1,8 +1,6 @@
1.26.0
------
TODO: avoid MPG123_NEED_MORE from non-feed reader reading frame
bodies or see it as a feature
TODO: Figure out terminal printout encoding for Windows.
TODO: Fix up --quiet: either all errors or none, I guess errors should
still be shown, but only fatal ones (no junk in the beginning stuff)
@@ -90,6 +88,9 @@ TODO: Make libout123 and/or mpg123 use that to convert on the fly. Optionally?
opening. This was never recommened and only now should work at all.
-- Also mpg123_decode_frame() now sets return buffer to NULL and returned byte
count to zero in case of MPG123_NEED_MORE (or any other early abort).
-- MPG123_NEED_MORE not returned anymore for non-feeder streams. Got in
there for generic partial frame body reads, but was only intended for
feeder API.
-- Added mpg123_set_moreinfo() to support the Lame project's frame analyzer,
disabled by ./configure --disable-moreinfo.
-- Added optional storage and retrieval of raw ID3 data.

View File

@@ -565,7 +565,7 @@ init_resync:
if((ret=fr->rd->read_frame_body(fr,newbuf,fr->framesize))<0)
{
/* if failed: flip back */
debug("need more?");
debug1("%s", ret == MPG123_NEED_MORE ? "need more" : "read error");
goto read_frame_bad;
}
fr->bsbufold = fr->bsbuf;

View File

@@ -384,18 +384,12 @@ static int stream_back_bytes(mpg123_handle *fr, off_t bytes)
}
/* returns size on success... */
/* returns size on success... otherwise an error code < 0 */
static int generic_read_frame_body(mpg123_handle *fr,unsigned char *buf, int size)
{
long l;
if((l=fr->rd->fullread(fr,buf,size)) != size)
{
long ll = l;
if(ll <= 0) ll = 0;
return READER_MORE;
}
return l;
l=fr->rd->fullread(fr,buf,size);
return (l >= 0 && l<size) ? READER_ERROR : l;
}
static off_t generic_tell(mpg123_handle *fr)
@@ -849,6 +843,8 @@ static ssize_t buffered_fullread(mpg123_handle *fr, unsigned char *out, ssize_t
{
struct bufferchain *bc = &fr->rdat.buffer;
ssize_t gotcount;
if(VERBOSE3)
mdebug("buffered_fullread: want %zd", count);
if(bc->size - bc->pos < count)
{ /* Add more stuff to buffer. If hitting end of file, adjust count. */
unsigned char readbuf[4096];
@@ -881,9 +877,8 @@ static ssize_t buffered_fullread(mpg123_handle *fr, unsigned char *out, ssize_t
count = bc->size - bc->pos; /* We want only what we got. */
}
gotcount = bc_give(bc, out, count);
if(VERBOSE3) debug2("wanted %li, got %li", (long)count, (long)gotcount);
if(VERBOSE3)
mdebug("buffered_fullread: got %zd", gotcount);
if(gotcount != count){ if(NOQUIET) error("gotcount != count"); return READER_ERROR; }
else return gotcount;
}
@@ -1116,7 +1111,7 @@ static int default_init(mpg123_handle *fr)
bc_init(&fr->rdat.buffer);
fr->rdat.filelen = 0; /* We carry the offset, but never know how big the stream is. */
fr->rdat.flags |= READER_BUFFERED;
#endif /* NO_FEEDER */
#endif /* NO_ICY */
}
return 0;
}

View File

@@ -826,7 +826,7 @@ int play_frame(void)
{
if(!param.quiet && mc == MPG123_ERR) error1("...in decoding next frame: %s", mpg123_strerror(mh));
if(!param.quiet && mc == MPG123_NEED_MORE)
error("The decoder expected more. File cut off early?");
error("The decoder expected more. Old libmpg123 that does this for non-feed readers?");
if(mc != MPG123_DONE && !got_played)
got_played = -1;
return 0;