Mercurial > libavformat.hg
comparison wav.c @ 858:66cc656ea404 libavformat
Replace CONFIG_ENCODERS/CONFIG_DECODERS with CONFIG_MUXERS/CONFIG_DEMUXERS
in libavformat to allow building (de)coders and (de)muxers independently at
some point + support for this option in configure.
author | diego |
---|---|
date | Fri, 23 Sep 2005 00:25:41 +0000 |
parents | fd1c2109505e |
children | 29fa250510df |
comparison
equal
deleted
inserted
replaced
857:26aaf3eed638 | 858:66cc656ea404 |
---|---|
44 { CODEC_ID_ADPCM_CT, 0x200 }, | 44 { CODEC_ID_ADPCM_CT, 0x200 }, |
45 { CODEC_ID_ADPCM_SWF, ('S'<<8)+'F' }, | 45 { CODEC_ID_ADPCM_SWF, ('S'<<8)+'F' }, |
46 { 0, 0 }, | 46 { 0, 0 }, |
47 }; | 47 }; |
48 | 48 |
49 #ifdef CONFIG_ENCODERS | 49 #ifdef CONFIG_MUXERS |
50 /* WAVEFORMATEX header */ | 50 /* WAVEFORMATEX header */ |
51 /* returns the size or -1 on error */ | 51 /* returns the size or -1 on error */ |
52 int put_wav_header(ByteIOContext *pb, AVCodecContext *enc) | 52 int put_wav_header(ByteIOContext *pb, AVCodecContext *enc) |
53 { | 53 { |
54 int bps, blkalign, bytespersec; | 54 int bps, blkalign, bytespersec; |
133 hdrsize -= 2; | 133 hdrsize -= 2; |
134 } | 134 } |
135 | 135 |
136 return hdrsize; | 136 return hdrsize; |
137 } | 137 } |
138 #endif //CONFIG_ENCODERS | 138 #endif //CONFIG_MUXERS |
139 | 139 |
140 /* We could be given one of the three possible structures here: | 140 /* We could be given one of the three possible structures here: |
141 * WAVEFORMAT, PCMWAVEFORMAT or WAVEFORMATEX. Each structure | 141 * WAVEFORMAT, PCMWAVEFORMAT or WAVEFORMATEX. Each structure |
142 * is an expansion of the previous one with the fields added | 142 * is an expansion of the previous one with the fields added |
143 * at the bottom. PCMWAVEFORMAT adds 'WORD wBitsPerSample' and | 143 * at the bottom. PCMWAVEFORMAT adds 'WORD wBitsPerSample' and |
192 if (id == CODEC_ID_PCM_S16LE && bps == 32) | 192 if (id == CODEC_ID_PCM_S16LE && bps == 32) |
193 id = CODEC_ID_PCM_S32LE; | 193 id = CODEC_ID_PCM_S32LE; |
194 return id; | 194 return id; |
195 } | 195 } |
196 | 196 |
197 #ifdef CONFIG_ENCODERS | 197 #ifdef CONFIG_MUXERS |
198 typedef struct { | 198 typedef struct { |
199 offset_t data; | 199 offset_t data; |
200 } WAVContext; | 200 } WAVContext; |
201 | 201 |
202 static int wav_write_header(AVFormatContext *s) | 202 static int wav_write_header(AVFormatContext *s) |
251 | 251 |
252 put_flush_packet(pb); | 252 put_flush_packet(pb); |
253 } | 253 } |
254 return 0; | 254 return 0; |
255 } | 255 } |
256 #endif //CONFIG_ENCODERS | 256 #endif //CONFIG_MUXERS |
257 | 257 |
258 /* return the size of the found tag */ | 258 /* return the size of the found tag */ |
259 /* XXX: > 2GB ? */ | 259 /* XXX: > 2GB ? */ |
260 static int find_tag(ByteIOContext *pb, uint32_t tag1) | 260 static int find_tag(ByteIOContext *pb, uint32_t tag1) |
261 { | 261 { |
393 wav_read_packet, | 393 wav_read_packet, |
394 wav_read_close, | 394 wav_read_close, |
395 wav_read_seek, | 395 wav_read_seek, |
396 }; | 396 }; |
397 | 397 |
398 #ifdef CONFIG_ENCODERS | 398 #ifdef CONFIG_MUXERS |
399 static AVOutputFormat wav_oformat = { | 399 static AVOutputFormat wav_oformat = { |
400 "wav", | 400 "wav", |
401 "wav format", | 401 "wav format", |
402 "audio/x-wav", | 402 "audio/x-wav", |
403 "wav", | 403 "wav", |
406 CODEC_ID_NONE, | 406 CODEC_ID_NONE, |
407 wav_write_header, | 407 wav_write_header, |
408 wav_write_packet, | 408 wav_write_packet, |
409 wav_write_trailer, | 409 wav_write_trailer, |
410 }; | 410 }; |
411 #endif //CONFIG_ENCODERS | 411 #endif //CONFIG_MUXERS |
412 | 412 |
413 int ff_wav_init(void) | 413 int ff_wav_init(void) |
414 { | 414 { |
415 av_register_input_format(&wav_iformat); | 415 av_register_input_format(&wav_iformat); |
416 #ifdef CONFIG_ENCODERS | 416 #ifdef CONFIG_MUXERS |
417 av_register_output_format(&wav_oformat); | 417 av_register_output_format(&wav_oformat); |
418 #endif //CONFIG_ENCODERS | 418 #endif //CONFIG_MUXERS |
419 return 0; | 419 return 0; |
420 } | 420 } |