Updating XTBs based on .GRDs from branch master
[chromium-blink-merge.git] / media / formats / webm / webm_info_parser.h
blob44ef6b207432b88ee898348051ab52d3093e2626
1 // Copyright 2014 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.
5 #ifndef MEDIA_FORMATS_WEBM_WEBM_INFO_PARSER_H_
6 #define MEDIA_FORMATS_WEBM_WEBM_INFO_PARSER_H_
8 #include "base/compiler_specific.h"
9 #include "base/time/time.h"
10 #include "media/base/media_export.h"
11 #include "media/formats/webm/webm_parser.h"
13 namespace media {
15 // Parser for WebM Info element.
16 class MEDIA_EXPORT WebMInfoParser : public WebMParserClient {
17 public:
18 WebMInfoParser();
19 ~WebMInfoParser() override;
21 // Parses a WebM Info element in |buf|.
23 // Returns -1 if the parse fails.
24 // Returns 0 if more data is needed.
25 // Returns the number of bytes parsed on success.
26 int Parse(const uint8* buf, int size);
28 int64 timecode_scale() const { return timecode_scale_; }
29 double duration() const { return duration_; }
30 base::Time date_utc() const { return date_utc_; }
32 private:
33 // WebMParserClient methods
34 WebMParserClient* OnListStart(int id) override;
35 bool OnListEnd(int id) override;
36 bool OnUInt(int id, int64 val) override;
37 bool OnFloat(int id, double val) override;
38 bool OnBinary(int id, const uint8* data, int size) override;
39 bool OnString(int id, const std::string& str) override;
41 int64 timecode_scale_;
42 double duration_;
43 base::Time date_utc_;
45 DISALLOW_COPY_AND_ASSIGN(WebMInfoParser);
48 } // namespace media
50 #endif // MEDIA_FORMATS_WEBM_WEBM_INFO_PARSER_H_