foobar2000 SDK  2015-08-03
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
cue_parser::input_wrapper_cue_t< t_base >

#include <cue_parser.h>

Public Member Functions

 input_wrapper_cue_t ()
 
 ~input_wrapper_cue_t ()
 
bool decode_can_seek ()
 
bool decode_get_dynamic_info (file_info &p_out, double &p_timestamp_delta)
 
bool decode_get_dynamic_info_track (file_info &p_out, double &p_timestamp_delta)
 
void decode_initialize (t_uint32 p_subsong, unsigned p_flags, abort_callback &p_abort)
 
void decode_on_idle (abort_callback &p_abort)
 
bool decode_run (audio_chunk &p_chunk, abort_callback &p_abort)
 
bool decode_run_raw (audio_chunk &p_chunk, mem_block_container &p_raw, abort_callback &p_abort)
 
void decode_seek (double p_seconds, abort_callback &p_abort)
 
t_filestats get_file_stats (abort_callback &p_abort)
 
void get_info (t_uint32 p_subsong, file_info &p_info, abort_callback &p_abort)
 
t_uint32 get_subsong (t_uint32 p_index)
 
t_uint32 get_subsong_count ()
 
void open (service_ptr_t< file > p_filehint, const char *p_path, t_input_open_reason p_reason, abort_callback &p_abort)
 
void retag_commit (abort_callback &p_abort)
 
void retag_set_info (t_uint32 p_subsong, const file_info &p_info, abort_callback &p_abort)
 
void set_logger (event_logger::ptr ptr)
 

Static Public Member Functions

static bool g_is_our_content_type (const char *p_content_type)
 
static bool g_is_our_path (const char *p_path, const char *p_extension)
 

Private Member Functions

bool _run (audio_chunk &chunk, mem_block_container *raw, abort_callback &aborter)
 

Private Attributes

double m_decodeFrom
 
double m_decodeLength
 
double m_decodePos
 
t_base m_impl
 
embeddedcue_metadata_manager m_meta
 

Detailed Description

template<typename t_base>
class cue_parser::input_wrapper_cue_t< t_base >

Definition at line 196 of file cue_parser.h.

Constructor & Destructor Documentation

template<typename t_base>
cue_parser::input_wrapper_cue_t< t_base >::input_wrapper_cue_t ( )
inline

Definition at line 198 of file cue_parser.h.

198 {}
template<typename t_base>
cue_parser::input_wrapper_cue_t< t_base >::~input_wrapper_cue_t ( )
inline

Definition at line 199 of file cue_parser.h.

199 {}

Member Function Documentation

template<typename t_base>
bool cue_parser::input_wrapper_cue_t< t_base >::_run ( audio_chunk chunk,
mem_block_container raw,
abort_callback aborter 
)
inlineprivate

Definition at line 293 of file cue_parser.h.

293  {
294  if (m_decodeLength >= 0 && m_decodePos >= m_decodeLength) return false;
295  if (raw == NULL) {
296  if (!m_impl.decode_run(chunk, aborter)) return false;
297  } else {
298  if (!m_impl.decode_run_raw(chunk, *raw, aborter)) return false;
299  }
300 
301  if (m_decodeLength >= 0) {
302  const uint64_t remaining = audio_math::time_to_samples( m_decodeLength - m_decodePos, chunk.get_sample_rate() );
303  const size_t samplesGot = chunk.get_sample_count();
304  if (remaining < samplesGot) {
306  if (remaining == 0) { // rare but possible as a result of rounding SNAFU - we're EOF but we didn't notice earlier
307  return false;
308  }
309 
310  chunk.set_sample_count( (size_t) remaining );
311  if (raw != NULL) {
312  const t_size rawSize = raw->get_size();
313  PFC_ASSERT( rawSize % samplesGot == 0 );
314  raw->set_size( (t_size) ( (t_uint64) rawSize * remaining / samplesGot ) );
315  }
316  } else {
317  m_decodePos += chunk.get_duration();
318  }
319  } else {
320  m_decodePos += chunk.get_duration();
321  }
322  return true;
323  }
virtual void set_size(t_size p_size)=0
uint64_t t_uint64
Definition: int_types.h:3
unsigned get_sample_rate() const
Helper, same as get_srate().
Definition: audio_chunk.h:103
size_t t_size
Definition: int_types.h:48
double get_duration() const
Retrieves duration of contained audio data, in seconds.
Definition: audio_chunk.h:116
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
template<typename t_base>
bool cue_parser::input_wrapper_cue_t< t_base >::decode_can_seek ( )
inline

