Browse code

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.

Diego Biurrun authored on 2016/05/04 07:15:41
Showing 7 changed files
... ...
@@ -1350,7 +1350,6 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf,
1350 1350
     i = 0;
1351 1351
 
1352 1352
     for (display = ctx->display_list; display; display = display->next) {
1353
-        int j;
1354 1353
         region = get_region(ctx, display->region_id);
1355 1354
         rect = sub->rects[i];
1356 1355
 
... ...
@@ -1400,10 +1399,13 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf,
1400 1400
 
1401 1401
 #if FF_API_AVPICTURE
1402 1402
 FF_DISABLE_DEPRECATION_WARNINGS
1403
+{
1404
+        int j;
1403 1405
         for (j = 0; j < 4; j++) {
1404 1406
             rect->pict.data[j] = rect->data[j];
1405 1407
             rect->pict.linesize[j] = rect->linesize[j];
1406 1408
         }
1409
+}
1407 1410
 FF_ENABLE_DEPRECATION_WARNINGS
1408 1411
 #endif
1409 1412
 
... ...
@@ -318,8 +318,6 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
318 318
             if (h < 0)
319 319
                 h = 0;
320 320
             if (w > 0 && h > 0) {
321
-                int j;
322
-                AVSubtitleRect *rect;
323 321
                 if (sub_header->rects) {
324 322
                     for (i = 0; i < sub_header->num_rects; i++) {
325 323
                         av_freep(&sub_header->rects[i]->data[0]);
... ...
@@ -369,11 +367,15 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
369 369
 
370 370
 #if FF_API_AVPICTURE
371 371
 FF_DISABLE_DEPRECATION_WARNINGS
372
+{
373
+                int j;
374
+                AVSubtitleRect *rect;
372 375
                 rect = sub_header->rects[0];
373 376
                 for (j = 0; j < 4; j++) {
374 377
                     rect->pict.data[j] = rect->data[j];
375 378
                     rect->pict.linesize[j] = rect->linesize[j];
376 379
                 }
380
+}
377 381
 FF_ENABLE_DEPRECATION_WARNINGS
378 382
 #endif
379 383
             }
... ...
@@ -2683,7 +2683,7 @@ static void update_mb_info(MpegEncContext *s, int startcode)
2683 2683
 
2684 2684
 static int encode_thread(AVCodecContext *c, void *arg){
2685 2685
     MpegEncContext *s= *(void**)arg;
2686
-    int mb_x, mb_y, pdif = 0;
2686
+    int mb_x, mb_y;
2687 2687
     int chr_h= 16>>s->chroma_y_shift;
2688 2688
     int i, j;
2689 2689
     MpegEncContext best_s = { 0 }, backup_s;
... ...
@@ -3307,7 +3307,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
3307 3307
     /* Send the last GOB if RTP */
3308 3308
     if (s->avctx->rtp_callback) {
3309 3309
         int number_mb = (mb_y - s->resync_mb_y)*s->mb_width - s->resync_mb_x;
3310
-        pdif = put_bits_ptr(&s->pb) - s->ptr_lastgob;
3310
+        int pdif = put_bits_ptr(&s->pb) - s->ptr_lastgob;
3311 3311
         /* Call the RTP callback to send the last GOB */
3312 3312
         emms_c();
3313 3313
         s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, pdif, number_mb);
... ...
@@ -515,8 +515,6 @@ static int display_end_segment(AVCodecContext *avctx, void *data,
515 515
     }
516 516
     for (i = 0; i < ctx->presentation.object_count; i++) {
517 517
         PGSSubObject *object;
518
-        AVSubtitleRect *rect;
519
-        int j;
520 518
 
521 519
         sub->rects[i]  = av_mallocz(sizeof(*sub->rects[0]));
522 520
         if (!sub->rects[i]) {
... ...
@@ -580,11 +578,15 @@ static int display_end_segment(AVCodecContext *avctx, void *data,
580 580
 
581 581
 #if FF_API_AVPICTURE
582 582
 FF_DISABLE_DEPRECATION_WARNINGS
583
+{
584
+        AVSubtitleRect *rect;
585
+        int j;
583 586
         rect = sub->rects[i];
584 587
         for (j = 0; j < 4; j++) {
585 588
             rect->pict.data[j] = rect->data[j];
586 589
             rect->pict.linesize[j] = rect->linesize[j];
587 590
         }
591
+}
588 592
 FF_ENABLE_DEPRECATION_WARNINGS
589 593
 #endif
590 594
 
... ...
@@ -57,8 +57,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
57 57
     int64_t packet_time = 0;
58 58
     GetBitContext gb;
59 59
     int has_alpha = avctx->codec_tag == MKTAG('D','X','S','A');
60
-    AVSubtitleRect *rect;
61
-    int j;
62 60
 
63 61
     memset(sub, 0, sizeof(*sub));
64 62
 
... ...
@@ -135,11 +133,15 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
135 135
 
136 136
 #if FF_API_AVPICTURE
137 137
 FF_DISABLE_DEPRECATION_WARNINGS
138
+{
139
+    AVSubtitleRect *rect;
140
+    int j;
138 141
     rect = sub->rects[0];
139 142
     for (j = 0; j < 4; j++) {
140 143
         rect->pict.data[j] = rect->data[j];
141 144
         rect->pict.linesize[j] = rect->linesize[j];
142 145
     }
146
+}
143 147
 FF_ENABLE_DEPRECATION_WARNINGS
144 148
 #endif
145 149
 
... ...
@@ -853,9 +853,9 @@ static int v4l2_read_header(AVFormatContext *s1)
853 853
 
854 854
 static int v4l2_read_packet(AVFormatContext *s1, AVPacket *pkt)
855 855
 {
856
-    struct video_data *s = s1->priv_data;
857 856
 #if FF_API_CODED_FRAME
858 857
 FF_DISABLE_DEPRECATION_WARNINGS
858
+    struct video_data *s = s1->priv_data;
859 859
     AVFrame *frame = s1->streams[0]->codec->coded_frame;
860 860
 FF_ENABLE_DEPRECATION_WARNINGS
861 861
 #endif
... ...
@@ -639,11 +639,11 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
639 639
         goto fail;
640 640
 
641 641
     if (pkt) {
642
+#if FF_API_COMPUTE_PKT_FIELDS2
642 643
         AVStream *st = s->streams[pkt->stream_index];
643 644
 
644 645
         av_log(s, AV_LOG_TRACE, "av_interleaved_write_frame size:%d dts:%" PRId64 " pts:%" PRId64 "\n",
645 646
                 pkt->size, pkt->dts, pkt->pts);
646
-#if FF_API_COMPUTE_PKT_FIELDS2
647 647
         if ((ret = compute_pkt_fields2(s, st, pkt)) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
648 648
             goto fail;
649 649
 #endif