pcm/Export: add GetInputBlockSize(), GetOutputBlockSize()
This commit is contained in:
parent
2093e53641
commit
34c6337887
@ -46,6 +46,20 @@ public:
|
||||
rest_buffer.Reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the size of one input block in bytes
|
||||
*/
|
||||
size_t GetInputBlockSize() const noexcept {
|
||||
return rest_buffer.GetInputBlockSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the size of one output block in bytes
|
||||
*/
|
||||
size_t GetOutputBlockSize() const noexcept {
|
||||
return 2 * GetInputBlockSize();
|
||||
}
|
||||
|
||||
ConstBuffer<uint32_t> Convert(ConstBuffer<uint8_t> src) noexcept;
|
||||
};
|
||||
|
||||
|
@ -44,6 +44,20 @@ public:
|
||||
rest_buffer.Reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the size of one input block in bytes
|
||||
*/
|
||||
size_t GetInputBlockSize() const noexcept {
|
||||
return rest_buffer.GetInputBlockSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the size of one output block in bytes
|
||||
*/
|
||||
size_t GetOutputBlockSize() const noexcept {
|
||||
return GetInputBlockSize();
|
||||
}
|
||||
|
||||
ConstBuffer<uint16_t> Convert(ConstBuffer<uint8_t> src) noexcept;
|
||||
};
|
||||
|
||||
|
@ -44,6 +44,20 @@ public:
|
||||
rest_buffer.Reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the size of one input block in bytes
|
||||
*/
|
||||
size_t GetInputBlockSize() const noexcept {
|
||||
return rest_buffer.GetInputBlockSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the size of one output block in bytes
|
||||
*/
|
||||
size_t GetOutputBlockSize() const noexcept {
|
||||
return GetInputBlockSize();
|
||||
}
|
||||
|
||||
ConstBuffer<uint32_t> Convert(ConstBuffer<uint8_t> src) noexcept;
|
||||
};
|
||||
|
||||
|
@ -144,6 +144,52 @@ PcmExport::GetOutputFrameSize() const noexcept
|
||||
return GetInputFrameSize();
|
||||
}
|
||||
|
||||
size_t
|
||||
PcmExport::GetInputBlockSize() const noexcept
|
||||
{
|
||||
#ifdef ENABLE_DSD
|
||||
switch (dsd_mode) {
|
||||
case DsdMode::NONE:
|
||||
break;
|
||||
|
||||
case DsdMode::U16:
|
||||
return dsd16_converter.GetInputBlockSize();
|
||||
|
||||
case DsdMode::U32:
|
||||
return dsd32_converter.GetInputBlockSize();
|
||||
break;
|
||||
|
||||
case DsdMode::DOP:
|
||||
return dop_converter.GetInputBlockSize();
|
||||
}
|
||||
#endif
|
||||
|
||||
return GetInputFrameSize();
|
||||
}
|
||||
|
||||
size_t
|
||||
PcmExport::GetOutputBlockSize() const noexcept
|
||||
{
|
||||
#ifdef ENABLE_DSD
|
||||
switch (dsd_mode) {
|
||||
case DsdMode::NONE:
|
||||
break;
|
||||
|
||||
case DsdMode::U16:
|
||||
return dsd16_converter.GetOutputBlockSize();
|
||||
|
||||
case DsdMode::U32:
|
||||
return dsd32_converter.GetOutputBlockSize();
|
||||
break;
|
||||
|
||||
case DsdMode::DOP:
|
||||
return dop_converter.GetOutputBlockSize();
|
||||
}
|
||||
#endif
|
||||
|
||||
return GetOutputFrameSize();
|
||||
}
|
||||
|
||||
unsigned
|
||||
PcmExport::Params::CalcOutputSampleRate(unsigned sample_rate) const noexcept
|
||||
{
|
||||
|
@ -198,6 +198,18 @@ public:
|
||||
gcc_pure
|
||||
size_t GetOutputFrameSize() const noexcept;
|
||||
|
||||
/**
|
||||
* @return the size of one input block in bytes
|
||||
*/
|
||||
gcc_pure
|
||||
size_t GetInputBlockSize() const noexcept;
|
||||
|
||||
/**
|
||||
* @return the size of one output block in bytes
|
||||
*/
|
||||
gcc_pure
|
||||
size_t GetOutputBlockSize() const noexcept;
|
||||
|
||||
/**
|
||||
* Export a PCM buffer.
|
||||
*
|
||||
|
@ -48,6 +48,13 @@ public:
|
||||
size = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the size of one input block in #T samples
|
||||
*/
|
||||
size_t GetInputBlockSize() const noexcept {
|
||||
return capacity;
|
||||
}
|
||||
|
||||
unsigned GetChannelCount() const noexcept {
|
||||
return capacity / n_frames;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user