AudioFormat: add method WithMask(), shortcut for ApplyMask()
This commit is contained in:
parent
8cb160b1f8
commit
6c818bb37a
@ -159,6 +159,13 @@ struct AudioFormat {
|
|||||||
|
|
||||||
void ApplyMask(AudioFormat mask);
|
void ApplyMask(AudioFormat mask);
|
||||||
|
|
||||||
|
gcc_pure
|
||||||
|
AudioFormat WithMask(AudioFormat mask) const {
|
||||||
|
AudioFormat result = *this;
|
||||||
|
result.ApplyMask(mask);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the size of each (mono) sample in bytes.
|
* Returns the size of each (mono) sample in bytes.
|
||||||
*/
|
*/
|
||||||
|
@ -64,8 +64,7 @@ DecoderControl::SetReady(const AudioFormat audio_format,
|
|||||||
assert(audio_format.IsValid());
|
assert(audio_format.IsValid());
|
||||||
|
|
||||||
in_audio_format = audio_format;
|
in_audio_format = audio_format;
|
||||||
out_audio_format = audio_format;
|
out_audio_format = audio_format.WithMask(configured_audio_format);
|
||||||
out_audio_format.ApplyMask(configured_audio_format);
|
|
||||||
|
|
||||||
seekable = _seekable;
|
seekable = _seekable;
|
||||||
total_time = _duration;
|
total_time = _duration;
|
||||||
|
@ -159,8 +159,7 @@ AudioOutput::Open()
|
|||||||
|
|
||||||
assert(filter_audio_format.IsValid());
|
assert(filter_audio_format.IsValid());
|
||||||
|
|
||||||
out_audio_format = filter_audio_format;
|
out_audio_format = filter_audio_format.WithMask(config_audio_format);
|
||||||
out_audio_format.ApplyMask(config_audio_format);
|
|
||||||
|
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@ try {
|
|||||||
const auto in_audio_format = ParseAudioFormat(argv[1], false);
|
const auto in_audio_format = ParseAudioFormat(argv[1], false);
|
||||||
const auto out_audio_format_mask = ParseAudioFormat(argv[2], false);
|
const auto out_audio_format_mask = ParseAudioFormat(argv[2], false);
|
||||||
|
|
||||||
auto out_audio_format = in_audio_format;
|
const auto out_audio_format =
|
||||||
out_audio_format.ApplyMask(out_audio_format_mask);
|
in_audio_format.WithMask(out_audio_format_mask);
|
||||||
|
|
||||||
const size_t in_frame_size = in_audio_format.GetFrameSize();
|
const size_t in_frame_size = in_audio_format.GetFrameSize();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user