FFmpeg  4.3.7
Macros | Functions
url.c File Reference

URL utility functions. More...

#include "avformat.h"
#include "internal.h"
#include "config.h"
#include "url.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"

Go to the source code of this file.

Macros

#define KEEP(component, also)
 
#define COPY(start, end)
 

Functions

int ff_url_join (char *str, int size, const char *proto, const char *authorization, const char *hostname, int port, const char *fmt,...)
 
static const char * find_delim (const char *delim, const char *cur, const char *end)
 
int ff_url_decompose (URLComponents *uc, const char *url, const char *end)
 Parse an URL to find the components. More...
 
static int is_fq_dos_path (const char *path)
 
static int append_path (char *root, char *out_end, char **rout, const char *in, const char *in_end)
 
int ff_make_absolute_url2 (char *buf, int size, const char *base, const char *rel, int handle_dos_paths)
 Convert a relative url into an absolute url, given a base url. More...
 
int 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...
 
AVIODirEntryff_alloc_dir_entry (void)
 Allocate directory entry with default values. More...
 

Detailed Description

URL utility functions.

Definition in file url.c.

Macro Definition Documentation

◆ KEEP

#define KEEP (   component,
  also 
)
Value:
do { \
if (uc.url_component_end_##component == uc.url && \
ub.url_component_end_##component > keep) { \
keep = ub.url_component_end_##component; \
also \
} \
} while (0)
#define ub(width, name)
Definition: cbs_h2645.c:264

Referenced by ff_make_absolute_url2().

◆ COPY

#define COPY (   start,
  end 
)
Value:
do { \
size_t len = end - start; \
if (len > out_end - out) { \
ret = AVERROR(ENOMEM); \
goto error; \
} \
memmove(out, start, len); \
out += len; \
} while (0)
static void error(const char *err)
static av_cold int end(AVCodecContext *avctx)
Definition: avrndec.c:92
#define AVERROR(e)
Definition: error.h:43
int len
FILE * out
Definition: movenc.c:54

Referenced by ff_make_absolute_url2().

Function Documentation

◆ ff_url_join()

int ff_url_join ( char *  str,
int  size,
const char *  proto,
const char *  authorization,
const char *  hostname,
int  port,
const char *  fmt,
  ... 
)

◆ find_delim()

static const char* find_delim ( const char *  delim,
const char *  cur,
const char *  end 
)
static

Definition at line 82 of file url.c.

Referenced by append_path(), and ff_url_decompose().

◆ ff_url_decompose()

int ff_url_decompose ( URLComponents uc,
const char *  url,
const char *  end 
)

Parse an URL to find the components.

Each component runs until the start of the next component, possibly including a mandatory delimiter.

Parameters
ucstructure to fill with pointers to the components.
urlURL to parse.
endend of the URL, or NULL to parse to the end of string.
Returns
>= 0 for success or an AVERROR code, especially if the URL is malformed.

Definition at line 89 of file url.c.

Referenced by ff_make_absolute_url2(), and test_decompose().

◆ is_fq_dos_path()

static int is_fq_dos_path ( const char *  path)
static

Definition at line 152 of file url.c.

Referenced by ff_make_absolute_url2().

◆ append_path()

static int append_path ( char *  root,
char *  out_end,
char **  rout,
const char *  in,
const char *  in_end 
)
static

Definition at line 164 of file url.c.

Referenced by ff_make_absolute_url2().

◆ ff_make_absolute_url2()

int ff_make_absolute_url2 ( char *  buf,
int  size,
const char *  base,
const char *  rel,
int  handle_dos_paths 
)

Convert a relative url into an absolute url, given a base url.

Parameters
bufthe buffer where output absolute url is written
sizethe size of buf
basethe base url, may be equal to buf.
relthe new url, which is interpreted relative to base
handle_dos_pathshandle DOS paths for file or unspecified protocol

Definition at line 193 of file url.c.

Referenced by ff_make_absolute_url(), and test().

◆ ff_make_absolute_url()

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

Same as ff_make_absolute_url2 with handle_dos_paths being equal to HAVE_DOS_PATHS config variable.

Definition at line 319 of file url.c.

Referenced by add_file(), get_content_url(), new_init_section(), new_playlist(), open_input(), parse_location(), parse_playlist(), and test().

◆ ff_alloc_dir_entry()

AVIODirEntry* ff_alloc_dir_entry ( void  )

Allocate directory entry with default values.

Returns
entry or NULL on error

Definition at line 325 of file url.c.

Referenced by file_move(), ftp_read_dir(), libsmbc_read_dir(), and libssh_read_dir().