• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 ** Copyright (C) 1999-2013 Erik de Castro Lopo <erikd@mega-nerd.com>
3 **
4 ** All rights reserved.
5 **
6 ** Redistribution and use in source and binary forms, with or without
7 ** modification, are permitted provided that the following conditions are
8 ** met:
9 **
10 **     * Redistributions of source code must retain the above copyright
11 **       notice, this list of conditions and the following disclaimer.
12 **     * Redistributions in binary form must reproduce the above copyright
13 **       notice, this list of conditions and the following disclaimer in
14 **       the documentation and/or other materials provided with the
15 **       distribution.
16 **     * Neither the author nor the names of any contributors may be used
17 **       to endorse or promote products derived from this software without
18 **       specific prior written permission.
19 **
20 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 ** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 ** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 ** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 ** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 ** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 ** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 ** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 ** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30 ** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32 
33 
34 #define	ARRAY_LEN(x)	((int) (sizeof (x) / sizeof (x [0])))
35 #define	MAX(a, b)		((a) > (b) ? (a) : (b))
36 
37 typedef struct
38 {	const char * title ;
39 	const char * copyright ;
40 	const char * artist ;
41 	const char * comment ;
42 	const char * date ;
43 	const char * album ;
44 	const char * license ;
45 
46 
47 	/* Stuff to go in the 'bext' chunk of WAV files. */
48 	int has_bext_fields ;
49 	int coding_hist_append ;
50 
51 	const char * description ;
52 	const char * originator ;
53 	const char * originator_reference ;
54 	const char * origination_date ;
55 	const char * origination_time ;
56 	const char * umid ;
57 	const char * loudness_value ;
58 	const char * loudness_range ;
59 	const char * max_true_peak_level ;
60 	const char * max_momentary_loudness ;
61 	const char * max_shortterm_loudness ;
62 	const char * coding_history ;
63 	const char * time_ref ;
64 } METADATA_INFO ;
65 
66 typedef SF_BROADCAST_INFO_VAR (2048) SF_BROADCAST_INFO_2K ;
67 
68 void sfe_apply_metadata_changes (const char * filenames [2], const METADATA_INFO * info) ;
69 
70 int sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels, int normalize) ;
71 
72 void sfe_copy_data_int (SNDFILE *outfile, SNDFILE *infile, int channels) ;
73 
74 int sfe_file_type_of_ext (const char *filename, int format) ;
75 
76 void sfe_dump_format_map (void) ;
77 
78 const char * program_name (const char * argv0) ;
79 
80 const char * sfe_endian_name (int format) ;
81 const char * sfe_container_name (int format) ;
82 const char * sfe_codec_name (int format) ;
83