foobar2000 SDK  2015-08-03
Data Structures | Public Member Functions | Private Attributes
album_art_extractor_instance_fileref

#include <album_art_helpers.h>

+ Inheritance diagram for album_art_extractor_instance_fileref:

Data Structures

struct  t_fileref
 

Public Member Functions

 album_art_extractor_instance_fileref (file::ptr f)
 
bool have_item (const GUID &p_what)
 
bool is_empty () const
 
album_art_data_ptr query (const GUID &p_what, abort_callback &p_abort)
 
void set (const GUID &p_what, t_filesize p_offset, t_filesize p_size)
 
- Public Member Functions inherited from album_art_extractor_instance
bool query (const GUID &what, album_art_data::ptr &out, abort_callback &abort)
 
- Public Member Functions inherited from service_base
template<typename outPtr_t >
bool cast (outPtr_t &outPtr)
 
virtual int service_add_ref ()=0 throw ()
 
virtual bool service_query (service_ptr_t< service_base > &p_out, const GUID &p_guid)
 
template<class T >
bool service_query_t (service_ptr_t< T > &p_out)
 
virtual int service_release ()=0 throw ()
 

Private Attributes

pfc::map_t< GUID, album_art_data::ptr > m_cache
 
pfc::map_t< GUID, t_filerefm_data
 
const file::ptr m_file
 

Additional Inherited Members

- Public Types inherited from service_base
typedef service_base t_interface
 
- Protected Member Functions inherited from service_base
 service_base ()
 
 ~service_base ()
 

Detailed Description

Helper - a more advanced implementation of album_art_extractor_instance.

Definition at line 98 of file album_art_helpers.h.


Data Structure Documentation

struct album_art_extractor_instance_fileref::t_fileref

Definition at line 124 of file album_art_helpers.h.

Data Fields
t_filesize m_offset
t_filesize m_size

Constructor & Destructor Documentation

album_art_extractor_instance_fileref::album_art_extractor_instance_fileref ( file::ptr  f)
inline

Definition at line 100 of file album_art_helpers.h.

100 : m_file(f) {}

Member Function Documentation

bool album_art_extractor_instance_fileref::have_item ( const GUID p_what)
inline

Definition at line 108 of file album_art_helpers.h.

108  {
109  return m_data.have_item(p_what);
110  }
pfc::map_t< GUID, t_fileref > m_data
bool album_art_extractor_instance_fileref::is_empty ( ) const
inline

Definition at line 122 of file album_art_helpers.h.

122 {return m_data.get_count() == 0;}
pfc::map_t< GUID, t_fileref > m_data
album_art_data_ptr album_art_extractor_instance_fileref::query ( const GUID p_what,
abort_callback p_abort 
)
inlinevirtual

Throws exception_album_art_not_found when the requested album art entry could not be found in the referenced media file.

Implements album_art_extractor_instance.

Definition at line 112 of file album_art_helpers.h.

112  {
113  album_art_data_ptr item;
114  if (m_cache.query(p_what,item)) return item;
115  t_fileref ref;
116  if (!m_data.query(p_what, ref)) throw exception_album_art_not_found();
117  m_file->seek(ref.m_offset, p_abort);
118  item = album_art_data_impl::g_create(m_file.get_ptr(), pfc::downcast_guarded<t_size>(ref.m_size), p_abort);
119  m_cache.set(p_what, item);
120  return item;
121  }
static album_art_data_ptr g_create(const void *p_buffer, t_size p_bytes)
Creates an album_art_data object from picture data contained in a memory buffer.
pfc::map_t< GUID, t_fileref > m_data
void set(const _t_key &p_key, const _t_value &p_value)
Definition: map.h:22
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
Definition: service.h:55
pfc::map_t< GUID, album_art_data::ptr > m_cache
bool query(const _t_key &p_key, _t_value &p_value) const
Definition: map.h:44
void album_art_extractor_instance_fileref::set ( const GUID p_what,
t_filesize  p_offset,
t_filesize  p_size 
)
inline

Definition at line 102 of file album_art_helpers.h.

102  {
103  const t_fileref ref = {p_offset, p_size};
104  m_data.set(p_what, ref);
105  m_cache.remove(p_what);
106  }
pfc::map_t< GUID, t_fileref > m_data
bool remove(const _t_key &p_key)
Definition: map.h:120
pfc::map_t< GUID, album_art_data::ptr > m_cache

Field Documentation

pfc::map_t<GUID, album_art_data::ptr> album_art_extractor_instance_fileref::m_cache
private

Definition at line 129 of file album_art_helpers.h.

pfc::map_t<GUID, t_fileref> album_art_extractor_instance_fileref::m_data
private

Definition at line 128 of file album_art_helpers.h.

const file::ptr album_art_extractor_instance_fileref::m_file
private

Definition at line 127 of file album_art_helpers.h.


The documentation for this class was generated from the following file: