]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dvbsubdec.c
qsvdec: avoid an infinite loop with no consumed data and no output
[ffmpeg] / libavcodec / dvbsubdec.c
index 1d62b8ad4235443b357df387c8dca5b3da5e1c45..d2b95bc53d4cbef61e66c38fedc58bf5c4640639 100644 (file)
@@ -22,6 +22,7 @@
 #include "avcodec.h"
 #include "get_bits.h"
 #include "bytestream.h"
+#include "internal.h"
 #include "libavutil/colorspace.h"
 
 #define DVBSUB_PAGE_SEGMENT     0x10
@@ -735,20 +736,20 @@ static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDis
                          0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
     uint8_t *map_table;
 
-    av_dlog(avctx, "DVB pixel block size %d, %s field:\n", buf_size,
+    ff_dlog(avctx, "DVB pixel block size %d, %s field:\n", buf_size,
             top_bottom ? "bottom" : "top");
 
     for (i = 0; i < buf_size; i++) {
         if (i % 16 == 0)
-            av_dlog(avctx, "0x%8p: ", buf+i);
+            ff_dlog(avctx, "0x%8p: ", buf+i);
 
-        av_dlog(avctx, "%02x ", buf[i]);
+        ff_dlog(avctx, "%02x ", buf[i]);
         if (i % 16 == 15)
-            av_dlog(avctx, "\n");
+            ff_dlog(avctx, "\n");
     }
 
     if (i % 16)
-        av_dlog(avctx, "\n");
+        ff_dlog(avctx, "\n");
 
     if (region == 0)
         return;
@@ -904,16 +905,16 @@ static int dvbsub_parse_clut_segment(AVCodecContext *avctx,
     int y, cr, cb, alpha;
     int r, g, b, r_add, g_add, b_add;
 
-    av_dlog(avctx, "DVB clut packet:\n");
+    ff_dlog(avctx, "DVB clut packet:\n");
 
     for (i=0; i < buf_size; i++) {
-        av_dlog(avctx, "%02x ", buf[i]);
+        ff_dlog(avctx, "%02x ", buf[i]);
         if (i % 16 == 15)
-            av_dlog(avctx, "\n");
+            ff_dlog(avctx, "\n");
     }
 
     if (i % 16)
-        av_dlog(avctx, "\n");
+        ff_dlog(avctx, "\n");
 
     clut_id = *buf++;
     buf += 1;
@@ -965,7 +966,7 @@ static int dvbsub_parse_clut_segment(AVCodecContext *avctx,
         YUV_TO_RGB1_CCIR(cb, cr);
         YUV_TO_RGB2_CCIR(r, g, b, y);
 
-        av_dlog(avctx, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, alpha);
+        ff_dlog(avctx, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, alpha);
 
         if (depth & 0x80)
             clut->clut4[entry_id] = RGBA(r,g,b,255 - alpha);
@@ -1046,11 +1047,11 @@ static int dvbsub_parse_region_segment(AVCodecContext *avctx,
             region->bgcolor = (((*buf++) >> 2) & 3);
     }
 
-    av_dlog(avctx, "Region %d, (%dx%d)\n", region_id, region->width, region->height);
+    ff_dlog(avctx, "Region %d, (%dx%d)\n", region_id, region->width, region->height);
 
     if (fill) {
         memset(region->pbuf, region->bgcolor, region->buf_size);
-        av_dlog(avctx, "Fill region (%d)\n", region->bgcolor);
+        ff_dlog(avctx, "Fill region (%d)\n", region->bgcolor);
     }
 
     delete_region_display_list(ctx, region);
@@ -1117,7 +1118,7 @@ static int dvbsub_parse_page_segment(AVCodecContext *avctx,
     ctx->time_out = *buf++;
     page_state = ((*buf++) >> 2) & 3;
 
-    av_dlog(avctx, "Page time out %ds, state %d\n", ctx->time_out, page_state);
+    ff_dlog(avctx, "Page time out %ds, state %d\n", ctx->time_out, page_state);
 
     if (page_state == 2) {
         delete_state(ctx);
@@ -1158,7 +1159,7 @@ static int dvbsub_parse_page_segment(AVCodecContext *avctx,
         ctx->display_list = display;
         ctx->display_list_size++;
 
-        av_dlog(avctx, "Region %d, (%d,%d)\n", region_id, display->x_pos, display->y_pos);
+        ff_dlog(avctx, "Region %d, (%d,%d)\n", region_id, display->x_pos, display->y_pos);
     }
 
     while (tmp_display_list) {
@@ -1421,19 +1422,19 @@ static int dvbsub_decode(AVCodecContext *avctx,
     int segment_length;
     int i;
 
-    av_dlog(avctx, "DVB sub packet:\n");
+    ff_dlog(avctx, "DVB sub packet:\n");
 
     for (i=0; i < buf_size; i++) {
-        av_dlog(avctx, "%02x ", buf[i]);
+        ff_dlog(avctx, "%02x ", buf[i]);
         if (i % 16 == 15)
-            av_dlog(avctx, "\n");
+            ff_dlog(avctx, "\n");
     }
 
     if (i % 16)
-        av_dlog(avctx, "\n");
+        ff_dlog(avctx, "\n");
 
     if (buf_size <= 6 || *buf != 0x0f) {
-        av_dlog(avctx, "incomplete or broken packet");
+        ff_dlog(avctx, "incomplete or broken packet");
         return AVERROR_INVALIDDATA;
     }
 
@@ -1449,7 +1450,7 @@ static int dvbsub_decode(AVCodecContext *avctx,
         p += 2;
 
         if (p_end - p < segment_length) {
-            av_dlog(avctx, "incomplete or broken packet");
+            ff_dlog(avctx, "incomplete or broken packet");
             return -1;
         }
 
@@ -1478,7 +1479,7 @@ static int dvbsub_decode(AVCodecContext *avctx,
                 *data_size = ret;
                 break;
             default:
-                av_dlog(avctx, "Subtitling segment type 0x%x, page id %d, length %d\n",
+                ff_dlog(avctx, "Subtitling segment type 0x%x, page id %d, length %d\n",
                         segment_type, page_id, segment_length);
                 break;
             }