Warning, file /multimedia/libkcompactdisc/src/wmlib/include/wm_struct.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 #ifndef WM_STRUCT_H 0002 #define WM_STRUCT_H 0003 /* 0004 * This file is part of WorkMan, the civilized CD player library 0005 * Copyright (C) 1991-1997 by Steven Grimm <koreth@midwinter.com> 0006 * Copyright (C) by Dirk Försterling <milliByte@DeathsDoor.com> 0007 * 0008 * This library is free software; you can redistribute it and/or 0009 * modify it under the terms of the GNU Library General Public 0010 * License as published by the Free Software Foundation; either 0011 * version 2 of the License, or (at your option) any later version. 0012 * 0013 * This library is distributed in the hope that it will be useful, 0014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0016 * Library General Public License for more details. 0017 * 0018 * You should have received a copy of the GNU Library General Public 0019 * License along with this library; if not, write to the Free 0020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 0021 * 0022 */ 0023 0024 #include "wm_platform.h" 0025 0026 #define WM_STR_GENVENDOR "Generic" 0027 #define WM_STR_GENMODEL "drive" 0028 #define WM_STR_GENREV "type" 0029 0030 struct wm_drive; 0031 0032 /* 0033 * Structure for a single track. This is pretty much self-explanatory -- 0034 * one of these exists for each track on the current CD. 0035 */ 0036 struct wm_trackinfo 0037 { 0038 int length; /* Length of track in seconds or Kbytes */ 0039 int start; /* Starting position (f+s*75+m*60*75) */ 0040 int track; /* Physical track number */ 0041 int data; /* Flag: data track */ 0042 }; 0043 0044 struct wm_cdinfo 0045 { 0046 int ntracks; /* Number of tracks on the disc */ 0047 int curtrack; 0048 int curtracklen; 0049 int cur_cdmode; 0050 int cur_index; /* Current index mark */ 0051 int cur_pos_rel; /* Current track-relative position in seconds */ 0052 int cur_pos_abs; /* Current absolute position in seconds */ 0053 int cur_frame; /* Current frame number */ 0054 int length; /* Total running time in seconds */ 0055 int cd_cur_balance; 0056 struct wm_trackinfo *trk; /* struct wm_trackinfo[ntracks] */ 0057 }; 0058 0059 /* 0060 * Each platform has to define generic functions, so may as well declare 0061 * them all here to save space. 0062 * These functions should never be seen outside libworkman. So I don't care 0063 * about the wm_ naming convention here. 0064 */ 0065 struct wm_drive_proto 0066 { 0067 int (*open)(struct wm_drive *d); 0068 int (*close)(struct wm_drive *d); 0069 int (*get_trackcount)(struct wm_drive *d, int *tracks); 0070 int (*get_cdlen)(struct wm_drive *d, int *frames); 0071 int (*get_trackinfo)(struct wm_drive *d, int track, int *data, int *startframe); 0072 int (*get_drive_status)(struct wm_drive *d, int oldmode, int *mode, int *pos, int *track, int *ind); 0073 int (*pause)(struct wm_drive *d); 0074 int (*resume)(struct wm_drive *d); 0075 int (*stop)(struct wm_drive *d); 0076 int (*play)(struct wm_drive *d, int start, int end); 0077 int (*eject)(struct wm_drive *d); 0078 int (*closetray)(struct wm_drive *d); 0079 int (*scsi)(struct wm_drive *d, unsigned char *cdb, int cdb_len, void *ret_buf, int ret_buflen, int get_reply); 0080 int (*set_volume)(struct wm_drive *d, int left, int right); 0081 int (*get_volume)(struct wm_drive *d, int *left, int *right); 0082 int (*scale_volume)(int *left, int *right); 0083 int (*unscale_volume)(int *left, int *right); 0084 }; 0085 0086 /* forward declaration */ 0087 int gen_init(struct wm_drive *d); 0088 int gen_open(struct wm_drive *d); 0089 int gen_close(struct wm_drive *d); 0090 int gen_get_trackcount(struct wm_drive *d, int *tracks); 0091 int gen_get_cdlen(struct wm_drive *d, int *frames); 0092 int gen_get_trackinfo(struct wm_drive *d, int track, int *data, int *startframe); 0093 int gen_get_drive_status(struct wm_drive *d, int oldmode, int *mode, int *pos, int *track, int *ind); 0094 int gen_pause(struct wm_drive *d); 0095 int gen_resume(struct wm_drive *d); 0096 int gen_stop(struct wm_drive *d); 0097 int gen_play(struct wm_drive *d, int start, int end); 0098 int gen_eject(struct wm_drive *d); 0099 int gen_closetray(struct wm_drive *d); 0100 int gen_scsi(struct wm_drive *d, unsigned char *cdb, int cdb_len, void *ret_buf, int ret_buflen, int get_reply); 0101 int gen_set_volume(struct wm_drive *d, int left, int right); 0102 int gen_get_volume(struct wm_drive *d, int *left, int *right); 0103 int gen_scale_volume(int *left, int *right); 0104 int gen_unscale_volume(int *left, int *right); 0105 0106 /* 0107 * Information about a particular block of CDDA data. 0108 */ 0109 struct wm_cdda_block 0110 { 0111 unsigned char status; 0112 unsigned char track; 0113 unsigned char index; 0114 unsigned char reserved; 0115 0116 int frame; 0117 char *buf; 0118 long buflen; 0119 }; 0120 0121 #ifdef WMLIB_CDDA_BUILD 0122 int gen_cdda_init(struct wm_drive *d); 0123 int gen_cdda_open(struct wm_drive* d); 0124 int gen_cdda_read(struct wm_drive* d, struct wm_cdda_block *block); 0125 int gen_cdda_close(struct wm_drive* d); 0126 #else 0127 #define gen_cdda_init(x) (-1) 0128 #define gen_cdda_open(x) (-1) 0129 #define gen_cdda_read(x, y) (-1) 0130 #define gen_cdda_close(x) (-1) 0131 #endif 0132 0133 0134 /* 0135 * Drive descriptor structure. Used for access to low-level routines. 0136 */ 0137 struct wm_drive 0138 { 0139 int cdda; /* cdda 1, cdin 0 */ 0140 0141 /* common section */ 0142 char *cd_device; 0143 char *soundsystem; 0144 char *sounddevice; 0145 char *ctldevice; 0146 0147 char vendor[9]; /* Vendor name */ 0148 char model[17]; /* Drive model */ 0149 char revision[5]; /* Revision of the drive */ 0150 void *aux; /* Pointer to optional platform-specific info */ 0151 0152 struct wm_cdinfo thiscd; 0153 int cur_cdmode; 0154 0155 /* cdin section */ 0156 int fd; /* file descriptor */ 0157 void *daux; /* Pointer to optional drive-specific info etc. */ 0158 struct wm_drive_proto proto; 0159 0160 /* cdda section */ 0161 unsigned char status; 0162 unsigned char track; 0163 unsigned char index; 0164 unsigned char command; 0165 0166 int current_position; 0167 int ending_position; 0168 0169 int frame; 0170 int frames_at_once; 0171 0172 struct wm_cdda_block *blocks; 0173 int numblocks; 0174 void *cddax; /* Pointer to optional drive-specific info etc. */ 0175 int oldmode; 0176 }; 0177 0178 int toshiba_fixup(struct wm_drive *d); 0179 int sony_fixup(struct wm_drive *d); 0180 0181 struct cdtext_info* get_glob_cdtext(struct wm_drive*, int); 0182 void free_cdtext(void); 0183 0184 int wm_cdda_init(struct wm_drive *d); 0185 int wm_cdda_destroy(struct wm_drive *d); 0186 0187 #endif /* WM_STRUCT_H */