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

Side by Side Diff: media/base/text_track.h

Issue 23702007: Render inband text tracks in the media pipeline (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: incorporate aaron's comments (10/22) Created 7 years, 2 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 unified diff | Download patch
OLDNEW
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 class TextTrackConfig {
acolwell GONE FROM CHROMIUM 2013/10/24 18:57:51 nit: Please put this class in its own file like th
Matthew Heaney (Chromium) 2013/10/25 03:05:38 Done.
36 (TextKind kind, 37 public:
37 const std::string& label, 38 TextTrackConfig();
38 const std::string& language)> AddTextTrackCB; 39 TextTrackConfig(TextKind kind,
40 const std::string& label,
41 const std::string& language);
42
43 // Returns true if all fields in |config| match this config.
44 bool Matches(const TextTrackConfig& config) const;
45
46 TextKind kind() const;
47 const std::string& label() const;
48 const std::string& language() const;
49
50 private:
51 TextKind kind_;
52 std::string label_;
53 std::string language_;
54 };
55
56 typedef base::Callback<void
57 (scoped_ptr<TextTrack>)> AddTextTrackDoneCB;
58
59 typedef base::Callback<void
60 (const TextTrackConfig& config,
61 const AddTextTrackDoneCB& done_cb)> AddTextTrackCB;
62
63 typedef std::map<int, TextTrackConfig> TextTrackConfigMap;
39 64
40 } // namespace media 65 } // namespace media
41 66
42 #endif // MEDIA_BASE_TEXT_TRACK_H_ 67 #endif // MEDIA_BASE_TEXT_TRACK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698