X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=modules%2Faudio_output%2Ffile.c;h=47dafb7a58dd590d73c30bc8aa69cc251bbaac85;hb=4b9f4ff644a2bec2461a882fb4e064195cf19b2d;hp=19a56e7f019c7a7d03d0f3f71522ba55c5f91402;hpb=d596c8e310c0788ade456e86f76735fb069b0b5a;p=vlc diff --git a/modules/audio_output/file.c b/modules/audio_output/file.c index 19a56e7f01..47dafb7a58 100644 --- a/modules/audio_output/file.c +++ b/modules/audio_output/file.c @@ -2,7 +2,7 @@ * file.c : audio output which writes the samples to a file ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: file.c,v 1.28 2004/02/03 23:31:46 gbazin Exp $ + * $Id$ * * Authors: Christophe Massiot * Gildas Bazin @@ -38,23 +38,6 @@ #define FRAME_SIZE 2048 #define A52_FRAME_NB 1536 -typedef struct WAVEHEADER -{ - uint32_t MainChunkID; // it will be 'RIFF' - uint32_t Length; - uint32_t ChunkTypeID; // it will be 'WAVE' - uint32_t SubChunkID; // it will be 'fmt ' - uint32_t SubChunkLength; - uint16_t Format; - uint16_t Modus; - uint32_t SampleFreq; - uint32_t BytesPerSec; - uint16_t BytesPerSample; - uint16_t BitsPerSample; - uint32_t DataChunkID; // it will be 'data' - uint32_t DataLength; -} WAVEHEADER; - /***************************************************************************** * aout_sys_t: audio output method descriptor ***************************************************************************** @@ -103,7 +86,7 @@ static void Play ( aout_instance_t * ); "will be saved but you can restrict the number of channels here.") #define WAV_TEXT N_("Add wave header") -#define WAV_LONGTEXT N_("Instead of writing a raw file, you can add a wav " \ +#define WAV_LONGTEXT N_("Instead of writing a raw file, you can add a WAV " \ "header to the file") static char *format_list[] = { "u8", "s8", "u16", "s16", "u16_le", "s16_le", @@ -272,6 +255,15 @@ static int Open( vlc_object_t * p_this ) wh->DataChunkID = VLC_FOURCC('d', 'a', 't', 'a'); wh->DataLength = 0; /* temp, to be filled in as we go */ + /* Header -> little endian format */ + SetWLE( &wh->Format, wh->Format ); + SetWLE( &wh->BitsPerSample, wh->BitsPerSample ); + SetDWLE( &wh->SubChunkLength, wh->SubChunkLength ); + SetWLE( &wh->Modus, wh->Modus ); + SetDWLE( &wh->SampleFreq, wh->SampleFreq ); + SetWLE( &wh->BytesPerSample, wh->BytesPerSample ); + SetDWLE( &wh->BytesPerSec, wh->BytesPerSec ); + if( fwrite( wh, sizeof(WAVEHEADER), 1, p_aout->output.p_sys->p_file ) != 1 ) { @@ -302,6 +294,13 @@ static void Close( vlc_object_t * p_this ) { msg_Err( p_aout, "seek error (%s)", strerror(errno) ); } + + /* Header -> little endian format */ + SetDWLE( &p_aout->output.p_sys->waveh.Length, + p_aout->output.p_sys->waveh.Length ); + SetDWLE( &p_aout->output.p_sys->waveh.DataLength, + p_aout->output.p_sys->waveh.DataLength ); + if( fwrite( &p_aout->output.p_sys->waveh, sizeof(WAVEHEADER), 1, p_aout->output.p_sys->p_file ) != 1 ) {