FFmpeg
Data Structures | Macros
avio.c File Reference
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/time.h"
#include "libavutil/avassert.h"
#include "avio_internal.h"
#include "os_support.h"
#include "internal.h"
#include "url.h"

Go to the source code of this file.

Data Structures

struct  AVIODirContext
 

Macros

#define IO_BUFFER_SIZE   32768
 

Logging context.

#define OFFSET(x)   offsetof(URLContext,x)
 
#define E   AV_OPT_FLAG_ENCODING_PARAM
 
#define D   AV_OPT_FLAG_DECODING_PARAM
 
#define AVIOOFFSET(x)   offsetof(AVIOContext,x)
 
#define E   AV_OPT_FLAG_ENCODING_PARAM
 
#define D   AV_OPT_FLAG_DECODING_PARAM
 
#define URL_SCHEME_CHARS
 
static const AVOption options []
 
static const AVClass url_context_class
 
static const AVOption avio_options []
 
const AVClass ff_avio_class
 
static const char * urlcontext_to_name (void *ptr)
 
static void * urlcontext_child_next (void *obj, void *prev)
 
static void * avio_child_next (void *obj, void *prev)
 
static const AVClasschild_class_iterate (void **iter)
 
URLContextffio_geturlcontext (AVIOContext *s)
 Return the URLContext associated with the AVIOContext. More...
 
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 avio_accept (AVIOContext *s, AVIOContext **c)
 Accept and allocate a client context on a server context. More...
 
int ffurl_handshake (URLContext *c)
 Perform one step of the protocol handshake to accept a new client. More...
 
int avio_handshake (AVIOContext *c)
 Perform one step of the protocol handshake to accept a new client. More...
 
static const struct URLProtocolurl_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...
 
int ffio_fdopen (AVIOContext **sp, URLContext *h)
 Create and initialize a AVIOContext for accessing the resource referenced by the URLContext h. More...
 
int ffio_open_whitelist (AVIOContext **s, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options, const char *whitelist, const char *blacklist)
 
int avio_open2 (AVIOContext **s, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
 Create and initialize a AVIOContext for accessing the resource indicated by url. More...
 
int avio_open (AVIOContext **s, const char *filename, int flags)
 Create and initialize a AVIOContext for accessing the resource indicated by url. 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)
 
int avio_close (AVIOContext *s)
 Close the resource accessed by the AVIOContext s and free it. More...
 
int avio_closep (AVIOContext **s)
 Close the resource accessed by the AVIOContext *s, free it and set the pointer pointing to it to NULL. More...
 
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...
 

Macro Definition Documentation

◆ IO_BUFFER_SIZE

#define IO_BUFFER_SIZE   32768

Definition at line 36 of file avio.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(URLContext,x)

Definition at line 57 of file avio.c.

◆ E [1/2]

Definition at line 91 of file avio.c.

◆ D [1/2]

Definition at line 92 of file avio.c.

◆ AVIOOFFSET

#define AVIOOFFSET (   x)    offsetof(AVIOContext,x)

Definition at line 90 of file avio.c.

◆ E [2/2]

Definition at line 91 of file avio.c.

◆ D [2/2]

Definition at line 92 of file avio.c.

◆ URL_SCHEME_CHARS

#define URL_SCHEME_CHARS
Value:
"abcdefghijklmnopqrstuvwxyz" \
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
"0123456789+-."

Definition at line 302 of file avio.c.

Function Documentation

◆ urlcontext_to_name()

static const char* urlcontext_to_name ( void *  ptr)
static

Definition at line 40 of file avio.c.

◆ urlcontext_child_next()

static void* urlcontext_child_next ( void *  obj,
void *  prev 
)
static

Definition at line 49 of file avio.c.

◆ avio_child_next()

static void* avio_child_next ( void *  obj,
void *  prev 
)
static

Definition at line 77 of file avio.c.

◆ child_class_iterate()

static const AVClass* child_class_iterate ( void **  iter)
static

Definition at line 83 of file avio.c.

◆ ffio_geturlcontext()

URLContext* ffio_geturlcontext ( AVIOContext s)

