39 const char *authorization,
const char *hostname,
40 int port,
const char *fmt, ...)
49 if (authorization && authorization[0])
51 #if CONFIG_NETWORK && defined(AF_INET6) 56 if (ai->ai_family == AF_INET6) {
73 size_t len = strlen(str);
76 vsnprintf(str + len, size > len ? size - len : 0, fmt, vl);
82 static const char *
find_delim(
const char *delim,
const char *cur,
const char *
end)
84 while (cur < end && !strchr(delim, *cur))
91 const char *cur, *aend, *p;
95 end = url + strlen(url);
106 if (end - cur >= 2 && cur[0] ==
'/' && cur[1] ==
'/') {
122 if (p + 1 < aend && p[1] !=
':')
153 const char *
in,
const char *in_end)
156 const char *d, *next;
158 if (in < in_end && *in ==
'/')
160 while (in < in_end) {
162 next = d + (d < in_end && *d ==
'/');
163 if (d - in == 1 && in[0] ==
'.') {
165 }
else if (d - in == 2 && in[0] ==
'.' && in[1] ==
'.') {
168 while (out > root && (--out)[-1] !=
'/');
170 if (out_end - out < next - in)
172 memmove(out, in, next - in);
185 char *
out, *out_end, *path;
186 const char *keep, *base_path_end;
187 int use_base_path, simplify_path = 0,
ret;
210 out_end = buf + size - 1;
219 #define KEEP(component, also) do { \ 220 if (uc.url_component_end_##component == uc.url && \ 221 ub.url_component_end_##component > keep) { \ 222 keep = ub.url_component_end_##component; \ 227 KEEP(authority_full, simplify_path = 1;);
232 #define COPY(start, end) do { \ 233 size_t len = end - start; \ 234 if (len > out_end - out) { \ 235 ret = AVERROR(ENOMEM); \ 238 memmove(out, start, len); \ 250 base_path_end = ub.url_component_end_path;
252 while (base_path_end > ub.
path && base_path_end[-1] !=
'/')
266 const char *root =
"/";
267 COPY(root, root + 1);
282 COPY(uc.
path, uc.url_component_end_path);
285 COPY(uc.url_component_end_path, uc.
end);
293 ret ==
AVERROR(EINVAL) ?
"syntax_error" :
"");
int ff_url_decompose(URLComponents *uc, const char *url, const char *end)
Parse an URL to find the components.
#define URL_COMPONENT_HAVE(uc, component)
int64_t filemode
Unix file mode, -1 if unknown.
const char * url
whole URL, for reference
Describes single entry of the directory.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static void error(const char *err)
static const char * find_delim(const char *delim, const char *cur, const char *end)
int64_t modification_timestamp
Time of last modification in microseconds since unix epoch, -1 if unknown.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static av_cold int end(AVCodecContext *avctx)
simple assert() macros that are a bit more flexible than ISO C assert().
const char * userinfo
including final '@' if present
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
const char * authority
"//" if it is a real URL
const char * query
including initial '?' if present
int64_t access_timestamp
Time of last access in microseconds since unix epoch, -1 if unknown.
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.
int64_t size
File size in bytes, -1 if unknown.
int ff_url_join(char *str, int size, const char *proto, const char *authorization, const char *hostname, int port, const char *fmt,...)
int type
Type of the entry.
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31))))#define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac){}void ff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map){AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);return NULL;}return ac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;}int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){int use_generic=1;int len=in->nb_samples;int p;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
int64_t group_id
Group ID of owner, -1 if unknown.
const char * port
including initial ':' if present
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
size_t av_strlcat(char *dst, const char *src, size_t size)
Append the string src to the string dst, but to a total length of no more than size - 1 bytes...
static int append_path(char *root, char *out_end, char **rout, const char *in, const char *in_end)
const char * scheme
possibly including lavf-specific options
int64_t status_change_timestamp
Time of last status change in microseconds since unix epoch, -1 if unknown.
AVIODirEntry * ff_alloc_dir_entry(void)
Allocate directory entry with default values.
int64_t user_id
User ID of owner, -1 if unknown.
unbuffered private I/O API
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
const char * fragment
including initial '#' if present
#define KEEP(component, also)