diff --git a/packager/app/mpd_generator.cc b/packager/app/mpd_generator.cc index 0f076d3ff0..52ada27356 100644 --- a/packager/app/mpd_generator.cc +++ b/packager/app/mpd_generator.cc @@ -97,14 +97,13 @@ int MpdMain(int argc, char** argv) { log_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; CHECK(logging::InitLogging(log_settings)); + google::SetVersionString(GetPackagerVersion()); google::SetUsageMessage(base::StringPrintf(kUsage, argv[0])); google::ParseCommandLineFlags(&argc, &argv, true); ExitStatus status = CheckRequiredFlags(); if (status != kSuccess) { - const std::string version_string = base::StringPrintf( - "mpd_generator version %s", GetPackagerVersion().c_str()); - google::ShowUsageWithFlags(version_string.c_str()); + google::ShowUsageWithFlags("Usage"); return status; } diff --git a/packager/app/packager_main.cc b/packager/app/packager_main.cc index deeed2503e..6d0fe4c4b4 100644 --- a/packager/app/packager_main.cc +++ b/packager/app/packager_main.cc @@ -72,11 +72,10 @@ namespace media { namespace { const char kUsage[] = - "Packager driver program. Usage:\n\n" - "%s [flags] ...\n" - "stream_descriptor consists of comma separated field_name/value pairs:\n" - "field_name=value,[field_name=value,]...\n" - "Supported field names are as follows:\n" + "%s [flags] ...\n\n" + " stream_descriptor consists of comma separated field_name/value pairs:\n" + " field_name=value,[field_name=value,]...\n" + " Supported field names are as follows:\n" " - input (in): Required input/source media file path or network stream\n" " URL.\n" " - stream_selector (stream): Required field with value 'audio',\n" @@ -525,12 +524,11 @@ int PackagerMain(int argc, char** argv) { log_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; CHECK(logging::InitLogging(log_settings)); + google::SetVersionString(GetPackagerVersion()); google::SetUsageMessage(base::StringPrintf(kUsage, argv[0])); google::ParseCommandLineFlags(&argc, &argv, true); if (argc < 2) { - const std::string version_string = base::StringPrintf( - "shaka-packager version %s", GetPackagerVersion().c_str()); - google::ShowUsageWithFlags(version_string.c_str()); + google::ShowUsageWithFlags("Usage"); return kSuccess; } diff --git a/packager/app/test/packager_app.py b/packager/app/test/packager_app.py index 9f3c3f285d..60c92c549f 100644 --- a/packager/app/test/packager_app.py +++ b/packager/app/test/packager_app.py @@ -31,11 +31,7 @@ class PackagerApp(object): return subprocess.check_output(cmd) def Version(self): - output = subprocess.check_output([self.binary]) - # The output should of the form: - # shaka-packager version xxx: Description... - # We consider everything before ':' part of version. - return output.split(':')[0] + return subprocess.check_output([self.binary, '--version']) def Package(self, streams, flags=None): if flags is None: diff --git a/packager/app/test/packager_test.py b/packager/app/test/packager_test.py index 1e82f9f451..d6e3655b3d 100755 --- a/packager/app/test/packager_test.py +++ b/packager/app/test/packager_test.py @@ -39,8 +39,8 @@ class PackagerAppTest(unittest.TestCase): def testVersion(self): self.assertRegexpMatches( - self.packager.Version(), '^shaka-packager version ' - r'((?P[\w\.]+)-)?(?P[a-f\d]+)-(debug|release)$') + self.packager.Version(), '^packager version ' + r'((?P[\w\.]+)-)?(?P[a-f\d]+)-(debug|release)\n.*$') def testDumpStreamInfo(self): test_file = os.path.join(self.test_data_dir, 'bear-640x360.mp4')