foobar2000 SDK  2015-08-03
Public Member Functions | Protected Member Functions | Private Attributes
file_info_impl

#include <file_info_impl.h>

+ Inheritance diagram for file_info_impl:

Public Member Functions

 file_info_impl (const file_info_impl &p_source)
 
 file_info_impl (const file_info &p_source)
 
 file_info_impl ()
 
 ~file_info_impl ()
 
void copy_info (const file_info &p_source)
 
void copy_meta (const file_info &p_source)
 
double get_length () const
 
replaygain_info get_replaygain () const
 
const char * info_enum_name (t_size p_index) const
 
const char * info_enum_value (t_size p_index) const
 
t_size info_get_count () const
 
void info_remove_mask (const bit_array &p_mask)
 
t_size info_set_ex (const char *p_name, t_size p_name_length, const char *p_value, t_size p_value_length)
 
const char * meta_enum_name (t_size p_index) const
 
const char * meta_enum_value (t_size p_index, t_size p_value_number) const
 
t_size meta_enum_value_count (t_size p_index) const
 
t_size meta_get_count () const
 
void meta_insert_value_ex (t_size p_index, t_size p_value_index, const char *p_value, t_size p_value_length)
 
void meta_modify_value_ex (t_size p_index, t_size p_value_index, const char *p_value, t_size p_value_length)
 
void meta_remove_mask (const bit_array &p_mask)
 
void meta_remove_values (t_size p_index, const bit_array &p_mask)
 
void meta_reorder (const t_size *p_order)
 
t_size meta_set_ex (const char *p_name, t_size p_name_length, const char *p_value, t_size p_value_length)
 
const file_info_imploperator= (const file_info_impl &p_source)
 
void set_length (double p_length)
 
void set_replaygain (const replaygain_info &p_info)
 
- Public Member Functions inherited from file_info
t_size __info_add_unsafe (const char *p_name, const char *p_value)
 
t_size __info_add_unsafe_ex (const char *p_name, t_size p_name_length, const char *p_value, t_size p_value_length)
 
t_size __meta_add_unsafe (const char *p_name, const char *p_value)
 
t_size __meta_add_unsafe_ex (const char *p_name, t_size p_name_length, const char *p_value, t_size p_value_length)
 
void _add_tag (const file_info &otherTag)
 
void _copy_meta_single_nocheck (const file_info &p_source, t_size p_index)
 
void _set_tag (const file_info &tag)
 
bool are_meta_fields_identical (t_size p_index1, t_size p_index2) const
 
audio_chunk::spec_t audio_chunk_spec () const
 
virtual void copy (const file_info &p_source)
 
void copy_info_single (const file_info &p_source, t_size p_index)
 
void copy_info_single_by_name (const file_info &p_source, const char *p_name)
 
void copy_info_single_by_name_ex (const file_info &p_source, const char *p_name, t_size p_name_length)
 
void copy_meta_single (const file_info &p_source, t_size p_index)
 
void copy_meta_single_by_name (const file_info &p_source, const char *p_name)
 
void copy_meta_single_by_name_ex (const file_info &p_source, const char *p_name, t_size p_name_length)
 
void copy_meta_single_rename (const file_info &p_source, t_size p_index, const char *p_new_name)
 
void copy_meta_single_rename_ex (const file_info &p_source, t_size p_index, const char *p_new_name, t_size p_new_name_length)
 
void from_mem (const void *memPtr, size_t memSize)
 
void from_stream (stream_reader *stream, abort_callback &abort)
 
void info_calculate_bitrate (t_filesize p_filesize, double p_length)
 
bool info_exists (const char *p_name) const
 
bool info_exists_ex (const char *p_name, t_size p_name_length) const
 
t_size info_find (const char *p_name) const
 
virtual t_size info_find_ex (const char *p_name, t_size p_name_length) const
 
const char * info_get (const char *p_name) const
 
t_int64 info_get_bitrate () const
 
t_int64 info_get_bitrate_vbr () const
 
unsigned info_get_decoded_bps () const
 
const char * info_get_ex (const char *p_name, t_size p_name_length) const
 
double info_get_float (const char *name) const
 
t_int64 info_get_int (const char *name) const
 
t_int64 info_get_length_samples () const
 
uint32_t info_get_wfx_chanMask () const
 
bool info_remove (const char *p_name)
 
void info_remove_all ()
 
bool info_remove_ex (const char *p_name, t_size p_name_length)
 
void info_remove_index (t_size p_index)
 
t_size info_set (const char *p_name, const char *p_value)
 
void info_set_bitrate (t_int64 val)
 
void info_set_bitrate_vbr (t_int64 val)
 
void info_set_float (const char *name, double value, unsigned precision, bool force_sign=false, const char *unit=0)
 
void info_set_int (const char *name, t_int64 value)
 
bool info_set_replaygain (const char *p_name, const char *p_value)
 
void info_set_replaygain_album_gain (float value)
 
void info_set_replaygain_album_peak (float value)
 
void info_set_replaygain_auto (const char *p_name, const char *p_value)
 
void info_set_replaygain_auto_ex (const char *p_name, t_size p_name_len, const char *p_value, t_size p_value_len)
 
bool info_set_replaygain_ex (const char *p_name, t_size p_name_len, const char *p_value, t_size p_value_len)
 
void info_set_replaygain_track_gain (float value)
 
void info_set_replaygain_track_peak (float value)
 
void info_set_wfx_chanMask (uint32_t val)
 
bool is_encoding_lossy () const
 
void merge_fallback (const file_info &fallback)
 
t_size meta_add (const char *p_name, const char *p_value)
 
t_size meta_add_ex (const char *p_name, t_size p_name_length, const char *p_value, t_size p_value_length)
 
void meta_add_value (t_size p_index, const char *p_value)
 
void meta_add_value_ex (t_size p_index, const char *p_value, t_size p_value_length)
 
t_size meta_calc_total_value_count () const
 
bool meta_exists (const char *p_name) const
 
bool meta_exists_ex (const char *p_name, t_size p_name_length) const
 
t_size meta_find (const char *p_name) const
 
virtual t_size meta_find_ex (const char *p_name, t_size p_name_length) const
 
bool meta_format (const char *p_name, pfc::string_base &p_out, const char *separator=", ") const
 
void meta_format_entry (t_size index, pfc::string_base &p_out, const char *separator=", ") const
 
const char * meta_get (const char *p_name, t_size p_index) const
 
t_size meta_get_count_by_name (const char *p_name) const
 
t_size meta_get_count_by_name_ex (const char *p_name, t_size p_name_length) const
 
const char * meta_get_ex (const char *p_name, t_size p_name_length, t_size p_index) const
 
void meta_insert_value (t_size p_index, t_size p_value_index, const char *p_value)
 
void meta_modify_value (t_size p_index, t_size p_value_index, const char *p_value)
 
void meta_remove_all ()
 
void meta_remove_field (const char *p_name)
 
void meta_remove_field_ex (const char *p_name, t_size p_name_length)
 
void meta_remove_index (t_size p_index)
 
void meta_remove_value (t_size p_index, t_size p_value)
 
t_size meta_set (const char *p_name, const char *p_value)
 
const file_infooperator= (const file_info &p_source)
 
void overwrite_info (const file_info &p_source)
 
void overwrite_meta (const file_info &p_source)
 
void reset ()
 
void reset_replaygain ()
 
void to_console () const
 
void to_formatter (pfc::string_formatter &) const
 
void to_stream (stream_writer *stream, abort_callback &abort) const
 

Protected Member Functions

t_size info_set_nocheck_ex (const char *p_name, t_size p_name_length, const char *p_value, t_size p_value_length)
 
t_size meta_set_nocheck_ex (const char *p_name, t_size p_name_length, const char *p_value, t_size p_value_length)
 
- Protected Member Functions inherited from file_info
 file_info ()
 
 ~file_info ()
 
void copy_info_single_by_name_nocheck (const file_info &p_source, const char *p_name)
 
void copy_info_single_by_name_nocheck_ex (const file_info &p_source, const char *p_name, t_size p_name_length)
 
void copy_info_single_nocheck (const file_info &p_source, t_size p_index)
 
void copy_meta_single_by_name_nocheck (const file_info &p_source, const char *p_name)
 
void copy_meta_single_by_name_nocheck_ex (const file_info &p_source, const char *p_name, t_size p_name_length)
 
void copy_meta_single_nocheck (const file_info &p_source, t_size p_index)
 
t_size info_set_nocheck (const char *p_name, const char *p_value)
 
