Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

vlc_access.h

00001 /*****************************************************************************
00002  * vlc_access.h
00003  *****************************************************************************
00004  * Copyright (C) 1999-2004 the VideoLAN team
00005  * $Id: vlc_access.h 12954 2005-10-24 17:08:54Z md $
00006  *
00007  * Authors: Laurent Aimar <[email protected]>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00022  *****************************************************************************/
00023 
00024 #ifndef _VLC_ACCESS_H
00025 #define _VLC_ACCESS_H 1
00026 
00032 enum access_query_e
00033 {
00034     /* capabilities */
00035     ACCESS_CAN_SEEK,        /* arg1= vlc_bool_t*    cannot fail */
00036     ACCESS_CAN_FASTSEEK,    /* arg1= vlc_bool_t*    cannot fail */
00037     ACCESS_CAN_PAUSE,       /* arg1= vlc_bool_t*    cannot fail */
00038     ACCESS_CAN_CONTROL_PACE,/* arg1= vlc_bool_t*    cannot fail */
00039 
00040     /* */
00041     ACCESS_GET_MTU,         /* arg1= int*           cannot fail(0 if no sense)*/
00042     ACCESS_GET_PTS_DELAY,   /* arg1= int64_t*       cannot fail */
00043     /* */
00044     ACCESS_GET_TITLE_INFO,  /* arg1=input_title_t*** arg2=int* can fail */
00045     /* Meta data */
00046     ACCESS_GET_META,        /* arg1= vlc_meta_t **  res=can fail    */
00047 
00048     /* */
00049     ACCESS_SET_PAUSE_STATE, /* arg1= vlc_bool_t     can fail */
00050 
00051     /* */
00052     ACCESS_SET_TITLE,       /* arg1= int            can fail */
00053     ACCESS_SET_SEEKPOINT,   /* arg1= int            can fail */
00054 
00055     /* Special mode for access/demux communication
00056      * XXX: avoid to use it unless you can't */
00057     ACCESS_SET_PRIVATE_ID_STATE,    /* arg1= int i_private_data, vlc_bool_t b_selected can fail */
00058     ACCESS_SET_PRIVATE_ID_CA,    /* arg1= int i_program_number, uint16_t i_vpid, uint16_t i_apid1, uint16_t i_apid2, uint16_t i_apid3, uint8_t i_length, uint8_t *p_data */
00059     ACCESS_GET_PRIVATE_ID_STATE     /* arg1=int i_private_data arg2=vlc_bool_t *  res=can fail */
00060 };
00061 
00062 struct access_t
00063 {
00064     VLC_COMMON_MEMBERS
00065 
00066     /* Module properties */
00067     module_t    *p_module;
00068 
00069     /* Access name (empty if non forced) */
00070     char        *psz_access;
00071     /* Access path/url/filename/.... */
00072     char        *psz_path;
00073     /* Access source for access_filter (NULL for regular access) */
00074     access_t    *p_source;
00075 
00076     /* Access can fill this entry to force a demuxer
00077      * XXX: fill it once you know for sure you will succed
00078      * (if you fail, this value won't be reseted */
00079     char        *psz_demux;
00080 
00081     /* pf_read/pf_block is used to read data.
00082      * XXX A access should set one and only one of them */
00083     int         (*pf_read) ( access_t *, uint8_t *, int );  /* Return -1 if no data yet, 0 if no more data, else real data read */
00084     block_t    *(*pf_block)( access_t * );                  /* return a block of data in his 'natural' size, NULL if not yet data or eof */
00085 
00086     /* Called for each seek.
00087      * XXX can be null */
00088     int         (*pf_seek) ( access_t *, int64_t );         /* can be null if can't seek */
00089 
00090     /* Used to retreive and configure the access
00091      * XXX mandatory. look at access_query_e to know what query you *have to* support */
00092     int         (*pf_control)( access_t *, int i_query, va_list args);
00093 
00094     /* Access has to maintain them uptodate */
00095     struct
00096     {
00097         unsigned int i_update;  /* Access sets them on change,
00098                                    Input removes them once take into account*/
00099 
00100         int64_t      i_size;    /* Write only for access, read only for input */
00101         int64_t      i_pos;     /* idem */
00102         vlc_bool_t   b_eof;     /* idem */
00103 
00104         int          i_title;    /* idem, start from 0 (could be menu) */
00105         int          i_seekpoint;/* idem, start from 0 */
00106 
00107         vlc_bool_t   b_prebuffered; /* Read only for input */ 
00108     } info;
00109     access_sys_t *p_sys;
00110 };
00111 
00112 #define access2_New( a, b, c, d, e ) __access2_New(VLC_OBJECT(a), b, c, d, e )
00113 VLC_EXPORT( access_t *, __access2_New,  ( vlc_object_t *p_obj, char *psz_access, char *psz_demux, char *psz_path, vlc_bool_t b_quick ) );
00114 VLC_EXPORT( access_t *, access2_FilterNew, ( access_t *p_source, char *psz_access_filter ) );
00115 VLC_EXPORT( void,      access2_Delete, ( access_t * ) );
00116 
00117 static inline int access2_vaControl( access_t *p_access, int i_query, va_list args )
00118 {
00119     if( !p_access ) return VLC_EGENERIC;
00120     return p_access->pf_control( p_access, i_query, args );
00121 }
00122 static inline int access2_Control( access_t *p_access, int i_query, ... )
00123 {
00124     va_list args;
00125     int     i_result;
00126 
00127     va_start( args, i_query );
00128     i_result = access2_vaControl( p_access, i_query, args );
00129     va_end( args );
00130     return i_result;
00131 }
00132 
00133 #endif

Generated on Tue Dec 20 10:14:19 2005 for vlc-0.8.4a by  doxygen 1.4.2