Reuse existing nodes if the media formats do not change. This fixes the

regression that audio playback of multiple files was not "seamless" anymore.
Even video playback should be seamless, the remaining small glitch could be
a problem with buffer timeout if the switch takes too long.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25735 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2008-05-31 11:06:04 +00:00
parent 4aa9ff58c6
commit 4fd26cd542
2 changed files with 13 additions and 3 deletions
+7 -2
View File
@@ -258,8 +258,13 @@ Controller::SetTo(const entry_ref &ref)
preferredVideoFormat = format.u.raw_video.display.format;
}
Init(BRect(0, 0, width - 1, height - 1), fVideoFrameRate,
preferredVideoFormat, LOOPING_ALL, false);
if (InitCheck() != B_OK) {
Init(BRect(0, 0, width - 1, height - 1), fVideoFrameRate,
preferredVideoFormat, LOOPING_ALL, false);
} else {
FormatChanged(BRect(0, 0, width - 1, height - 1), fVideoFrameRate,
preferredVideoFormat);
}
SetCurrentFrame(0);
@@ -119,11 +119,16 @@ status_t
NodeManager::FormatChanged(BRect videoBounds, float videoFrameRate,
color_space preferredVideoFormat, bool force)
{
TRACE("NodeManager::FormatChanged()\n");
if (!force && videoBounds == VideoBounds()
&& videoFrameRate == FramesPerSecond())
&& videoFrameRate == FramesPerSecond()) {
TRACE(" -> reusing existing nodes\n");
return B_OK;
}
if (videoFrameRate != FramesPerSecond()) {
TRACE(" -> need to Init()\n");
PlaybackManager::Init(videoFrameRate, LoopMode(), IsLoopingEnabled(),
Speed(), MODE_PLAYING_PAUSED_FORWARD, CurrentFrame());
}