OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 function MpegParser(parent) { | 5 function MpegParser(parent) { |
6 MetadataParser.apply(this, [parent]); | 6 MetadataParser.call(this, parent, 'mpeg', /\.(mp4|m4v|m4a|mpe?g4?)$/i); |
7 this.verbose = true; | |
8 } | 7 } |
9 | 8 |
10 MpegParser.parserType = 'mpeg'; | |
11 | |
12 MpegParser.prototype = {__proto__: MetadataParser.prototype}; | 9 MpegParser.prototype = {__proto__: MetadataParser.prototype}; |
13 | 10 |
14 MpegParser.prototype.urlFilter = /\.(mp4|m4v|m4a|mpe?g4?)$/i; | |
15 | |
16 MpegParser.HEADER_SIZE = 8; | 11 MpegParser.HEADER_SIZE = 8; |
17 | 12 |
18 MpegParser.readAtomSize = function(br, opt_end) { | 13 MpegParser.readAtomSize = function(br, opt_end) { |
19 var pos = br.tell(); | 14 var pos = br.tell(); |
20 | 15 |
21 if (opt_end) { | 16 if (opt_end) { |
22 // Assert that opt_end <= buffer end. | 17 // Assert that opt_end <= buffer end. |
23 // When supplied, opt_end is the end of the enclosing atom and is used to | 18 // When supplied, opt_end is the end of the enclosing atom and is used to |
24 // check the correct nesting. | 19 // check the correct nesting. |
25 br.validateRead(opt_end - pos); | 20 br.validateRead(opt_end - pos); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // The previous read did not return the next atom header, EOF reached. | 250 // The previous read did not return the next atom header, EOF reached. |
256 this.vlog("EOF @" + filePos); | 251 this.vlog("EOF @" + filePos); |
257 onSuccess(); | 252 onSuccess(); |
258 } | 253 } |
259 } catch(e) { | 254 } catch(e) { |
260 return onError(e.toString()); | 255 return onError(e.toString()); |
261 } | 256 } |
262 }; | 257 }; |
263 | 258 |
264 MetadataDispatcher.registerParserClass(MpegParser); | 259 MetadataDispatcher.registerParserClass(MpegParser); |
OLD | NEW |