]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dvdsubdec.c
vc1_parser.o does not depend on h263dec.o and intrax8.o.
[ffmpeg] / libavcodec / dvdsubdec.c
index b445d3e4567a3b04daa9fb0f62d3d589347c67d2..142241217c5b5baab242e65286c72ae91b86c6ad 100644 (file)
@@ -173,11 +173,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header,
 
     if (buf_size < 10)
         return -1;
-    sub_header->rects = NULL;
-    sub_header->num_rects = 0;
-    sub_header->format = 0;
-    sub_header->start_display_time = 0;
-    sub_header->end_display_time = 0;
+    memset(sub_header, 0, sizeof(*sub_header));
 
     if (AV_RB16(buf) == 0) {   /* HD subpicture with 4-byte offsets */
         big_offsets = 1;
@@ -322,14 +318,13 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header,
                            buf, offset1, buf_size, is_8bit);
                 decode_rle(bitmap + w, w * 2, w, h / 2,
                            buf, offset2, buf_size, is_8bit);
+                sub_header->rects[0]->pict.data[1] = av_mallocz(AVPALETTE_SIZE);
                 if (is_8bit) {
                     if (yuv_palette == 0)
                         goto fail;
-                    sub_header->rects[0]->pict.data[1] = av_malloc(256 * 4);
                     sub_header->rects[0]->nb_colors = 256;
                     yuv_a_to_rgba(yuv_palette, alpha, (uint32_t*)sub_header->rects[0]->pict.data[1], 256);
                 } else {
-                    sub_header->rects[0]->pict.data[1] = av_malloc(4 * 4);
                     sub_header->rects[0]->nb_colors = 4;
                     guess_palette((uint32_t*)sub_header->rects[0]->pict.data[1],
                                   colormap, alpha, 0xffff00);