[FFmpeg-devel] [PATCH] avcodec: use HAVE_THREADS header guards to silence -Wunused-function

Ganesh Ajjanagadde gajjanagadde at gmail.com
Thu Sep 17 04:22:27 CEST 2015


When compiled with --disable-pthreads, e.g
http://fate.ffmpeg.org/report.cgi?time=20150917015044&slot=alpha-debian-qemu-gcc-4.7,
a bunch of -Wunused-functions are reported due to missing header guards
around threading related functions.
This patch should silence such warnings.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
---
 libavcodec/alac.c          | 2 ++
 libavcodec/exr.c           | 2 ++
 libavcodec/ffv1dec.c       | 4 ++++
 libavcodec/flacdec.c       | 2 ++
 libavcodec/h264.c          | 2 ++
 libavcodec/huffyuvdec.c    | 2 ++
 libavcodec/mdec.c          | 2 ++
 libavcodec/mimic.c         | 4 ++++
 libavcodec/mpeg12dec.c     | 2 ++
 libavcodec/mpeg4videodec.c | 2 ++
 libavcodec/pngdec.c        | 2 ++
 libavcodec/takdec.c        | 2 ++
 libavcodec/tta.c           | 2 ++
 libavcodec/vp3.c           | 4 ++++
 libavcodec/vp8.c           | 2 ++
 libavcodec/vp9.c           | 2 ++
 libavcodec/wavpack.c       | 2 ++
 17 files changed, 40 insertions(+)

diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index 827c0db..1842e7b 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -609,12 +609,14 @@ static av_cold int alac_decode_init(AVCodecContext * avctx)
     return 0;
 }
 
+#if HAVE_THREADS
 static int init_thread_copy(AVCodecContext *avctx)
 {
     ALACContext *alac = avctx->priv_data;
     alac->avctx = avctx;
     return allocate_buffers(alac);
 }
