MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / decode_init

Function decode_init

libavcodec/dsddec.c:44–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42 */
43
44static av_cold int decode_init(AVCodecContext *avctx)
45{
46 DSDContext * s;
47 int i;
48 uint8_t silence;
49
50 if (!avctx->ch_layout.nb_channels)
51 return AVERROR_INVALIDDATA;
52
53 ff_init_dsd_data();
54
55 s = av_malloc_array(avctx->ch_layout.nb_channels, sizeof(*s));
56 if (!s)
57 return AVERROR(ENOMEM);
58
59 silence = avctx->codec_id == AV_CODEC_ID_DSD_LSBF_PLANAR ||
60 avctx->codec_id == AV_CODEC_ID_DSD_LSBF ? DSD_SILENCE_REVERSED : DSD_SILENCE;
61 for (i = 0; i < avctx->ch_layout.nb_channels; i++) {
62 s[i].pos = 0;
63 memset(s[i].buf, silence, sizeof(s[i].buf));
64 }
65
66 avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
67 avctx->priv_data = s;
68 return 0;
69}
70
71typedef struct ThreadData {
72 AVFrame *frame;

Callers

nothing calls this directly

Calls 2

ff_init_dsd_dataFunction · 0.85
av_malloc_arrayFunction · 0.85

Tested by

no test coverage detected