Changed the method of determining if a frame is completed or not.

This commit is contained in:
Jonathan Thomas
2012-07-06 02:34:18 -05:00
parent c7b9795c2a
commit 457df5b2ff
5 changed files with 75 additions and 117 deletions

View File

@@ -336,76 +336,6 @@ void Frame::AddAudio(int destChannel, int destStartSample, const float* source,
audio->addFrom(destChannel, destStartSample, source, numSamples, gainToApplyToSource);
}
// Set if the audio has been completed loaded into the frame
void Frame::SetAudioComplete(int channel)
{
// Add channel as completed
channels_complete[channel] = true;
}
// Set if the image has been completed loaded into the frame
void Frame::SetImageComplete()
{
image_complete = true;
}
// Gets whether the frame has completely loaded all it's audio data (for each channel)
bool Frame::IsAudioReady(bool has_audio)
{
if (has_audio)
{
if (number == 300)
cout << "IsAudioReady channels: " << channels_complete.size() << endl;
// Do all channels have audio loaded?
if (channels_complete.size() == channels)
return true;
else
// still waiting on some channel to be loaded
return false;
}
else
// No audio needed for this frame
return true;
}
// Gets whether the frame has completed loading it's image and audio data
bool Frame::IsReady(bool has_video, bool has_audio)
{
if (has_video && has_audio)
{
// Does the frame have both audio and image data?
if (image_complete && IsAudioReady(has_audio))
return true;
else
return false;
}
else if (has_video)
{
// Does the frame have image data?
if (image_complete)
return true;
else
return false;
}
else if (has_audio)
{
// Does the frame have audio data?
if (IsAudioReady(has_audio))
return true;
else
return false;
}
else
{
// Invalid
return false;
}
}
// Play audio samples for this frame
void Frame::Play()
{