Imported Upstream version 1.0.25
[platform/upstream/libsndfile.git] / programs / common.h
1 /*
2 ** Copyright (C) 1999-2011 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 * coding_history ;
58         const char * time_ref ;
59 } METADATA_INFO ;
60
61 typedef SF_BROADCAST_INFO_VAR (2048) SF_BROADCAST_INFO_2K ;
62
63 void sfe_apply_metadata_changes (const char * filenames [2], const METADATA_INFO * info) ;
64
65 void sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels) ;
66
67 void sfe_copy_data_int (SNDFILE *outfile, SNDFILE *infile, int channels) ;
68
69 int sfe_file_type_of_ext (const char *filename, int format) ;
70
71 void sfe_dump_format_map (void) ;
72
73 const char * program_name (const char * argv0) ;