From 0ca16775d9685e9b21b8a4098a968f97c34c4ba9 Mon Sep 17 00:00:00 2001 From: Frankenstone Date: Sun, 31 Jan 2021 18:16:08 +0100 Subject: [PATCH] libspark, libduckbox: rework audio_bypass Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/706891dec407f08aaaad689867165b9651a5b74c Author: Frankenstone Date: 2021-01-31 (Sun, 31 Jan 2021) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libspark/audio.cpp | 35 +++-------------------------------- libspark/audio_lib.h | 24 +++--------------------- 2 files changed, 6 insertions(+), 53 deletions(-) diff --git a/libspark/audio.cpp b/libspark/audio.cpp index 25a05a8..cb1951d 100644 --- a/libspark/audio.cpp +++ b/libspark/audio.cpp @@ -157,41 +157,12 @@ void cAudio::SetSyncMode(AVSYNC_TYPE Mode) ioctl(fd, AUDIO_SET_AV_SYNC, Mode); } -// E2 streamtype values. These correspond to -// player2/linux/drivers/media/dvb/stm/dvb/dvb_audio.c:AudioIoctlSetBypassMode -#define AUDIO_STREAMTYPE_AC3 0 -#define AUDIO_STREAMTYPE_MPEG 1 -#define AUDIO_STREAMTYPE_DTS 2 -#define AUDIO_STREAMTYPE_AAC 8 -#define AUDIO_STREAMTYPE_AACHE 9 - -void cAudio::SetStreamType(AUDIO_FORMAT type) +void cAudio::SetStreamType(int bypass) { - int bypass = AUDIO_STREAMTYPE_MPEG; - hal_debug("%s %d\n", __FUNCTION__, type); - StreamType = type; + StreamType = bypass; - switch (type) - { - case AUDIO_FMT_DD_PLUS: - case AUDIO_FMT_DOLBY_DIGITAL: - bypass = AUDIO_STREAMTYPE_AC3; - break; - case AUDIO_FMT_AAC: - bypass = AUDIO_STREAMTYPE_AAC; - break; - case AUDIO_FMT_AAC_PLUS: - bypass = AUDIO_STREAMTYPE_AACHE; - break; - case AUDIO_FMT_DTS: - bypass = AUDIO_STREAMTYPE_DTS; - break; - default: - break; - } + hal_info("%s %d (0x%x)\n", __FUNCTION__, bypass, bypass); - // Normaly the encoding should be set using AUDIO_SET_ENCODING - // But as we implemented the behavior to bypass (cause of e2) this is correct here if (ioctl(fd, AUDIO_SET_BYPASS_MODE, bypass) < 0) hal_info("%s: AUDIO_SET_BYPASS_MODE failed (%m)\n", __func__); } diff --git a/libspark/audio_lib.h b/libspark/audio_lib.h index dbcdd73..10a1412 100644 --- a/libspark/audio_lib.h +++ b/libspark/audio_lib.h @@ -18,24 +18,6 @@ typedef enum { HDMI_ENCODED_FORCED } HDMI_ENCODED_MODE; -typedef enum -{ - AUDIO_FMT_AUTO = 0, - AUDIO_FMT_MPEG, - AUDIO_FMT_MP3, - AUDIO_FMT_DOLBY_DIGITAL, - AUDIO_FMT_BASIC = AUDIO_FMT_DOLBY_DIGITAL, - AUDIO_FMT_AAC, - AUDIO_FMT_AAC_PLUS, - AUDIO_FMT_DD_PLUS, - AUDIO_FMT_DTS, - AUDIO_FMT_AVS, - AUDIO_FMT_MLP, - AUDIO_FMT_WMA, - AUDIO_FMT_MPG1, // TD only. For Movieplayer / cPlayback - AUDIO_FMT_ADVANCED = AUDIO_FMT_MLP -} AUDIO_FORMAT; - class mixerVolume; class cAudio @@ -49,7 +31,7 @@ class cAudio int mixer_fd; /* if we are using the OSS mixer */ int mixer_num; /* oss mixer to use, if any */ - AUDIO_FORMAT StreamType; + int StreamType; AUDIO_SYNC_MODE SyncMode; bool started; @@ -84,8 +66,8 @@ class cAudio int Start(void); int Stop(void); bool Pause(bool Pcm = true); - void SetStreamType(AUDIO_FORMAT type); - AUDIO_FORMAT GetStreamType(void) { return StreamType; } + void SetStreamType(int bypass); + int GetStreamType(void) { return StreamType; } void SetSyncMode(AVSYNC_TYPE Mode); /* select channels */