foobar2000 SDK  2015-08-03
album_art.h
Go to the documentation of this file.
1 class NOVTABLE album_art_data : public service_base {
5 public:
7  virtual const void * get_ptr() const = 0;
9  virtual t_size get_size() const = 0;
10 
12  static bool equals(album_art_data const & v1, album_art_data const & v2) {
13  const t_size s = v1.get_size();
14  if (s != v2.get_size()) return false;
15  return memcmp(v1.get_ptr(), v2.get_ptr(),s) == 0;
16  }
17  bool operator==(const album_art_data & other) const {return equals(*this,other);}
18  bool operator!=(const album_art_data & other) const {return !equals(*this,other);}
19 
20  FB2K_MAKE_SERVICE_INTERFACE(album_art_data,service_base);
21 };
22 
24 
26 namespace album_art_ids {
28  static const GUID cover_front = { 0xf1e66f4e, 0xfe09, 0x4b94, { 0x91, 0xa3, 0x67, 0xc2, 0x3e, 0xd1, 0x44, 0x5e } };
30  static const GUID cover_back = { 0xcb552d19, 0x86d5, 0x434c, { 0xac, 0x77, 0xbb, 0x24, 0xed, 0x56, 0x7e, 0xe4 } };
32  static const GUID disc = { 0x3dba9f36, 0xf928, 0x4fa4, { 0x87, 0x9c, 0xd3, 0x40, 0x47, 0x59, 0x58, 0x7e } };
34  static const GUID icon = { 0x74cdf5b4, 0x7053, 0x4b3d, { 0x9a, 0x3c, 0x54, 0x69, 0xf5, 0x82, 0x6e, 0xec } };
36  static const GUID artist = { 0x9a654042, 0xacd1, 0x43f7, { 0xbf, 0xcf, 0xd3, 0xec, 0xf, 0xfe, 0x40, 0xfa } };
37 
38 };
39 
40 PFC_DECLARE_EXCEPTION(exception_album_art_not_found,exception_io_not_found,"Attached picture not found");
41 PFC_DECLARE_EXCEPTION(exception_album_art_unsupported_entry,exception_io_data,"Unsupported attached picture entry");
42 
43 PFC_DECLARE_EXCEPTION(exception_album_art_unsupported_format,exception_io_data,"Attached picture operations not supported for this file format");
44 
46 class NOVTABLE album_art_extractor_instance : public service_base {
47  FB2K_MAKE_SERVICE_INTERFACE(album_art_extractor_instance,service_base);
48 public:
50  virtual album_art_data_ptr query(const GUID & p_what,abort_callback & p_abort) = 0;
51 
52  bool query(const GUID & what, album_art_data::ptr & out, abort_callback & abort) {
53  try { out = query(what, abort); return true; } catch(exception_album_art_not_found) { return false; }
54  }
55 };
56 
59  FB2K_MAKE_SERVICE_INTERFACE(album_art_editor_instance,album_art_extractor_instance);
60 public:
62  virtual void set(const GUID & p_what,album_art_data_ptr p_data,abort_callback & p_abort) = 0;
63 
65  virtual void remove(const GUID & p_what) = 0;
66 
68  virtual void commit(abort_callback & p_abort) = 0;
69 };
70 
72  FB2K_MAKE_SERVICE_INTERFACE(album_art_editor_instance_v2, album_art_editor_instance);
73 public:
75  virtual void remove_all() = 0;
76 };
77 
80 
83 class NOVTABLE album_art_extractor : public service_base {
84 public:
88  virtual bool is_our_path(const char * p_path,const char * p_extension) = 0;
89 
93  virtual album_art_extractor_instance_ptr open(file_ptr p_filehint,const char * p_path,abort_callback & p_abort) = 0;
94 
95  static bool g_get_interface(service_ptr_t<album_art_extractor> & out,const char * path);
96  static bool g_is_supported_path(const char * path);
97  static album_art_extractor_instance_ptr g_open(file_ptr p_filehint,const char * p_path,abort_callback & p_abort);
98  static album_art_extractor_instance_ptr g_open_allowempty(file_ptr p_filehint,const char * p_path,abort_callback & p_abort);
99 
100  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(album_art_extractor);
101 };
102 
104 class NOVTABLE album_art_editor : public service_base {
105 public:
109  virtual bool is_our_path(const char * p_path,const char * p_extension) = 0;
110 
113  virtual album_art_editor_instance_ptr open(file_ptr p_filehint,const char * p_path,abort_callback & p_abort) = 0;
114 
117  static bool g_get_interface(service_ptr_t<album_art_editor> & out,const char * path);
119  static bool g_is_supported_path(const char * path);
120 
121  static album_art_editor_instance_ptr g_open(file_ptr p_filehint,const char * p_path,abort_callback & p_abort);
122 
123  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(album_art_editor);
124 };
125 
126 
129 public:
130 
132  virtual album_art_extractor_instance_ptr open(file_ptr p_file,abort_callback & p_abort) = 0;
133 
136  virtual album_art_editor_instance_ptr edit(file_ptr p_file,abort_callback & p_abort) = 0;
137 
138  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(tag_processor_album_art_utils)
139 };
140 
141 
143 class NOVTABLE album_art_path_list : public service_base {
144  FB2K_MAKE_SERVICE_INTERFACE(album_art_path_list, service_base)
145 public:
146  virtual const char * get_path(t_size index) const = 0;
147  virtual t_size get_count() const = 0;
148 };
149 
153 public:
154  virtual album_art_path_list::ptr query_paths(const GUID & p_what, abort_callback & p_abort) = 0;
155 };
156 
157 
161 class NOVTABLE album_art_manager_v2 : public service_base {
162  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(album_art_manager_v2)
163 public:
165  virtual album_art_extractor_instance_v2::ptr open(metadb_handle_list_cref items, pfc::list_base_const_t<GUID> const & ids, abort_callback & abort) = 0;
166 
168  virtual album_art_extractor_instance_v2::ptr open_stub(abort_callback & abort) = 0;
169 };
170 
171 
175 class NOVTABLE album_art_fallback : public service_base {
176  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(album_art_fallback)
177 public:
178  virtual album_art_extractor_instance_v2::ptr open(metadb_handle_list_cref items, pfc::list_base_const_t<GUID> const & ids, abort_callback & abort) = 0;
179 };
180 
182 class NOVTABLE album_art_manager_config : public service_base {
183  FB2K_MAKE_SERVICE_INTERFACE(album_art_manager_config, service_base)
184 public:
185  virtual bool get_external_pattern(pfc::string_base & out, const GUID & type) = 0;
186  virtual bool use_embedded_pictures() = 0;
187  virtual bool use_fallbacks() = 0;
188 };
189 
192  FB2K_MAKE_SERVICE_INTERFACE(album_art_manager_v3, album_art_manager_v2)
193 public:
195  virtual album_art_extractor_instance_v2::ptr open_v3(metadb_handle_list_cref items, pfc::list_base_const_t<GUID> const & ids, album_art_manager_config::ptr config, abort_callback & abort) = 0;
196 };
t_filesize get_size(HANDLE p_handle)
service_ptr_t< file > file_ptr
Definition: filesystem.h:324
Class encapsulating access to album art stored in a media file. Use album_art_extractor class obtain ...
Definition: album_art.h:46
PFC_DECLARE_EXCEPTION(exception_album_art_not_found, exception_io_not_found,"Attached picture not found")
Entrypoint class for accessing album art extraction functionality. Register your own implementation t...
Definition: album_art.h:83
Definition: pfc.h:71
bool operator==(const album_art_data &other) const
Definition: album_art.h:17
static const GUID artist
Artist picture.
Definition: album_art.h:36
static const GUID cover_back
Back cover.
Definition: album_art.h:30
static const GUID icon
Album-specific icon (NOT a file type icon).
Definition: album_art.h:34
album_art_extractor_instance extension; lets the frontend query referenced file paths (eg...
Definition: album_art.h:151
virtual t_size get_size() const =0
Retrieves size of the memory block containing the picture.
Common class for handling picture data. Type of contained picture data is unknown and to be determin...
Definition: album_art.h:4
Entrypoint class for accessing album art editing functionality. Register your own implementation to a...
Definition: album_art.h:104
bool operator!=(const album_art_data &other) const
Definition: album_art.h:18
service_ptr_t< album_art_extractor_instance > album_art_extractor_instance_ptr
Definition: album_art.h:78
Helper API for extracting album art from APEv2 tags - introduced in 0.9.5.
Definition: album_art.h:128
size_t t_size
Definition: int_types.h:48
Album art path list - see album_art_extractor_instance_v2.
Definition: album_art.h:143
Base class for all service classes. Provides interfaces for reference counter and querying for differ...
Definition: service.h:333
static bool equals(album_art_data const &v1, album_art_data const &v2)
Determine whether two album_art_data objects store the same picture data.
Definition: album_art.h:12
Class encapsulating access to album art stored in a media file. Use album_art_editor class to obtain ...
Definition: album_art.h:58
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
Definition: service.h:55
bool query(const GUID &what, album_art_data::ptr &out, abort_callback &abort)
Definition: album_art.h:52
Namespace containing identifiers of album art types.
Definition: album_art.h:26
service_ptr_t< album_art_data > album_art_data_ptr
Definition: album_art.h:23
static const GUID cover_front
Front cover.
Definition: album_art.h:28
static const GUID disc
Picture of a disc or other storage media.
Definition: album_art.h:32
virtual const void * get_ptr() const =0
Retrieves a pointer to a memory block containing the picture.
service_ptr_t< album_art_editor_instance > album_art_editor_instance_ptr
Definition: album_art.h:79
bool equals(const t1 &v1, const t2 &v2)
Definition: pathUtils.h:27