A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

feat: add Rust bindings

+733
+3
.gitignore
··· 21 21 .zig-cache 22 22 zig-out 23 23 24 + # Rust build artifacts 25 + target 26 + 24 27 # Intermediate language files 25 28 /apps/lang/*.update 26 29 /apps/lang/*.new
+30
Cargo.lock
··· 1 + # This file is automatically @generated by Cargo. 2 + # It is not intended for manual editing. 3 + version = 3 4 + 5 + [[package]] 6 + name = "rockbox-graphql" 7 + version = "0.1.0" 8 + dependencies = [ 9 + "rockbox-sys", 10 + ] 11 + 12 + [[package]] 13 + name = "rockbox-rpc" 14 + version = "0.1.0" 15 + dependencies = [ 16 + "rockbox-sys", 17 + ] 18 + 19 + [[package]] 20 + name = "rockbox-server" 21 + version = "0.1.0" 22 + dependencies = [ 23 + "rockbox-graphql", 24 + "rockbox-rpc", 25 + "rockbox-sys", 26 + ] 27 + 28 + [[package]] 29 + name = "rockbox-sys" 30 + version = "0.1.0"
+6
Cargo.toml
··· 1 + [workspace] 2 + default-members = ["crates/*"] 3 + members = ["crates/*"] 4 + resolver = "2" 5 + 6 + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+4
apps/main.c
··· 155 155 156 156 /*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */ 157 157 158 + extern void start_server(void); 159 + 158 160 static void init(void); 159 161 /* main(), and various functions called by main() and init() may be 160 162 * be INIT_ATTR. These functions must not be called after the final call ··· 193 195 /* All threads should be created and public queues registered by now */ 194 196 usb_start_monitoring(); 195 197 #endif 198 + 199 + start_server(); 196 200 197 201 #if !defined(DISABLE_ACTION_REMAP) && defined(CORE_KEYREMAP_FILE) 198 202 if (file_exists(CORE_KEYREMAP_FILE))
+1
bin/.rust-1.81.0.pkg
··· 1 + hermit
+1
bin/cargo
··· 1 + .rust-1.81.0.pkg
+1
bin/cargo-clippy
··· 1 + .rust-1.81.0.pkg
+1
bin/cargo-fmt
··· 1 + .rust-1.81.0.pkg
+1
bin/clippy-driver
··· 1 + .rust-1.81.0.pkg
+1
bin/rls
··· 1 + .rust-1.81.0.pkg
+1
bin/rust-analyzer
··· 1 + .rust-1.81.0.pkg
+1
bin/rust-gdb
··· 1 + .rust-1.81.0.pkg
+1
bin/rust-gdbgui
··· 1 + .rust-1.81.0.pkg
+1
bin/rust-lldb
··· 1 + .rust-1.81.0.pkg
+1
bin/rustc
··· 1 + .rust-1.81.0.pkg
+1
bin/rustdoc
··· 1 + .rust-1.81.0.pkg
+1
bin/rustfmt
··· 1 + .rust-1.81.0.pkg
+5
build.zig
··· 2920 2920 defineCMacros(exe); 2921 2921 addIncludePaths(exe); 2922 2922 2923 + exe.addLibraryPath(.{ 2924 + .cwd_relative = "./target/release", 2925 + }); 2926 + exe.linkSystemLibrary("rockbox_server"); 2927 + exe.linkSystemLibrary("libunwind"); 2923 2928 exe.linkLibrary(libfirmware); 2924 2929 exe.linkLibrary(libspeex_voice); 2925 2930 exe.linkLibrary(librbcodec);
+7
crates/graphql/Cargo.toml
··· 1 + [package] 2 + edition = "2021" 3 + name = "rockbox-graphql" 4 + version = "0.1.0" 5 + 6 + [dependencies] 7 + rockbox-sys = {path = "../sys"}
+14
crates/graphql/src/lib.rs
··· 1 + pub fn add(left: u64, right: u64) -> u64 { 2 + left + right 3 + } 4 + 5 + #[cfg(test)] 6 + mod tests { 7 + use super::*; 8 + 9 + #[test] 10 + fn it_works() { 11 + let result = add(2, 2); 12 + assert_eq!(result, 4); 13 + } 14 + }
+7
crates/rpc/Cargo.toml
··· 1 + [package] 2 + edition = "2021" 3 + name = "rockbox-rpc" 4 + version = "0.1.0" 5 + 6 + [dependencies] 7 + rockbox-sys = {path = "../sys"}
+14
crates/rpc/src/lib.rs
··· 1 + pub fn add(left: u64, right: u64) -> u64 { 2 + left + right 3 + } 4 + 5 + #[cfg(test)] 6 + mod tests { 7 + use super::*; 8 + 9 + #[test] 10 + fn it_works() { 11 + let result = add(2, 2); 12 + assert_eq!(result, 4); 13 + } 14 + }
+12
crates/server/Cargo.toml
··· 1 + [package] 2 + edition = "2021" 3 + name = "rockbox-server" 4 + version = "0.1.0" 5 + 6 + [lib] 7 + crate-type = ["staticlib"] 8 + 9 + [dependencies] 10 + rockbox-graphql = {path = "../graphql"} 11 + rockbox-rpc = {path = "../rpc"} 12 + rockbox-sys = {path = "../sys"}
+11
crates/server/src/lib.rs
··· 1 + use rockbox_sys::playback; 2 + 3 + #[no_mangle] 4 + pub extern "C" fn start_server() { 5 + // Start the server 6 + println!("Starting server..."); 7 + let status = playback::status(); 8 + playback::current_track(); 9 + println!("Status: {}", status); 10 + playback::pause(); 11 + }
+6
crates/sys/Cargo.toml
··· 1 + [package] 2 + edition = "2021" 3 + name = "rockbox-sys" 4 + version = "0.1.0" 5 + 6 + [dependencies]
+57
crates/sys/src/browse.rs
··· 1 + use std::ffi::CString; 2 + 3 + use crate::{AddToPlCallback, BrowseContext, Entry, Mp3Entry, PlaylistInsertCb, Tm, TreeContext}; 4 + 5 + pub fn rockbox_browse(ctx: *mut BrowseContext) -> i32 { 6 + unsafe { crate::rockbox_browse(ctx) } 7 + } 8 + 9 + pub fn tree_get_context() -> *mut TreeContext { 10 + unsafe { crate::tree_get_context() } 11 + } 12 + 13 + pub fn tree_get_entries(ctx: *mut TreeContext) -> *mut Entry { 14 + unsafe { crate::tree_get_entries(ctx) } 15 + } 16 + 17 + pub fn tree_get_entry_at(ctx: *mut TreeContext, index: i32) -> *mut Entry { 18 + unsafe { crate::tree_get_entry_at(ctx, index) } 19 + } 20 + 21 + pub fn set_current_file(path: &str) { 22 + let path = CString::new(path).unwrap(); 23 + unsafe { crate::set_current_file(path.as_ptr()) } 24 + } 25 + 26 + pub fn set_dirfilter(filter: i32) { 27 + unsafe { crate::set_dirfilter(filter) } 28 + } 29 + 30 + pub fn onplay_show_playlist_menu(path: &str, attr: i32, playlist_insert_cb: PlaylistInsertCb) { 31 + let path = CString::new(path).unwrap(); 32 + unsafe { crate::onplay_show_playlist_menu(path.as_ptr(), attr, playlist_insert_cb) } 33 + } 34 + 35 + pub fn onplay_show_playlist_cat_menu(track_name: &str, attr: i32, add_to_pl_cb: AddToPlCallback) { 36 + let track_name = CString::new(track_name).unwrap(); 37 + unsafe { crate::onplay_show_playlist_cat_menu(track_name.as_ptr(), attr, add_to_pl_cb) } 38 + } 39 + 40 + pub fn browse_id3( 41 + id3: *mut Mp3Entry, 42 + playlist_display_index: i32, 43 + playlist_amount: i32, 44 + modified: *mut Tm, 45 + track_ct: i32, 46 + ) -> bool { 47 + let ret = unsafe { 48 + crate::browse_id3( 49 + id3, 50 + playlist_display_index, 51 + playlist_amount, 52 + modified, 53 + track_ct, 54 + ) 55 + }; 56 + ret != 0 57 + }
crates/sys/src/dir.rs

