[FFmpeg-devel] [PATCH] examples/demuxing_decoding: use correct size of video_dst_data[0]

Michael Niedermayer michaelni at gmx.at
Tue May 12 21:12:22 CEST 2015


On Tue, May 12, 2015 at 04:02:44PM +0200, Andreas Cadhalpun wrote:
> On 12.05.2015 14:51, Michael Niedermayer wrote:
> > On Tue, May 12, 2015 at 02:31:38PM +0200, Andreas Cadhalpun wrote:
> >> @@ -108,6 +109,14 @@ static int decode_packet(int *got_frame, int cached)
> >>                            (const uint8_t **)(frame->data), frame->linesize,
> >>                            pix_fmt, width, height);
> >>  
> >> +            if ((desc->flags & AV_PIX_FMT_FLAG_PAL ||
> >> +                 desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) &&
> >> +                video_dst_data[1] - video_dst_data[0] > video_dst_linesize[0] * height) {
> >> +                /* zero-initialize the padding before the palette */
> >> +                memset(video_dst_data[0] + video_dst_linesize[0] * height, 0,
> >> +                       video_dst_data[1] - video_dst_data[0] - video_dst_linesize[0] * height);
> >> +            }
> > 
> > i wonder if this shouldnt be moved to av_image_alloc() ?
> 
> It's a bit nicer to do this in av_image_fill_pointers.

yes but thats not safe

for example rawdec calls avpicture_fill() on the input buffer
which uses av_image_fill_pointers()

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150512/d4142339/attachment.asc>


More information about the ffmpeg-devel mailing list