OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "media/base/text_buffer.h" | |
6 | |
7 namespace media { | |
8 | |
9 TextBuffer::TextBuffer(const base::TimeDelta& timestamp, | |
10 const base::TimeDelta& duration) | |
11 : timestamp_(timestamp), | |
12 duration_(duration) { | |
13 } | |
14 | |
15 TextBuffer::~TextBuffer() {} | |
16 | |
17 void TextBuffer::set_string( | |
18 const uint8* buf, | |
19 int buflen, | |
20 std::string* str) { | |
21 if (buf == NULL || buflen <= 0) { | |
fgalligan1
2013/09/04 22:23:09
Add DCHECK(str)
Matthew Heaney (Chromium)
2013/09/13 19:51:54
OBE
| |
22 str->clear(); | |
23 } else { | |
24 str->assign(buf, buf + buflen); | |
25 } | |
26 } | |
27 | |
28 void TextBuffer::set_id(const uint8* id, int id_size) { | |
29 set_string(id, id_size, &id_); | |
30 } | |
31 | |
32 void TextBuffer::set_settings(const uint8* settings, int settings_size) { | |
33 set_string(settings, settings_size, &settings_); | |
34 } | |
35 | |
36 void TextBuffer::set_text(const uint8* text, int text_size) { | |
37 set_string(text, text_size, &text_); | |
38 } | |
39 | |
40 } // namespace media | |
OLD | NEW |