Toshaan Bharvani
12 months ago
4 changed files with 966 additions and 502 deletions
@ -0,0 +1,84 @@ |
|||||||
|
From 6ea9b13fe82fae2b25b7371c6c36d6296db28ccb Mon Sep 17 00:00:00 2001 |
||||||
|
From: Antonio Larrosa <antonio.larrosa@gmail.com> |
||||||
|
Date: Thu, 14 Feb 2019 10:09:30 +0100 |
||||||
|
Subject: [PATCH] Fix building vlc with libfdk-aac v2 |
||||||
|
|
||||||
|
When flushing the encoder, we now need to provide non-null buffer |
||||||
|
parameters for everything, even if they are unused. |
||||||
|
|
||||||
|
The encoderDelay parameter has been replaced by two, nDelay and |
||||||
|
nDelayCore. |
||||||
|
|
||||||
|
This is based on: |
||||||
|
https://git.libav.org/?p=libav.git;a=commitdiff_plain;h=141c960e21d2860e354f9b90df136184dd00a9a8;hp=c8bca9fe466f810fd484e2c6db7ef7bc83b5a943 |
||||||
|
|
||||||
|
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org> |
||||||
|
--- |
||||||
|
modules/codec/fdkaac.c | 27 +++++++++++++++++++++------ |
||||||
|
1 file changed, 21 insertions(+), 6 deletions(-) |
||||||
|
|
||||||
|
diff --git a/modules/codec/fdkaac.c b/modules/codec/fdkaac.c |
||||||
|
index e0b3088c4a..3ac7b756a3 100644 |
||||||
|
--- a/modules/codec/fdkaac.c |
||||||
|
+++ b/modules/codec/fdkaac.c |
||||||
|
@@ -92,6 +92,11 @@ static void CloseEncoder(vlc_object_t *); |
||||||
|
#define SIGNALING_COMPATIBLE 1 |
||||||
|
#define SIGNALING_HIERARCHICAL 2 |
||||||
|
|
||||||
|
+#define FDKENC_VER_AT_LEAST(vl0, vl1) \ |
||||||
|
+ (defined(AACENCODER_LIB_VL0) && \ |
||||||
|
+ ((AACENCODER_LIB_VL0 > vl0) || \ |
||||||
|
+ (AACENCODER_LIB_VL0 == vl0 && AACENCODER_LIB_VL1 >= vl1))) |
||||||
|
+ |
||||||
|
static const int pi_aot_values[] = { PROFILE_AAC_LC, PROFILE_AAC_HE, PROFILE_AAC_HE_v2, PROFILE_AAC_LD, PROFILE_AAC_ELD }; |
||||||
|
static const char *const ppsz_aot_descriptions[] = |
||||||
|
{ N_("AAC-LC"), N_("HE-AAC"), N_("HE-AAC-v2"), N_("AAC-LD"), N_("AAC-ELD") }; |
||||||
|
@@ -288,7 +293,11 @@ static int OpenEncoder(vlc_object_t *p_this) |
||||||
|
p_sys->i_maxoutputsize = 768*p_enc->fmt_in.audio.i_channels; |
||||||
|
p_enc->fmt_in.audio.i_bitspersample = 16; |
||||||
|
p_sys->i_frame_size = info.frameLength; |
||||||
|
+#if FDKENC_VER_AT_LEAST(4, 0) |
||||||
|
+ p_sys->i_encoderdelay = info.nDelay; |
||||||
|
+#else |
||||||
|
p_sys->i_encoderdelay = info.encoderDelay; |
||||||
|
+#endif |
||||||
|
|
||||||
|
p_enc->fmt_out.i_extra = info.confSize; |
||||||
|
if (p_enc->fmt_out.i_extra) { |
||||||
|
@@ -351,21 +360,27 @@ static block_t *EncodeAudio(encoder_t *p_enc, block_t *p_aout_buf) |
||||||
|
int out_identifier = OUT_BITSTREAM_DATA; |
||||||
|
int out_size, out_elem_size; |
||||||
|
void *in_ptr, *out_ptr; |
||||||
|
+ uint8_t dummy_buf[1]; |
||||||
|
|
||||||
|
if (unlikely(i_samples == 0)) { |
||||||
|
// this forces the encoder to purge whatever is left in the internal buffer |
||||||
|
+ /* Must be a non-null pointer, even if it's a dummy. We could use |
||||||
|
+ * the address of anything else on the stack as well. */ |
||||||
|
+ in_ptr = dummy_buf; |
||||||
|
+ in_size = 0; |
||||||
|
+ |
||||||
|
in_args.numInSamples = -1; |
||||||
|
} else { |
||||||
|
in_ptr = p_buffer + (i_samples - i_samples_left)*p_enc->fmt_in.audio.i_channels; |
||||||
|
in_size = 2*p_enc->fmt_in.audio.i_channels*i_samples_left; |
||||||
|
- in_elem_size = 2; |
||||||
|
in_args.numInSamples = p_enc->fmt_in.audio.i_channels*i_samples_left; |
||||||
|
- in_buf.numBufs = 1; |
||||||
|
- in_buf.bufs = &in_ptr; |
||||||
|
- in_buf.bufferIdentifiers = &in_identifier; |
||||||
|
- in_buf.bufSizes = &in_size; |
||||||
|
- in_buf.bufElSizes = &in_elem_size; |
||||||
|
} |
||||||
|
+ in_elem_size = 2; |
||||||
|
+ in_buf.numBufs = 1; |
||||||
|
+ in_buf.bufs = &in_ptr; |
||||||
|
+ in_buf.bufferIdentifiers = &in_identifier; |
||||||
|
+ in_buf.bufSizes = &in_size; |
||||||
|
+ in_buf.bufElSizes = &in_elem_size; |
||||||
|
block_t *p_block; |
||||||
|
p_block = block_Alloc(p_sys->i_maxoutputsize); |
||||||
|
p_block->i_buffer = p_sys->i_maxoutputsize; |
||||||
|
-- |
||||||
|
2.11.0 |
||||||
|
|
@ -0,0 +1,18 @@ |
|||||||
|
avcodec_vaapi requires ffmpeg-4, but other vaapi modules can be built |
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac |
||||||
|
index 69beb77..c7f7142 100644 |
||||||
|
--- a/configure.ac |
||||||
|
+++ b/configure.ac |
||||||
|
@@ -2454,9 +2454,9 @@ AS_IF([test "${have_vaapi}" = "yes" -a "${have_avcodec}" = "yes"], [ |
||||||
|
have_avcodec_vaapi="yes" |
||||||
|
],[ |
||||||
|
AS_IF([test -n "${enable_libva}"], [ |
||||||
|
- AC_MSG_ERROR([libva is present but libavcodec/vaapi.h is missing]) |
||||||
|
+ AC_MSG_WARN([libva is present but libavcodec/vaapi.h is missing]) |
||||||
|
], [ |
||||||
|
- AC_MSG_WARN([libva is present but libavcodec/vaapi.h is missing ]) |
||||||
|
+ AC_MSG_NOTICE([libva is present but libavcodec/vaapi.h is missing ]) |
||||||
|
]) |
||||||
|
]) |
||||||
|
VLC_RESTORE_FLAGS |
Loading…
Reference in new issue