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

Side by Side Diff: media/webm/chromeos/webm_encoder.cc

Issue 109043002: Move more file_util functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « media/base/yuv_convert_unittest.cc ('k') | net/android/keystore_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/webm/chromeos/webm_encoder.h" 5 #include "media/webm/chromeos/webm_encoder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 while (!has_errors_ && (packet = vpx_codec_get_cx_data(&codec, &iter))) { 150 while (!has_errors_ && (packet = vpx_codec_get_cx_data(&codec, &iter))) {
151 if (packet->kind == VPX_CODEC_CX_FRAME_PKT) 151 if (packet->kind == VPX_CODEC_CX_FRAME_PKT)
152 WriteWebmBlock(packet); 152 WriteWebmBlock(packet);
153 } 153 }
154 } 154 }
155 155
156 return WriteWebmFooter(); 156 return WriteWebmFooter();
157 } 157 }
158 158
159 bool WebmEncoder::WriteWebmHeader() { 159 bool WebmEncoder::WriteWebmHeader() {
160 output_ = file_util::OpenFile(output_path_, "wb"); 160 output_ = base::OpenFile(output_path_, "wb");
161 if (!output_) 161 if (!output_)
162 return false; 162 return false;
163 163
164 // Global header. 164 // Global header.
165 StartSubElement(EBML); 165 StartSubElement(EBML);
166 { 166 {
167 Ebml_SerializeUnsigned(&ebml_writer_, EBMLVersion, 1); 167 Ebml_SerializeUnsigned(&ebml_writer_, EBMLVersion, 1);
168 Ebml_SerializeUnsigned(&ebml_writer_, EBMLReadVersion, 1); 168 Ebml_SerializeUnsigned(&ebml_writer_, EBMLReadVersion, 1);
169 Ebml_SerializeUnsigned(&ebml_writer_, EBMLMaxIDLength, 4); 169 Ebml_SerializeUnsigned(&ebml_writer_, EBMLMaxIDLength, 4);
170 Ebml_SerializeUnsigned(&ebml_writer_, EBMLMaxSizeLength, 8); 170 Ebml_SerializeUnsigned(&ebml_writer_, EBMLMaxSizeLength, 8);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 flags |= 0x08; 244 flags |= 0x08;
245 EbmlSerializeHelper(&flags, 1); 245 EbmlSerializeHelper(&flags, 1);
246 246
247 EbmlWrite(packet->data.frame.buf, packet->data.frame.sz); 247 EbmlWrite(packet->data.frame.buf, packet->data.frame.sz);
248 } 248 }
249 249
250 bool WebmEncoder::WriteWebmFooter() { 250 bool WebmEncoder::WriteWebmFooter() {
251 EndSubElement(); // Cluster 251 EndSubElement(); // Cluster
252 EndSubElement(); // Segment 252 EndSubElement(); // Segment
253 DCHECK(ebml_sub_elements_.empty()); 253 DCHECK(ebml_sub_elements_.empty());
254 return file_util::CloseFile(output_) && !has_errors_; 254 return base::CloseFile(output_) && !has_errors_;
255 } 255 }
256 256
257 void WebmEncoder::StartSubElement(unsigned long class_id) { 257 void WebmEncoder::StartSubElement(unsigned long class_id) {
258 Ebml_WriteID(&ebml_writer_, class_id); 258 Ebml_WriteID(&ebml_writer_, class_id);
259 ebml_sub_elements_.push(ftell(output_)); 259 ebml_sub_elements_.push(ftell(output_));
260 static const uint64_t kUnknownLen = 0x01FFFFFFFFFFFFFFLLU; 260 static const uint64_t kUnknownLen = 0x01FFFFFFFFFFFFFFLLU;
261 EbmlSerializeHelper(&kUnknownLen, 8); 261 EbmlSerializeHelper(&kUnknownLen, 8);
262 } 262 }
263 263
264 void WebmEncoder::EndSubElement() { 264 void WebmEncoder::EndSubElement() {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 case 8: 312 case 8:
313 return EbmlSerializeHelper(static_cast<const int64_t*>(buffer), len); 313 return EbmlSerializeHelper(static_cast<const int64_t*>(buffer), len);
314 default: 314 default:
315 NOTREACHED() << "Invalid EbmlSerialize length: " << len; 315 NOTREACHED() << "Invalid EbmlSerialize length: " << len;
316 } 316 }
317 } 317 }
318 318
319 } // namespace chromeos 319 } // namespace chromeos
320 320
321 } // namespace media 321 } // namespace media
OLDNEW
« no previous file with comments | « media/base/yuv_convert_unittest.cc ('k') | net/android/keystore_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698