libavformat/avio.c File Reference

#include <unistd.h>
#include "libavutil/avstring.h"
#include "libavutil/opt.h"
#include "os_support.h"
#include "avformat.h"
#include "url.h"

Go to the source code of this file.

Data Structures

struct  URLProtocol_compat

Defines

#define URL_SCHEME_CHARS

Functions

static int default_interrupt_cb (void)
URLProtocolav_protocol_next (URLProtocol *p)
 returns the next registered protocol after the given protocol (the first if NULL is given), or NULL if protocol is the last one.
const char * avio_enum_protocols (void **opaque, int output)
 Iterate through names of available protocols.
int ffurl_register_protocol (URLProtocol *protocol, int size)
 Register the URLProtocol protocol.
int av_register_protocol (URLProtocol *protocol)
int register_protocol (URLProtocol *protocol)
static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up, const char *filename, int flags)
int ffurl_connect (URLContext *uc)
 Connect an URLContext that has been allocated by ffurl_alloc.
int url_open_protocol (URLContext **puc, struct URLProtocol *up, const char *filename, int flags)
int url_alloc (URLContext **puc, const char *filename, int flags)
int url_connect (URLContext *uc)
int url_open (URLContext **puc, const char *filename, int flags)
int url_read (URLContext *h, unsigned char *buf, int size)
int url_read_complete (URLContext *h, unsigned char *buf, int size)
int url_write (URLContext *h, const unsigned char *buf, int size)
int64_t url_seek (URLContext *h, int64_t pos, int whence)
int url_close (URLContext *h)
int64_t url_filesize (URLContext *h)
int url_get_file_handle (URLContext *h)
int url_get_max_packet_size (URLContext *h)
void url_get_filename (URLContext *h, char *buf, int buf_size)
void url_set_interrupt_cb (URLInterruptCB *interrupt_cb)
int av_register_protocol2 (URLProtocol *protocol, int size)
 Register the URLProtocol protocol.
int ffurl_alloc (URLContext **puc, const char *filename, int flags)
 Create a URLContext for accessing to the resource indicated by url, but do not initiate the connection yet.
int ffurl_open (URLContext **puc, const char *filename, int flags)
 Create an URLContext for accessing to the resource indicated by url, and open it.
static int retry_transfer_wrapper (URLContext *h, unsigned char *buf, int size, int size_min, int(*transfer_func)(URLContext *h, unsigned char *buf, int size))
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.
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.
int ffurl_write (URLContext *h, const unsigned char *buf, int size)
 Write size bytes from buf to the resource accessed by h.
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.
int ffurl_close (URLContext *h)
 Close the resource accessed by the URLContext h, and free the memory used by it.
int url_exist (const char *filename)
 Return a non-zero value if the resource indicated by url exists, 0 otherwise.
int avio_check (const char *url, int flags)
 Return AVIO_* access flags corresponding to the access permissions of the resource in url, or a negative value corresponding to an AVERROR code in case of failure.
int64_t ffurl_size (URLContext *h)
 Return the filesize of the resource accessed by h, AVERROR(ENOSYS) if the operation is not supported by h, or another negative value corresponding to an AVERROR error code in case of failure.
int ffurl_get_file_handle (URLContext *h)
 Return the file descriptor associated with this URL.
void avio_set_interrupt_cb (int(*interrupt_cb)(void))
 The callback is called in blocking functions to test regulary if asynchronous interruption is needed.
int av_url_read_pause (URLContext *h, int pause)
int64_t av_url_read_seek (URLContext *h, int stream_index, int64_t timestamp, int flags)

Variables

URLProtocolfirst_protocol = NULL
int(* url_interrupt_cb )(void) = default_interrupt_cb


Define Documentation

#define URL_SCHEME_CHARS

Value:

"abcdefghijklmnopqrstuvwxyz"                \
    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"                \
    "0123456789+-."

Definition at line 242 of file avio.c.

Referenced by ffurl_alloc().


Function Documentation

