foobar2000 SDK  2015-08-03
Public Types | Public Member Functions | Static Public Member Functions
input_entryabstract

#include <input.h>

+ Inheritance diagram for input_entry:

Public Types

enum  { flag_redirect = 1, flag_parallel_reads_slow = 2 }
 
- Public Types inherited from service_base
typedef service_base t_interface
 

Public Member Functions

bool are_parallel_reads_slow ()
 
 FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT (input_entry)
 
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
 
virtual unsigned get_flags ()=0
 
virtual bool is_our_content_type (const char *p_type)=0
 
virtual bool is_our_path (const char *p_full_path, const char *p_extension)=0
 
bool is_redirect ()
 
void open (service_ptr_t< input_decoder > &p_instance, service_ptr_t< file > const &p_filehint, const char *p_path, abort_callback &p_abort)
 
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)
 
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)
 
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
 
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
 
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
 
- 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 ()
 

Static Public Member Functions

static bool g_find_service_by_content_type (service_ptr_t< input_entry > &p_out, const char *p_content_type)
 
static bool g_find_service_by_path (service_ptr_t< input_entry > &p_out, const char *p_path)
 
static bool g_find_service_by_path (service_ptr_t< input_entry > &p_out, const char *p_path, const char *p_ext)
 
static bool g_is_supported_path (const char *p_path)
 
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)
 
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)
 
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)
 
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)
 

Additional Inherited Members

- Protected Member Functions inherited from service_base
 service_base ()
 
 ~service_base ()
 

Detailed Description

Definition at line 147 of file input.h.

Member Enumeration Documentation

anonymous enum
Enumerator
flag_redirect 

Indicates that this service implements some kind of redirector that opens another input for decoding, used to avoid circular call possibility.

flag_parallel_reads_slow 

Indicates that multi-CPU optimizations should not be used.

Definition at line 183 of file input.h.

183  {
185  flag_redirect = 1,
188  };
Indicates that this service implements some kind of redirector that opens another input for decoding...
Definition: input.h:185
Indicates that multi-CPU optimizations should not be used.
Definition: input.h:187

Member Function Documentation

bool input_entry::are_parallel_reads_slow ( )
inline

Definition at line 193 of file input.h.

193 {return (get_flags() & flag_parallel_reads_slow) != 0;}
Indicates that multi-CPU optimizations should not be used.
Definition: input.h:187
virtual unsigned get_flags()=0
See flag_* enums.
input_entry::FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT ( input_entry  )
bool input_entry::g_find_service_by_content_type ( service_ptr_t< input_entry > &  p_out,
const char *  p_content_type 
)
static

Definition at line 24 of file input.cpp.

25 {
28  while(e.next(ptr))
29  {
30  if (ptr->is_our_content_type(p_content_type))
31  {
32  p_out = ptr;
33  return true;
34  }
35  }
36  return false;
37 }
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
Definition: service.h:55
bool next(service_ptr_t< t_query > &p_out)
Definition: service.h:587
bool input_entry::g_find_service_by_path ( service_ptr_t< input_entry > &  p_out,
const char *  p_path 
)
static

Definition at line 3 of file input.cpp.

4 {
5  pfc::string_extension ext(p_path);
6  return g_find_service_by_path(p_out, p_path, ext );
7 }
static bool g_find_service_by_path(service_ptr_t< input_entry > &p_out, const char *p_path)
Definition: input.cpp:3
bool input_entry::g_find_service_by_path ( service_ptr_t< input_entry > &  p_out,
const char *  p_path,
const char *  p_ext 
)
static

Definition at line 9 of file input.cpp.

10 {
13  while(e.next(ptr))
14  {
15  if (ptr->is_our_path(p_path,p_ext))
16  {
17  p_out = ptr;
18  return true;
19  }
20  }
21  return false;
22 }
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
Definition: service.h:55
bool next(service_ptr_t< t_query > &p_out)
Definition: service.h:587
bool input_entry::g_is_supported_path ( const char *  p_path)
static

Definition at line 217 of file input.cpp.

218 {
221  pfc::string_extension ext(p_path);
222  while(e.next(ptr))
223  {
224  if (ptr->is_our_path(p_path,ext)) return true;
225  }
226  return false;
227 }
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
Definition: service.h:55
bool next(service_ptr_t< t_query > &p_out)
Definition: service.h:587
void input_entry::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 
)
static

Definition at line 160 of file input.cpp.

