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

Side by Side Diff: media/base/mac/videotoolbox_helpers.cc

Issue 2181163002: media: Change auto to not deduce raw pointers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | media/cast/sender/audio_encoder.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/base/mac/videotoolbox_helpers.h" 5 #include "media/base/mac/videotoolbox_helpers.h"
6 6
7 #include <array> 7 #include <array>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/big_endian.h" 10 #include "base/big_endian.h"
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 29
30 base::ScopedCFTypeRef<CFArrayRef> ArrayWithIntegers(const int* v, size_t size) { 30 base::ScopedCFTypeRef<CFArrayRef> ArrayWithIntegers(const int* v, size_t size) {
31 std::vector<CFNumberRef> numbers; 31 std::vector<CFNumberRef> numbers;
32 numbers.reserve(size); 32 numbers.reserve(size);
33 for (const int* end = v + size; v < end; ++v) 33 for (const int* end = v + size; v < end; ++v)
34 numbers.push_back(CFNumberCreate(nullptr, kCFNumberSInt32Type, v)); 34 numbers.push_back(CFNumberCreate(nullptr, kCFNumberSInt32Type, v));
35 base::ScopedCFTypeRef<CFArrayRef> array(CFArrayCreate( 35 base::ScopedCFTypeRef<CFArrayRef> array(CFArrayCreate(
36 kCFAllocatorDefault, reinterpret_cast<const void**>(&numbers[0]), 36 kCFAllocatorDefault, reinterpret_cast<const void**>(&numbers[0]),
37 numbers.size(), &kCFTypeArrayCallBacks)); 37 numbers.size(), &kCFTypeArrayCallBacks));
38 for (auto& number : numbers) { 38 for (auto* number : numbers) {
39 CFRelease(number); 39 CFRelease(number);
40 } 40 }
41 return array; 41 return array;
42 } 42 }
43 43
44 base::ScopedCFTypeRef<CFArrayRef> ArrayWithIntegerAndFloat(int int_val, 44 base::ScopedCFTypeRef<CFArrayRef> ArrayWithIntegerAndFloat(int int_val,
45 float float_val) { 45 float float_val) {
46 std::array<CFNumberRef, 2> numbers = { 46 std::array<CFNumberRef, 2> numbers = {
47 {CFNumberCreate(nullptr, kCFNumberSInt32Type, &int_val), 47 {CFNumberCreate(nullptr, kCFNumberSInt32Type, &int_val),
48 CFNumberCreate(nullptr, kCFNumberFloat32Type, &float_val)}}; 48 CFNumberCreate(nullptr, kCFNumberFloat32Type, &float_val)}};
49 base::ScopedCFTypeRef<CFArrayRef> array(CFArrayCreate( 49 base::ScopedCFTypeRef<CFArrayRef> array(CFArrayCreate(
50 kCFAllocatorDefault, reinterpret_cast<const void**>(numbers.data()), 50 kCFAllocatorDefault, reinterpret_cast<const void**>(numbers.data()),
51 numbers.size(), &kCFTypeArrayCallBacks)); 51 numbers.size(), &kCFTypeArrayCallBacks));
52 for (auto& number : numbers) 52 for (auto* number : numbers)
53 CFRelease(number); 53 CFRelease(number);
54 return array; 54 return array;
55 } 55 }
56 56
57 // Wrapper class for writing AnnexBBuffer output into. 57 // Wrapper class for writing AnnexBBuffer output into.
58 class AnnexBBuffer { 58 class AnnexBBuffer {
59 public: 59 public:
60 virtual bool Reserve(size_t size) = 0; 60 virtual bool Reserve(size_t size) = 0;
61 virtual void Append(const char* s, size_t n) = 0; 61 virtual void Append(const char* s, size_t n) = 0;
62 virtual size_t GetReservedSize() const = 0; 62 virtual size_t GetReservedSize() const = 0;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 bool CopySampleBufferToAnnexBBuffer(CoreMediaGlue::CMSampleBufferRef sbuf, 135 bool CopySampleBufferToAnnexBBuffer(CoreMediaGlue::CMSampleBufferRef sbuf,
136 AnnexBBuffer* annexb_buffer, 136 AnnexBBuffer* annexb_buffer,
137 bool keyframe) { 137 bool keyframe) {
138 // Perform two pass, one to figure out the total output size, and another to 138 // Perform two pass, one to figure out the total output size, and another to
139 // copy the data after having performed a single output allocation. Note that 139 // copy the data after having performed a single output allocation. Note that
140 // we'll allocate a bit more because we'll count 4 bytes instead of 3 for 140 // we'll allocate a bit more because we'll count 4 bytes instead of 3 for
141 // video NALs. 141 // video NALs.
142 OSStatus status; 142 OSStatus status;
143 143
144 // Get the sample buffer's block buffer and format description. 144 // Get the sample buffer's block buffer and format description.
145 auto bb = CoreMediaGlue::CMSampleBufferGetDataBuffer(sbuf); 145 auto* bb = CoreMediaGlue::CMSampleBufferGetDataBuffer(sbuf);
146 DCHECK(bb); 146 DCHECK(bb);
147 auto fdesc = CoreMediaGlue::CMSampleBufferGetFormatDescription(sbuf); 147 auto* fdesc = CoreMediaGlue::CMSampleBufferGetFormatDescription(sbuf);
148 DCHECK(fdesc); 148 DCHECK(fdesc);
149 149
150 size_t bb_size = CoreMediaGlue::CMBlockBufferGetDataLength(bb); 150 size_t bb_size = CoreMediaGlue::CMBlockBufferGetDataLength(bb);
151 size_t total_bytes = bb_size; 151 size_t total_bytes = bb_size;
152 152
153 size_t pset_count; 153 size_t pset_count;
154 int nal_size_field_bytes; 154 int nal_size_field_bytes;
155 status = CoreMediaGlue::CMVideoFormatDescriptionGetH264ParameterSetAtIndex( 155 status = CoreMediaGlue::CMVideoFormatDescriptionGetH264ParameterSetAtIndex(
156 fdesc, 0, nullptr, nullptr, &pset_count, &nal_size_field_bytes); 156 fdesc, 0, nullptr, nullptr, &pset_count, &nal_size_field_bytes);
157 if (status == 157 if (status ==
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 294
295 bool SessionPropertySetter::Set(CFStringRef key, CFArrayRef value) { 295 bool SessionPropertySetter::Set(CFStringRef key, CFArrayRef value) {
296 DCHECK(session_); 296 DCHECK(session_);
297 DCHECK(glue_); 297 DCHECK(glue_);
298 return glue_->VTSessionSetProperty(session_, key, value) == noErr; 298 return glue_->VTSessionSetProperty(session_, key, value) == noErr;
299 } 299 }
300 300
301 } // namespace video_toolbox 301 } // namespace video_toolbox
302 302
303 } // namespace media 303 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/cast/sender/audio_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698