aboutsummaryrefslogtreecommitdiff
path: root/video/video_decoder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'video/video_decoder.cpp')
-rw-r--r--video/video_decoder.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp
index c6171c4450..dce96aae03 100644
--- a/video/video_decoder.cpp
+++ b/video/video_decoder.cpp
@@ -778,6 +778,31 @@ void VideoDecoder::setEndTime(const Audio::Timestamp &endTime) {
}
}
+void VideoDecoder::setEndFrame(uint frame) {
+ VideoTrack *track = 0;
+
+ for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++) {
+ if ((*it)->getTrackType() == Track::kTrackTypeVideo) {
+ // We only allow this when one video track is present
+ if (track)
+ return;
+
+ track = (VideoTrack *)*it;
+ }
+ }
+
+ // If we didn't find a video track, we can't set the final frame (of course)
+ if (!track)
+ return;
+
+ Audio::Timestamp time = track->getFrameTime(frame + 1);
+
+ if (time < 0)
+ return;
+
+ setEndTime(time);
+}
+
VideoDecoder::Track *VideoDecoder::getTrack(uint track) {
if (track > _internalTracks.size())
return 0;