t_size meta_set_nocheck (const char *p_name, const char *p_value)
 

Private Attributes

file_info_impl_utils::info_storage m_info
 
double m_length
 
file_info_impl_utils::meta_storage m_meta
 
replaygain_info m_replaygain
 

Additional Inherited Members

- Public Types inherited from file_info
typedef pfc::string::comparatorCaseInsensitiveASCII field_name_comparator
 
- Static Public Member Functions inherited from file_info
static bool field_is_person (const char *fieldName)
 
static bool field_is_title (const char *fieldName)
 
static bool field_name_equals (const char *n1, const char *n2)
 
static bool g_is_info_equal (const file_info &p_item1, const file_info &p_item2)
 
static bool g_is_meta_equal (const file_info &p_item1, const file_info &p_item2)
 
static bool g_is_meta_equal_debug (const file_info &p_item1, const file_info &p_item2)
 
static bool g_is_valid_field_name (const char *p_name, t_size p_length=pfc_infinite)
 

Detailed Description

Implements file_info.

Definition at line 93 of file file_info_impl.h.

Constructor & Destructor Documentation

file_info_impl::file_info_impl ( const file_info_impl p_source)

Definition at line 94 of file file_info_impl.cpp.

94  : m_length(0)
95 {
96  copy(p_source);
97 }
virtual void copy(const file_info &p_source)
Copies entire file_info contents from specified file_info object.
Definition: file_info.cpp:166
file_info_impl::file_info_impl ( const file_info p_source)

Definition at line 89 of file file_info_impl.cpp.

89  : m_length(0)
90 {
91  copy(p_source);
92 }
virtual void copy(const file_info &p_source)
Copies entire file_info contents from specified file_info object.
Definition: file_info.cpp:166
file_info_impl::file_info_impl ( )

Definition at line 105 of file file_info_impl.cpp.

105  : m_length(0)
106 {
108 }
replaygain_info m_replaygain
file_info_impl::~file_info_impl ( )

Definition at line 138 of file file_info_impl.cpp.

139 {
140 }

Member Function Documentation

void file_info_impl::copy_info ( const file_info p_source)
virtual

Copies technical info from specified file_info object.

Reimplemented from file_info.

Definition at line 217 of file file_info_impl.cpp.

218 {
219  m_info.copy_from(p_source);
220 }
void copy_from(const file_info &p_info)
file_info_impl_utils::info_storage m_info
void file_info_impl::copy_meta ( const file_info p_source)
virtual

Copies metadata from specified file_info object.

Reimplemented from file_info.

Definition at line 212 of file file_info_impl.cpp.

213 {
214  m_meta.copy_from(p_source);
215 }
file_info_impl_utils::meta_storage m_meta
void copy_from(const file_info &p_info)
double file_info_impl::get_length ( ) const
virtual

Retrieves audio duration, in seconds.
Note that the reported duration should not be assumed to be the exact length of the track -
with many popular audio formats, exact duration is impossible to determine without performing a full decode pass;
with other formats, the decoded data may be shorter than reported due to truncation other damage.

Implements file_info.

Definition at line 110 of file file_info_impl.cpp.

111 {
112  return m_length;
113 }
replaygain_info file_info_impl::get_replaygain ( ) const
virtual

Retrieves ReplayGain information.

Implements file_info.

Definition at line 125 of file file_info_impl.cpp.

126 {
127  return m_replaygain;
128 }
replaygain_info m_replaygain
const char * file_info_impl::info_enum_name ( t_size  p_index) const
virtual

Retrieves the name of specified technical info entry. Return value is a null-terminated UTF-8 encoded string.

Implements file_info.

Definition at line 62 of file file_info_impl.cpp.

63 {
64  return m_info.get_name(p_index);
65 }
file_info_impl_utils::info_storage m_info
const char * get_name(t_size p_index) const
const char * file_info_impl::info_enum_value ( t_size  p_index) const
virtual

Retrieves the value of specified technical info entry. Return value is a null-terminated UTF-8 encoded string.

Implements file_info.

Definition at line 67 of file file_info_impl.cpp.

68 {
69  return m_info.get_value(p_index);
70 }
file_info_impl_utils::info_storage m_info
const char * get_value(t_size p_index) const
t_size file_info_impl::info_get_count ( ) const
virtual

