asfdec: remove a forgotten declaration of nonexistent function
[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"
b8404847
AK
29#include "libavformat/version.h"
30
31#if !FF_API_OLD_AVIO
32#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */
5cec8971 33
026e1757 34extern int (*url_interrupt_cb)(void);
b8404847 35#endif
5652bb94
AK
36
37/**
38 * Create a URLContext for accessing to the resource indicated by
39 * url, but do not initiate the connection yet.
40 *
41 * @param puc pointer to the location where, in case of success, the
42 * function puts the pointer to the created URLContext
43 * @param flags flags which control how the resource indicated by url
44 * is to be opened
45 * @return 0 in case of success, a negative value corresponding to an
46 * AVERROR code in case of failure
47 */
48int ffurl_alloc(URLContext **h, const char *url, int flags);
49
62eaaeac
AK
50/**
51 * Connect an URLContext that has been allocated by ffurl_alloc
52 */
53int ffurl_connect(URLContext *h);
54
0589da0a
AK
55/**
56 * Create an URLContext for accessing to the resource indicated by
57 * url, and open it.
58 *
59 * @param puc pointer to the location where, in case of success, the
60 * function puts the pointer to the created URLContext
61 * @param flags flags which control how the resource indicated by url
62 * is to be opened
63 * @return 0 in case of success, a negative value corresponding to an
64 * AVERROR code in case of failure
65 */
66int ffurl_open(URLContext **h, const char *url, int flags);
67
bc371aca
AK
68/**
69 * Read up to size bytes from the resource accessed by h, and store
70 * the read bytes in buf.
71 *
72 * @return The number of bytes actually read, or a negative value
73 * corresponding to an AVERROR code in case of error. A value of zero
74 * indicates that it is not possible to read more from the accessed
75 * resource (except if the value of the size argument is also zero).
76 */
77int ffurl_read(URLContext *h, unsigned char *buf, int size);
78
dce37564
AK
79/**
80 * Read as many bytes as possible (up to size), calling the
81 * read function multiple times if necessary.
82 * This makes special short-read handling in applications
83 * unnecessary, if the return value is < size then it is
84 * certain there was either an error or the end of file was reached.
85 */
86int ffurl_read_complete(URLContext *h, unsigned char *buf, int size);
87
925e908b
AK
88/**
89 * Write size bytes from buf to the resource accessed by h.
90 *
91 * @return the number of bytes actually written, or a negative value
92 * corresponding to an AVERROR code in case of failure
93 */
94int ffurl_write(URLContext *h, const unsigned char *buf, int size);
95
58a48c65
AK
96/**
97 * Change the position that will be used by the next read/write
98 * operation on the resource accessed by h.
99 *
100 * @param pos specifies the new position to set
101 * @param whence specifies how pos should be interpreted, it must be
102 * one of SEEK_SET (seek from the beginning), SEEK_CUR (seek from the
103 * current position), SEEK_END (seek from the end), or AVSEEK_SIZE
104 * (return the filesize of the requested resource, pos is ignored).
105 * @return a negative value corresponding to an AVERROR code in case
106 * of failure, or the resulting file position, measured in bytes from
107 * the beginning of the file. You can use this feature together with
108 * SEEK_CUR to read the current file position.
109 */
110int64_t ffurl_seek(URLContext *h, int64_t pos, int whence);
111
e52a9145
AK
112/**
113 * Close the resource accessed by the URLContext h, and free the
114 * memory used by it.
115 *
116 * @return a negative value if an error condition occurred, 0
117 * otherwise
118 */
119int ffurl_close(URLContext *h);
120
32a97d46
AK
121/**
122 * Return the filesize of the resource accessed by h, AVERROR(ENOSYS)
123 * if the operation is not supported by h, or another negative value
124 * corresponding to an AVERROR error code in case of failure.
125 */
126int64_t ffurl_size(URLContext *h);
127
1869ea03
AK
128/**
129 * Return the file descriptor associated with this URL. For RTP, this
130 * will return only the RTP file descriptor, not the RTCP file descriptor.
131 *
132 * @return the file descriptor associated with this URL, or <0 on error.
133 */
134int ffurl_get_file_handle(URLContext *h);
135
8e76a19b
AK
136/**
137 * Register the URLProtocol protocol.
138 *
139 * @param size the size of the URLProtocol struct referenced
140 */
141int ffurl_register_protocol(URLProtocol *protocol, int size);
142
5652bb94 143#endif //AVFORMAT_URL_H