Trait winsafe::prelude::dshow_IFileSinkFilter

source ·
pub trait dshow_IFileSinkFilter: ole_IUnknown {
    // Provided methods
    unsafe fn GetCurFile(
        &self,
        mt: Option<&mut AM_MEDIA_TYPE<'_>>
    ) -> HrResult<String> { ... }
    fn SetFileName(
        &self,
        file_name: &str,
        mt: Option<&AM_MEDIA_TYPE<'_>>
    ) -> HrResult<()> { ... }
}
Available on crate features kernel and dshow only.
Expand description

This trait is enabled with the dshow feature, and provides methods for IFileSinkFilter.

Prefer importing this trait through the prelude:

use winsafe::prelude::*;

Provided Methods§

source

unsafe fn GetCurFile( &self, mt: Option<&mut AM_MEDIA_TYPE<'_>> ) -> HrResult<String>

IFileSinkFilter::GetCurFile method.

§Safety

If you pass an AM_MEDIA_TYPE reference to pmt, its pbFormat field may return a valid reference to a format block. If so, you must free it with CoTaskMemFree, or you’ll have a memory leak.

§Examples
use winsafe::{self as w, prelude::*, guard};

let sinkf: w::IFileSinkFilter; // initialized somewhere

let mut ammt = w::AM_MEDIA_TYPE::default();
unsafe {
    sinkf.GetCurFile(Some(&mut ammt))?;
    if let Some(pb_format) = ammt.pbFormat::<w::DVINFO>() { // valid reference?
        let _ = guard::CoTaskMemFreeGuard::new(pb_format as *mut _  as _, 0);
    }
}
source

fn SetFileName( &self, file_name: &str, mt: Option<&AM_MEDIA_TYPE<'_>> ) -> HrResult<()>

Object Safety§

This trait is not object safe.

Implementors§