1 // Copyright (c) 2016 The WebM project authors. All Rights Reserved.
2 //
3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the LICENSE file in the root of the source
5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS.  All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree.
8 #ifndef SRC_INFO_PARSER_H_
9 #define SRC_INFO_PARSER_H_
10 
11 #include "src/byte_parser.h"
12 #include "src/date_parser.h"
13 #include "src/float_parser.h"
14 #include "src/int_parser.h"
15 #include "src/master_value_parser.h"
16 #include "webm/dom_types.h"
17 #include "webm/id.h"
18 
19 namespace webm {
20 
21 // Spec reference:
22 // http://matroska.org/technical/specs/index.html#Info
23 // http://www.webmproject.org/docs/container/#Info
24 class InfoParser : public MasterValueParser<Info> {
25  public:
InfoParser()26   InfoParser()
27       : MasterValueParser<Info>(
28             MakeChild<UnsignedIntParser>(Id::kTimecodeScale,
29                                          &Info::timecode_scale),
30             MakeChild<FloatParser>(Id::kDuration, &Info::duration),
31             MakeChild<DateParser>(Id::kDateUtc, &Info::date_utc),
32             MakeChild<StringParser>(Id::kTitle, &Info::title),
33             MakeChild<StringParser>(Id::kMuxingApp, &Info::muxing_app),
34             MakeChild<StringParser>(Id::kWritingApp, &Info::writing_app)) {}
35 
36  protected:
OnParseCompleted(Callback * callback)37   Status OnParseCompleted(Callback* callback) override {
38     return callback->OnInfo(metadata(Id::kInfo), value());
39   }
40 };
41 
42 }  // namespace webm
43 
44 #endif  // SRC_INFO_PARSER_H_
45