History

avformat/http: add ff_http_do_new_request2 for options

add ff_http_do_new_request2() which supports options to be applied to HTTPContext after initialisation with the new uri

vectronic committed 7 years ago

Commit e81c6861 parent afab93c2 files · +20 −1Browse files

Unified · Split

2 files
  1. libavformat/http.c +7 −1
  2. libavformat/http.h +13 −0
libavformat/http.c+7−1
@@ -320,8 +320,11 @@ int ff_http_get_shutdown_status(URLContext *h) · 319 unmodified lines
320320 return ret;
321321 }
322322
323+int ff_http_do_new_request(URLContext *h, const char *uri) {
324+ return ff_http_do_new_request2(h, uri, NULL);
325+}
323326
324−int ff_http_do_new_request(URLContext *h, const char *uri)
327+int ff_http_do_new_request2(URLContext *h, const char *uri, AVDictionary **opts)
325328 {
326329 HTTPContext *s = h->priv_data;
327330 AVDictionary *options = NULL;
@@ -366,6 +369,9 @@ int ff_http_do_new_request(URLContext *h, const char *uri) · 38 unmodified lines
366369 if (!s->location)
367370 return AVERROR(ENOMEM);
368371
372+ if ((ret = av_opt_set_dict(s, opts)) < 0)
373+ return ret;
374+
369375 av_log(s, AV_LOG_INFO, "Opening \'%s\' for %s\n", uri, h->flags & AVIO_FLAG_WRITE ? "writing" : "reading");
370376 ret = http_open_cnx(h, &options);
371377 av_dict_free(&options);
libavformat/http.h+13−0
@@ -56,6 +56,19 @@ int ff_http_get_shutdown_status(URLContext *h); · 55 unmodified lines
5656 */
5757 int ff_http_do_new_request(URLContext *h, const char *uri);
5858
59+/**
60+ * Send a new HTTP request, reusing the old connection.
61+ *
62+ * @param h pointer to the resource
63+ * @param uri uri used to perform the request
64+ * @param options A dictionary filled with HTTP options. On return
65+ * this parameter will be destroyed and replaced with a dict containing options
66+ * that were not found. May be NULL.
67+ * @return a negative value if an error condition occurred, 0
68+ * otherwise
69+ */
70+int ff_http_do_new_request2(URLContext *h, const char *uri, AVDictionary **options);
71+
5972 int ff_http_averror(int status_code, int default_averror);
6073
6174 #endif /* AVFORMAT_HTTP_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t