Skip to content

Commit

Permalink
create ALACEncoderX::isAvailableOutputChannelLayout()
Browse files Browse the repository at this point in the history
  • Loading branch information
nu774 committed May 5, 2017
1 parent 1c51729 commit a2727ce
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
16 changes: 16 additions & 0 deletions ALACEncoderX.h
Expand Up @@ -40,6 +40,22 @@ class ALACEncoderX: public IEncoder, public IEncoderStat {
uint64_t framesWritten() const { return m_stat.framesWritten(); }
double currentBitrate() const { return m_stat.currentBitrate(); }
double overallBitrate() const { return m_stat.overallBitrate(); }

static bool isAvailableOutputChannelLayout(uint32_t channel_layout_tag)
{
switch (channel_layout_tag) {
case kAudioChannelLayoutTag_Mono:
case kAudioChannelLayoutTag_Stereo:
case kAudioChannelLayoutTag_AAC_3_0:
case kAudioChannelLayoutTag_AAC_4_0:
case kAudioChannelLayoutTag_AAC_5_0:
case kAudioChannelLayoutTag_AAC_5_1:
case kAudioChannelLayoutTag_AAC_6_1:
case kAudioChannelLayoutTag_AAC_7_1:
return true;
}
return false;
}
};

#endif
13 changes: 1 addition & 12 deletions main.cpp
Expand Up @@ -529,19 +529,8 @@ void build_filter_chain_sub(std::shared_ptr<ISeekableSource> src,
}
#endif
#ifdef REFALAC
switch (*channel_layout) {
case kAudioChannelLayoutTag_Mono:
case kAudioChannelLayoutTag_Stereo:
case kAudioChannelLayoutTag_AAC_3_0:
case kAudioChannelLayoutTag_AAC_4_0:
case kAudioChannelLayoutTag_AAC_5_0:
case kAudioChannelLayoutTag_AAC_5_1:
case kAudioChannelLayoutTag_AAC_6_1:
case kAudioChannelLayoutTag_AAC_7_1:
break;
default:
if (!ALACEncoderX::isAvailableOutputChannelLayout(*channel_layout))
throw std::runtime_error("Not supported channel layout for ALAC");
}
#endif
}
if (opts.lowpass > 0) {
Expand Down

0 comments on commit a2727ce

Please sign in to comment.