Return the URLContext associated with the AVIOContext.

Parameters
sIO context
Returns
pointer to URLContext or NULL.

Definition at line 107 of file avio.c.

Referenced by dashenc_io_close(), dashenc_io_open(), hlsenc_io_close(), hlsenc_io_open(), and open_url_keepalive().

◆ url_alloc_for_protocol()

static int url_alloc_for_protocol ( URLContext **  puc,
const URLProtocol up,
const char *  filename,
int  flags,
const AVIOInterruptCB int_cb 
)
static

Definition at line 118 of file avio.c.

Referenced by ffurl_alloc().

◆ ffurl_connect()

int ffurl_connect ( URLContext uc,
AVDictionary **  options 
)

Connect an URLContext that has been allocated by ffurl_alloc.

Parameters
optionsA 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 205 of file avio.c.

Referenced by avio_check(), ffurl_open_whitelist(), mmsh_open_internal(), and rtmp_http_open().

◆ ffurl_accept()

int ffurl_accept ( URLContext s,
URLContext **  c 
)

Accept an URLContext c on an URLContext s.

Parameters
sserver context
cclient context, must be unallocated.
Returns
>= 0 on success, ff_neterrno() on failure.

Definition at line 265 of file avio.c.

Referenced by avio_accept(), and http_accept().

◆ avio_accept()

int avio_accept ( AVIOContext s,
AVIOContext **  c 
)

Accept and allocate a client context on a server context.

Parameters
sthe server context
cthe client context, must be unallocated
Returns
>= 0 on success or a negative value corresponding to an AVERROR on failure
Examples
avio_http_serve_files.c.

Definition at line 273 of file avio.c.

Referenced by main().

◆ ffurl_handshake()

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)

Parameters
cthe client context
Returns
>= 0 on success or a negative value corresponding to an AVERROR code on failure

Definition at line 284 of file avio.c.

Referenced by avio_handshake(), and http_handshake().

◆ avio_handshake()

int avio_handshake ( AVIOContext c)

Perform one step of the protocol handshake to accept a new client.

This function must be called on a client returned by avio_accept() before using it as a read/write context. It is separate from avio_accept() because it may block. A step of the handshake is defined by places where the application may decide to change the proceedings. For example, on a protocol with a request header and a reply header, each one can constitute a step because the application may use the parameters from the request to change parameters in the reply; or each individual chunk of the request can constitute a step. If the handshake is already finished, avio_handshake() does nothing and returns 0 immediately.

Parameters
cthe client context to perform the handshake on
Returns
0 on a complete and successful handshake > 0 if the handshake progressed, but is not complete < 0 for an AVERROR code
Examples
avio_http_serve_files.c.

Definition at line 296 of file avio.c.

Referenced by process_client().

◆ url_find_protocol()

static const struct URLProtocol* url_find_protocol ( const char *  filename)
static

Definition at line 307 of file avio.c.

Referenced by avio_find_protocol_name(), and ffurl_alloc().

◆ 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.

Parameters
pucpointer to the location where, in case of success, the function puts the pointer to the created URLContext
flagsflags which control how the resource indicated by url is to be opened
int_cbinterrupt callback to use for the URLContext, may be NULL
Returns
>= 0 in case of success, a negative value corresponding to an AVERROR code in case of failure

Definition at line 349 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().

◆ ffurl_open_whitelist()

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.

Parameters
pucpointer to the location where, in case of success, the function puts the pointer to the created URLContext
flagsflags which control how the resource indicated by url is to be opened
int_cbinterrupt callback to use for the URLContext, may be NULL
optionsA 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.
parentAn enclosing URLContext, whose generic options should be applied to this URLContext as well.
Returns
>= 0 in case of success, a negative value corresponding to an AVERROR code in case of failure

Definition at line 362 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().

◆ ffio_fdopen()

int ffio_fdopen ( AVIOContext **  s,
struct URLContext h 
)

Create and initialize a AVIOContext for accessing the resource referenced by the URLContext h.

