Re: [FFmpeg-devel] [PATCH] avformat/srt: add Haivision SRT protocol

2017-10-06 Thread Nicolas George
Le quintidi 15 vendémiaire, an CCXXVI, Nablet Developer a écrit :
> > SRT is a subtitle format: a more specific name would be better.
> Haivision suggested name "opensrt" - is it acceptable to distinguish with
> SRT subtitile format?
> if yes, I'll go ahead and submit new patch with name changed.

That would be fine by me, at least.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] avformat/srt: add Haivision SRT protocol

2017-10-05 Thread Nablet Developer

> SRT is a subtitle format: a more specific name would be better.
Haivision suggested name "opensrt" - is it acceptable to distinguish 
with SRT subtitile format?

if yes, I'll go ahead and submit new patch with name changed.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/srt: add Haivision SRT protocol

2017-10-05 Thread Nablet Developer

> SRT is a subtitle format: a more specific name would be better.

for example? haivision_srt?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/srt: add Haivision SRT protocol

2017-10-05 Thread Nicolas George
Le quartidi 14 vendémiaire, an CCXXVI, Nablet Developer a écrit :
> protocol requires libsrt (https://github.com/Haivision/srt) to be
> installed
> 
> Signed-off-by: Nablet Developer 
> ---
>  configure   |5 +
>  libavformat/Makefile|1 +
>  libavformat/protocols.c |1 +

>  libavformat/srt.c   | 1105 
> +++

SRT is a subtitle format: a more specific name would be better.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] avformat/srt: add Haivision SRT protocol

2017-10-05 Thread Carl Eugen Hoyos
2017-10-05 10:25 GMT+02:00 Nablet Developer :
> protocol requires libsrt (https://github.com/Haivision/srt) to be
> installed

> +  --enable-libsrt  enable libsrt [autodetect]

Given that there is a libsrt that you don't meant, I don't
think this is the right name for the option:
I suggest --enable-srt.
This should not be auto-detected since this certainly
is no system library.
And I suspect there is some alphabetical ordering,
please respect it, same below.

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


[FFmpeg-devel] [PATCH] avformat/srt: add Haivision SRT protocol

2017-10-05 Thread Nablet Developer
protocol requires libsrt (https://github.com/Haivision/srt) to be
installed

Signed-off-by: Nablet Developer 
---
 configure   |5 +
 libavformat/Makefile|1 +
 libavformat/protocols.c |1 +
 libavformat/srt.c   | 1105 +++
 libavformat/url.h   |4 +
 5 files changed, 1116 insertions(+)
 create mode 100644 libavformat/srt.c

diff --git a/configure b/configure
index 391c141..d955805 100755
--- a/configure
+++ b/configure
@@ -301,6 +301,7 @@ External library support:
on OSX if openssl and gnutls are not used 
[autodetect]
   --disable-xlib   disable xlib [autodetect]
   --disable-zlib   disable zlib [autodetect]
+  --enable-libsrt  enable libsrt [autodetect]
 
   The following libraries provide various hardware acceleration features:
   --disable-audiotoolbox   disable Apple AudioToolbox code [autodetect]
@@ -1638,6 +1639,7 @@ EXTERNAL_LIBRARY_LIST="
 openal
 opencl
 opengl
+libsrt
 "
 
 HWACCEL_AUTODETECT_LIBRARY_LIST="
@@ -3170,6 +3172,8 @@ tls_securetransport_protocol_select="tcp_protocol"
 tls_protocol_deps_any="tls_schannel_protocol tls_securetransport_protocol 
tls_gnutls_protocol tls_openssl_protocol"
 udp_protocol_select="network"
 udplite_protocol_select="network"
+srt_protocol_select="network"
+srt_protocol_deps="libsrt"
 unix_protocol_deps="sys_un_h"
 unix_protocol_select="network"
 
@@ -6076,6 +6080,7 @@ enabled rkmpp && { { require_pkg_config 
rockchip_mpp rockchip_mpp ro
{ enabled libdrm ||
  die "ERROR: rkmpp requires --enable-libdrm"; }
  }
+enabled libsrt   && require_pkg_config srt srt/srt.h srt_socket
 
 if enabled gcrypt; then
 GCRYPT_CONFIG="${cross_prefix}libgcrypt-config"
diff --git a/libavformat/Makefile b/libavformat/Makefile
index df709c29..695cf51 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -593,6 +593,7 @@ OBJS-$(CONFIG_TLS_SCHANNEL_PROTOCOL) += tls_schannel.o 
tls.o
 OBJS-$(CONFIG_TLS_SECURETRANSPORT_PROTOCOL) += tls_securetransport.o tls.o
 OBJS-$(CONFIG_UDP_PROTOCOL)  += udp.o
 OBJS-$(CONFIG_UDPLITE_PROTOCOL)  += udp.o
+OBJS-$(CONFIG_SRT_PROTOCOL)  += srt.o
 OBJS-$(CONFIG_UNIX_PROTOCOL) += unix.o
 
 # libavdevice dependencies
diff --git a/libavformat/protocols.c b/libavformat/protocols.c
index 8d3555e..8b4fded 100644
--- a/libavformat/protocols.c
+++ b/libavformat/protocols.c
@@ -62,6 +62,7 @@ extern const URLProtocol ff_tls_securetransport_protocol;
 extern const URLProtocol ff_tls_openssl_protocol;
 extern const URLProtocol ff_udp_protocol;
 extern const URLProtocol ff_udplite_protocol;
+extern const URLProtocol ff_srt_protocol;
 extern const URLProtocol ff_unix_protocol;
 extern const URLProtocol ff_librtmp_protocol;
 extern const URLProtocol ff_librtmpe_protocol;
diff --git a/libavformat/srt.c b/libavformat/srt.c
new file mode 100644
index 000..5950a50
--- /dev/null
+++ b/libavformat/srt.c
@@ -0,0 +1,1105 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * SRT protocol
+ */
+
+#define _DEFAULT_SOURCE
+#define _BSD_SOURCE /* Needed for using struct ip_mreq with recent glibc */
+
+#include "avformat.h"
+#include "avio_internal.h"
+#include "libavutil/avassert.h"
+#include "libavutil/parseutils.h"
+#include "libavutil/fifo.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/avstring.h"
+#include "libavutil/opt.h"
+#include "libavutil/log.h"
+#include "libavutil/time.h"
+#include "internal.h"
+#include "network.h"
+#include "os_support.h"
+#include "url.h"
+
+#ifdef __APPLE__
+#include "TargetConditionals.h"
+#endif
+
+#include 
+#include 
+
+
+#if HAVE_PTHREAD_CANCEL
+#include 
+#endif
+
+#ifndef HAVE_PTHREAD_CANCEL
+#define HAVE_PTHREAD_CANCEL 0
+#endif
+
+#ifndef IPV6_ADD_MEMBERSHIP
+#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
+#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
+#endif
+
+#define UDP_TX_BUF_SIZE 32768
+#define UDP_MAX_PKT_SIZE 65536
+#define UDP_HEADER_SIZE 8
+
+typedef struct SRTContext {
+const AVClass *class;
+SRTSOCKET srt_fd;
+int buffer_size;
+int pkt_size;
+