From dc0395291a090b342beaab2e89c627dc33ee89b0 Mon Sep 17 00:00:00 2001 From: Vishal Shah Date: Thu, 2 Jun 2022 10:40:34 -0600 Subject: [PATCH] fix: dash_roles add role=description for DVS audio per DASH-IF-IOP-v4.3 (#1054) Fixes support for description role for audio DVS tracks as per spec. --- docs/source/options/dash_stream_descriptors.rst | 4 ++-- packager/app/packager_main.cc | 6 +++--- packager/app/test/packager_test.py | 2 +- .../audio-video-with-accessibilities-and-roles/output.mpd | 2 +- packager/mpd/base/adaptation_set.cc | 2 ++ packager/mpd/base/adaptation_set.h | 3 ++- packager/mpd/base/period.cc | 2 ++ 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/docs/source/options/dash_stream_descriptors.rst b/docs/source/options/dash_stream_descriptors.rst index 6e1f901099..a6a6a101ae 100644 --- a/docs/source/options/dash_stream_descriptors.rst +++ b/docs/source/options/dash_stream_descriptors.rst @@ -12,5 +12,5 @@ DASH specific stream descriptor fields Optional semicolon separated list of values for DASH Role element. The value should be one of: **caption**, **subtitle**, **main**, **alternate**, - **supplementary**, **commentary** and **dub**. See DASH (ISO/IEC 23009-1) - specification for details. + **supplementary**, **commentary**, **description** and **dub**. See + DASH (ISO/IEC 23009-1) specification for details. diff --git a/packager/app/packager_main.cc b/packager/app/packager_main.cc index 1035b1fe25..e256c423bf 100644 --- a/packager/app/packager_main.cc +++ b/packager/app/packager_main.cc @@ -114,8 +114,8 @@ const char kUsage[] = " in the format: scheme_id_uri=value.\n" " - dash_roles (roles): Optional semicolon separated list of values for\n" " DASH Role elements. The value should be one of: caption, subtitle,\n" - " main, alternate, supplementary, commentary and dub. See DASH\n" - " (ISO/IEC 23009-1) specification for details.\n"; + " main, alternate, supplementary, commentary, description and dub. See\n" + " DASH (ISO/IEC 23009-1) specification for details.\n"; // Labels for parameters in RawKey key info. const char kDrmLabelLabel[] = "label"; @@ -565,7 +565,7 @@ int PackagerMain(int argc, char** argv) { #if defined(OS_WIN) // Windows wmain, which converts wide character arguments to UTF-8. int wmain(int argc, wchar_t* argv[], wchar_t* envp[]) { - std::unique_ptr> utf8_argv( + std::unique_ptr> utf8_argv( new char*[argc], [argc](char** utf8_args) { // TODO(tinskip): This leaks, but if this code is enabled, it crashes. // Figure out why. I suspect gflags does something funny with the diff --git a/packager/app/test/packager_test.py b/packager/app/test/packager_test.py index 113a582482..07f0dde29d 100755 --- a/packager/app/test/packager_test.py +++ b/packager/app/test/packager_test.py @@ -709,7 +709,7 @@ class PackagerFunctionalTest(PackagerAppTest): self._GetStream( 'audio', dash_accessibilities='urn:tva:metadata:cs:AudioPurposeCS:2007=1', - dash_roles='alternate'), + dash_roles='description'), self._GetStream('video'), ] diff --git a/packager/app/test/testdata/audio-video-with-accessibilities-and-roles/output.mpd b/packager/app/test/testdata/audio-video-with-accessibilities-and-roles/output.mpd index ab3a50484d..0c3c3a1794 100644 --- a/packager/app/test/testdata/audio-video-with-accessibilities-and-roles/output.mpd +++ b/packager/app/test/testdata/audio-video-with-accessibilities-and-roles/output.mpd @@ -12,7 +12,7 @@ - + bear-640x360-audio.mp4 diff --git a/packager/mpd/base/adaptation_set.cc b/packager/mpd/base/adaptation_set.cc index 154a9fe588..1f3cbe1d82 100644 --- a/packager/mpd/base/adaptation_set.cc +++ b/packager/mpd/base/adaptation_set.cc @@ -54,6 +54,8 @@ std::string RoleToText(AdaptationSet::Role role) { return "commentary"; case AdaptationSet::kRoleDub: return "dub"; + case AdaptationSet::kRoleDescription: + return "description"; default: return "unknown"; } diff --git a/packager/mpd/base/adaptation_set.h b/packager/mpd/base/adaptation_set.h index c288ad857a..dd9fa3942d 100644 --- a/packager/mpd/base/adaptation_set.h +++ b/packager/mpd/base/adaptation_set.h @@ -43,7 +43,8 @@ class AdaptationSet { kRoleAlternate, kRoleSupplementary, kRoleCommentary, - kRoleDub + kRoleDub, + kRoleDescription }; virtual ~AdaptationSet(); diff --git a/packager/mpd/base/period.cc b/packager/mpd/base/period.cc index 712cdd2e97..e1285fdf0b 100644 --- a/packager/mpd/base/period.cc +++ b/packager/mpd/base/period.cc @@ -57,6 +57,8 @@ AdaptationSet::Role RoleFromString(const std::string& role_str) { return AdaptationSet::Role::kRoleCommentary; if (role_str == "dub") return AdaptationSet::Role::kRoleDub; + if (role_str == "description") + return AdaptationSet::Role::kRoleDescription; return AdaptationSet::Role::kRoleUnknown; }