From 21c38f512b36546503b929420b64c1f3bbfc32d6 Mon Sep 17 00:00:00 2001 From: Josh Wu Date: Wed, 6 Dec 2023 16:25:41 +0800 Subject: [PATCH] ffplay routing --- examples/run_unicast_server.py | 47 ++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/examples/run_unicast_server.py b/examples/run_unicast_server.py index 4dadec859..e71cbeff9 100644 --- a/examples/run_unicast_server.py +++ b/examples/run_unicast_server.py @@ -19,12 +19,14 @@ import logging import sys import os +import struct from bumble.core import AdvertisingData -from bumble.device import Device +from bumble.device import Device, CisLink from bumble.hci import ( CodecID, CodingFormat, OwnAddressType, + HCI_IsoDataPacket, HCI_LE_Set_Extended_Advertising_Parameters_Command, ) from bumble.profiles.bap import ( @@ -115,7 +117,13 @@ async def main() -> None: ), ( AdvertisingData.FLAGS, - bytes([AdvertisingData.LE_GENERAL_DISCOVERABLE_MODE_FLAG]), + bytes( + [ + AdvertisingData.LE_GENERAL_DISCOVERABLE_MODE_FLAG + | AdvertisingData.BR_EDR_HOST_FLAG + | AdvertisingData.BR_EDR_CONTROLLER_FLAG + ] + ), ), ( AdvertisingData.INCOMPLETE_LIST_OF_16_BIT_SERVICE_CLASS_UUIDS, @@ -124,6 +132,41 @@ async def main() -> None: ] ) ) + subprocess = await asyncio.create_subprocess_shell( + f'dlc3 | ffplay pipe:0', + stdin=asyncio.subprocess.PIPE, + stdout=asyncio.subprocess.PIPE, + stderr=asyncio.subprocess.PIPE, + ) + + stdin = subprocess.stdin + assert stdin + + # Write a fake LC3 header to dlc3. + stdin.write( + bytes([0x1C, 0xCC]) # Header. + + struct.pack( + '