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

Side by Side Diff: media/formats/mp2t/ts_packet.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_packet.h" 5 #include "media/formats/mp2t/ts_packet.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include <memory>
8
8 #include "media/base/bit_reader.h" 9 #include "media/base/bit_reader.h"
9 #include "media/formats/mp2t/mp2t_common.h" 10 #include "media/formats/mp2t/mp2t_common.h"
10 11
11 namespace media { 12 namespace media {
12 namespace mp2t { 13 namespace mp2t {
13 14
14 static const uint8_t kTsHeaderSyncword = 0x47; 15 static const uint8_t kTsHeaderSyncword = 0x47;
15 16
16 // static 17 // static
17 int TsPacket::Sync(const uint8_t* buf, int size) { 18 int TsPacket::Sync(const uint8_t* buf, int size) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 52 }
52 53
53 DCHECK_EQ(buf[0], kTsHeaderSyncword); 54 DCHECK_EQ(buf[0], kTsHeaderSyncword);
54 if (buf[0] != kTsHeaderSyncword) { 55 if (buf[0] != kTsHeaderSyncword) {
55 DVLOG(1) << "Not on a TS syncword:" 56 DVLOG(1) << "Not on a TS syncword:"
56 << " buf[0]=" 57 << " buf[0]="
57 << std::hex << static_cast<int>(buf[0]) << std::dec; 58 << std::hex << static_cast<int>(buf[0]) << std::dec;
58 return NULL; 59 return NULL;
59 } 60 }
60 61
61 scoped_ptr<TsPacket> ts_packet(new TsPacket()); 62 std::unique_ptr<TsPacket> ts_packet(new TsPacket());
62 bool status = ts_packet->ParseHeader(buf); 63 bool status = ts_packet->ParseHeader(buf);
63 if (!status) { 64 if (!status) {
64 DVLOG(1) << "Parsing header failed"; 65 DVLOG(1) << "Parsing header failed";
65 return NULL; 66 return NULL;
66 } 67 }
67 return ts_packet.release(); 68 return ts_packet.release();
68 } 69 }
69 70
70 TsPacket::TsPacket() { 71 TsPacket::TsPacket() {
71 } 72 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 << std::hex << stuffing_byte; 212 << std::hex << stuffing_byte;
212 } 213 }
213 214
214 DVLOG(LOG_LEVEL_TS) << "random_access_indicator=" << random_access_indicator_; 215 DVLOG(LOG_LEVEL_TS) << "random_access_indicator=" << random_access_indicator_;
215 return true; 216 return true;
216 } 217 }
217 218
218 } // namespace mp2t 219 } // namespace mp2t
219 } // namespace media 220 } // namespace media
220 221
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698