Menu

[025cc2]: / DirectPython11 / DPMedia.hpp  Maximize  Restore  History

Download this file

91 lines (67 with data), 2.3 kB

 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
Copyright (C) 2010, Heikki Salo
All rights reserved.
Distributed under the BSD license:
http://www.opensource.org/licenses/bsd-license.php
*/
#ifndef DP_MEDIA_HPP
#define DP_MEDIA_HPP
#include "stdafx.h"
#include <mfapi.h>
#include <mfidl.h>
#include <mferror.h>
#include <evr.h>
#include <Shlwapi.h>
const UINT WM_DP_MEDIAEVENT = WM_USER + 1;
class DPWindow;
class DPTexture;
class DPMedia : boost::noncopyable {
public:
~DPMedia();
DPMedia(python::object&, DPWindow*);
void play();
void setPosition(MFTIME);
void pause();
python::object getVideoSize();
DPTexture* getTexture();
UINT64 getPosition();
UINT64 getDuration();
python::object getEvents();
bool hasVideo() { return videoDisplay != 0;}
bool hasAudio() { return audioVolume != 0;}
float getVolume();
void setVolume(float);
void release();
void repaint();
void resize(UINT, UINT);
void onEvent(IMFMediaEvent*, MediaEventType);
DPWindow* getWindow() { return window; }
void setWindow(DPWindow* win) { window = win; }
private:
friend class DPMediaAsyncCallback;
void AddBranchToPartialTopology(IMFTopology*, IMFPresentationDescriptor*, DWORD, HWND);
void CreateSourceStreamNode(IMFMediaSource*, IMFPresentationDescriptor*, IMFStreamDescriptor*, IMFTopologyNode**);
void CreateOutputNode(IMFStreamDescriptor*, HWND, IMFTopologyNode**);
void topologyReady();
IMFMediaSession* mediaSession;
IMFMediaSource* mediaSource;
IMFVideoDisplayControl* videoDisplay;
IMFSimpleAudioVolume* audioVolume;
DPWindow* window;
};
class DPMediaAsyncCallback : public IMFAsyncCallback {
public:
static DPMediaAsyncCallback* createNew(DPMedia*);
STDMETHODIMP QueryInterface(REFIID, void**);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
//Optional.
STDMETHODIMP GetParameters(DWORD*, DWORD*) { return E_NOTIMPL; }
STDMETHODIMP Invoke(IMFAsyncResult*);
private:
virtual ~DPMediaAsyncCallback();
DPMediaAsyncCallback(DPMedia* arg) { media = arg; refCount = 1; }
DPMedia* media;
long refCount;
};
#endif
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.