Browse code

libzvbi-teletextdec: fix AVSubtitleRect pict compatiblity code

Only set pict if we got a valid rect.

Signed-off-by: Marton Balint <cus@passwd.hu>

Marton Balint authored on 2015/10/24 03:40:23
Showing 1 changed files
... ...
@@ -464,18 +464,17 @@ static int teletext_decode_frame(AVCodecContext *avctx, void *data, int *data_si
464 464
             if (sub->rects) {
465 465
                 sub->num_rects = 1;
466 466
                 sub->rects[0] = ctx->pages->sub_rect;
467
-            } else {
468
-                ret = AVERROR(ENOMEM);
469
-            }
470
-
471 467
 #if FF_API_AVPICTURE
472 468
 FF_DISABLE_DEPRECATION_WARNINGS
473
-            for (j = 0; j < 4; j++) {
474
-                sub->rects[0]->pict.data[j] = sub->rects[0]->data[j];
475
-                sub->rects[0]->pict.linesize[j] = sub->rects[0]->linesize[j];
476
-            }
469
+                for (j = 0; j < 4; j++) {
470
+                    sub->rects[0]->pict.data[j] = sub->rects[0]->data[j];
471
+                    sub->rects[0]->pict.linesize[j] = sub->rects[0]->linesize[j];
472
+                }
477 473
 FF_ENABLE_DEPRECATION_WARNINGS
478 474
 #endif
475
+            } else {
476
+                ret = AVERROR(ENOMEM);
477
+            }
479 478
         } else {
480 479
             av_log(avctx, AV_LOG_DEBUG, "sending empty sub\n");
481 480
             sub->rects = NULL;