foobar2000 SDK  2015-08-03
input.h
Go to the documentation of this file.
1 PFC_DECLARE_EXCEPTION(exception_tagging_unsupported, exception_io_data, "Tagging of this file format is not supported")
2 
3 enum {
4  input_flag_no_seeking = 1 << 0,
5  input_flag_no_looping = 1 << 1,
6  input_flag_playback = 1 << 2,
7  input_flag_testing_integrity = 1 << 3,
8  input_flag_allow_inaccurate_seeking = 1 << 4,
9  input_flag_no_postproc = 1 << 5,
10 
11  input_flag_simpledecode = input_flag_no_seeking|input_flag_no_looping,
12 };
13 
17 
18 class NOVTABLE input_info_reader : public service_base
19 {
20 public:
23  virtual t_uint32 get_subsong_count() = 0;
24 
27  virtual t_uint32 get_subsong(t_uint32 p_index) = 0;
28 
33  virtual void get_info(t_uint32 p_subsong,file_info & p_info,abort_callback & p_abort) = 0;
34 
36  virtual t_filestats get_file_stats(abort_callback & p_abort) = 0;
37 
38  FB2K_MAKE_SERVICE_INTERFACE(input_info_reader,service_base);
39 };
40 
44 
45 class NOVTABLE input_decoder : public input_info_reader
46 {
47 public:
58  virtual void initialize(t_uint32 p_subsong,unsigned p_flags,abort_callback & p_abort) = 0;
59 
64  virtual bool run(audio_chunk & p_chunk,abort_callback & p_abort) = 0;
65 
69  virtual void seek(double p_seconds,abort_callback & p_abort) = 0;
70 
72  virtual bool can_seek() = 0;
73 
78  virtual bool get_dynamic_info(file_info & p_out, double & p_timestamp_delta) = 0;
79 
84  virtual bool get_dynamic_info_track(file_info & p_out, double & p_timestamp_delta) = 0;
85 
88  virtual void on_idle(abort_callback & p_abort) = 0;
89 
90 
92 };
93 
94 
95 class NOVTABLE input_decoder_v2 : public input_decoder {
97 public:
98 
103  virtual bool run_raw(audio_chunk & out, mem_block_container & outRaw, abort_callback & abort) = 0;
104 
107  virtual void set_logger(event_logger::ptr ptr) = 0;
108 };
109 
110 class NOVTABLE input_decoder_v3 : public input_decoder_v2 {
112 public:
114  virtual void set_pause(bool paused) = 0;
116  virtual bool flush_on_pause() = 0;
117 };
118 
122 
123 class NOVTABLE input_info_writer : public input_info_reader
124 {
125 public:
130  virtual void set_info(t_uint32 p_subsong,const file_info & p_info,abort_callback & p_abort) = 0;
131 
134  virtual void commit(abort_callback & p_abort) = 0;
135 
137 };
138 
139 class NOVTABLE input_info_writer_v2 : public input_info_writer {
140 public:
142  virtual void remove_tags(abort_callback & abort) = 0;
143 
145 };
146 
147 class NOVTABLE input_entry : public service_base
148 {
149 public:
152  virtual bool is_our_content_type(const char * p_type)=0;
153 
157  virtual bool is_our_path(const char * p_full_path,const char * p_extension)=0;
158 
164  virtual void open_for_decoding(service_ptr_t<input_decoder> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort) = 0;
165 
171  virtual void open_for_info_read(service_ptr_t<input_info_reader> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort) = 0;
172 
178  virtual void open_for_info_write(service_ptr_t<input_info_writer> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort) = 0;
179 
181  virtual void get_extended_data(service_ptr_t<file> p_filehint,const playable_location & p_location,const GUID & p_guid,mem_block_container & p_out,abort_callback & p_abort) = 0;
182 
183  enum {
185  flag_redirect = 1,
187  flag_parallel_reads_slow = 2,
188  };
190  virtual unsigned get_flags() = 0;
191 
192  inline bool is_redirect() {return (get_flags() & flag_redirect) != 0;}
193  inline bool are_parallel_reads_slow() {return (get_flags() & flag_parallel_reads_slow) != 0;}
194 
195  static bool g_find_service_by_path(service_ptr_t<input_entry> & p_out,const char * p_path);
196  static bool g_find_service_by_path(service_ptr_t<input_entry> & p_out,const char * p_path, const char * p_ext);
197  static bool g_find_service_by_content_type(service_ptr_t<input_entry> & p_out,const char * p_content_type);
198  static void g_open_for_decoding(service_ptr_t<input_decoder> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort,bool p_from_redirect = false);
199  static void g_open_for_info_read(service_ptr_t<input_info_reader> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort,bool p_from_redirect = false);
200  static void g_open_for_info_write(service_ptr_t<input_info_writer> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort,bool p_from_redirect = false);
201  static void g_open_for_info_write_timeout(service_ptr_t<input_info_writer> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort,double p_timeout,bool p_from_redirect = false);
202  static bool g_is_supported_path(const char * p_path);
203 
204 
205  void open(service_ptr_t<input_decoder> & p_instance,service_ptr_t<file> const & p_filehint,const char * p_path,abort_callback & p_abort) {open_for_decoding(p_instance,p_filehint,p_path,p_abort);}
206  void open(service_ptr_t<input_info_reader> & p_instance,service_ptr_t<file> const & p_filehint,const char * p_path,abort_callback & p_abort) {open_for_info_read(p_instance,p_filehint,p_path,p_abort);}
207  void open(service_ptr_t<input_info_writer> & p_instance,service_ptr_t<file> const & p_filehint,const char * p_path,abort_callback & p_abort) {open_for_info_write(p_instance,p_filehint,p_path,p_abort);}
208 
209  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(input_entry);
210 };
void open(service_ptr_t< input_info_reader > &p_instance, service_ptr_t< file > const &p_filehint, const char *p_path, abort_callback &p_abort)
Definition: input.h:206
void seek(HANDLE p_handle, t_sfilesize p_position, file::t_seek_mode p_mode)
Definition: pfc.h:71
void open(service_ptr_t< input_info_writer > &p_instance, service_ptr_t< file > const &p_filehint, const char *p_path, abort_callback &p_abort)
Definition: input.h:207
void open(service_ptr_t< input_decoder > &p_instance, service_ptr_t< file > const &p_filehint, const char *p_path, abort_callback &p_abort)
Definition: input.h:205
Class providing interface for writing metadata and replaygain info to files. Also see: file_info...
Definition: input.h:123
Interface to container of a chunk of audio data. See audio_chunk_impl for an implementation.
Definition: audio_chunk.h:5
bool is_redirect()
Definition: input.h:192
FB2K_MAKE_SERVICE_INTERFACE(input_decoder, input_info_reader)
Class providing interface for retrieval of information (metadata, duration, replaygain, other tech infos) from files. Also see: file_info. Instantiating: see input_entry. Implementing: see input_impl.
Definition: input.h:18
Main interface class for information about some playable object.
Definition: file_info.h:73
PFC_DECLARE_EXCEPTION(exception_tagging_unsupported, exception_io_data,"Tagging of this file format is not supported") enum
Definition: input.h:1
bool are_parallel_reads_slow()
Definition: input.h:193
Base class for all service classes. Provides interfaces for reference counter and querying for differ...
Definition: service.h:333
FB2K_MAKE_SERVICE_INTERFACE(input_info_writer, input_info_reader)
Class providing interface for retrieval of PCM audio data from files. Instantiating: see input_entry...
Definition: input.h:45
Definition: input.h:147
FB2K_MAKE_SERVICE_INTERFACE(input_info_reader, service_base)
Generic interface for a memory block; used by various other interfaces to return memory blocks while ...
uint32_t t_uint32
Definition: int_types.h:5