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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#![allow(non_camel_case_types, non_snake_case)]
use crate::co;
use crate::decl::*;
use crate::kernel::privs::*;
use crate::mf::vts::*;
use crate::ole::privs::*;
use crate::prelude::*;
com_interface! { IMFMediaSession: "90377834-21d0-4dee-8214-ba2e3e6c1127";
/// [`IMFMediaSession`](https://learn.microsoft.com/en-us/windows/win32/api/mfidl/nn-mfidl-imfmediasession)
/// COM interface.
///
/// Automatically calls
/// [`Release`](https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nf-unknwn-iunknown-release)
/// when the object goes out of scope.
///
/// # Examples
///
/// ```no_run
/// use winsafe::{self as w, prelude::*};
///
/// let media_session = w::MFCreateMediaSession(None::<&w::IMFAttributes>)?;
/// # w::HrResult::Ok(())
/// ```
}
impl mf_IMFMediaEventGenerator for IMFMediaSession {}
impl mf_IMFMediaSession for IMFMediaSession {}
/// This trait is enabled with the `mf` feature, and provides methods for
/// [`IMFMediaSession`](crate::IMFMediaSession).
///
/// Prefer importing this trait through the prelude:
///
/// ```no_run
/// use winsafe::prelude::*;
/// ```
pub trait mf_IMFMediaSession: mf_IMFMediaEventGenerator {
fn_com_noparm! { ClearTopologies: IMFMediaSessionVT;
/// [`IMFMediaSession::ClearTopologies`](https://learn.microsoft.com/en-us/windows/win32/api/mfidl/nf-mfidl-imfmediasession-cleartopologies)
/// method.
}
fn_com_noparm! { Close: IMFMediaSessionVT;
/// [`IMFMediaSession::Close`](https://learn.microsoft.com/en-us/windows/win32/api/mfidl/nf-mfidl-imfmediasession-close)
/// method.
}
fn_com_interface_get! { GetClock: IMFMediaSessionVT => IMFClock;
/// [`IMFMediaSession::GetClock`](https://learn.microsoft.com/en-us/windows/win32/api/mfidl/nf-mfidl-imfmediasession-getclock)
/// method.
}
/// [`IMFMediaSession::GetFullTopology`](https://learn.microsoft.com/en-us/windows/win32/api/mfidl/nf-mfidl-imfmediasession-getfulltopology)
/// method.
#[must_use]
fn GetFullTopology(
&self,
flags: co::MFSESSION_GETFULLTOPOLOGY,
topo_id: u64,
) -> HrResult<IMFTopology> {
let mut queried = unsafe { IMFTopology::null() };
HrRet(unsafe {
(vt::<IMFMediaSessionVT>(self).GetFullTopology)(
self.ptr(),
flags.raw(),
topo_id,
queried.as_mut(),
)
}).to_hrresult()
.map(|_| queried)
}
/// [`IMFMediaSession::GetSessionCapabilities`](https://learn.microsoft.com/en-us/windows/win32/api/mfidl/nf-mfidl-imfmediasession-getsessioncapabilities)
/// method.
#[must_use]
fn GetSessionCapabilities(&self) -> HrResult<co::MFSESSIONCAP> {
let mut caps = co::MFSESSIONCAP::default();
HrRet(unsafe {
(vt::<IMFMediaSessionVT>(self).GetSessionCapabilities)(self.ptr(), caps.as_mut())
}).to_hrresult()
.map(|_| caps)
}
fn_com_noparm! { Pause: IMFMediaSessionVT;
/// [`IMFMediaSession::Pause`](https://learn.microsoft.com/en-us/windows/win32/api/mfidl/nf-mfidl-imfmediasession-pause)
/// method.
}
/// [`IMFMediaSession::SetTopology`](https://learn.microsoft.com/en-us/windows/win32/api/mfidl/nf-mfidl-imfmediasession-settopology)
/// method.
fn SetTopology(
&self,
flags: co::MFSESSION_SETTOPOLOGY,
topology: &impl mf_IMFTopology,
) -> HrResult<()> {
HrRet(unsafe {
(vt::<IMFMediaSessionVT>(self).SetTopology)(self.ptr(), flags.raw(), topology.ptr())
}).to_hrresult()
}
fn_com_noparm! { Shutdown: IMFMediaSessionVT;
/// [`IMFMediaSession::Shutdown`](https://learn.microsoft.com/en-us/windows/win32/api/mfidl/nf-mfidl-imfmediasession-shutdown)
/// method.
}
/// [`IMFMediaSession::Start`](https://learn.microsoft.com/en-us/windows/win32/api/mfidl/nf-mfidl-imfmediasession-start)
/// method.
///
/// # Examples
///
/// ```no_run
/// use winsafe::{self as w, prelude::*, co};
///
/// let session: w::IMFMediaSession; // initialized somewhere
/// # let session = unsafe { w::IMFMediaSession::null() };
///
/// session.Start(
/// co::MF_TIME_FORMAT::NULL,
/// &w::PropVariant::Empty,
/// )?;
/// # w::HrResult::Ok(())
/// ```
fn Start(&self, time_format: co::MF_TIME_FORMAT, start_position: &PropVariant) -> HrResult<()> {
HrRet(unsafe {
(vt::<IMFMediaSessionVT>(self).Start)(
self.ptr(),
pcvoid(&time_format),
pcvoid(&start_position.to_raw()?),
)
}).to_hrresult()
}
fn_com_noparm! { Stop: IMFMediaSessionVT;
/// [`IMFMediaSession::Stop`](https://learn.microsoft.com/en-us/windows/win32/api/mfidl/nf-mfidl-imfmediasession-stop)
/// method.
}
}