7 #include "packager/media/base/media_sample.h"
11 #include "packager/base/logging.h"
12 #include "packager/base/strings/stringprintf.h"
17 MediaSample::MediaSample(
const uint8_t* data,
19 const uint8_t* side_data,
20 size_t side_data_size,
25 is_key_frame_(is_key_frame),
26 is_encrypted_(false) {
31 data_.assign(data, data + size);
33 side_data_.assign(side_data, side_data + side_data_size);
36 MediaSample::MediaSample() : dts_(0),
40 is_encrypted_(false) {}
42 MediaSample::~MediaSample() {}
50 return make_scoped_refptr(
51 new MediaSample(data, data_size, NULL, 0u, is_key_frame));
57 const uint8_t* side_data,
58 size_t side_data_size,
63 data, data_size, side_data, side_data_size, is_key_frame));
68 size_t metadata_size) {
69 return make_scoped_refptr(
70 new MediaSample(
nullptr, 0, metadata, metadata_size,
false));
76 return make_scoped_refptr(media_sample);
81 return make_scoped_refptr(
new MediaSample(NULL, 0, NULL, 0,
false));
86 return "End of stream sample\n";
87 return base::StringPrintf(
88 "dts: %" PRId64
"\n pts: %" PRId64
"\n duration: %" PRId64
"\n "
89 "is_key_frame: %s\n size: %zu\n side_data_size: %zu\n",
93 is_key_frame_ ?
"true" :
"false",