MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / gopher_open

Function gopher_open

libavformat/gopher.c:82–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82static int gopher_open(URLContext *h, const char *uri, int flags)
83{
84 GopherContext *s = h->priv_data;
85 char proto[10], hostname[1024], auth[1024], path[1024], buf[1024];
86 int port, err;
87 const char *lower_proto = "tcp";
88
89 h->is_streamed = 1;
90
91 /* needed in any case to build the host string */
92 av_url_split(proto, sizeof(proto), auth, sizeof(auth),
93 hostname, sizeof(hostname), &port, path, sizeof(path), uri);
94
95 if (port < 0)
96 port = 70;
97
98 if (!strcmp(proto, "gophers"))
99 lower_proto = "tls";
100
101 ff_url_join(buf, sizeof(buf), lower_proto, NULL, hostname, port, NULL);
102
103 s->hd = NULL;
104 err = ffurl_open_whitelist(&s->hd, buf, AVIO_FLAG_READ_WRITE,
105 &h->interrupt_callback, NULL, h->protocol_whitelist, h->protocol_blacklist, h);
106 if (err < 0)
107 goto fail;
108
109 if ((err = gopher_connect(h, path)) < 0)
110 goto fail;
111 return 0;
112 fail:
113 gopher_close(h);
114 return err;
115}
116
117static int gopher_read(URLContext *h, uint8_t *buf, int size)
118{

Callers

nothing calls this directly

Calls 5

av_url_splitFunction · 0.85
ff_url_joinFunction · 0.85
ffurl_open_whitelistFunction · 0.85
gopher_connectFunction · 0.85
gopher_closeFunction · 0.85

Tested by

no test coverage detected