Skip to content

Commit

Permalink
feat: Add support for ac3 and ec3 (#69)
Browse files Browse the repository at this point in the history
Closes #37
  • Loading branch information
ans-negi committed Mar 24, 2021
1 parent ddfd796 commit e9d47be
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ docs/build/
build/
dist/
shaka_streamer.egg-info/
.idea/
venv/
12 changes: 9 additions & 3 deletions streamer/bitrate_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand All @@ -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(
Expand Down Expand Up @@ -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',
},
}),
}
Expand Down

0 comments on commit e9d47be

Please sign in to comment.