Note
When the URLContext h has been opened in read+write mode, the AVIOContext can be used only for writing.
Parameters
sUsed to return the pointer to the created AVIOContext. In case of failure the pointed to value is set to NULL.
Returns
>= 0 in case of success, a negative value corresponding to an AVERROR code in case of failure

Definition at line 412 of file avio.c.

Referenced by avio_accept(), ff_rtp_chain_mux_open(), and ffio_open_whitelist().

◆ ffio_open_whitelist()

int ffio_open_whitelist ( AVIOContext **  s,
const char *  filename,
int  flags,
const AVIOInterruptCB int_cb,
AVDictionary **  options,
const char *  whitelist,
const char *  blacklist 
)

Definition at line 471 of file avio.c.

Referenced by avio_open2(), import_pem(), io_open_default(), and parse_playlist().

◆ avio_open2()

int avio_open2 ( AVIOContext **  s,
const char *  url,
int  flags,
const AVIOInterruptCB int_cb,
AVDictionary **  options 
)

Create and initialize a AVIOContext for accessing the resource indicated by url.

Note
When the resource indicated by url has been opened in read+write mode, the AVIOContext can be used only for writing.
Parameters
sUsed to return the pointer to the created AVIOContext. In case of failure the pointed to value is set to NULL.
urlresource to access
flagsflags which control how the resource indicated by url is to be opened
int_cban interrupt callback to be used at the protocols level
optionsA 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.
Returns
>= 0 in case of success, a negative value corresponding to an AVERROR code in case of failure
Examples
avio_http_serve_files.c.

Definition at line 491 of file avio.c.

Referenced by avio_open(), dash_init(), dump_attachment(), enc_stats_get_file(), find_sidx(), get_preset_file_2(), lavfi_read_header(), main(), of_add_attachments(), of_open(), open_url(), parse_manifest(), print_sdp(), process_client(), read_binary(), read_mfra(), and write_fragment().

◆ avio_open()

int avio_open ( AVIOContext **  s,
const char *  url,
int  flags 
)

Create and initialize a AVIOContext for accessing the resource indicated by url.

Note
When the resource indicated by url has been opened in read+write mode, the AVIOContext can be used only for writing.
Parameters
sUsed to return the pointer to the created AVIOContext. In case of failure the pointed to value is set to NULL.
urlresource to access
flagsflags 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
Examples
mux.c, qsv_decode.c, qsv_transcode.c, remux.c, transcode.c, transcode_aac.c, and vaapi_transcode.c.

Definition at line 497 of file avio.c.

Referenced by file_read(), fsync_init(), init(), main(), open_output_file(), read_graph(), and writer_open().

◆ retry_transfer_wrapper()

static int retry_transfer_wrapper ( URLContext h,
uint8_t *  buf,
const uint8_t *  cbuf,
int  size,
int  size_min,
int  read 
)
inlinestatic

Definition at line 503 of file avio.c.

Referenced by ffurl_read2(), ffurl_read_complete(), and ffurl_write2().

◆ ffurl_read2()

int ffurl_read2 ( void *  urlcontext,
uint8_t *  buf,
int  size 
)

Definition at line 548 of file avio.c.

Referenced by ffio_fdopen(), ffio_geturlcontext(), and ffurl_read().

◆ ffurl_read_complete()

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 557 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().

◆ ffurl_write2()

int ffurl_write2 ( void *  urlcontext,
const uint8_t *  buf,
int  size 
)

Definition at line 564 of file avio.c.

Referenced by ffio_fdopen(), and ffurl_write().

◆ ffurl_seek2()

int64_t ffurl_seek2 ( void *  urlcontext,
int64_t  pos,
int  whence 
)

Definition at line 577 of file avio.c.

Referenced by ffio_fdopen(), and ffurl_seek().

◆ ffurl_closep()

int ffurl_closep ( URLContext **  h)

◆ ffurl_close()

int ffurl_close ( URLContext h)

◆ avio_close()

int avio_close ( AVIOContext s)

Close the resource accessed by the AVIOContext s and free it.

This function can only be used if s was opened by avio_open().

The internal buffer is automatically flushed before closing the resource.

Returns
0 on success, an AVERROR < 0 on error.
See also
avio_closep
Examples
avio_http_serve_files.c, and qsv_decode.c.

