1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-12 01:49:33 +00:00

Allow writing to pipe.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6502 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
albeu 2002-06-22 12:10:02 +00:00
parent 88c475968f
commit 3a376cd09c

View File

@ -109,7 +109,7 @@ static int init(int rate,int channels,int format,int flags){
if(fp) { if(fp) {
if(ao_pcm_waveheader) /* Reserve space for wave header */ if(ao_pcm_waveheader) /* Reserve space for wave header */
fseek(fp, sizeof(wavhdr), SEEK_SET); fwrite(&wavhdr,sizeof(wavhdr),1,fp);
return 1; return 1;
} }
printf("PCM: Failed to open %s for writing!\n", ao_outputfilename); 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 // close audio device
static void uninit(){ 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 = wavhdr.data_length + sizeof(wavhdr) - 8;
wavhdr.file_length = le2me_32(wavhdr.file_length); wavhdr.file_length = le2me_32(wavhdr.file_length);
fseek(fp, 0, SEEK_SET);
fwrite(&wavhdr,sizeof(wavhdr),1,fp); fwrite(&wavhdr,sizeof(wavhdr),1,fp);
} }
fclose(fp); fclose(fp);