From e9d47beb87f7d1ae3a18a713258fbf9574bc6dfd Mon Sep 17 00:00:00 2001 From: ans-negi <71122137+ans-negi@users.noreply.github.com> Date: Wed, 24 Mar 2021 22:59:44 +0530 Subject: [PATCH] feat: Add support for ac3 and ec3 (#69) Closes #37 --- .gitignore | 2 ++ streamer/bitrate_configuration.py | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index d99d857..f10cf8b 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ docs/build/ build/ dist/ shaka_streamer.egg-info/ +.idea/ +venv/ diff --git a/streamer/bitrate_configuration.py b/streamer/bitrate_configuration.py index 5d6d336..ab053c0 100644 --- a/streamer/bitrate_configuration.py +++ b/streamer/bitrate_configuration.py @@ -39,6 +39,8 @@ class AudioCodec(enum.Enum): AAC: str = 'aac' OPUS: str = 'opus' + AC3: str = 'ac3' + EAC3: str = 'eac3' def is_hardware_accelerated(self) -> bool: """Returns True if this codec is hardware accelerated.""" @@ -61,7 +63,7 @@ def get_output_format(self) -> str: # TODO(#31): add support for configurable output format per-codec if self == AudioCodec.OPUS: return 'webm' - elif self == AudioCodec.AAC: + elif (self == AudioCodec.AAC) or (self == AudioCodec.AC3) or (self == AudioCodec.EAC3): return 'mp4' else: assert False, 'No mapping for output format for codec {}'.format( @@ -152,13 +154,17 @@ def _sortable_properties(self) -> Tuple[float]: 'bitrates': { 'aac': '128k', 'opus': '64k', + 'ac3': '192k', + 'eac3': '96k', }, }), 'surround': AudioChannelLayout({ 'max_channels': 6, 'bitrates': { - 'aac': '192k', - 'opus': '96k', + 'aac': '256k', + 'opus': '128k', + 'ac3': '384k', + 'eac3': '192k', }, }), }