foobar2000 SDK  2015-01-14
Public Member Functions
input_decoderabstract

#include <input.h>

+ Inheritance diagram for input_decoder:

Public Member Functions

virtual bool can_seek ()=0
 
 FB2K_MAKE_SERVICE_INTERFACE (input_decoder, input_info_reader)
 
virtual bool get_dynamic_info (file_info &p_out, double &p_timestamp_delta)=0
 
virtual bool get_dynamic_info_track (file_info &p_out, double &p_timestamp_delta)=0
 
virtual void initialize (t_uint32 p_subsong, unsigned p_flags, abort_callback &p_abort)=0
 
virtual void on_idle (abort_callback &p_abort)=0
 
virtual bool run (audio_chunk &p_chunk, abort_callback &p_abort)=0
 
virtual void seek (double p_seconds, abort_callback &p_abort)=0
 
- Public Member Functions inherited from input_info_reader
 FB2K_MAKE_SERVICE_INTERFACE (input_info_reader, service_base)
 
virtual t_filestats get_file_stats (abort_callback &p_abort)=0
 
virtual void get_info (t_uint32 p_subsong, file_info &p_info, abort_callback &p_abort)=0
 
virtual t_uint32 get_subsong (t_uint32 p_index)=0
 
virtual t_uint32 get_subsong_count ()=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 ()
 

Additional Inherited Members

- Public Types inherited from service_base
typedef service_base t_interface
 
- Protected Member Functions inherited from service_base
 service_base ()
 
 ~service_base ()
 

Detailed Description

Class providing interface for retrieval of PCM audio data from files.
Instantiating: see input_entry.
Implementing: see input_impl.

Definition at line 45 of file input.h.

Member Function Documentation

virtual bool input_decoder::can_seek ( )
pure virtual

Queries whether resource being read/decoded is seekable. If p_value is set to false, all seek() calls will fail. Before calling can_seek() or other decoding calls, decoding must be initialized with initialize() call.

input_decoder::FB2K_MAKE_SERVICE_INTERFACE ( input_decoder  ,
input_info_reader   
)
virtual bool input_decoder::get_dynamic_info ( file_info p_out,
double &  p_timestamp_delta 
)
pure virtual

This function is used to signal dynamic VBR bitrate, etc. Called after each run() (or not called at all if caller doesn't care about dynamic info).

Parameters
p_outInitially contains currently displayed info (either last get_dynamic_info result or current cached info), use this object to return changed info.
p_timestamp_deltaIndicates when returned info should be displayed (in seconds, relative to first sample of last decoded chunk), initially set to 0.
Returns
false to keep old info, or true to indicate that changes have been made to p_info and those should be displayed.
virtual bool input_decoder::get_dynamic_info_track ( file_info p_out,
double &  p_timestamp_delta 
)
pure virtual

This function is used to signal dynamic live stream song titles etc. Called after each run() (or not called at all if caller doesn't care about dynamic info). The difference between this and get_dynamic_info() is frequency and relevance of dynamic info changes - get_dynamic_info_track() returns new info only on track change in the stream, returning new titles etc.

Parameters
p_outInitially contains currently displayed info (either last get_dynamic_info_track result or current cached info), use this object to return changed info.
p_timestamp_deltaIndicates when returned info should be displayed (in seconds, relative to first sample of last decoded chunk), initially set to 0.
Returns
false to keep old info, or true to indicate that changes have been made to p_info and those should be displayed.
virtual void input_decoder::initialize ( t_uint32  p_subsong,
unsigned  p_flags,
abort_callback p_abort 
)
pure virtual

Prepares to decode specified subsong; resets playback position to the beginning of specified subsong. This must be called first, before any other input_decoder methods (other than those inherited from input_info_reader).
It is legal to set initialize() more than once, with same or different subsong, to play either the same subsong again or another subsong from same file without full reopen.
Warning: this interface inherits from input_info_reader, it is legal to call any input_info_reader methods even during decoding! Call order is not defined, other than initialize() requirement before calling other input_decoder methods.
.

Parameters
p_subsongSubsong to decode. Should always be 0 for non-multi-subsong-enabled inputs.
p_flagsSpecifies additional hints for decoding process. It can be null, or a combination of one or more following constants:
input_flag_no_seeking - Indicates that seek() will never be called. Can be used to avoid building potentially expensive seektables when only sequential reading is needed.
input_flag_no_looping - Certain input implementations can be configured to utilize looping info from file formats they process and keep playing single file forever, or keep repeating it specified number of times. This flag indicates that such features should be disabled, for e.g. ReplayGain scan or conversion.
input_flag_playback - Indicates that decoding process will be used for realtime playback rather than conversion. This can be used to reconfigure features that are relevant only for conversion and take a lot of resources, such as very slow secure CDDA reading.
input_flag_testing_integrity - Indicates that we're testing integrity of the file. Any recoverable problems where decoding would normally continue should cause decoder to fail with exception_io_data.
p_abortabort_callback object signaling user aborting the operation.
virtual void input_decoder::on_idle ( abort_callback p_abort)
pure virtual

Called from playback thread before sleeping.

Parameters
p_abortabort_callback object signaling user aborting the operation.
virtual bool input_decoder::run ( audio_chunk p_chunk,
abort_callback p_abort 
)
pure virtual

Reads/decodes one chunk of audio data. Use false return value to signal end of file (no more data to return). Before calling run(), decoding must be initialized by initialize() call.

Parameters
p_chunkaudio_chunk object receiving decoded data. Contents are valid only the method returns true.
p_abortabort_callback object signaling user aborting the operation.
Returns
true on success (new data decoded), false on EOF.
virtual void input_decoder::seek ( double  p_seconds,
abort_callback p_abort 
)
pure virtual

Seeks to specified time offset. Before seeking or other decoding calls, decoding must be initialized with initialize() call.

Parameters
p_secondsTime to seek to, in seconds. If p_seconds exceeds length of the object being decoded, succeed, and then return false from next run() call.
p_abortabort_callback object signaling user aborting the operation.

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