purple: work around broken idle indication
[siplcs.git] / src / miranda / vlc.c
blob7e1b26bd7e75029ac0af2378d19175bc5e50f99d
1 #include <windows.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <vlc/vlc.h>
6 extern HINSTANCE hInst;
8 LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
10 switch(msg)
12 case WM_CLOSE:
13 DestroyWindow(hwnd);
14 break;
15 case WM_DESTROY:
16 PostQuitMessage(0);
17 break;
18 default:
19 return DefWindowProc(hwnd, msg, wParam, lParam);
21 return 0;
24 int __stdcall show_vlc(void *data)
26 libvlc_instance_t * inst;
27 libvlc_media_player_t *mp;
28 libvlc_media_t *m;
29 int rc;
30 HANDLE w;
31 WNDCLASSEX wc;
33 /* Load the VLC engine */
34 inst = libvlc_new (0, NULL);
36 /* Create a new item */
37 m = libvlc_media_new_path (inst, "C:\\Temp\\[001_1-01] Broken Bow (Part 1).mpg");
39 /* Create a media player playing environement */
40 mp = libvlc_media_player_new_from_media (m);
42 /* No need to keep the media now */
43 libvlc_media_release (m);
46 //Step 1: Registering the Window Class
47 wc.cbSize = sizeof(WNDCLASSEX);
48 wc.style = 0;
49 wc.lpfnWndProc = WndProc;
50 wc.cbClsExtra = 0;
51 wc.cbWndExtra = 0;
52 wc.hInstance = hInst;
53 wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
54 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
55 wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
56 wc.lpszMenuName = NULL;
57 wc.lpszClassName = L"myclassstuff";
58 wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
60 if(!RegisterClassEx(&wc))
62 MessageBox(NULL, L"Window Registration Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
63 return 0;
66 w = CreateWindow(L"myclassstuff", L"VLC Window", WS_OVERLAPPEDWINDOW, 50, 50, 400, 400, NULL, NULL, hInst, NULL);
68 if (!w)
70 DWORD d = GetLastError();
71 printf ("===================== %08x ==============\n", d);
75 // libvlc_media_player_set_hwnd (mp, w);
77 // ShowWindow(w, SW_SHOW);
78 // UpdateWindow(w);
80 #if 0
81 /* This is a non working code that show how to hooks into a window,
82 * if we have a window around */
83 libvlc_media_player_set_xdrawable (mp, xdrawable);
84 /* or on windows */
85 /* or on mac os */
86 libvlc_media_player_set_nsobject (mp, view);
87 #endif
89 /* play the media_player */
90 rc = libvlc_media_player_play (mp);
92 Sleep (60000); /* Let it play a bit */
94 /* Stop playing */
95 libvlc_media_player_stop (mp);
97 /* Free the media_player */
98 libvlc_media_player_release (mp);
100 libvlc_release (inst);
102 return 0;