Re: [FFmpeg-devel] [PATCH 6/9] lavf/http: add http_accept

2015-07-09 Thread Stephan Holljes
On Thu, Jul 9, 2015 at 3:41 PM, Nicolas George geo...@nsup.org wrote:
 Le decadi 20 messidor, an CCXXIII, Stephan Holljes a écrit :
 Signed-off-by: Stephan Holljes klaxa1...@googlemail.com
 ---
  libavformat/http.c | 19 +++
  1 file changed, 19 insertions(+)

 Changes since first version:
   - Add av_assert0() check for sc-listen
   - Add bitmask for s-flags in ffurl_alloc

 Thanks.


 diff --git a/libavformat/http.c b/libavformat/http.c
 index 676bfd5..3c1ec35 100644
 --- a/libavformat/http.c
 +++ b/libavformat/http.c
 @@ -25,6 +25,7 @@
  #include zlib.h
  #endif /* CONFIG_ZLIB */

 +#include libavutil/avassert.h
  #include libavutil/avstring.h
  #include libavutil/opt.h

 @@ -382,6 +383,24 @@ static int http_open(URLContext *h, const char *uri, 
 int flags,
  return ret;
  }

 +static int http_accept(URLContext *s, URLContext **c)
 +{
 +int ret;
 +HTTPContext *sc = s-priv_data;
 +HTTPContext *cc;
 +URLContext *sl = sc-hd;
 +URLContext *cl;
 +av_assert0(sc-listen);

 +if ((ret = ffurl_alloc(c, s-filename, s-flags  AVIO_FLAG_READ_WRITE, 
 sl-interrupt_callback))  0)
 +goto fail;

 Same remark as in my previous mail.

 +cc = (*c)-priv_data;
 +if ((ret = ffurl_accept(sl, cl))  0)
 +goto fail;

 +cc-hd = cl;

 Does it make sense to set cc-listen = 1 here, to indicate that the client
 is not yet a normal client? It may make the tests for trailers simpler.

I am not sure about the implications. So far setting listen has been
exclusive to server contexts. I'll will give it some thoughts and do
some testing.


 +fail:
 +return ret;
 +}
 +
  static int http_getc(HTTPContext *s)
  {
  int len;

 Regards,

 --
   Nicolas George

 ___
 ffmpeg-devel mailing list
 ffmpeg-devel@ffmpeg.org
 http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 6/9] lavf/http: add http_accept

2015-07-08 Thread Stephan Holljes
Signed-off-by: Stephan Holljes klaxa1...@googlemail.com
---
 libavformat/http.c | 19 +++
 1 file changed, 19 insertions(+)
Changes since first version:
  - Add av_assert0() check for sc-listen
  - Add bitmask for s-flags in ffurl_alloc

diff --git a/libavformat/http.c b/libavformat/http.c
index 676bfd5..3c1ec35 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -25,6 +25,7 @@
 #include zlib.h
 #endif /* CONFIG_ZLIB */
 
+#include libavutil/avassert.h
 #include libavutil/avstring.h
 #include libavutil/opt.h
 
@@ -382,6 +383,24 @@ static int http_open(URLContext *h, const char *uri, int 
flags,
 return ret;
 }
 
+static int http_accept(URLContext *s, URLContext **c)
+{
+int ret;
+HTTPContext *sc = s-priv_data;
+HTTPContext *cc;
+URLContext *sl = sc-hd;
+URLContext *cl;
+av_assert0(sc-listen);
+if ((ret = ffurl_alloc(c, s-filename, s-flags  AVIO_FLAG_READ_WRITE, 
sl-interrupt_callback))  0)
+goto fail;
+cc = (*c)-priv_data;
+if ((ret = ffurl_accept(sl, cl))  0)
+goto fail;
+cc-hd = cl;
+fail:
+return ret;
+}
+
 static int http_getc(HTTPContext *s)
 {
 int len;
-- 
2.1.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 6/9] lavf/http: add http_accept

2015-07-03 Thread Nicolas George
Le quintidi 15 messidor, an CCXXIII, Stephan Holljes a écrit :
 Signed-off-by: Stephan Holljes klaxa1...@googlemail.com
 ---
  libavformat/http.c | 19 +++
  1 file changed, 19 insertions(+)
 
 diff --git a/libavformat/http.c b/libavformat/http.c
 index 676bfd5..d9c3624 100644
 --- a/libavformat/http.c
 +++ b/libavformat/http.c
 @@ -25,6 +25,7 @@
  #include zlib.h
  #endif /* CONFIG_ZLIB */
  
 +#include libavutil/avassert.h
  #include libavutil/avstring.h
  #include libavutil/opt.h
  
 @@ -382,6 +383,24 @@ static int http_open(URLContext *h, const char *uri, int 
 flags,
  return ret;
  }
  
 +static int http_accept(URLContext *s, URLContext **c)
 +{
 +int ret;
 +HTTPContext *sc = s-priv_data;
 +HTTPContext *cc;
 +URLContext *sl = sc-hd;
 +URLContext *cl;
 +av_assert0(sc-listen);

 +if ((ret = ffurl_alloc(c, s-filename, AVIO_FLAG_WRITE, 
 sl-interrupt_callback))  0)

Here too, I suspect c-flags should be used (possibly with some filtering)
instead of hardcoding the flags.

 +goto fail;
 +cc = (*c)-priv_data;
 +if ((ret = ffurl_accept(sl, cl))  0)
 +goto fail;
 +cc-hd = cl;
 +fail:
 +return ret;
 +}
 +
  static int http_getc(HTTPContext *s)
  {
  int len;

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 6/9] lavf/http: add http_accept

2015-07-03 Thread Stephan Holljes
Signed-off-by: Stephan Holljes klaxa1...@googlemail.com
---
 libavformat/http.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/libavformat/http.c b/libavformat/http.c
index 676bfd5..3c1ec35 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -25,6 +25,7 @@
 #include zlib.h
 #endif /* CONFIG_ZLIB */
 
+#include libavutil/avassert.h
 #include libavutil/avstring.h
 #include libavutil/opt.h
 
@@ -382,6 +383,24 @@ static int http_open(URLContext *h, const char *uri, int 
flags,
 return ret;
 }
 
+static int http_accept(URLContext *s, URLContext **c)
+{
+int ret;
+HTTPContext *sc = s-priv_data;
+HTTPContext *cc;
+URLContext *sl = sc-hd;
+URLContext *cl;
+av_assert0(sc-listen);
+if ((ret = ffurl_alloc(c, s-filename, s-flags  AVIO_FLAG_READ_WRITE, 
sl-interrupt_callback))  0)
+goto fail;
+cc = (*c)-priv_data;
+if ((ret = ffurl_accept(sl, cl))  0)
+goto fail;
+cc-hd = cl;
+fail:
+return ret;
+}
+
 static int http_getc(HTTPContext *s)
 {
 int len;
-- 
2.1.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel