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

Unified Diff: media/webm/webm_cluster_parser.cc

Issue 23702007: Render inband text tracks in the media pipeline (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix compile errors 11/21 #6 Created 7 years, 1 month 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
« no previous file with comments | « media/mp4/mp4_stream_parser_unittest.cc ('k') | media/webm/webm_cluster_parser_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/webm/webm_cluster_parser.cc
diff --git a/media/webm/webm_cluster_parser.cc b/media/webm/webm_cluster_parser.cc
index 87cccae4da10683d8c11fdeac2aaec178719f222..df9e4ce244bb17d3f7bda4b39d16bbc71dd33e18 100644
--- a/media/webm/webm_cluster_parser.cc
+++ b/media/webm/webm_cluster_parser.cc
@@ -10,8 +10,10 @@
#include "base/sys_byteorder.h"
#include "media/base/buffers.h"
#include "media/base/decrypt_config.h"
+#include "media/filters/webvtt_util.h"
#include "media/webm/webm_constants.h"
#include "media/webm/webm_crypto_helpers.h"
+#include "media/webm/webm_webvtt_parser.h"
namespace media {
@@ -307,6 +309,7 @@ bool WebMClusterParser::OnBlock(bool is_simple_block, int track_num,
}
Track* track = NULL;
+ bool is_text = false;
std::string encryption_key_id;
if (track_num == audio_.track_num()) {
track = &audio_;
@@ -322,6 +325,7 @@ bool WebMClusterParser::OnBlock(bool is_simple_block, int track_num,
if (block_duration < 0) // not specified
return false;
track = text_track;
+ is_text = true;
} else {
MEDIA_LOG(log_cb_) << "Unexpected track number " << track_num;
return false;
@@ -339,9 +343,28 @@ bool WebMClusterParser::OnBlock(bool is_simple_block, int track_num,
bool is_keyframe =
is_simple_block ? (flags & 0x80) != 0 : track->IsKeyframe(data, size);
- scoped_refptr<StreamParserBuffer> buffer =
- StreamParserBuffer::CopyFrom(data, size, additional, additional_size,
- is_keyframe);
+ scoped_refptr<StreamParserBuffer> buffer;
+ if (!is_text) {
+ buffer = StreamParserBuffer::CopyFrom(data, size,
+ additional, additional_size,
+ is_keyframe);
+ } else {
+ std::string id, settings, content;
+ WebMWebVTTParser::Parse(data, size,
+ &id, &settings, &content);
+
+ std::vector<uint8> side_data;
+ MakeSideData(id.begin(), id.end(),
+ settings.begin(), settings.end(),
+ &side_data);
+
+ buffer = StreamParserBuffer::CopyFrom(
+ reinterpret_cast<const uint8*>(content.data()),
+ content.length(),
+ &side_data[0],
+ side_data.size(),
+ is_keyframe);
+ }
// Every encrypted Block has a signal byte and IV prepended to it. Current
// encrypted WebM request for comments specification is here
« no previous file with comments | « media/mp4/mp4_stream_parser_unittest.cc ('k') | media/webm/webm_cluster_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698