vlc_access.h 3.7 KB
Newer Older
Laurent Aimar's avatar
Laurent Aimar committed
1
/*****************************************************************************
2
 * vlc_access.h: Access descriptor, queries and methods
Laurent Aimar's avatar
Laurent Aimar committed
3
 *****************************************************************************
Jean-Baptiste Kempf's avatar
LGPL    
Jean-Baptiste Kempf committed
4
 * Copyright (C) 1999-2006 VLC authors and VideoLAN
5
 * $Id$
Laurent Aimar's avatar
Laurent Aimar committed
6
7
8
 *
 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
 *
Jean-Baptiste Kempf's avatar
LGPL    
Jean-Baptiste Kempf committed
9
10
11
 * 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
Laurent Aimar's avatar
Laurent Aimar committed
12
13
14
15
 * (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
Jean-Baptiste Kempf's avatar
LGPL    
Jean-Baptiste Kempf committed
16
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
Laurent Aimar's avatar
Laurent Aimar committed
18
 *
Jean-Baptiste Kempf's avatar
LGPL    
Jean-Baptiste Kempf committed
19
20
21
 * 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.
Laurent Aimar's avatar
Laurent Aimar committed
22
23
 *****************************************************************************/

24
25
#ifndef VLC_ACCESS_H
#define VLC_ACCESS_H 1
Laurent Aimar's avatar
Laurent Aimar committed
26

27
#include <vlc_stream.h>
zorglub's avatar
zorglub committed
28

Laurent Aimar's avatar
Laurent Aimar committed
29
30
/**
 * \defgroup access Access
31
 * \ingroup stream
32
 * Raw input byte streams
Laurent Aimar's avatar
Laurent Aimar committed
33
 * @{
34
35
 * \file
 * Input byte stream modules interface
Laurent Aimar's avatar
Laurent Aimar committed
36
37
 */

38
39
40
41
42
43
44
45
46
/**
 * Special redirection error code.
 *
 * In case of redirection, the access open function should clean up (as in
 * normal failure case), store the heap-allocated redirection URL in
 * access_t.psz_url, and return this value.
 */
#define VLC_ACCESS_REDIRECT VLC_ETIMEOUT

47
48
49
50
51
52
53
54
55
56
57
58
/**
 * Opens a new read-only byte stream.
 *
 * This function might block.
 * The initial offset is of course always zero.
 *
 * \param obj parent VLC object
 * \param mrl media resource location to read
 * \return a new access object on success, NULL on failure
 */
VLC_API access_t *vlc_access_NewMRL(vlc_object_t *obj, const char *mrl);

59
60
61
62
63
/**
 * \defgroup access_helper Access Helpers
 * @{
 */

64
65
66
67
68
/**
 * Default pf_control callback for directory accesses.
 */
VLC_API int access_vaDirectoryControlHelper( access_t *p_access, int i_query, va_list args );

69
70
71
72
73
74
75
76
#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)

ivoire's avatar
ivoire committed
77
/**
78
79
80
81
82
83
84
85
 * Access pf_readdir helper struct
 * \see access_fsdir_init()
 * \see access_fsdir_additem()
 * \see access_fsdir_finish()
 */
struct access_fsdir
{
    input_item_node_t *p_node;
86
87
88
    void **pp_slaves;
    unsigned int i_slaves;
    int i_sub_autodetect_fuzzy;
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
    bool b_show_hiddenfiles;
    char *psz_ignored_exts;
};

/**
 * Init a access_fsdir struct
 *
 * \param p_fsdir need to be cleaned with access_fsdir_finish()
 * \param p_node node that will be used to add items
 */
VLC_API void access_fsdir_init(struct access_fsdir *p_fsdir,
                               access_t *p_access, input_item_node_t *p_node);

/**
 * Finish adding items to the node
 *
105
 * \param b_success if true, items of the node will be sorted.
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
 */
VLC_API void access_fsdir_finish(struct access_fsdir *p_fsdir, bool b_success);

/**
 * Add a new input_item_t entry to the node of the access_fsdir struct.
 *
 * \param p_fsdir previously inited access_fsdir struct
 * \param psz_uri uri of the new item
 * \param psz_filename file name of the new item
 * \param i_type see \ref input_item_type_e
 * \param i_net see \ref input_item_net_type
 */
VLC_API int access_fsdir_additem(struct access_fsdir *p_fsdir,
                                 const char *psz_uri, const char *psz_filename,
                                 int i_type, int i_net);

/**
 * @} @}
ivoire's avatar
ivoire committed
124
125
 */

Laurent Aimar's avatar
Laurent Aimar committed
126
#endif