<div>Hi <font color="#000000">Gwenole,</font></div>
<div> </div>
<div>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri">int main(int argc,char **argv)</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri">{</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>VAEntrypoint entrypoints[5];</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>int num_entrypoints,vld_entrypoint;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>VAConfigAttrib attrib;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>VAConfigID config_id;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>VASurfaceID vaSurface;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>VAContextID vaContext;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>VABufferID vaSliceDataBuf;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 1"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>int major_ver, minor_ver;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>Display *x11_display;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>VADisplay<span style="mso-tab-count: 1"> </span>vaDisplay;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>VAStatus vaStatus;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>Window win = 0;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>int i;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 1"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 1"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>x11_display = XOpenDisplay(NULL);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>vaDisplay = vaGetDisplay(x11_display);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>vaStatus = vaInitialize(vaDisplay, &major_ver, &minor_ver);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 1"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 1"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>win = XCreateSimpleWindow(x11_display,RootWindow(x11_display, 0),0, 0,352,240,0, 0,WhitePixel(x11_display, 10));</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>XMapWindow(x11_display, win);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>XSync(x11_display, True);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 1"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 1"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 1"> </span>for(i=0;i<2;i++)</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 1"> </span>{</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>vaStatus = vaQueryConfigEntrypoints(vaDisplay,VAProfileH264Main,entrypoints,&num_entrypoints);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>if(VA_STATUS_SUCCESS != vaStatus)<span style="mso-tab-count: 1"> </span>{</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 3"> </span>printf("QueryEntryPoints :%d\n", vaStatus);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 3"> </span>exit(-1);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>}</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>for(vld_entrypoint = 0; vld_entrypoint < num_entrypoints; vld_entrypoint++) {</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 3"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 3"> </span>if (entrypoints[vld_entrypoint] == VAEntrypointVLD)</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 4"> </span>break;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>}</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>if (vld_entrypoint == num_entrypoints) {</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 3"> </span>/* not find VLD entry point */</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 3"> </span>exit(-1);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>}</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>attrib.type = VAConfigAttribRTFormat;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>vaStatus = vaGetConfigAttributes(vaDisplay,VAProfileH264Main,VAEntrypointVLD,&attrib,1);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>if ((attrib.value & VA_RT_FORMAT_YUV420) == 0)<span style="mso-spacerun: yes"> </span>{</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 3"> </span>/* not find desired YUV420 RT format */</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 3"> </span>exit(-1);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>}</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>vaStatus = vaCreateConfig(vaDisplay,VAProfileH264Main,VAEntrypointVLD,&attrib,1,&config_id);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>if(VA_STATUS_SUCCESS != vaStatus){</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 3"> </span>printf("vaCreateConfig Failure:%d\n", vaStatus);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 3"> </span>exit(-1);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>}</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>vaStatus = vaCreateSurfaces(vaDisplay,CLIP_WIDTH,CLIP_HEIGHT,VA_RT_FORMAT_YUV420,1,&vaSurface);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>/* Create a context for this decode pipe */</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>vaStatus = vaCreateContext(vaDisplay, config_id,352,240,VA_PROGRESSIVE,&vaSurface,1,&vaContext);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>if(VA_STATUS_SUCCESS != vaStatus)<span style="mso-tab-count: 1"> </span>{</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 3"> </span>printf("vaCreateContext Failure :%d\n", vaStatus);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 3"> </span>return -1;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>}</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>vaStatus = vaCreateBuffer(vaDisplay,vaContext,VASliceDataBufferType,1000,1,NULL,&(vaSliceDataBuf));</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>if(VA_STATUS_SUCCESS != vaStatus)<span style="mso-tab-count: 2"> </span>{</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 3"> </span>printf("VASliceDataBufferType Creation Failure:%d\n", vaStatus);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 3"> </span>return -1;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>}</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>vaDestroyBuffer (vaDisplay,vaSliceDataBuf);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>vaDestroyContext(vaDisplay,vaContext);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>vaDestroySurfaces(vaDisplay,&vaSurface,1);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span>vaDestroyConfig(vaDisplay,config_id);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 2"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 1"> </span>}</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 1"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>vaTerminate(vaDisplay);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>XCloseDisplay(x11_display);</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-tab-count: 1"> </span></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri"><span style="mso-spacerun: yes"> </span>return 0;</font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Calibri">}</font></p></div>
<div> </div>
<div><br><br> </div>
<div class="gmail_quote">On Wed, Nov 18, 2009 at 8:49 PM, Gwenole Beauchesne <span dir="ltr"><<a href="mailto:gbeauchesne@splitted-desktop.com">gbeauchesne@splitted-desktop.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi,
<div class="im"><br><br>On Wed, 18 Nov 2009, Sambhav wrote:<br><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">I am trying to do the following sequence of libva calls multiple times for H264 decoding. <br> <br> - CreateConfig,<br>
- CreateSurfaces (1 surfaces)<br> - CreateContext, <br> <br> - CreateBuffer -VASliceDataBufferType - Failing 2nd time - Segmentaion fault<br> - DestroyBuffer - VASliceDataBufferType,<br> <br> - DestroyContext, <br>
- DestroySurfaces, <br> - DestroyConfig,<br></blockquote><br></div>Please post the source code corresponding to those.<br><br>Thanks,<br><font color="#888888">Gwenole.</font></blockquote></div><br>