From b7e64fba7f37cc0399beae844f0a5dbef9219376 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 4 May 2016 00:15:41 +0200 Subject: Reduce the scope of some variables This avoids unused variable warnings after the next version bump. Also drop a trace level av_log() call that is in the way. --- libavcodec/dvbsubdec.c | 4 +++- libavcodec/dvdsubdec.c | 6 ++++-- libavcodec/mpegvideo_enc.c | 4 ++-- libavcodec/pgssubdec.c | 6 ++++-- libavcodec/xsubdec.c | 6 ++++-- libavdevice/v4l2.c | 2 +- libavformat/mux.c | 2 +- 7 files changed, 19 insertions(+), 11 deletions(-) diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index be68c58516..526f125262 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -1350,7 +1350,6 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf, i = 0; for (display = ctx->display_list; display; display = display->next) { - int j; region = get_region(ctx, display->region_id); rect = sub->rects[i]; @@ -1400,10 +1399,13 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf, #if FF_API_AVPICTURE FF_DISABLE_DEPRECATION_WARNINGS +{ + int j; for (j = 0; j < 4; j++) { rect->pict.data[j] = rect->data[j]; rect->pict.linesize[j] = rect->linesize[j]; } +} FF_ENABLE_DEPRECATION_WARNINGS #endif diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c index da1a83f812..6e55a09bc2 100644 --- a/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c @@ -318,8 +318,6 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header, if (h < 0) h = 0; if (w > 0 && h > 0) { - int j; - AVSubtitleRect *rect; if (sub_header->rects) { for (i = 0; i < sub_header->num_rects; i++) { av_freep(&sub_header->rects[i]->data[0]); @@ -369,11 +367,15 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header, #if FF_API_AVPICTURE FF_DISABLE_DEPRECATION_WARNINGS +{ + int j; + AVSubtitleRect *rect; rect = sub_header->rects[0]; for (j = 0; j < 4; j++) { rect->pict.data[j] = rect->data[j]; rect->pict.linesize[j] = rect->linesize[j]; } +} FF_ENABLE_DEPRECATION_WARNINGS #endif } diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 17cdb87f2c..2667f3b543 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -2683,7 +2683,7 @@ static void update_mb_info(MpegEncContext *s, int startcode) static int encode_thread(AVCodecContext *c, void *arg){ MpegEncContext *s= *(void**)arg; - int mb_x, mb_y, pdif = 0; + int mb_x, mb_y; int chr_h= 16>>s->chroma_y_shift; int i, j; MpegEncContext best_s = { 0 }, backup_s; @@ -3307,7 +3307,7 @@ FF_DISABLE_DEPRECATION_WARNINGS /* Send the last GOB if RTP */ if (s->avctx->rtp_callback) { int number_mb = (mb_y - s->resync_mb_y)*s->mb_width - s->resync_mb_x; - pdif = put_bits_ptr(&s->pb) - s->ptr_lastgob; + int pdif = put_bits_ptr(&s->pb) - s->ptr_lastgob; /* Call the RTP callback to send the last GOB */ emms_c(); s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, pdif, number_mb); diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index a4cb66b0ae..886685b4b5 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -515,8 +515,6 @@ static int display_end_segment(AVCodecContext *avctx, void *data, } for (i = 0; i < ctx->presentation.object_count; i++) { PGSSubObject *object; - AVSubtitleRect *rect; - int j; sub->rects[i] = av_mallocz(sizeof(*sub->rects[0])); if (!sub->rects[i]) { @@ -580,11 +578,15 @@ static int display_end_segment(AVCodecContext *avctx, void *data, #if FF_API_AVPICTURE FF_DISABLE_DEPRECATION_WARNINGS +{ + AVSubtitleRect *rect; + int j; rect = sub->rects[i]; for (j = 0; j < 4; j++) { rect->pict.data[j] = rect->data[j]; rect->pict.linesize[j] = rect->linesize[j]; } +} FF_ENABLE_DEPRECATION_WARNINGS #endif diff --git a/libavcodec/xsubdec.c b/libavcodec/xsubdec.c index 7e25787989..3af300c22b 100644 --- a/libavcodec/xsubdec.c +++ b/libavcodec/xsubdec.c @@ -57,8 +57,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, int64_t packet_time = 0; GetBitContext gb; int has_alpha = avctx->codec_tag == MKTAG('D','X','S','A'); - AVSubtitleRect *rect; - int j; memset(sub, 0, sizeof(*sub)); @@ -135,11 +133,15 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, #if FF_API_AVPICTURE FF_DISABLE_DEPRECATION_WARNINGS +{ + AVSubtitleRect *rect; + int j; rect = sub->rects[0]; for (j = 0; j < 4; j++) { rect->pict.data[j] = rect->data[j]; rect->pict.linesize[j] = rect->linesize[j]; } +} FF_ENABLE_DEPRECATION_WARNINGS #endif diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 46db25dbd3..b59f29f554 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -853,9 +853,9 @@ static int v4l2_read_header(AVFormatContext *s1) static int v4l2_read_packet(AVFormatContext *s1, AVPacket *pkt) { - struct video_data *s = s1->priv_data; #if FF_API_CODED_FRAME FF_DISABLE_DEPRECATION_WARNINGS + struct video_data *s = s1->priv_data; AVFrame *frame = s1->streams[0]->codec->coded_frame; FF_ENABLE_DEPRECATION_WARNINGS #endif diff --git a/libavformat/mux.c b/libavformat/mux.c index c967ad6b96..5f0d7ddd4b 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -639,11 +639,11 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt) goto fail; if (pkt) { +#if FF_API_COMPUTE_PKT_FIELDS2 AVStream *st = s->streams[pkt->stream_index]; av_log(s, AV_LOG_TRACE, "av_interleaved_write_frame size:%d dts:%" PRId64 " pts:%" PRId64 "\n", pkt->size, pkt->dts, pkt->pts); -#if FF_API_COMPUTE_PKT_FIELDS2 if ((ret = compute_pkt_fields2(s, st, pkt)) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) goto fail; #endif -- cgit v1.2.3