aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2012-07-22 12:17:54 -0400
committerMatthew Hoops2012-07-22 12:17:54 -0400
commit29541dc5f4dd492f7443463f709a5c6396dab9d8 (patch)
tree851a7e9c539385eb1839eddd128146153c9456b7
parent9bf17934d3fb6ab30c64dd87dfed1e5f154bca51 (diff)
downloadscummvm-rg350-29541dc5f4dd492f7443463f709a5c6396dab9d8.tar.gz
scummvm-rg350-29541dc5f4dd492f7443463f709a5c6396dab9d8.tar.bz2
scummvm-rg350-29541dc5f4dd492f7443463f709a5c6396dab9d8.zip
VIDEO: Hold tracks in an Array instead of a List
Decoders such as AVI will need to access them by index
-rw-r--r--video/video_decoder.cpp14
-rw-r--r--video/video_decoder.h18
2 files changed, 30 insertions, 2 deletions
diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp
index 5946a7d79c..b2fcdda04c 100644
--- a/video/video_decoder.cpp
+++ b/video/video_decoder.cpp
@@ -519,6 +519,20 @@ void AdvancedVideoDecoder::addTrack(Track *track) {
track->start();
}
+AdvancedVideoDecoder::Track *AdvancedVideoDecoder::getTrack(uint track) {
+ if (track > _tracks.size())
+ return 0;
+
+ return _tracks[track];
+}
+
+const AdvancedVideoDecoder::Track *AdvancedVideoDecoder::getTrack(uint track) const {
+ if (track > _tracks.size())
+ return 0;
+
+ return _tracks[track];
+}
+
AdvancedVideoDecoder::VideoTrack *AdvancedVideoDecoder::findNextVideoTrack() {
VideoTrack *bestTrack = 0;
uint32 bestTime = 0xFFFFFFFF;
diff --git a/video/video_decoder.h b/video/video_decoder.h
index 3d8b09f26e..2a5eebfc60 100644
--- a/video/video_decoder.h
+++ b/video/video_decoder.h
@@ -25,7 +25,7 @@
#include "audio/mixer.h"
#include "audio/timestamp.h" // TODO: Move this to common/ ?
-#include "common/list.h"
+#include "common/array.h"
#include "common/str.h"
namespace Audio {
@@ -657,9 +657,23 @@ protected:
*/
virtual bool useAudioSync() const { return true; }
+ /**
+ * Get the given track based on its index.
+ *
+ * @return A valid track pointer on success, 0 otherwise
+ */
+ Track *getTrack(uint track);
+
+ /**
+ * Get the given track based on its index
+ *
+ * @return A valid track pointer on success, 0 otherwise
+ */
+ const Track *getTrack(uint track) const;
+
private:
// Tracks owned by this AdvancedVideoDecoder
- typedef Common::List<Track *> TrackList;
+ typedef Common::Array<Track *> TrackList;
TrackList _tracks;
VideoTrack *findNextVideoTrack();
const VideoTrack *findNextVideoTrack() const;