| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_BASE_MEDIA_TRACKS_H_ | 5 #ifndef MEDIA_BASE_MEDIA_TRACKS_H_ |
| 6 #define MEDIA_BASE_MEDIA_TRACKS_H_ | 6 #define MEDIA_BASE_MEDIA_TRACKS_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "media/base/media_export.h" | 14 #include "media/base/media_export.h" |
| 15 #include "media/base/media_track.h" | 15 #include "media/base/media_track.h" |
| 16 | 16 |
| 17 namespace media { | 17 namespace media { |
| 18 | 18 |
| 19 class AudioDecoderConfig; | 19 class AudioDecoderConfig; |
| 20 class VideoDecoderConfig; | 20 class VideoDecoderConfig; |
| 21 | 21 |
| 22 class MEDIA_EXPORT MediaTracks { | 22 class MEDIA_EXPORT MediaTracks { |
| 23 public: | 23 public: |
| 24 using MediaTracksCollection = std::vector<std::unique_ptr<MediaTrack>>; | 24 using MediaTracksCollection = std::vector<std::unique_ptr<MediaTrack>>; |
| 25 | 25 |
| 26 MediaTracks(); | 26 MediaTracks(); |
| 27 ~MediaTracks(); | 27 ~MediaTracks(); |
| 28 | 28 |
| 29 // Callers need to ensure that track id is unique. | 29 // Adds a new audio track. The |bytestreamTrackId| must uniquely identify the |
| 30 void AddAudioTrack(const AudioDecoderConfig& config, | 30 // track within the bytestream. |
| 31 StreamParser::TrackId byteStreamTrackId, | 31 MediaTrack* AddAudioTrack(const AudioDecoderConfig& config, |
| 32 const std::string& kind, | 32 StreamParser::TrackId byteStreamTrackId, |
| 33 const std::string& label, | 33 const std::string& kind, |
| 34 const std::string& language); | 34 const std::string& label, |
| 35 // Callers need to ensure that track id is unique. | 35 const std::string& language); |
| 36 void AddVideoTrack(const VideoDecoderConfig& config, | 36 // Adds a new video track. The |bytestreamTrackId| must uniquely identify the |
| 37 StreamParser::TrackId byteStreamTrackId, | 37 // track within the bytestream. |
| 38 const std::string& kind, | 38 MediaTrack* AddVideoTrack(const VideoDecoderConfig& config, |
| 39 const std::string& label, | 39 StreamParser::TrackId byteStreamTrackId, |
| 40 const std::string& language); | 40 const std::string& kind, |
| 41 const std::string& label, |
| 42 const std::string& language); |
| 41 | 43 |
| 42 const MediaTracksCollection& tracks() const { return tracks_; } | 44 const MediaTracksCollection& tracks() const { return tracks_; } |
| 43 | 45 |
| 44 const AudioDecoderConfig& getAudioConfig( | 46 const AudioDecoderConfig& getAudioConfig( |
| 45 StreamParser::TrackId byteStreamTrackId) const; | 47 StreamParser::TrackId byteStreamTrackId) const; |
| 46 const VideoDecoderConfig& getVideoConfig( | 48 const VideoDecoderConfig& getVideoConfig( |
| 47 StreamParser::TrackId byteStreamTrackId) const; | 49 StreamParser::TrackId byteStreamTrackId) const; |
| 48 | 50 |
| 49 // TODO(servolk): These are temporary helpers useful until all code paths are | 51 // TODO(servolk): These are temporary helpers useful until all code paths are |
| 50 // converted to properly handle multiple media tracks. | 52 // converted to properly handle multiple media tracks. |
| 51 const AudioDecoderConfig& getFirstAudioConfig() const; | 53 const AudioDecoderConfig& getFirstAudioConfig() const; |
| 52 const VideoDecoderConfig& getFirstVideoConfig() const; | 54 const VideoDecoderConfig& getFirstVideoConfig() const; |
| 53 | 55 |
| 54 private: | 56 private: |
| 55 MediaTracksCollection tracks_; | 57 MediaTracksCollection tracks_; |
| 56 std::map<StreamParser::TrackId, AudioDecoderConfig> audio_configs_; | 58 std::map<StreamParser::TrackId, AudioDecoderConfig> audio_configs_; |
| 57 std::map<StreamParser::TrackId, VideoDecoderConfig> video_configs_; | 59 std::map<StreamParser::TrackId, VideoDecoderConfig> video_configs_; |
| 58 | 60 |
| 59 DISALLOW_COPY_AND_ASSIGN(MediaTracks); | 61 DISALLOW_COPY_AND_ASSIGN(MediaTracks); |
| 60 }; | 62 }; |
| 61 | 63 |
| 62 } // namespace media | 64 } // namespace media |
| 63 | 65 |
| 64 #endif // MEDIA_BASE_MEDIA_TRACKS_H_ | 66 #endif // MEDIA_BASE_MEDIA_TRACKS_H_ |
| OLD | NEW |