Retrieves number of technical info entries.

Implements file_info.

Definition at line 57 of file file_info_impl.cpp.

58 {
59  return m_info.get_count();
60 }
file_info_impl_utils::info_storage m_info
void file_info_impl::info_remove_mask ( const bit_array p_mask)
virtual

Removes technical info entries indicated by specified bit mask.

Implements file_info.

Definition at line 83 of file file_info_impl.cpp.

84 {
85  m_info.remove_mask(p_mask);
86 }
file_info_impl_utils::info_storage m_info
void remove_mask(const bit_array &p_mask)
t_size file_info_impl::info_set_ex ( const char *  p_name,
t_size  p_name_length,
const char *  p_value,
t_size  p_value_length 
)
virtual

Creates a new technical info entry with specified name and specified value. If an entry of the same name already exists, it is erased. Return value is the index of newly created entry.

Implements file_info.

Definition at line 72 of file file_info_impl.cpp.

73 {
74  info_remove_ex(p_name,p_name_length);
75  return info_set_nocheck_ex(p_name,p_name_length,p_value,p_value_length);
76 }
bool info_remove_ex(const char *p_name, t_size p_name_length)
Definition: file_info.cpp:76
t_size info_set_nocheck_ex(const char *p_name, t_size p_name_length, const char *p_value, t_size p_value_length)
t_size file_info_impl::info_set_nocheck_ex ( const char *  p_name,
t_size  p_name_length,
const char *  p_value,
t_size  p_value_length 
)
protectedvirtual

Implements file_info.

Definition at line 78 of file file_info_impl.cpp.

79 {
80  return m_info.add_item(p_name,p_name_length,p_value,p_value_length);
81 }
file_info_impl_utils::info_storage m_info
t_size add_item(const char *p_name, t_size p_name_length, const char *p_value, t_size p_value_length)
const char * file_info_impl::meta_enum_name ( t_size  p_index) const
virtual

Retrieves the name of metadata entry of specified index. Return value is a null-terminated UTF-8 encoded string.

Implements file_info.

Definition at line 9 of file file_info_impl.cpp.

10 {
11  return m_meta.get_name(p_index);
12 }
const char * get_name(t_size p_index) const
file_info_impl_utils::meta_storage m_meta
const char * file_info_impl::meta_enum_value ( t_size  p_index,
t_size  p_value_number 
) const
virtual

Retrieves specified value from specified metadata entry. Return value is a null-terminated UTF-8 encoded string.

Implements file_info.

Definition at line 19 of file file_info_impl.cpp.

20 {
21  return m_meta.get_value(p_index,p_value_number);
22 }
file_info_impl_utils::meta_storage m_meta
const char * get_value(t_size p_index, t_size p_value_index) const
t_size file_info_impl::meta_enum_value_count ( t_size  p_index) const
virtual

Retrieves count of values in metadata entry of specified index. The value is always equal to or greater than 1.

Implements file_info.

Definition at line 14 of file file_info_impl.cpp.

15 {
16  return m_meta.get_value_count(p_index);
17 }
file_info_impl_utils::meta_storage m_meta
t_size get_value_count(t_size p_index) const
t_size file_info_impl::meta_get_count ( ) const
virtual

Retrieves count of metadata entries.

Implements file_info.

Definition at line 4 of file file_info_impl.cpp.

5 {
6  return m_meta.get_count();
7 }
file_info_impl_utils::meta_storage m_meta
void file_info_impl::meta_insert_value_ex ( t_size  p_index,
t_size  p_value_index,
const char *  p_value,
t_size  p_value_length 
)
virtual

Inserts a new value into specified metadata entry.

Implements file_info.

Definition at line 35 of file file_info_impl.cpp.

36 {
37  m_meta.insert_value(p_index,p_value_index,p_value,p_value_length);
38 }
void insert_value(t_size p_index, t_size p_value_index, const char *p_value, t_size p_value_length)
file_info_impl_utils::meta_storage m_meta
void file_info_impl::meta_modify_value_ex ( t_size  p_index,
t_size  p_value_index,
const char *  p_value,
t_size  p_value_length 
)
virtual

Alters specified value in specified metadata entry.

Implements file_info.

Definition at line 120 of file file_info_impl.cpp.

