From 49e531ff4706279c7eed774f2c8b896942924ce2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 13 Apr 2015 19:18:00 +0200 Subject: [PATCH] mmal: Reference MMAL VC lib explicitly This is optional, but ensures that linking with -Wl,--as-needed does not drop the library containing the MMAL VC driver. The driver normally "registers" itself in the library constructor, but since no symbols are explicitly referenced, the linker could remove it with --as-needed enabled. Signed-off-by: Diego Biurrun --- libavcodec/mmaldec.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c index 1f29d2b6b2..76d26bcb9c 100644 --- a/libavcodec/mmaldec.c +++ b/libavcodec/mmaldec.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "avcodec.h" #include "internal.h" @@ -182,6 +183,8 @@ static av_cold int ffmmal_close_decoder(AVCodecContext *avctx) if (ctx->bsfc) av_bitstream_filter_close(ctx->bsfc); + mmal_vc_deinit(); + return 0; } @@ -321,6 +324,11 @@ static av_cold int ffmmal_init_decoder(AVCodecContext *avctx) bcm_host_init(); + if (mmal_vc_init()) { + av_log(avctx, AV_LOG_ERROR, "Cannot initialize MMAL VC driver!\n"); + return AVERROR(ENOSYS); + } + if ((ret = ff_get_format(avctx, avctx->codec->pix_fmts)) < 0) return ret;