modified Playlist::valid() to allow overlapping playlist elements
This commit is contained in:
parent
3cc14cc556
commit
f60920dee7
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.30 $
|
Version : $Revision: 1.31 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -497,33 +497,35 @@ Playlist::removePlaylistElement(Ptr<UniqueId>::Ref playlistElementId)
|
||||||
bool
|
bool
|
||||||
Playlist::valid(void) throw ()
|
Playlist::valid(void) throw ()
|
||||||
{
|
{
|
||||||
Ptr<time_duration>::Ref runningTime(new time_duration(0,0,0,0));
|
time_duration runningTime(0,0,0,0);
|
||||||
Ptr<PlaylistElement>::Ref playlistElement;
|
|
||||||
Ptr<AudioClip>::Ref audioClip;
|
|
||||||
Ptr<Playlist>::Ref playlist;
|
|
||||||
|
|
||||||
PlaylistElementListType::const_iterator it = elementList->begin();
|
PlaylistElementListType::const_iterator it = elementList->begin();
|
||||||
while (it != elementList->end()) {
|
while (it != elementList->end()) {
|
||||||
playlistElement = it->second;
|
Ptr<PlaylistElement>::Ref playlistElement = it->second;
|
||||||
if (*runningTime != *(playlistElement->getRelativeOffset())) {
|
|
||||||
|
if (playlistElement->getType() == PlaylistElement::PlaylistType
|
||||||
|
&& !playlistElement->getPlaylist()->valid()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (playlistElement->getType() == PlaylistElement::AudioClipType) {
|
|
||||||
audioClip = playlistElement->getAudioClip();
|
time_duration relativeOffset = *playlistElement->getRelativeOffset();
|
||||||
*runningTime += *(audioClip->getPlaylength());
|
if (runningTime < relativeOffset) {
|
||||||
} else if (playlistElement->getType()
|
return false; // found a gap in the playlist
|
||||||
== PlaylistElement::PlaylistType) {
|
|
||||||
playlist = playlistElement->getPlaylist();
|
|
||||||
if (!playlist->valid()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
*runningTime += *(playlist->getPlaylength());
|
|
||||||
} else { // this should never happen
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
time_duration endTime =
|
||||||
|
relativeOffset
|
||||||
|
+ *playlistElement->getPlayable()->getPlaylength();
|
||||||
|
if (endTime > runningTime) {
|
||||||
|
runningTime = endTime;
|
||||||
|
}
|
||||||
|
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
setPlaylength(runningTime); // fix playlength, if everything else is OK
|
|
||||||
|
Ptr<time_duration>::Ref playlength(new time_duration());
|
||||||
|
*playlength = runningTime;
|
||||||
|
setPlaylength(playlength); // fix playlength, if everything else is OK
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue