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