121 {
122  m_meta.modify_value(p_index,p_value_index,p_value,p_value_length);
123 }
file_info_impl_utils::meta_storage m_meta
void modify_value(t_size p_index, t_size p_value_index, const char *p_value, t_size p_value_length)
void file_info_impl::meta_remove_mask ( const bit_array p_mask)
virtual

Removes metadata entries according to specified bit mask.

Implements file_info.

Definition at line 40 of file file_info_impl.cpp.

41 {
42  m_meta.remove_mask(p_mask);
43 }
file_info_impl_utils::meta_storage m_meta
void remove_mask(const bit_array &p_mask)
void file_info_impl::meta_remove_values ( t_size  p_index,
const bit_array p_mask 
)
virtual

Removes values according to specified bit mask from specified metadata entry. If all values are removed, entire metadata entry is removed as well.

Implements file_info.

Definition at line 50 of file file_info_impl.cpp.

51 {
52  m_meta.remove_values(p_index,p_mask);
53  if (m_meta.get_value_count(p_index) == 0)
55 }
file_info_impl_utils::meta_storage m_meta
void remove_values(t_size p_index, const bit_array &p_mask)
t_size get_value_count(t_size p_index) const
void remove_mask(const bit_array &p_mask)
void file_info_impl::meta_reorder ( const t_size p_order)
virtual

Reorders metadata entries according to specified permutation.

Implements file_info.

Definition at line 45 of file file_info_impl.cpp.

46 {
47  m_meta.reorder(p_order);
48 }
file_info_impl_utils::meta_storage m_meta
void reorder(const t_size *p_order)
t_size file_info_impl::meta_set_ex ( const char *  p_name,
t_size  p_name_length,
const char *  p_value,
t_size  p_value_length 
)
virtual

Creates a new metadata entry of specified name with specified value. If an entry of same name already exists, it is erased. Return value is the index of newly created metadata entry.

Implements file_info.

Definition at line 24 of file file_info_impl.cpp.

25 {
26  meta_remove_field_ex(p_name,p_name_length);
27  return meta_set_nocheck_ex(p_name,p_name_length,p_value,p_value_length);
28 }
void meta_remove_field_ex(const char *p_name, t_size p_name_length)
Definition: file_info.cpp:23
t_size meta_set_nocheck_ex(const char *p_name, t_size p_name_length, const char *p_value, t_size p_value_length)
t_size file_info_impl::meta_set_nocheck_ex ( const char *  p_name,
t_size  p_name_length,
const char *  p_value,
t_size  p_value_length 
)
protectedvirtual

Implements file_info.

Definition at line 30 of file file_info_impl.cpp.

31 {
32  return m_meta.add_entry(p_name,p_name_length,p_value,p_value_length);
33 }
file_info_impl_utils::meta_storage m_meta
t_size add_entry(const char *p_name, t_size p_name_length, const char *p_value, t_size p_value_length)
const file_info_impl & file_info_impl::operator= ( const file_info_impl p_source)

Definition at line 99 of file file_info_impl.cpp.

100 {
101  copy(p_source);
102  return *this;
103 }
virtual void copy(const file_info &p_source)
Copies entire file_info contents from specified file_info object.
Definition: file_info.cpp:166
void file_info_impl::set_length ( double  p_length)
virtual

Sets audio duration, in seconds.
Note that the reported duration should not be assumed to be the exact length of the track -
with many popular audio formats, exact duration is impossible to determine without performing a full decode pass;
with other formats, the decoded data may be shorter than reported due to truncation other damage.

Implements file_info.

Definition at line 115 of file file_info_impl.cpp.

116 {
117  m_length = p_length;
118 }
void file_info_impl::set_replaygain ( const replaygain_info p_info)
virtual

Sets ReplayGain information.

Implements file_info.

Definition at line 130 of file file_info_impl.cpp.

131 {
132  m_replaygain = p_info;
133 }
replaygain_info m_replaygain

Field Documentation

file_info_impl_utils::info_storage file_info_impl::m_info
private

Definition at line 136 of file file_info_impl.h.

double file_info_impl::m_length
private

Definition at line 139 of file file_info_impl.h.

file_info_impl_utils::meta_storage file_info_impl::m_meta
private

Definition at line 135 of file file_info_impl.h.

replaygain_info file_info_impl::m_replaygain
private

Definition at line 141 of file file_info_impl.h.


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