[Libva] VADestroyImage giving segmentation fault
Gwenole Beauchesne
gbeauchesne at splitted-desktop.com
Fri Oct 15 09:03:48 PDT 2010
Hi,
On Thu, 14 Oct 2010, Varun Dua wrote:
> I am decoding a H.264 video using Nvidia's Graphics Card and Vaapi Library on Ubuntu 10.04. I am able to decode an entire video
> and display it using vaPutSurface, no problems at all. Now I need the data in RGBA format so I get the data in BRGA format which
> is supported in my implementation (I can convert it into RGBA).
Note that retrieving the decoded pixels can be a slow operation. Also note
that only the vdpau-video driver supports BGRA read-back. In particular,
only the NVIDIA implementation. i.e. I would not rely on that.
> VAImage vaimage;
> unsigned char *imagedata = NULL;
> FILE *fp1;
> char file[100];
> printf("%x\n",myimgfmt.fourcc);
> vastatus = pfn_vaCreateImage(vaapi->display,&myimgfmt,avcc->width,avcc->height,&vaimage);
> checkVaStatus();
> pfn_vaGetImage (vaapi->display,va_surface_ids[current_surface],0,0,avcc->width,avcc->height,vaimage.image_id);
> checkVaStatus();
> imagedata = (char *)malloc(vaimage.data_size*sizeof(char));
> pfn_vaMapBuffer(vaapi->display,vaimage.buf,(void *)&imagedata);
vaMapBuffer() returns the mapped region in imagedata. i.e. you must not
allocate, neither free that pointer;
> sprintf(file,"brga/frame%d.raw",framenumber++);
> fp1 = fopen(file,"wb");
> fwrite(imagedata,vaimage.data_size*sizeof(unsigned char),1,fp1);
> fclose(fp1);
> free(imagedata);
> imagedata = NULL;
> vastatus = pfn_vaUnmapBuffer(vaapi->display,vaimage.buf);
> checkVaStatus();
> vastatus = vaDestroyImage(vaapi->display,vaimage.image_id);
>
> Everthing is working fine except that I am getting Segmentaion fault at vaDestroyImage. I am unable to correct this error. Can
> anybody help me with that ?
Drop the imagedata = ...; and free(imagedata); lines.
Regards,
Gwenole.
More information about the Libva
mailing list