VAStatus va_FoolMapBuffer( VADisplay dpy, VABufferID buf_id, /* in */ void **pbuf /* out */ ) { unsigned int magic, buftype; DPY2FOOLCTX_CHK(dpy); magic = buf_id & FOOL_BUFID_MASK; if (magic != FOOL_BUFID_MAGIC) return 0; /* could be VAImageBufferType from vaDeriveImage */ buftype = buf_id & 0xff; *pbuf = fool_ctx->fool_buf[buftype]; /* it is coded buffer, fill coded segment from file */ if (*pbuf && (buftype == VAEncCodedBufferType)) va_FoolFillCodedBuf(dpy, fool_ctx); return 1; /* fool is valid */ }
VAStatus va_FoolMapBuffer( VADisplay dpy, VABufferID buf_id, /* in */ void **pbuf /* out */ ) { unsigned int buftype = buf_id & 0xff; unsigned int magic = buf_id & FOOL_BUFID_MASK; DPY2INDEX(dpy); if (magic != FOOL_BUFID_MAGIC || buftype >= VABufferTypeMax || !pbuf) return 0; /* buf_id is the buffer type */ *pbuf = fool_context[idx].fool_buf[buftype]; /* it is coded buffer, fill the fake segment buf from file */ if (*pbuf && (buftype == VAEncCodedBufferType)) va_FoolFillCodedBuf(idx); return 1; /* don't call into driver */ }