Add --profile to set default options to ensure comformance

Change-Id: If114b9f10e029cb8ca53ae64c865a46558d1daca
This commit is contained in:
KongQun Yang 2014-06-26 10:42:12 -07:00 committed by Gerrit Code Review
parent 2af92f67d2
commit e60156a3dd
5 changed files with 41 additions and 2 deletions

View File

@ -8,10 +8,14 @@
#include "app/muxer_flags.h"
DEFINE_string(profile,
"",
"Specify the target DASH profile: on-demand or live. This will "
"set proper option values to ensure conformance to the desired "
"profile.");
DEFINE_double(clear_lead,
10.0f,
"Clear lead in seconds if encryption is enabled.");
DEFINE_bool(single_segment,
true,
"Generate a single segment for the media presentation. This option "

View File

@ -11,8 +11,8 @@
#include <gflags/gflags.h>
DECLARE_string(profile);
DECLARE_double(clear_lead);
DECLARE_bool(single_segment);
DECLARE_double(segment_duration);
DECLARE_bool(segment_sap_aligned);

View File

@ -210,6 +210,9 @@ bool RunPackager(const StringVector& stream_descriptors) {
return false;
}
if (!AssignFlagsFromProfile())
return false;
// Get basic muxer options.
MuxerOptions muxer_options;
if (!GetMuxerOptions(&muxer_options))

View File

@ -86,6 +86,35 @@ scoped_ptr<EncryptionKeySource> CreateEncryptionKeySource() {
return encryption_key_source.Pass();
}
bool AssignFlagsFromProfile() {
bool single_segment = FLAGS_single_segment;
bool normalize_pts = FLAGS_normalize_presentation_timestamp;
if (FLAGS_profile == "on-demand") {
single_segment = true;
normalize_pts = true;
} else if (FLAGS_profile == "live") {
single_segment = false;
normalize_pts = false;
} else if (FLAGS_profile != "") {
fprintf(stderr, "ERROR: --profile '%s' is not supported.\n",
FLAGS_profile.c_str());
return false;
}
if (FLAGS_single_segment != single_segment) {
FLAGS_single_segment = single_segment;
fprintf(stdout, "Profile %s: set --single_segment to %s.\n",
FLAGS_profile.c_str(), single_segment ? "true" : "false");
}
if (FLAGS_normalize_presentation_timestamp != normalize_pts) {
FLAGS_normalize_presentation_timestamp = normalize_pts;
fprintf(stdout,
"Profile %s: set --normalize_presentation_timestamp to %s.\n",
FLAGS_profile.c_str(), normalize_pts ? "true" : "false");
}
return true;
}
bool GetMuxerOptions(MuxerOptions* muxer_options) {
DCHECK(muxer_options);

View File

@ -33,6 +33,9 @@ void DumpStreamInfo(const std::vector<MediaStream*>& streams);
/// encryption is not required.
scoped_ptr<EncryptionKeySource> CreateEncryptionKeySource();
/// Set flags according to profile.
bool AssignFlagsFromProfile();
/// Fill MuxerOptions members using provided command line options.
bool GetMuxerOptions(MuxerOptions* muxer_options);