[Libva] Multiple time Create Destroy failing
Sambhav
isambhav at gmail.com
Wed Nov 18 08:17:10 PST 2009
Hi Gwenole,
int main(int argc,char **argv)
{
VAEntrypoint entrypoints[5];
int num_entrypoints,vld_entrypoint;
VAConfigAttrib attrib;
VAConfigID config_id;
VASurfaceID vaSurface;
VAContextID vaContext;
VABufferID vaSliceDataBuf;
int major_ver, minor_ver;
Display *x11_display;
VADisplay vaDisplay;
VAStatus vaStatus;
Window win = 0;
int i;
x11_display = XOpenDisplay(NULL);
vaDisplay = vaGetDisplay(x11_display);
vaStatus = vaInitialize(vaDisplay, &major_ver, &minor_ver);
win = XCreateSimpleWindow(x11_display,RootWindow(x11_display, 0),0,
0,352,240,0, 0,WhitePixel(x11_display, 10));
XMapWindow(x11_display, win);
XSync(x11_display, True);
for(i=0;i<2;i++)
{
vaStatus =
vaQueryConfigEntrypoints(vaDisplay,VAProfileH264Main,entrypoints,&num_entrypoints);
if(VA_STATUS_SUCCESS != vaStatus) {
printf("QueryEntryPoints
:%d\n", vaStatus);
exit(-1);
}
for(vld_entrypoint = 0; vld_entrypoint <
num_entrypoints; vld_entrypoint++) {
if
(entrypoints[vld_entrypoint] == VAEntrypointVLD)
break;
}
if (vld_entrypoint == num_entrypoints) {
/* not find VLD entry point
*/
exit(-1);
}
attrib.type = VAConfigAttribRTFormat;
vaStatus =
vaGetConfigAttributes(vaDisplay,VAProfileH264Main,VAEntrypointVLD,&attrib,1);
if ((attrib.value & VA_RT_FORMAT_YUV420) ==
0) {
/* not find desired YUV420
RT format */
exit(-1);
}
vaStatus =
vaCreateConfig(vaDisplay,VAProfileH264Main,VAEntrypointVLD,&attrib,1,&config_id);
if(VA_STATUS_SUCCESS != vaStatus){
printf("vaCreateConfig
Failure:%d\n", vaStatus);
exit(-1);
}
vaStatus =
vaCreateSurfaces(vaDisplay,CLIP_WIDTH,CLIP_HEIGHT,VA_RT_FORMAT_YUV420,1,&vaSurface);
/* Create a context for this decode pipe */
vaStatus = vaCreateContext(vaDisplay,
config_id,352,240,VA_PROGRESSIVE,&vaSurface,1,&vaContext);
if(VA_STATUS_SUCCESS != vaStatus) {
printf("vaCreateContext
Failure :%d\n", vaStatus);
return -1;
}
vaStatus =
vaCreateBuffer(vaDisplay,vaContext,VASliceDataBufferType,1000,1,NULL,&(vaSliceDataBuf));
if(VA_STATUS_SUCCESS != vaStatus)
{
printf("VASliceDataBufferType
Creation Failure:%d\n", vaStatus);
return -1;
}
vaDestroyBuffer (vaDisplay,vaSliceDataBuf);
vaDestroyContext(vaDisplay,vaContext);
vaDestroySurfaces(vaDisplay,&vaSurface,1);
vaDestroyConfig(vaDisplay,config_id);
}
vaTerminate(vaDisplay);
XCloseDisplay(x11_display);
return 0;
}
On Wed, Nov 18, 2009 at 8:49 PM, Gwenole Beauchesne <
gbeauchesne at splitted-desktop.com> wrote:
> Hi,
>
>
> On Wed, 18 Nov 2009, Sambhav wrote:
>
> I am trying to do the following sequence of libva calls multiple times for
>> H264 decoding.
>>
>> - CreateConfig,
>> - CreateSurfaces (1 surfaces)
>> - CreateContext,
>>
>> - CreateBuffer -VASliceDataBufferType - Failing 2nd time -
>> Segmentaion fault
>> - DestroyBuffer - VASliceDataBufferType,
>>
>> - DestroyContext,
>> - DestroySurfaces,
>> - DestroyConfig,
>>
>
> Please post the source code corresponding to those.
>
> Thanks,
> Gwenole.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/libva/attachments/20091118/a007c941/attachment.html
More information about the Libva
mailing list