picture.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* grabbag - Convenience lib for various routines common to several tools
  2. * Copyright (C) 2006-2009 Josh Coalson
  3. * Copyright (C) 2011-2023 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. /* This .h cannot be included by itself; #include "share/grabbag.h" instead. */
  20. #ifndef GRABBAG__PICTURE_H
  21. #define GRABBAG__PICTURE_H
  22. #include "FLAC/metadata.h"
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /* spec should be of the form "[TYPE]|MIME_TYPE|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE", e.g.
  27. * "|image/jpeg|||cover.jpg"
  28. * "4|image/jpeg||300x300x24|backcover.jpg"
  29. * "|image/png|description|300x300x24/71|cover.png"
  30. * "-->|image/gif||300x300x24/71|http://blah.blah.blah/cover.gif"
  31. *
  32. * empty type means default to FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER
  33. * empty resolution spec means to get from the file (cannot get used with "-->" linked images)
  34. * spec and error_message must not be NULL
  35. */
  36. FLAC__StreamMetadata *grabbag__picture_parse_specification(const char *spec, const char **error_message);
  37. typedef struct PictureResolution
  38. { uint32_t width, height, depth, colors ;
  39. } PictureResolution ;
  40. FLAC__StreamMetadata *grabbag__picture_from_specification(int type, const char *mime_type, const char * description,
  41. const PictureResolution * res, const char * filepath, const char **error_message);
  42. #ifdef __cplusplus
  43. }
  44. #endif
  45. #endif