Mercurial > libavcodec.hg
comparison xsubdec.c @ 10069:8ac9bc10b485 libavcodec
Always allocate a buffer of AVPALETTE_SIZE for palette in the subtitle
decoders instead of as small as possible.
This avoids completely unnecessary issues with e.g. libswscale.
author | reimar |
---|---|
date | Thu, 20 Aug 2009 18:54:50 +0000 |
parents | 8ab9fbad11b2 |
children | 8a4984c5cacc |
comparison
equal
deleted
inserted
replaced
10068:770294452eaf | 10069:8ac9bc10b485 |
---|---|
93 sub->rects[0]->w = w; sub->rects[0]->h = h; | 93 sub->rects[0]->w = w; sub->rects[0]->h = h; |
94 sub->rects[0]->type = SUBTITLE_BITMAP; | 94 sub->rects[0]->type = SUBTITLE_BITMAP; |
95 sub->rects[0]->pict.linesize[0] = w; | 95 sub->rects[0]->pict.linesize[0] = w; |
96 sub->rects[0]->pict.data[0] = av_malloc(w * h); | 96 sub->rects[0]->pict.data[0] = av_malloc(w * h); |
97 sub->rects[0]->nb_colors = 4; | 97 sub->rects[0]->nb_colors = 4; |
98 sub->rects[0]->pict.data[1] = av_malloc(sub->rects[0]->nb_colors * 4); | 98 sub->rects[0]->pict.data[1] = av_mallocz(AVPALETTE_SIZE); |
99 | 99 |
100 // read palette | 100 // read palette |
101 for (i = 0; i < sub->rects[0]->nb_colors; i++) | 101 for (i = 0; i < sub->rects[0]->nb_colors; i++) |
102 ((uint32_t*)sub->rects[0]->pict.data[1])[i] = bytestream_get_be24(&buf); | 102 ((uint32_t*)sub->rects[0]->pict.data[1])[i] = bytestream_get_be24(&buf); |
103 // make all except background (first entry) non-transparent | 103 // make all except background (first entry) non-transparent |