Definition at line 616 of file avio.c.

Referenced by avformat_close_input(), avio_closep(), dash_free(), do_encrypt(), dump_attachment(), find_sidx(), import_pem(), io_close2_default(), main(), parse_manifest(), parse_playlist(), process_client(), read_binary(), read_mfra(), write_fragment(), and writer_close().

◆ avio_closep()

int avio_closep ( AVIOContext **  s)

Close the resource accessed by the AVIOContext *s, free it and set the pointer pointing to it to NULL.

This function can only be used if s was opened by avio_open().

The internal buffer is automatically flushed before closing the resource.

Returns
0 on success, an AVERROR < 0 on error.
See also
avio_close
Examples
mux.c, remux.c, transcode.c, and transcode_aac.c.

Definition at line 649 of file avio.c.

Referenced by avformat_open_input(), fc_close(), ff_rtp_chain_mux_open(), ff_rtsp_undo_setup(), ffio_fdopen(), file_read(), fsync_uninit(), lavfi_read_header(), main(), of_add_attachments(), of_enc_stats_close(), of_write_trailer(), open_output_file(), ost_add(), print_report(), print_sdp(), read_graph(), sap_write_close(), and uninit().

◆ avio_find_protocol_name()

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.

Returns
Name of the protocol or NULL.

Definition at line 657 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().

◆ avio_check()

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.

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.

Definition at line 664 of file avio.c.

Referenced by assert_file_overwrite(), and find_image_range().

◆ ffurl_move()

int ffurl_move ( const char *  url_src,
const char *  url_dst 
)

Move or rename a resource.

Note
url_src and url_dst should share the same protocol and authority.
Parameters
url_srcurl to resource to be moved
url_dstnew url to resource if the operation succeeded
Returns
>=0 on success or negative on error.

Definition at line 683 of file avio.c.

Referenced by ff_rename().

◆ ffurl_delete()

int ffurl_delete ( const char *  url)

Delete a resource.

Parameters
urlresource to be deleted.
Returns
>=0 on success or negative on error.

Definition at line 705 of file avio.c.

Referenced by dashenc_delete_file().

◆ avio_open_dir()

int avio_open_dir ( AVIODirContext **  s,
const char *  url,
AVDictionary **  options 
)

Open directory for reading.

Parameters
sdirectory read context. Pointer to a NULL pointer must be passed.
urldirectory to be listed.
optionsA 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.
Returns
>=0 on success or negative on error.
Examples
avio_list_dir.c.

Definition at line 725 of file avio.c.

Referenced by list_op().

◆ avio_read_dir()

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.

Parameters
sdirectory read context.
[out]nextnext entry or NULL when no more entries.
Returns
>=0 on success or negative on error. End of list is not considered an error.
Examples
avio_list_dir.c.

Definition at line 763 of file avio.c.

Referenced by list_op().

◆ avio_close_dir()

int avio_close_dir ( AVIODirContext **  s)

Close directory.

Note
Entries created using avio_read_dir() are not deleted and must be freeded with avio_free_directory_entry().
Parameters
sdirectory read context.
Returns
>=0 on success or negative on error.
Examples
avio_list_dir.c.

Definition at line 776 of file avio.c.

Referenced by list_op().

◆ avio_free_directory_entry()

void avio_free_directory_entry ( AVIODirEntry **  entry)

Free entry allocated by avio_read_dir().

Parameters
entryentry to be freed.
Examples
avio_list_dir.c.

Definition at line 791 of file avio.c.

Referenced by avio_read_dir(), ftp_read_dir(), and list_op().

◆ ffurl_size()

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 799 of file avio.c.

Referenced by async_open().

◆ ffurl_get_file_handle()

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 814 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().

◆ ffurl_get_multi_file_handle()

int ffurl_get_multi_file_handle ( URLContext h,
int **  handles,
int *  numhandles 
)

Return the file descriptors associated with this URL.

Returns
0 on success or <0 on error.

Definition at line 821 of file avio.c.

Referenced by srtp_get_multi_file_handle().

◆ ffurl_get_short_seek()

