blob: b5bb7026e1e7430866ded27f3717a7f78e6613b9 [file] [log] [blame]
// Copyright (c) 2016 The WebM project authors. All Rights Reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file in the root of the source
// tree. An additional intellectual property rights grant can be found
// in the file PATENTS. All contributing project authors may
// be found in the AUTHORS file in the root of the source tree.
#include <cstdint>
#include "src/master_parser.h"
#include "webm/callback.h"
#include "webm/reader.h"
#include "webm/status.h"
namespace webm {
// Parses Segment elements from a WebM byte stream. This class adheres to the
// ElementParser interface; see element_parser.h for further documentation on
// how it should be used.
// Spec reference:
class SegmentParser : public MasterParser {
Status Init(const ElementMetadata& metadata, std::uint64_t max_size) override;
void InitAfterSeek(const Ancestory& child_ancestory,
const ElementMetadata& child_metadata) override;
Status Feed(Callback* callback, Reader* reader,
std::uint64_t* num_bytes_read) override;
bool WasSkipped() const override;
// Set to true iff Callback::OnSegmentBegin has completed.
bool begin_done_;
// Set to true iff the base class has completed parsing.
bool parse_completed_;
// The action requested by Callback::OnSegmentBegin.
Action action_ = Action::kRead;
} // namespace webm