libzvbi-teletextdec: fix AVSubtitleRect pict compatiblity code
authorMarton Balint <cus@passwd.hu>
Fri, 23 Oct 2015 18:40:23 +0000 (20:40 +0200)
committerMarton Balint <cus@passwd.hu>
Sat, 24 Oct 2015 14:12:26 +0000 (16:12 +0200)
Only set pict if we got a valid rect.

Signed-off-by: Marton Balint <cus@passwd.hu>
libavcodec/libzvbi-teletextdec.c

index c63b1ec..22acd39 100644 (file)
@@ -464,18 +464,17 @@ static int teletext_decode_frame(AVCodecContext *avctx, void *data, int *data_si
             if (sub->rects) {
                 sub->num_rects = 1;
                 sub->rects[0] = ctx->pages->sub_rect;
-            } else {
-                ret = AVERROR(ENOMEM);
-            }
-
 #if FF_API_AVPICTURE
 FF_DISABLE_DEPRECATION_WARNINGS
-            for (j = 0; j < 4; j++) {
-                sub->rects[0]->pict.data[j] = sub->rects[0]->data[j];
-                sub->rects[0]->pict.linesize[j] = sub->rects[0]->linesize[j];
-            }
+                for (j = 0; j < 4; j++) {
+                    sub->rects[0]->pict.data[j] = sub->rects[0]->data[j];
+                    sub->rects[0]->pict.linesize[j] = sub->rects[0]->linesize[j];
+                }
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
+            } else {
+                ret = AVERROR(ENOMEM);
+            }
         } else {
             av_log(avctx, AV_LOG_DEBUG, "sending empty sub\n");
             sub->rects = NULL;