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