]> 4ch.mooo.com Git - 16.git/blob - src/lib/doslib/ext/flac/foreign_metadata.h
f9c0604034b78e00cd9e8149c683515dbd15b982
[16.git] / src / lib / doslib / ext / flac / foreign_metadata.h
1 /* flac - Command-line FLAC encoder/decoder
2  * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007  Josh Coalson
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17  */
18
19 #ifndef flac__foreign_metadata_h
20 #define flac__foreign_metadata_h
21
22 #if HAVE_CONFIG_H
23 #  include "config.h"
24 #endif
25
26 #include "flac/metadata.h"
27 #include "utils.h"
28
29 /* WATCHOUT: these enums are used to index internal arrays */
30 typedef enum { FOREIGN_BLOCK_TYPE__AIFF = 0, FOREIGN_BLOCK_TYPE__RIFF = 1 } foreign_block_type_t;
31
32 typedef struct {
33         /* for encoding, this will be the offset in the WAVE/AIFF file of the chunk */
34         /* for decoding, this will be the offset in the FLAC file of the chunk data inside the APPLICATION block */
35         off_t offset;
36         FLAC__uint32 size;
37 } foreign_block_t;
38
39 typedef struct {
40         foreign_block_type_t type; /* currently we don't support multiple foreign types in a stream (an maybe never will) */
41         foreign_block_t *blocks;
42         size_t num_blocks;
43         size_t format_block; /* block number of 'fmt ' or 'COMM' chunk */
44         size_t audio_block; /* block number of 'data' or 'SSND' chunk */
45         FLAC__uint32 ssnd_offset_size; /* 0 if type!=AIFF */
46 } foreign_metadata_t;
47
48 foreign_metadata_t *flac__foreign_metadata_new(foreign_block_type_t type);
49
50 void flac__foreign_metadata_delete(foreign_metadata_t *fm);
51
52 FLAC__bool flac__foreign_metadata_read_from_aiff(foreign_metadata_t *fm, const char *filename, const char **error);
53 FLAC__bool flac__foreign_metadata_read_from_wave(foreign_metadata_t *fm, const char *filename, const char **error);
54 FLAC__bool flac__foreign_metadata_write_to_flac(foreign_metadata_t *fm, const char *infilename, const char *outfilename, const char **error);
55
56 FLAC__bool flac__foreign_metadata_read_from_flac(foreign_metadata_t *fm, const char *filename, const char **error);
57 FLAC__bool flac__foreign_metadata_write_to_iff(foreign_metadata_t *fm, const char *infilename, const char *outfilename, off_t offset1, off_t offset2, off_t offset3, const char **error);
58
59 #endif