Commit 52fdb71e authored by smorlat's avatar smorlat
Browse files

rewind in case of not a wav.

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@517 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent 70867604
......@@ -70,17 +70,17 @@ static int read_wav_header(PlayerData *d){
len = read(d->fd, header1, sizeof(header1)) ;
if (len != sizeof(header1)){
return -1;
goto not_a_wav;
}
if (0!=strncmp(riff_chunk->riff, "RIFF", 4) || 0!=strncmp(riff_chunk->wave, "WAVE", 4)){
return -1;
goto not_a_wav;
}
len = read(d->fd, header2, sizeof(header2)) ;
if (len != sizeof(header2)){
ms_warning("Wrong wav header: cannot read file");
return -1;
goto not_a_wav;
}
d->rate=le_uint32(format_chunk->rate);
......@@ -96,7 +96,7 @@ static int read_wav_header(PlayerData *d){
len = read(d->fd, header3, sizeof(header3)) ;
if (len != sizeof(header3)){
ms_warning("Wrong wav header: cannot read file");
return -1;
goto not_a_wav;
}
count=0;
while (strncmp(data_chunk->data, "data", 4)!=0 && count<30)
......@@ -109,7 +109,7 @@ static int read_wav_header(PlayerData *d){
len = read(d->fd, header3, sizeof(header3)) ;
if (len != sizeof(header3)){
ms_warning("Wrong wav header: cannot read file");
return -1;
goto not_a_wav;
}
}
#ifdef WORDS_BIGENDIAN
......@@ -117,6 +117,11 @@ static int read_wav_header(PlayerData *d){
d->swap=TRUE;
#endif
return 0;
not_a_wav:
/*rewind*/
lseek(d->fd,0,SEEK_SET);
return -1;
}
static int player_open(MSFilter *f, void *arg){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment