-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathPreVideoViewer.cpp
54 lines (40 loc) · 1.06 KB
/
PreVideoViewer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "PreVideoViewer.h"
#include <comutil.h>
PreVideoViewer::PreVideoViewer()
{
}
PreVideoViewer::~PreVideoViewer()
{
}
void PreVideoViewer::showVideo(string vid)
{
IGraphBuilder *pGraphBuilder;
IMediaControl *pMediaControl;
IMediaEvent *pMediaEvent;
long eventCode;
IVideoWindow *pVideoWindow;
CoInitialize(NULL);
CoCreateInstance(CLSID_FilterGraph,
NULL,
CLSCTX_INPROC,
IID_IGraphBuilder,
(LPVOID *)&pGraphBuilder);
pGraphBuilder->QueryInterface(IID_IMediaControl,
(LPVOID *)&pMediaControl);
pGraphBuilder->QueryInterface(IID_IMediaEvent,
(LPVOID *)&pMediaEvent);
pMediaControl->RenderFile(_com_util::ConvertStringToBSTR(vid.c_str()));//vid.c_str());
pGraphBuilder->QueryInterface(IID_IVideoWindow,
(LPVOID *)&pVideoWindow);
// Start Full Screen
pVideoWindow->put_FullScreenMode(OATRUE);
pMediaControl->Run();
pMediaEvent->WaitForCompletion(-1, &eventCode);
// End Full Screen
pVideoWindow->put_FullScreenMode(OAFALSE);
pVideoWindow->Release();
pMediaEvent->Release();
pMediaControl->Release();
pGraphBuilder->Release();
CoUninitialize();
}