Example #1
0
bool VideoDecoder::seekToFrame(uint frame) {
	if (!isSeekable())
		return false;

	VideoTrack *track = 0;

	for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++) {
		if ((*it)->getTrackType() == Track::kTrackTypeVideo) {
			// We only allow seeking by frame when one video track
			// is present
			if (track)
				return false;

			track = (VideoTrack *)*it;
		}
	}

	// If we didn't find a video track, we can't seek by frame (of course)
	if (!track)
		return false;

	Audio::Timestamp time = track->getFrameTime(frame);

	if (time < 0)
		return false;

	return seek(time);
}
Example #2
0
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);
}