[FFmpeg-devel] Patch: fix ffplay segmentation fault
avcoder
ffmpeg
Mon Mar 23 10:30:49 CET 2009
Dear:
On Mon, Mar 23, 2009 at 4:58 PM, Reimar D?ffinger
<Reimar.Doeffinger at gmx.de> wrote:
> On Mon, Mar 23, 2009 at 03:30:09PM +0800, avcoder wrote:
>> Dear:
>>
>> It seems that the recent swscale development has broken ffplay
>>
>> the following patch/hack will fix it
>>
>> Index: swscale.c
>> ===================================================================
>> --- swscale.c ??? 29040?
>> +++ swscale.c ??????
>> @@ -2120,7 +2120,7 @@
>> ? ? ? ? ?if (!dst[plane]) continue;
>> ? ? ? ? ?// ignore palette for GRAY8
>> ? ? ? ? ?if (plane == 1 && !dst[2]) continue;
>> - ? ? ? ?if (!src[plane] || (plane == 1 && !src[2]))
>> + ? ? ? ?if (dst[plane] && (!src[plane] || (plane == 1 && !src[2])))
>> ? ? ? ? ? ? ?fillPlane(dst[plane], dstStride[plane], length, height,
>> y, (plane==3) ? 255 : 128);
>> ? ? ? ? ?else
>> ? ? ? ? ?{
>
> given the "if (!dst[plane]) continue;" above this can't be necessary.
Thanks!
I am silly
>
>> Index: ffplay.c
>> ===================================================================
>> --- ffplay.c ???? 18169?
>> +++ ffplay.c ???????
>> @@ -1242,6 +1242,7 @@
>> ? ? ? ? ?return -1;
>>
>> ? ? ?vp = &is->pictq[is->pictq_windex];
>> + ? ?memset(&pict,0,sizeof(AVPicture));
>>
>> ? ? ?/* alloc or resize hardware picture buffer */
>> ? ? ?if (!vp->bmp ||
>
> The declaration and memset for pict should be moved into the if where it
> is used.
I update the patch according to your comment:
Index: ffplay.c
===================================================================
--- ffplay.c ??? 18169?
+++ ffplay.c ??????
@@ -1227,7 +1227,6 @@
{
VideoPicture *vp;
int dst_pix_fmt;
- AVPicture pict;
static struct SwsContext *img_convert_ctx;
/* wait until we have space to put a new picture */
@@ -1270,10 +1269,13 @@
/* if the frame is not skipped, then display it */
if (vp->bmp) {
+ AVPicture pict;
+
/* get a pointer on the bitmap */
SDL_LockYUVOverlay (vp->bmp);
dst_pix_fmt = PIX_FMT_YUV420P;
+ memset(&pict,0,sizeof(AVPicture));
pict.data[0] = vp->bmp->pixels[0];
pict.data[1] = vp->bmp->pixels[2];
pict.data[2] = vp->bmp->pixels[1];
--
----------------------------------------------
Inspired by http://ppnext.com
Your potential. Our passion.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffplay2.diff
Type: application/octet-stream
Size: 770 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090323/08e173cd/attachment.obj>
More information about the ffmpeg-devel
mailing list