OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_FILTERS_WEBVTT_UTIL_H_ | 5 #ifndef MEDIA_FILTERS_WEBVTT_UTIL_H_ |
6 #define MEDIA_FILTERS_WEBVTT_UTIL_H_ | 6 #define MEDIA_FILTERS_WEBVTT_UTIL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 namespace media { | 10 namespace media { |
11 | 11 |
12 // Utility function to create side data item for decoder buffer. | 12 // Utility function to create side data item for decoder buffer. |
13 template<typename T> | 13 template <typename T> |
14 void MakeSideData(T id_begin, T id_end, | 14 void MakeSideData(T id_begin, |
15 T settings_begin, T settings_end, | 15 T id_end, |
16 std::vector<uint8>* side_data) { | 16 T settings_begin, |
| 17 T settings_end, |
| 18 std::vector<uint8_t>* side_data) { |
17 // The DecoderBuffer only supports a single side data item. In the case of | 19 // The DecoderBuffer only supports a single side data item. In the case of |
18 // a WebVTT cue, we can have potentially two side data items. In order to | 20 // a WebVTT cue, we can have potentially two side data items. In order to |
19 // avoid disrupting DecoderBuffer any more than we need to, we copy both | 21 // avoid disrupting DecoderBuffer any more than we need to, we copy both |
20 // side data items onto a single one, and terminate each with a NUL marker. | 22 // side data items onto a single one, and terminate each with a NUL marker. |
21 side_data->clear(); | 23 side_data->clear(); |
22 side_data->insert(side_data->end(), id_begin, id_end); | 24 side_data->insert(side_data->end(), id_begin, id_end); |
23 side_data->push_back(0); | 25 side_data->push_back(0); |
24 side_data->insert(side_data->end(), settings_begin, settings_end); | 26 side_data->insert(side_data->end(), settings_begin, settings_end); |
25 side_data->push_back(0); | 27 side_data->push_back(0); |
26 } | 28 } |
27 | 29 |
28 } // namespace media | 30 } // namespace media |
29 | 31 |
30 #endif // MEDIA_FILTERS_WEBVTT_UTIL_H_ | 32 #endif // MEDIA_FILTERS_WEBVTT_UTIL_H_ |
OLD | NEW |