int av_register_protocol ( URLProtocol protocol  ) 

Deprecated:
Use av_register_protocol2() instead.

Definition at line 100 of file avio.c.

int avio_check ( const char *  url,
int  flags 
)

Return AVIO_* access flags corresponding to the access permissions of the resource in url, or a negative value corresponding to an AVERROR code in case of failure.

The returned access flags are masked by the value in flags.

Note:
This function is intrinsically unsafe, in the sense that the checked resource may change its existence or permission status from one call to another. Thus you should not trust the returned value, unless you are sure that no other processes are accessing the checked resource.

This function is slightly broken until next major bump because of AVIO_RDONLY == 0. Don't use it until then.

Definition at line 380 of file avio.c.

const char* avio_enum_protocols ( void **  opaque,
int  output 
)

Iterate through names of available protocols.

Note:
it is recommanded to use av_protocol_next() instead of this
Parameters:
opaque A private pointer representing current protocol. It must be a pointer to NULL on first iteration and will be updated by successive calls to avio_enum_protocols.
output If set to 1, iterate over output protocols, otherwise over input protocols.
Returns:
A static string containing the name of current protocol or NULL

Definition at line 63 of file avio.c.

Referenced by avio_enum_protocols().

void avio_set_interrupt_cb ( int(*)(void)  interrupt_cb  ) 

The callback is called in blocking functions to test regulary if asynchronous interruption is needed.

AVERROR_EXIT is returned in this case by the interrupted function. 'NULL' means no interrupt callback is given.

Definition at line 426 of file avio.c.

Referenced by main(), read_thread(), transcode(), and url_set_interrupt_cb().

static int default_interrupt_cb ( void   )  [static]

Definition at line 421 of file avio.c.

Referenced by avio_set_interrupt_cb().

int ffurl_alloc ( URLContext **  h,
const char *  url,
int  flags 
)

Create a URLContext for accessing to the resource indicated by url, but do not initiate the connection yet.

Parameters:
puc pointer to the location where, in case of success, the function puts the pointer to the created URLContext
flags flags which control how the resource indicated by url is to be opened
Returns:
0 in case of success, a negative value corresponding to an AVERROR code in case of failure

Definition at line 247 of file avio.c.

Referenced by avio_check(), ffurl_open(), mmsh_open(), open_input(), and url_alloc().

int ffurl_close ( URLContext h  ) 

int ffurl_connect ( URLContext uc  ) 

Connect an URLContext that has been allocated by ffurl_alloc.

Definition at line 153 of file avio.c.

Referenced by avio_check(), ffurl_open(), mmsh_open(), open_input(), url_connect(), and url_open_protocol().

int ffurl_get_file_handle ( URLContext h  ) 

Return the file descriptor associated with this URL.

For RTP, this will return only the RTP file descriptor, not the RTCP file descriptor.

Returns:
the file descriptor associated with this URL, or <0 on error.

Definition at line 414 of file avio.c.

Referenced by http_get_file_handle(), rtp_open(), rtsp_write_packet(), sap_fetch_packet(), sap_write_header(), and url_get_file_handle().

int ffurl_open ( URLContext **  h,
const char *  url,
int  flags 
)

Create an URLContext for accessing to the resource indicated by url, and open it.

Parameters:
puc pointer to the location where, in case of success, the function puts the pointer to the created URLContext
flags flags which control how the resource indicated by url is to be opened
Returns:
0 in case of success, a negative value corresponding to an AVERROR code in case of failure

Definition at line 275 of file avio.c.

Referenced by applehttp_read(), avio_open(), concat_open(), crypto_open(), gopher_open(), http_open_cnx(), md5_close(), mms_open(), open_input(), read_data(), rtmp_open(), rtp_open(), sap_read_header(), sap_write_header(), url_exist(), and url_open().

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.

Returns:
The number of bytes actually read, or a negative value corresponding to an AVERROR code in case of error. A value of zero indicates that it is not possible to read more from the accessed resource (except if the value of the size argument is also zero).

