summaryrefslogtreecommitdiffstats
path: root/libao2/ao_pcm.c
diff options
context:
space:
mode:
authoralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-06-22 12:10:02 +0000
committeralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-06-22 12:10:02 +0000
commit3a376cd09cbb25fcd3a1a883cd444f6412c1b391 (patch)
treebe72df9b26d6289c35922e2c6ef87872565a3fb8 /libao2/ao_pcm.c
parent88c475968f50f76fdafe323f1cf349aafd03aa47 (diff)
downloadmpv-3a376cd09cbb25fcd3a1a883cd444f6412c1b391.tar.bz2
mpv-3a376cd09cbb25fcd3a1a883cd444f6412c1b391.tar.xz
Allow writing to pipe.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6502 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2/ao_pcm.c')
-rw-r--r--libao2/ao_pcm.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libao2/ao_pcm.c b/libao2/ao_pcm.c
index 34ffa005e6..2c2ebfb0cd 100644
--- a/libao2/ao_pcm.c
+++ b/libao2/ao_pcm.c
@@ -109,7 +109,7 @@ static int init(int rate,int channels,int format,int flags){
if(fp) {
if(ao_pcm_waveheader) /* Reserve space for wave header */
- fseek(fp, sizeof(wavhdr), SEEK_SET);
+ fwrite(&wavhdr,sizeof(wavhdr),1,fp);
return 1;
}
printf("PCM: Failed to open %s for writing!\n", ao_outputfilename);
@@ -119,10 +119,9 @@ static int init(int rate,int channels,int format,int flags){
// close audio device
static void uninit(){
- if(ao_pcm_waveheader){ /* Write wave header */
+ if(ao_pcm_waveheader && fseek(fp, 0, SEEK_SET) == 0){ /* Write wave header */
wavhdr.file_length = wavhdr.data_length + sizeof(wavhdr) - 8;
wavhdr.file_length = le2me_32(wavhdr.file_length);
- fseek(fp, 0, SEEK_SET);
fwrite(&wavhdr,sizeof(wavhdr),1,fp);
}
fclose(fp);