Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Unified Diff: media/base/decoder_buffer.h

Issue 23702007: Render inband text tracks in the media pipeline (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: incorporate aaron's comments (10/22) Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/base/decoder_buffer.h
diff --git a/media/base/decoder_buffer.h b/media/base/decoder_buffer.h
index 393e586d06bfdc2f42b178db6f72250a4b960801..2b38f56d84bbd8f1a0caf196c4de535c35d29e7e 100644
--- a/media/base/decoder_buffer.h
+++ b/media/base/decoder_buffer.h
@@ -6,6 +6,7 @@
#define MEDIA_BASE_DECODER_BUFFER_H_
#include <string>
+#include <vector>
#include "base/logging.h"
#include "base/memory/aligned_memory.h"
@@ -133,6 +134,12 @@ class MEDIA_EXPORT DecoderBuffer
// Returns a human-readable string describing |*this|.
std::string AsHumanReadableString();
+ // Utility function to create side data item for decoder buffer.
+ template<typename T>
+ static void MakeSideData(T id_begin, T id_end,
acolwell GONE FROM CHROMIUM 2013/10/24 18:57:51 This doesn't belong here. This class is format ind
Matthew Heaney (Chromium) 2013/10/25 03:05:38 Done.
+ T settings_begin, T settings_end,
+ std::vector<uint8>* side_data);
+
protected:
friend class base::RefCountedThreadSafe<DecoderBuffer>;
@@ -162,4 +169,20 @@ class MEDIA_EXPORT DecoderBuffer
} // namespace media
+template<typename T>
+inline void media::DecoderBuffer::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_BASE_DECODER_BUFFER_H_

Powered by Google App Engine
This is Rietveld 408576698