Reduce the scope of some variables
authorDiego Biurrun <diego@biurrun.de>
Tue, 3 May 2016 22:15:41 +0000 (00:15 +0200)
committerDiego Biurrun <diego@biurrun.de>
Wed, 11 May 2016 10:21:25 +0000 (12:21 +0200)
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
libavcodec/dvdsubdec.c
libavcodec/mpegvideo_enc.c
libavcodec/pgssubdec.c
libavcodec/xsubdec.c
libavdevice/v4l2.c
libavformat/mux.c

index be68c58..526f125 100644 (file)
@@ -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
 
index da1a83f..6e55a09 100644 (file)
@@ -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
             }
index 17cdb87..2667f3b 100644 (file)
@@ -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);
index a4cb66b..886685b 100644 (file)
@@ -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
 
index 7e25787..3af300c 100644 (file)
@@ -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
 
index 46db25d..b59f29f 100644 (file)
@@ -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
index c967ad6..5f0d7dd 100644 (file)
@@ -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