Shaka Packager SDK
Loading...
Searching...
No Matches
webvtt_util.h
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#ifndef PACKAGER_MEDIA_CODECS_WEBVTT_UTIL_H_
6#define PACKAGER_MEDIA_CODECS_WEBVTT_UTIL_H_
7
8#include <vector>
9
10namespace shaka {
11namespace media {
12
13// Utility function to create side data item for decoder buffer.
14template <typename T>
15void MakeSideData(T id_begin,
16 T id_end,
17 T settings_begin,
18 T settings_end,
19 std::vector<uint8_t>* side_data) {
20 // The DecoderBuffer only supports a single side data item. In the case of
21 // a WebVTT cue, we can have potentially two side data items. In order to
22 // avoid disrupting DecoderBuffer any more than we need to, we copy both
23 // side data items onto a single one, and terminate each with a NUL marker.
24 side_data->clear();
25 side_data->insert(side_data->end(), id_begin, id_end);
26 side_data->push_back(0);
27 side_data->insert(side_data->end(), settings_begin, settings_end);
28 side_data->push_back(0);
29}
30
31} // namespace media
32} // namespace shaka
33
34#endif // PACKAGER_MEDIA_CODECS_WEBVTT_UTIL_H_
All the methods that are virtual are virtual for mocking.