OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_TEXT_TRACK_H_ | 5 #ifndef MEDIA_BASE_TEXT_TRACK_H_ |
6 #define MEDIA_BASE_TEXT_TRACK_H_ | 6 #define MEDIA_BASE_TEXT_TRACK_H_ |
7 | 7 |
8 #include <map> | |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/callback.h" | 11 #include "base/callback.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
13 | 14 |
14 namespace media { | 15 namespace media { |
15 | 16 |
16 // Specifies the varieties of text tracks. | 17 // Specifies the varieties of text tracks. |
17 enum TextKind { | 18 enum TextKind { |
18 kTextSubtitles, | 19 kTextSubtitles, |
19 kTextCaptions, | 20 kTextCaptions, |
20 kTextDescriptions, | 21 kTextDescriptions, |
21 kTextMetadata, | 22 kTextMetadata, |
22 kTextNone | 23 kTextNone |
23 }; | 24 }; |
24 | 25 |
25 class TextTrack { | 26 class TextTrack { |
26 public: | 27 public: |
27 virtual ~TextTrack() {} | 28 virtual ~TextTrack() {} |
28 virtual void addWebVTTCue(const base::TimeDelta& start, | 29 virtual void addWebVTTCue(const base::TimeDelta& start, |
29 const base::TimeDelta& end, | 30 const base::TimeDelta& end, |
30 const std::string& id, | 31 const std::string& id, |
31 const std::string& content, | 32 const std::string& content, |
32 const std::string& settings) = 0; | 33 const std::string& settings) = 0; |
33 }; | 34 }; |
34 | 35 |
35 typedef base::Callback<scoped_ptr<TextTrack> | 36 typedef base::Callback<void |
37 (scoped_ptr<TextTrack>)> AddTextTrackDoneCB; | |
38 | |
39 typedef base::Callback<void | |
36 (TextKind kind, | 40 (TextKind kind, |
acolwell GONE FROM CHROMIUM
2013/10/21 20:10:40
nit: Use const TextTrackConfig& here instead.
Matthew Heaney (Chromium)
2013/10/23 05:09:01
Done.
| |
37 const std::string& label, | 41 const std::string& label, |
38 const std::string& language)> AddTextTrackCB; | 42 const std::string& language, |
43 const AddTextTrackDoneCB& done_cb)> AddTextTrackCB; | |
44 | |
45 class TextTrackConfig { | |
46 public: | |
47 TextTrackConfig(); | |
48 TextTrackConfig(TextKind kind, | |
49 const std::string& label, | |
50 const std::string& language); | |
51 | |
52 // Returns true if all fields in |config| match this config. | |
53 bool Matches(const TextTrackConfig& config) const; | |
54 | |
acolwell GONE FROM CHROMIUM
2013/10/21 20:10:40
Add kind(), label(), language() accessors.
Matthew Heaney (Chromium)
2013/10/23 05:09:01
Done.
| |
55 private: | |
56 TextKind kind_; | |
57 std::string label_; | |
58 std::string language_; | |
59 }; | |
60 | |
61 typedef std::map<int, TextTrackConfig> TextTrackConfigMap; | |
39 | 62 |
40 } // namespace media | 63 } // namespace media |
41 | 64 |
42 #endif // MEDIA_BASE_TEXT_TRACK_H_ | 65 #endif // MEDIA_BASE_TEXT_TRACK_H_ |
OLD | NEW |