00001 /***************************************************************************** 00002 * Copyright (C) 2003, 2004 Rocky Bernstein (for the VideoLAN team) 00003 * $Id: vcdplayer.h 11664 2005-07-09 06:17:09Z courmisch $ 00004 * 00005 * Authors: Rocky Bernstein <[email protected]> 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. 00020 *****************************************************************************/ 00021 00022 /* VCD Player header. More or less media-player independent. Or at least 00023 that is the goal. So we prefer bool to vlc_bool. 00024 */ 00025 00026 #ifndef _VCDPLAYER_H_ 00027 #define _VCDPLAYER_H_ 00028 00029 #include <libvcd/info.h> 00030 #include "vlc_meta.h" 00031 00032 #define INPUT_DBG_META 1 /* Meta information */ 00033 #define INPUT_DBG_EVENT 2 /* input (keyboard/mouse) events */ 00034 #define INPUT_DBG_MRL 4 /* MRL parsing */ 00035 #define INPUT_DBG_EXT 8 /* Calls from external routines */ 00036 #define INPUT_DBG_CALL 16 /* routine calls */ 00037 #define INPUT_DBG_LSN 32 /* LSN changes */ 00038 #define INPUT_DBG_PBC 64 /* Playback control */ 00039 #define INPUT_DBG_CDIO 128 /* Debugging from CDIO */ 00040 #define INPUT_DBG_SEEK 256 /* Seeks to set location */ 00041 #define INPUT_DBG_SEEK_CUR 512 /* Seeks to find current location */ 00042 #define INPUT_DBG_STILL 1024 /* Still-frame */ 00043 #define INPUT_DBG_VCDINFO 2048 /* Debugging from VCDINFO */ 00044 00045 #define INPUT_DEBUG 1 00046 #if INPUT_DEBUG 00047 #define dbg_print(mask, s, args...) \ 00048 if (p_vcdplayer && p_vcdplayer->i_debug & mask) \ 00049 msg_Dbg(p_access, "%s: "s, __func__ , ##args) 00050 #else 00051 #define dbg_print(mask, s, args...) 00052 #endif 00053 00054 #define LOG_ERR(args...) msg_Err( p_access, args ) 00055 #define LOG_WARN(args...) msg_Warn( p_access, args ) 00056 00057 /*------------------------------------------------------------------ 00058 General definitions and structures. 00059 ---------------------------------------------------------------------*/ 00060 00061 /* Value for indefinite wait period on a still frame */ 00062 #define STILL_INDEFINITE_WAIT 255 00063 /* Value when we have yet to finish reading blocks of a frame. */ 00064 #define STILL_READING -5 00065 00066 typedef struct { 00067 lsn_t start_LSN; /* LSN where play item starts */ 00068 size_t size; /* size in sector units of play item. */ 00069 } vcdplayer_play_item_info_t; 00070 00071 /***************************************************************************** 00072 * vcdplayer_t: VCD information 00073 *****************************************************************************/ 00074 typedef struct vcdplayer_input_s 00075 { 00076 vcdinfo_obj_t *vcd; /* CD device descriptor */ 00077 00078 /*------------------------------------------------------------------ 00079 User-settable options 00080 --------------------------------------------------------------*/ 00081 unsigned int i_debug; /* Debugging mask */ 00082 unsigned int i_blocks_per_read; /* number of blocks per read */ 00083 00084 /*------------------------------------------------------------- 00085 Playback control fields 00086 --------------------------------------------------------------*/ 00087 bool in_still; /* true if in still */ 00088 int i_lid; /* LID that play item is in. Implies 00089 PBC is on. VCDPLAYER_BAD_ENTRY if 00090 not none or not in PBC */ 00091 PsdListDescriptor_t pxd; /* If PBC is on, the relevant 00092 PSD/PLD */ 00093 int pdi; /* current pld index of pxd. -1 if 00094 no index*/ 00095 vcdinfo_itemid_t play_item; /* play-item, VCDPLAYER_BAD_ENTRY 00096 if none */ 00097 vcdinfo_itemid_t loop_item; /* Where do we loop back to? 00098 Meaningful only in a selection 00099 list */ 00100 int i_loop; /* # of times play-item has been 00101 played. Meaningful only in a 00102 selection list. */ 00103 track_t i_track; /* current track number */ 00104 00105 /*----------------------------------- 00106 location fields 00107 ------------------------------------*/ 00108 lsn_t i_lsn; /* LSN of where we are right now */ 00109 lsn_t end_lsn; /* LSN of end of current 00110 entry/segment/track. This block 00111 can be read (and is not one after 00112 the "end"). 00113 */ 00114 lsn_t origin_lsn; /* LSN of start of seek/slider */ 00115 lsn_t track_lsn; /* LSN of start track origin of track 00116 we are in. */ 00117 lsn_t track_end_lsn; /* LSN of end of current track (if 00118 entry). */ 00119 lsn_t * p_entries; /* Entry points */ 00120 lsn_t * p_segments; /* Segments */ 00121 bool b_valid_ep; /* Valid entry points flag */ 00122 bool b_end_of_track; /* If the end of track was reached */ 00123 00124 /*-------------------------------------------------------------- 00125 (S)VCD Medium information 00126 ---------------------------------------------------------------*/ 00127 00128 char *psz_source; /* (S)VCD drive or image filename */ 00129 bool b_svd; /* true if we have SVD info */ 00130 vlc_meta_t *p_meta; 00131 track_t i_tracks; /* # of playable MPEG tracks. This is 00132 generally one less than the number 00133 of CD tracks as the first CD track 00134 is an ISO-9660 track and is not 00135 playable. 00136 */ 00137 unsigned int i_segments; /* # of segments */ 00138 unsigned int i_entries; /* # of entries */ 00139 unsigned int i_lids; /* # of List IDs */ 00140 00141 /* Tracks, segment, and entry information. The number of entries for 00142 each is given by the corresponding i_* field above. */ 00143 vcdplayer_play_item_info_t *track; 00144 vcdplayer_play_item_info_t *segment; 00145 vcdplayer_play_item_info_t *entry; 00146 00147 unsigned int i_titles; /* # of navigatable titles. */ 00148 00149 /* 00150 # tracks + menu for segments + menu for LIDs 00151 */ 00152 input_title_t *p_title[CDIO_CD_MAX_TRACKS+2]; 00153 00154 /* Probably gets moved into another structure...*/ 00155 intf_thread_t *p_intf; 00156 int i_audio_nb; 00157 int i_still; 00158 bool b_end_of_cell; 00159 bool b_track_length; /* Use track as max unit in seek */ 00160 input_thread_t *p_input; 00161 access_t *p_access; 00162 00163 } vcdplayer_t; 00164 00165 /* vcdplayer_read return status */ 00166 typedef enum { 00167 READ_BLOCK, 00168 READ_STILL_FRAME, 00169 READ_ERROR, 00170 READ_END, 00171 } vcdplayer_read_status_t; 00172 00173 00174 /* ---------------------------------------------------------------------- 00175 Function Prototypes 00176 -----------------------------------------------------------------------*/ 00177 00181 bool vcdplayer_pbc_is_on(const vcdplayer_t *p_vcdplayer); 00182 00188 bool vcdplayer_play_default( access_t * p_access ); 00189 00195 bool vcdplayer_play_next( access_t * p_access ); 00196 00202 bool vcdplayer_play_prev( access_t * p_access ); 00203 00209 bool vcdplayer_play_return( access_t * p_access ); 00210 00211 /* 00212 Set's start origin and size for subsequent seeks. 00213 input: p_vcd->i_lsn, p_vcd->play_item 00214 changed: p_vcd->origin_lsn, p_vcd->end_lsn 00215 */ 00216 void vcdplayer_set_origin(access_t *p_access, lsn_t i_lsn, track_t i_track, 00217 const vcdinfo_itemid_t *p_itemid); 00218 00219 void vcdplayer_play(access_t *p_access, vcdinfo_itemid_t itemid); 00220 00221 vcdplayer_read_status_t vcdplayer_read (access_t * p_access_t, uint8_t *p_buf); 00222 00223 #endif /* _VCDPLAYER_H_ */ 00224 /* 00225 * Local variables: 00226 * c-file-style: "gnu" 00227 * tab-width: 8 00228 * indent-tabs-mode: nil 00229 * End: 00230 */