]> git.sesse.net Git - vlc/blob - modules/access/vcdx/vcdplayer.h
info.c: Add LID info in stream and media info.
[vlc] / modules / access / vcdx / vcdplayer.h
1 /*****************************************************************************
2  * Copyright (C) 2003, 2004 Rocky Bernstein (for VideoLAN)
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 /* all 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_vcd && p_vcd->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 #define VCDPLAYER_IN_STILL  65535
62
63 typedef struct {
64   lsn_t  start_LSN; /* LSN where play item starts */
65   size_t size;      /* size in sector units of play item. */
66 } vcdplayer_play_item_info_t;
67
68 /* vcdplayer_read return status */
69 typedef enum {
70   READ_BLOCK,
71   READ_STILL_FRAME,
72   READ_ERROR,
73   READ_END,
74 } vcdplayer_read_status_t;
75
76 /*****************************************************************************
77  * vcdplayer_t: VCD information
78  *****************************************************************************/
79 typedef struct thread_vcd_data_s
80 {
81   vcdinfo_obj_t *vcd;                   /* CD device descriptor */
82
83   /* User-settable options */
84   unsigned int i_debug;                 /* Debugging mask */
85   unsigned int i_blocks_per_read;       /* number of blocks per read */
86
87   /* Current State: position */
88   bool         in_still;                /* true if in still */
89   int          i_lid;                   /* LID that play item is in. Implies 
90                                            PBC is on. VCDPLAYER_BAD_ENTRY if 
91                                            not none or not in PBC */
92   PsdListDescriptor_t pxd;              /* If PBC is on, the relevant 
93                                             PSD/PLD */
94   int          pdi;                     /* current pld index of pxd. -1 if 
95                                            no index*/
96   vcdinfo_itemid_t play_item;           /* play-item, VCDPLAYER_BAD_ENTRY 
97                                            if none */
98   vcdinfo_itemid_t loop_item;           /* Where do we loop back to? 
99                                            Meaningful only in a selection 
100                                            list */
101   int          loop_count;              /* # of times play-item has been 
102                                            played. Meaningful only in a 
103                                            selection list.              */
104   track_t      i_track;                 /* Current track number */
105   lsn_t        i_lsn;                   /* Current logical sector number */
106   lsn_t        end_lsn;                 /* LSN of end of current 
107                                            entry/segment/track. This block
108                                            can be read (and is not one after 
109                                            the "end").
110                                         */
111   lsn_t        origin_lsn;              /* LSN of start of seek/slider */
112   lsn_t        track_lsn;               /* LSN of start track origin of track 
113                                            we are in. */
114   lsn_t        track_end_lsn;           /* LSN of end of current track (if 
115                                            entry). */
116   lsn_t *      p_entries;               /* Entry points */
117   lsn_t *      p_segments;              /* Segments */
118   bool         b_valid_ep;              /* Valid entry points flag */
119   bool         b_end_of_track;          /* If the end of track was reached */
120
121   /* Information about (S)VCD */
122   char *       psz_source;              /* (S)VCD drive or image filename */
123   bool         b_svd;                   /* true if we have SVD info */
124   vlc_meta_t  *p_meta;
125   track_t      i_tracks;                /* # of playable MPEG tracks. This is 
126                                            generally one less than the number
127                                            of CD tracks as the first CD track
128                                            is an ISO-9660 track and is not
129                                            playable.
130                                         */
131   unsigned int i_segments;              /* # of segments */
132   unsigned int i_entries;               /* # of entries */
133   unsigned int i_lids;                  /* # of List IDs */
134
135   /* Tracks, segment, and entry information. The number of entries for
136      each is given by the corresponding num_* field above.  */
137   vcdplayer_play_item_info_t *track;
138   vcdplayer_play_item_info_t *segment;
139   vcdplayer_play_item_info_t *entry;
140
141   unsigned int i_titles;                /* # of navigatable titles. */
142
143   /* 
144      # tracks + menu for segments + menu for LIDs
145    */
146   input_title_t *p_title[CDIO_CD_MAX_TRACKS+2];
147
148   /* Probably gets moved into another structure...*/
149   intf_thread_t *p_intf;
150   int            i_audio_nb;
151   int            i_still_time;
152   bool           b_end_of_cell;
153   input_thread_t *p_input;
154   demux_t        *p_demux;
155   access_t       *p_access;
156   
157 } vcdplayer_t;
158
159 /*!
160   Get the next play-item in the list given in the LIDs. Note play-item
161   here refers to list of play-items for a single LID It shouldn't be
162   confused with a user's list of favorite things to play or the 
163   "next" field of a LID which moves us to a different LID.
164  */
165 bool vcdplayer_inc_play_item( access_t *p_access );
166
167 /*!
168   Return true if playback control (PBC) is on
169 */
170 bool vcdplayer_pbc_is_on(const vcdplayer_t *p_this);
171
172 /*!
173   Play item assocated with the "default" selection.
174
175   Return false if there was some problem.
176 */
177 bool vcdplayer_play_default( access_t * p_access );
178
179 /*!
180   Play item assocated with the "next" selection.
181
182   Return false if there was some problem.
183 */
184 bool vcdplayer_play_next( access_t * p_access );
185
186 /*!
187   Play item assocated with the "prev" selection.
188
189   Return false if there was some problem.
190 */
191 bool vcdplayer_play_prev( access_t * p_access );
192
193 /*!
194   Play item assocated with the "return" selection.
195
196   Return false if there was some problem.
197 */
198 bool vcdplayer_play_return( access_t * p_access );
199
200 /* 
201    Set's start origin and size for subsequent seeks.  
202    input: p_vcd->i_lsn, p_vcd->play_item
203    changed: p_vcd->origin_lsn, p_vcd->end_lsn
204 */
205 void vcdplayer_set_origin(access_t *p_access, lsn_t i_lsn, track_t i_track,
206                           const vcdinfo_itemid_t *p_itemid);
207
208 void vcdplayer_play(access_t *p_access, vcdinfo_itemid_t itemid);
209
210 vcdplayer_read_status_t vcdplayer_pbc_nav     ( access_t * p_access,
211                                                 uint8_t  *wait_time );
212 vcdplayer_read_status_t vcdplayer_non_pbc_nav ( access_t * p_access,
213                                                 uint8_t  *wait_time );
214
215 vcdplayer_read_status_t vcdplayer_read (access_t * p_access_t, uint8_t *p_buf);
216
217 #endif /* _VCDPLAYER_H_ */
218 /* 
219  * Local variables:
220  *  c-file-style: "gnu"
221  *  tab-width: 8
222  *  indent-tabs-mode: nil
223  * End:
224  */