foobar2000 SDK  2015-08-03
chapterizer.h
Go to the documentation of this file.
1 class NOVTABLE chapter_list {
3 public:
5  virtual t_size get_chapter_count() const = 0;
9  virtual const file_info & get_info(t_size p_chapter) const = 0;
10 
12  virtual void set_chapter_count(t_size p_count) = 0;
16  virtual void set_info(t_size p_chapter,const file_info & p_info) = 0;
17 
18  virtual double get_pregap() const = 0;
19  virtual void set_pregap(double val) = 0;
20 
22  void copy(const chapter_list & p_source);
23 
24  inline const chapter_list & operator=(const chapter_list & p_source) {copy(p_source); return *this;}
25 
26 protected:
29 };
30 
32 template<typename file_info_ = file_info_impl>
34 public:
35  chapter_list_impl_t() : m_pregap() {}
37  chapter_list_impl_t(const chapter_list & p_source) : m_pregap() {copy(p_source);}
38 
39  const t_self & operator=(const chapter_list & p_source) {copy(p_source); return *this;}
40 
41  t_size get_chapter_count() const {return m_infos.get_size();}
42  const file_info & get_info(t_size p_chapter) const {return m_infos[p_chapter];}
43 
44  void set_chapter_count(t_size p_count) {m_infos.set_size(p_count);}
45  void set_info(t_size p_chapter,const file_info & p_info) {m_infos[p_chapter] = p_info;}
46  file_info_ & get_info_(t_size p_chapter) {return m_infos[p_chapter];}
47 
48  double get_pregap() const {return m_pregap;}
49  void set_pregap(double val) {PFC_ASSERT(val >= 0); m_pregap = val;}
50 private:
52  double m_pregap;
53 };
54 
56 
57 
59 class NOVTABLE chapterizer : public service_base {
60  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(chapterizer);
61 public:
64  virtual bool is_our_path(const char * p_path) = 0;
65 
70  virtual void set_chapters(const char * p_path,chapter_list const & p_list,abort_callback & p_abort) = 0;
75  virtual void get_chapters(const char * p_path,chapter_list & p_list,abort_callback & p_abort) = 0;
76 
77  virtual bool supports_pregaps() = 0;
78 
80  static bool g_find(service_ptr_t<chapterizer> & p_out,const char * p_path);
81 
82  static bool g_is_pregap_capable(const char * p_path);
83 };
84 
85 
86 
87 unsigned cuesheet_parse_index_time_ticks_e(const char * p_string,t_size p_length);
88 double cuesheet_parse_index_time_e(const char * p_string,t_size p_length);
89 
91 {
92 public:
93  cuesheet_format_index_time(double p_time);
94  inline operator const char*() const {return m_buffer;}
95 private:
97 };
t_size get_chapter_count() const
Returns number of chapters.
Definition: chapterizer.h:41
chapter_list_impl_t chapter_list_impl
Definition: chapterizer.h:55
void set_info(t_size p_chapter, const file_info &p_info)
Modifies description of specified chapter.
Definition: chapterizer.h:45
Interface for object storing list of chapters.
Definition: chapterizer.h:2
This service implements chapter list editing operations for various file formats, e...
Definition: chapterizer.h:59
void set_pregap(double val)
Definition: chapterizer.h:49
file_info_ & get_info_(t_size p_chapter)
Definition: chapterizer.h:46
pfc::array_t< file_info_ > m_infos
Definition: chapterizer.h:51
double get_pregap() const
Definition: chapterizer.h:48
Main interface class for information about some playable object.
Definition: file_info.h:73
unsigned cuesheet_parse_index_time_ticks_e(const char *p_string, t_size p_length)
Definition: chapterizer.cpp:48
size_t t_size
Definition: int_types.h:48
string8_fastalloc string_formatter
Definition: string_base.h:615
void set_chapter_count(t_size p_count)
Sets number of chapters.
Definition: chapterizer.h:44
Base class for all service classes. Provides interfaces for reference counter and querying for differ...
Definition: service.h:333
const file_info & get_info(t_size p_chapter) const
Queries description of specified chapter.
Definition: chapterizer.h:42
const t_self & operator=(const chapter_list &p_source)
Definition: chapterizer.h:39
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
Definition: service.h:55
This is free and unencumbered software released into the public domain Anyone is free to copy
Definition: pfc-license.txt:3
double cuesheet_parse_index_time_e(const char *p_string, t_size p_length)
Definition: chapterizer.cpp:43
chapter_list_impl_t(const chapter_list &p_source)
Definition: chapterizer.h:37
chapter_list_impl_t< file_info_ > t_self
Definition: chapterizer.h:36
const chapter_list & operator=(const chapter_list &p_source)
Definition: chapterizer.h:24
Implements chapter_list.
Definition: chapterizer.h:33
pfc::string_formatter m_buffer
Definition: chapterizer.h:96