3 From: Martin Storsjö <martin@martin.st>
4 Date: Fri, 31 Aug 2018 11:25:30 +0000 (+0300)
5 Subject: libfdk-aacenc: Fix building with libfdk-aac v2
6 X-Git-Url: https://git.libav.org/?p=libav.git;a=commitdiff_plain;h=141c960e21d2860e354f9b90df136184dd00a9a8;hp=c8bca9fe466f810fd484e2c6db7ef7bc83b5a943
8 libfdk-aacenc: Fix building with libfdk-aac v2
10 When flushing the encoder, we now need to provide non-null buffer
11 parameters for everything, even if they are unused.
13 The encoderDelay parameter has been replaced by two, nDelay and
17 --- vlc-3.0.7.1/modules/codec/fdkaac.c.orig 2019-08-04 19:40:15.759796884 +0200
18 +++ vlc-3.0.7.1/modules/codec/fdkaac.c 2019-08-04 19:50:16.323210020 +0200
20 #include <vlc_plugin.h>
21 #include <vlc_codec.h>
23 +#define FDKENC_VER_AT_LEAST(vl0, vl1) \
24 + (defined(AACENCODER_LIB_VL0) && \
25 + ((AACENCODER_LIB_VL0 > vl0) || \
26 + (AACENCODER_LIB_VL0 == vl0 && AACENCODER_LIB_VL1 >= vl1)))
28 static int OpenEncoder(vlc_object_t *);
29 static void CloseEncoder(vlc_object_t *);
32 p_sys->i_maxoutputsize = 768*p_enc->fmt_in.audio.i_channels;
33 p_enc->fmt_in.audio.i_bitspersample = 16;
34 p_sys->i_frame_size = info.frameLength;
35 +#if FDKENC_VER_AT_LEAST(4, 0)
36 + p_sys->i_encoderdelay = info.nDelay;
38 p_sys->i_encoderdelay = info.encoderDelay;
41 p_enc->fmt_out.i_extra = info.confSize;
42 if (p_enc->fmt_out.i_extra) {
44 int out_identifier = OUT_BITSTREAM_DATA;
45 int out_size, out_elem_size;
46 void *in_ptr, *out_ptr;
49 if (unlikely(i_samples == 0)) {
50 + /* Must be a non-null pointer, even if it's a dummy. */
53 // this forces the encoder to purge whatever is left in the internal buffer
54 in_args.numInSamples = -1;
56 in_ptr = p_buffer + (i_samples - i_samples_left)*p_enc->fmt_in.audio.i_channels;
57 in_size = 2*p_enc->fmt_in.audio.i_channels*i_samples_left;
59 in_args.numInSamples = p_enc->fmt_in.audio.i_channels*i_samples_left;
61 - in_buf.bufs = &in_ptr;
62 - in_buf.bufferIdentifiers = &in_identifier;
63 - in_buf.bufSizes = &in_size;
64 - in_buf.bufElSizes = &in_elem_size;
68 + in_buf.bufs = &in_ptr;
69 + in_buf.bufferIdentifiers = &in_identifier;
70 + in_buf.bufSizes = &in_size;
71 + in_buf.bufElSizes = &in_elem_size;
74 p_block = block_Alloc(p_sys->i_maxoutputsize);
75 p_block->i_buffer = p_sys->i_maxoutputsize;