160  {
161  TRACK_CALL_TEXT("input_entry::g_open_for_decoding");
162 #if 1
163  g_open_t(p_instance,p_filehint,p_path,p_abort,p_from_redirect);
164 #else
165  service_ptr_t<file> filehint = p_filehint;
167 
168  prepare_for_open(entry,filehint,p_path,filesystem::open_mode_read,p_abort,p_from_redirect);
169 
170  entry->open_for_decoding(p_instance,filehint,p_path,p_abort);
171 #endif
172 
173 }
static void prepare_for_open(service_ptr_t< input_entry > &p_service, service_ptr_t< file > &p_file, const char *p_path, filesystem::t_open_mode p_open_mode, abort_callback &p_abort, bool p_from_redirect)
Definition: input.cpp:41
void input_entry::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 
)
static

Definition at line 175 of file input.cpp.

175  {
176  TRACK_CALL_TEXT("input_entry::g_open_for_info_read");
177 #if 1
178  g_open_t(p_instance,p_filehint,p_path,p_abort,p_from_redirect);
179 #else
180  service_ptr_t<file> filehint = p_filehint;
182 
183  prepare_for_open(entry,filehint,p_path,filesystem::open_mode_read,p_abort,p_from_redirect);
184 
185  entry->open_for_info_read(p_instance,filehint,p_path,p_abort);
186 #endif
187 }
static void prepare_for_open(service_ptr_t< input_entry > &p_service, service_ptr_t< file > &p_file, const char *p_path, filesystem::t_open_mode p_open_mode, abort_callback &p_abort, bool p_from_redirect)
Definition: input.cpp:41
void input_entry::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 
)
static

Definition at line 189 of file input.cpp.

189  {
190  TRACK_CALL_TEXT("input_entry::g_open_for_info_write");
191 #if 1
192  g_open_t(p_instance,p_filehint,p_path,p_abort,p_from_redirect);
193 #else
194  service_ptr_t<file> filehint = p_filehint;
196 
197  prepare_for_open(entry,filehint,p_path,filesystem::open_mode_write_existing,p_abort,p_from_redirect);
198 
199  entry->open_for_info_write(p_instance,filehint,p_path,p_abort);
200 #endif
201 }
static void prepare_for_open(service_ptr_t< input_entry > &p_service, service_ptr_t< file > &p_file, const char *p_path, filesystem::t_open_mode p_open_mode, abort_callback &p_abort, bool p_from_redirect)
Definition: input.cpp:41
void input_entry::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 
)
static

Definition at line 203 of file input.cpp.

203  {
204  pfc::lores_timer timer;
205  timer.start();
206  for(;;) {
207  try {
208  g_open_for_info_write(p_instance,p_filehint,p_path,p_abort,p_from_redirect);
209  break;
210  } catch(exception_io_sharing_violation) {
211  if (timer.query() > p_timeout) throw;
212  p_abort.sleep(0.01);
213  }
214  }
215 }
void start()
Definition: timers.h:93
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)
Definition: input.cpp:189
double query() const
Definition: timers.h:97
virtual void input_entry::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 
)
pure virtual
virtual unsigned input_entry::get_flags ( )
pure virtual
virtual bool input_entry::is_our_content_type ( const char *  p_type)
pure virtual
virtual bool input_entry::is_our_path ( const char *  p_full_path,
const char *  p_extension 
)
pure virtual

Determines whether specified file type can be handled by this input. This must not use any kind of file access; the result should be only based on file path / extension.

Parameters
p_full_pathFull URL of file being tested.
p_extensionExtension of file being tested, provided by caller for performance reasons.

Implemented in input_entry_impl_t< I, t_flags, t_decoder, t_inforeader, t_infowriter >, input_entry_impl_t< T, t_flags, t_decoder, t_inforeader, t_infowriter >, input_entry_impl_t< input_wrapper_singletrack_t< T >, t_flags, t_decoder, t_inforeader, t_infowriter >, input_entry_impl_t< T, 0 >, input_entry_impl_t< input_wrapper_singletrack_t< T >, 0 >, and input_entry_impl_t< cue_parser::input_wrapper_cue_t< t_input_impl >, t_flags, input_decoder_v2, input_info_reader, input_info_writer >.

bool input_entry::is_redirect ( )
inline

Definition at line 192 of file input.h.

192 {return (get_flags() & flag_redirect) != 0;}
Indicates that this service implements some kind of redirector that opens another input for decoding...
Definition: input.h:185
virtual unsigned get_flags()=0
See flag_* enums.
void input_entry::open ( service_ptr_t< input_decoder > &  p_instance,
service_ptr_t< file > const &  p_filehint,
const char *  p_path,
abort_callback p_abort 
)
inline

