1 /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 2 3 /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens 4 Copyright (c) 2006 - 2017 Thomas Schmitt <scdbackup@gmx.net> 5 Provided under GPL version 2 or later. 6 */ 7 8 #ifndef BURN__FILE_H 9 #define BURN__FILE_H 10 11 struct burn_source_file 12 { 13 char magic[4]; 14 15 int datafd; 16 int subfd; 17 off_t fixed_size; 18 }; 19 20 /* ts A70126 : burn_source_file obsoleted burn_source_fd */ 21 22 23 /* ts A70930 */ 24 struct burn_source_fifo { 25 char magic[4]; 26 27 /* The fifo stays inactive and unequipped with eventual resources 28 until its read() method is called for the first time. 29 Only then burn_fifo_start() gets called, allocates the complete 30 resources, starts a thread with burn_fifo_source_shoveller() 31 which shovels data and finally destroys the resources. 32 This late start is to stay modest in case of multiple tracks 33 in one disc. 34 */ 35 int is_started; 36 37 void *thread_handle; /* actually a pointer to a thread_t */ 38 int thread_pid; 39 int thread_is_valid; 40 41 /* The shoveller aborts if this is 1. Resource leaks are possible. */ 42 volatile int do_abort; 43 44 /* the burn_source for which this fifo is acting as proxy */ 45 struct burn_source *inp; 46 int inp_read_size; 47 48 /* <<< up to now it was only a pipe. This is on its way out. */ 49 int outlet[2]; 50 51 /* The ring buffer mechanism */ 52 int chunksize; 53 int chunks; 54 char *buf; 55 volatile int buf_writepos; 56 volatile int buf_readpos; 57 volatile int end_of_input; 58 volatile int input_error; 59 volatile int end_of_consumption; 60 61 off_t in_counter; 62 off_t out_counter; 63 64 int total_min_fill; 65 int interval_min_fill; 66 int put_counter; 67 int get_counter; 68 int empty_counter; 69 int full_counter; 70 71 }; 72 73 74 /** The worker behind the fifo thread. 75 Gets started from burn_fifo_start() in async.c 76 */ 77 int burn_fifo_source_shoveller(struct burn_source *source, int flag); 78 79 80 /* ts B00922 */ 81 struct burn_source_offst { 82 83 /* See burn_offst_source_new() */ 84 struct burn_source *inp; 85 struct burn_source *prev; 86 off_t start; 87 off_t size; 88 int size_adjustable; 89 90 /* for set_size/get_size */ 91 int nominal_size; 92 93 /* To help offst_free() */ 94 struct burn_source *next; 95 96 /* The current reading position */ 97 int running; 98 off_t pos; 99 100 }; 101 102 #endif /* LIBBURN__FILE_H */ 103