Definition at line 251 of file cue_parser.h.

251 {return m_impl.decode_can_seek();}
template<typename t_base>
bool cue_parser::input_wrapper_cue_t< t_base >::decode_get_dynamic_info ( file_info p_out,
double &  p_timestamp_delta 
)
inline

Definition at line 260 of file cue_parser.h.

260  {
261  return m_impl.decode_get_dynamic_info(p_out, p_timestamp_delta);
262  }
template<typename t_base>
bool cue_parser::input_wrapper_cue_t< t_base >::decode_get_dynamic_info_track ( file_info p_out,
double &  p_timestamp_delta 
)
inline

Definition at line 264 of file cue_parser.h.

264  {
265  return m_impl.decode_get_dynamic_info_track(p_out, p_timestamp_delta);
266  }
template<typename t_base>
void cue_parser::input_wrapper_cue_t< t_base >::decode_initialize ( t_uint32  p_subsong,
unsigned  p_flags,
abort_callback p_abort 
)
inline

Definition at line 226 of file cue_parser.h.

226  {
227  if (p_subsong == 0) {
228  m_impl.decode_initialize(p_flags, p_abort);
229  m_decodeFrom = 0; m_decodeLength = -1; m_decodePos = 0;
230  } else {
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;
238  }
239  }
void query_track_offsets(unsigned p_track, double &p_begin, double &p_length) const
embeddedcue_metadata_manager m_meta
Definition: cue_parser.h:327
template<typename t_base>
void cue_parser::input_wrapper_cue_t< t_base >::decode_on_idle ( abort_callback p_abort)
inline

Definition at line 268 of file cue_parser.h.

268  {
269  m_impl.decode_on_idle(p_abort);
270  }
template<typename t_base>
bool cue_parser::input_wrapper_cue_t< t_base >::decode_run ( audio_chunk p_chunk,
abort_callback p_abort 
)
inline

Definition at line 241 of file cue_parser.h.

241  {
242  return _run(p_chunk, NULL, p_abort);
243  }
bool _run(audio_chunk &chunk, mem_block_container *raw, abort_callback &aborter)
Definition: cue_parser.h:293
template<typename t_base>
bool cue_parser::input_wrapper_cue_t< t_base >::decode_run_raw ( audio_chunk p_chunk,
mem_block_container p_raw,
abort_callback p_abort 
)
inline

Definition at line 253 of file cue_parser.h.

253  {
254  return _run(p_chunk, &p_raw, p_abort);
255  }
bool _run(audio_chunk &chunk, mem_block_container *raw, abort_callback &aborter)
Definition: cue_parser.h:293
template<typename t_base>
void cue_parser::input_wrapper_cue_t< t_base >::decode_seek ( double  p_seconds,
abort_callback p_abort 
)
inline

Definition at line 245 of file cue_parser.h.

245  {
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;
249  }
template<typename t_base>
static bool cue_parser::input_wrapper_cue_t< t_base >::g_is_our_content_type ( const char *  p_content_type)
inlinestatic

Definition at line 289 of file cue_parser.h.

289 {return t_base::g_is_our_content_type(p_content_type);}
template<typename t_base>
static bool cue_parser::input_wrapper_cue_t< t_base >::g_is_our_path ( const char *  p_path,
const char *  p_extension 
)
inlinestatic

Definition at line 290 of file cue_parser.h.

290 {return t_base::g_is_our_path(p_path,p_extension);}
template<typename t_base>
t_filestats cue_parser::input_wrapper_cue_t< t_base >::get_file_stats ( abort_callback p_abort)
inline

Definition at line 224 of file cue_parser.h.

