1 /* EasyTAG - tag editor for audio files 2 * Copyright (C) 2014-2015 David King <amigadave@amigadave.com> 3 * Copyright (C) 2000-2003 Jerome Couderc <easytag@gmail.com> 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License as published by the Free 7 * Software Foundation; either version 2 of the License, or (at your option) 8 * any later version. 9 * 10 * This program is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 * more details. 14 * 15 * You should have received a copy of the GNU General Public License along with 16 * this program; if not, write to the Free Software Foundation, Inc., 51 17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef ET_PICTURE_H_ 21 #define ET_PICTURE_H_ 22 23 #include <gio/gio.h> 24 25 G_BEGIN_DECLS 26 27 #include "core_types.h" 28 29 #define ET_TYPE_PICTURE (et_picture_get_type ()) 30 31 typedef enum // Picture types 32 { 33 // Same values for FLAC, see: http://flac.sourceforge.net/api/group__flac__format.html#ga113 34 ET_PICTURE_TYPE_OTHER = 0, 35 ET_PICTURE_TYPE_FILE_ICON, 36 ET_PICTURE_TYPE_OTHER_FILE_ICON, 37 ET_PICTURE_TYPE_FRONT_COVER, 38 ET_PICTURE_TYPE_BACK_COVER, 39 ET_PICTURE_TYPE_LEAFLET_PAGE, 40 ET_PICTURE_TYPE_MEDIA, 41 ET_PICTURE_TYPE_LEAD_ARTIST_LEAD_PERFORMER_SOLOIST, 42 ET_PICTURE_TYPE_ARTIST_PERFORMER, 43 ET_PICTURE_TYPE_CONDUCTOR, 44 ET_PICTURE_TYPE_BAND_ORCHESTRA, 45 ET_PICTURE_TYPE_COMPOSER, 46 ET_PICTURE_TYPE_LYRICIST_TEXT_WRITER, 47 ET_PICTURE_TYPE_RECORDING_LOCATION, 48 ET_PICTURE_TYPE_DURING_RECORDING, 49 ET_PICTURE_TYPE_DURING_PERFORMANCE, 50 ET_PICTURE_TYPE_MOVIE_VIDEO_SCREEN_CAPTURE, 51 ET_PICTURE_TYPE_A_BRIGHT_COLOURED_FISH, 52 ET_PICTURE_TYPE_ILLUSTRATION, 53 ET_PICTURE_TYPE_BAND_ARTIST_LOGOTYPE, 54 ET_PICTURE_TYPE_PUBLISHER_STUDIO_LOGOTYPE, 55 56 ET_PICTURE_TYPE_UNDEFINED 57 } EtPictureType; 58 59 /* 60 * EtPicture: 61 * @type: type of cover art 62 * @description: string to describe the image, often a suitable filename 63 * @width: original width, or 0 if unknown 64 * @height: original height, or 0 if unknown 65 * @bytes: image data 66 * @next: next image data in the list, or %NULL 67 */ 68 typedef struct _EtPicture EtPicture; 69 struct _EtPicture 70 { 71 EtPictureType type; 72 gchar *description; 73 gint width; 74 gint height; 75 GBytes *bytes; 76 EtPicture *next; 77 }; 78 79 typedef enum 80 { 81 PICTURE_FORMAT_JPEG, 82 PICTURE_FORMAT_PNG, 83 PICTURE_FORMAT_GIF, 84 PICTURE_FORMAT_UNKNOWN 85 } Picture_Format; 86 87 GType et_picture_get_type (void); 88 EtPicture * et_picture_new (EtPictureType type, const gchar *description, guint width, guint height, GBytes *bytes); 89 EtPicture * et_picture_copy_single (const EtPicture *pic); 90 EtPicture * et_picture_copy_all (const EtPicture *pic); 91 void et_picture_free (EtPicture *pic); 92 Picture_Format Picture_Format_From_Data (const EtPicture *pic); 93 const gchar *Picture_Mime_Type_String (Picture_Format format); 94 const gchar * Picture_Type_String (EtPictureType type); 95 gboolean et_picture_detect_difference (const EtPicture *a, const EtPicture *b); 96 gchar * et_picture_format_info (const EtPicture *pic, ET_Tag_Type tag_type); 97 98 GBytes * et_picture_load_file_data (GFile *file, GError **error); 99 gboolean et_picture_save_file_data (const EtPicture *pic, GFile *file, GError **error); 100 101 EtPictureType et_picture_type_from_filename (const gchar *filename_utf8); 102 103 G_END_DECLS 104 105 #endif /* ET_PICTURE_H_ */ 106