int ffurl_get_short_seek ( void *  urlcontext)

Return the current short seek threshold value for this URL.

Returns
threshold (>0) on success or <=0 on error.

Definition at line 838 of file avio.c.

Referenced by ffio_fdopen(), http_get_short_seek(), and tls_get_short_seek().

◆ ffurl_shutdown()

int ffurl_shutdown ( URLContext h,
int  flags 
)

Signal the URLContext that we are done reading or writing the stream.

Parameters
hpointer to the resource
flagsflags which control how the resource indicated by url is to be shutdown
Returns
a negative value if an error condition occurred, 0 otherwise

Definition at line 847 of file avio.c.

Referenced by dashenc_io_close(), ftp_shutdown(), and hlsenc_io_close().

◆ ff_check_interrupt()

int ff_check_interrupt ( AVIOInterruptCB cb)

◆ ff_rename()

int ff_rename ( const char *  url_src,
const char *  url_dst,
void *  logctx 
)

Wrap ffurl_move() and log if error happens.

Parameters
url_srcsource path
url_dstdestination path
Returns
0 or AVERROR on failure

Definition at line 861 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().

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{"protocol_whitelist", "List of protocols that are allowed to be used", OFFSET(protocol_whitelist), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D },
{"protocol_blacklist", "List of protocols that are not allowed to be used", OFFSET(protocol_blacklist), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D },
{"rw_timeout", "Timeout for IO operations (in microseconds)", 0x42, AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_DECODING_PARAM },
{ NULL }
}

Definition at line 60 of file avio.c.

Referenced by avio_open2(), avio_open_dir(), ffio_open_whitelist(), ffurl_connect(), and ffurl_open_whitelist().

◆ url_context_class

const AVClass url_context_class
static
Initial value:
= {
.class_name = "URLContext",
.item_name = urlcontext_to_name,
.option = options,
.child_next = urlcontext_child_next,
.child_class_iterate = ff_urlcontext_child_class_iterate,
}

Definition at line 67 of file avio.c.

Referenced by child_class_iterate(), and url_alloc_for_protocol().

◆ avio_options

const AVOption avio_options[]
static
Initial value:
= {
{"protocol_whitelist", "List of protocols that are allowed to be used", AVIOOFFSET(protocol_whitelist), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D },
{ NULL },
}

Definition at line 93 of file avio.c.

◆ ff_avio_class

const AVClass ff_avio_class
Initial value:
= {
.class_name = "AVIOContext",
.item_name = av_default_item_name,
.option = avio_options,
.child_next = avio_child_next,
.child_class_iterate = child_class_iterate,
}

Definition at line 98 of file avio.c.

Referenced by ffio_fdopen(), and format_child_class_iterate().

AVIOOFFSET
#define AVIOOFFSET(x)
Definition: avio.c:90
urlcontext_to_name
static const char * urlcontext_to_name(void *ptr)
Definition: avio.c:40
ff_urlcontext_child_class_iterate
const AVClass * ff_urlcontext_child_class_iterate(void **iter)
Definition: protocols.c:84
avio_options
static const AVOption avio_options[]
Definition: avio.c:93
AV_OPT_TYPE_INT64
@ AV_OPT_TYPE_INT64
Underlying C type is int64_t.
Definition: opt.h:263
avio_child_next
static void * avio_child_next(void *obj, void *prev)
Definition: avio.c:77
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
D
#define D
Definition: avio.c:92
NULL
#define NULL
Definition: coverity.c:32
urlcontext_child_next
static void * urlcontext_child_next(void *obj, void *prev)
Definition: avio.c:49
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
AV_OPT_FLAG_ENCODING_PARAM
#define AV_OPT_FLAG_ENCODING_PARAM
A generic parameter which can be set by the user for muxing or encoding.
Definition: opt.h:352
OFFSET
#define OFFSET(x)
Definition: avio.c:57
child_class_iterate
static const AVClass * child_class_iterate(void **iter)
Definition: avio.c:83
options
static const AVOption options[]
Definition: avio.c:60
AV_OPT_FLAG_DECODING_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
Definition: opt.h:356
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276