From 0b53b404283b542f1a1dfea7d6e61414cb3c8a56 Mon Sep 17 00:00:00 2001 From: Tomohiro IKEDA Date: Sat, 16 Nov 2019 04:53:47 +0900 Subject: [PATCH] Change --generate_static_mpd to --generate_static_live_mpd (#672) --- docs/source/options/dash_options.rst | 2 +- docs/source/tutorials/ads.rst | 2 +- docs/source/tutorials/dash.rst | 2 +- packager/app/mpd_flags.cc | 3 +-- packager/app/mpd_flags.h | 2 +- packager/app/packager_main.cc | 2 +- packager/app/retired_flags.cc | 14 ++++++++++++++ packager/app/test/packager_test.py | 12 ++++++------ 8 files changed, 26 insertions(+), 13 deletions(-) diff --git a/docs/source/options/dash_options.rst b/docs/source/options/dash_options.rst index 3402dea526..0b25db78a2 100644 --- a/docs/source/options/dash_options.rst +++ b/docs/source/options/dash_options.rst @@ -1,7 +1,7 @@ DASH options ^^^^^^^^^^^^ ---generate_static_mpd +--generate_static_live_mpd If enabled, generates static mpd. If segment_template is specified in stream descriptors, shaka-packager generates dynamic mpd by default; if diff --git a/docs/source/tutorials/ads.rst b/docs/source/tutorials/ads.rst index 82342823d6..5dc02e874e 100644 --- a/docs/source/tutorials/ads.rst +++ b/docs/source/tutorials/ads.rst @@ -34,7 +34,7 @@ respectively. 'in=h264_main_720p_3000.mp4,stream=video,init_segment=h264_720p/init.mp4,segment_template=h264_720p/$Number$.m4s' \ 'in=h264_high_1080p_6000.mp4,stream=video,init_segment=h264_1080p/init.mp4,segment_template=h264_1080p/$Number$.m4s' \ --ad_cues 600;1800;3000 \ - --generate_static_mpd --mpd_output h264.mpd + --generate_static_live_mpd --mpd_output h264.mpd * DASH with on-demand profile:: diff --git a/docs/source/tutorials/dash.rst b/docs/source/tutorials/dash.rst index 4e4c6980fb..9ec314bbf5 100644 --- a/docs/source/tutorials/dash.rst +++ b/docs/source/tutorials/dash.rst @@ -71,7 +71,7 @@ genereated with the previous command. 'in=h264_main_480p_1000.mp4,stream=video,init_segment=h264_480p/init.mp4,segment_template=h264_480p/$Number$.m4s' \ 'in=h264_main_720p_3000.mp4,stream=video,init_segment=h264_720p/init.mp4,segment_template=h264_720p/$Number$.m4s' \ 'in=h264_high_1080p_6000.mp4,stream=video,init_segment=h264_1080p/init.mp4,segment_template=h264_1080p/$Number$.m4s' \ - --generate_static_mpd --mpd_output h264.mpd + --generate_static_live_mpd --mpd_output h264.mpd The above packaging command creates five groups of segments (each with an init segment and a series of media segments) for the five streams and a manifest, diff --git a/packager/app/mpd_flags.cc b/packager/app/mpd_flags.cc index 9d51435df9..9ee52d3a9d 100644 --- a/packager/app/mpd_flags.cc +++ b/packager/app/mpd_flags.cc @@ -8,8 +8,7 @@ #include "packager/app/mpd_flags.h" -// TODO(kqyang): Rename to generate_static_live_mpd. -DEFINE_bool(generate_static_mpd, +DEFINE_bool(generate_static_live_mpd, false, "Set to true to generate static mpd. If segment_template is " "specified in stream descriptors, shaka-packager generates dynamic " diff --git a/packager/app/mpd_flags.h b/packager/app/mpd_flags.h index 5675f65d6c..d6c9f2fe83 100644 --- a/packager/app/mpd_flags.h +++ b/packager/app/mpd_flags.h @@ -11,7 +11,7 @@ #include -DECLARE_bool(generate_static_mpd); +DECLARE_bool(generate_static_live_mpd); DECLARE_bool(output_media_info); DECLARE_string(mpd_output); DECLARE_string(base_urls); diff --git a/packager/app/packager_main.cc b/packager/app/packager_main.cc index a55557cb57..926fb6ebe6 100644 --- a/packager/app/packager_main.cc +++ b/packager/app/packager_main.cc @@ -452,7 +452,7 @@ base::Optional GetPackagingParams() { mpd_params.default_language = FLAGS_default_language; mpd_params.default_text_language = FLAGS_default_text_language; - mpd_params.generate_static_live_mpd = FLAGS_generate_static_mpd; + mpd_params.generate_static_live_mpd = FLAGS_generate_static_live_mpd; mpd_params.generate_dash_if_iop_compliant_mpd = FLAGS_generate_dash_if_iop_compliant_mpd; mpd_params.allow_approximate_segment_timeline = diff --git a/packager/app/retired_flags.cc b/packager/app/retired_flags.cc index 84d1c30587..57b5e1c452 100644 --- a/packager/app/retired_flags.cc +++ b/packager/app/retired_flags.cc @@ -44,6 +44,9 @@ DEFINE_bool(generate_playready_pssh, DEFINE_bool(generate_common_pssh, false, "This flag is deprecated. Use --protection_systems instead."); +DEFINE_bool(generate_static_mpd, + false, + "This flag is deprecated. Use --generate_static_live_mpd instead."); // The current gflags library does not provide a way to check whether a flag is // set in command line. If a flag has a different value to its default value, @@ -89,6 +92,16 @@ bool InformRetiredPsshGenerationFlag(const char* flagname, bool value) { return true; } +bool InformRetiredGenerateStaticMpdFlag(const char* flagname, bool value) { + if (value) { + fprintf(stderr, + "WARNING: %s is deprecated and ignored. Please switch to " + "--generate_static_live_mpd.\n", + flagname); + } + return true; +} + DEFINE_validator(profile, &InformRetiredStringFlag); DEFINE_validator(single_segment, &InformRetiredDefaultTrueFlag); DEFINE_validator(webm_subsample_encryption, &InformRetiredDefaultTrueFlag); @@ -101,3 +114,4 @@ DEFINE_validator(num_subsegments_per_sidx, &InformRetiredDefaultInt32Flag); DEFINE_validator(generate_widevine_pssh, &InformRetiredPsshGenerationFlag); DEFINE_validator(generate_playready_pssh, &InformRetiredPsshGenerationFlag); DEFINE_validator(generate_common_pssh, &InformRetiredPsshGenerationFlag); +DEFINE_validator(generate_static_mpd, &InformRetiredGenerateStaticMpdFlag); diff --git a/packager/app/test/packager_test.py b/packager/app/test/packager_test.py index 21f1113be8..d60c2b7fc7 100755 --- a/packager/app/test/packager_test.py +++ b/packager/app/test/packager_test.py @@ -431,7 +431,7 @@ class PackagerAppTest(unittest.TestCase): time_shift_buffer_depth=0.0, preserved_segments_outside_live_window=0, utc_timings=None, - generate_static_mpd=False, + generate_static_live_mpd=False, ad_cues=None, default_language=None, segment_duration=1.0, @@ -508,8 +508,8 @@ class PackagerAppTest(unittest.TestCase): if utc_timings: flags += ['--utc_timings', utc_timings] - if generate_static_mpd: - flags += ['--generate_static_mpd'] + if generate_static_live_mpd: + flags += ['--generate_static_live_mpd'] if ad_cues: flags += ['--ad_cues', ad_cues] @@ -1091,7 +1091,7 @@ class PackagerFunctionalTest(PackagerAppTest): output_format='mp4') ] flags = self._GetFlags(output_dash=True, output_hls=True, - generate_static_mpd=True, ad_cues='1.5') + generate_static_live_mpd=True, ad_cues='1.5') self.assertPackageSuccess(streams, flags) # Mpd cannot be validated right now since we don't generate determinstic # mpd with multiple inputs due to thread racing. @@ -1442,7 +1442,7 @@ class PackagerFunctionalTest(PackagerAppTest): def testLiveStaticProfile(self): self.assertPackageSuccess( self._GetStreams(['audio', 'video'], segmented=True), - self._GetFlags(output_dash=True, generate_static_mpd=True)) + self._GetFlags(output_dash=True, generate_static_live_mpd=True)) self._CheckTestResults('live-static-profile') def testLiveStaticProfileWithTimeInSegmentName(self): @@ -1450,7 +1450,7 @@ class PackagerFunctionalTest(PackagerAppTest): self._GetStreams(['audio', 'video'], segmented=True, using_time_specifier=True), - self._GetFlags(output_dash=True, generate_static_mpd=True)) + self._GetFlags(output_dash=True, generate_static_live_mpd=True)) self._CheckTestResults('live-static-profile-with-time-in-segment-name') def testLiveProfileAndEncryption(self):