Definition at line 318 of file avio.c.

Referenced by applehttp_read(), concat_read(), crypto_read(), ff_rtmp_packet_read(), ffio_fdopen(), gopher_read(), http_getc(), http_read(), read_data(), sap_fetch_packet(), sap_read_header(), and url_read().

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.

This makes special short-read handling in applications unnecessary, if the return value is < size then it is certain there was either an error or the end of file was reached.

Definition at line 325 of file avio.c.

Referenced by ff_rtmp_packet_read(), ff_rtsp_tcp_read_packet(), get_chunk_header(), get_http_header_data(), get_tcp_server_response(), open_input(), read_data_packet(), rtmp_handshake(), and url_read_complete().

int ffurl_register_protocol ( URLProtocol protocol,
int  size 
)

Register the URLProtocol protocol.

Parameters:
size the size of the URLProtocol struct referenced

Definition at line 73 of file avio.c.

Referenced by av_register_protocol(), av_register_protocol2(), and register_protocol().

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.

Parameters:
pos specifies the new position to set
whence specifies how pos should be interpreted, it must be one of SEEK_SET (seek from the beginning), SEEK_CUR (seek from the current position), SEEK_END (seek from the end), or AVSEEK_SIZE (return the filesize of the requested resource, pos is ignored).
Returns:
a negative value corresponding to an AVERROR code in case of failure, or the resulting file position, measured in bytes from the beginning of the file. You can use this feature together with SEEK_CUR to read the current file position.

Definition at line 343 of file avio.c.

Referenced by concat_read(), concat_seek(), ffio_fdopen(), ffurl_connect(), ffurl_size(), and url_seek().

int64_t ffurl_size ( URLContext h  ) 

Return the filesize of the resource accessed by h, AVERROR(ENOSYS) if the operation is not supported by h, or another negative value corresponding to an AVERROR error code in case of failure.

Definition at line 399 of file avio.c.

Referenced by concat_open(), and url_filesize().

int ffurl_write ( URLContext h,
const unsigned char *  buf,
int  size 
)

Write size bytes from buf to the resource accessed by h.

Returns:
the number of bytes actually written, or a negative value corresponding to an AVERROR code in case of failure

Definition at line 332 of file avio.c.

Referenced by ff_rtmp_packet_write(), ffio_fdopen(), gopher_write(), http_close(), http_connect(), http_write(), md5_close(), rtmp_handshake(), rtp_check_and_send_back_rr(), rtp_send_punch_packets(), rtp_write(), sap_write_close(), sap_write_packet(), send_command_packet(), tcp_write_packet(), and url_write().

int register_protocol ( URLProtocol protocol  ) 

Deprecated:
Use av_register_protocol() instead.

Definition at line 105 of file avio.c.

static int retry_transfer_wrapper ( URLContext h,
unsigned char *  buf,
int  size,
int  size_min,
int(*)(URLContext *h, unsigned char *buf, int size transfer_func 
) [inline, static]

Definition at line 288 of file avio.c.

Referenced by ffurl_read(), ffurl_read_complete(), and ffurl_write().

static int url_alloc_for_protocol ( URLContext **  puc,
struct URLProtocol up,
const char *  filename,
int  flags 
) [static]

Definition at line 111 of file avio.c.

Referenced by ffurl_alloc(), and url_open_protocol().

int url_exist ( const char *  url  ) 

Return a non-zero value if the resource indicated by url exists, 0 otherwise.

Deprecated:
Use avio_check instead.

Definition at line 370 of file avio.c.

Referenced by build_feed_streams(), find_image_range(), and opt_output_file().

void url_set_interrupt_cb ( URLInterruptCB interrupt_cb  ) 

Definition at line 232 of file avio.c.


Variable Documentation

Definition at line 54 of file avio.c.

int(* url_interrupt_cb)(void) = default_interrupt_cb


Generated on Fri Oct 26 02:38:20 2012 for FFmpeg by  doxygen 1.5.8