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_TS_SECTION_PES_H_
|
|
|
|
#define MEDIA_FORMATS_MP2T_TS_SECTION_PES_H_
|
|
|
|
|
2014-09-30 23:52:58 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2014-04-01 01:34:59 +00:00
|
|
|
#include "base/compiler_specific.h"
|
|
|
|
#include "base/memory/scoped_ptr.h"
|
|
|
|
#include "media/base/byte_queue.h"
|
|
|
|
#include "media/formats/mp2t/ts_section.h"
|
|
|
|
|
2014-09-19 20:41:13 +00:00
|
|
|
namespace edash_packager {
|
2014-04-01 01:34:59 +00:00
|
|
|
namespace media {
|
|
|
|
namespace mp2t {
|
|
|
|
|
|
|
|
class EsParser;
|
|
|
|
|
|
|
|
class TsSectionPes : public TsSection {
|
|
|
|
public:
|
|
|
|
explicit TsSectionPes(scoped_ptr<EsParser> es_parser);
|
|
|
|
virtual ~TsSectionPes();
|
|
|
|
|
|
|
|
// TsSection implementation.
|
|
|
|
virtual bool Parse(bool payload_unit_start_indicator,
|
2014-09-30 21:52:21 +00:00
|
|
|
const uint8_t* buf,
|
|
|
|
int size) OVERRIDE;
|
2014-04-01 01:34:59 +00:00
|
|
|
virtual void Flush() OVERRIDE;
|
|
|
|
virtual void Reset() OVERRIDE;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Emit a reassembled PES packet.
|
|
|
|
// Return true if successful.
|
|
|
|
// |emit_for_unknown_size| is used to force emission for PES packets
|
|
|
|
// whose size is unknown.
|
|
|
|
bool Emit(bool emit_for_unknown_size);
|
|
|
|
|
|
|
|
// Parse a PES packet, return true if successful.
|
2014-09-30 21:52:21 +00:00
|
|
|
bool ParseInternal(const uint8_t* raw_pes, int raw_pes_size);
|
2014-04-01 01:34:59 +00:00
|
|
|
|
|
|
|
void ResetPesState();
|
|
|
|
|
|
|
|
// Bytes of the current PES.
|
|
|
|
ByteQueue pes_byte_queue_;
|
|
|
|
|
|
|
|
// ES parser.
|
|
|
|
scoped_ptr<EsParser> es_parser_;
|
|
|
|
|
|
|
|
// Do not start parsing before getting a unit start indicator.
|
|
|
|
bool wait_for_pusi_;
|
|
|
|
|
|
|
|
// Used to unroll PTS and DTS.
|
|
|
|
bool previous_pts_valid_;
|
2014-09-30 21:52:21 +00:00
|
|
|
int64_t previous_pts_;
|
2014-04-01 01:34:59 +00:00
|
|
|
bool previous_dts_valid_;
|
2014-09-30 21:52:21 +00:00
|
|
|
int64_t previous_dts_;
|
2014-04-01 01:34:59 +00:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(TsSectionPes);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mp2t
|
|
|
|
} // namespace media
|
2014-09-19 20:41:13 +00:00
|
|
|
} // namespace edash_packager
|
2014-04-01 01:34:59 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|