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) { is_key_frame_ = value; }
139 void set_is_encrypted(
bool value) { is_encrypted_ = value; }
141 void set_decrypt_config(std::unique_ptr<DecryptConfig> decrypt_config) {
142 decrypt_config_ = std::move(decrypt_config);
146 bool end_of_stream()
const {
return data_size_ == 0; }
148 const std::string& config_id()
const {
return config_id_; }
149 void set_config_id(
const std::string& config_id) { config_id_ = config_id; }
157 const uint8_t* side_data,
158 size_t side_data_size,
167 int64_t duration_ = 0;
168 bool is_key_frame_ =
false;
170 bool is_encrypted_ =
false;
173 std::shared_ptr<const uint8_t> data_;
174 size_t data_size_ = 0;
178 std::shared_ptr<const uint8_t> side_data_;
179 size_t side_data_size_ = 0;
183 std::string config_id_;
186 std::unique_ptr<DecryptConfig> decrypt_config_;