26#include "config_components.h"
37#define AV_CAT_SEPARATOR "|"
58 for (
i = 0;
i !=
data->length;
i++)
63 return err < 0 ? -1 : 0;
66#if CONFIG_CONCAT_PROTOCOL
69 char *node_uri =
NULL;
82 for (
i = 0,
len = 1; uri[
i];
i++) {
96 for (
i = 0; *uri;
i++) {
106 &
h->interrupt_callback,
NULL,
h->protocol_whitelist,
h->protocol_blacklist,
h);
117 if (total_size > INT64_MAX -
size) {
133 else if (!(nodes =
av_realloc(nodes,
data->length *
sizeof(*nodes)))) {
138 data->total_size = total_size;
145 int result, total = 0;
148 size_t i =
data->current;
153 if (
i + 1 ==
data->length ||
159 return total ? total : result;
165 return total ? total : result;
176 return data->total_size;
184 for (
i = 0;
i !=
data->current;
i++)
202 result += nodes[--
i].
size;
207#if CONFIG_CONCAT_PROTOCOL
210 .url_open = concat_open,
215 .default_whitelist =
"concat,file,subfile",
219#if CONFIG_CONCATF_PROTOCOL
227 unsigned int nodes_size = 0;
241 NULL,
h->protocol_whitelist,
h->protocol_blacklist);
260 int leading_spaces = strspn(cursor,
" \n\t\r");
262 if (!cursor[leading_spaces])
273 if (++
len == SIZE_MAX /
sizeof(*nodes)) {
281 &
h->interrupt_callback,
NULL,
h->protocol_whitelist,
h->protocol_blacklist,
h);
293 if (total_size > INT64_MAX -
size) {
320 data->total_size = total_size;
326 .url_open = concatf_open,
331 .default_whitelist =
"concatf,concat,file,subfile",
int ffio_open_whitelist(AVIOContext **s, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options, const char *whitelist, const char *blacklist)
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.
int64_t ffurl_size(URLContext *h)
Return the filesize of the resource accessed by h, AVERROR(ENOSYS) if the operation is not supported ...
int ffurl_closep(URLContext **hh)
Close the resource accessed by the URLContext h, and free the memory used by it.
int ffurl_close(URLContext *h)
int avio_closep(AVIOContext **s)
Close the resource accessed by the AVIOContext *s, free it and set the pointer pointing to it to NULL...
#define AVIO_FLAG_READ
read-only
#define AVSEEK_SIZE
Passing this as the "whence" parameter to a seek function causes it to return the filesize without se...
int avio_read_to_bprint(AVIOContext *h, struct AVBPrint *pb, size_t max_size)
Read contents of h into print buffer, up to max_size bytes, or up to EOF.
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define AV_BPRINT_SIZE_UNLIMITED
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
static int concat_read(URLContext *h, unsigned char *buf, int size)
static av_cold int concat_close(URLContext *h)
static int64_t concat_seek(URLContext *h, int64_t pos, int whence)
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AVERROR_EOF
End of file.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given buffer if it is not large enough, otherwise do nothing.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
char * av_get_token(const char **buf, const char *term)
Unescape the given string until a non escaped terminating char, and return the token corresponding to...
Macro definitions for various function/variable attributes.
Memory handling functions.
const URLProtocol ff_concatf_protocol
const URLProtocol ff_concat_protocol
size_t length
number of cat'ed nodes
size_t current
index of currently read node
struct concat_nodes * nodes
list of nodes to concat
URLContext * uc
node's URLContext
unbuffered private I/O API
static 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.
static int ffurl_read(URLContext *h, uint8_t *buf, int size)
Read up to size bytes from the resource accessed by h, and store the read bytes in buf.