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

Side by Side Diff: media/mp3/mp3_stream_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 unified diff | Download patch
« no previous file with comments | « media/mp3/mp3_stream_parser.h ('k') | media/mp3/mp3_stream_parser_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/mp3/mp3_stream_parser.h" 5 #include "media/mp3/mp3_stream_parser.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "media/base/bit_reader.h" 10 #include "media/base/bit_reader.h"
11 #include "media/base/buffers.h" 11 #include "media/base/buffers.h"
12 #include "media/base/stream_parser_buffer.h" 12 #include "media/base/stream_parser_buffer.h"
13 #include "media/base/text_track_config.h"
13 #include "media/base/video_decoder_config.h" 14 #include "media/base/video_decoder_config.h"
14 #include "net/http/http_util.h" 15 #include "net/http/http_util.h"
15 16
16 namespace media { 17 namespace media {
17 18
18 static const uint32 kMP3StartCodeMask = 0xffe00000; 19 static const uint32 kMP3StartCodeMask = 0xffe00000;
19 static const uint32 kICYStartCode = 0x49435920; // 'ICY ' 20 static const uint32 kICYStartCode = 0x49435920; // 'ICY '
20 21
21 // Arbitrary upper bound on the size of an IceCast header before it 22 // Arbitrary upper bound on the size of an IceCast header before it
22 // triggers an error. 23 // triggers an error.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 in_media_segment_(false) { 113 in_media_segment_(false) {
113 } 114 }
114 115
115 MP3StreamParser::~MP3StreamParser() {} 116 MP3StreamParser::~MP3StreamParser() {}
116 117
117 void MP3StreamParser::Init(const InitCB& init_cb, 118 void MP3StreamParser::Init(const InitCB& init_cb,
118 const NewConfigCB& config_cb, 119 const NewConfigCB& config_cb,
119 const NewBuffersCB& new_buffers_cb, 120 const NewBuffersCB& new_buffers_cb,
120 const NewTextBuffersCB& text_cb, 121 const NewTextBuffersCB& text_cb,
121 const NeedKeyCB& need_key_cb, 122 const NeedKeyCB& need_key_cb,
122 const AddTextTrackCB& add_text_track_cb,
123 const NewMediaSegmentCB& new_segment_cb, 123 const NewMediaSegmentCB& new_segment_cb,
124 const base::Closure& end_of_segment_cb, 124 const base::Closure& end_of_segment_cb,
125 const LogCB& log_cb) { 125 const LogCB& log_cb) {
126 DVLOG(1) << __FUNCTION__; 126 DVLOG(1) << __FUNCTION__;
127 DCHECK_EQ(state_, UNINITIALIZED); 127 DCHECK_EQ(state_, UNINITIALIZED);
128 init_cb_ = init_cb; 128 init_cb_ = init_cb;
129 config_cb_ = config_cb; 129 config_cb_ = config_cb;
130 new_buffers_cb_ = new_buffers_cb; 130 new_buffers_cb_ = new_buffers_cb;
131 new_segment_cb_ = new_segment_cb; 131 new_segment_cb_ = new_segment_cb;
132 end_of_segment_cb_ = end_of_segment_cb; 132 end_of_segment_cb_ = end_of_segment_cb;
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 base::TimeDelta(), base::TimeDelta()); 403 base::TimeDelta(), base::TimeDelta());
404 404
405 base::TimeDelta base_timestamp; 405 base::TimeDelta base_timestamp;
406 if (timestamp_helper_) 406 if (timestamp_helper_)
407 base_timestamp = timestamp_helper_->GetTimestamp(); 407 base_timestamp = timestamp_helper_->GetTimestamp();
408 408
409 timestamp_helper_.reset(new AudioTimestampHelper(sample_rate)); 409 timestamp_helper_.reset(new AudioTimestampHelper(sample_rate));
410 timestamp_helper_->SetBaseTimestamp(base_timestamp); 410 timestamp_helper_->SetBaseTimestamp(base_timestamp);
411 411
412 VideoDecoderConfig video_config; 412 VideoDecoderConfig video_config;
413 bool success = config_cb_.Run(config_, video_config); 413 bool success = config_cb_.Run(config_, video_config, TextTrackConfigMap());
414 414
415 if (!init_cb_.is_null()) 415 if (!init_cb_.is_null())
416 base::ResetAndReturn(&init_cb_).Run(success, kInfiniteDuration()); 416 base::ResetAndReturn(&init_cb_).Run(success, kInfiniteDuration());
417 417
418 if (!success) 418 if (!success)
419 return -1; 419 return -1;
420 } 420 }
421 421
422 scoped_refptr<StreamParserBuffer> buffer = 422 scoped_refptr<StreamParserBuffer> buffer =
423 StreamParserBuffer::CopyFrom(data, frame_size, true); 423 StreamParserBuffer::CopyFrom(data, frame_size, true);
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 588
589 if (end_of_segment) { 589 if (end_of_segment) {
590 in_media_segment_ = false; 590 in_media_segment_ = false;
591 end_of_segment_cb_.Run(); 591 end_of_segment_cb_.Run();
592 } 592 }
593 593
594 return true; 594 return true;
595 } 595 }
596 596
597 } // namespace media 597 } // namespace media
OLDNEW
« no previous file with comments | « media/mp3/mp3_stream_parser.h ('k') | media/mp3/mp3_stream_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698