filter/Internal: add method Reset()
This commit is contained in:
parent
7a3a793a12
commit
27c7891169
|
@ -52,6 +52,12 @@ public:
|
||||||
return out_audio_format;
|
return out_audio_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the filter's state, e.g. drop/flush buffers.
|
||||||
|
*/
|
||||||
|
virtual void Reset() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters a block of PCM data.
|
* Filters a block of PCM data.
|
||||||
*
|
*
|
||||||
|
@ -60,7 +66,7 @@ public:
|
||||||
* @param src the input buffer
|
* @param src the input buffer
|
||||||
* @return the destination buffer on success (will be
|
* @return the destination buffer on success (will be
|
||||||
* invalidated by deleting this object or the next FilterPCM()
|
* invalidated by deleting this object or the next FilterPCM()
|
||||||
* call)
|
* or Reset() call)
|
||||||
*/
|
*/
|
||||||
virtual ConstBuffer<void> FilterPCM(ConstBuffer<void> src) = 0;
|
virtual ConstBuffer<void> FilterPCM(ConstBuffer<void> src) = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -48,6 +48,13 @@ public:
|
||||||
:Filter(_filter->GetOutAudioFormat()),
|
:Filter(_filter->GetOutAudioFormat()),
|
||||||
filter(std::move(_filter)), convert(std::move(_convert)) {}
|
filter(std::move(_filter)), convert(std::move(_convert)) {}
|
||||||
|
|
||||||
|
void Reset() override {
|
||||||
|
filter->Reset();
|
||||||
|
|
||||||
|
if (convert)
|
||||||
|
convert->Reset();
|
||||||
|
}
|
||||||
|
|
||||||
ConstBuffer<void> FilterPCM(ConstBuffer<void> src) override;
|
ConstBuffer<void> FilterPCM(ConstBuffer<void> src) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual methods from class Filter */
|
/* virtual methods from class Filter */
|
||||||
|
void Reset() override;
|
||||||
ConstBuffer<void> FilterPCM(ConstBuffer<void> src) override;
|
ConstBuffer<void> FilterPCM(ConstBuffer<void> src) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -130,6 +131,13 @@ PreparedChainFilter::Open(AudioFormat &in_audio_format)
|
||||||
return chain.release();
|
return chain.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ChainFilter::Reset()
|
||||||
|
{
|
||||||
|
for (auto &child : children)
|
||||||
|
child.filter->Reset();
|
||||||
|
}
|
||||||
|
|
||||||
ConstBuffer<void>
|
ConstBuffer<void>
|
||||||
ChainFilter::FilterPCM(ConstBuffer<void> src)
|
ChainFilter::FilterPCM(ConstBuffer<void> src)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,6 +52,10 @@ public:
|
||||||
|
|
||||||
void Set(const AudioFormat &_out_audio_format);
|
void Set(const AudioFormat &_out_audio_format);
|
||||||
|
|
||||||
|
void Reset() override {
|
||||||
|
state.Reset();
|
||||||
|
}
|
||||||
|
|
||||||
ConstBuffer<void> FilterPCM(ConstBuffer<void> src) override;
|
ConstBuffer<void> FilterPCM(ConstBuffer<void> src) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue