SFB::Audio::ChannelLayout& SFB::Audio::ChannelLayout::operator=(const AudioChannelLayout *rhs)
{
	if(nullptr == rhs)
		mChannelLayout.reset();
	else
		mChannelLayout = unique_AudioChannelLayout_ptr(CopyChannelLayout(rhs), std::free);

	return *this;
}
SFB::Audio::ChannelLayout& SFB::Audio::ChannelLayout::operator=(const ChannelLayout& rhs)
{
	if(this != &rhs) {
		if(!rhs)
			mChannelLayout.reset();
		else
			mChannelLayout = unique_AudioChannelLayout_ptr(CopyChannelLayout(rhs.mChannelLayout.get()), std::free);
	}

	return *this;
}
AudioDecoder& AudioDecoder::operator=(const AudioDecoder& rhs)
{
	if(this == &rhs)
		return *this;

	if(mInputSource)
		delete mInputSource, mInputSource = NULL;
	
	if(mChannelLayout)
		free(mChannelLayout), mChannelLayout = NULL;

	if(rhs.mInputSource)
		mInputSource = rhs.mInputSource;

	mFormat				= rhs.mFormat;
	mSourceFormat		= rhs.mSourceFormat;
	mChannelLayout		= CopyChannelLayout(rhs.mChannelLayout);
	mIsOpen				= rhs.mIsOpen;

	memcpy(&mCallbacks, &rhs.mCallbacks, sizeof(rhs.mCallbacks));

	return *this;
}
SFB::Audio::ChannelLayout::ChannelLayout(const AudioChannelLayout *channelLayout)
	: mChannelLayout(CopyChannelLayout(channelLayout), std::free)
{}