foobar2000 SDK  2015-01-14
Public Member Functions | Private Attributes
input_postprocessed< baseclass >

#include <decode_postprocessor.h>

+ Inheritance diagram for input_postprocessed< baseclass >:

Public Member Functions

bool decode_get_dynamic_info (file_info &p_out, double &p_timestamp_delta)
 
void decode_initialize (t_uint32 p_subsong, unsigned p_flags, abort_callback &p_abort)
 
void decode_initialize (unsigned p_flags, abort_callback &p_abort)
 
bool decode_run (audio_chunk &p_chunk, abort_callback &p_abort)
 
bool decode_run_raw (audio_chunk &p_chunk, mem_block_container &p_raw, abort_callback &p_abort)
 
void decode_seek (double p_seconds, abort_callback &p_abort)
 

Private Attributes

dsp_chunk_list_impl m_chunks
 
bool m_haveEOF
 
decode_postprocessor m_postproc
 
double m_toSkip
 

Detailed Description

template<typename baseclass>
class input_postprocessed< baseclass >

Generic template to add decode_postprocessor support to your input class. Works with both single-track and multi-track inputs.

Definition at line 83 of file decode_postprocessor.h.

Member Function Documentation

template<typename baseclass >
bool input_postprocessed< baseclass >::decode_get_dynamic_info ( file_info p_out,
double &  p_timestamp_delta 
)
inline

Definition at line 143 of file decode_postprocessor.h.

143  {
144  bool rv = baseclass::decode_get_dynamic_info(p_out, p_timestamp_delta);
145  if (m_postproc.get_dynamic_info(p_out)) rv = true;
146  return rv;
147  }
decode_postprocessor m_postproc
bool get_dynamic_info(file_info &p_out)
template<typename baseclass >
void input_postprocessed< baseclass >::decode_initialize ( t_uint32  p_subsong,
unsigned  p_flags,
abort_callback p_abort 
)
inline

Definition at line 85 of file decode_postprocessor.h.

85  {
87  m_haveEOF = false;
88  m_toSkip = 0;
89  m_postproc.close();
90  if ((p_flags & input_flag_no_postproc) == 0 && m_postproc.should_bother()) {
92  this->get_info(p_subsong, info, p_abort);
93  m_postproc.initialize(info);
94  }
95  baseclass::decode_initialize(p_subsong, p_flags, p_abort);
96  }
void remove_all()
Definition: dsp.h:12
decode_postprocessor m_postproc
void info(const char *p_message)
Definition: console.cpp:4
dsp_chunk_list_impl m_chunks
void initialize(const file_info &info)
Implements file_info.
template<typename baseclass >
void input_postprocessed< baseclass >::decode_initialize ( unsigned  p_flags,
abort_callback p_abort 
)
inline

Definition at line 97 of file decode_postprocessor.h.

97  {
99  m_haveEOF = false;
100  m_toSkip = 0;
101  m_postproc.close();
102  if ((p_flags & input_flag_no_postproc) == 0 && m_postproc.should_bother()) {
104  this->get_info(info, p_abort);
105  m_postproc.initialize(info);
106  }
107  baseclass::decode_initialize(p_flags, p_abort);
108  }
void remove_all()
Definition: dsp.h:12
decode_postprocessor m_postproc
void info(const char *p_message)
Definition: console.cpp:4
dsp_chunk_list_impl m_chunks
void initialize(const file_info &info)
Implements file_info.
template<typename baseclass >
bool input_postprocessed< baseclass >::decode_run ( audio_chunk p_chunk,
abort_callback p_abort 
)
inline

Definition at line 109 of file decode_postprocessor.h.

109  {
110  if (m_postproc.is_active()) {
111  for(;;) {
112  p_abort.check();
113  if (m_chunks.get_count() > 0) {
114  audio_chunk * c = m_chunks.get_item(0);
115  if (m_toSkip > 0) {
116  if (!c->process_skip(m_toSkip)) {
118  continue;
119  }
120  }
121  p_chunk = *c;
123  return true;
124  }
125  if (m_haveEOF) return false;
126  if (!baseclass::decode_run(*m_chunks.insert_item(0), p_abort)) {
127  m_haveEOF = true;
129  }
130  m_postproc.run(m_chunks, m_haveEOF, p_abort);
131  }
132  } else {
133  return baseclass::decode_run(p_chunk, p_abort);
134  }
135  }
decode_postprocessor m_postproc
Interface to container of a chunk of audio data. See audio_chunk_impl for an implementation.
Definition: audio_chunk.h:5
bool process_skip(double &skipDuration)
void run(dsp_chunk_list &p_chunk_list, bool p_eof, abort_callback &p_abort)
dsp_chunk_list_impl m_chunks
t_size get_count() const
Definition: dsp.cpp:4
audio_chunk * get_item(t_size n) const
Definition: dsp.cpp:6
audio_chunk * insert_item(t_size idx, t_size hint_size=0)
Definition: dsp.cpp:23
void remove_by_idx(t_size idx)
Definition: dsp.cpp:8
template<typename baseclass >
bool input_postprocessed< baseclass >::decode_run_raw ( audio_chunk p_chunk,
mem_block_container p_raw,
abort_callback p_abort 
)
inline

Definition at line 136 of file decode_postprocessor.h.

136  {
137  if (m_postproc.is_active()) {
138  throw pfc::exception_not_implemented();
139  } else {
140  return baseclass::decode_run_raw(p_chunk, p_raw, p_abort);
141  }
142  }
decode_postprocessor m_postproc
template<typename baseclass >
void input_postprocessed< baseclass >::decode_seek ( double  p_seconds,
abort_callback p_abort 
)
inline

Definition at line 148 of file decode_postprocessor.h.

148  {
150  m_haveEOF = false;
151  m_postproc.flush();
152  double target = pfc::max_t<double>(0, p_seconds - m_postproc.get_buffer_ahead());
153  m_toSkip = p_seconds - target;
154  baseclass::decode_seek(target, p_abort);
155  }
void remove_all()
Definition: dsp.h:12
decode_postprocessor m_postproc
dsp_chunk_list_impl m_chunks

Field Documentation

template<typename baseclass >
dsp_chunk_list_impl input_postprocessed< baseclass >::m_chunks
private

Definition at line 157 of file decode_postprocessor.h.

template<typename baseclass >
bool input_postprocessed< baseclass >::m_haveEOF
private

Definition at line 158 of file decode_postprocessor.h.

template<typename baseclass >
decode_postprocessor input_postprocessed< baseclass >::m_postproc
private

Definition at line 160 of file decode_postprocessor.h.

template<typename baseclass >
double input_postprocessed< baseclass >::m_toSkip
private

Definition at line 159 of file decode_postprocessor.h.


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