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
#![allow(non_camel_case_types, non_snake_case)]
use crate::decl::*;
use crate::dshow::vts::*;
use crate::ole::privs::*;
use crate::prelude::*;
com_interface! { IGraphBuilder: "56a868a9-0ad4-11ce-b03a-0020af0ba770";
/// [`IGraphBuilder`](https://learn.microsoft.com/en-us/windows/win32/api/strmif/nn-strmif-igraphbuilder)
/// COM interface.
///
/// Automatically calls
/// [`IUnknown::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::*, co};
///
/// let obj = w::CoCreateInstance::<w::IGraphBuilder>(
/// &co::CLSID::FilterGraph,
/// None::<&w::IUnknown>,
/// co::CLSCTX::INPROC_SERVER,
/// )?;
/// # w::HrResult::Ok(())
/// ```
}
impl dshow_IFilterGraph for IGraphBuilder {}
impl dshow_IGraphBuilder for IGraphBuilder {}
/// This trait is enabled with the `dshow` feature, and provides methods for
/// [`IGraphBuilder`](crate::IGraphBuilder).
///
/// Prefer importing this trait through the prelude:
///
/// ```no_run
/// use winsafe::prelude::*;
/// ```
pub trait dshow_IGraphBuilder: dshow_IFilterGraph {
fn_com_noparm! { Abort: IGraphBuilderVT;
/// [`IGraphBuilder::Abort`](https://learn.microsoft.com/en-us/windows/win32/api/strmif/nf-strmif-igraphbuilder-abort)
/// method.
}
/// [`IGraphBuilder::AddSourceFilter`](https://learn.microsoft.com/en-us/windows/win32/api/strmif/nf-strmif-igraphbuilder-addsourcefilter)
/// method.
#[must_use]
fn AddSourceFilter(&self, file_name: &str, filter_name: &str) -> HrResult<IBaseFilter> {
let mut queried = unsafe { IBaseFilter::null() };
HrRet(unsafe {
(vt::<IGraphBuilderVT>(self).AddSourceFilter)(
self.ptr(),
WString::from_str(file_name).as_ptr(),
WString::from_str(filter_name).as_ptr(),
queried.as_mut(),
)
})
.to_hrresult()
.map(|_| queried)
}
/// [`IGraphBuilder::Connect`](https://learn.microsoft.com/en-us/windows/win32/api/strmif/nf-strmif-igraphbuilder-connect)
/// method.
fn Connect(&self, pin_out: &impl dshow_IPin, pin_in: &impl dshow_IPin) -> HrResult<()> {
HrRet(unsafe {
(vt::<IGraphBuilderVT>(self).Connect)(self.ptr(), pin_out.ptr(), pin_in.ptr())
})
.to_hrresult()
}
/// [`IGraphBuilder::Render`](https://learn.microsoft.com/en-us/windows/win32/api/strmif/nf-strmif-igraphbuilder-render)
/// method.
fn Render(&self, pin_out: &impl dshow_IPin) -> HrResult<()> {
HrRet(unsafe { (vt::<IGraphBuilderVT>(self).Render)(self.ptr(), pin_out.ptr()) })
.to_hrresult()
}
/// [`IGraphBuilder::RenderFile`](https://learn.microsoft.com/en-us/windows/win32/api/strmif/nf-strmif-igraphbuilder-renderfile)
/// method.
fn RenderFile(&self, file: &str) -> HrResult<()> {
HrRet(unsafe {
(vt::<IGraphBuilderVT>(self).RenderFile)(
self.ptr(),
WString::from_str(file).as_ptr(),
std::ptr::null(),
)
})
.to_hrresult()
}
/// [`IGraphBuilder::SetLogFile`](https://learn.microsoft.com/en-us/windows/win32/api/strmif/nf-strmif-igraphbuilder-setlogfile)
/// method.
fn SetLogFile(&self, hfile: Option<&HFILE>) -> HrResult<()> {
HrRet(unsafe {
(vt::<IGraphBuilderVT>(self).SetLogFile)(
self.ptr(),
hfile.map_or(std::ptr::null_mut(), |h| h.ptr()),
)
})
.to_hrresult()
}
/// [`IGraphBuilder::ShouldOperationContinue`](https://learn.microsoft.com/en-us/windows/win32/api/strmif/nf-strmif-igraphbuilder-shouldoperationcontinue)
/// method.
#[must_use]
fn ShouldOperationContinue(&self) -> HrResult<bool> {
HrRet(unsafe { (vt::<IGraphBuilderVT>(self).ShouldOperationContinue)(self.ptr()) })
.to_bool_hrresult()
}
}