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
30struct vlc_http_mgr;
32
33/**
34 * Creates an HTTP file.
35 *
36 * Allocates a structure for a remote HTTP-served read-only file.
37 *
38 * @param mgr HTTP connection manager
39 * @param url URL of the file to read
40 * @param ua user agent string (or NULL to ignore)
41 * @param ref referral URL (or NULL to ignore)
42 *
43 * @return an HTTP resource object pointer, or NULL on error
44 */
46 const char *url, const char *ua,
47 const char *ref);
48
49/**
50 * Gets file size.
51 *
52 * Determines the file size in bytes.
53 *
54 * @return Bytes count or (uintmax_t)-1 if unknown.
55 */
57
58/**
59 * Checks seeking support.
60 *
61 * @retval true if file supports seeking
62 * @retval false if file does not support seeking
63 */
65
66/**
67 * Sets the read offset.
68 *
69 * @param offset byte offset of next read
70 * @retval 0 if seek succeeded
71 * @retval -1 if seek failed
72 */
73int vlc_http_file_seek(struct vlc_http_resource *, uintmax_t offset);
74
75/**
76 * Reads data.
77 *
78 * Reads data from a file and update the file offset.
79 */
81
82#define vlc_http_file_get_status vlc_http_res_get_status
83#define vlc_http_file_get_redirect vlc_http_res_get_redirect
84#define vlc_http_file_get_type vlc_http_res_get_type
85#define vlc_http_file_destroy vlc_http_res_destroy
86
87/** @} */
uintmax_t vlc_http_file_get_size(struct vlc_http_resource *)
Gets file size.
Definition: file.c:178
bool vlc_http_file_can_seek(struct vlc_http_resource *)
Checks seeking support.
Definition: file.c:196
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
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