vcdplayer.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Copyright (C) 2003, 2004 Rocky Bernstein (for the VideoLAN team)
00003  * $Id$
00004  *
00005  * Authors: Rocky Bernstein <rocky@panix.com>
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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 #include <vlc_input.h>
00032 #include <vlc_access.h>
00033 
00034 #define INPUT_DBG_META        1 /* Meta information */
00035 #define INPUT_DBG_EVENT       2 /* input (keyboard/mouse) events */
00036 #define INPUT_DBG_MRL         4 /* MRL parsing */
00037 #define INPUT_DBG_EXT         8 /* Calls from external routines */
00038 #define INPUT_DBG_CALL       16 /* routine calls */
00039 #define INPUT_DBG_LSN        32 /* LSN changes */
00040 #define INPUT_DBG_PBC        64 /* Playback control */
00041 #define INPUT_DBG_CDIO      128 /* Debugging from CDIO */
00042 #define INPUT_DBG_SEEK      256 /* Seeks to set location */
00043 #define INPUT_DBG_SEEK_CUR  512 /* Seeks to find current location */
00044 #define INPUT_DBG_STILL    1024 /* Still-frame */
00045 #define INPUT_DBG_VCDINFO  2048 /* Debugging from VCDINFO */
00046 
00047 #define INPUT_DEBUG 1
00048 #if INPUT_DEBUG
00049 #define dbg_print(mask, s, args...) \
00050    if (p_vcdplayer && p_vcdplayer->i_debug & mask) \
00051      msg_Dbg(p_access, "%s: "s, __func__ , ##args)
00052 #else
00053 #define dbg_print(mask, s, args...)
00054 #endif
00055 
00056 #define LOG_ERR(args...)  msg_Err( p_access, args )
00057 #define LOG_WARN(args...) msg_Warn( p_access, args )
00058 
00059 /*------------------------------------------------------------------
00060   General definitions and structures.
00061 ---------------------------------------------------------------------*/
00062 
00063 /* Value for indefinite wait period on a still frame */
00064 #define STILL_INDEFINITE_WAIT 255
00065 /* Value when we have yet to finish reading blocks of a frame. */
00066 #define STILL_READING          -5
00067 
00068 typedef struct {
00069   lsn_t  start_LSN; /* LSN where play item starts */
00070   size_t size;      /* size in sector units of play item. */
00071 } vcdplayer_play_item_info_t;
00072 
00073 /*****************************************************************************
00074  * vcdplayer_t: VCD information
00075  *****************************************************************************/
00076 typedef struct vcdplayer_input_s
00077 {
00078   vcdinfo_obj_t *vcd;                   /* CD device descriptor */
00079 
00080   /*------------------------------------------------------------------
00081     User-settable options
00082    --------------------------------------------------------------*/
00083   unsigned int i_debug;                 /* Debugging mask */
00084   unsigned int i_blocks_per_read;       /* number of blocks per read */
00085 
00086   /*-------------------------------------------------------------
00087      Playback control fields
00088    --------------------------------------------------------------*/
00089   bool         in_still;                /* true if in still */
00090   int          i_lid;                   /* LID that play item is in. Implies
00091                                            PBC is on. VCDPLAYER_BAD_ENTRY if
00092                                            not none or not in PBC */
00093   PsdListDescriptor_t pxd;              /* If PBC is on, the relevant
00094                                             PSD/PLD */
00095   int          pdi;                     /* current pld index of pxd. -1 if
00096                                            no index*/
00097   vcdinfo_itemid_t play_item;           /* play-item, VCDPLAYER_BAD_ENTRY
00098                                            if none */
00099   vcdinfo_itemid_t loop_item;           /* Where do we loop back to?
00100                                            Meaningful only in a selection
00101                                            list */
00102   int          i_loop;                  /* # of times play-item has been
00103                                            played. Meaningful only in a
00104                                            selection list.              */
00105   track_t      i_track;                 /* current track number */
00106 
00107   /*-----------------------------------
00108      location fields
00109    ------------------------------------*/
00110   lsn_t        i_lsn;                   /* LSN of where we are right now */
00111   lsn_t        end_lsn;                 /* LSN of end of current
00112                                            entry/segment/track. This block
00113                                            can be read (and is not one after
00114                                            the "end").
00115                                         */
00116   lsn_t        origin_lsn;              /* LSN of start of seek/slider */
00117   lsn_t        track_lsn;               /* LSN of start track origin of track
00118                                            we are in. */
00119   lsn_t        track_end_lsn;           /* LSN of end of current track (if
00120                                            entry). */
00121   lsn_t *      p_entries;               /* Entry points */
00122   lsn_t *      p_segments;              /* Segments */
00123   bool         b_valid_ep;              /* Valid entry points flag */
00124   bool         b_end_of_track;          /* If the end of track was reached */
00125 
00126   /*--------------------------------------------------------------
00127     (S)VCD Medium information
00128    ---------------------------------------------------------------*/
00129 
00130   char        *psz_source;              /* (S)VCD drive or image filename */
00131   bool         b_svd;                   /* true if we have SVD info */
00132   vlc_meta_t  *p_meta;
00133   track_t      i_tracks;                /* # of playable MPEG tracks. This is
00134                                            generally one less than the number
00135                                            of CD tracks as the first CD track
00136                                            is an ISO-9660 track and is not
00137                                            playable.
00138                                         */
00139   unsigned int i_segments;              /* # of segments */
00140   unsigned int i_entries;               /* # of entries */
00141   unsigned int i_lids;                  /* # of List IDs */
00142 
00143   /* Tracks, segment, and entry information. The number of entries for
00144      each is given by the corresponding i_* field above.  */
00145   vcdplayer_play_item_info_t *track;
00146   vcdplayer_play_item_info_t *segment;
00147   vcdplayer_play_item_info_t *entry;
00148 
00149   unsigned int i_titles;                /* # of navigatable titles. */
00150 
00151   /*
00152      # tracks + menu for segments + menu for LIDs
00153    */
00154   input_title_t *p_title[CDIO_CD_MAX_TRACKS+2];
00155 
00156   /* Probably gets moved into another structure...*/
00157   intf_thread_t *p_intf;
00158   int            i_audio_nb;
00159   int            i_still;
00160   bool           b_end_of_cell;
00161   bool           b_track_length; /* Use track as max unit in seek */
00162   input_thread_t *p_input;
00163   access_t       *p_access;
00164  
00165 } vcdplayer_t;
00166 
00167 /* vcdplayer_read return status */
00168 typedef enum {
00169   READ_BLOCK,
00170   READ_STILL_FRAME,
00171   READ_ERROR,
00172   READ_END,
00173 } vcdplayer_read_status_t;
00174 
00175 
00176 /* ----------------------------------------------------------------------
00177    Function Prototypes
00178   -----------------------------------------------------------------------*/
00179 
00180 /*!
00181   Return true if playback control (PBC) is on
00182 */
00183 bool vcdplayer_pbc_is_on(const vcdplayer_t *p_vcdplayer);
00184 
00185 /*!
00186   Play item assocated with the "default" selection.
00187 
00188   Return false if there was some problem.
00189 */
00190 bool vcdplayer_play_default( access_t * p_access );
00191 
00192 /*!
00193   Play item assocated with the "next" selection.
00194 
00195   Return false if there was some problem.
00196 */
00197 bool vcdplayer_play_next( access_t * p_access );
00198 
00199 /*!
00200   Play item assocated with the "prev" selection.
00201 
00202   Return false if there was some problem.
00203 */
00204 bool vcdplayer_play_prev( access_t * p_access );
00205 
00206 /*!
00207   Play item assocated with the "return" selection.
00208 
00209   Return false if there was some problem.
00210 */
00211 bool vcdplayer_play_return( access_t * p_access );
00212 
00213 /*
00214    Set's start origin and size for subsequent seeks.
00215    input: p_vcd->i_lsn, p_vcd->play_item
00216    changed: p_vcd->origin_lsn, p_vcd->end_lsn
00217 */
00218 void vcdplayer_set_origin(access_t *p_access, lsn_t i_lsn, track_t i_track,
00219                           const vcdinfo_itemid_t *p_itemid);
00220 
00221 void vcdplayer_play(access_t *p_access, vcdinfo_itemid_t itemid);
00222 
00223 vcdplayer_read_status_t vcdplayer_read (access_t * p_access_t, uint8_t *p_buf);
00224 
00225 #endif /* _VCDPLAYER_H_ */
00226 /*
00227  * Local variables:
00228  *  c-file-style: "gnu"
00229  *  tab-width: 8
00230  *  indent-tabs-mode: nil
00231  * End:
00232  */

Generated on Wed Aug 13 08:02:37 2008 for VLC by  doxygen 1.5.1