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