You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Changed the method of determining if a frame is completed or not.
This commit is contained in:
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user