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

Side by Side Diff: media/webm/webm_info_parser.cc

Issue 7203002: Adding ChunkDemuxer implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed unit tests and nits Created 9 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « media/webm/webm_info_parser.h ('k') | media/webm/webm_parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "media/webm/webm_info_parser.h"
6
7 #include "base/logging.h"
8 #include "media/webm/webm_constants.h"
9
10 namespace media {
11
12 WebMInfoParser::WebMInfoParser()
13 : timecode_scale_(-1),
14 duration_(-1) {
15 }
16
17 WebMInfoParser::~WebMInfoParser() {}
18
19 int WebMInfoParser::Parse(const uint8* buf, int size) {
20 return WebMParseListElement(buf, size, kWebMIdInfo, 1, this);
21 }
22
23 bool WebMInfoParser::OnListStart(int id) { return true; }
24
25 bool WebMInfoParser::OnListEnd(int id) {
26 if (id == kWebMIdInfo && timecode_scale_ == -1) {
27 // Set timecode scale to default value if it isn't present in
28 // the Info element.
29 timecode_scale_ = kWebMDefaultTimecodeScale;
30 }
31 return true;
32 }
33
34 bool WebMInfoParser::OnUInt(int id, int64 val) {
35 if (id != kWebMIdTimecodeScale)
36 return true;
37
38 if (timecode_scale_ != -1) {
39 VLOG(1) << "Multiple values for id " << std::hex << id << " specified";
40 return false;
41 }
42
43 timecode_scale_ = val;
44 return true;
45 }
46
47 bool WebMInfoParser::OnFloat(int id, double val) {
48 if (id != kWebMIdDuration) {
49 VLOG(1) << "Unexpected float for id" << std::hex << id;
50 return false;
51 }
52
53 if (duration_ != -1) {
54 VLOG(1) << "Multiple values for duration.";
55 return false;
56 }
57
58 duration_ = val;
59 return true;
60 }
61
62 bool WebMInfoParser::OnBinary(int id, const uint8* data, int size) {
63 return true;
64 }
65
66 bool WebMInfoParser::OnString(int id, const std::string& str) {
67 return true;
68 }
69
70 bool WebMInfoParser::OnSimpleBlock(int track_num, int timecode, int flags,
71 const uint8* data, int size) {
72 return false;
73 }
74
75 } // namespace media
OLDNEW
« no previous file with comments | « media/webm/webm_info_parser.h ('k') | media/webm/webm_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698