#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/formats/mp4/track_run_iterator.h"
#include <algorithm>
#include <iomanip>
#include <limits>
#include <memory>
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/numerics/checked_math.h"
#include "base/numerics/safe_conversions.h"
#include "build/chromecast_buildflags.h"
#include "media/base/decrypt_config.h"
#include "media/base/demuxer.h"
#include "media/base/demuxer_memory_limit.h"
#include "media/base/encryption_pattern.h"
#include "media/base/encryption_scheme.h"
#include "media/base/media_util.h"
#include "media/base/timestamp_constants.h"
#include "media/formats/mp4/rcheck.h"
#include "media/formats/mp4/sample_to_group_iterator.h"
#include "media/media_buildflags.h"
namespace media {
namespace mp4 {
struct SampleInfo { … };
struct TrackRunInfo { … };
TrackRunInfo::TrackRunInfo()
: … { … }
TrackRunInfo::~TrackRunInfo() = default;
base::TimeDelta TimeDeltaFromRational(int64_t numer, int64_t denom) { … }
DecodeTimestamp DecodeTimestampFromRational(int64_t numer, int64_t denom) { … }
TrackRunIterator::TrackRunIterator(const Movie* moov, MediaLog* media_log)
: … { … }
TrackRunIterator::~TrackRunIterator() = default;
static std::string HexFlags(uint32_t flags) { … }
static bool PopulateSampleInfo(const TrackExtends& trex,
const TrackFragmentHeader& tfhd,
const TrackFragmentRun& trun,
const int64_t edit_list_offset,
const uint32_t i,
SampleInfo* sample_info,
const SampleDependsOn sdtp_sample_depends_on,
bool is_audio,
MediaLog* media_log) { … }
static const CencSampleEncryptionInfoEntry* GetSampleEncryptionInfoEntry(
const TrackRunInfo& run_info,
uint32_t group_description_index) { … }
class CompareMinTrackRunDataOffset { … };
bool TrackRunIterator::Init(const MovieFragment& moof) { … }
bool TrackRunIterator::UpdateCts() { … }
bool TrackRunIterator::AdvanceRun() { … }
bool TrackRunIterator::ResetRun() { … }
bool TrackRunIterator::AdvanceSample() { … }
bool TrackRunIterator::AuxInfoNeedsToBeCached() { … }
bool TrackRunIterator::CacheAuxInfo(const uint8_t* buf, int buf_size) { … }
bool TrackRunIterator::IsRunValid() const { … }
bool TrackRunIterator::IsSampleValid() const { … }
int64_t TrackRunIterator::GetMaxClearOffset() { … }
uint32_t TrackRunIterator::track_id() const { … }
bool TrackRunIterator::is_encrypted() const { … }
int64_t TrackRunIterator::aux_info_offset() const { … }
int TrackRunIterator::aux_info_size() const { … }
bool TrackRunIterator::is_audio() const { … }
const AudioSampleEntry& TrackRunIterator::audio_description() const { … }
const VideoSampleEntry& TrackRunIterator::video_description() const { … }
int64_t TrackRunIterator::sample_offset() const { … }
uint32_t TrackRunIterator::sample_size() const { … }
DecodeTimestamp TrackRunIterator::dts() const { … }
base::TimeDelta TrackRunIterator::cts() const { … }
base::TimeDelta TrackRunIterator::duration() const { … }
bool TrackRunIterator::is_keyframe() const { … }
const ProtectionSchemeInfo& TrackRunIterator::protection_scheme_info() const { … }
const TrackEncryption& TrackRunIterator::track_encryption() const { … }
std::unique_ptr<DecryptConfig> TrackRunIterator::GetDecryptConfig() { … }
uint32_t TrackRunIterator::GetGroupDescriptionIndex(
uint32_t sample_index) const { … }
bool TrackRunIterator::IsSampleEncrypted(size_t sample_index) const { … }
const std::vector<uint8_t>& TrackRunIterator::GetKeyId(
size_t sample_index) const { … }
uint8_t TrackRunIterator::GetIvSize(size_t sample_index) const { … }
bool TrackRunIterator::ApplyConstantIv(size_t sample_index,
SampleEncryptionEntry* entry) const { … }
}
}