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_CUE_POINT_PARSER_H_
9 #define SRC_CUE_POINT_PARSER_H_
10 
11 #include "src/cue_track_positions_parser.h"
12 #include "src/int_parser.h"
13 #include "src/master_value_parser.h"
14 #include "webm/dom_types.h"
15 #include "webm/id.h"
16 
17 namespace webm {
18 
19 // Spec reference:
20 // http://matroska.org/technical/specs/index.html#CuePoint
21 // http://www.webmproject.org/docs/container/#CuePoint
22 class CuePointParser : public MasterValueParser<CuePoint> {
23  public:
CuePointParser()24   CuePointParser()
25       : MasterValueParser<CuePoint>(
26             MakeChild<UnsignedIntParser>(Id::kCueTime, &CuePoint::time),
27             MakeChild<CueTrackPositionsParser>(
28                 Id::kCueTrackPositions, &CuePoint::cue_track_positions)) {}
29 
30  protected:
OnParseCompleted(Callback * callback)31   Status OnParseCompleted(Callback* callback) override {
32     return callback->OnCuePoint(metadata(Id::kCuePoint), value());
33   }
34 };
35 
36 }  // namespace webm
37 
38 #endif  // SRC_CUE_POINT_PARSER_H_
39