@@ -349,6 +349,12 @@ typedef struct AVIOContext {
* Try to buffer at least this amount of data before flushing it
*/
int min_packet_size;
+
+ /**
+ * Make a new request on the underlying http connection.
+ * This is internal only, do not use from outside.
+ */
+ int (*new_http_request)(struct AVIOContext *pb, const char *uri);
} AVIOContext;
/**
@@ -922,6 +922,14 @@ static int64_t io_read_seek(void *opaque, int stream_index, int64_t timestamp, i
return internal->h->prot->url_read_seek(internal->h, stream_index, timestamp, flags);
}
+static int io_new_http_request(AVIOContext *s, const char *uri)
+{
+ URLContext *uc = ffio_geturlcontext(s);
+ if (!uc)
+ return AVERROR(ENOSYS);
+ return uc->prot->url_new_http_request(uc, uri);
+}
+
int ffio_fdopen(AVIOContext **s, URLContext *h)
{
AVIOInternal *internal = NULL;
@@ -970,6 +978,8 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
if (h->prot->url_read_seek)
(*s)->seekable |= AVIO_SEEKABLE_TIME;
+ if (h->prot->url_new_http_request)
+ (*s)->new_http_request = io_new_http_request;
}
(*s)->short_seek_get = io_short_seek;
(*s)->av_class = &ff_avio_class;
@@ -1712,6 +1712,7 @@ const URLProtocol ff_http_protocol = {
.url_write = http_write,
.url_seek = http_seek,
.url_close = http_close,
+ .url_new_http_request= ff_http_do_new_request,
.url_get_file_handle = http_get_file_handle,
.url_get_short_seek = http_get_short_seek,
.url_shutdown = http_shutdown,
@@ -1732,6 +1733,7 @@ const URLProtocol ff_https_protocol = {
.url_write = http_write,
.url_seek = http_seek,
.url_close = http_close,
+ .url_new_http_request= ff_http_do_new_request,
.url_get_file_handle = http_get_file_handle,
.url_get_short_seek = http_get_short_seek,
.url_shutdown = http_shutdown,
@@ -62,6 +62,7 @@ typedef struct URLProtocol {
int (*url_open2)(URLContext *h, const char *url, int flags, AVDictionary **options);
int (*url_accept)(URLContext *s, URLContext **c);
int (*url_handshake)(URLContext *c);
+ int (*url_new_http_request)(URLContext *h, const char *uri);
/**
* Read data from the protocol.