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_PARSER_H_ 9 #define SRC_PARSER_H_ 10 11 #include "webm/callback.h" 12 #include "webm/reader.h" 13 #include "webm/status.h" 14 15 namespace webm { 16 17 class Parser { 18 public: 19 virtual ~Parser() = default; 20 21 // Feeds data into the parser, with the number of bytes read from the reader 22 // returned in num_bytes_read. Returns Status::kOkCompleted when parsing is 23 // complete, or an appropriate error code if the data is malformed and cannot 24 // be parsed. Otherwise, the status of Reader::Read is returned if only a 25 // partial parse could be done because the reader couldn't immediately provide 26 // all the needed data. reader and num_bytes_read must not be null. Do not 27 // call again once the parse is complete. 28 virtual Status Feed(Callback* callback, Reader* reader, 29 std::uint64_t* num_bytes_read) = 0; 30 }; 31 32 } // namespace webm 33 34 #endif // SRC_PARSER_H_ 35