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

Side by Side Diff: ppapi/examples/audio_encode/audio_encode.html

Issue 1640703002: ppapi: examples: audio_encode: fix opus comments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <!-- 3 <!--
4 Copyright 2015 The Chromium Authors. All rights reserved. 4 Copyright 2015 The Chromium Authors. All rights reserved.
5 Use of this source code is governed by a BSD-style license that can be 5 Use of this source code is governed by a BSD-style license that can be
6 found in the LICENSE file. 6 found in the LICENSE file.
7 --> 7 -->
8 <head> 8 <head>
9 <title>Audio Encoder Example</title> 9 <title>Audio Encoder Example</title>
10 <script type="text/javascript"> 10 <script type="text/javascript">
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // input sample rate. 224 // input sample rate.
225 i += writeValue(buffer, 4, i, format.sample_rate); 225 i += writeValue(buffer, 4, i, format.sample_rate);
226 // output gain. 226 // output gain.
227 i += writeValue(buffer, 2, i, 0); 227 i += writeValue(buffer, 2, i, 0);
228 // channel mapping family. 228 // channel mapping family.
229 i += writeValue(buffer, 1, i, 0); 229 i += writeValue(buffer, 1, i, 0);
230 230
231 this._writePage(this._Start, buffer.byteLength); 231 this._writePage(this._Start, buffer.byteLength);
232 this.buffer.appendData(buffer); 232 this.buffer.appendData(buffer);
233 this._writePageChecksum(start); 233 this._writePageChecksum(start);
234 this._writeCommentHeader('OpusTags'); 234 this._writeCommentHeader();
235 }, 235 },
236 _writeCommentHeader: function(name) { 236 _writeCommentHeader: function(name) {
237 var start = this.buffer.getSize(); 237 var start = this.buffer.getSize();
238 var buffer = new Uint8Array(8 + 4 + 8 + 4 + 4 + 13), i = 0; 238 var buffer = new Uint8Array(8 + 4 + 8 + 4 + 4 + 13), i = 0;
239 // Opus comment header. 239 // Opus comment header.
240 i += writeString(buffer, i, name); 240 i += writeString(buffer, i, 'OpusTags');
241 // Vendor string. 241 // Vendor string.
242 i += this._writeLengthString(buffer, i, 'Chromium'); 242 i += this._writeLengthString(buffer, i, 'Chromium');
243 // User comment list length 243 // User comment list length
244 i += writeValue(buffer, 4, i, 1); 244 i += writeValue(buffer, 4, i, 1);
245 // User comment 0 length. 245 // User comment 0 length.
246 i += this._writeLengthString(buffer, i, 'TITLE=example'); 246 i += this._writeLengthString(buffer, i, 'TITLE=example');
247 247
248 this._writePage(this._Continue, buffer.byteLength); 248 this._writePage(0, buffer.byteLength);
249 this.buffer.appendData(buffer); 249 this.buffer.appendData(buffer);
250 this._writePageChecksum(start); 250 this._writePageChecksum(start);
251 }, 251 },
252 _writeLengthString: function(buffer, offset, str) { 252 _writeLengthString: function(buffer, offset, str) {
253 return (writeValue(buffer, offset, 4, str.length) + 253 return (writeValue(buffer, 4, offset, str.length) +
254 writeString(buffer, offset, str)); 254 writeString(buffer, offset + 4, str));
255 }, 255 },
256 writeData: function(data) { 256 writeData: function(data) {
257 this.position += this.format.sample_per_frame / this.format.channels; 257 this.position += this.format.sample_per_frame / this.format.channels;
258 var start = this.buffer.getSize(); 258 var start = this.buffer.getSize();
259 this._writePage(0, data.byteLength, this.position); 259 this._writePage(0, data.byteLength, this.position);
260 this.buffer.appendData(data); 260 this.buffer.appendData(data);
261 this._writePageChecksum(start); 261 this._writePageChecksum(start);
262 this.dataWritten = true; 262 this.dataWritten = true;
263 }, 263 },
264 end: function() { 264 end: function() {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 409
410 <select id="profileList"></select> 410 <select id="profileList"></select>
411 <input type="button" id="start" value="Start Recording"/> 411 <input type="button" id="start" value="Start Recording"/>
412 <input type="button" id="stop" value="Stop Recording"/> 412 <input type="button" id="stop" value="Stop Recording"/>
413 <div id="download-box"></div> 413 <div id="download-box"></div>
414 <div id="length"></div> 414 <div id="length"></div>
415 <br> 415 <br>
416 <embed id="plugin" type="application/x-ppapi-example-audio-encode"/> 416 <embed id="plugin" type="application/x-ppapi-example-audio-encode"/>
417 </body> 417 </body>
418 </html> 418 </html>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698