Index: media/base/text_buffer.h |
diff --git a/media/base/text_buffer.h b/media/base/text_buffer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b510d209ed16b5c08defc335a4a5ee4f2dc7bca6 |
--- /dev/null |
+++ b/media/base/text_buffer.h |
@@ -0,0 +1,57 @@ |
+// Copyright 2013 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_TEXT_BUFFER_H_ |
+#define MEDIA_BASE_TEXT_BUFFER_H_ |
+ |
+#include <string> |
+ |
+#include "base/memory/ref_counted.h" |
+#include "base/time/time.h" |
+#include "media/base/media_export.h" |
+ |
+namespace media { |
+ |
+// A text buffer to carry the components of a text track cue. |
+class MEDIA_EXPORT TextBuffer |
acolwell GONE FROM CHROMIUM
2013/09/12 00:15:15
nit: s/TextBuffer/TextCue
Matthew Heaney (Chromium)
2013/09/13 19:51:54
Done.
|
+ : public base::RefCountedThreadSafe<TextBuffer> { |
+ public: |
+ TextBuffer(const base::TimeDelta& timestamp, |
+ const base::TimeDelta& duration); |
+ |
+ // Access to constructor parameters. |
+ base::TimeDelta timestamp() const { return timestamp_; } |
+ base::TimeDelta duration() const { return duration_; } |
+ |
+ // To manipulate the cue identifier. |
+ const std::string& id() const { return id_; } |
+ void set_id(const uint8* id, int id_size); |
acolwell GONE FROM CHROMIUM
2013/09/12 00:15:15
nit: Any reason id, settings, and text can't be pa
Matthew Heaney (Chromium)
2013/09/13 19:51:54
Done.
|
+ |
+ // To manipulate the cue rendering settings. |
+ const std::string& settings() const { return settings_; } |
+ void set_settings(const uint8* settings, int settings_size); |
+ |
+ // To manipulate the payload (body text) of the cue. |
+ const std::string& text() const { return text_; } |
+ void set_text(const uint8* text, int text_size); |
+ |
+ private: |
+ friend class base::RefCountedThreadSafe<TextBuffer>; |
+ virtual ~TextBuffer(); |
+ |
+ // Utility function to set string member variable. |
+ static void set_string(const uint8* buf, int buflen, std::string* str); |
+ |
+ base::TimeDelta timestamp_; |
+ base::TimeDelta duration_; |
+ std::string id_; |
+ std::string settings_; |
+ std::string text_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(TextBuffer); |
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_BASE_TEXT_BUFFER_H_ |