VLC  4.0.0-dev
file.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * file.h: HTTP read-only file
3  *****************************************************************************
4  * Copyright (C) 2015 RĂ©mi Denis-Courmont
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation; either version 2.1 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19  *****************************************************************************/
20 
21 #include <stdint.h>
22 
23 /**
24  * \defgroup http_file Files
25  * HTTP read-only files
26  * \ingroup http_res
27  * @{
28  */
29 
30 struct vlc_http_mgr;
31 struct vlc_http_resource;
32 
33 /**
34  * Creates an HTTP file.
35  *
36  * Allocates a structure for a remote HTTP-served read-only file.
37  *
38  * @param url URL of the file to read
39  * @param ua user agent string (or NULL to ignore)
40  * @param ref referral URL (or NULL to ignore)
41  *
42  * @return an HTTP resource object pointer, or NULL on error
43  */
45  const char *url, const char *ua,
46  const char *ref);
47 
48 /**
49  * Gets file size.
50  *
51  * Determines the file size in bytes.
52  *
53  * @return Bytes count or (uintmax_t)-1 if unknown.
54  */
55 uintmax_t vlc_http_file_get_size(struct vlc_http_resource *);
56 
57 /**
58  * Checks seeking support.
59  *
60  * @retval true if file supports seeking
61  * @retval false if file does not support seeking
62  */
64 
65 /**
66  * Sets the read offset.
67  *
68  * @param offset byte offset of next read
69  * @retval 0 if seek succeeded
70  * @retval -1 if seek failed
71  */
72 int vlc_http_file_seek(struct vlc_http_resource *, uintmax_t offset);
73 
74 /**
75  * Reads data.
76  *
77  * Reads data from a file and update the file offset.
78  */
80 
81 #define vlc_http_file_get_status vlc_http_res_get_status
82 #define vlc_http_file_get_redirect vlc_http_res_get_redirect
83 #define vlc_http_file_get_type vlc_http_res_get_type
84 #define vlc_http_file_destroy vlc_http_res_destroy
85 
86 /** @} */
uintmax_t vlc_http_file_get_size(struct vlc_http_resource *)
Gets file size.
Definition: file.c:178
struct vlc_http_resource * vlc_http_file_create(struct vlc_http_mgr *mgr, const char *url, const char *ua, const char *ref)
Creates an HTTP file.
Definition: file.c:113
bool vlc_http_file_can_seek(struct vlc_http_resource *)
Checks seeking support.
Definition: file.c:196
block_t * vlc_http_file_read(struct vlc_http_resource *)
Reads data.
Definition: file.c:232
int vlc_http_file_seek(struct vlc_http_resource *, uintmax_t offset)
Sets the read offset.
Definition: file.c:204
Definition: vlc_frame.h:123
Definition: connmgr.c:100
Definition: resource.h:44