224 {return m_impl.get_file_stats(p_abort);}
template<typename t_base>
void cue_parser::input_wrapper_cue_t< t_base >::get_info ( t_uint32  p_subsong,
file_info p_info,
abort_callback p_abort 
)
inline

Definition at line 216 of file cue_parser.h.

216  {
217  if (p_subsong == 0) {
218  m_meta.get_tag(p_info);
219  } else {
220  m_meta.get_track_info(p_subsong,p_info);
221  }
222  }
void get_track_info(unsigned p_track, file_info &p_info) const
embeddedcue_metadata_manager m_meta
Definition: cue_parser.h:327
template<typename t_base>
t_uint32 cue_parser::input_wrapper_cue_t< t_base >::get_subsong ( t_uint32  p_index)
inline

Definition at line 212 of file cue_parser.h.

212  {
213  return m_meta.have_cuesheet() ? m_meta.remap_trackno(p_index) : 0;
214  }
embeddedcue_metadata_manager m_meta
Definition: cue_parser.h:327
unsigned remap_trackno(unsigned p_index) const
template<typename t_base>
t_uint32 cue_parser::input_wrapper_cue_t< t_base >::get_subsong_count ( )
inline

Definition at line 208 of file cue_parser.h.

208  {
209  return m_meta.have_cuesheet() ? (uint32_t) m_meta.get_cue_track_count() : 1;
210  }
embeddedcue_metadata_manager m_meta
Definition: cue_parser.h:327
template<typename t_base>
void cue_parser::input_wrapper_cue_t< t_base >::open ( service_ptr_t< file p_filehint,
const char *  p_path,
t_input_open_reason  p_reason,
abort_callback p_abort 
)
inline

Definition at line 201 of file cue_parser.h.

201  {
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);
206  }
void info(const char *p_message)
Definition: console.cpp:4
embeddedcue_metadata_manager m_meta
Definition: cue_parser.h:327
Implements file_info.
template<typename t_base>
void cue_parser::input_wrapper_cue_t< t_base >::retag_commit ( abort_callback p_abort)
inline

Definition at line 280 of file cue_parser.h.

280  {
282  m_meta.get_tag(info);
283  m_impl.retag(pfc::implicit_cast<const file_info&>(info), p_abort);
284  info.reset();
285  m_impl.get_info(info, p_abort);
286  m_meta.set_tag( info );
287  }
void info(const char *p_message)
Definition: console.cpp:4
void reset()
Definition: file_info.cpp:287
embeddedcue_metadata_manager m_meta
Definition: cue_parser.h:327
Implements file_info.
template<typename t_base>
void cue_parser::input_wrapper_cue_t< t_base >::retag_set_info ( t_uint32  p_subsong,
const file_info p_info,
abort_callback p_abort 
)
inline

Definition at line 272 of file cue_parser.h.

272  {
273  if (p_subsong == 0) {
274  m_meta.set_tag(p_info);
275  } else {
276  m_meta.set_track_info(p_subsong,p_info);
277  }
278  }
void set_track_info(unsigned p_track, file_info const &p_info)
embeddedcue_metadata_manager m_meta
Definition: cue_parser.h:327
template<typename t_base>
void cue_parser::input_wrapper_cue_t< t_base >::set_logger ( event_logger::ptr  ptr)
inline

Definition at line 256 of file cue_parser.h.

256  {
257  m_impl.set_logger(ptr);
258  }

Field Documentation

template<typename t_base>
double cue_parser::input_wrapper_cue_t< t_base >::m_decodeFrom
private

Definition at line 325 of file cue_parser.h.

template<typename t_base>
double cue_parser::input_wrapper_cue_t< t_base >::m_decodeLength
private

Definition at line 325 of file cue_parser.h.

template<typename t_base>
double cue_parser::input_wrapper_cue_t< t_base >::m_decodePos
private

Definition at line 325 of file cue_parser.h.

template<typename t_base>
t_base cue_parser::input_wrapper_cue_t< t_base >::m_impl
private

Definition at line 324 of file cue_parser.h.

template<typename t_base>
embeddedcue_metadata_manager cue_parser::input_wrapper_cue_t< t_base >::m_meta
private

Definition at line 327 of file cue_parser.h.


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