Index: media/base/media_tracks.h |
diff --git a/media/base/media_tracks.h b/media/base/media_tracks.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e1c9a320e655b5221d39710760f9afb867cb12ec |
--- /dev/null |
+++ b/media/base/media_tracks.h |
@@ -0,0 +1,60 @@ |
+// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MEDIA_BASE_MEDIA_TRACKS_H_ |
+#define MEDIA_BASE_MEDIA_TRACKS_H_ |
+ |
+#include <map> |
+#include <string> |
+#include <vector> |
+ |
+#include "base/callback.h" |
+#include "base/macros.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "media/base/media_export.h" |
+#include "media/base/media_track.h" |
+ |
+namespace media { |
+ |
+class AudioDecoderConfig; |
+class VideoDecoderConfig; |
+ |
+class MEDIA_EXPORT MediaTracks { |
+ public: |
+ MediaTracks(); |
+ virtual ~MediaTracks(); |
+ |
+ void AddAudioTrack(const AudioDecoderConfig& config, |
+ const std::string& id, |
+ const std::string& kind, |
+ const std::string& label, |
+ const std::string& language); |
+ void AddVideoTrack(const VideoDecoderConfig& config, |
+ const std::string& id, |
+ const std::string& kind, |
+ const std::string& label, |
+ const std::string& language); |
+ |
+ typedef std::vector<scoped_ptr<MediaTrack>> MediaTracksCollection; |
+ const MediaTracksCollection& tracks() const { return tracks_; } |
+ |
+ const AudioDecoderConfig& getAudioConfig(const std::string& id) const; |
+ const VideoDecoderConfig& getVideoConfig(const std::string& id) const; |
+ |
+ // TODO(servolk): These are temporary helpers useful until all code paths are |
+ // converted to properly handle multiple media tracks. |
+ const AudioDecoderConfig& getFirstAudioConfig() const; |
+ const VideoDecoderConfig& getFirstVideoConfig() const; |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(MediaTracks); |
+ |
+ MediaTracksCollection tracks_; |
+ std::map<std::string, AudioDecoderConfig> audio_configs_; |
+ std::map<std::string, VideoDecoderConfig> video_configs_; |
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_BASE_MEDIA_TRACKS_H_ |