5 int main(int argc
, char **argv
)
7 const unsigned int width
= 16, height
= 16;
8 const unsigned int min_required_blocks
= 1, min_required_macroblocks
= 1;
9 const unsigned int mc_types
[2] = {XVMC_MOCOMP
| XVMC_MPEG_2
, XVMC_IDCT
| XVMC_MPEG_2
};
14 unsigned int is_overlay
, intra_unsigned
;
18 XvMCBlockArray blocks
= {0};
19 XvMCMacroBlockArray macroblocks
= {0};
21 display
= XOpenDisplay(NULL
);
28 XVMC_CHROMA_FORMAT_420
,
37 XCloseDisplay(display
);
38 error(1, 0, "Error, unable to find a good port.\n");
43 Atom xv_colorkey
= XInternAtom(display
, "XV_COLORKEY", 0);
44 XvGetPortAttribute(display
, port_num
, xv_colorkey
, &colorkey
);
47 assert(XvMCCreateContext(display
, port_num
, surface_type_id
, width
, height
, XVMC_DIRECT
, &context
) == Success
);
48 assert(XvMCCreateSurface(display
, &context
, &surface
) == Success
);
50 /* Test NULL context */
51 assert(XvMCCreateBlocks(display
, NULL
, 1, &blocks
) == XvMCBadContext
);
53 assert(XvMCCreateBlocks(display
, &context
, 0, &blocks
) == BadValue
);
54 /* Test valid params */
55 assert(XvMCCreateBlocks(display
, &context
, min_required_blocks
, &blocks
) == Success
);
56 /* Test context id assigned and correct */
57 assert(blocks
.context_id
== context
.context_id
);
58 /* Test number of blocks assigned and correct */
59 assert(blocks
.num_blocks
== min_required_blocks
);
60 /* Test block pointer valid */
61 assert(blocks
.blocks
!= NULL
);
62 /* Test NULL context */
63 assert(XvMCCreateMacroBlocks(display
, NULL
, 1, ¯oblocks
) == XvMCBadContext
);
64 /* Test 0 macroblocks */
65 assert(XvMCCreateMacroBlocks(display
, &context
, 0, ¯oblocks
) == BadValue
);
66 /* Test valid params */
67 assert(XvMCCreateMacroBlocks(display
, &context
, min_required_macroblocks
, ¯oblocks
) == Success
);
68 /* Test context id assigned and correct */
69 assert(macroblocks
.context_id
== context
.context_id
);
70 /* Test macroblock pointer valid */
71 assert(macroblocks
.macro_blocks
!= NULL
);
72 /* Test valid params */
73 assert(XvMCDestroyMacroBlocks(display
, ¯oblocks
) == Success
);
74 /* Test valid params */
75 assert(XvMCDestroyBlocks(display
, &blocks
) == Success
);
77 assert(XvMCDestroySurface(display
, &surface
) == Success
);
78 assert(XvMCDestroyContext(display
, &context
) == Success
);
80 XvUngrabPort(display
, port_num
, CurrentTime
);
81 XCloseDisplay(display
);