1 #include <stdio.h>
2 #include <glib.h>
3 #include <glib-object.h>
4 #include "mixvideo.h"
5 #include "mixdisplayx11.h"
6
7 int
main(int argc,char ** argv)8 main (int argc, char **argv)
9 {
10 MIX_RESULT ret;
11
12 g_type_init ();
13
14 /* test MixDisplay */
15 {
16
17 MixDisplayX11 *x11_clone = NULL;
18 MixDisplayX11 *x11 = mix_displayx11_new ();
19
20 MixDisplay *base = MIX_DISPLAY (x11);
21
22 gboolean flag = MIX_IS_DISPLAYX11 (base);
23
24 Drawable drawable = 1024;
25
26 mix_displayx11_set_drawable (x11, drawable);
27
28 /* clone x11 */
29
30 x11_clone = (MixDisplayX11 *) mix_display_dup (MIX_DISPLAY (x11));
31
32 base = MIX_DISPLAY (x11_clone);
33
34 flag = MIX_IS_DISPLAYX11 (base);
35
36 mix_displayx11_get_drawable (x11_clone, &drawable);
37
38 /* TODO: add more test cases */
39
40 /* release */
41 mix_display_unref (MIX_DISPLAY (x11));
42 mix_display_unref (MIX_DISPLAY (x11_clone));
43 g_print ("MixDisplayX11 test is done!\n");
44 }
45
46 /* test MixVideoInitParams */
47 {
48 MixVideoInitParams *init_params = mix_videoinitparams_new ();
49
50 MixDisplayX11 *x11 = mix_displayx11_new ();
51 mix_displayx11_set_drawable (x11, 1024);
52
53 mix_videoinitparams_set_display (init_params, MIX_DISPLAY (x11));
54
55 /* release */
56 mix_params_unref (MIX_PARAMS (init_params));
57 mix_display_unref (MIX_DISPLAY (x11));
58
59 g_print ("MixVideoInitParams test is done!\n");
60 }
61
62 /* test MixVideo */
63
64 {
65 MixVideo *video = mix_video_new ();
66 MixVideoInitParams *init_params = mix_videoinitparams_new ();
67 MixDisplayX11 *x11 = mix_displayx11_new ();
68 MixDrmParams *drm = mix_drmparams_new ();
69 MixCodecMode mode = MIX_CODEC_MODE_DECODE;
70
71 mix_displayx11_set_drawable (x11, 1024);
72 mix_videoinitparams_set_display (init_params, MIX_DISPLAY (x11));
73
74 mix_video_initialize (video, mode, init_params, drm);
75
76 /* TODO: add more test cases */
77
78 /* unref the objects. */
79
80 mix_params_unref (MIX_PARAMS (init_params));
81 mix_params_unref (MIX_PARAMS (drm));
82 mix_display_unref (MIX_DISPLAY (x11));
83 g_object_unref (G_OBJECT (video));
84
85 g_print ("MixVideo test is done!\n");
86 }
87 }
88