A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
at master 82 lines 2.9 kB view raw
1/*************************************************************************** 2 * __________ __ ___. 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 * \/ \/ \/ \/ \/ 8 * $Id$ 9 * 10 * Copyright (C) 2017 by Michael Sevakis 11 * 12 * This program is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public License 14 * as published by the Free Software Foundation; either version 2 15 * of the License, or (at your option) any later version. 16 * 17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 * KIND, either express or implied. 19 * 20 ****************************************************************************/ 21#ifndef RB_NAMESPACE_H 22#define RB_NAMESPACE_H 23 24#include "file_internal.h" 25 26enum ns_item_flags 27{ 28 NSITEM_MOUNTED = 0x01, /* item is mounted */ 29 NSITEM_HIDDEN = 0x02, /* item is not enumerated */ 30 NSITEM_CONTENTS = 0x04, /* contents enumerate */ 31}; 32 33struct ns_scan_info 34{ 35 struct dirscan_info scan; /* dirscan info - first! */ 36 int item; /* current item in parent */ 37}; 38 39/* root functions */ 40#define ROOT_MAX_REALPATH 80 41const char* root_get_realpath(void); 42int root_mount_path(const char *path, unsigned int flags); 43void root_unmount_volume(IF_MV_NONVOID(int volume)); 44int root_readdir_dirent(struct filestr_base *stream, 45 struct ns_scan_info *scanp, 46 struct DIRENT *entry); 47 48/* namespace functions */ 49int ns_parse_root(const char *path, const char **pathp, uint16_t *lenp); 50int ns_open_root(IF_MV(int volume,) unsigned int *callflagsp, 51 struct file_base_info *infop, uint16_t *attrp); 52int ns_open_stream(const char *path, unsigned int callflags, 53 struct filestr_base *stream, struct ns_scan_info *scanp); 54bool ns_volume_is_visible(IF_MV_NONVOID(int volume)); 55 56/* closes the namespace stream */ 57static inline int ns_close_stream(struct filestr_base *stream) 58{ 59 return close_stream_internal(stream); 60} 61 62#include "dircache_redirect.h" 63 64static inline void ns_dirscan_rewind(struct ns_scan_info *scanp) 65{ 66 rewinddir_dirent(&scanp->scan); 67 if (scanp->item != -1) 68 scanp->item = 0; 69} 70 71static inline int ns_readdir_dirent(struct filestr_base *stream, 72 struct ns_scan_info *scanp, 73 struct dirent *entry) 74 75{ 76 if (scanp->item == -1) 77 return readdir_dirent(stream, &scanp->scan, entry); 78 else 79 return root_readdir_dirent(stream, scanp, entry); 80} 81 82#endif /* RB_NAMESPACE_H */