Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(698)

Unified Diff: media/base/media_tracks.h

Issue 1716503002: Basic media tracks implementation for media stream parsers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/media_track.cc ('k') | media/base/media_tracks.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4e0fbb0fc1f88195ce14cc05d14a424924be4d5d
--- /dev/null
+++ b/media/base/media_tracks.h
@@ -0,0 +1,62 @@
+// Copyright 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/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:
+ typedef std::vector<scoped_ptr<MediaTrack>> MediaTracksCollection;
+
+ MediaTracks();
+ ~MediaTracks();
+
+ // Callers need to ensure that track id is unique.
+ void AddAudioTrack(const AudioDecoderConfig& config,
+ const std::string& id,
+ const std::string& kind,
+ const std::string& label,
+ const std::string& language);
+ // Callers need to ensure that track id is unique.
+ void AddVideoTrack(const VideoDecoderConfig& config,
+ const std::string& id,
+ const std::string& kind,
+ const std::string& label,
+ const std::string& language);
+
+ 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:
+ MediaTracksCollection tracks_;
+ std::map<std::string, AudioDecoderConfig> audio_configs_;
+ std::map<std::string, VideoDecoderConfig> video_configs_;
+
+ DISALLOW_COPY_AND_ASSIGN(MediaTracks);
+};
+
+} // namespace media
+
+#endif // MEDIA_BASE_MEDIA_TRACKS_H_
« no previous file with comments | « media/base/media_track.cc ('k') | media/base/media_tracks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698