17 template<
typename t_value>
void operator() (
const char * p_name,
const t_value & p_value) {
19 for(
typename t_value::const_iterator iter = p_value.first(); iter.is_valid(); ++iter) {
42 m_meta.remove_all(); m_info.remove_all();
48 for(
t_size infowalk = 0, infocount = p_info.
info_get_count(); infowalk < infocount; ++infowalk) {
53 for(
t_size metawalk = 0, metacount = p_info.
meta_get_count(); metawalk < metacount; ++metawalk) {
56 t_meta_value & entry = m_meta.find_or_add(p_info.
meta_enum_name(metawalk));
58 for(
t_size valuewalk = 0; valuewalk < valuecount; ++valuewalk) {
69 template<
typename t_source>
71 m_meta.overwrite(p_meta);
73 template<
typename t_source>
75 m_info.overwrite(p_info);
79 from_info_overwrite_info(p_info);
80 from_info_overwrite_meta(p_info);
81 from_info_overwrite_rg(p_info);
87 m_meta.remove(p_name);
89 t_meta_value & val = m_meta.find_or_add(p_name);
91 for(
t_size walk = 0; walk < count; ++walk) {
97 void meta_set(
const char * p_name,
const char * p_value) {
98 m_meta.find_or_add(p_name).set_single(p_value);
102 return m_meta.query_ptr(p_name);
108 from_info_overwrite_meta(p_info);
115 from_info_overwrite_meta(p_info);
116 from_info_overwrite_info(p_info);
125 m_info.enumerate( e );
129 m_meta.enumerate( e );
133 template<
typename t_callback>
void enumerate_meta(t_callback & p_callback)
const {m_meta.enumerate(p_callback);}
134 template<
typename t_callback>
void enumerate_meta(t_callback & p_callback) {m_meta.enumerate(p_callback);}
160 void parse(
const char *p_cuesheet,t_cue_entry_list & p_out);
181 void get_track_info(
unsigned p_track,
file_info & p_info)
const;
182 void set_track_info(
unsigned p_track,
file_info const & p_info);
183 void query_track_offsets(
unsigned p_track,
double & p_begin,
double & p_length)
const;
184 bool have_cuesheet()
const;
185 unsigned remap_trackno(
unsigned p_index)
const;
186 t_size get_cue_track_count()
const;
195 template<
typename t_base>
202 m_impl.open( p_filehint, p_path, p_reason, p_abort );
204 m_impl.get_info(info,p_abort);
205 m_meta.set_tag(info);
209 return m_meta.have_cuesheet() ? (uint32_t) m_meta.get_cue_track_count() : 1;
213 return m_meta.have_cuesheet() ? m_meta.remap_trackno(p_index) : 0;
217 if (p_subsong == 0) {
218 m_meta.get_tag(p_info);
220 m_meta.get_track_info(p_subsong,p_info);
227 if (p_subsong == 0) {
228 m_impl.decode_initialize(p_flags, p_abort);
229 m_decodeFrom = 0; m_decodeLength = -1; m_decodePos = 0;
231 double start, length;
232 m_meta.query_track_offsets(p_subsong,start,length);
233 unsigned flags2 = p_flags;
234 if (start > 0) flags2 &= ~input_flag_no_seeking;
235 m_impl.decode_initialize(flags2, p_abort);
236 m_impl.decode_seek(start, p_abort);
237 m_decodeFrom = start; m_decodeLength = length; m_decodePos = 0;
242 return _run(p_chunk, NULL, p_abort);
246 if (this->m_decodeLength >= 0 && p_seconds > m_decodeLength) p_seconds = m_decodeLength;
247 m_impl.decode_seek(m_decodeFrom + p_seconds,p_abort);
248 m_decodePos = p_seconds;
254 return _run(p_chunk, &p_raw, p_abort);
257 m_impl.set_logger(ptr);
261 return m_impl.decode_get_dynamic_info(p_out, p_timestamp_delta);
265 return m_impl.decode_get_dynamic_info_track(p_out, p_timestamp_delta);
269 m_impl.decode_on_idle(p_abort);
273 if (p_subsong == 0) {
274 m_meta.set_tag(p_info);
276 m_meta.set_track_info(p_subsong,p_info);
282 m_meta.get_tag(info);
283 m_impl.retag(pfc::implicit_cast<const file_info&>(info), p_abort);
285 m_impl.get_info(info, p_abort);
286 m_meta.set_tag( info );
289 inline static bool g_is_our_content_type(
const char * p_content_type) {
return t_base::g_is_our_content_type(p_content_type);}
290 inline static bool g_is_our_path(
const char * p_path,
const char * p_extension) {
return t_base::g_is_our_path(p_path,p_extension);}
294 if (m_decodeLength >= 0 && m_decodePos >= m_decodeLength)
return false;
296 if (!m_impl.decode_run(chunk, aborter))
return false;
298 if (!m_impl.decode_run_raw(chunk, *raw, aborter))
return false;
301 if (m_decodeLength >= 0) {
302 const uint64_t remaining = audio_math::time_to_samples( m_decodeLength - m_decodePos, chunk.
get_sample_rate() );
304 if (remaining < samplesGot) {
305 m_decodePos = m_decodeLength;
306 if (remaining == 0) {
313 PFC_ASSERT( rawSize % samplesGot == 0 );
353 double offset_acc = pregap;
358 entry->m_infos = p_list.
get_info(n);
359 entry->m_file =
"CDImage.wav";
360 entry->m_track_number = (unsigned)(n+1);
361 entry->m_index_list.from_infos(entry->m_infos,offset_acc);
362 if (n == 0) entry->m_index_list.m_positions[0] = 0;
363 offset_acc += entry->m_infos.get_length();
387 for(
t_uint32 walk = 0; walk < total; ++walk) {
404 template<
typename t_input_impl,
unsigned t_flags = 0>
virtual void set_size(t_size p_size)=0
replaygain_info get_replaygain() const
__file_info_record__info__enumerator(file_info &p_out)
virtual double get_length() const =0
Retrieves audio duration, in seconds. Note that the reported duration should not be assumed to be th...
void operator()(const char *p_name, const char *p_value)
pfc::chain_list_v2_t< cue_entry > t_cue_entry_list
void add_item(const t_source &p_source)
void meta_set(const char *p_name, const char *p_value)
Interface for object storing list of chapters.
t_cuesheet_index_list m_index_list
void merge_overwrite(const file_info &p_info)
void from_info(const file_info &p_info)
service_factory_single_t< cue_parser::chapterizer_impl_t< t_input_impl > > m_chapterizer_factory
void set_replaygain(const replaygain_info &p_replaygain)
void set_chapters(const char *p_path, chapter_list const &p_list, abort_callback &p_abort)
Writes new chapter list to specified file.
void info(const char *p_message)
This service implements chapter list editing operations for various file formats, e...
bool is_our_path(const char *p_path)
Tests whether specified path is supported by this implementation.
unsigned get_sample_rate() const
Helper, same as get_srate().
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
virtual const file_info & get_info(t_size p_chapter) const =0
Queries description of specified chapter.
virtual void set_info(t_size p_chapter, const file_info &p_info)=0
Modifies description of specified chapter.
Differences between chain_list_v2_t<> and old chain_list_t<>: Iterators pointing to removed items as...
Interface to container of a chunk of audio data. See audio_chunk_impl for an implementation.
pfc::map_t< pfc::string8, t_meta_value, file_info::field_name_comparator > t_meta_map
virtual const char * info_enum_value(t_size p_index) const =0
Retrieves the value of specified technical info entry. Return value is a null-terminated UTF-8 encode...
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...
static const replaygain_info replaygain_info_invalid
const t_meta_value * meta_query_ptr(const char *p_name) const
void meta_add_value(t_size p_index, const char *p_value)
Structure containing ReplayGain scan results from some playable object, also providing various helper...
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)
t_size __meta_add_unsafe(const char *p_name, const char *p_value)
Unsafe - does not check whether the field already exists and will result in duplicates if it does - c...
void enumerate_meta(t_callback &p_callback)
Main interface class for information about some playable object.
t_cuesheet_index_list m_indexes
void get_chapters(const char *p_path, chapter_list &p_list, abort_callback &p_abort)
Retrieves chapter list from specified file.
void overwrite_info(const t_source &p_info)
string8_fastalloc string_formatter
virtual void set_chapter_count(t_size p_count)=0
Sets number of chapters.
virtual t_size meta_get_count() const =0
Retrieves count of metadata entries.
void parse(const char *p_cuesheet, t_cue_entry_list &p_out)
Throws exception_bad_cuesheet on failure.
t_size __info_add_unsafe(const char *p_name, const char *p_value)
Unsafe - does not check whether the field already exists and will result in duplicates if it does - c...
replaygain_info m_replaygain
void enumerate_meta(t_callback &p_callback) const
virtual t_size get_chapter_count() const =0
Returns number of chapters.
virtual double get_pregap() const =0
virtual void set_replaygain(const replaygain_info &p_info)=0
Sets ReplayGain information.
PFC_DECLARE_EXCEPTION(exception_bad_cuesheet, exception_io_data,"Invalid cuesheet")
void set_length(double p_length)
input_factory_ex_t< cue_parser::input_wrapper_cue_t< t_input_impl >, t_flags, input_decoder_v2 > m_input_factory
void from_info_overwrite_info(const file_info &p_info)
void create(pfc::string_formatter &p_out, const t_entry_list &p_data)
pfc::chain_list_v2_t< pfc::string8 > t_meta_value
static replaygain_info g_merge(replaygain_info r1, replaygain_info r2)
pfc::map_t< unsigned, track_record > track_record_list
pfc::map_t< pfc::string8, pfc::string8, file_info::field_name_comparator > t_info_map
void from_info_overwrite_meta(const file_info &p_info)
void from_info_overwrite_rg(const file_info &p_info)
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)
t_size meta_set(const char *p_name, const char *p_value)
void parse_info(const char *p_cuesheet, file_info &p_info, unsigned p_index)
Throws exception_bad_cuesheet on failure.
Generic interface for a memory block; used by various other interfaces to return memory blocks while ...
virtual replaygain_info get_replaygain() const =0
Retrieves ReplayGain information.
double get_duration() const
Retrieves duration of contained audio data, in seconds.
virtual t_size get_sample_count() const =0
Retrieves number of valid samples in the buffer. Note that a "sample" means a unit of interleaved PC...
virtual void set_sample_count(t_size val)=0
Sets number of valid samples in the buffer. WARNING: sample count * channel count should never be abo...
virtual t_size get_size() const =0
virtual const char * info_enum_name(t_size p_index) const =0
Retrieves the name of specified technical info entry. Return value is a null-terminated UTF-8 encoded...
virtual void set_length(double p_length)=0
Sets audio duration, in seconds. Note that the reported duration should not be assumed to be the exa...
virtual t_size info_get_count() const =0
Retrieves number of technical info entries.
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...