X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fconcat.c;h=f97354c7884514fbf604ceacf456c9d79e1d89e9;hb=8f0768cc22788357f603695b86f5e9013652bba6;hp=ba1b6a544a626b85c95f02c14aee654635cbefe0;hpb=d8cab5c26b0987f139830937e1f30b2a10822680;p=ffmpeg diff --git a/libavformat/concat.c b/libavformat/concat.c index ba1b6a544a6..f97354c7884 100644 --- a/libavformat/concat.c +++ b/libavformat/concat.c @@ -50,7 +50,6 @@ static av_cold int concat_close(URLContext *h) err |= ffurl_close(nodes[i].uc); av_freep(&data->nodes); - av_freep(&h->priv_data); return err < 0 ? -1 : 0; } @@ -62,16 +61,11 @@ static av_cold int concat_open(URLContext *h, const char *uri, int flags) int64_t size; size_t len, i; URLContext *uc; - struct concat_data *data; + struct concat_data *data = h->priv_data; struct concat_nodes *nodes; av_strstart(uri, "concat:", &uri); - /* creating data */ - if (!(data = av_mallocz(sizeof(*data)))) - return AVERROR(ENOMEM); - h->priv_data = data; - for (i = 0, len = 1; uri[i]; i++) if (uri[i] == *AV_CAT_SEPARATOR) /* integer overflow */ @@ -81,7 +75,6 @@ static av_cold int concat_open(URLContext *h, const char *uri, int flags) } if (!(nodes = av_malloc(sizeof(*nodes) * len))) { - av_freep(&h->priv_data); return AVERROR(ENOMEM); } else data->nodes = nodes; @@ -101,7 +94,8 @@ static av_cold int concat_open(URLContext *h, const char *uri, int flags) uri += len + strspn(uri+len, AV_CAT_SEPARATOR); /* creating URLContext */ - if ((err = ffurl_open(&uc, node_uri, flags)) < 0) + if ((err = ffurl_open(&uc, node_uri, flags, + &h->interrupt_callback, NULL)) < 0) break; /* creating size */ @@ -190,9 +184,10 @@ static int64_t concat_seek(URLContext *h, int64_t pos, int whence) } URLProtocol ff_concat_protocol = { - .name = "concat", - .url_open = concat_open, - .url_read = concat_read, - .url_seek = concat_seek, - .url_close = concat_close, + .name = "concat", + .url_open = concat_open, + .url_read = concat_read, + .url_seek = concat_seek, + .url_close = concat_close, + .priv_data_size = sizeof(struct concat_data), };