Chromium Code Reviews| Index: media/filters/webvtt_util.h |
| diff --git a/media/filters/webvtt_util.h b/media/filters/webvtt_util.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..391f322d27bce14f3d8f8941ff518631cbc4cd75 |
| --- /dev/null |
| +++ b/media/filters/webvtt_util.h |
| @@ -0,0 +1,36 @@ |
| +// Copyright (c) 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_FILTERS_WEBVTT_UTIL_H_ |
| +#define MEDIA_FILTERS_WEBVTT_UTIL_H_ |
| + |
| +#include <vector> |
| + |
| +namespace media { |
| + |
| +// Utility function to create side data item for decoder buffer. |
| +template<typename T> |
| +static void MakeSideData(T id_begin, T id_end, |
| + T settings_begin, T settings_end, |
| + std::vector<uint8>* side_data); |
| + |
| +} // namespace media |
| + |
| +template<typename T> |
|
acolwell GONE FROM CHROMIUM
2013/10/29 21:14:19
nit: Do we really need a template here?
Matthew Heaney (Chromium)
2013/11/05 04:52:40
What is the alternative? In the ffmpeg demuxer ca
|
| +inline void media::MakeSideData( |
| + T id_begin, T id_end, |
| + T settings_begin, T settings_end, |
| + std::vector<uint8>* side_data) { |
| + // The DecoderBuffer only supports a single side data item. In the case of |
| + // a WebVTT cue, we can have potentially two side data items. In order to |
| + // avoid disrupting DecoderBuffer any more than we need to, we copy both |
| + // side data items onto a single one, and terminate each with a NUL marker. |
| + side_data->clear(); |
| + side_data->insert(side_data->end(), id_begin, id_end); |
| + side_data->push_back(0); |
| + side_data->insert(side_data->end(), settings_begin, settings_end); |
| + side_data->push_back(0); |
| +} |
| + |
| +#endif // MEDIA_FILTERS_WEBVTT_UTIL_H_ |