]> git.sesse.net Git - vlc/blob - modules/access/vcdx/vcdplayer.h
Copyright fixes
[vlc] / modules / access / vcdx / vcdplayer.h
1 /*****************************************************************************
2  * Copyright (C) 2003, 2004 Rocky Bernstein (for VideoLAN (Centrale Réseaux) and its contributors)
3  * $Id$
4  *
5  * Authors: Rocky Bernstein <rocky@panix.com> 
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
20  *****************************************************************************/
21
22 /* VCD Player header. More or less media-player independent. Or at least
23    that is the goal. So we prefer bool to vlc_bool.
24  */
25
26 #ifndef _VCDPLAYER_H_
27 #define _VCDPLAYER_H_
28
29 #include <libvcd/info.h>
30 #include "vlc_meta.h"
31
32 #define INPUT_DBG_META        1 /* Meta information */
33 #define INPUT_DBG_EVENT       2 /* input (keyboard/mouse) events */
34 #define INPUT_DBG_MRL         4 /* MRL parsing */
35 #define INPUT_DBG_EXT         8 /* Calls from external routines */
36 #define INPUT_DBG_CALL       16 /* routine calls */
37 #define INPUT_DBG_LSN        32 /* LSN changes */
38 #define INPUT_DBG_PBC        64 /* Playback control */
39 #define INPUT_DBG_CDIO      128 /* Debugging from CDIO */
40 #define INPUT_DBG_SEEK      256 /* Seeks to set location */
41 #define INPUT_DBG_SEEK_CUR  512 /* Seeks to find current location */
42 #define INPUT_DBG_STILL    1024 /* Still-frame */
43 #define INPUT_DBG_VCDINFO  2048 /* Debugging from VCDINFO */
44
45 #define INPUT_DEBUG 1
46 #if INPUT_DEBUG
47 #define dbg_print(mask, s, args...) \
48    if (p_vcdplayer && p_vcdplayer->i_debug & mask) \
49      msg_Dbg(p_access, "%s: "s, __func__ , ##args)
50 #else
51 #define dbg_print(mask, s, args...) 
52 #endif
53
54 #define LOG_ERR(args...)  msg_Err( p_access, args )
55 #define LOG_WARN(args...) msg_Warn( p_access, args )
56
57 /*------------------------------------------------------------------
58   General definitions and structures.
59 ---------------------------------------------------------------------*/
60
61 /* Value for indefinite wait period on a still frame */
62 #define STILL_INDEFINITE_WAIT 255
63 /* Value when we have yet to finish reading blocks of a frame. */
64 #define STILL_READING          -5
65
66 typedef struct {
67   lsn_t  start_LSN; /* LSN where play item starts */
68   size_t size;      /* size in sector units of play item. */
69 } vcdplayer_play_item_info_t;
70
71 /*****************************************************************************
72  * vcdplayer_t: VCD information
73  *****************************************************************************/
74 typedef struct vcdplayer_input_s
75 {
76   vcdinfo_obj_t *vcd;                   /* CD device descriptor */
77
78   /*------------------------------------------------------------------
79     User-settable options 
80    --------------------------------------------------------------*/
81   unsigned int i_debug;                 /* Debugging mask */
82   unsigned int i_blocks_per_read;       /* number of blocks per read */
83
84   /*-------------------------------------------------------------
85      Playback control fields 
86    --------------------------------------------------------------*/
87   bool         in_still;                /* true if in still */
88   int          i_lid;                   /* LID that play item is in. Implies 
89                                            PBC is on. VCDPLAYER_BAD_ENTRY if 
90                                            not none or not in PBC */
91   PsdListDescriptor_t pxd;              /* If PBC is on, the relevant 
92                                             PSD/PLD */
93   int          pdi;                     /* current pld index of pxd. -1 if 
94                                            no index*/
95   vcdinfo_itemid_t play_item;           /* play-item, VCDPLAYER_BAD_ENTRY 
96                                            if none */
97   vcdinfo_itemid_t loop_item;           /* Where do we loop back to? 
98                                            Meaningful only in a selection 
99                                            list */
100   int          i_loop;                  /* # of times play-item has been 
101                                            played. Meaningful only in a 
102                                            selection list.              */
103   track_t      i_track;                 /* current track number */
104
105   /*-----------------------------------
106      location fields
107    ------------------------------------*/
108   lsn_t        i_lsn;                   /* LSN of where we are right now */
109   lsn_t        end_lsn;                 /* LSN of end of current 
110                                            entry/segment/track. This block
111                                            can be read (and is not one after 
112                                            the "end").
113                                         */
114   lsn_t        origin_lsn;              /* LSN of start of seek/slider */
115   lsn_t        track_lsn;               /* LSN of start track origin of track 
116                                            we are in. */
117   lsn_t        track_end_lsn;           /* LSN of end of current track (if 
118                                            entry). */
119   lsn_t *      p_entries;               /* Entry points */
120   lsn_t *      p_segments;              /* Segments */
121   bool         b_valid_ep;              /* Valid entry points flag */
122   bool         b_end_of_track;          /* If the end of track was reached */
123
124   /*--------------------------------------------------------------
125     (S)VCD Medium information
126    ---------------------------------------------------------------*/
127
128   char        *psz_source;              /* (S)VCD drive or image filename */
129   bool         b_svd;                   /* true if we have SVD info */
130   vlc_meta_t  *p_meta;
131   track_t      i_tracks;                /* # of playable MPEG tracks. This is 
132                                            generally one less than the number
133                                            of CD tracks as the first CD track
134                                            is an ISO-9660 track and is not
135                                            playable.
136                                         */
137   unsigned int i_segments;              /* # of segments */
138   unsigned int i_entries;               /* # of entries */
139   unsigned int i_lids;                  /* # of List IDs */
140
141   /* Tracks, segment, and entry information. The number of entries for
142      each is given by the corresponding i_* field above.  */
143   vcdplayer_play_item_info_t *track;
144   vcdplayer_play_item_info_t *segment;
145   vcdplayer_play_item_info_t *entry;
146
147   unsigned int i_titles;                /* # of navigatable titles. */
148
149   /* 
150      # tracks + menu for segments + menu for LIDs
151    */
152   input_title_t *p_title[CDIO_CD_MAX_TRACKS+2];
153
154   /* Probably gets moved into another structure...*/
155   intf_thread_t *p_intf;
156   int            i_audio_nb;
157   int            i_still;
158   bool           b_end_of_cell;
159   bool           b_track_length; /* Use track as max unit in seek */
160   input_thread_t *p_input;
161   access_t       *p_access;
162   
163 } vcdplayer_t;
164
165 /* vcdplayer_read return status */
166 typedef enum {
167   READ_BLOCK,
168   READ_STILL_FRAME,
169   READ_ERROR,
170   READ_END,
171 } vcdplayer_read_status_t;
172
173
174 /* ----------------------------------------------------------------------
175    Function Prototypes 
176   -----------------------------------------------------------------------*/
177
178 /*!
179   Return true if playback control (PBC) is on
180 */
181 bool vcdplayer_pbc_is_on(const vcdplayer_t *p_vcdplayer);
182
183 /*!
184   Play item assocated with the "default" selection.
185
186   Return false if there was some problem.
187 */
188 bool vcdplayer_play_default( access_t * p_access );
189
190 /*!
191   Play item assocated with the "next" selection.
192
193   Return false if there was some problem.
194 */
195 bool vcdplayer_play_next( access_t * p_access );
196
197 /*!
198   Play item assocated with the "prev" selection.
199
200   Return false if there was some problem.
201 */
202 bool vcdplayer_play_prev( access_t * p_access );
203
204 /*!
205   Play item assocated with the "return" selection.
206
207   Return false if there was some problem.
208 */
209 bool vcdplayer_play_return( access_t * p_access );
210
211 /* 
212    Set's start origin and size for subsequent seeks.  
213    input: p_vcd->i_lsn, p_vcd->play_item
214    changed: p_vcd->origin_lsn, p_vcd->end_lsn
215 */
216 void vcdplayer_set_origin(access_t *p_access, lsn_t i_lsn, track_t i_track,
217                           const vcdinfo_itemid_t *p_itemid);
218
219 void vcdplayer_play(access_t *p_access, vcdinfo_itemid_t itemid);
220
221 vcdplayer_read_status_t vcdplayer_read (access_t * p_access_t, uint8_t *p_buf);
222
223 #endif /* _VCDPLAYER_H_ */
224 /* 
225  * Local variables:
226  *  c-file-style: "gnu"
227  *  tab-width: 8
228  *  indent-tabs-mode: nil
229  * End:
230  */