Add support for setting VP9 profile and level to sample_muxer.
BUG=https://bugs.chromium.org/p/webm/issues/detail?id=1179 Change-Id: I20ffc213764c3c1c35563178b6e8e1e0031760b6
This commit is contained in:
parent
836591f4f5
commit
df3412f68d
@ -60,6 +60,10 @@ void Usage() {
|
||||
printf(" -display_height <int> Display height in pixels\n");
|
||||
printf(" -stereo_mode <int> 3D video mode\n");
|
||||
printf("\n");
|
||||
printf("VP9 options:\n");
|
||||
printf(" -profile <int> VP9 profile\n");
|
||||
printf(" -level <int> VP9 level\n");
|
||||
printf("\n");
|
||||
printf("Cues options:\n");
|
||||
printf(" -output_cues_block_number <int> >0 outputs cue block number\n");
|
||||
printf(" -cues_before_clusters <int> >0 puts Cues before Clusters\n");
|
||||
@ -172,6 +176,8 @@ int main(int argc, char* argv[]) {
|
||||
uint64_t display_width = 0;
|
||||
uint64_t display_height = 0;
|
||||
uint64_t stereo_mode = 0;
|
||||
int vp9_profile = -1; // No profile set.
|
||||
int vp9_level = -1; // No level set.
|
||||
|
||||
metadata_files_t metadata_files;
|
||||
|
||||
@ -234,6 +240,10 @@ int main(int argc, char* argv[]) {
|
||||
display_height = strtol(argv[++i], &end, 10);
|
||||
} else if (!strcmp("-stereo_mode", argv[i]) && i < argc_check) {
|
||||
stereo_mode = strtol(argv[++i], &end, 10);
|
||||
} else if (!strcmp("-profile", argv[i]) && i < argc_check) {
|
||||
vp9_profile = static_cast<int>(strtol(argv[++i], &end, 10));
|
||||
} else if (!strcmp("-level", argv[i]) && i < argc_check) {
|
||||
vp9_level = static_cast<int>(strtol(argv[++i], &end, 10));
|
||||
} else if (!strcmp("-output_cues_block_number", argv[i]) &&
|
||||
i < argc_check) {
|
||||
output_cues_block_number =
|
||||
@ -410,6 +420,49 @@ int main(int argc, char* argv[]) {
|
||||
if (rate > 0.0) {
|
||||
video->set_frame_rate(rate);
|
||||
}
|
||||
|
||||
if (vp9_profile >= 0 || vp9_level >= 0) {
|
||||
const int kMaxVp9PrivateSize = 6;
|
||||
unsigned char private_data[kMaxVp9PrivateSize];
|
||||
int private_size = 0;
|
||||
if (vp9_profile >= 0) {
|
||||
if (vp9_profile < 0 || vp9_profile > 3) {
|
||||
printf("\n VP9 profile(%d) is not valid.\n", vp9_profile);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
const uint8_t kVp9ProfileId = 1;
|
||||
const uint8_t kVp9ProfileIdLength = 1;
|
||||
private_data[private_size++] = kVp9ProfileId;
|
||||
private_data[private_size++] = kVp9ProfileIdLength;
|
||||
private_data[private_size++] = vp9_profile;
|
||||
}
|
||||
|
||||
if (vp9_level >= 0) {
|
||||
const int kNumLevels = 14;
|
||||
const int levels[kNumLevels] = {10, 11, 20, 21, 30, 31, 40,
|
||||
41, 50, 51, 52, 60, 61, 62};
|
||||
bool level_is_valid = false;
|
||||
for (int i = 0; i < kNumLevels; ++i) {
|
||||
if (vp9_level == levels[i]) {
|
||||
level_is_valid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!level_is_valid) {
|
||||
printf("\n VP9 level(%d) is not valid.\n", vp9_level);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
const uint8_t kVp9LevelId = 2;
|
||||
const uint8_t kVp9LevelIdLength = 1;
|
||||
private_data[private_size++] = kVp9LevelId;
|
||||
private_data[private_size++] = kVp9LevelIdLength;
|
||||
private_data[private_size++] = vp9_level;
|
||||
}
|
||||
if (!video->SetCodecPrivate(private_data, private_size)) {
|
||||
printf("\n Could not add video private data.\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
} else if (track_type == Track::kAudio && output_audio) {
|
||||
// Get the audio track from the parser
|
||||
const mkvparser::AudioTrack* const pAudioTrack =
|
||||
|
Loading…
x
Reference in New Issue
Block a user