Roll src/third_party/WebKit 787a07c:716df21 (svn 201034:201036)
[chromium-blink-merge.git] / media / filters / webvtt_util.h
blobb71b66f72052497dd5c0c6628a55670ef958a11c
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.
5 #ifndef MEDIA_FILTERS_WEBVTT_UTIL_H_
6 #define MEDIA_FILTERS_WEBVTT_UTIL_H_
8 #include <vector>
10 namespace media {
12 // Utility function to create side data item for decoder buffer.
13 template<typename T>
14 void MakeSideData(T id_begin, T id_end,
15 T settings_begin, T settings_end,
16 std::vector<uint8>* side_data) {
17 // 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
19 // 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.
21 side_data->clear();
22 side_data->insert(side_data->end(), id_begin, id_end);
23 side_data->push_back(0);
24 side_data->insert(side_data->end(), settings_begin, settings_end);
25 side_data->push_back(0);
28 } // namespace media
30 #endif // MEDIA_FILTERS_WEBVTT_UTIL_H_