This is a binary file and will not be displayed.

crates/sys/src/file.rs

This is a binary file and will not be displayed.

+472
crates/sys/src/lib.rs
··· 1 + use std::ffi::{c_char, c_int, c_long, c_uchar, c_uint, c_ulong, c_void}; 2 + 3 + pub mod browse; 4 + pub mod dir; 5 + pub mod file; 6 + pub mod metadata; 7 + pub mod playback; 8 + pub mod playlist; 9 + pub mod settings; 10 + pub mod sound; 11 + pub mod system; 12 + pub mod tagcache; 13 + 14 + const MAX_PATH: usize = 260; 15 + const ID3V2_BUF_SIZE: usize = 1800; 16 + 17 + #[repr(C)] 18 + #[derive(Debug)] 19 + pub struct Mp3Entry { 20 + pub path: [c_char; MAX_PATH], // char path[MAX_PATH] 21 + pub title: *mut c_char, // char* title 22 + pub artist: *mut c_char, // char* artist 23 + pub album: *mut c_char, // char* album 24 + pub genre_string: *mut c_char, // char* genre_string 25 + pub disc_string: *mut c_char, // char* disc_string 26 + pub track_string: *mut c_char, // char* track_string 27 + pub year_string: *mut c_char, // char* year_string 28 + pub composer: *mut c_char, // char* composer 29 + pub comment: *mut c_char, // char* comment 30 + pub albumartist: *mut c_char, // char* albumartist 31 + pub grouping: *mut c_char, // char* grouping 32 + pub discnum: c_int, // int discnum 33 + pub tracknum: c_int, // int tracknum 34 + pub layer: c_int, // int layer 35 + pub year: c_int, // int year 36 + pub id3version: c_uchar, // unsigned char id3version 37 + pub codectype: c_uint, // unsigned int codectype 38 + pub bitrate: c_uint, // unsigned int bitrate 39 + pub frequency: c_ulong, // unsigned long frequency 40 + pub id3v2len: c_ulong, // unsigned long id3v2len 41 + pub id3v1len: c_ulong, // unsigned long id3v1len 42 + pub first_frame_offset: c_ulong, // unsigned long first_frame_offset 43 + pub filesize: c_ulong, // unsigned long filesize 44 + pub length: c_ulong, // unsigned long length 45 + pub elapsed: c_ulong, // unsigned long elapsed 46 + pub lead_trim: c_int, // int lead_trim 47 + pub tail_trim: c_int, // int tail_trim 48 + pub samples: u64, // uint64_t samples 49 + pub frame_count: c_ulong, // unsigned long frame_count 50 + pub bytesperframe: c_ulong, // unsigned long bytesperframe 51 + pub vbr: bool, // bool vbr 52 + pub has_toc: bool, // bool has_toc 53 + pub toc: [c_uchar; 100], // unsigned char toc[100] 54 + pub needs_upsampling_correction: bool, // bool needs_upsampling_correction 55 + pub id3v2buf: [c_char; ID3V2_BUF_SIZE], // char id3v2buf[ID3V2_BUF_SIZE] 56 + pub id3v1buf: [[c_char; 92]; 4], // char id3v1buf[4][92] 57 + pub offset: c_ulong, // unsigned long offset 58 + pub index: c_int, // int index 59 + pub skip_resume_adjustments: bool, // bool skip_resume_adjustments 60 + pub autoresumable: c_uchar, // unsigned char autoresumable 61 + pub tagcache_idx: c_long, // long tagcache_idx 62 + pub rating: c_int, // int rating 63 + pub score: c_int, // int score 64 + pub playcount: c_long, // long playcount 65 + pub lastplayed: c_long, // long lastplayed 66 + pub playtime: c_long, // long playtime 67 + pub track_level: c_long, // long track_level 68 + pub album_level: c_long, // long album_level 69 + pub track_gain: c_long, // long track_gain 70 + pub album_gain: c_long, // long album_gain 71 + pub track_peak: c_long, // long track_peak 72 + pub album_peak: c_long, // long album_peak 73 + pub has_embedded_albumart: bool, // bool has_embedded_albumart 74 + pub albumart: *mut c_void, // struct mp3_albumart albumart 75 + pub has_embedded_cuesheet: bool, // bool has_embedded_cuesheet 76 + pub embedded_cuesheet: *mut c_void, // struct embedded_cuesheet embedded_cuesheet 77 + pub cuesheet: *mut c_void, // struct cuesheet* cuesheet 78 + pub mb_track_id: *mut c_char, // char* mb_track_id 79 + pub is_asf_stream: bool, // bool is_asf_stream 80 + } 81 + 82 + const PLAYLIST_CONTROL_FILE: &str = "./config/rockbox.org/.playlist_control"; 83 + const MAX_DIR_LEVELS: usize = 10; 84 + 85 + #[repr(C)] 86 + #[derive(Debug)] 87 + pub struct PlaylistInfo { 88 + pub utf8: bool, // bool utf8 89 + pub control_created: bool, // bool control_created 90 + pub flags: c_uint, // unsigned int flags 91 + pub fd: c_int, // int fd 92 + pub control_fd: c_int, // int control_fd 93 + pub max_playlist_size: c_int, // int max_playlist_size 94 + pub indices: *mut c_ulong, // unsigned long* indices 95 + pub index: c_int, // int index 96 + pub first_index: c_int, // int first_index 97 + pub amount: c_int, // int amount 98 + pub last_insert_pos: c_int, // int last_insert_pos 99 + pub started: bool, // bool started 100 + pub last_shuffled_start: c_int, // int last_shuffled_start 101 + pub seed: c_int, // int seed 102 + pub mutex: *mut c_void, // struct mutex (convert to a void pointer for FFI) 103 + pub dirlen: c_int, // int dirlen 104 + pub filename: [c_char; MAX_PATH], // char filename[MAX_PATH] 105 + pub control_filename: 106 + [c_char; std::mem::size_of::<[u8; PLAYLIST_CONTROL_FILE.len() + 100 + 8]>()], // char control_filename[sizeof(PLAYLIST_CONTROL_FILE) + 8] 107 + pub dcfrefs_handle: c_int, // int dcfrefs_handle 108 + } 109 + 110 + #[repr(C)] 111 + #[derive(Debug)] 112 + pub struct PlaylistTrackInfo { 113 + pub filename: [c_char; MAX_PATH], // char filename[MAX_PATH] 114 + pub attr: c_int, 115 + pub index: c_int, 116 + pub display_index: c_int, 117 + } 118 + 119 + #[repr(C)] 120 + #[derive(Debug, Copy, Clone, PartialEq, Eq)] 121 + pub enum ThemableIcons { 122 + NoIcon = -1, 123 + IconNoIcon, // Icon_NOICON = NOICON 124 + IconAudio, // Icon_Audio 125 + IconFolder, // Icon_Folder 126 + IconPlaylist, // Icon_Playlist 127 + IconCursor, // Icon_Cursor 128 + IconWps, // Icon_Wps 129 + IconFirmware, // Icon_Firmware 130 + IconFont, // Icon_Font 131 + IconLanguage, // Icon_Language 132 + IconConfig, // Icon_Config 133 + IconPlugin, // Icon_Plugin 134 + IconBookmark, // Icon_Bookmark 135 + IconPreset, // Icon_Preset 136 + IconQueued, // Icon_Queued 137 + IconMoving, // Icon_Moving 138 + IconKeyboard, // Icon_Keyboard 139 + IconReverseCursor, // Icon_Reverse_Cursor 140 + IconQuestionmark, // Icon_Questionmark 141 + IconMenuSetting, // Icon_Menu_setting 142 + IconMenuFunctioncall, // Icon_Menu_functioncall 143 + IconSubmenu, // Icon_Submenu 144 + IconSubmenuEntered, // Icon_Submenu_Entered 145 + IconRecording, // Icon_Recording 146 + IconVoice, // Icon_Voice 147 + IconGeneralSettingsMenu, // Icon_General_settings_menu 148 + IconSystemMenu, // Icon_System_menu 149 + IconPlaybackMenu, // Icon_Playback_menu 150 + IconDisplayMenu, // Icon_Display_menu 151 + IconRemoteDisplayMenu, // Icon_Remote_Display_menu 152 + IconRadioScreen, // Icon_Radio_screen 153 + IconFileViewMenu, // Icon_file_view_menu 154 + IconEQ, // Icon_EQ 155 + IconRockbox, // Icon_Rockbox 156 + IconLastThemeable, // Icon_Last_Themeable 157 + } 158 + 159 + #[repr(C)] 160 + #[derive(Debug)] 161 + pub struct TreeCache { 162 + pub entries_handle: c_int, // int entries_handle 163 + pub name_buffer_handle: c_int, // int name_buffer_handle 164 + pub max_entries: c_int, // int max_entries 165 + pub name_buffer_size: c_int, // int name_buffer_size (in bytes) 166 + } 167 + 168 + #[repr(C)] 169 + #[derive(Debug)] 170 + pub struct TreeContext { 171 + pub currdir: [c_char; MAX_PATH], // char currdir[MAX_PATH] 172 + pub dirlevel: c_int, // int dirlevel 173 + pub selected_item: c_int, // int selected_item 174 + pub selected_item_history: [c_int; MAX_DIR_LEVELS], // int selected_item_history[MAX_DIR_LEVELS] 175 + pub dirfilter: *mut c_int, // int* dirfilter 176 + pub filesindir: c_int, // int filesindir 177 + pub dirsindir: c_int, // int dirsindir 178 + pub dirlength: c_int, // int dirlength 179 + pub currtable: c_int, // int currtable (db use) 180 + pub currextra: c_int, // int currextra (db use) 181 + pub sort_dir: c_int, // int sort_dir 182 + pub out_of_tree: c_int, // int out_of_tree 183 + pub cache: TreeCache, // struct tree_cache cache 184 + pub dirfull: bool, // bool dirfull 185 + pub is_browsing: bool, // bool is_browsing 186 + pub browse: *mut BrowseContext, // struct browse_context* browse 187 + } 188 + 189 + #[repr(C)] 190 + #[derive(Debug)] 191 + pub struct BrowseContext { 192 + pub dirfilter: c_int, // int dirfilter 193 + pub flags: c_uint, // unsigned flags 194 + pub callback_show_item: 195 + Option<extern "C" fn(name: *mut c_char, attr: c_int, tc: *mut TreeContext) -> bool>, // bool (*callback_show_item)(...) 196 + pub title: *mut c_char, // char* title 197 + pub icon: ThemableIcons, // enum themable_icons icon 198 + pub root: *const c_char, // const char* root 199 + pub selected: *const c_char, // const char* selected 200 + pub buf: *mut c_char, // char* buf 201 + pub bufsize: usize, // size_t bufsize 202 + } 203 + 204 + #[repr(C)] 205 + #[derive(Debug)] 206 + pub struct Entry { 207 + pub name: *mut c_char, // char* name 208 + pub attr: c_int, // int attr (FAT attributes + file type flags) 209 + pub time_write: c_uint, // unsigned time_write (Last write time) 210 + pub customaction: c_int, // int customaction (db use) 211 + } 212 + 213 + pub type PlaylistInsertCb = Option<extern "C" fn()>; 214 + pub type AddToPlCallback = Option<extern "C" fn()>; 215 + 216 + #[repr(C)] 217 + #[derive(Debug)] 218 + pub struct Tm { 219 + pub tm_sec: c_int, // Seconds. [0-60] (1 leap second) 220 + pub tm_min: c_int, // Minutes. [0-59] 221 + pub tm_hour: c_int, // Hours. [0-23] 222 + pub tm_mday: c_int, // Day. [1-31] 223 + pub tm_mon: c_int, // Month. [0-11] 224 + pub tm_year: c_int, // Year - 1900 225 + pub tm_wday: c_int, // Day of week. [0-6] 226 + pub tm_yday: c_int, // Days in year. [0-365] 227 + pub tm_isdst: c_int, // DST. [-1/0/1] 228 + pub tm_gmtoff: c_long, // Seconds east of UTC 229 + pub tm_zone: *const c_char, // Timezone abbreviation 230 + } 231 + 232 + extern "C" { 233 + // Playback control 234 + fn audio_pause(); 235 + fn audio_play(elapsed: c_long, offset: c_long); 236 + fn audio_resume(); 237 + fn audio_next(); 238 + fn audio_prev(); 239 + fn audio_ff_rewind(newtime: c_int); 240 + fn audio_next_track() -> *mut Mp3Entry; 241 + fn audio_status() -> c_int; 242 + fn audio_current_track() -> *mut Mp3Entry; 243 + fn audio_flush_and_reload_tracks(); 244 + fn audio_get_file_pos() -> c_int; 245 + fn audio_hard_stop(); 246 + 247 + // Playlist control 248 + fn playlist_get_current() -> *mut PlaylistInfo; 249 + fn playlist_get_resume_info(resume_index: *mut c_int) -> c_int; 250 + fn playlist_get_track_info( 251 + playlist: *mut PlaylistInfo, 252 + index: c_int, 253 + info: *mut PlaylistTrackInfo, 254 + ) -> c_int; 255 + fn playlist_get_first_index(playlist: *mut PlaylistInfo) -> c_int; 256 + fn playlist_get_display_index() -> c_int; 257 + fn playlist_amount() -> c_int; 258 + fn playlist_resume() -> c_int; 259 + fn playlist_resume_track(start_index: c_int, crc: c_uint, elapsed: c_ulong, offset: c_ulong); 260 + fn playlist_set_modified(playlist: *mut PlaylistInfo, modified: c_uchar); 261 + fn playlist_start(start_index: c_int, elapsed: c_ulong, offset: c_ulong); 262 + fn playlist_sync(playlist: *mut PlaylistInfo); 263 + fn playlist_remove_all_tracks(playlist: *mut PlaylistInfo) -> c_int; 264 + fn playlist_create(dir: *const c_char, file: *const c_char) -> c_int; 265 + fn playlist_insert_track( 266 + playlist: *mut PlaylistInfo, 267 + filename: *const c_char, 268 + position: c_int, 269 + queue: c_uchar, 270 + sync: c_uchar, 271 + ) -> c_int; 272 + fn playlist_insert_directory( 273 + playlist: *mut PlaylistInfo, 274 + dir: *const c_char, 275 + position: c_int, 276 + queue: c_uchar, 277 + recurse: c_uchar, 278 + ) -> c_int; 279 + fn playlist_insert_playlist( 280 + playlist: *mut PlaylistInfo, 281 + filename: *const c_char, 282 + position: c_int, 283 + queue: c_uchar, 284 + ) -> c_int; 285 + fn playlist_shuffle(random_sed: c_int, start_index: c_int) -> c_int; 286 + fn warn_on_pl_erase() -> c_uchar; 287 + 288 + // Sound 289 + fn adjust_volume(); 290 + fn sound_set(); 291 + fn sound_current(); 292 + fn sound_default(); 293 + fn sound_min(); 294 + fn sound_max(); 295 + fn sound_unit(); 296 + fn sound_val2phys(); 297 + fn sound_enum_hw_eq_band_setting(); 298 + fn sound_get_pitch(); 299 + fn sound_set_pitch(); 300 + fn audio_master_sampr_list(); 301 + fn pcm_apply_settings(); 302 + fn pcm_play_data(); 303 + fn pcm_play_stop(); 304 + fn pcm_set_frequency(); 305 + fn pcm_is_playing(); 306 + fn pcm_play_lock(); 307 + fn pcm_play_unlock(); 308 + fn beep_play(); 309 + fn dsp_set_crossfeed_type(); 310 + fn dsp_eq_enable(); 311 + fn dsp_dither_enable(); 312 + fn dsp_get_timestretch(); 313 + fn dsp_set_timestretch(); 314 + fn dsp_timestretch_enable(); 315 + fn dsp_timestrech_available(); 316 + fn dsp_configure(); 317 + fn dsp_get_config(); 318 + fn dsp_process(); 319 + fn mixer_channel_status(); 320 + fn mixer_channel_get_buffer(); 321 + fn mixer_channel_calculate_peaks(); 322 + fn mixer_channel_play_data(); 323 + fn mixer_channel_play_pause(); 324 + fn mixer_channel_stop(); 325 + fn mixer_channel_set_amplitude(); 326 + fn mixer_channel_get_bytes_waiting(); 327 + fn mixer_channel_set_buffer_hook(); 328 + fn mixer_set_frequency(); 329 + fn mixer_get_frequency(); 330 + fn pcmbuf_fade(); 331 + fn pcmbuf_set_low_latency(); 332 + fn system_sound_play(); 333 + fn keyclick_click(); 334 + 335 + // Browsing 336 + fn rockbox_browse(browse: *mut BrowseContext) -> c_int; 337 + fn tree_get_context() -> *mut TreeContext; 338 + fn tree_get_entries(t: *mut TreeContext) -> *mut Entry; 339 + fn tree_get_entry_at(t: *mut TreeContext, index: c_int) -> *mut Entry; 340 + fn set_current_file(path: *const c_char); 341 + fn set_dirfilter(l_dirfilter: c_int); 342 + fn onplay_show_playlist_menu( 343 + path: *const c_char, // const char* path 344 + attr: c_int, // int attr 345 + playlist_insert_cb: PlaylistInsertCb, // void (*playlist_insert_cb)() 346 + ); 347 + fn onplay_show_playlist_cat_menu( 348 + track_name: *const c_char, 349 + attr: c_int, 350 + add_to_pl_cb: AddToPlCallback, 351 + ); 352 + fn browse_id3( 353 + id3: *mut Mp3Entry, 354 + playlist_display_index: c_int, 355 + playlist_amount: c_int, 356 + modified: *mut Tm, 357 + track_ct: c_int, 358 + ) -> c_uchar; 359 + 360 + // Directory 361 + fn open_dir(); 362 + fn close_dir(); 363 + fn readdir(); 364 + fn mkdir(); 365 + fn rmdir(); 366 + fn dir_exists(); 367 + fn dir_get_info(); 368 + 369 + // File 370 + fn open_utf8(); 371 + fn open(); 372 + fn creat(); 373 + fn close(); 374 + fn read(); 375 + fn lseek(); 376 + fn write(); 377 + fn remove(); 378 + fn rename(); 379 + fn ftruncate(); 380 + fn filesize(); 381 + fn fdprintf(); 382 + fn read_line(); 383 + fn settings_parseline(); 384 + fn storage_sleep(); 385 + fn storage_spin(); 386 + fn storage_spindown(); 387 + fn reload_directory(); 388 + fn create_numbered_filename(); 389 + fn file_exists(); 390 + fn strip_extension(); 391 + fn crc_32(); 392 + fn crc_32r(); 393 + fn filetype_get_attr(); 394 + fn filetype_get_plugin(); 395 + 396 + // Metadata 397 + fn get_metadata(); 398 + fn get_codec_string(); 399 + fn count_mp3_frames(); 400 + fn create_xing_header(); 401 + fn tagcache_search(); 402 + fn tagcache_search_set_uniqbuf(); 403 + fn tagcache_search_add_filter(); 404 + fn tagcache_get_next(); 405 + fn tagcache_get_numeric(); 406 + fn tagcache_get_stat(); 407 + fn tagcache_commit_finalize(); 408 + fn tagcache_is_in_ram(); 409 + fn tagcache_fill_tags(); 410 + fn tagtree_subentries_do_action(); 411 + fn search_albumart_files(); 412 + 413 + // Kernel / System 414 + fn sleep(ticks: c_uint); 415 + fn r#yield(); 416 + fn current_tick(); 417 + fn default_event_handler(event: c_long); 418 + fn create_thread(); 419 + fn thread_self(); 420 + fn thread_exit(); 421 + fn thread_wait(); 422 + fn thread_thaw(); 423 + fn thread_set_priority(thread_id: c_uint, priority: c_int); 424 + fn mutext_init(); 425 + fn mutex_lock(); 426 + fn mutex_unlock(); 427 + fn semaphore_init(); 428 + fn semaphore_wait(); 429 + fn semaphore_release(); 430 + fn reset_poweroff_timer(); 431 + fn set_sleeptimer_duration(); 432 + fn get_sleep_timer(); 433 + fn commit_dcache(); 434 + fn commit_discard_dcache(); 435 + fn commit_discard_idcache(); 436 + 437 + // Menu 438 + fn root_menu_get_options(); 439 + fn do_menu(); 440 + fn root_menu_set_default(); 441 + fn root_menu_write_to_cfg(); 442 + fn root_menu_load_from_cfg(); 443 + 444 + // Settings 445 + fn get_settings_list(count: *mut c_int); 446 + fn find_settings(); 447 + fn settings_save(); 448 + fn option_screen(); 449 + fn set_option(); 450 + fn set_bool_options(); 451 + fn set_int(); 452 + fn set_int_ex(); 453 + fn set_bool(); 454 + fn set_color(); 455 + 456 + // Misc 457 + fn codec_load_file(); 458 + fn codec_run_proc(); 459 + fn codec_close(); 460 + fn read_bmp_file(); 461 + fn read_bmp_fd(); 462 + fn read_jpeg_file(); 463 + fn read_jpeg_fd(); 464 + 465 + // Plugin 466 + fn plugin_open(); 467 + fn plugin_get_buffer(); 468 + fn plugin_get_audio_buffer(); 469 + fn plugin_release_audio_buffer(); 470 + fn plugin_get_current_filename(); 471 + fn plugin_reserve_buffer(); 472 + }
crates/sys/src/metadata.rs

