Commit 2cbaa078 authored by Ganesh Ajjanagadde's avatar Ganesh Ajjanagadde Committed by Ronald S. Bultje

avcodec: use HAVE_THREADS header guards to silence -Wunused-function

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: 's avatarGanesh Ajjanagadde <gajjanagadde@gmail.com>
parent 26e8895b
...@@ -609,12 +609,14 @@ static av_cold int alac_decode_init(AVCodecContext * avctx) ...@@ -609,12 +609,14 @@ static av_cold int alac_decode_init(AVCodecContext * avctx)
return 0; return 0;
} }
#if HAVE_THREADS
static int init_thread_copy(AVCodecContext *avctx) static int init_thread_copy(AVCodecContext *avctx)
{ {
ALACContext *alac = avctx->priv_data; ALACContext *alac = avctx->priv_data;
alac->avctx = avctx; alac->avctx = avctx;
return allocate_buffers(alac); return allocate_buffers(alac);
} }
#endif
static const AVOption options[] = { static const AVOption options[] = {
{ "extra_bits_bug", "Force non-standard decoding process", { "extra_bits_bug", "Force non-standard decoding process",
......
...@@ -1426,6 +1426,7 @@ static av_cold int decode_init(AVCodecContext *avctx) ...@@ -1426,6 +1426,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
return 0; return 0;
} }
#if HAVE_THREADS
static int decode_init_thread_copy(AVCodecContext *avctx) static int decode_init_thread_copy(AVCodecContext *avctx)
{ EXRContext *s = avctx->priv_data; { EXRContext *s = avctx->priv_data;
...@@ -1436,6 +1437,7 @@ static int decode_init_thread_copy(AVCodecContext *avctx) ...@@ -1436,6 +1437,7 @@ static int decode_init_thread_copy(AVCodecContext *avctx)
return 0; return 0;
} }
#endif
static av_cold int decode_end(AVCodecContext *avctx) static av_cold int decode_end(AVCodecContext *avctx)
{ {
......
...@@ -1017,6 +1017,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac ...@@ -1017,6 +1017,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
return buf_size; return buf_size;
} }
#if HAVE_THREADS
static int init_thread_copy(AVCodecContext *avctx) static int init_thread_copy(AVCodecContext *avctx)
{ {
FFV1Context *f = avctx->priv_data; FFV1Context *f = avctx->priv_data;
...@@ -1042,6 +1043,7 @@ static int init_thread_copy(AVCodecContext *avctx) ...@@ -1042,6 +1043,7 @@ static int init_thread_copy(AVCodecContext *avctx)
return 0; return 0;
} }
#endif
static void copy_fields(FFV1Context *fsdst, FFV1Context *fssrc, FFV1Context *fsrc) static void copy_fields(FFV1Context *fsdst, FFV1Context *fssrc, FFV1Context *fsrc)
{ {
...@@ -1071,6 +1073,7 @@ static void copy_fields(FFV1Context *fsdst, FFV1Context *fssrc, FFV1Context *fsr ...@@ -1071,6 +1073,7 @@ static void copy_fields(FFV1Context *fsdst, FFV1Context *fssrc, FFV1Context *fsr
} }
} }
#if HAVE_THREADS
static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src) static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
{ {
FFV1Context *fsrc = src->priv_data; FFV1Context *fsrc = src->priv_data;
...@@ -1114,6 +1117,7 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src) ...@@ -1114,6 +1117,7 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
return 0; return 0;
} }
#endif
AVCodec ff_ffv1_decoder = { AVCodec ff_ffv1_decoder = {
.name = "ffv1", .name = "ffv1",
......
...@@ -623,6 +623,7 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data, ...@@ -623,6 +623,7 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
return bytes_read; return bytes_read;
} }
#if HAVE_THREADS
static int init_thread_copy(AVCodecContext *avctx) static int init_thread_copy(AVCodecContext *avctx)
{ {
FLACContext *s = avctx->priv_data; FLACContext *s = avctx->priv_data;
...@@ -633,6 +634,7 @@ static int init_thread_copy(AVCodecContext *avctx) ...@@ -633,6 +634,7 @@ static int init_thread_copy(AVCodecContext *avctx)
return allocate_buffers(s); return allocate_buffers(s);
return 0; return 0;
} }
#endif
static av_cold int flac_decode_close(AVCodecContext *avctx) static av_cold int flac_decode_close(AVCodecContext *avctx)
{ {
......
...@@ -701,6 +701,7 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx) ...@@ -701,6 +701,7 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
return 0; return 0;
} }
#if HAVE_THREADS
static int decode_init_thread_copy(AVCodecContext *avctx) static int decode_init_thread_copy(AVCodecContext *avctx)
{ {
H264Context *h = avctx->priv_data; H264Context *h = avctx->priv_data;
...@@ -719,6 +720,7 @@ static int decode_init_thread_copy(AVCodecContext *avctx) ...@@ -719,6 +720,7 @@ static int decode_init_thread_copy(AVCodecContext *avctx)
return 0; return 0;
} }
#endif
/** /**
* Run setup operations that must be run after slice header decoding. * Run setup operations that must be run after slice header decoding.
......
...@@ -571,6 +571,7 @@ static av_cold int decode_init(AVCodecContext *avctx) ...@@ -571,6 +571,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
return ret; return ret;
} }
#if HAVE_THREADS
static av_cold int decode_init_thread_copy(AVCodecContext *avctx) static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
{ {
HYuvContext *s = avctx->priv_data; HYuvContext *s = avctx->priv_data;
...@@ -595,6 +596,7 @@ static av_cold int decode_init_thread_copy(AVCodecContext *avctx) ...@@ -595,6 +596,7 @@ static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
return 0; return 0;
} }
#endif
/** Subset of GET_VLC for use in hand-roller VLC code */ /** Subset of GET_VLC for use in hand-roller VLC code */
#define VLC_INTERN(dst, table, gb, name, bits, max_depth) \ #define VLC_INTERN(dst, table, gb, name, bits, max_depth) \
......
...@@ -233,6 +233,7 @@ static av_cold int decode_init(AVCodecContext *avctx) ...@@ -233,6 +233,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
return 0; return 0;
} }
#if HAVE_THREADS
static av_cold int decode_init_thread_copy(AVCodecContext *avctx) static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
{ {
MDECContext * const a = avctx->priv_data; MDECContext * const a = avctx->priv_data;
...@@ -241,6 +242,7 @@ static av_cold int decode_init_thread_copy(AVCodecContext *avctx) ...@@ -241,6 +242,7 @@ static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
return 0; return 0;
} }
#endif
static av_cold int decode_end(AVCodecContext *avctx) static av_cold int decode_end(AVCodecContext *avctx)
{ {
......
...@@ -167,6 +167,7 @@ static av_cold int mimic_decode_init(AVCodecContext *avctx) ...@@ -167,6 +167,7 @@ static av_cold int mimic_decode_init(AVCodecContext *avctx)
return 0; return 0;
} }
#if HAVE_THREADS
static int mimic_decode_update_thread_context(AVCodecContext *avctx, const AVCodecContext *avctx_from) static int mimic_decode_update_thread_context(AVCodecContext *avctx, const AVCodecContext *avctx_from)
{ {
MimicContext *dst = avctx->priv_data, *src = avctx_from->priv_data; 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 ...@@ -191,6 +192,7 @@ static int mimic_decode_update_thread_context(AVCodecContext *avctx, const AVCod
return 0; return 0;
} }
#endif
static const int8_t vlcdec_lookup[9][64] = { static const int8_t vlcdec_lookup[9][64] = {
{ 0, }, { 0, },
...@@ -454,6 +456,7 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data, ...@@ -454,6 +456,7 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
return buf_size; return buf_size;
} }
#if HAVE_THREADS
static av_cold int mimic_init_thread_copy(AVCodecContext *avctx) static av_cold int mimic_init_thread_copy(AVCodecContext *avctx)
{ {
MimicContext *ctx = avctx->priv_data; MimicContext *ctx = avctx->priv_data;
...@@ -469,6 +472,7 @@ static av_cold int mimic_init_thread_copy(AVCodecContext *avctx) ...@@ -469,6 +472,7 @@ static av_cold int mimic_init_thread_copy(AVCodecContext *avctx)
return 0; return 0;
} }
#endif
AVCodec ff_mimic_decoder = { AVCodec ff_mimic_decoder = {
.name = "mimic", .name = "mimic",
......
...@@ -1139,6 +1139,7 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx) ...@@ -1139,6 +1139,7 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx)
return 0; return 0;
} }
#if HAVE_THREADS
static int mpeg_decode_update_thread_context(AVCodecContext *avctx, static int mpeg_decode_update_thread_context(AVCodecContext *avctx,
const AVCodecContext *avctx_from) const AVCodecContext *avctx_from)
{ {
...@@ -1163,6 +1164,7 @@ static int mpeg_decode_update_thread_context(AVCodecContext *avctx, ...@@ -1163,6 +1164,7 @@ static int mpeg_decode_update_thread_context(AVCodecContext *avctx,
return 0; return 0;
} }
#endif
static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm, static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm,
const uint8_t *new_perm) const uint8_t *new_perm)
......
...@@ -2688,6 +2688,7 @@ int ff_mpeg4_frame_end(AVCodecContext *avctx, const uint8_t *buf, int buf_size) ...@@ -2688,6 +2688,7 @@ int ff_mpeg4_frame_end(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
return 0; return 0;
} }
#if HAVE_THREADS
static int mpeg4_update_thread_context(AVCodecContext *dst, static int mpeg4_update_thread_context(AVCodecContext *dst,
const AVCodecContext *src) const AVCodecContext *src)
{ {
...@@ -2707,6 +2708,7 @@ static int mpeg4_update_thread_context(AVCodecContext *dst, ...@@ -2707,6 +2708,7 @@ static int mpeg4_update_thread_context(AVCodecContext *dst,
return 0; return 0;
} }
#endif
static av_cold int decode_init(AVCodecContext *avctx) static av_cold int decode_init(AVCodecContext *avctx)
{ {
......
...@@ -1340,6 +1340,7 @@ end: ...@@ -1340,6 +1340,7 @@ end:
} }
#endif #endif
#if HAVE_THREADS
static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src) static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
{ {
PNGDecContext *psrc = src->priv_data; PNGDecContext *psrc = src->priv_data;
...@@ -1387,6 +1388,7 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src) ...@@ -1387,6 +1388,7 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
return 0; return 0;
} }
#endif
static av_cold int png_dec_init(AVCodecContext *avctx) static av_cold int png_dec_init(AVCodecContext *avctx)
{ {
......
...@@ -908,6 +908,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data, ...@@ -908,6 +908,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
return pkt->size; return pkt->size;
} }
#if HAVE_THREADS
static int init_thread_copy(AVCodecContext *avctx) static int init_thread_copy(AVCodecContext *avctx)
{ {
TAKDecContext *s = avctx->priv_data; TAKDecContext *s = avctx->priv_data;
...@@ -926,6 +927,7 @@ static int update_thread_context(AVCodecContext *dst, ...@@ -926,6 +927,7 @@ static int update_thread_context(AVCodecContext *dst,
memcpy(&tdst->ti, &tsrc->ti, sizeof(TAKStreamInfo)); memcpy(&tdst->ti, &tsrc->ti, sizeof(TAKStreamInfo));
return 0; return 0;
} }
#endif
static av_cold int tak_decode_close(AVCodecContext *avctx) static av_cold int tak_decode_close(AVCodecContext *avctx)
{ {
......
...@@ -387,6 +387,7 @@ error: ...@@ -387,6 +387,7 @@ error:
return ret; return ret;
} }
#if HAVE_THREADS
static int init_thread_copy(AVCodecContext *avctx) static int init_thread_copy(AVCodecContext *avctx)
{ {
TTAContext *s = avctx->priv_data; TTAContext *s = avctx->priv_data;
...@@ -404,6 +405,7 @@ static av_cold int tta_decode_close(AVCodecContext *avctx) { ...@@ -404,6 +405,7 @@ static av_cold int tta_decode_close(AVCodecContext *avctx) {
return 0; return 0;
} }
#endif
#define OFFSET(x) offsetof(TTAContext, x) #define OFFSET(x) offsetof(TTAContext, x)
#define DEC (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM) #define DEC (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM)
......
...@@ -1930,6 +1930,7 @@ static int ref_frames(Vp3DecodeContext *dst, Vp3DecodeContext *src) ...@@ -1930,6 +1930,7 @@ static int ref_frames(Vp3DecodeContext *dst, Vp3DecodeContext *src)
return 0; return 0;
} }
#if HAVE_THREADS
static int vp3_update_thread_context(AVCodecContext *dst, const AVCodecContext *src) static int vp3_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
{ {
Vp3DecodeContext *s = dst->priv_data, *s1 = src->priv_data; Vp3DecodeContext *s = dst->priv_data, *s1 = src->priv_data;
...@@ -1989,6 +1990,7 @@ static int vp3_update_thread_context(AVCodecContext *dst, const AVCodecContext * ...@@ -1989,6 +1990,7 @@ static int vp3_update_thread_context(AVCodecContext *dst, const AVCodecContext *
return update_frames(dst); return update_frames(dst);
} }
#endif
static int vp3_decode_frame(AVCodecContext *avctx, static int vp3_decode_frame(AVCodecContext *avctx,
void *data, int *got_frame, void *data, int *got_frame,
...@@ -2221,6 +2223,7 @@ static int read_huffman_tree(AVCodecContext *avctx, GetBitContext *gb) ...@@ -2221,6 +2223,7 @@ static int read_huffman_tree(AVCodecContext *avctx, GetBitContext *gb)
return 0; return 0;
} }
#if HAVE_THREADS
static int vp3_init_thread_copy(AVCodecContext *avctx) static int vp3_init_thread_copy(AVCodecContext *avctx)
{ {
Vp3DecodeContext *s = avctx->priv_data; Vp3DecodeContext *s = avctx->priv_data;
...@@ -2237,6 +2240,7 @@ static int vp3_init_thread_copy(AVCodecContext *avctx) ...@@ -2237,6 +2240,7 @@ static int vp3_init_thread_copy(AVCodecContext *avctx)
return init_frames(s); return init_frames(s);
} }
#endif
#if CONFIG_THEORA_DECODER #if CONFIG_THEORA_DECODER
static const enum AVPixelFormat theora_pix_fmts[4] = { static const enum AVPixelFormat theora_pix_fmts[4] = {
......
...@@ -2769,6 +2769,7 @@ av_cold int ff_vp8_decode_init(AVCodecContext *avctx) ...@@ -2769,6 +2769,7 @@ av_cold int ff_vp8_decode_init(AVCodecContext *avctx)
} }
#if CONFIG_VP8_DECODER #if CONFIG_VP8_DECODER
#if HAVE_THREADS
static av_cold int vp8_decode_init_thread_copy(AVCodecContext *avctx) static av_cold int vp8_decode_init_thread_copy(AVCodecContext *avctx)
{ {
VP8Context *s = avctx->priv_data; VP8Context *s = avctx->priv_data;
...@@ -2819,6 +2820,7 @@ static int vp8_decode_update_thread_context(AVCodecContext *dst, ...@@ -2819,6 +2820,7 @@ static int vp8_decode_update_thread_context(AVCodecContext *dst,
return 0; return 0;
} }
#endif /* HAVE_THREADS */
#endif /* CONFIG_VP8_DECODER */ #endif /* CONFIG_VP8_DECODER */
#if CONFIG_VP7_DECODER #if CONFIG_VP7_DECODER
......
...@@ -4307,6 +4307,7 @@ static av_cold int vp9_decode_init(AVCodecContext *ctx) ...@@ -4307,6 +4307,7 @@ static av_cold int vp9_decode_init(AVCodecContext *ctx)
return init_frames(ctx); return init_frames(ctx);
} }
#if HAVE_THREADS
static av_cold int vp9_decode_init_thread_copy(AVCodecContext *avctx) static av_cold int vp9_decode_init_thread_copy(AVCodecContext *avctx)
{ {
return init_frames(avctx); return init_frames(avctx);
...@@ -4359,6 +4360,7 @@ static int vp9_decode_update_thread_context(AVCodecContext *dst, const AVCodecCo ...@@ -4359,6 +4360,7 @@ static int vp9_decode_update_thread_context(AVCodecContext *dst, const AVCodecCo
return 0; return 0;
} }
#endif
static const AVProfile profiles[] = { static const AVProfile profiles[] = {
{ FF_PROFILE_VP9_0, "Profile 0" }, { FF_PROFILE_VP9_0, "Profile 0" },
......
...@@ -597,12 +597,14 @@ static av_cold int wv_alloc_frame_context(WavpackContext *c) ...@@ -597,12 +597,14 @@ static av_cold int wv_alloc_frame_context(WavpackContext *c)
return 0; return 0;
} }
#if HAVE_THREADS
static int init_thread_copy(AVCodecContext *avctx) static int init_thread_copy(AVCodecContext *avctx)
{ {
WavpackContext *s = avctx->priv_data; WavpackContext *s = avctx->priv_data;
s->avctx = avctx; s->avctx = avctx;
return 0; return 0;
} }
#endif
static av_cold int wavpack_decode_init(AVCodecContext *avctx) static av_cold int wavpack_decode_init(AVCodecContext *avctx)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment