File: daisy.h

package info (click to toggle)
daisy-player 11.6.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,876 kB
  • sloc: sh: 13,272; ansic: 9,685; makefile: 737; sed: 16
file content (227 lines) | stat: -rw-r--r-- 8,532 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
/* header file for daisy-player
 *  Copyright (C)2018 J. Lemmens
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 * Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#define _GNU_SOURCE

#include <string.h>
#include <libgen.h>
#include <stdio.h>
#include <unistd.h>
#include <strings.h>
#define __STDC_WANT_IEC_60559_BFP_EXT__
#include <stdlib.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <ncursesw/curses.h>
#include <fcntl.h>
#include <dirent.h>
#include <pwd.h>
#include <locale.h>
#include <libintl.h>
#include <sox.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <libxml/xmlreader.h>
#include <libxml/xmlwriter.h>
#include <libxml/HTMLparser.h>
#include <cdio/cdio.h>
#include <cdio/disc.h>
#include <magic.h>
#include <fnmatch.h>
#include <sys/select.h>
#include <grp.h>
#include <time.h>

#undef PACKAGE
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_URL
#undef PACKAGE_VERSION
#undef VERSION
#include "config.h"

#ifdef HAVE_CDIO_PARANOIA_CDDA_H
   #include <cdio/paranoia/paranoia.h>
#else
   #include <cdio/cdda.h>
   #include <cdio/paranoia.h>
#endif

#define MAX_CMD 512
#define MAX_STR 256
#define MAX_TAG 1024
#define DAISY_PLAYER

typedef struct Daisy
{
   int playorder, x, y, screen;
   float begin, duration;
   char *xml_file, *anchor, *clips_file;
   char *clips_anchor, *orig_smil;
   char class[MAX_STR], label[100];
   char first_id[MAX_STR], last_id[MAX_STR];
   int level, page_number;
   char *daisy_mp; // discinfo
   char *filename; // Audio-CD
   lsn_t first_lsn, last_lsn;
} daisy_t;

typedef struct My_attribute
{
   char class[MAX_STR],
        clip_begin[MAX_STR],
        clip_end[MAX_STR],
        content[MAX_STR],
        dc_format[MAX_STR],
        dc_title[MAX_STR],
        dtb_depth[MAX_STR],
        dtb_totalPageCount[MAX_STR],
        href[MAX_STR],
        http_equiv[MAX_STR],
        *id,
        *idref,
        media_type[MAX_STR],
        name[MAX_STR],
        ncc_depth[MAX_STR],
        ncc_maxPageNormal[MAX_STR],
        ncc_totalTime[MAX_STR],
        number[MAX_STR],
        playorder[MAX_STR],
        smilref[MAX_STR],
        *src,
        toc[MAX_STR],
        value[MAX_STR];
} my_attribute_t;

typedef struct Misc
{
   int discinfo, playing, just_this_item, current_page_number;
   int current, max_y, max_x, total_items, level, displaying, ignore_bookmark;
   int items_in_opf, items_in_ncx;
   int tts_no, depth, total_pages;
   int pipefd[2], tmp_wav_fd, has_audio_tag;
   int pause_resume_playing, mounted_by_daisy_player;
   char *pause_resume_id, *prev_id, *current_id;
   char *audio_id;
   float speed, total_time, clip_begin, clip_end;
   long min_vol, max_vol, volume;
   htmlDocPtr doc;
   xmlTextReaderPtr reader;
   pid_t player_pid, cdda_pid, main_pid;
   time_t seconds;
   char ncc_html[MAX_STR], ncc_totalTime[MAX_STR], ocr_language[5];
   char daisy_version[MAX_STR], daisy_title[MAX_STR], daisy_language[MAX_STR];
   char *daisy_mp, *tmp_dir;
   char tag[MAX_TAG], *label;
   int label_len;
   char bookmark_title[MAX_STR], search_str[30];
   char cd_dev[MAX_STR], pulseaudio_device[5];
   char cddb_flag, opf_name[MAX_STR], ncx_name[MAX_STR];
   char use_ncx, use_opf;
   char *current_audio_file, tmp_wav[MAX_STR + 1], mcn[MAX_STR];
   char xmlversion[MAX_STR + 1];
   char cmd[MAX_CMD + 1], str[MAX_STR + 1];
   time_t elapsed_seconds;
   WINDOW *screenwin, *titlewin;
   cdrom_paranoia_t *par;
   cdrom_drive_t *drv;
   CdIo_t *p_cdio;
   int cd_type;
   lsn_t lsn_cursor, pause_resume_lsn_cursor;
   int use_OPF, use_NCX; // for testing
} misc_t;

extern void get_toc_audiocd (misc_t *, daisy_t *);
extern  daisy_t *get_number_of_tracks (misc_t *);
extern pid_t play_track (misc_t *, char *, char *, lsn_t);
extern void playfile (char *, char *, char *, char *, char *);
extern char *get_mcn (misc_t *);
extern void quit_daisy_player (misc_t *, my_attribute_t *, daisy_t *);
extern void view_screen (misc_t *, daisy_t *);
extern void pause_resume (misc_t *, my_attribute_t *, daisy_t *);
extern void open_clips_file (misc_t *, my_attribute_t *, char *, char *);
extern void get_next_clips (misc_t *, my_attribute_t *, daisy_t *);
extern void free_all (misc_t *, my_attribute_t *, daisy_t *);
extern void select_next_output_device (misc_t *, daisy_t *);
extern void go_to_page_number (misc_t *, my_attribute_t *, daisy_t *);
extern void make_tmp_dir (misc_t *);
extern daisy_t *create_daisy_struct (misc_t *, my_attribute_t *, daisy_t *);
extern void skip_right (misc_t *, daisy_t *);
extern void player_ended ();
extern char *convert_URL_name (misc_t *, char *);
extern void get_path_name (char *, char *, char *);
extern void failure (misc_t *, char *, int);
extern int get_tag_or_label (misc_t *, my_attribute_t *, xmlTextReaderPtr);
extern void get_clips (misc_t *, my_attribute_t *);
extern void fill_daisy_struct_2 (misc_t *, my_attribute_t *, daisy_t *);
extern void fill_item (misc_t *, daisy_t *);
extern int get_page_number_2 (misc_t *, my_attribute_t *,
                              daisy_t *daisy, char *);
extern void read_daisy_3 (misc_t *, my_attribute_t *, daisy_t *);
extern void fill_page_numbers (misc_t *, daisy_t *, my_attribute_t *);
extern int get_page_number_3 (misc_t *, my_attribute_t *);
extern int madplay (char *, char *, char *, char *);
extern void kill_player (misc_t *);
extern void remove_tmp_dir (misc_t *);
extern void init_paranoia (misc_t *);
extern void parse_page_number (misc_t *, my_attribute_t *, xmlTextReaderPtr);
extern char *get_dir_content (misc_t *, char *, char *);
extern void get_cddb_info (misc_t *, daisy_t *);
extern void find_index_names (misc_t *);
extern int handle_ncc_html (misc_t *, my_attribute_t *, daisy_t *);
extern int namefilter (const struct dirent *);
extern int get_meta_attributes (xmlTextReaderPtr, xmlTextWriterPtr);
extern void create_ncc_html (misc_t *);
extern void get_attributes (misc_t *, my_attribute_t *, xmlTextReaderPtr);
extern char *pactl (char *, char *, char *);
extern void parse_smil_2 (misc_t *, my_attribute_t *, daisy_t *);
extern void get_label_2 (misc_t *, daisy_t *, int);
extern void fill_xml_anchor_ncx (misc_t *, my_attribute_t *, daisy_t *);
extern void parse_content (misc_t *, my_attribute_t *, daisy_t *);
extern void parse_text (misc_t *, my_attribute_t *, daisy_t *);
extern void put_bookmark (misc_t *);
extern float read_time (char *);
extern void parse_clips (misc_t *, my_attribute_t *, daisy_t *);
extern void parse_smil_3 (misc_t *, my_attribute_t *, daisy_t *);
extern void fill_xml_anchor_opf (misc_t *, my_attribute_t *, daisy_t *);
extern void parse_opf (misc_t *, my_attribute_t *, daisy_t *);
extern void parse_ncx (misc_t *, my_attribute_t *, daisy_t *);
extern void get_bookmark (misc_t *, my_attribute_t *, daisy_t *);
extern void view_page (misc_t *, daisy_t *);
extern void view_time (misc_t *, daisy_t *);
extern void start_playing (misc_t *, daisy_t *);
extern void write_wav (misc_t *, my_attribute_t *, daisy_t *, char *);
extern void store_to_disk (misc_t *, my_attribute_t *, daisy_t *);
extern void help (misc_t *, my_attribute_t *, daisy_t *);
extern void previous_item (misc_t *, daisy_t *);
extern void next_item (misc_t *, daisy_t *);
extern void calculate_times_3 (misc_t *, my_attribute_t *, daisy_t *);
extern void load_xml (misc_t *, my_attribute_t *);
extern void save_xml (misc_t *);
extern void search (misc_t *, my_attribute_t *, daisy_t *, int, char);
extern void change_level (misc_t *, my_attribute_t *, daisy_t *, char);
extern void go_to_time (misc_t *, daisy_t *, my_attribute_t *);
extern void skip_left (misc_t *, my_attribute_t *, daisy_t *);
extern void browse (misc_t *, my_attribute_t *, daisy_t *, char *);
extern void usage (int);
extern char *get_mount_point (misc_t *);
extern void handle_discinfo (misc_t *, my_attribute_t *, daisy_t *, char *);