pub struct Instance { /* private fields */ }
Implementations§
Source§impl Instance
impl Instance
Sourcepub fn new() -> Option<Instance>
pub fn new() -> Option<Instance>
Create and initialize a libvlc instance.
Examples found in repository?
examples/cli_player.rs (line 21)
11fn main() {
12 let args: Vec<String> = std::env::args().collect();
13
14 let path = match args.get(1) {
15 Some(s) => s,
16 None => {
17 println!("Usage: cli_audio_player path_to_a_media_file");
18 return;
19 }
20 };
21 let instance = Instance::new().unwrap();
22
23 let md = Media::new_path(&instance, path).unwrap();
24 let mdp = MediaPlayer::new(&instance).unwrap();
25
26 let (tx, rx) = channel::<()>();
27
28 let em = md.event_manager();
29 let _ = em.attach(EventType::MediaStateChanged, move |e, _| {
30 match e {
31 Event::MediaStateChanged(s) => {
32 println!("State : {:?}", s);
33 if s == State::Ended || s == State::Error {
34 tx.send(()).unwrap();
35 }
36 },
37 _ => (),
38 }
39 });
40
41 mdp.set_media(&md);
42
43 // Start playing
44 mdp.play().unwrap();
45
46 // Wait for end state
47 rx.recv().unwrap();
48}
Sourcepub fn add_intf(&self, name: &str) -> Result<(), ()>
pub fn add_intf(&self, name: &str) -> Result<(), ()>
Try to start a user interface for the libvlc instance.
Sourcepub fn set_user_agent(&self, name: &str, http: &str)
pub fn set_user_agent(&self, name: &str, http: &str)
Sets the application name. LibVLC passes this as the user agent string when a protocol requires it.
Sourcepub fn set_app_id(&self, id: &str, version: &str, icon: &str)
pub fn set_app_id(&self, id: &str, version: &str, icon: &str)
Sets some meta-information about the application.
Sourcepub fn audio_filter_list_get(&self) -> Option<ModuleDescriptionList>
pub fn audio_filter_list_get(&self) -> Option<ModuleDescriptionList>
Returns a list of audio filters that are available.
Sourcepub fn video_filter_list_get(&self) -> Option<ModuleDescriptionList>
pub fn video_filter_list_get(&self) -> Option<ModuleDescriptionList>
Returns a list of video filters that are available.
Sourcepub fn set_log<F: Fn(LogLevel, Log, Cow<'_, str>) + Send + 'static>(&self, f: F)
pub fn set_log<F: Fn(LogLevel, Log, Cow<'_, str>) + Send + 'static>(&self, f: F)
Set logging callback
Sourcepub fn raw(&self) -> *mut libvlc_instance_t
pub fn raw(&self) -> *mut libvlc_instance_t
Returns raw pointer
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Instance
impl RefUnwindSafe for Instance
impl !Send for Instance
impl !Sync for Instance
impl Unpin for Instance
impl UnwindSafe for Instance
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more