Added automatic format support filter.

This commit is contained in:
Armin Novak 2018-07-02 16:33:50 +02:00
parent 30283e18e5
commit 73b8963d14
1 changed files with 19 additions and 4 deletions

View File

@ -21,6 +21,8 @@
#endif
#include <freerdp/log.h>
#include <freerdp/codec/dsp.h>
#include "shadow.h"
#include "shadow_rdpsnd.h"
@ -30,9 +32,13 @@
/* Default supported audio formats */
static const AUDIO_FORMAT default_supported_audio_formats[] =
{
{ WAVE_FORMAT_AAC_MS, 2, 44100, 176400, 4, 16, 0, NULL },
{ WAVE_FORMAT_MPEGLAYER3, 2, 44100, 176400, 4, 16, 0, NULL },
{ WAVE_FORMAT_GSM610, 2, 44100, 176400, 4, 16, 0, NULL },
{ WAVE_FORMAT_PCM, 2, 44100, 176400, 4, 16, 0, NULL },
{ WAVE_FORMAT_ALAW, 2, 22050, 44100, 2, 8, 0, NULL }
{ WAVE_FORMAT_ALAW, 2, 22050, 44100, 2, 8, 0, NULL },
};
static AUDIO_FORMAT supported_audio_formats[ARRAYSIZE(default_supported_audio_formats)] = { 0 };
static void rdpsnd_activated(RdpsndServerContext* context)
{
@ -84,10 +90,19 @@ int shadow_client_rdpsnd_init(rdpShadowClient* client)
}
else
{
size_t x, y = 0;
for (x = 0; x < ARRAYSIZE(default_supported_audio_formats); x++)
{
const AUDIO_FORMAT* format = &default_supported_audio_formats[x];
if (freerdp_dsp_supports_format(format, TRUE))
supported_audio_formats[y++] = *format;
}
/* Set default audio formats. */
rdpsnd->server_formats = default_supported_audio_formats;
rdpsnd->num_server_formats =
sizeof(default_supported_audio_formats) / sizeof(default_supported_audio_formats[0]);
rdpsnd->server_formats = supported_audio_formats;
rdpsnd->num_server_formats = y;
}
rdpsnd->src_format = rdpsnd->server_formats[0];