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 */
Buffered I/O operations.
int size
int(* url_check)(URLContext *h, int mask)
Definition: url.h:75
int flags
Definition: url.h:74
const AVClass ffurl_context_class
Definition: avio.c:76
int64_t ffurl_size(URLContext *h)
Return the filesize of the resource accessed by h, AVERROR(ENOSYS) if the operation is not supported ...
Definition: avio.c:426
int is_streamed
true if streamed (no seek possible), default = false
Definition: url.h:49
AVIOInterruptCB interrupt_callback
Definition: url.h:51
struct URLProtocol * prot
Definition: url.h:44
int ffurl_register_protocol(URLProtocol *protocol, int size)
Register the URLProtocol protocol.
Definition: avio.c:109
int flags
Definition: url.h:47
const AVClass * priv_data_class
Definition: url.h:73
struct URLProtocol * next
Definition: url.h:67
int ffurl_write(URLContext *h, const unsigned char *buf, int size)
Write size bytes from buf to the resource accessed by h.
Definition: avio.c:355
Public dictionary API.
int(* url_get_file_handle)(URLContext *h)
Definition: url.h:71
static int flags
Definition: log.c:34
Callback for checking whether to abort blocking functions.
Definition: avio.h:51
int ffurl_open(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Create an URLContext for accessing to the resource indicated by url, and open it. ...
Definition: avio.c:293
int(* url_open2)(URLContext *h, const char *url, int flags, AVDictionary **options)
This callback is to be used by protocols which open further nested protocols.
Definition: url.h:62
struct URLProtocol URLProtocol
int ffurl_read_complete(URLContext *h, unsigned char *buf, int size)
Read as many bytes as possible (up to size), calling the read function multiple times if necessary...
Definition: avio.c:348
static const uint16_t mask[17]
Definition: lzw.c:36
int ff_check_interrupt(AVIOInterruptCB *cb)
Check if the user has requested to interrup a blocking function associated with cb.
Definition: avio.c:462
int ff_udp_set_remote_url(URLContext *h, const char *uri)
If no filename is given to av_open_input_file because you want to get the local port first...
Definition: udp.c:247
int ffurl_read(URLContext *h, unsigned char *buf, int size)
Read up to size bytes from the resource accessed by h, and store the read bytes in buf...
Definition: avio.c:341
int(* url_open)(URLContext *h, const char *url, int flags)
Definition: url.h:56
int(* url_write)(URLContext *h, const unsigned char *buf, int size)
Definition: url.h:64
int(* url_read)(URLContext *h, unsigned char *buf, int size)
Definition: url.h:63
static const AVIOInterruptCB int_cb
Definition: avconv.c:661
int ffurl_connect(URLContext *uc, AVDictionary **options)
Connect an URLContext that has been allocated by ffurl_alloc.
Definition: avio.c:168
struct URLContext URLContext
int(* url_read_pause)(URLContext *h, int pause)
Definition: url.h:68
int64_t(* url_seek)(URLContext *h, int64_t pos, int whence)
Definition: url.h:65
Libavformat version macros.
int ffurl_get_file_handle(URLContext *h)
Return the file descriptor associated with this URL.
Definition: avio.c:441
int is_connected
Definition: url.h:50
URLProtocol * ffurl_protocol_next(URLProtocol *prev)
Iterate over all available protocols.
Definition: avio.c:36
int ff_udp_get_local_port(URLContext *h)
Return the local port used by the UDP connection.
Definition: udp.c:286
int64_t(* url_read_seek)(URLContext *h, int stream_index, int64_t timestamp, int flags)
Definition: url.h:69
static const OptionDef options[]
Definition: avconv.c:105
static void(WINAPI *cond_broadcast)(pthread_cond_t *cond)
Definition: url.h:42
Describe the class of an AVClass context structure.
Definition: log.h:33
void * priv_data
Definition: url.h:45
int ffurl_alloc(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb)
Create a URLContext for accessing to the resource indicated by url, but do not initiate the connectio...
Definition: avio.c:266
const char * name
Definition: url.h:55
int64_t ffurl_seek(URLContext *h, int64_t pos, int whence)
Change the position that will be used by the next read/write operation on the resource accessed by h...
Definition: avio.c:366
const AVClass * av_class
information for av_log().
Definition: url.h:43
int ffurl_close(URLContext *h)
Close the resource accessed by the URLContext h, and free the memory used by it.
Definition: avio.c:376
char * filename
specified URL
Definition: url.h:46
int(* url_interrupt_cb)(void)
int max_packet_size
if non zero, the stream is packetized with this max packet size
Definition: url.h:48
int(* url_close)(URLContext *h)
Definition: url.h:66
int priv_data_size
Definition: url.h:72