+#endif
 
 static const AVOption options[] = {
     { "extra_bits_bug", "Force non-standard decoding process",
diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 3b6b245..86a9908 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -1426,6 +1426,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     return 0;
 }
 
+#if HAVE_THREADS
 static int decode_init_thread_copy(AVCodecContext *avctx)
 {    EXRContext *s = avctx->priv_data;
 
@@ -1436,6 +1437,7 @@ static int decode_init_thread_copy(AVCodecContext *avctx)
 
     return 0;
 }
+#endif
 
 static av_cold int decode_end(AVCodecContext *avctx)
 {
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 557b1a0..e50d943 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -1008,6 +1008,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
     return buf_size;
 }
 
+#if HAVE_THREADS
 static int init_thread_copy(AVCodecContext *avctx)
 {
     FFV1Context *f = avctx->priv_data;
@@ -1032,6 +1033,7 @@ static int init_thread_copy(AVCodecContext *avctx)
 
     return 0;
 }
+#endif
 
 static void copy_fields(FFV1Context *fsdst, FFV1Context *fssrc, FFV1Context *fsrc)
 {
@@ -1061,6 +1063,7 @@ static void copy_fields(FFV1Context *fsdst, FFV1Context *fssrc, FFV1Context *fsr
     }
 }
 
+#if HAVE_THREADS
 static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
 {
     FFV1Context *fsrc = src->priv_data;
@@ -1104,6 +1107,7 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
 
     return 0;
 }
+#endif
 
 AVCodec ff_ffv1_decoder = {
     .name           = "ffv1",
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index 8653da7..126f4e0 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -623,6 +623,7 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
     return bytes_read;
 }
 
+#if HAVE_THREADS
 static int init_thread_copy(AVCodecContext *avctx)
 {
     FLACContext *s = avctx->priv_data;
@@ -633,6 +634,7 @@ static int init_thread_copy(AVCodecContext *avctx)
         return allocate_buffers(s);
     return 0;
 }
+#endif
 
 static av_cold int flac_decode_close(AVCodecContext *avctx)
 {
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index b797893..12fa5c0 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -701,6 +701,7 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
+#if HAVE_THREADS
 static int decode_init_thread_copy(AVCodecContext *avctx)
 {
     H264Context *h = avctx->priv_data;
@@ -719,6 +720,7 @@ static int decode_init_thread_copy(AVCodecContext *avctx)
 
     return 0;
 }
+#endif
 
 /**
  * Run setup operations that must be run after slice header decoding.
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index a700abb..7314519 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -571,6 +571,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     return ret;
 }
 
+#if HAVE_THREADS
 static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
 {
     HYuvContext *s = avctx->priv_data;
@@ -595,6 +596,7 @@ static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
 
     return 0;
 }
+#endif
 
 /** Subset of GET_VLC for use in hand-roller VLC code */
 #define VLC_INTERN(dst, table, gb, name, bits, max_depth)   \
diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c
index a9b7e82..1cc4ca4 100644
--- a/libavcodec/mdec.c
+++ b/libavcodec/mdec.c
@@ -233,6 +233,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     return 0;
 }
 
+#if HAVE_THREADS
 static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
 {
     MDECContext * const a = avctx->priv_data;
@@ -241,6 +242,7 @@ static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
 
     return 0;
 }
+#endif
 
 static av_cold int decode_end(AVCodecContext *avctx)
 {
diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c
index f5853b5..d3f9c07 100644
--- a/libavcodec/mimic.c
+++ b/libavcodec/mimic.c
@@ -167,6 +167,7 @@ static av_cold int mimic_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
+#if HAVE_THREADS
 static int mimic_decode_update_thread_context(AVCodecContext *avctx, const AVCodecContext *avctx_from)
 {
     MimicContext *dst = avctx->priv_data, *src = avctx_from->priv_data;
@@ -191,6 +192,7 @@ static int mimic_decode_update_thread_context(AVCodecContext *avctx, const AVCod
 
     return 0;
 }
+#endif
 
 static const int8_t vlcdec_lookup[9][64] = {
     {    0, },
@@ -454,6 +456,7 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
     return buf_size;
 }
 
+#if HAVE_THREADS
 static av_cold int mimic_init_thread_copy(AVCodecContext *avctx)
 {
     MimicContext *ctx = avctx->priv_data;
@@ -469,6 +472,7 @@ static av_cold int mimic_init_thread_copy(AVCodecContext *avctx)
 
     return 0;
 }
+#endif
 
 AVCodec ff_mimic_decoder = {
     .name                  = "mimic",
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 0731605..25b4952 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1145,6 +1145,7 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
+#if HAVE_THREADS
 static int mpeg_decode_update_thread_context(AVCodecContext *avctx,
                                              const AVCodecContext *avctx_from)
 {
@@ -1169,6 +1170,7 @@ static int mpeg_decode_update_thread_context(AVCodecContext *avctx,
 
     return 0;
 }
+#endif
 
 static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm,
                                  const uint8_t *new_perm)
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index f15747f..5c388c4 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -2688,6 +2688,7 @@ int ff_mpeg4_frame_end(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
     return 0;
 }
 
+#if HAVE_THREADS
 static int mpeg4_update_thread_context(AVCodecContext *dst,
                                        const AVCodecContext *src)
 {
@@ -2707,6 +2708,7 @@ static int mpeg4_update_thread_context(AVCodecContext *dst,
 
     return 0;
 }
+#endif
 
 static av_cold int decode_init(AVCodecContext *avctx)
 {
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index ee11f12..90b607e 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1338,6 +1338,7 @@ end:
 }
 #endif
 
+#if HAVE_THREADS
 static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
 {
     PNGDecContext *psrc = src->priv_data;
@@ -1385,6 +1386,7 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
 
     return 0;
 }
+#endif
 
 static av_cold int png_dec_init(AVCodecContext *avctx)
 {
diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c
index 2acdb92..5395596 100644
--- a/libavcodec/takdec.c
+++ b/libavcodec/takdec.c
@@ -908,6 +908,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
     return pkt->size;
 }
 
+#if HAVE_THREADS
 static int init_thread_copy(AVCodecContext *avctx)
 {
     TAKDecContext *s = avctx->priv_data;
@@ -926,6 +927,7 @@ static int update_thread_context(AVCodecContext *dst,
     memcpy(&tdst->ti, &tsrc->ti, sizeof(TAKStreamInfo));
     return 0;
 }
+#endif
 
 static av_cold int tak_decode_close(AVCodecContext *avctx)
 {
diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index 1e2e9c4..1ed90fe 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -387,6 +387,7 @@ error:
     return ret;
 }
 
+#if HAVE_THREADS
 static int init_thread_copy(AVCodecContext *avctx)
 {
     TTAContext *s = avctx->priv_data;
@@ -404,6 +405,7 @@ static av_cold int tta_decode_close(AVCodecContext *avctx) {
 
     return 0;
 }
+#endif
 
 #define OFFSET(x) offsetof(TTAContext, x)
 #define DEC (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM)
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 09e6f75..1e55474 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -1930,6 +1930,7 @@ static int ref_frames(Vp3DecodeContext *dst, Vp3DecodeContext *src)
     return 0;
 }
 
+#if HAVE_THREADS
 static int vp3_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
 {
     Vp3DecodeContext *s = dst->priv_data, *s1 = src->priv_data;
@@ -1989,6 +1990,7 @@ static int vp3_update_thread_context(AVCodecContext *dst, const AVCodecContext *
 
     return update_frames(dst);
 }
+#endif
 
 static int vp3_decode_frame(AVCodecContext *avctx,
                             void *data, int *got_frame,
@@ -2221,6 +2223,7 @@ static int read_huffman_tree(AVCodecContext *avctx, GetBitContext *gb)
     return 0;
 }
 
+#if HAVE_THREADS
 static int vp3_init_thread_copy(AVCodecContext *avctx)
 {
     Vp3DecodeContext *s = avctx->priv_data;
@@ -2237,6 +2240,7 @@ static int vp3_init_thread_copy(AVCodecContext *avctx)
 
     return init_frames(s);
 }
+#endif
 
 #if CONFIG_THEORA_DECODER
 static const enum AVPixelFormat theora_pix_fmts[4] = {
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 730871a..c6d2fca 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -2769,6 +2769,7 @@ av_cold int ff_vp8_decode_init(AVCodecContext *avctx)
 }
 
 #if CONFIG_VP8_DECODER
+#if HAVE_THREADS
 static av_cold int vp8_decode_init_thread_copy(AVCodecContext *avctx)
 {
     VP8Context *s = avctx->priv_data;
@@ -2819,6 +2820,7 @@ static int vp8_decode_update_thread_context(AVCodecContext *dst,
 
     return 0;
 }
+#endif /* HAVE_THREADS */
 #endif /* CONFIG_VP8_DECODER */
 
 #if CONFIG_VP7_DECODER
diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index f1183e8..ed0d905 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -4307,6 +4307,7 @@ static av_cold int vp9_decode_init(AVCodecContext *ctx)
     return init_frames(ctx);
 }
 
+#if HAVE_THREADS
 static av_cold int vp9_decode_init_thread_copy(AVCodecContext *avctx)
 {
     return init_frames(avctx);
@@ -4359,6 +4360,7 @@ static int vp9_decode_update_thread_context(AVCodecContext *dst, const AVCodecCo
 
     return 0;
 }
+#endif
 
 static const AVProfile profiles[] = {
     { FF_PROFILE_VP9_0, "Profile 0" },
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 9bafe65..d20556d 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -597,12 +597,14 @@ static av_cold int wv_alloc_frame_context(WavpackContext *c)
     return 0;
 }
 
+#if HAVE_THREADS
 static int init_thread_copy(AVCodecContext *avctx)
 {
     WavpackContext *s = avctx->priv_data;
     s->avctx = avctx;
     return 0;
 }
+#endif
 
 static av_cold int wavpack_decode_init(AVCodecContext *avctx)
 {
-- 
2.5.2



More information about the ffmpeg-devel mailing list