1
0
mirror of http://mpg123.de/trunk/.git synced 2025-10-26 15:31:15 +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:
thor
2018-02-04 11:42:14 +00:00
parent 585b608968
commit 6dd4c500fb
5 changed files with 19 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ Changes in libmpg123 libtool interface versions...
- added MPG123_STORE_RAW_ID3 and mpg123_id3_raw() - added MPG123_STORE_RAW_ID3 and mpg123_id3_raw()
- added mpg123_new_string() and mpg123_delete_string() - added mpg123_new_string() and mpg123_delete_string()
- added MPG123_FORCE_ENDIAN and MPG123_BIG_ENDIAN - added MPG123_FORCE_ENDIAN and MPG123_BIG_ENDIAN
- added MPG123_NO_READAHEAD and MPG123_FREEFORMAT_SIZE
44.0.44 44.0.44
- added mpg123_getformat2() - added mpg123_getformat2()

View File

@@ -64,6 +64,7 @@ static void frame_default_pars(mpg123_pars *mp)
mp->feedpool = 5; mp->feedpool = 5;
mp->feedbuffer = 4096; mp->feedbuffer = 4096;
#endif #endif
mp->freeformat_framesize = -1;
} }
void frame_init(mpg123_handle *fr) void frame_init(mpg123_handle *fr)
@@ -564,7 +565,7 @@ static void frame_fixed_reset(mpg123_handle *fr)
#endif #endif
fr->halfphase = 0; /* here or indeed only on first-time init? */ fr->halfphase = 0; /* here or indeed only on first-time init? */
fr->error_protection = 0; fr->error_protection = 0;
fr->freeformat_framesize = -1; fr->freeformat_framesize = fr->p.freeformat_framesize;
fr->enc_delay = -1; fr->enc_delay = -1;
fr->enc_padding = -1; fr->enc_padding = -1;
memset(fr->id3buf, 0, sizeof(fr->id3buf)); memset(fr->id3buf, 0, sizeof(fr->id3buf));

View File

@@ -84,6 +84,7 @@ struct mpg123_pars_struct
long feedpool; long feedpool;
long feedbuffer; long feedbuffer;
#endif #endif
long freeformat_framesize;
}; };
enum frame_state_flags enum frame_state_flags

View File

@@ -255,6 +255,9 @@ int attribute_align_arg mpg123_par(mpg123_pars *mp, enum mpg123_parms key, long
ret = MPG123_MISSING_FEATURE; ret = MPG123_MISSING_FEATURE;
#endif #endif
break; break;
case MPG123_FREEFORMAT_SIZE:
mp->freeformat_framesize = val;
break;
default: default:
ret = MPG123_BAD_PARAM; 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; ret = MPG123_MISSING_FEATURE;
#endif #endif
break; break;
case MPG123_FREEFORMAT_SIZE:
*val = mp->freeformat_framesize;
break;
default: default:
ret = MPG123_BAD_PARAM; ret = MPG123_BAD_PARAM;
} }

View File

@@ -543,7 +543,9 @@ init_resync:
if(!fr->firsthead) 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 */ /* 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); if(ret < 0) fr->rd->back_bytes(fr, 4);
JUMP_CONCLUSION(ret); JUMP_CONCLUSION(ret);
@@ -787,6 +789,12 @@ static int decode_header(mpg123_handle *fr,unsigned long newhead, int *freeforma
if(fr->freeformat_framesize < 0) if(fr->freeformat_framesize < 0)
{ {
int ret; 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; *freeformat_count += 1;
if(*freeformat_count > 5) if(*freeformat_count > 5)
{ {