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