mirror of
https://github.com/google/bumble.git
synced 2026-06-01 07:37:02 +00:00
+5
-15
@@ -228,10 +228,11 @@ class FfplayOutput(QueuedOutput):
|
|||||||
subprocess: Optional[asyncio.subprocess.Process]
|
subprocess: Optional[asyncio.subprocess.Process]
|
||||||
ffplay_task: Optional[asyncio.Task]
|
ffplay_task: Optional[asyncio.Task]
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self, codec: str) -> None:
|
||||||
super().__init__(AacAudioExtractor())
|
super().__init__(AudioExtractor.create(codec))
|
||||||
self.subprocess = None
|
self.subprocess = None
|
||||||
self.ffplay_task = None
|
self.ffplay_task = None
|
||||||
|
self.codec = codec
|
||||||
|
|
||||||
async def start(self):
|
async def start(self):
|
||||||
if self.started:
|
if self.started:
|
||||||
@@ -240,7 +241,7 @@ class FfplayOutput(QueuedOutput):
|
|||||||
await super().start()
|
await super().start()
|
||||||
|
|
||||||
self.subprocess = await asyncio.create_subprocess_shell(
|
self.subprocess = await asyncio.create_subprocess_shell(
|
||||||
'ffplay -acodec aac pipe:0',
|
f'ffplay -f {self.codec} pipe:0',
|
||||||
stdin=asyncio.subprocess.PIPE,
|
stdin=asyncio.subprocess.PIPE,
|
||||||
stdout=asyncio.subprocess.PIPE,
|
stdout=asyncio.subprocess.PIPE,
|
||||||
stderr=asyncio.subprocess.PIPE,
|
stderr=asyncio.subprocess.PIPE,
|
||||||
@@ -419,7 +420,7 @@ class Speaker:
|
|||||||
self.outputs = []
|
self.outputs = []
|
||||||
for output in outputs:
|
for output in outputs:
|
||||||
if output == '@ffplay':
|
if output == '@ffplay':
|
||||||
self.outputs.append(FfplayOutput())
|
self.outputs.append(FfplayOutput(codec))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Default to FileOutput
|
# Default to FileOutput
|
||||||
@@ -708,17 +709,6 @@ def speaker(
|
|||||||
):
|
):
|
||||||
"""Run the speaker."""
|
"""Run the speaker."""
|
||||||
|
|
||||||
# ffplay only works with AAC for now
|
|
||||||
if codec != 'aac' and '@ffplay' in output:
|
|
||||||
print(
|
|
||||||
color(
|
|
||||||
f'{codec} not supported with @ffplay output, '
|
|
||||||
'@ffplay output will be skipped',
|
|
||||||
'yellow',
|
|
||||||
)
|
|
||||||
)
|
|
||||||
output = list(filter(lambda x: x != '@ffplay', output))
|
|
||||||
|
|
||||||
if '@ffplay' in output:
|
if '@ffplay' in output:
|
||||||
# Check if ffplay is installed
|
# Check if ffplay is installed
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user