40#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
43typedef struct DSDDecContext {
44 struct SwrContext *swr;
46 unsigned scratch_size;
49#define PRIV_DATA_SIZE sizeof(DSDDecContext)
51#define PRIV_DATA_SIZE 0
61#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
71#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
95 for (
int ch = 0; ch <
channels; ch++) {
96 const uint8_t *plane =
src + ch * nb_samples;
97 for (
int i = 0;
i < nb_samples;
i++)
102 for (
int ch = 0; ch <
channels; ch++) {
103 const uint8_t *plane =
src + ch * nb_samples;
104 for (
int i = 0;
i < nb_samples;
i++)
114 int *got_frame_ptr,
AVPacket *avpkt)
124#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
138 (
const uint8_t *
const []){ s->scratch },
140 if (ret !=
frame->nb_samples)
154#define DSD_DECODER(id_, name_, long_name_) \
155const FFCodec ff_ ## name_ ## _decoder = { \
157 CODEC_LONG_NAME(long_name_), \
158 .p.type = AVMEDIA_TYPE_AUDIO, \
159 .p.id = AV_CODEC_ID_##id_, \
160 .priv_data_size = PRIV_DATA_SIZE, \
161 .init = decode_init, \
162 .close = decode_close, \
163 FF_CODEC_DECODE_CB(decode_frame), \
164 .p.capabilities = AV_CODEC_CAP_DR1, \
167DSD_DECODER(DSD_LSBF, dsd_lsbf,
"DSD (Direct Stream Digital), least significant bit first")
168DSD_DECODER(DSD_MSBF, dsd_msbf,
"DSD (Direct Stream Digital), most significant bit first")
169DSD_DECODER(DSD_MSBF_PLANAR, dsd_msbf_planar,
"DSD (Direct Stream Digital), most significant bit first, planar")
170DSD_DECODER(DSD_LSBF_PLANAR, dsd_lsbf_planar,
"DSD (Direct Stream Digital), least significant bit first, planar")
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Libavcodec external API header.
#define i(width, name, range_min, range_max)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int ff_dsd_to_pcm_init(struct AVCodecContext *avctx, struct SwrContext **swrp)
(Re)create a libswresample context converting AV_SAMPLE_FMT_DSD to avctx->sample_fmt at the same samp...
static int decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
static av_cold int decode_close(AVCodecContext *avctx)
static av_cold int decode_init(AVCodecContext *avctx)
#define DSD_DECODER(id_, name_, long_name_)
static void repack(AVCodecContext *avctx, uint8_t *dst, const uint8_t *src, int nb_samples)
@ AV_CODEC_ID_DSD_MSBF_PLANAR
@ AV_CODEC_ID_DSD_LSBF_PLANAR
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
@ AV_SAMPLE_FMT_FLTP
float, planar
@ AV_SAMPLE_FMT_DSD
DSD (Direct Stream Digital) bitstream, interleaved.
av_cold void swr_free(SwrContext **ss)
Free the given SwrContext and set the pointer to NULL.
int attribute_align_arg swr_convert(struct SwrContext *s, uint8_t *const *out_arg, int out_count, const uint8_t *const *in_arg, int in_count)
Convert audio.
const uint8_t ff_reverse[256]
Memory handling functions.
int nb_channels
Number of channels in this layout.
main external API structure.
AVChannelLayout ch_layout
Audio channel layout.
enum AVSampleFormat sample_fmt
audio sample format
enum AVSampleFormat request_sample_fmt
desired sample format
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
libswresample public header