2014-04-01 01:34:59 +00:00
|
|
|
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef MEDIA_FORMATS_MP2T_ES_PARSER_H_
|
|
|
|
#define MEDIA_FORMATS_MP2T_ES_PARSER_H_
|
|
|
|
|
|
|
|
#include "base/basictypes.h"
|
|
|
|
#include "base/callback.h"
|
|
|
|
#include "base/memory/ref_counted.h"
|
|
|
|
|
|
|
|
namespace media {
|
|
|
|
|
2014-04-07 17:48:25 +00:00
|
|
|
class MediaSample;
|
2014-04-01 01:34:59 +00:00
|
|
|
|
|
|
|
namespace mp2t {
|
|
|
|
|
|
|
|
class EsParser {
|
|
|
|
public:
|
2014-04-08 00:39:14 +00:00
|
|
|
typedef base::Callback<void(scoped_refptr<MediaSample>&)> EmitSampleCB;
|
2014-04-01 01:34:59 +00:00
|
|
|
|
2014-04-07 17:48:25 +00:00
|
|
|
EsParser(uint32 track_id) : track_id_(track_id) {}
|
2014-04-01 01:34:59 +00:00
|
|
|
virtual ~EsParser() {}
|
|
|
|
|
|
|
|
// ES parsing.
|
|
|
|
// Should use kNoTimestamp when a timestamp is not valid.
|
2014-04-07 17:48:25 +00:00
|
|
|
virtual bool Parse(const uint8* buf, int size, int64 pts, int64 dts) = 0;
|
2014-04-01 01:34:59 +00:00
|
|
|
|
|
|
|
// Flush any pending buffer.
|
|
|
|
virtual void Flush() = 0;
|
|
|
|
|
|
|
|
// Reset the state of the ES parser.
|
|
|
|
virtual void Reset() = 0;
|
2014-04-07 17:48:25 +00:00
|
|
|
|
|
|
|
uint32 track_id() { return track_id_; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint32 track_id_;
|
2014-04-01 01:34:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mp2t
|
|
|
|
} // namespace media
|
|
|
|
|
|
|
|
#endif
|