avio: make url_read_complete() internal.
[libav.git] / libavformat / url.h
CommitLineData
5652bb94
AK
1/*
2 *
3 * This file is part of Libav.
4 *
5 * Libav is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * Libav is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with Libav; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20/**
21 * @file
22 * unbuffered private I/O API
23 */
24
25#ifndef AVFORMAT_URL_H
26#define AVFORMAT_URL_H
27
28#include "avio.h"
29
30/**
31 * Create a URLContext for accessing to the resource indicated by
32 * url, but do not initiate the connection yet.
33 *
34 * @param puc pointer to the location where, in case of success, the
35 * function puts the pointer to the created URLContext
36 * @param flags flags which control how the resource indicated by url
37 * is to be opened
38 * @return 0 in case of success, a negative value corresponding to an
39 * AVERROR code in case of failure
40 */
41int ffurl_alloc(URLContext **h, const char *url, int flags);
42
62eaaeac
AK
43/**
44 * Connect an URLContext that has been allocated by ffurl_alloc
45 */
46int ffurl_connect(URLContext *h);
47
0589da0a
AK
48/**
49 * Create an URLContext for accessing to the resource indicated by
50 * url, and open it.
51 *
52 * @param puc pointer to the location where, in case of success, the
53 * function puts the pointer to the created URLContext
54 * @param flags flags which control how the resource indicated by url
55 * is to be opened
56 * @return 0 in case of success, a negative value corresponding to an
57 * AVERROR code in case of failure
58 */
59int ffurl_open(URLContext **h, const char *url, int flags);
60
bc371aca
AK
61/**
62 * Read up to size bytes from the resource accessed by h, and store
63 * the read bytes in buf.
64 *
65 * @return The number of bytes actually read, or a negative value
66 * corresponding to an AVERROR code in case of error. A value of zero
67 * indicates that it is not possible to read more from the accessed
68 * resource (except if the value of the size argument is also zero).
69 */
70int ffurl_read(URLContext *h, unsigned char *buf, int size);
71
dce37564
AK
72/**
73 * Read as many bytes as possible (up to size), calling the
74 * read function multiple times if necessary.
75 * This makes special short-read handling in applications
76 * unnecessary, if the return value is < size then it is
77 * certain there was either an error or the end of file was reached.
78 */
79int ffurl_read_complete(URLContext *h, unsigned char *buf, int size);
80
5652bb94 81#endif //AVFORMAT_URL_H