Commit 295601bb authored by Jay Ridgeway's avatar Jay Ridgeway Committed by Michael Niedermayer

avformat/tls: add tls url_get_file_handle

Support url_get_file_handle on TLS streams.
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 6b517a19
...@@ -235,6 +235,12 @@ static int tls_write(URLContext *h, const uint8_t *buf, int size) ...@@ -235,6 +235,12 @@ static int tls_write(URLContext *h, const uint8_t *buf, int size)
return print_tls_error(h, ret); return print_tls_error(h, ret);
} }
static int tls_get_file_handle(URLContext *h)
{
TLSContext *c = h->priv_data;
return ffurl_get_file_handle(c->tls_shared.tcp);
}
static const AVOption options[] = { static const AVOption options[] = {
TLS_COMMON_OPTIONS(TLSContext, tls_shared), TLS_COMMON_OPTIONS(TLSContext, tls_shared),
{ NULL } { NULL }
...@@ -253,6 +259,7 @@ const URLProtocol ff_tls_gnutls_protocol = { ...@@ -253,6 +259,7 @@ const URLProtocol ff_tls_gnutls_protocol = {
.url_read = tls_read, .url_read = tls_read,
.url_write = tls_write, .url_write = tls_write,
.url_close = tls_close, .url_close = tls_close,
.url_get_file_handle = tls_get_file_handle,
.priv_data_size = sizeof(TLSContext), .priv_data_size = sizeof(TLSContext),
.flags = URL_PROTOCOL_FLAG_NETWORK, .flags = URL_PROTOCOL_FLAG_NETWORK,
.priv_data_class = &tls_class, .priv_data_class = &tls_class,
......
...@@ -325,6 +325,12 @@ static int tls_write(URLContext *h, const uint8_t *buf, int size) ...@@ -325,6 +325,12 @@ static int tls_write(URLContext *h, const uint8_t *buf, int size)
return print_tls_error(h, ret); return print_tls_error(h, ret);
} }
static int tls_get_file_handle(URLContext *h)
{
TLSContext *c = h->priv_data;
return ffurl_get_file_handle(c->tls_shared.tcp);
}
static const AVOption options[] = { static const AVOption options[] = {
TLS_COMMON_OPTIONS(TLSContext, tls_shared), TLS_COMMON_OPTIONS(TLSContext, tls_shared),
{ NULL } { NULL }
...@@ -343,6 +349,7 @@ const URLProtocol ff_tls_openssl_protocol = { ...@@ -343,6 +349,7 @@ const URLProtocol ff_tls_openssl_protocol = {
.url_read = tls_read, .url_read = tls_read,
.url_write = tls_write, .url_write = tls_write,
.url_close = tls_close, .url_close = tls_close,
.url_get_file_handle = tls_get_file_handle,
.priv_data_size = sizeof(TLSContext), .priv_data_size = sizeof(TLSContext),
.flags = URL_PROTOCOL_FLAG_NETWORK, .flags = URL_PROTOCOL_FLAG_NETWORK,
.priv_data_class = &tls_class, .priv_data_class = &tls_class,
......
...@@ -577,6 +577,12 @@ done: ...@@ -577,6 +577,12 @@ done:
return ret < 0 ? ret : outbuf[1].cbBuffer; return ret < 0 ? ret : outbuf[1].cbBuffer;
} }
static int tls_get_file_handle(URLContext *h)
{
TLSContext *c = h->priv_data;
return ffurl_get_file_handle(c->tls_shared.tcp);
}
static const AVOption options[] = { static const AVOption options[] = {
TLS_COMMON_OPTIONS(TLSContext, tls_shared), TLS_COMMON_OPTIONS(TLSContext, tls_shared),
{ NULL } { NULL }
...@@ -595,6 +601,7 @@ const URLProtocol ff_tls_schannel_protocol = { ...@@ -595,6 +601,7 @@ const URLProtocol ff_tls_schannel_protocol = {
.url_read = tls_read, .url_read = tls_read,
.url_write = tls_write, .url_write = tls_write,
.url_close = tls_close, .url_close = tls_close,
.url_get_file_handle = tls_get_file_handle,
.priv_data_size = sizeof(TLSContext), .priv_data_size = sizeof(TLSContext),
.flags = URL_PROTOCOL_FLAG_NETWORK, .flags = URL_PROTOCOL_FLAG_NETWORK,
.priv_data_class = &tls_class, .priv_data_class = &tls_class,
......
...@@ -375,6 +375,12 @@ static int tls_write(URLContext *h, const uint8_t *buf, int size) ...@@ -375,6 +375,12 @@ static int tls_write(URLContext *h, const uint8_t *buf, int size)
return print_tls_error(h, ret); return print_tls_error(h, ret);
} }
static int tls_get_file_handle(URLContext *h)
{
TLSContext *c = h->priv_data;
return ffurl_get_file_handle(c->tls_shared.tcp);
}
static const AVOption options[] = { static const AVOption options[] = {
TLS_COMMON_OPTIONS(TLSContext, tls_shared), TLS_COMMON_OPTIONS(TLSContext, tls_shared),
{ NULL } { NULL }
...@@ -393,6 +399,7 @@ const URLProtocol ff_tls_securetransport_protocol = { ...@@ -393,6 +399,7 @@ const URLProtocol ff_tls_securetransport_protocol = {
.url_read = tls_read, .url_read = tls_read,
.url_write = tls_write, .url_write = tls_write,
.url_close = tls_close, .url_close = tls_close,
.url_get_file_handle = tls_get_file_handle,
.priv_data_size = sizeof(TLSContext), .priv_data_size = sizeof(TLSContext),
.flags = URL_PROTOCOL_FLAG_NETWORK, .flags = URL_PROTOCOL_FLAG_NETWORK,
.priv_data_class = &tls_class, .priv_data_class = &tls_class,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment