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
320 return ret;320 return ret;
321}321}
322 322
323int ff_http_do_new_request(URLContext *h, const char *uri) {
324 return ff_http_do_new_request2(h, uri, NULL);
325}
323 326
324int ff_http_do_new_request(URLContext *h, const char *uri)327int ff_http_do_new_request2(URLContext *h, const char *uri, AVDictionary **opts)
325{328{
326 HTTPContext *s = h->priv_data;329 HTTPContext *s = h->priv_data;
327 AVDictionary *options = NULL;330 AVDictionary *options = NULL;
@@ -366,6 +369,9 @@ int ff_http_do_new_request(URLContext *h, const char *uri) · 38 unmodified lines
366 if (!s->location)369 if (!s->location)
367 return AVERROR(ENOMEM);370 return AVERROR(ENOMEM);
368 371
372 if ((ret = av_opt_set_dict(s, opts)) < 0)
373 return ret;
374
369 av_log(s, AV_LOG_INFO, "Opening \'%s\' for %s\n", uri, h->flags & AVIO_FLAG_WRITE ? "writing" : "reading");375 av_log(s, AV_LOG_INFO, "Opening \'%s\' for %s\n", uri, h->flags & AVIO_FLAG_WRITE ? "writing" : "reading");
370 ret = http_open_cnx(h, &options);376 ret = http_open_cnx(h, &options);
371 av_dict_free(&options);377 av_dict_free(&options);
libavformat/http.h+13−0
@@ -56,6 +56,19 @@ int ff_http_get_shutdown_status(URLContext *h); · 55 unmodified lines
56 */56 */
57int ff_http_do_new_request(URLContext *h, const char *uri);57int ff_http_do_new_request(URLContext *h, const char *uri);
58 58
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 */
70int ff_http_do_new_request2(URLContext *h, const char *uri, AVDictionary **options);
71
59int ff_http_averror(int status_code, int default_averror);72int ff_http_averror(int status_code, int default_averror);
60 73
61#endif /* AVFORMAT_HTTP_H */74#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