A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
at master 60 lines 2.0 kB view raw
1/*************************************************************************** 2 * __________ __ ___. 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 * \/ \/ \/ \/ \/ 8 * $Id$ 9 * 10 * Copyright (C) 2014 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 DISK_CACHE_H 22#define DISK_CACHE_H 23 24#include "mutex.h" 25#include "mv.h" 26 27static inline void dc_lock_cache(void) 28{ 29 extern struct mutex disk_cache_mutex; 30 mutex_lock(&disk_cache_mutex); 31} 32 33static inline void dc_unlock_cache(void) 34{ 35 extern struct mutex disk_cache_mutex; 36 mutex_unlock(&disk_cache_mutex); 37} 38 39void * dc_cache_probe(IF_MV(int volume,) sector_t secnum, 40 unsigned int *flags); 41void dc_dirty_buf(void *buf); 42void dc_discard_buf(void *buf); 43void dc_commit_all(IF_MV_NONVOID(int volume)); 44void dc_discard_all(IF_MV_NONVOID(int volume)); 45 46void dc_init(void) INIT_ATTR; 47 48/* in addition to filling, writeback is implemented by the client */ 49extern void dc_writeback_callback(IF_MV(int volume, ) sector_t sector, 50 void *buf); 51 52 53/** These synchronize and can be called by anyone **/ 54 55/* expropriate a buffer from the cache of DC_CACHE_BUFSIZE bytes */ 56void * dc_get_buffer(void); 57/* return buffer to the cache by buffer */ 58void dc_release_buffer(void *buf); 59 60#endif /* DISK_CACHE_H */