This is a binary file and will not be displayed.

+68
crates/sys/src/playback.rs
··· 1 + pub fn pause() { 2 + unsafe { 3 + crate::audio_pause(); 4 + } 5 + } 6 + 7 + pub fn play(elapsed: i64, offset: i64) { 8 + unsafe { 9 + crate::audio_play(elapsed, offset); 10 + } 11 + } 12 + 13 + pub fn resume() { 14 + unsafe { 15 + crate::audio_resume(); 16 + } 17 + } 18 + 19 + pub fn next() { 20 + unsafe { 21 + crate::audio_next(); 22 + } 23 + } 24 + 25 + pub fn prev() { 26 + unsafe { 27 + crate::audio_prev(); 28 + } 29 + } 30 + 31 + pub fn ff_rewind(newtime: i32) { 32 + unsafe { 33 + crate::audio_ff_rewind(newtime); 34 + } 35 + } 36 + 37 + pub fn next_track() { 38 + unsafe { 39 + crate::audio_next_track(); 40 + } 41 + } 42 + 43 + pub fn status() -> i32 { 44 + unsafe { crate::audio_status() } 45 + } 46 + 47 + pub fn current_track() { 48 + let track = unsafe { 49 + crate::audio_current_track(); 50 + }; 51 + println!("{:?}", track); 52 + } 53 + 54 + pub fn flush_and_reload_tracks() { 55 + unsafe { 56 + crate::audio_flush_and_reload_tracks(); 57 + } 58 + } 59 + 60 + pub fn get_file_pos() -> i32 { 61 + unsafe { crate::audio_get_file_pos() } 62 + } 63 + 64 + pub fn hard_stop() { 65 + unsafe { 66 + crate::audio_hard_stop(); 67 + } 68 + }
crates/sys/src/playlist.rs

This is a binary file and will not be displayed.

crates/sys/src/settings.rs

This is a binary file and will not be displayed.

crates/sys/src/sound.rs

This is a binary file and will not be displayed.

crates/sys/src/system.rs

This is a binary file and will not be displayed.

crates/sys/src/tagcache.rs

This is a binary file and will not be displayed.

+4
flake.nix
··· 34 34 pkgs.pkg-config 35 35 pkgs.gcc 36 36 pkgs.zlib 37 + pkgs.cargo 38 + pkgs.rustc 37 39 ]; 38 40 39 41 # Smaller binaries and avoids shipping glibc. ··· 100 102 pkgs.pkg-config 101 103 pkgs.gcc 102 104 pkgs.zlib 105 + pkgs.cargo 106 + pkgs.rustc 103 107 ]; 104 108 }; 105 109 }));