Skip to content

Commit

Permalink
add mk_load_mp4_file function
Browse files Browse the repository at this point in the history
  • Loading branch information
BenLocal committed Jan 3, 2025
1 parent 2f6761e commit 8d6b2f1
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,11 @@ impl Drop for EnvIni {
}
}

impl AsRef<mk_ini> for EnvIni {
fn as_ref(&self) -> &mk_ini {
&self.0
}
}

unsafe impl Send for EnvIni {}
unsafe impl Sync for EnvIni {}
37 changes: 37 additions & 0 deletions src/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,40 @@ extern "C" fn proxy_player_on_close(
cb(err, const_ptr_to_string!(what), sys_err);
};
}

pub struct Mp4ProxyPlayer;

impl Mp4ProxyPlayer {
pub fn new(
vhost: &str,
app: &str,
stream: &str,
file_path: &str,
file_repeat: i32,
ini: Option<EnvIni>,
) {
unsafe {
let vhost = const_str_to_ptr!(vhost);
let app = const_str_to_ptr!(app);
let stream = const_str_to_ptr!(stream);
let file_path = const_str_to_ptr!(file_path);
match ini {
Some(ini) => mk_load_mp4_file2(
vhost.as_ptr(),
app.as_ptr(),
stream.as_ptr(),
file_path.as_ptr(),
file_repeat,
*ini.as_ref(),
),
None => mk_load_mp4_file(
vhost.as_ptr(),
app.as_ptr(),
stream.as_ptr(),
file_path.as_ptr(),
file_repeat,
),
}
}
}
}

0 comments on commit 8d6b2f1

Please sign in to comment.