mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2025-07-02 07:45:48 +00:00
Use moonlight-common-c definition for max channel count
This commit is contained in:
parent
d1937cb8e6
commit
4e09dccfc0
@ -20,6 +20,8 @@
|
|||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include <opus_multistream.h>
|
#include <opus_multistream.h>
|
||||||
#include <alsa/asoundlib.h>
|
#include <alsa/asoundlib.h>
|
||||||
|
|
||||||
@ -27,26 +29,23 @@
|
|||||||
|
|
||||||
static snd_pcm_t *handle;
|
static snd_pcm_t *handle;
|
||||||
static OpusMSDecoder* decoder;
|
static OpusMSDecoder* decoder;
|
||||||
static short pcmBuffer[FRAME_SIZE * MAX_CHANNEL_COUNT];
|
static short pcmBuffer[FRAME_SIZE * AUDIO_CONFIGURATION_MAX_CHANNEL_COUNT];
|
||||||
|
|
||||||
static int alsa_renderer_init(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, void* context, int arFlags) {
|
static int alsa_renderer_init(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, void* context, int arFlags) {
|
||||||
int rc;
|
int rc;
|
||||||
unsigned char alsaMapping[MAX_CHANNEL_COUNT];
|
unsigned char alsaMapping[AUDIO_CONFIGURATION_MAX_CHANNEL_COUNT];
|
||||||
|
|
||||||
/* The supplied mapping array has order: FL-FR-C-LFE-RL-RR-SL-SR
|
/* The supplied mapping array has order: FL-FR-C-LFE-RL-RR-SL-SR
|
||||||
* ALSA expects the order: FL-FR-RL-RR-C-LFE-SL-SR
|
* ALSA expects the order: FL-FR-RL-RR-C-LFE-SL-SR
|
||||||
* We need copy the mapping locally and swap the channels around.
|
* We need copy the mapping locally and swap the channels around.
|
||||||
*/
|
*/
|
||||||
alsaMapping[0] = opusConfig->mapping[0];
|
memcpy(alsaMapping, opusConfig->mapping, sizeof(alsaMapping));
|
||||||
alsaMapping[1] = opusConfig->mapping[1];
|
|
||||||
if (opusConfig->channelCount >= 6) {
|
if (opusConfig->channelCount >= 6) {
|
||||||
alsaMapping[2] = opusConfig->mapping[4];
|
alsaMapping[2] = opusConfig->mapping[4];
|
||||||
alsaMapping[3] = opusConfig->mapping[5];
|
alsaMapping[3] = opusConfig->mapping[5];
|
||||||
alsaMapping[4] = opusConfig->mapping[2];
|
alsaMapping[4] = opusConfig->mapping[2];
|
||||||
alsaMapping[5] = opusConfig->mapping[3];
|
alsaMapping[5] = opusConfig->mapping[3];
|
||||||
}
|
}
|
||||||
alsaMapping[6] = opusConfig->mapping[6];
|
|
||||||
alsaMapping[7] = opusConfig->mapping[7];
|
|
||||||
|
|
||||||
decoder = opus_multistream_decoder_create(opusConfig->sampleRate, opusConfig->channelCount, opusConfig->streams, opusConfig->coupledStreams, alsaMapping, &rc);
|
decoder = opus_multistream_decoder_create(opusConfig->sampleRate, opusConfig->channelCount, opusConfig->streams, opusConfig->coupledStreams, alsaMapping, &rc);
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
#include <Limelight.h>
|
#include <Limelight.h>
|
||||||
|
|
||||||
#define MAX_CHANNEL_COUNT 8
|
|
||||||
#define FRAME_SIZE 240
|
#define FRAME_SIZE 240
|
||||||
#define FRAME_BUFFER 12
|
#define FRAME_BUFFER 12
|
||||||
|
|
||||||
|
@ -29,18 +29,18 @@ static OpusMSDecoder* decoder;
|
|||||||
ILCLIENT_T* handle;
|
ILCLIENT_T* handle;
|
||||||
COMPONENT_T* component;
|
COMPONENT_T* component;
|
||||||
static OMX_BUFFERHEADERTYPE *buf;
|
static OMX_BUFFERHEADERTYPE *buf;
|
||||||
static short pcmBuffer[FRAME_SIZE * MAX_CHANNEL_COUNT];
|
static short pcmBuffer[FRAME_SIZE * AUDIO_CONFIGURATION_MAX_CHANNEL_COUNT];
|
||||||
static int channelCount;
|
static int channelCount;
|
||||||
|
|
||||||
static int omx_renderer_init(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, void* context, int arFlags) {
|
static int omx_renderer_init(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, void* context, int arFlags) {
|
||||||
int rc, error;
|
int rc, error;
|
||||||
OMX_ERRORTYPE err;
|
OMX_ERRORTYPE err;
|
||||||
unsigned char omxMapping[MAX_CHANNEL_COUNT];
|
unsigned char omxMapping[AUDIO_CONFIGURATION_MAX_CHANNEL_COUNT];
|
||||||
char* componentName = "audio_render";
|
char* componentName = "audio_render";
|
||||||
|
|
||||||
channelCount = opusConfig->channelCount;
|
channelCount = opusConfig->channelCount;
|
||||||
/* The supplied mapping array has order: FL-FR-C-LFE-RL-RR
|
/* The supplied mapping array has order: FL-FR-C-LFE-RL-RR-SL-SR
|
||||||
* OMX expects the order: FL-FR-LFE-C-RL-RR
|
* OMX expects the order: FL-FR-LFE-C-RL-RR-SL-SR
|
||||||
* We need copy the mapping locally and swap the channels around.
|
* We need copy the mapping locally and swap the channels around.
|
||||||
*/
|
*/
|
||||||
memcpy(omxMapping, opusConfig->mapping, sizeof(omxMapping));
|
memcpy(omxMapping, opusConfig->mapping, sizeof(omxMapping));
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include <opus_multistream.h>
|
#include <opus_multistream.h>
|
||||||
#include <pulse/simple.h>
|
#include <pulse/simple.h>
|
||||||
@ -28,7 +29,7 @@
|
|||||||
|
|
||||||
static OpusMSDecoder* decoder;
|
static OpusMSDecoder* decoder;
|
||||||
static pa_simple *dev = NULL;
|
static pa_simple *dev = NULL;
|
||||||
static short pcmBuffer[FRAME_SIZE * MAX_CHANNEL_COUNT];
|
static short pcmBuffer[FRAME_SIZE * AUDIO_CONFIGURATION_MAX_CHANNEL_COUNT];
|
||||||
static int channelCount;
|
static int channelCount;
|
||||||
|
|
||||||
bool audio_pulse_init(char* audio_device) {
|
bool audio_pulse_init(char* audio_device) {
|
||||||
@ -49,7 +50,7 @@ bool audio_pulse_init(char* audio_device) {
|
|||||||
|
|
||||||
static int pulse_renderer_init(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, void* context, int arFlags) {
|
static int pulse_renderer_init(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, void* context, int arFlags) {
|
||||||
int rc, error;
|
int rc, error;
|
||||||
unsigned char alsaMapping[MAX_CHANNEL_COUNT];
|
unsigned char alsaMapping[AUDIO_CONFIGURATION_MAX_CHANNEL_COUNT];
|
||||||
|
|
||||||
channelCount = opusConfig->channelCount;
|
channelCount = opusConfig->channelCount;
|
||||||
|
|
||||||
@ -57,16 +58,13 @@ static int pulse_renderer_init(int audioConfiguration, POPUS_MULTISTREAM_CONFIGU
|
|||||||
* ALSA expects the order: FL-FR-RL-RR-C-LFE-SL-SR
|
* ALSA expects the order: FL-FR-RL-RR-C-LFE-SL-SR
|
||||||
* We need copy the mapping locally and swap the channels around.
|
* We need copy the mapping locally and swap the channels around.
|
||||||
*/
|
*/
|
||||||
alsaMapping[0] = opusConfig->mapping[0];
|
memcpy(alsaMapping, opusConfig->mapping, sizeof(alsaMapping));
|
||||||
alsaMapping[1] = opusConfig->mapping[1];
|
|
||||||
if (opusConfig->channelCount >= 6) {
|
if (opusConfig->channelCount >= 6) {
|
||||||
alsaMapping[2] = opusConfig->mapping[4];
|
alsaMapping[2] = opusConfig->mapping[4];
|
||||||
alsaMapping[3] = opusConfig->mapping[5];
|
alsaMapping[3] = opusConfig->mapping[5];
|
||||||
alsaMapping[4] = opusConfig->mapping[2];
|
alsaMapping[4] = opusConfig->mapping[2];
|
||||||
alsaMapping[5] = opusConfig->mapping[3];
|
alsaMapping[5] = opusConfig->mapping[3];
|
||||||
}
|
}
|
||||||
alsaMapping[6] = opusConfig->mapping[6];
|
|
||||||
alsaMapping[7] = opusConfig->mapping[7];
|
|
||||||
|
|
||||||
decoder = opus_multistream_decoder_create(opusConfig->sampleRate, opusConfig->channelCount, opusConfig->streams, opusConfig->coupledStreams, alsaMapping, &rc);
|
decoder = opus_multistream_decoder_create(opusConfig->sampleRate, opusConfig->channelCount, opusConfig->streams, opusConfig->coupledStreams, alsaMapping, &rc);
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include <opus_multistream.h>
|
#include <opus_multistream.h>
|
||||||
|
|
||||||
static OpusMSDecoder* decoder;
|
static OpusMSDecoder* decoder;
|
||||||
static short pcmBuffer[FRAME_SIZE * MAX_CHANNEL_COUNT];
|
static short pcmBuffer[FRAME_SIZE * AUDIO_CONFIGURATION_MAX_CHANNEL_COUNT];
|
||||||
static SDL_AudioDeviceID dev;
|
static SDL_AudioDeviceID dev;
|
||||||
static int channelCount;
|
static int channelCount;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user