7 p_out <<
"cue_track" <<
pfc::format_uint(p_tracknumber % 100,2) <<
"_" << p_name;
15 static const char header[] =
"cue_track";
22 class __get_tag_cue_track_list_builder {
25 void operator() (
unsigned p_trackno,
const track_record & p_record) {
28 iter->m_file = p_record.
m_file;
29 iter->m_flags = p_record.
m_flags;
31 iter->m_track_number = p_trackno;
41 class __get_tag__enum_fields_enumerator {
43 __get_tag__enum_fields_enumerator(field_name_list & p_out) : m_out(p_out) {}
44 void operator() (
unsigned p_trackno,
const track_record & p_record) {
47 template<
typename t_value>
void operator() (
const char * p_name,
const t_value & p_value) {
51 field_name_list & m_out;
55 class __get_tag__is_field_global_check {
59 __get_tag__is_field_global_check(
const char * p_field) : m_field(p_field), m_value(NULL), m_state(
true) {}
61 void operator() (
unsigned p_trackno,
const track_record & p_record) {
62 if (p_trackno > 0 && m_state) {
64 if (val == NULL) {m_state =
false;
return;}
65 if (m_value == NULL) {
69 m_state =
false;
return;
75 if (m_state && m_value != NULL) {
76 p_globals.
set(m_field,*m_value);
80 const char *
const m_field;
81 const t_value * m_value;
85 class __get_tag__filter_globals {
89 void operator() (
const char * p_field) {
91 __get_tag__is_field_global_check wrapper(p_field);
92 m_tracks.enumerate(wrapper);
93 wrapper.finalize(m_globals);
101 class __get_tag__local_field_filter {
104 void operator() (
unsigned p_trackno,
const track_record & p_track) {
106 m_currenttrack = p_trackno;
111 PFC_ASSERT(m_currenttrack > 0);
112 if (!m_globals.have_item(p_name)) {
114 m_output.set(m_buffer,p_value);
118 unsigned m_currenttrack;
127 if (metaindex == ~0)
return;
132 if (val == NULL)
return;
136 if (strcmp(*iter,p_cueinfo.
meta_enum_value(metaindex,valwalk)) != 0)
return;
146 if (!have_cuesheet()) {
147 m_content.query_ptr((
unsigned)0)->m_info.to_info(p_info);
152 __get_tag_cue_track_list_builder e(entries);
153 m_content.enumerate(e);
169 field_name_list fields;
170 { __get_tag__enum_fields_enumerator e(fields); m_content.enumerate(e);}
171 { __get_tag__filter_globals e(m_content,globals); fields.enumerate(e); }
177 {__get_tag__local_field_filter e(globals,output.
m_meta); m_content.enumerate(e);}
191 const track_record * rec = m_content.query_ptr((
unsigned)0);
198 output.
meta_set(
"cuesheet",cuesheet);
205 static const char header[] =
"cue_track";
207 p_name += strlen(header);
210 if (tracknumber == 0)
return false;
212 p_tracknumber = tracknumber;
219 class __set_tag_global_field_relay {
221 __set_tag_global_field_relay(
const file_info & p_info,
t_size p_index) : m_info(p_info), m_index(p_index) {}
222 void operator() (
unsigned p_trackno,
track_record & p_record) {
234 m_content.remove_all();
237 track_record & track0 = m_content.find_or_add((
unsigned)0);
244 const char * cuesheet = p_info.
meta_get(
"cuesheet",0);
245 if (cuesheet == NULL) {
258 }
catch(exception_io_data
const & e) {
266 if (iter->m_index_list.start() > length) {
267 console::info(
"Invalid cuesheet - index outside allowed range");
276 track_record & entry = m_content.find_or_add(iter->m_track_number);
277 entry.
m_file = iter->m_file;
284 if (end <= begin)
throw exception_io_data();
290 for(
t_size metawalk = 0, metacount = p_info.
meta_get_count(); metawalk < metacount; ++metawalk) {
294 __set_tag_global_field_relay relay(p_info,metawalk);
295 m_content.enumerate(relay);
301 for(
t_size metawalk = 0, metacount = p_info.
meta_get_count(); metawalk < metacount; ++metawalk) {
316 const track_record * rec = m_content.query_ptr(p_track);
317 if (rec == NULL)
throw exception_io_data();
323 if (rec == NULL)
throw exception_io_data();
329 const track_record * rec = m_content.query_ptr(p_track);
330 if (rec == NULL)
throw exception_io_data();
336 return m_content.get_count() > 1;
340 class __remap_trackno_enumerator {
342 __remap_trackno_enumerator(
unsigned p_index) : m_countdown(p_index), m_result(0) {}
343 template<
typename t_blah>
void operator() (
unsigned p_trackno,
const t_blah&) {
344 if (p_trackno > 0 && m_result == 0) {
345 if (m_countdown == 0) {
346 m_result = p_trackno;
352 unsigned result()
const {
return m_result;}
354 unsigned m_countdown;
360 if (have_cuesheet()) {
361 __remap_trackno_enumerator wrapper(p_index);
362 m_content.enumerate(wrapper);
363 return wrapper.result();
370 return m_content.get_count() - 1;
replaygain_info get_replaygain() const
virtual double get_length() const =0
Retrieves audio duration, in seconds. Note that the reported duration should not be assumed to be th...
void meta_set(const char *p_name, const char *p_value)
t_cuesheet_index_list m_index_list
void from_info(const file_info &p_info)
static bool is_global_meta_entry(const char *p_name)
void set_replaygain(const replaygain_info &p_replaygain)
void info(const char *p_message)
virtual t_size meta_enum_value_count(t_size p_index) const =0
Retrieves count of values in metadata entry of specified index. The value is always equal to or great...
double get_length() const
static int compare(T1 const &v1, T2 const &v2)
Differences between chain_list_v2_t<> and old chain_list_t<>: Iterators pointing to removed items as...
int stricmp_ascii_ex(const char *const s1, t_size const len1, const char *const s2, t_size const len2)
file_info_record_helper::file_info_record m_info
virtual const char * meta_enum_value(t_size p_index, t_size p_value_number) const =0
Retrieves specified value from specified metadata entry. Return value is a null-terminated UTF-8 enco...
const t_meta_value * meta_query_ptr(const char *p_name) const
void complain(const char *what, const char *msg)
void transfer_meta_entry(const char *p_name, const file_info &p_info, t_size p_index)
void overwrite_meta(const t_source &p_meta)
const char * meta_get(const char *p_name, t_size p_index) const
Main interface class for information about some playable object.
void overwrite_info(const t_source &p_info)
const t_storage_value * query_ptr(const _t_key &p_key) const
void meta_remove_field(const char *p_name)
string8_fastalloc string_formatter
virtual t_size meta_get_count() const =0
Retrieves count of metadata entries.
bool remove(const _t_key &p_key)
static bool resolve_cue_meta_name(const char *p_name, pfc::string_base &p_outname, unsigned &p_tracknumber)
void enumerate_meta(t_callback &p_callback) const
unsigned atoui_ex(const char *p_string, t_size p_string_len)
void set_length(double p_length)
void from_info_overwrite_info(const file_info &p_info)
void create(pfc::string_formatter &p_out, const t_entry_list &p_data)
void set(const _t_key &p_key, const _t_value &p_value)
static void build_cue_meta_name(const char *p_name, unsigned p_tracknumber, pfc::string_base &p_out)
static bool is_reserved_meta_entry(const char *p_name)
void parse_full(const char *p_cuesheet, cue_creator::t_entry_list &p_out)
Throws exception_bad_cuesheet on failure.
void from_info_set_meta(const file_info &p_info)
bool char_is_numeric(char_t p_char)
virtual replaygain_info get_replaygain() const =0
Retrieves ReplayGain information.
static bool is_allowed_field(const char *p_name)
string8_t< pfc::alloc_fast_aggressive > string8_fastalloc
t_size meta_find(const char *p_name) const
static void strip_redundant_track_meta(unsigned p_tracknumber, const file_info &p_cueinfo, file_info_record::t_meta_map &p_meta, const char *p_metaname)
void to_info(file_info &p_info) const
virtual const char * meta_enum_name(t_size p_index) const =0
Retrieves the name of metadata entry of specified index. Return value is a null-terminated UTF-8 enco...