33 static std::shared_ptr<MediaSample>
CopyFrom(
const uint8_t* data,
46 static std::shared_ptr<MediaSample>
CopyFrom(
const uint8_t* data,
48 const uint8_t* side_data,
49 size_t side_data_size,
58 static std::shared_ptr<MediaSample>
FromMetadata(
const uint8_t* metadata,
59 size_t metadata_size);
72 std::shared_ptr<MediaSample>
Clone()
const;
77 void TransferData(std::shared_ptr<uint8_t> data,
size_t data_size);
83 void SetData(
const uint8_t* data,
size_t data_size);
89 DCHECK(!end_of_stream());
93 void set_dts(int64_t dts) { dts_ = dts; }
96 DCHECK(!end_of_stream());
100 void set_pts(int64_t pts) { pts_ = pts; }
102 int64_t duration()
const {
103 DCHECK(!end_of_stream());
107 void set_duration(int64_t duration) {
108 DCHECK(!end_of_stream());
109 duration_ = duration;
112 bool is_key_frame()
const {
113 DCHECK(!end_of_stream());
114 return is_key_frame_;
117 bool is_encrypted()
const {
118 DCHECK(!end_of_stream());
119 return is_encrypted_;
121 const uint8_t* data()
const {
122 DCHECK(!end_of_stream());
126 size_t data_size()
const {
127 DCHECK(!end_of_stream());
131 const uint8_t* side_data()
const {
return side_data_.get(); }
133 size_t side_data_size()
const {
return side_data_size_; }
135 const DecryptConfig* decrypt_config()
const {
return decrypt_config_.get(); }
137 void set_is_key_frame(
bool value) {
138 is_key_frame_ = value;
141 void set_is_encrypted(
bool value) {
142 is_encrypted_ = value;
145 void set_decrypt_config(std::unique_ptr<DecryptConfig> decrypt_config) {
146 decrypt_config_ = std::move(decrypt_config);
150 bool end_of_stream()
const {
return data_size_ == 0; }
152 const std::string& config_id()
const {
return config_id_; }
153 void set_config_id(
const std::string& config_id) {
154 config_id_ = config_id;
163 const uint8_t* side_data,
164 size_t side_data_size,
173 int64_t duration_ = 0;
174 bool is_key_frame_ =
false;
176 bool is_encrypted_ =
false;
179 std::shared_ptr<const uint8_t> data_;
180 size_t data_size_ = 0;
184 std::shared_ptr<const uint8_t> side_data_;
185 size_t side_data_size_ = 0;
189 std::string config_id_;
192 std::unique_ptr<DecryptConfig> decrypt_config_;