FFmpeg
|
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
#include "libavutil/opt.h"
#include "libavutil/time.h"
#include "libavutil/avassert.h"
#include "os_support.h"
#include "internal.h"
#include "url.h"
Go to the source code of this file.
Data Structures | |
struct | AVIODirContext |
Logging context. | |
#define | OFFSET(x) offsetof(URLContext,x) |
#define | E AV_OPT_FLAG_ENCODING_PARAM |
#define | D AV_OPT_FLAG_DECODING_PARAM |
#define | URL_SCHEME_CHARS |
static const AVOption | options [] |
const AVClass | ffurl_context_class |
static const char * | urlcontext_to_name (void *ptr) |
static void * | urlcontext_child_next (void *obj, void *prev) |
static int | url_alloc_for_protocol (URLContext **puc, const URLProtocol *up, const char *filename, int flags, const AVIOInterruptCB *int_cb) |
int | ffurl_connect (URLContext *uc, AVDictionary **options) |
Connect an URLContext that has been allocated by ffurl_alloc. 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... | |
static const struct URLProtocol * | url_find_protocol (const char *filename) |
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_open_whitelist (URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options, const char *whitelist, const char *blacklist, URLContext *parent) |
Create an URLContext for accessing to the resource indicated by url, and open it. More... | |
static int | retry_transfer_wrapper (URLContext *h, uint8_t *buf, const uint8_t *cbuf, int size, int size_min, int read) |
int | ffurl_read2 (void *urlcontext, uint8_t *buf, int size) |
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_write2 (void *urlcontext, const uint8_t *buf, int size) |
int64_t | ffurl_seek2 (void *urlcontext, int64_t pos, int whence) |
int | ffurl_closep (URLContext **hh) |
Close the resource accessed by the URLContext h, and free the memory used by it. More... | |
int | ffurl_close (URLContext *h) |
const char * | avio_find_protocol_name (const char *url) |
Return the name of the protocol that will handle the passed URL. More... | |
int | avio_check (const char *url, int flags) |
Return AVIO_FLAG_* 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. More... | |
int | ffurl_move (const char *url_src, const char *url_dst) |
Move or rename a resource. More... | |
int | ffurl_delete (const char *url) |
Delete a resource. More... | |
int | avio_open_dir (AVIODirContext **s, const char *url, AVDictionary **options) |
Open directory for reading. More... | |
int | avio_read_dir (AVIODirContext *s, AVIODirEntry **next) |
Get next directory entry. More... | |
int | avio_close_dir (AVIODirContext **s) |
Close directory. More... | |
void | avio_free_directory_entry (AVIODirEntry **entry) |
Free entry allocated by avio_read_dir(). More... | |
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_get_short_seek (void *urlcontext) |
Return the current short seek threshold value for this URL. More... | |
int | ffurl_shutdown (URLContext *h, int flags) |
Signal the URLContext that we are done reading or writing the stream. More... | |
int | ff_check_interrupt (AVIOInterruptCB *cb) |
Check if the user has requested to interrupt a blocking function associated with cb. More... | |
int | ff_rename (const char *url_src, const char *url_dst, void *logctx) |
Wrap ffurl_move() and log if error happens. More... | |
#define OFFSET | ( | x | ) | offsetof(URLContext,x) |
#define E AV_OPT_FLAG_ENCODING_PARAM |
#define D AV_OPT_FLAG_DECODING_PARAM |
#define URL_SCHEME_CHARS |
|
static |
|
static |
Definition at line 73 of file avio.c.
Referenced by ffurl_alloc().
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 160 of file avio.c.
Referenced by avio_check(), ffurl_open_whitelist(), mmsh_open_internal(), and rtmp_http_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 220 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 228 of file avio.c.
Referenced by avio_handshake(), and http_handshake().
|
static |
Definition at line 245 of file avio.c.
Referenced by avio_find_protocol_name(), and ffurl_alloc().
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 287 of file avio.c.
Referenced by avio_check(), avio_open_dir(), ffurl_delete(), ffurl_move(), ffurl_open_whitelist(), http_accept(), mmsh_open_internal(), rtmp_http_open(), and tcp_accept().
int ffurl_open_whitelist | ( | URLContext ** | puc, |
const char * | filename, | ||
int | flags, | ||
const AVIOInterruptCB * | int_cb, | ||
AVDictionary ** | options, | ||
const char * | whitelist, | ||
const char * | blacklist, | ||
URLContext * | parent | ||
) |
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. |
parent | An enclosing URLContext, whose generic options should be applied to this URLContext as well. |
Definition at line 300 of file avio.c.
Referenced by async_open(), cache_open(), crypto_open2(), ff_tls_open_underlying(), ffio_open_whitelist(), 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(), prompeg_open(), rtmp_calc_swfhash(), rtmp_open(), rtmpe_open(), rtp_open(), rtsp_listen(), rtsp_read_setup(), sap_read_header(), sap_write_header(), srtp_open(), subfile_open(), tee_open(), and translate_ipfs_to_http().
|
inlinestatic |
Definition at line 350 of file avio.c.
Referenced by ffurl_read2(), ffurl_read_complete(), and ffurl_write2().
Definition at line 395 of file avio.c.
Referenced by ffio_fdopen(), ffio_geturlcontext(), and ffurl_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 404 of file avio.c.
Referenced by ff_rtsp_tcp_read_packet(), get_chunk_header(), get_http_header_data(), get_tcp_server_response(), read_data_packet(), read_line(), rtmp_calc_swfhash(), rtmp_handshake(), rtmp_packet_read_one_chunk(), rtmp_receive_hs_packet(), rtmp_server_handshake(), and rtsp_read_announce().
Definition at line 414 of file avio.c.
Referenced by ffio_fdopen(), and ffurl_write().
int64_t ffurl_seek2 | ( | void * | urlcontext, |
int64_t | pos, | ||
int | whence | ||
) |
Definition at line 428 of file avio.c.
Referenced by ffio_fdopen(), and ffurl_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 439 of file avio.c.
Referenced by async_close(), async_open(), cache_close(), concat_close(), crypto_close(), ff_rtsp_undo_setup(), ff_tls_close(), ffurl_close(), ffurl_open_whitelist(), ftp_abort(), ftp_close_both_connections(), ftp_close_data_connection(), ftp_close_dir(), ftp_open_dir(), gopher_close(), hls_close(), hls_read(), http_accept(), http_buf_read(), http_close(), http_open_cnx(), icecast_close(), ipfs_close(), ism_flush(), ism_free(), ism_seek(), mms_close(), mmsh_close(), mmsh_open_internal(), prompeg_close(), prompeg_open(), rtmp_close(), rtmp_http_close(), rtmp_open(), rtmpe_close(), rtp_close(), rtp_open(), rtsp_read_setup(), sap_read_close(), sap_write_close(), srtp_close(), subfile_close(), subfile_open(), tcp_accept(), tee_close(), and tls_close().
int ffurl_close | ( | URLContext * | h | ) |
Definition at line 462 of file avio.c.
Referenced by avio_check(), avio_close(), avio_close_dir(), avio_open_dir(), ff_rtp_chain_mux_open(), ffio_open_whitelist(), ffurl_delete(), ffurl_move(), http_seek_internal(), md5_close(), and rtmp_calc_swfhash().
const char* avio_find_protocol_name | ( | const char * | url | ) |
Return the name of the protocol that will handle the passed URL.
NULL is returned if no protocol could be found for the given URL.
Definition at line 468 of file avio.c.
Referenced by add_file(), assert_file_overwrite(), create_master_playlist(), dash_flush(), dash_write_packet(), ff_configure_buffers_for_index(), ff_is_http_proto(), format_name(), hls_delete_old_segments(), hls_start(), hls_window(), hls_write_packet(), hls_write_trailer(), ishttp(), open_url(), seg_init(), sls_flag_check_duration_size(), write_hls_media_playlist(), and write_manifest().
Return AVIO_FLAG_* 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.
Definition at line 475 of file avio.c.
Referenced by assert_file_overwrite(), and find_image_range().
int ffurl_move | ( | const char * | url_src, |
const char * | url_dst | ||
) |
Move or rename a resource.
url_src | url to resource to be moved |
url_dst | new url to resource if the operation succeeded |
Definition at line 494 of file avio.c.
Referenced by ff_rename().
int ffurl_delete | ( | const char * | url | ) |
Delete a resource.
url | resource to be deleted. |
Definition at line 516 of file avio.c.
Referenced by dashenc_delete_file().
int avio_open_dir | ( | AVIODirContext ** | s, |
const char * | url, | ||
AVDictionary ** | options | ||
) |
Open directory for reading.
s | directory read context. Pointer to a NULL pointer must be passed. |
url | directory to be listed. |
options | A dictionary filled with protocol-private options. On return this parameter will be destroyed and replaced with a dictionary containing options that were not found. May be NULL. |
Definition at line 538 of file avio.c.
Referenced by list_op().
int avio_read_dir | ( | AVIODirContext * | s, |
AVIODirEntry ** | next | ||
) |
Get next directory entry.
Returned entry must be freed with avio_free_directory_entry(). In particular it may outlive AVIODirContext.
s | directory read context. | |
[out] | next | next entry or NULL when no more entries. |
Definition at line 576 of file avio.c.
Referenced by list_op().
int avio_close_dir | ( | AVIODirContext ** | s | ) |
Close directory.
s | directory read context. |
Definition at line 589 of file avio.c.
Referenced by list_op().
void avio_free_directory_entry | ( | AVIODirEntry ** | entry | ) |
Free entry allocated by avio_read_dir().
entry | entry to be freed. |
Definition at line 604 of file avio.c.
Referenced by avio_read_dir(), ftp_read_dir(), and list_op().
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 612 of file avio.c.
Referenced by async_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 627 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(), srtp_get_file_handle(), and tls_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 634 of file avio.c.
Referenced by srtp_get_multi_file_handle().
int ffurl_get_short_seek | ( | void * | urlcontext | ) |
Return the current short seek threshold value for this URL.
Definition at line 651 of file avio.c.
Referenced by ffio_fdopen(), http_get_short_seek(), and tls_get_short_seek().
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 660 of file avio.c.
Referenced by dashenc_io_close(), ftp_shutdown(), and hlsenc_io_close().
int ff_check_interrupt | ( | AVIOInterruptCB * | cb | ) |
Check if the user has requested to interrupt a blocking function associated with cb.
Definition at line 667 of file avio.c.
Referenced by async_check_interrupt(), avformat_find_stream_info(), dash_read_packet(), failing_write_packet(), ff_listen_connect(), ff_network_sleep_interruptible(), ff_network_wait_fd_timeout(), ff_poll_interrupt(), get_current_fragment(), hls_read(), libsrt_network_wait_fd_timeout(), read_data(), reopen_demux_for_component(), retry_transfer_wrapper(), rtp_read(), start_connect_attempt(), tls_open(), and zmq_proto_wait_timeout().
int ff_rename | ( | const char * | url_src, |
const char * | url_dst, | ||
void * | logctx | ||
) |
Wrap ffurl_move() and log if error happens.
url_src | source path |
url_dst | destination path |
Definition at line 674 of file avio.c.
Referenced by create_master_playlist(), dash_flush(), hds_flush(), hls_rename_temp_file(), hls_window(), ism_flush(), segment_end(), sls_flag_file_rename(), write_abst(), write_hls_media_playlist(), write_manifest(), and write_packet().
|
static |
Definition at line 56 of file avio.c.
Referenced by avio_open_dir(), ffurl_connect(), and ffurl_open_whitelist().
const AVClass ffurl_context_class |
Definition at line 63 of file avio.c.
Referenced by child_class_iterate(), and url_alloc_for_protocol().