foobar2000 SDK  2015-01-14
Public Member Functions
cue_parser::chapterizer_impl_t< I >

#include <cue_parser.h>

+ Inheritance diagram for cue_parser::chapterizer_impl_t< I >:

Public Member Functions

void get_chapters (const char *p_path, chapter_list &p_list, abort_callback &p_abort)
 
bool is_our_path (const char *p_path)
 
void set_chapters (const char *p_path, chapter_list const &p_list, abort_callback &p_abort)
 
bool supports_pregaps ()
 
- 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 ()
 

Additional Inherited Members

- Public Types inherited from service_base
typedef service_base t_interface
 
- Static Public Member Functions inherited from chapterizer
static bool g_find (service_ptr_t< chapterizer > &p_out, const char *p_path)
 
static bool g_is_pregap_capable (const char *p_path)
 
- Protected Member Functions inherited from service_base
 service_base ()
 
 ~service_base ()
 

Detailed Description

template<typename I>
class cue_parser::chapterizer_impl_t< I >

Definition at line 331 of file cue_parser.h.

Member Function Documentation

template<typename I>
void cue_parser::chapterizer_impl_t< I >::get_chapters ( const char *  p_path,
chapter_list p_list,
abort_callback p_abort 
)
inlinevirtual

Retrieves chapter list from specified file.

Parameters
p_pathPath of file to examine.
p_listObject receiving chapter list.
p_abortabort_callback object signaling user aborting the operation.

Implements chapterizer.

Definition at line 380 of file cue_parser.h.

380  {
381 
382  input_wrapper_cue_t<I> instance;
383  instance.open(0,p_path,input_open_info_read,p_abort);
384  const t_uint32 total = instance.get_subsong_count();
385 
386  p_list.set_chapter_count(total);
387  for(t_uint32 walk = 0; walk < total; ++walk) {
389  instance.get_info(instance.get_subsong(walk),info,p_abort);
390  p_list.set_info(walk,info);
391  }
392  }
void info(const char *p_message)
Definition: console.cpp:4
virtual void set_info(t_size p_chapter, const file_info &p_info)=0
Modifies description of specified chapter.
virtual void set_chapter_count(t_size p_count)=0
Sets number of chapters.
Implements file_info.
uint32_t t_uint32
Definition: int_types.h:5
template<typename I>
bool cue_parser::chapterizer_impl_t< I >::is_our_path ( const char *  p_path)
inlinevirtual

Tests whether specified path is supported by this implementation.

Parameters
p_extExtension of the file being processed.

Implements chapterizer.

Definition at line 334 of file cue_parser.h.

334  {
335  return I::g_is_our_path(p_path, pfc::string_extension(p_path));
336  }
template<typename I>
void cue_parser::chapterizer_impl_t< I >::set_chapters ( const char *  p_path,
chapter_list const &  p_list,
abort_callback p_abort 
)
inlinevirtual

Writes new chapter list to specified file.

Parameters
p_pathPath of file to modify.
p_listNew chapter list to write.
p_abortabort_callback object signaling user aborting the operation.

Implements chapterizer.

Definition at line 338 of file cue_parser.h.

338  {
339  input_wrapper_cue_t<I> instance;
340  instance.open(0,p_path,input_open_info_write,p_abort);
341 
342  //stamp the cuesheet first
343  {
345  instance.get_info(0,info,p_abort);
346 
347  pfc::string_formatter cuesheet;
348 
349  {
351  t_size n, m = p_list.get_chapter_count();
352  const double pregap = p_list.get_pregap();
353  double offset_acc = pregap;
354  for(n=0;n<m;n++)
355  {
357  entry = entries.insert_last();
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();
364  }
365  cue_creator::create(cuesheet,entries);
366  }
367 
368  info.meta_set("cuesheet",cuesheet);
369 
370  instance.retag_set_info(0,info,p_abort);
371  }
372  //stamp per-chapter infos
373  for(t_size walk = 0, total = p_list.get_chapter_count(); walk < total; ++walk) {
374  instance.retag_set_info( (uint32_t)( walk + 1 ), p_list.get_info(walk),p_abort);
375  }
376 
377  instance.retag_commit(p_abort);
378  }
void info(const char *p_message)
Definition: console.cpp:4
Differences between chain_list_v2_t<> and old chain_list_t<>: Iterators pointing to removed items as...
Definition: chain_list_v2.h:26
size_t t_size
Definition: int_types.h:48
string8_fastalloc string_formatter
Definition: string_base.h:614
void create(pfc::string_formatter &p_out, const t_entry_list &p_data)
Definition: cue_creator.cpp:44
t_size meta_set(const char *p_name, const char *p_value)
Definition: file_info.h:157
Implements file_info.
template<typename I>
bool cue_parser::chapterizer_impl_t< I >::supports_pregaps ( )
inlinevirtual

Implements chapterizer.

Definition at line 394 of file cue_parser.h.

394  {
395  return true;
396  }

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