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

Side by Side Diff: media/formats/mp2t/ts_section_pes.cc

Issue 1874413003: Convert media/formats to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/formats/mp2t/ts_section_pes.h" 5 #include "media/formats/mp2t/ts_section_pes.h"
6 6
7 #include <memory>
8
7 #include "base/logging.h" 9 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
9 #include "media/base/bit_reader.h" 11 #include "media/base/bit_reader.h"
10 #include "media/base/timestamp_constants.h" 12 #include "media/base/timestamp_constants.h"
11 #include "media/formats/mp2t/es_parser.h" 13 #include "media/formats/mp2t/es_parser.h"
12 #include "media/formats/mp2t/mp2t_common.h" 14 #include "media/formats/mp2t/mp2t_common.h"
13 #include "media/formats/mp2t/timestamp_unroller.h" 15 #include "media/formats/mp2t/timestamp_unroller.h"
14 16
15 static const int kPesStartCode = 0x000001; 17 static const int kPesStartCode = 0x000001;
16 18
(...skipping 11 matching lines...) Expand all
28 30
29 static int64_t ConvertTimestampSectionToTimestamp(int64_t timestamp_section) { 31 static int64_t ConvertTimestampSectionToTimestamp(int64_t timestamp_section) {
30 return (((timestamp_section >> 33) & 0x7) << 30) | 32 return (((timestamp_section >> 33) & 0x7) << 30) |
31 (((timestamp_section >> 17) & 0x7fff) << 15) | 33 (((timestamp_section >> 17) & 0x7fff) << 15) |
32 (((timestamp_section >> 1) & 0x7fff) << 0); 34 (((timestamp_section >> 1) & 0x7fff) << 0);
33 } 35 }
34 36
35 namespace media { 37 namespace media {
36 namespace mp2t { 38 namespace mp2t {
37 39
38 TsSectionPes::TsSectionPes(scoped_ptr<EsParser> es_parser, 40 TsSectionPes::TsSectionPes(std::unique_ptr<EsParser> es_parser,
39 TimestampUnroller* timestamp_unroller) 41 TimestampUnroller* timestamp_unroller)
40 : es_parser_(es_parser.release()), 42 : es_parser_(es_parser.release()),
41 wait_for_pusi_(true), 43 wait_for_pusi_(true),
42 timestamp_unroller_(timestamp_unroller) { 44 timestamp_unroller_(timestamp_unroller) {
43 DCHECK(es_parser_); 45 DCHECK(es_parser_);
44 DCHECK(timestamp_unroller_); 46 DCHECK(timestamp_unroller_);
45 } 47 }
46 48
47 TsSectionPes::~TsSectionPes() { 49 TsSectionPes::~TsSectionPes() {
48 } 50 }
49 51
50 bool TsSectionPes::Parse(bool payload_unit_start_indicator, 52 bool TsSectionPes::Parse(bool payload_unit_start_indicator,
51 const uint8_t* buf, 53 const uint8_t* buf,
52 int size) { 54 int size) {
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 return es_parser_->Parse(&raw_pes[es_offset], es_size, media_pts, media_dts); 252 return es_parser_->Parse(&raw_pes[es_offset], es_size, media_pts, media_dts);
251 } 253 }
252 254
253 void TsSectionPes::ResetPesState() { 255 void TsSectionPes::ResetPesState() {
254 pes_byte_queue_.Reset(); 256 pes_byte_queue_.Reset();
255 wait_for_pusi_ = true; 257 wait_for_pusi_ = true;
256 } 258 }
257 259
258 } // namespace mp2t 260 } // namespace mp2t
259 } // namespace media 261 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698