diff mbox

[FFmpeg-devel] avformat/tls: add tls url_get_file_handle

Message ID 1476628101-46884-1-git-send-email-jayridge@gmail.com
State Accepted
Commit 295601bba3023b14264fcfee64e7a386cd7753cd
Headers show

Commit Message

Jay Oct. 16, 2016, 2:28 p.m. UTC
From: Jay Ridgeway <jayridge@gmail.com>

Support url_get_file_handle on TLS streams.
---
 libavformat/tls_gnutls.c          | 7 +++++++
 libavformat/tls_openssl.c         | 7 +++++++
 libavformat/tls_schannel.c        | 7 +++++++
 libavformat/tls_securetransport.c | 7 +++++++
 4 files changed, 28 insertions(+)

Comments

Michael Niedermayer Dec. 17, 2016, 7:17 p.m. UTC | #1
On Sun, Oct 16, 2016 at 10:28:21AM -0400, jayridge@gmail.com wrote:
> From: Jay Ridgeway <jayridge@gmail.com>
> 
> Support url_get_file_handle on TLS streams.
> ---
>  libavformat/tls_gnutls.c          | 7 +++++++
>  libavformat/tls_openssl.c         | 7 +++++++
>  libavformat/tls_schannel.c        | 7 +++++++
>  libavformat/tls_securetransport.c | 7 +++++++
>  4 files changed, 28 insertions(+)

applied

thx

[...]
wm4 Dec. 18, 2016, 12:01 p.m. UTC | #2
On Sat, 17 Dec 2016 20:17:54 +0100
Michael Niedermayer <michael@niedermayer.cc> wrote:

> On Sun, Oct 16, 2016 at 10:28:21AM -0400, jayridge@gmail.com wrote:
> > From: Jay Ridgeway <jayridge@gmail.com>
> > 
> > Support url_get_file_handle on TLS streams.
> > ---
> >  libavformat/tls_gnutls.c          | 7 +++++++
> >  libavformat/tls_openssl.c         | 7 +++++++
> >  libavformat/tls_schannel.c        | 7 +++++++
> >  libavformat/tls_securetransport.c | 7 +++++++
> >  4 files changed, 28 insertions(+)  
> 
> applied
> 
> thx
> 
> [...]

What is this even supposed to be useful for???
wm4 Dec. 18, 2016, 12:07 p.m. UTC | #3
On Sat, 17 Dec 2016 20:17:54 +0100
Michael Niedermayer <michael@niedermayer.cc> wrote:

> On Sun, Oct 16, 2016 at 10:28:21AM -0400, jayridge@gmail.com wrote:
> > From: Jay Ridgeway <jayridge@gmail.com>
> > 
> > Support url_get_file_handle on TLS streams.
> > ---
> >  libavformat/tls_gnutls.c          | 7 +++++++
> >  libavformat/tls_openssl.c         | 7 +++++++
> >  libavformat/tls_schannel.c        | 7 +++++++
> >  libavformat/tls_securetransport.c | 7 +++++++
> >  4 files changed, 28 insertions(+)  
> 
> applied
> 
> thx
> 
> [...]

What is this even supposed to be useful for???
diff mbox

Patch

diff --git a/libavformat/tls_gnutls.c b/libavformat/tls_gnutls.c
index 991b36b..ecc80bf 100644
--- a/libavformat/tls_gnutls.c
+++ b/libavformat/tls_gnutls.c
@@ -235,6 +235,12 @@  static int tls_write(URLContext *h, const uint8_t *buf, int size)
     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[] = {
     TLS_COMMON_OPTIONS(TLSContext, tls_shared),
     { NULL }
@@ -253,6 +259,7 @@  const URLProtocol ff_tls_gnutls_protocol = {
     .url_read       = tls_read,
     .url_write      = tls_write,
     .url_close      = tls_close,
+    .url_get_file_handle = tls_get_file_handle,
     .priv_data_size = sizeof(TLSContext),
     .flags          = URL_PROTOCOL_FLAG_NETWORK,
     .priv_data_class = &tls_class,
diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
index 46eb3e6..1455392 100644
--- a/libavformat/tls_openssl.c
+++ b/libavformat/tls_openssl.c
@@ -283,6 +283,12 @@  static int tls_write(URLContext *h, const uint8_t *buf, int size)
     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[] = {
     TLS_COMMON_OPTIONS(TLSContext, tls_shared),
     { NULL }
@@ -301,6 +307,7 @@  const URLProtocol ff_tls_openssl_protocol = {
     .url_read       = tls_read,
     .url_write      = tls_write,
     .url_close      = tls_close,
+    .url_get_file_handle = tls_get_file_handle,
     .priv_data_size = sizeof(TLSContext),
     .flags          = URL_PROTOCOL_FLAG_NETWORK,
     .priv_data_class = &tls_class,
diff --git a/libavformat/tls_schannel.c b/libavformat/tls_schannel.c
index c11b7d4..065dccb 100644
--- a/libavformat/tls_schannel.c
+++ b/libavformat/tls_schannel.c
@@ -577,6 +577,12 @@  done:
     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[] = {
     TLS_COMMON_OPTIONS(TLSContext, tls_shared),
     { NULL }
@@ -595,6 +601,7 @@  const URLProtocol ff_tls_schannel_protocol = {
     .url_read       = tls_read,
     .url_write      = tls_write,
     .url_close      = tls_close,
+    .url_get_file_handle = tls_get_file_handle,
     .priv_data_size = sizeof(TLSContext),
     .flags          = URL_PROTOCOL_FLAG_NETWORK,
     .priv_data_class = &tls_class,
diff --git a/libavformat/tls_securetransport.c b/libavformat/tls_securetransport.c
index 253c89c..bc8a320 100644
--- a/libavformat/tls_securetransport.c
+++ b/libavformat/tls_securetransport.c
@@ -375,6 +375,12 @@  static int tls_write(URLContext *h, const uint8_t *buf, int size)
     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[] = {
     TLS_COMMON_OPTIONS(TLSContext, tls_shared),
     { NULL }
@@ -393,6 +399,7 @@  const URLProtocol ff_tls_securetransport_protocol = {
     .url_read       = tls_read,
     .url_write      = tls_write,
     .url_close      = tls_close,
+    .url_get_file_handle = tls_get_file_handle,
     .priv_data_size = sizeof(TLSContext),
     .flags          = URL_PROTOCOL_FLAG_NETWORK,
     .priv_data_class = &tls_class,