xref: /aosp_15_r20/external/flac/include/share/grabbag/picture.h (revision 600f14f40d737144c998e2ec7a483122d3776fbc)
1*600f14f4SXin Li /* grabbag - Convenience lib for various routines common to several tools
2*600f14f4SXin Li  * Copyright (C) 2006-2009  Josh Coalson
3*600f14f4SXin Li  * Copyright (C) 2011-2023  Xiph.Org Foundation
4*600f14f4SXin Li  *
5*600f14f4SXin Li  * This program is free software; you can redistribute it and/or
6*600f14f4SXin Li  * modify it under the terms of the GNU General Public License
7*600f14f4SXin Li  * as published by the Free Software Foundation; either version 2
8*600f14f4SXin Li  * of the License, or (at your option) any later version.
9*600f14f4SXin Li  *
10*600f14f4SXin Li  * This program is distributed in the hope that it will be useful,
11*600f14f4SXin Li  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12*600f14f4SXin Li  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13*600f14f4SXin Li  * GNU General Public License for more details.
14*600f14f4SXin Li  *
15*600f14f4SXin Li  * You should have received a copy of the GNU General Public License along
16*600f14f4SXin Li  * with this program; if not, write to the Free Software Foundation, Inc.,
17*600f14f4SXin Li  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18*600f14f4SXin Li  */
19*600f14f4SXin Li 
20*600f14f4SXin Li /* This .h cannot be included by itself; #include "share/grabbag.h" instead. */
21*600f14f4SXin Li 
22*600f14f4SXin Li #ifndef GRABBAG__PICTURE_H
23*600f14f4SXin Li #define GRABBAG__PICTURE_H
24*600f14f4SXin Li 
25*600f14f4SXin Li #include "FLAC/metadata.h"
26*600f14f4SXin Li 
27*600f14f4SXin Li #ifdef __cplusplus
28*600f14f4SXin Li extern "C" {
29*600f14f4SXin Li #endif
30*600f14f4SXin Li 
31*600f14f4SXin Li /* spec should be of the form "[TYPE]|MIME_TYPE|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE", e.g.
32*600f14f4SXin Li  *   "|image/jpeg|||cover.jpg"
33*600f14f4SXin Li  *   "4|image/jpeg||300x300x24|backcover.jpg"
34*600f14f4SXin Li  *   "|image/png|description|300x300x24/71|cover.png"
35*600f14f4SXin Li  *   "-->|image/gif||300x300x24/71|http://blah.blah.blah/cover.gif"
36*600f14f4SXin Li  *
37*600f14f4SXin Li  * empty type means default to FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER
38*600f14f4SXin Li  * empty resolution spec means to get from the file (cannot get used with "-->" linked images)
39*600f14f4SXin Li  * spec and error_message must not be NULL
40*600f14f4SXin Li  */
41*600f14f4SXin Li FLAC__StreamMetadata *grabbag__picture_parse_specification(const char *spec, const char **error_message);
42*600f14f4SXin Li 
43*600f14f4SXin Li typedef struct PictureResolution
44*600f14f4SXin Li {	uint32_t width, height, depth, colors ;
45*600f14f4SXin Li } PictureResolution ;
46*600f14f4SXin Li 
47*600f14f4SXin Li FLAC__StreamMetadata *grabbag__picture_from_specification(int type, const char *mime_type, const char * description,
48*600f14f4SXin Li 		const PictureResolution * res, const char * filepath, const char **error_message);
49*600f14f4SXin Li 
50*600f14f4SXin Li #ifdef __cplusplus
51*600f14f4SXin Li }
52*600f14f4SXin Li #endif
53*600f14f4SXin Li 
54*600f14f4SXin Li #endif
55