// Copyright 2014 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef MEDIA_FORMATS_WEBM_WEBM_PARSER_H_ #define MEDIA_FORMATS_WEBM_WEBM_PARSER_H_ #include <stdint.h> #include <string> #include <vector> #include "base/memory/raw_ptr.h" #include "media/base/media_export.h" namespace media { // Interface for receiving WebM parser events. // // Each method is called when an element of the specified type is parsed. // The ID of the element that was parsed is given along with the value // stored in the element. List elements generate calls at the start and // end of the list. Any pointers passed to these methods are only guaranteed // to be valid for the life of that call. Each method (except for OnListStart) // returns a bool that indicates whether the parsed data is valid. OnListStart // returns a pointer to a WebMParserClient object, which should be used to // handle elements parsed out of the list being started. If false (or NULL by // OnListStart) is returned then the parse is immediately terminated and an // error is reported by the parser. class MEDIA_EXPORT WebMParserClient { … }; struct ListElementInfo; // Parses a WebM list element and all of its children. This // class supports incremental parsing of the list so Parse() // can be called multiple times with pieces of the list. // IsParsingComplete() will return true once the entire list has // been parsed. class MEDIA_EXPORT WebMListParser { … }; // Parses an element header & returns the ID and element size. // // Returns < 0 if the parse fails. // Returns 0 if more data is needed. // Returning > 0 indicates success & the number of bytes parsed. // |*id| contains the element ID on success and is undefined otherwise. // |*element_size| contains the element size on success and is undefined // otherwise. int MEDIA_EXPORT WebMParseElementHeader(const uint8_t* buf, int size, int* id, int64_t* element_size); } // namespace media #endif // MEDIA_FORMATS_WEBM_WEBM_PARSER_H_