mirror of
http://mpg123.de/trunk/.git
synced 2025-08-06 10:02:38 +03:00
hotfix for endless free format search
git-svn-id: svn://scm.orgis.org/mpg123/trunk@3191 35dc7657-300d-0410-a2e5-dc2837fedb53
This commit is contained in:
@@ -78,6 +78,12 @@ push(@mpg123_command, '-k', $frame, '--listentry', $entry, '-@', $listfile);
|
|||||||
print STDERR "running player:\n\t@mpg123_command\n\n";
|
print STDERR "running player:\n\t@mpg123_command\n\n";
|
||||||
|
|
||||||
open(MPG123, '-|', @mpg123_command) or die "Cannot run mpg123!";
|
open(MPG123, '-|', @mpg123_command) or die "Cannot run mpg123!";
|
||||||
|
|
||||||
|
sleep(1);
|
||||||
|
print "What do yo think of this year?\n";
|
||||||
|
my $ans = <STDIN>;
|
||||||
|
print "You said: $ans";
|
||||||
|
|
||||||
while(<MPG123>)
|
while(<MPG123>)
|
||||||
{
|
{
|
||||||
print STDOUT $_;
|
print STDOUT $_;
|
||||||
|
@@ -61,7 +61,7 @@ static const int tabsel_123[2][3][16] =
|
|||||||
|
|
||||||
static const long freqs[9] = { 44100, 48000, 32000, 22050, 24000, 16000 , 11025 , 12000 , 8000 };
|
static const long freqs[9] = { 44100, 48000, 32000, 22050, 24000, 16000 , 11025 , 12000 , 8000 };
|
||||||
|
|
||||||
static int decode_header(mpg123_handle *fr,unsigned long newhead);
|
static int decode_header(mpg123_handle *fr,unsigned long newhead, int *freeformat_count);
|
||||||
static int skip_junk(mpg123_handle *fr, unsigned long *newheadp, long *headcount);
|
static int skip_junk(mpg123_handle *fr, unsigned long *newheadp, long *headcount);
|
||||||
static int do_readahead(mpg123_handle *fr, unsigned long newhead);
|
static int do_readahead(mpg123_handle *fr, unsigned long newhead);
|
||||||
static int wetwork(mpg123_handle *fr, unsigned long *newheadp);
|
static int wetwork(mpg123_handle *fr, unsigned long *newheadp);
|
||||||
@@ -445,6 +445,7 @@ else if(ret == PARSE_RESYNC) goto init_resync; \
|
|||||||
int read_frame(mpg123_handle *fr)
|
int read_frame(mpg123_handle *fr)
|
||||||
{
|
{
|
||||||
/* TODO: rework this thing */
|
/* TODO: rework this thing */
|
||||||
|
int freeformat_count = 0;
|
||||||
unsigned long newhead;
|
unsigned long newhead;
|
||||||
off_t framepos;
|
off_t framepos;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -495,7 +496,7 @@ init_resync:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
ret = head_check(newhead);
|
ret = head_check(newhead);
|
||||||
if(ret) ret = decode_header(fr, newhead);
|
if(ret) ret = decode_header(fr, newhead, &freeformat_count);
|
||||||
|
|
||||||
JUMP_CONCLUSION(ret); /* That only continues for ret == 0 or 1 */
|
JUMP_CONCLUSION(ret); /* That only continues for ret == 0 or 1 */
|
||||||
if(ret == 0)
|
if(ret == 0)
|
||||||
@@ -667,7 +668,7 @@ static int guess_freeformat_framesize(mpg123_handle *fr)
|
|||||||
* <0: some error
|
* <0: some error
|
||||||
* You are required to do a head_check() before calling!
|
* You are required to do a head_check() before calling!
|
||||||
*/
|
*/
|
||||||
static int decode_header(mpg123_handle *fr,unsigned long newhead)
|
static int decode_header(mpg123_handle *fr,unsigned long newhead, int *freeformat_count)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG /* Do not waste cycles checking the header twice all the time. */
|
#ifdef DEBUG /* Do not waste cycles checking the header twice all the time. */
|
||||||
if(!head_check(newhead))
|
if(!head_check(newhead))
|
||||||
@@ -724,6 +725,12 @@ static int decode_header(mpg123_handle *fr,unsigned long newhead)
|
|||||||
if(fr->freeformat_framesize < 0)
|
if(fr->freeformat_framesize < 0)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
*freeformat_count += 1;
|
||||||
|
if(*freeformat_count > 5)
|
||||||
|
{
|
||||||
|
error("You fooled me too often. Refusing to guess free format frame size _again_.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
ret = guess_freeformat_framesize(fr);
|
ret = guess_freeformat_framesize(fr);
|
||||||
if(ret>0)
|
if(ret>0)
|
||||||
{
|
{
|
||||||
@@ -1015,6 +1022,7 @@ static int handle_id3v2(mpg123_handle *fr, unsigned long newhead)
|
|||||||
static int skip_junk(mpg123_handle *fr, unsigned long *newheadp, long *headcount)
|
static int skip_junk(mpg123_handle *fr, unsigned long *newheadp, long *headcount)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
int freeformat_count = 0;
|
||||||
long limit = 65536;
|
long limit = 65536;
|
||||||
unsigned long newhead = *newheadp;
|
unsigned long newhead = *newheadp;
|
||||||
/* check for id3v2; first three bytes (of 4) are "ID3" */
|
/* check for id3v2; first three bytes (of 4) are "ID3" */
|
||||||
@@ -1064,7 +1072,7 @@ static int skip_junk(mpg123_handle *fr, unsigned long *newheadp, long *headcount
|
|||||||
|
|
||||||
if((ret=fr->rd->head_shift(fr,&newhead))<=0) return ret;
|
if((ret=fr->rd->head_shift(fr,&newhead))<=0) return ret;
|
||||||
|
|
||||||
if(head_check(newhead) && (ret=decode_header(fr, newhead))) break;
|
if(head_check(newhead) && (ret=decode_header(fr, newhead, &freeformat_count))) break;
|
||||||
} while(1);
|
} while(1);
|
||||||
if(ret<0) return ret;
|
if(ret<0) return ret;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user