FFmpeg
|
unbuffered private I/O API More...
#include "avio.h"
#include "libavformat/version.h"
#include "libavutil/dict.h"
#include "libavutil/log.h"
Go to the source code of this file.
Data Structures | |
struct | URLContext |
struct | URLProtocol |
Macros | |
#define | URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */ |
#define | URL_PROTOCOL_FLAG_NETWORK 2 /*< The protocol uses network */ |
Functions | |
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 connection yet. More... | |
int | ffurl_connect (URLContext *uc, AVDictionary **options) |
Connect an URLContext that has been allocated by ffurl_alloc. More... | |
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. More... | |
int | ffurl_accept (URLContext *s, URLContext **c) |
Accept an URLContext c on an URLContext s. More... | |
int | ffurl_handshake (URLContext *c) |
Perform one step of the protocol handshake to accept a new client. More... | |
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. More... | |
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. More... | |
int | ffurl_write (URLContext *h, const unsigned char *buf, int size) |
Write size bytes from buf to the resource accessed by h. More... | |
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. More... | |
int | ffurl_closep (URLContext **h) |
Close the resource accessed by the URLContext h, and free the memory used by it. More... | |
int | ffurl_close (URLContext *h) |
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. More... | |
int | ffurl_get_file_handle (URLContext *h) |
Return the file descriptor associated with this URL. More... | |
int | ffurl_get_multi_file_handle (URLContext *h, int **handles, int *numhandles) |
Return the file descriptors associated with this URL. More... | |
int | ffurl_shutdown (URLContext *h, int flags) |
Signal the URLContext that we are done reading or writing the stream. More... | |
int | ffurl_register_protocol (URLProtocol *protocol) |
Register the URLProtocol protocol. More... | |
int | ff_check_interrupt (AVIOInterruptCB *cb) |
Check if the user has requested to interrup a blocking function associated with cb. More... | |
URLProtocol * | ffurl_protocol_next (const URLProtocol *prev) |
Iterate over all available protocols. More... | |
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, then you must call this function to set the remote server address. More... | |
int | ff_udp_get_local_port (URLContext *h) |
Return the local port used by the UDP connection. More... | |
int | ff_url_join (char *str, int size, const char *proto, const char *authorization, const char *hostname, int port, const char *fmt,...) av_printf_format(7 |
Assemble a URL string from components. More... | |
int void | ff_make_absolute_url (char *buf, int size, const char *base, const char *rel) |
Convert a relative url into an absolute url, given a base url. More... | |
AVIODirEntry * | ff_alloc_dir_entry (void) |
Allocate directory entry with default values. More... | |
Variables | |
const AVClass | ffurl_context_class |
unbuffered private I/O API
Definition in file url.h.
#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */ |
Definition at line 34 of file url.h.
Referenced by url_find_protocol().
#define URL_PROTOCOL_FLAG_NETWORK 2 /*< The protocol uses network */ |
Definition at line 35 of file url.h.
Referenced by ffurl_closep(), and url_alloc_for_protocol().
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 connection yet.
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 |
int_cb | interrupt callback to use for the URLContext, may be NULL |
Definition at line 270 of file avio.c.
Referenced by avio_check(), avio_open_dir(), avpriv_io_delete(), avpriv_io_move(), ffurl_open(), http_accept(), mmsh_open_internal(), open_input(), rtmp_http_open(), and tcp_accept().
int ffurl_connect | ( | URLContext * | uc, |
AVDictionary ** | options | ||
) |
Connect an URLContext that has been allocated by ffurl_alloc.
options | A dictionary filled with options for nested protocols, i.e. it will be passed to url_open2() for protocols implementing it. This parameter will be destroyed and replaced with a dict containing options that were not found. May be NULL. |
Definition at line 195 of file avio.c.
Referenced by avio_check(), ffurl_open(), mmsh_open_internal(), rtmp_http_open(), and url_connect().
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.
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 |
int_cb | interrupt callback to use for the URLContext, may be NULL |
options | A dictionary filled with protocol-private options. On return this parameter will be destroyed and replaced with a dict containing options that were not found. May be NULL. |
Definition at line 292 of file avio.c.
Referenced by async_open(), avio_open2(), cache_open(), concat_open(), crypto_open2(), dash_flush(), dash_write_header(), ff_tls_open_underlying(), find_index_range(), ftp_connect_control_connection(), ftp_connect_data_connection(), gopher_open(), hls_read(), http_listen(), http_open_cnx_internal(), icecast_open(), ism_flush(), ism_seek(), md5_close(), mms_open(), open_url(), rtmp_calc_swfhash(), rtmp_open(), rtmpe_open(), rtp_new_av_stream(), rtp_open(), rtsp_listen(), rtsp_read_setup(), sap_read_header(), sap_write_header(), srtp_open(), and subfile_open().
int ffurl_accept | ( | URLContext * | s, |
URLContext ** | c | ||
) |
Accept an URLContext c on an URLContext s.
s | server context |
c | client context, must be unallocated. |
Definition at line 214 of file avio.c.
Referenced by avio_accept(), and http_accept().
int ffurl_handshake | ( | URLContext * | c | ) |
Perform one step of the protocol handshake to accept a new client.
See avio_handshake() for details. Implementations should try to return decreasing values. If the protocol uses an underlying protocol, the underlying handshake is usually the first step, and the return value can be: (largest value for this protocol) + (return value from other protocol)
c | the client context |
Definition at line 222 of file avio.c.
Referenced by avio_handshake(), and http_handshake().
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 at line 353 of file avio.c.
Referenced by async_buffer_task(), cache_read(), concat_read(), crypto_read(), ff_rtmp_packet_read(), ff_rtmp_packet_read_internal(), ffio_fdopen(), find_index_range(), ftp_getc(), ftp_read(), ftp_read_dir(), gnutls_url_pull(), gopher_read(), hls_read(), http_buf_read(), http_getc(), read_from_url(), rtmp_http_open(), rtmp_http_read(), rtmp_http_send_cmd(), rtmp_write(), rtmpe_read(), sap_fetch_packet(), sap_read_header(), srtp_read(), subfile_read(), and url_bio_bread().
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 360 of file avio.c.
Referenced by ff_rtsp_tcp_read_packet(), get_chunk_header(), get_http_header_data(), get_tcp_server_response(), open_input(), read_data_packet(), read_from_url(), read_line(), rtmp_calc_swfhash(), rtmp_handshake(), rtmp_packet_read_one_chunk(), rtmp_receive_hs_packet(), rtmp_server_handshake(), rtsp_read_announce(), and tls_read_cb().
int ffurl_write | ( | URLContext * | h, |
const unsigned char * | buf, | ||
int | size | ||
) |
Write size bytes from buf to the resource accessed by h.
Definition at line 367 of file avio.c.
Referenced by crypto_close(), crypto_write(), dash_write(), ff_rtmp_packet_write(), ff_rtp_check_and_send_back_rr(), ff_rtp_send_punch_packets(), ff_rtp_send_rtcp_feedback(), ff_rtsp_tcp_write_packet(), ffio_fdopen(), ftp_send_command(), ftp_write(), gnutls_url_push(), gopher_write(), http_connect(), http_send_data(), http_shutdown(), http_write(), http_write_reply(), icecast_write(), ism_write(), md5_close(), rtmp_handshake(), rtmp_send_hs_packet(), rtmp_server_handshake(), rtmpe_write(), rtp_write(), rtsp_send_reply(), sap_write_close(), sap_write_packet(), send_command_packet(), srtp_write(), tls_write_cb(), and url_bio_bwrite().
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.
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). |
Definition at line 380 of file avio.c.
Referenced by async_buffer_task(), cache_read(), cache_seek(), concat_read(), concat_seek(), ffio_fdopen(), ffurl_connect(), ffurl_size(), find_index_range(), ism_seek(), open_input(), rtmp_calc_swfhash(), and slave_seek().
int ffurl_closep | ( | URLContext ** | h | ) |
Close the resource accessed by the URLContext h, and free the memory used by it.
Also set the URLContext pointer to NULL.
Definition at line 390 of file avio.c.
Referenced by ffurl_close(), ftp_abort(), ftp_close_both_connections(), ftp_close_data_connection(), ftp_close_dir(), ftp_open_dir(), http_close(), http_open_cnx(), and mmsh_close().
int ffurl_close | ( | URLContext * | h | ) |
Definition at line 412 of file avio.c.
Referenced by async_close(), async_open(), avio_check(), avio_close(), avio_close_dir(), avio_open2(), avio_open_dir(), avpriv_io_delete(), avpriv_io_move(), cache_close(), close_connection(), concat_close(), concat_open(), crypto_close(), dash_flush(), dash_free(), ff_rtp_chain_mux_open(), ff_rtsp_undo_setup(), ffurl_open(), find_index_range(), free_playlist_list(), gopher_close(), hls_close(), hls_read(), hls_read_seek(), http_seek_internal(), icecast_close(), ism_flush(), ism_free(), ism_seek(), md5_close(), mms_close(), mmsh_open_internal(), open_input(), read_data(), recheck_discard_flags(), rtmp_calc_swfhash(), rtmp_close(), rtmp_http_close(), rtmp_open(), rtmpe_close(), rtp_close(), rtp_new_av_stream(), rtp_open(), rtsp_listen(), sap_read_close(), sap_write_close(), srtp_close(), subfile_close(), subfile_open(), tls_close(), and url_connect().
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 556 of file avio.c.
Referenced by async_open(), and concat_open().
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.
Definition at line 571 of file avio.c.
Referenced by ftp_get_file_handle(), http_get_file_handle(), rtp_open(), rtsp_write_packet(), sap_fetch_packet(), sap_write_header(), and srtp_get_file_handle().
int ffurl_get_multi_file_handle | ( | URLContext * | h, |
int ** | handles, | ||
int * | numhandles | ||
) |
Return the file descriptors associated with this URL.
Definition at line 578 of file avio.c.
Referenced by srtp_get_multi_file_handle().
int ffurl_shutdown | ( | URLContext * | h, |
int | flags | ||
) |
Signal the URLContext that we are done reading or writing the stream.
h | pointer to the resource |
flags | flags which control how the resource indicated by url is to be shutdown |
Definition at line 593 of file avio.c.
Referenced by ftp_shutdown().
int ffurl_register_protocol | ( | URLProtocol * | protocol | ) |
Register the URLProtocol protocol.
int ff_check_interrupt | ( | AVIOInterruptCB * | cb | ) |
Check if the user has requested to interrup a blocking function associated with cb.
Definition at line 600 of file avio.c.
Referenced by async_check_interrupt(), avformat_find_stream_info(), ff_listen_connect(), ff_network_wait_fd_timeout(), ff_poll_interrupt(), hls_read(), read_data(), retry_transfer_wrapper(), and rtp_read().
URLProtocol* ffurl_protocol_next | ( | const URLProtocol * | prev | ) |
Iterate over all available protocols.
prev | result of the previous call to this functions or NULL. |
Definition at line 36 of file avio.c.
Referenced by avio_enum_protocols(), url_find_protocol(), and urlcontext_child_class_next().
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, then you must call this function to set the remote server address.
url syntax: udp://host:port[?option=val...] option: 'ttl=n' : set the ttl value (for multicast only) 'localport=n' : set the local port 'pkt_size=n' : set max packet size 'reuse=1' : enable reusing the socket 'overrun_nonfatal=1': survive in case of circular buffer overrun
h | media file context |
uri | of the remote server |
Definition at line 423 of file udp.c.
Referenced by ff_rtp_set_remote_url(), and udp_open().
int ff_udp_get_local_port | ( | URLContext * | h | ) |
Return the local port used by the UDP connection.
h | media file context |
Definition at line 462 of file udp.c.
Referenced by ff_rtp_get_local_rtcp_port(), ff_rtp_get_local_rtp_port(), and rtp_open().
int ff_url_join | ( | char * | str, |
int | size, | ||
const char * | proto, | ||
const char * | authorization, | ||
const char * | hostname, | ||
int | port, | ||
const char * | fmt, | ||
... | |||
) |
Assemble a URL string from components.
This is the reverse operation of av_url_split.
Note, this requires networking to be initialized, so the caller must ensure ff_network_init has been called.
str | the buffer to fill with the url |
size | the size of the str buffer |
proto | the protocol identifier, if null, the separator after the identifier is left out, too |
authorization | an optional authorization string, may be null. An empty string is treated the same as a null string. |
hostname | the host name string |
port | the port number, left out from the string if negative |
fmt | a generic format string for everything to add after the host/port, may be null |
int void ff_make_absolute_url | ( | char * | buf, |
int | size, | ||
const char * | base, | ||
const char * | rel | ||
) |
Convert a relative url into an absolute url, given a base url.
buf | the buffer where output absolute url is written |
size | the size of buf |
base | the base url, may be equal to buf. |
rel | the new url, which is interpreted relative to base |
Definition at line 80 of file url.c.
Referenced by add_file(), new_playlist(), parse_location(), parse_playlist(), and test().
AVIODirEntry* ff_alloc_dir_entry | ( | void | ) |
Allocate directory entry with default values.
Definition at line 149 of file url.c.
Referenced by ftp_read_dir(), libsmbc_read_dir(), and libssh_read_dir().
const AVClass ffurl_context_class |
Definition at line 77 of file avio.c.
Referenced by ff_avio_child_class_next(), and url_alloc_for_protocol().