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.
|
|
|
|
|
2017-12-20 00:56:36 +00:00
|
|
|
#ifndef PACKAGER_MEDIA_FORMATS_MP2T_TS_SECTION_PSI_H_
|
|
|
|
#define PACKAGER_MEDIA_FORMATS_MP2T_TS_SECTION_PSI_H_
|
2014-04-01 01:34:59 +00:00
|
|
|
|
2023-08-31 23:59:46 +00:00
|
|
|
#include "packager/macros.h"
|
2014-10-01 22:10:21 +00:00
|
|
|
#include "packager/media/base/byte_queue.h"
|
|
|
|
#include "packager/media/formats/mp2t/ts_section.h"
|
2014-04-01 01:34:59 +00:00
|
|
|
|
2016-05-20 21:19:33 +00:00
|
|
|
namespace shaka {
|
2014-04-01 01:34:59 +00:00
|
|
|
namespace media {
|
|
|
|
|
|
|
|
class BitReader;
|
|
|
|
|
|
|
|
namespace mp2t {
|
|
|
|
|
|
|
|
class TsSectionPsi : public TsSection {
|
|
|
|
public:
|
|
|
|
TsSectionPsi();
|
2015-07-22 23:40:45 +00:00
|
|
|
~TsSectionPsi() override;
|
2014-04-01 01:34:59 +00:00
|
|
|
|
|
|
|
// TsSection implementation.
|
2015-07-22 23:40:45 +00:00
|
|
|
bool Parse(bool payload_unit_start_indicator,
|
|
|
|
const uint8_t* buf,
|
|
|
|
int size) override;
|
2020-12-10 23:03:41 +00:00
|
|
|
bool Flush() override;
|
2015-07-22 23:40:45 +00:00
|
|
|
void Reset() override;
|
2014-04-01 01:34:59 +00:00
|
|
|
|
|
|
|
// Parse the content of the PSI section.
|
|
|
|
virtual bool ParsePsiSection(BitReader* bit_reader) = 0;
|
|
|
|
|
|
|
|
// Reset the state of the PSI section.
|
|
|
|
virtual void ResetPsiSection() = 0;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void ResetPsiState();
|
|
|
|
|
|
|
|
// Bytes of the current PSI.
|
|
|
|
ByteQueue psi_byte_queue_;
|
|
|
|
|
|
|
|
// Do not start parsing before getting a unit start indicator.
|
|
|
|
bool wait_for_pusi_;
|
|
|
|
|
|
|
|
// Number of leading bytes to discard (pointer field).
|
|
|
|
int leading_bytes_to_discard_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(TsSectionPsi);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mp2t
|
|
|
|
} // namespace media
|
2016-05-20 21:19:33 +00:00
|
|
|
} // namespace shaka
|
2014-04-01 01:34:59 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|