mirror of
http://mpg123.de/trunk/.git
synced 2025-10-25 04:37:34 +03:00
libmpg123: add MPG123_FREEFORMAT_SIZE and MPG123_NO_READAHEAD
git-svn-id: svn://scm.orgis.org/mpg123/trunk@4394 35dc7657-300d-0410-a2e5-dc2837fedb53
This commit is contained in:
@@ -12,6 +12,7 @@ Changes in libmpg123 libtool interface versions...
|
||||
- added MPG123_STORE_RAW_ID3 and mpg123_id3_raw()
|
||||
- added mpg123_new_string() and mpg123_delete_string()
|
||||
- added MPG123_FORCE_ENDIAN and MPG123_BIG_ENDIAN
|
||||
- added MPG123_NO_READAHEAD and MPG123_FREEFORMAT_SIZE
|
||||
|
||||
44.0.44
|
||||
- added mpg123_getformat2()
|
||||
|
||||
@@ -64,6 +64,7 @@ static void frame_default_pars(mpg123_pars *mp)
|
||||
mp->feedpool = 5;
|
||||
mp->feedbuffer = 4096;
|
||||
#endif
|
||||
mp->freeformat_framesize = -1;
|
||||
}
|
||||
|
||||
void frame_init(mpg123_handle *fr)
|
||||
@@ -564,7 +565,7 @@ static void frame_fixed_reset(mpg123_handle *fr)
|
||||
#endif
|
||||
fr->halfphase = 0; /* here or indeed only on first-time init? */
|
||||
fr->error_protection = 0;
|
||||
fr->freeformat_framesize = -1;
|
||||
fr->freeformat_framesize = fr->p.freeformat_framesize;
|
||||
fr->enc_delay = -1;
|
||||
fr->enc_padding = -1;
|
||||
memset(fr->id3buf, 0, sizeof(fr->id3buf));
|
||||
|
||||
@@ -84,6 +84,7 @@ struct mpg123_pars_struct
|
||||
long feedpool;
|
||||
long feedbuffer;
|
||||
#endif
|
||||
long freeformat_framesize;
|
||||
};
|
||||
|
||||
enum frame_state_flags
|
||||
|
||||
@@ -255,6 +255,9 @@ int attribute_align_arg mpg123_par(mpg123_pars *mp, enum mpg123_parms key, long
|
||||
ret = MPG123_MISSING_FEATURE;
|
||||
#endif
|
||||
break;
|
||||
case MPG123_FREEFORMAT_SIZE:
|
||||
mp->freeformat_framesize = val;
|
||||
break;
|
||||
default:
|
||||
ret = MPG123_BAD_PARAM;
|
||||
}
|
||||
@@ -344,6 +347,9 @@ int attribute_align_arg mpg123_getpar(mpg123_pars *mp, enum mpg123_parms key, lo
|
||||
ret = MPG123_MISSING_FEATURE;
|
||||
#endif
|
||||
break;
|
||||
case MPG123_FREEFORMAT_SIZE:
|
||||
*val = mp->freeformat_framesize;
|
||||
break;
|
||||
default:
|
||||
ret = MPG123_BAD_PARAM;
|
||||
}
|
||||
|
||||
@@ -543,7 +543,9 @@ init_resync:
|
||||
|
||||
if(!fr->firsthead)
|
||||
{
|
||||
ret = do_readahead(fr, newhead);
|
||||
ret = fr->p.flags & MPG123_NO_READAHEAD
|
||||
? PARSE_GOOD
|
||||
: do_readahead(fr, newhead);
|
||||
/* readahead can fail mit NEED_MORE, in which case we must also make the just read header available again for next go */
|
||||
if(ret < 0) fr->rd->back_bytes(fr, 4);
|
||||
JUMP_CONCLUSION(ret);
|
||||
@@ -787,6 +789,12 @@ static int decode_header(mpg123_handle *fr,unsigned long newhead, int *freeforma
|
||||
if(fr->freeformat_framesize < 0)
|
||||
{
|
||||
int ret;
|
||||
if(fr->p.flags & MPG123_NO_READAHEAD)
|
||||
{
|
||||
if(VERBOSE3)
|
||||
error("Got no free-format frame size and am not allowed to read ahead.");
|
||||
return PARSE_BAD;
|
||||
}
|
||||
*freeformat_count += 1;
|
||||
if(*freeformat_count > 5)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user