AudioDecoder * AudioDecoder::CreateDecoderForInputSourceRegion(InputSource *inputSource, SInt64 startingFrame, CFErrorRef *error)
{
	if(nullptr == inputSource)
		return nullptr;

	if(!inputSource->SupportsSeeking())
		return nullptr;

	AudioDecoder *decoder = CreateDecoderForInputSource(inputSource, error);

	if(nullptr == decoder)
		return nullptr;

	if(!decoder->SupportsSeeking()) {
		delete decoder, decoder = nullptr;
		return nullptr;
	}

	AudioDecoder *regionDecoder = CreateDecoderForDecoderRegion(decoder, startingFrame, error);

	if(nullptr == regionDecoder) {
		delete decoder, decoder = nullptr;
		return nullptr;
	}

	return regionDecoder;
}
AudioDecoder * AudioDecoder::CreateDecoderForInputSourceRegion(InputSource *inputSource, SInt64 startingFrame, UInt32 frameCount, UInt32 repeatCount, CFErrorRef *error)
{
	if(NULL == inputSource)
		return NULL;

	if(!inputSource->SupportsSeeking())
		return NULL;

	AudioDecoder *decoder = CreateDecoderForInputSource(inputSource, error);

	if(NULL == decoder)
		return NULL;

	if(!decoder->SupportsSeeking()) {
		delete decoder, decoder = NULL;
		return NULL;
	}

	AudioDecoder *regionDecoder = CreateDecoderForDecoderRegion(decoder, startingFrame, frameCount, repeatCount, error);

	if(NULL == regionDecoder) {
		delete decoder, decoder = NULL;
		return NULL;
	}

	return regionDecoder;
}
Example #3
0
SFB::Audio::Decoder::unique_ptr SFB::Audio::Decoder::CreateDecoderForInputSourceRegion(InputSource::unique_ptr inputSource, SInt64 startingFrame, UInt32 frameCount, UInt32 repeatCount, CFErrorRef *error)
{
	if(!inputSource)
		return nullptr;

	return CreateDecoderForDecoderRegion(CreateDecoderForInputSource(std::move(inputSource), error), startingFrame, frameCount, repeatCount, error);
}
AudioDecoder * AudioDecoder::CreateDecoderForURL(CFURLRef url, CFStringRef mimeType, CFErrorRef *error)
{
	if(NULL == url)
		return NULL;

	// Create the input source which will feed the decoder
	InputSource *inputSource = InputSource::CreateInputSourceForURL(url, 0, error);
	
	if(NULL == inputSource)
		return NULL;

	AudioDecoder *decoder = CreateDecoderForInputSource(inputSource, mimeType, error);
	
	if(NULL == decoder)
		delete inputSource, inputSource = NULL;
	
	return decoder;
}
// If this returns NULL, the caller is responsible for deleting inputSource
// If this returns an AudioDecoder instance, the instance takes ownership of inputSource
AudioDecoder * AudioDecoder::CreateDecoderForInputSource(InputSource *inputSource, CFErrorRef *error)
{
	return CreateDecoderForInputSource(inputSource, NULL, error);
}
Example #6
0
SFB::Audio::Decoder::unique_ptr SFB::Audio::Decoder::CreateDecoderForInputSource(InputSource::unique_ptr inputSource, CFErrorRef *error)
{
	return CreateDecoderForInputSource(std::move(inputSource), nullptr, error);
}
Example #7
0
SFB::Audio::Decoder::unique_ptr SFB::Audio::Decoder::CreateDecoderForURL(CFURLRef url, CFStringRef mimeType, CFErrorRef *error)
{
	return CreateDecoderForInputSource(InputSource::CreateInputSourceForURL(url, 0, error), mimeType, error);
}