]> git.sesse.net Git - vlc/blobdiff - include/vlc_access.h
meta_fetcher: rename as scope and set values
[vlc] / include / vlc_access.h
index 554f2f8b494815542bd6c7adeb2e403383a1dffc..8a8f1faf3129f14022903542668725e6ec5b5394 100644 (file)
@@ -1,24 +1,24 @@
 /*****************************************************************************
  * vlc_access.h: Access descriptor, queries and methods
  *****************************************************************************
- * Copyright (C) 1999-2006 the VideoLAN team
+ * Copyright (C) 1999-2006 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #ifndef VLC_ACCESS_H
@@ -43,18 +43,18 @@ enum access_query_e
     ACCESS_CAN_FASTSEEK,    /* arg1= bool*    cannot fail */
     ACCESS_CAN_PAUSE,       /* arg1= bool*    cannot fail */
     ACCESS_CAN_CONTROL_PACE,/* arg1= bool*    cannot fail */
+    ACCESS_GET_SIZE=6,      /* arg1= uin64_t* */
 
     /* */
     ACCESS_GET_PTS_DELAY = 0x101,/* arg1= int64_t*       cannot fail */
-    /* */
-    ACCESS_GET_TITLE_INFO,  /* arg1=input_title_t*** arg2=int*      res=can fail */
-    /* Meta data */
-    ACCESS_GET_META,        /* arg1= vlc_meta_t **                  res=can fail */
+    ACCESS_GET_TITLE_INFO,  /* arg1=input_title_t*** arg2=int*  res=can fail */
+    ACCESS_GET_TITLE,       /* arg1=unsigned * res=can fail */
+    ACCESS_GET_SEEKPOINT,   /* arg1=unsigned * res=can fail */
 
-    /* */
-    ACCESS_GET_CONTENT_TYPE,/* arg1=char **ppsz_content_type                       res=can fail */
+    /* Meta data */
+    ACCESS_GET_META,        /* arg1= vlc_meta_t ** res=can fail */
+    ACCESS_GET_CONTENT_TYPE,/* arg1=char **ppsz_content_type res=can fail */
 
-    /* */
     ACCESS_GET_SIGNAL,      /* arg1=double *pf_quality, arg2=double *pf_strength   res=can fail */
 
     /* */
@@ -80,7 +80,7 @@ struct access_t
 
     /* Access name (empty if non forced) */
     char        *psz_access;
-    char        *psz_path; /**< Location (URL with the scheme stripped) */
+    char        *psz_location; /**< Location (URL with the scheme stripped) */
     char        *psz_filepath; /**< Local file path (if applicable) */
 
     /* Access can fill this entry to force a demuxer
@@ -104,15 +104,8 @@ struct access_t
     /* Access has to maintain them uptodate */
     struct
     {
-        unsigned int i_update;  /* Access sets them on change,
-                                   Input removes them once take into account*/
-
-        uint64_t     i_size;    /* Write only for access, read only for input */
         uint64_t     i_pos;     /* idem */
         bool         b_eof;     /* idem */
-
-        int          i_title;    /* idem, start from 0 (could be menu) */
-        int          i_seekpoint;/* idem, start from 0 */
     } info;
     access_sys_t *p_sys;
 
@@ -137,39 +130,49 @@ static inline int access_Control( access_t *p_access, int i_query, ... )
     return i_result;
 }
 
+static inline uint64_t access_GetSize( access_t *p_access )
+{
+    uint64_t val;
+    if( access_Control( p_access, ACCESS_GET_SIZE, &val ) )
+        val = 0;
+    return val;
+}
+
 static inline void access_InitFields( access_t *p_a )
 {
-    p_a->info.i_update = 0;
-    p_a->info.i_size = 0;
     p_a->info.i_pos = 0;
     p_a->info.b_eof = false;
-    p_a->info.i_title = 0;
-    p_a->info.i_seekpoint = 0;
 }
 
 /**
  * This function will return the parent input of this access.
  * It is retained. It can return NULL.
  */
-VLC_EXPORT( input_thread_t *, access_GetParentInput, ( access_t *p_access ) );
-
-#define ACCESS_SET_CALLBACKS( read, block, control, seek )              \
-    p_access->pf_read = read;                                           \
-    p_access->pf_block = block;                                         \
-    p_access->pf_control = control;                                     \
-    p_access->pf_seek = seek;
-
-#define STANDARD_READ_ACCESS_INIT                                       \
-    access_InitFields( p_access );                                      \
-    ACCESS_SET_CALLBACKS( Read, NULL, Control, Seek );                  \
-    p_sys = p_access->p_sys = calloc( 1, sizeof( access_sys_t ));       \
-    if( !p_sys ) return VLC_ENOMEM;
-
-#define STANDARD_BLOCK_ACCESS_INIT                                      \
-    access_InitFields( p_access );                                      \
-    ACCESS_SET_CALLBACKS( NULL, Block, Control, Seek );                 \
-    p_sys = p_access->p_sys = calloc( 1, sizeof( access_sys_t ) );      \
-    if( !p_sys ) return VLC_ENOMEM;
+VLC_API input_thread_t * access_GetParentInput( access_t *p_access ) VLC_USED;
+
+#define ACCESS_SET_CALLBACKS( read, block, control, seek ) \
+    do { \
+        p_access->pf_read = (read); \
+        p_access->pf_block = (block); \
+        p_access->pf_control = (control); \
+        p_access->pf_seek = (seek); \
+    } while(0)
+
+#define STANDARD_READ_ACCESS_INIT \
+    do { \
+        access_InitFields( p_access ); \
+        ACCESS_SET_CALLBACKS( Read, NULL, Control, Seek ); \
+        p_sys = p_access->p_sys = calloc( 1, sizeof( access_sys_t ) ); \
+        if( !p_sys ) return VLC_ENOMEM;\
+    } while(0);
+
+#define STANDARD_BLOCK_ACCESS_INIT \
+    do { \
+        access_InitFields( p_access ); \
+        ACCESS_SET_CALLBACKS( NULL, Block, Control, Seek ); \
+        p_sys = p_access->p_sys = calloc( 1, sizeof( access_sys_t ) ); \
+        if( !p_sys ) return VLC_ENOMEM; \
+    } while(0);
 
 /**
  * @}