1 /* 2 * Copyright 2008-2013 Various Authors 3 * Copyright 2008 Timo Hirvonen 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License as 7 * published by the Free Software Foundation; either version 2 of the 8 * License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef CMUS_JOB_H 20 #define CMUS_JOB_H 21 22 #include "cmus.h" 23 24 #define JOB_TYPE_LIB 1 << 0 25 #define JOB_TYPE_PL 1 << 1 26 #define JOB_TYPE_QUEUE 1 << 2 27 28 #define JOB_TYPE_ADD 1 << 16 29 #define JOB_TYPE_UPDATE 1 << 17 30 #define JOB_TYPE_UPDATE_CACHE 1 << 18 31 #define JOB_TYPE_DELETE 1 << 19 32 33 struct add_data { 34 enum file_type type; 35 char *name; 36 add_ti_cb add; 37 void *opaque; 38 unsigned int force : 1; 39 }; 40 41 struct update_data { 42 size_t size; 43 size_t used; 44 struct track_info **ti; 45 unsigned int force : 1; 46 }; 47 48 struct update_cache_data { 49 unsigned int force : 1; 50 }; 51 52 struct pl_delete_data { 53 struct playlist *pl; 54 void (*cb)(struct playlist *); 55 }; 56 57 extern int job_fd; 58 59 void job_init(void); 60 void job_exit(void); 61 void job_schedule_add(int type, struct add_data *data); 62 void job_schedule_update(struct update_data *data); 63 void job_schedule_update_cache(int type, struct update_cache_data *data); 64 void job_schedule_pl_delete(struct pl_delete_data *data); 65 void job_handle(void); 66 67 #endif 68