Definition at line 205 of file input.h.

205 {open_for_decoding(p_instance,p_filehint,p_path,p_abort);}
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
Opens specified resource for decoding.
void input_entry::open ( service_ptr_t< input_info_reader > &  p_instance,
service_ptr_t< file > const &  p_filehint,
const char *  p_path,
abort_callback p_abort 
)
inline

Definition at line 206 of file input.h.

206 {open_for_info_read(p_instance,p_filehint,p_path,p_abort);}
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
Opens specified file for reading info.
void input_entry::open ( service_ptr_t< input_info_writer > &  p_instance,
service_ptr_t< file > const &  p_filehint,
const char *  p_path,
abort_callback p_abort 
)
inline

Definition at line 207 of file input.h.

207 {open_for_info_write(p_instance,p_filehint,p_path,p_abort);}
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
Opens specified file for writing info.
virtual void input_entry::open_for_decoding ( service_ptr_t< input_decoder > &  p_instance,
service_ptr_t< file p_filehint,
const char *  p_path,
abort_callback p_abort 
)
pure virtual

Opens specified resource for decoding.

Parameters
p_instanceReceives new input_decoder instance if successful.
p_filehintOptional; passes file object to use for the operation; if set to null, the service will handle opening file by itself. Note that not all inputs operate on physical files that can be reached through filesystem API, some of them require this parameter to be set to null (tone and silence generators for an example).
p_pathURL of resource being opened.
p_abortabort_callback object signaling user aborting the operation.

Implemented in input_entry_impl_t< I, t_flags, t_decoder, t_inforeader, t_infowriter >, input_entry_impl_t< T, t_flags, t_decoder, t_inforeader, t_infowriter >, input_entry_impl_t< input_wrapper_singletrack_t< T >, t_flags, t_decoder, t_inforeader, t_infowriter >, input_entry_impl_t< T, 0 >, input_entry_impl_t< input_wrapper_singletrack_t< T >, 0 >, and input_entry_impl_t< cue_parser::input_wrapper_cue_t< t_input_impl >, t_flags, input_decoder_v2, input_info_reader, input_info_writer >.

virtual void input_entry::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 
)
pure virtual

Opens specified file for reading info.

Parameters
p_instanceReceives new input_info_reader instance if successful.
p_filehintOptional; passes file object to use for the operation; if set to null, the service will handle opening file by itself. Note that not all inputs operate on physical files that can be reached through filesystem API, some of them require this parameter to be set to null (tone and silence generators for an example).
p_pathURL of resource being opened.
p_abortabort_callback object signaling user aborting the operation.

Implemented in input_entry_impl_t< I, t_flags, t_decoder, t_inforeader, t_infowriter >, input_entry_impl_t< T, t_flags, t_decoder, t_inforeader, t_infowriter >, input_entry_impl_t< input_wrapper_singletrack_t< T >, t_flags, t_decoder, t_inforeader, t_infowriter >, input_entry_impl_t< T, 0 >, input_entry_impl_t< input_wrapper_singletrack_t< T >, 0 >, and input_entry_impl_t< cue_parser::input_wrapper_cue_t< t_input_impl >, t_flags, input_decoder_v2, input_info_reader, input_info_writer >.

virtual void input_entry::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 
)
pure virtual

Opens specified file for writing info.

Parameters
p_instanceReceives new input_info_writer instance if successful.
p_filehintOptional; passes file object to use for the operation; if set to null, the service will handle opening file by itself. Note that not all inputs operate on physical files that can be reached through filesystem API, some of them require this parameter to be set to null (tone and silence generators for an example).
p_pathURL of resource being opened.
p_abortabort_callback object signaling user aborting the operation.

Implemented in input_entry_impl_t< I, t_flags, t_decoder, t_inforeader, t_infowriter >, input_entry_impl_t< T, t_flags, t_decoder, t_inforeader, t_infowriter >, input_entry_impl_t< input_wrapper_singletrack_t< T >, t_flags, t_decoder, t_inforeader, t_infowriter >, input_entry_impl_t< T, 0 >, input_entry_impl_t< input_wrapper_singletrack_t< T >, 0 >, and input_entry_impl_t< cue_parser::input_wrapper_cue_t< t_input_impl >, t_flags, input_decoder_v2, input_info_reader, input_info_writer >.


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