audiosink: Add support for DSD data

Code is partially based on the DSD of Robert Tiemann <rtie@gmx.de>:
https://gitlab.freedesktop.org/rtiemann/gstreamer/-/tree/dsd

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3901>
This commit is contained in:
Carlos Rafael Giani 2023-02-05 18:05:15 +01:00 committed by GStreamer Marge Bot
parent 7e7bf907d7
commit 8febc4102a

View file

@ -55,6 +55,7 @@
#include <string.h>
#include <gst/audio/audio.h>
#include <gst/audio/gstdsd.h>
#include "gstaudiosink.h"
#include "gstaudioutilsprivate.h"
@ -416,12 +417,18 @@ gst_audio_sink_ring_buffer_acquire (GstAudioRingBuffer * buf,
buf->memory = g_malloc (buf->size);
if (buf->spec.type == GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW) {
gst_audio_format_info_fill_silence (buf->spec.info.finfo, buf->memory,
buf->size);
} else {
/* FIXME, non-raw formats get 0 as the empty sample */
memset (buf->memory, 0, buf->size);
switch (buf->spec.type) {
case GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW:
gst_audio_format_info_fill_silence (buf->spec.info.finfo, buf->memory,
buf->size);
break;
case GST_AUDIO_RING_BUFFER_FORMAT_TYPE_DSD:
memset (buf->memory, GST_DSD_SILENCE_PATTERN_BYTE, buf->size);
break;
default:
/* FIXME, non-raw formats get 0 as the empty sample */
memset (buf->memory, 0, buf->size);
break;
}