1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef MEDIA_MP2T_ES_PARSER_H_ 6 #define MEDIA_MP2T_ES_PARSER_H_ 7 8 #include "base/basictypes.h" 9 #include "base/callback.h" 10 #include "base/memory/ref_counted.h" 11 #include "base/time/time.h" 12 13 namespace media { 14 15 class StreamParserBuffer; 16 17 namespace mp2t { 18 19 class EsParser { 20 public: 21 typedef base::Callback<void(scoped_refptr<StreamParserBuffer>)> EmitBufferCB; 22 23 EsParser() {} 24 virtual ~EsParser() {} 25 26 // ES parsing. 27 // Should use kNoTimestamp when a timestamp is not valid. 28 virtual bool Parse(const uint8* buf, int size, 29 base::TimeDelta pts, 30 base::TimeDelta dts) = 0; 31 32 // Flush any pending buffer. 33 virtual void Flush() = 0; 34 35 // Reset the state of the ES parser. 36 virtual void Reset() = 0; 37 }; 38 39 } // namespace mp2t 40 } // namespace media 41 42 #endif 43