url.h
Go to the documentation of this file.
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 
25 #ifndef AVFORMAT_URL_H
26 #define AVFORMAT_URL_H
27 
28 #include "avio.h"
29 #include "libavformat/version.h"
30 
31 #include "libavutil/dict.h"
32 #include "libavutil/log.h"
33 
34 #if !FF_API_OLD_AVIO
35 #define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */
36 #define URL_PROTOCOL_FLAG_NETWORK 2 /*< The protocol uses network */
37 
38 extern int (*url_interrupt_cb)(void);
39 
40 extern const AVClass ffurl_context_class;
41 
42 typedef struct URLContext {
43  const AVClass *av_class;
44  struct URLProtocol *prot;
45  void *priv_data;
46  char *filename;
47  int flags;
52 } URLContext;
53 
54 typedef struct URLProtocol {
55  const char *name;
56  int (*url_open)( URLContext *h, const char *url, int flags);
62  int (*url_open2)(URLContext *h, const char *url, int flags, AVDictionary **options);
63  int (*url_read)( URLContext *h, unsigned char *buf, int size);
64  int (*url_write)(URLContext *h, const unsigned char *buf, int size);
65  int64_t (*url_seek)( URLContext *h, int64_t pos, int whence);
66  int (*url_close)(URLContext *h);
67  struct URLProtocol *next;
68  int (*url_read_pause)(URLContext *h, int pause);
69  int64_t (*url_read_seek)(URLContext *h, int stream_index,
70  int64_t timestamp, int flags);
74  int flags;
75  int (*url_check)(URLContext *h, int mask);
76 } URLProtocol;
77 #endif
78 
92 int ffurl_alloc(URLContext **puc, const char *filename, int flags,
93  const AVIOInterruptCB *int_cb);
94 
104 
121 int ffurl_open(URLContext **puc, const char *filename, int flags,
123 
133 int ffurl_read(URLContext *h, unsigned char *buf, int size);
134 
142 int ffurl_read_complete(URLContext *h, unsigned char *buf, int size);
143 
150 int ffurl_write(URLContext *h, const unsigned char *buf, int size);
151 
166 int64_t ffurl_seek(URLContext *h, int64_t pos, int whence);
167 
175 int ffurl_close(URLContext *h);
176 
182 int64_t ffurl_size(URLContext *h);
183 
191 
197 int ffurl_register_protocol(URLProtocol *protocol, int size);
198 
204 
211 
212 /* udp.c */
213 int ff_udp_set_remote_url(URLContext *h, const char *uri);
215 
216 #endif /* AVFORMAT_URL_H */