29 #define AV_CAT_SEPARATOR "|"
49 for (i = 0; i != data->
length; i++)
54 return err < 0 ? -1 : 0;
59 char *node_uri =
NULL, *tmp_uri;
69 for (i = 0, len = 1; uri[i]; i++)
72 if (++len == UINT_MAX /
sizeof(*nodes)) {
77 if (!(nodes =
av_malloc(
sizeof(*nodes) * len))) {
85 for (i = 0; *uri; i++) {
88 if (!(tmp_uri =
av_realloc(node_uri, len+1))) {
127 int result, total = 0;
135 return total ? total : result;
137 if (i + 1 == data->
length ||
157 for (i = data->
length - 1;
158 i && pos < -nodes[i].
size;
160 pos += nodes[i].
size;
164 for (i = 0; i != data->
current; i++)
165 pos += nodes[i].
size;
170 for (i = 0; i != data->
length - 1 && pos >= nodes[i].
size; i++)
171 pos -= nodes[i].
size;
181 result += nodes[--i].
size;
static av_cold int concat_close(URLContext *h)
memory handling functions
AVIOInterruptCB interrupt_callback
size_t length
number of cat'ed nodes
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
struct concat_nodes * nodes
list of nodes to concat
static int concat_read(URLContext *h, unsigned char *buf, int size)
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
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.
static int64_t concat_seek(URLContext *h, int64_t pos, int whence)
int64_t ffurl_size(URLContext *h)
Return the filesize of the resource accessed by h, AVERROR(ENOSYS) if the operation is not supported ...
static av_cold int concat_open(URLContext *h, const char *uri, int flags)
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int ffurl_close(URLContext *h)
Close the resource accessed by the URLContext h, and free the memory used by it.
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
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...
int ffurl_open(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Create an URLContext for accessing to the resource indicated by url, and open it. ...
size_t current
index of currently read node
unbuffered private I/O API
URLProtocol ff_concat_protocol
int ffurl_read(URLContext *h, unsigned char *buf, int size)
Read up to size bytes from the resource accessed by h, and store the read bytes in buf...
URLContext * uc
node's URLContext