mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 23:13:16 +02:00
rework audio_bypass
This commit is contained in:
@@ -160,39 +160,12 @@ void cAudio::SetSyncMode(AVSYNC_TYPE Mode)
|
|||||||
ioctl(fd, AUDIO_SET_AV_SYNC, Mode);
|
ioctl(fd, AUDIO_SET_AV_SYNC, Mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define AUDIO_STREAMTYPE_AC3 0
|
void cAudio::SetStreamType(int bypass)
|
||||||
#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)
|
|
||||||
{
|
{
|
||||||
int bypass = AUDIO_STREAMTYPE_MPEG;
|
StreamType = bypass;
|
||||||
hal_debug("%s %d\n", __FUNCTION__, type);
|
|
||||||
StreamType = type;
|
|
||||||
|
|
||||||
switch (type)
|
hal_info("%s %d (0x%x)\n", __FUNCTION__, bypass, bypass);
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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)
|
if (ioctl(fd, AUDIO_SET_BYPASS_MODE, bypass) < 0)
|
||||||
hal_info("%s: AUDIO_SET_BYPASS_MODE failed (%m)\n", __func__);
|
hal_info("%s: AUDIO_SET_BYPASS_MODE failed (%m)\n", __func__);
|
||||||
}
|
}
|
||||||
|
@@ -18,24 +18,6 @@ typedef enum {
|
|||||||
HDMI_ENCODED_FORCED
|
HDMI_ENCODED_FORCED
|
||||||
} HDMI_ENCODED_MODE;
|
} 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 mixerVolume;
|
||||||
|
|
||||||
class cAudio
|
class cAudio
|
||||||
@@ -49,7 +31,7 @@ class cAudio
|
|||||||
int mixer_fd; /* if we are using the OSS mixer */
|
int mixer_fd; /* if we are using the OSS mixer */
|
||||||
int mixer_num; /* oss mixer to use, if any */
|
int mixer_num; /* oss mixer to use, if any */
|
||||||
|
|
||||||
AUDIO_FORMAT StreamType;
|
int StreamType;
|
||||||
AUDIO_SYNC_MODE SyncMode;
|
AUDIO_SYNC_MODE SyncMode;
|
||||||
bool started;
|
bool started;
|
||||||
|
|
||||||
@@ -80,8 +62,8 @@ class cAudio
|
|||||||
int Start(void);
|
int Start(void);
|
||||||
int Stop(void);
|
int Stop(void);
|
||||||
bool Pause(bool Pcm = true);
|
bool Pause(bool Pcm = true);
|
||||||
void SetStreamType(AUDIO_FORMAT type);
|
void SetStreamType(int bypass);
|
||||||
AUDIO_FORMAT GetStreamType(void) { return StreamType; }
|
int GetStreamType(void) { return StreamType; }
|
||||||
void SetSyncMode(AVSYNC_TYPE Mode);
|
void SetSyncMode(AVSYNC_TYPE Mode);
|
||||||
|
|
||||||
/* select channels */
|
/* select channels */
|
||||||
|
@@ -157,39 +157,12 @@ void cAudio::SetSyncMode(AVSYNC_TYPE Mode)
|
|||||||
ioctl(fd, AUDIO_SET_AV_SYNC, Mode);
|
ioctl(fd, AUDIO_SET_AV_SYNC, Mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define AUDIO_STREAMTYPE_AC3 0
|
void cAudio::SetStreamType(int bypass)
|
||||||
#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)
|
|
||||||
{
|
{
|
||||||
int bypass = AUDIO_STREAMTYPE_MPEG;
|
StreamType = bypass;
|
||||||
hal_debug("%s %d\n", __FUNCTION__, type);
|
|
||||||
StreamType = type;
|
|
||||||
|
|
||||||
switch (type)
|
hal_info("%s %d (0x%x)\n", __FUNCTION__, bypass, bypass);
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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)
|
if (ioctl(fd, AUDIO_SET_BYPASS_MODE, bypass) < 0)
|
||||||
hal_info("%s: AUDIO_SET_BYPASS_MODE failed (%m)\n", __func__);
|
hal_info("%s: AUDIO_SET_BYPASS_MODE failed (%m)\n", __func__);
|
||||||
}
|
}
|
||||||
|
@@ -18,24 +18,6 @@ typedef enum {
|
|||||||
HDMI_ENCODED_FORCED
|
HDMI_ENCODED_FORCED
|
||||||
} HDMI_ENCODED_MODE;
|
} 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 mixerVolume;
|
||||||
|
|
||||||
class cAudio
|
class cAudio
|
||||||
@@ -49,7 +31,7 @@ class cAudio
|
|||||||
int mixer_fd; /* if we are using the OSS mixer */
|
int mixer_fd; /* if we are using the OSS mixer */
|
||||||
int mixer_num; /* oss mixer to use, if any */
|
int mixer_num; /* oss mixer to use, if any */
|
||||||
|
|
||||||
AUDIO_FORMAT StreamType;
|
int StreamType;
|
||||||
AUDIO_SYNC_MODE SyncMode;
|
AUDIO_SYNC_MODE SyncMode;
|
||||||
bool started;
|
bool started;
|
||||||
|
|
||||||
@@ -80,8 +62,8 @@ class cAudio
|
|||||||
int Start(void);
|
int Start(void);
|
||||||
int Stop(void);
|
int Stop(void);
|
||||||
bool Pause(bool Pcm = true);
|
bool Pause(bool Pcm = true);
|
||||||
void SetStreamType(AUDIO_FORMAT type);
|
void SetStreamType(int bypass);
|
||||||
AUDIO_FORMAT GetStreamType(void) { return StreamType; }
|
int GetStreamType(void) { return StreamType; }
|
||||||
void SetSyncMode(AVSYNC_TYPE Mode);
|
void SetSyncMode(AVSYNC_TYPE Mode);
|
||||||
|
|
||||||
/* select channels */
|
/* select channels */
|
||||||
|
Reference in New Issue
Block a user