Re: [FFmpeg-devel] [PATCH] openssl: Support version 1.1.0.

2016-10-14 Thread Matt Oliver
On 14 October 2016 at 23:04, wm4  wrote:

> On Mon, 10 Oct 2016 02:39:51 +1100
> Matt Oliver  wrote:
>
> > ---
> >  configure |   3 +-
> >  libavformat/tls_openssl.c | 159
> > --
> >  2 files changed, 98 insertions(+), 64 deletions(-)
> >
> > diff --git a/configure b/configure
> > index df6ffa2..750684a 100755
> > --- a/configure
> > +++ b/configure
> > @@ -5813,7 +5813,8 @@ enabled omx   && { check_header
> > OMX_Core.h ||
> >  add_cflags
> -isystem/opt/vc/include/IL
> > ; }
> >  check_header OMX_Core.h ; } ||
> > die "ERROR: OpenMAX IL headers not
> found"; }
> > -enabled openssl   && { use_pkg_config openssl openssl/ssl.h
> > SSL_library_init ||
> > +enabled openssl   && { use_pkg_config openssl openssl/ssl.h
> > OPENSSL_init_ssl ||
> > +   use_pkg_config openssl openssl/ssl.h
> > SSL_library_init ||
> > check_lib openssl/ssl.h SSL_library_init
> > -lssl -lcrypto ||
> > check_lib openssl/ssl.h SSL_library_init
> > -lssl32 -leay32 ||
> > check_lib openssl/ssl.h SSL_library_init
> > -lssl -lcrypto -lws2_32 -lgdi32 ||
> > diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
> > index 46eb3e6..4effb39 100644
> > --- a/libavformat/tls_openssl.c
> > +++ b/libavformat/tls_openssl.c
> > @@ -63,6 +63,85 @@ static unsigned long openssl_thread_id(void)
> >  #endif
> >  #endif
> >
> > +static int url_bio_create(BIO *b)
> > +{
> > +#if OPENSSL_VERSION_NUMBER >= 0x101fL
> > +BIO_set_init(b, 1);
> > +BIO_set_data(b, NULL);
> > +BIO_set_flags(b, 0);
> > +#else
> > +b->init = 1;
> > +b->ptr = NULL;
> > +b->flags = 0;
> > +#endif
> > +return 1;
> > +}
> > +
> > +static int url_bio_destroy(BIO *b)
> > +{
> > +return 1;
> > +}
> > +
> > +#if OPENSSL_VERSION_NUMBER >= 0x101fL
> > +#define BIO_GET_DATA(x) BIO_get_data(x);
> > +#else
> > +#define BIO_GET_DATA(x) x->ptr;
> > +#endif
> > +
> > +static int url_bio_bread(BIO *b, char *buf, int len)
> > +{
> > +URLContext *h = BIO_GET_DATA(b);
> > +int ret = ffurl_read(h, buf, len);
> > +if (ret >= 0)
> > +return ret;
> > +BIO_clear_retry_flags(b);
> > +if (ret == AVERROR_EXIT)
> > +return 0;
> > +return -1;
> > +}
> > +
> > +static int url_bio_bwrite(BIO *b, const char *buf, int len)
> > +{
> > +URLContext *h = BIO_GET_DATA(b);
> > +int ret = ffurl_write(h, buf, len);
> > +if (ret >= 0)
> > +return ret;
> > +BIO_clear_retry_flags(b);
> > +if (ret == AVERROR_EXIT)
> > +return 0;
> > +return -1;
> > +}
> > +
> > +static long url_bio_ctrl(BIO *b, int cmd, long num, void *ptr)
> > +{
> > +if (cmd == BIO_CTRL_FLUSH) {
> > +BIO_clear_retry_flags(b);
> > +return 1;
> > +}
> > +return 0;
> > +}
> > +
> > +static int url_bio_bputs(BIO *b, const char *str)
> > +{
> > +return url_bio_bwrite(b, str, strlen(str));
> > +}
> > +
> > +#if OPENSSL_VERSION_NUMBER >= 0x101fL
> > +static BIO_METHOD* url_bio_method;
>
> More global mutable data? Are you serious? We've been trying our best
> to avoid these, and only awful APIs like OpenSSL or GnuTLS force us to
> have them (as well as our own awful APIs). Please remove this global if
> possible.
>
>
The only way would be to add a variable it to TLSContext. Which if that
works for you then let me know so I can push this.


> > +#else
> > +static BIO_METHOD url_bio_method = {
> > +.type = BIO_TYPE_SOURCE_SINK,
> > +.name = "urlprotocol bio",
> > +.bwrite = url_bio_bwrite,
> > +.bread = url_bio_bread,
> > +.bputs = url_bio_bputs,
> > +.bgets = NULL,
> > +.ctrl = url_bio_ctrl,
> > +.create = url_bio_create,
> > +.destroy = url_bio_destroy,
> > +};
> > +#endif
> > +
> >  int ff_openssl_init(void)
> >  {
> >  avpriv_lock_avformat();
> > @@ -86,6 +165,15 @@ int ff_openssl_init(void)
> >  #endif
> >  }
> >  #endif
> > +#if OPENSSL_VERSION_NUMBER >= 0x101fL
> > +url_bio_method = BIO_meth_new(BIO_TYPE_SOURCE_SINK,
> "urlprotocol
> > bio");
> > +BIO_meth_set_write(url_bio_method, url_bio_bwrite);
> > +BIO_meth_set_read(url_bio_method, url_bio_bread);
> > +BIO_meth_set_puts(url_bio_method, url_bio_bputs);
> > +BIO_meth_set_ctrl(url_bio_method, url_bio_ctrl);
> > +BIO_meth_set_create(url_bio_method, url_bio_create);
> > +BIO_meth_set_destroy(url_bio_method, url_bio_destroy);
> > +#endif
> >  }
> >  openssl_init++;
> >  avpriv_unlock_avformat();
> > @@ -107,6 +195,9 @@ void ff_openssl_deinit(void)
> >  av_free(openssl_mutexes);
> >  }
> >  #endif
> > +#if OPENSSL_VERSION_NUMBER >= 0x101fL
> > +BIO_meth_free(url_bio_method);
> > +#endif
> >

Re: [FFmpeg-devel] [PATCH] openssl: Support version 1.1.0.

2016-10-14 Thread Matt Oliver
---
 configure |   3 +-
 libavformat/tls_openssl.c | 163
--
 2 files changed, 102 insertions(+), 64 deletions(-)

diff --git a/configure b/configure
index e014615..3a92eb3 100755
--- a/configure
+++ b/configure
@@ -5816,7 +5816,8 @@ enabled omx   && { check_header
OMX_Core.h ||
 add_cflags -isystem/opt/vc/include/IL
; }
 check_header OMX_Core.h ; } ||
die "ERROR: OpenMAX IL headers not found"; }
-enabled openssl   && { use_pkg_config openssl openssl/ssl.h
SSL_library_init ||
+enabled openssl   && { use_pkg_config openssl openssl/ssl.h
OPENSSL_init_ssl ||
+   use_pkg_config openssl openssl/ssl.h
SSL_library_init ||
check_lib openssl/ssl.h SSL_library_init
-lssl -lcrypto ||
check_lib openssl/ssl.h SSL_library_init
-lssl32 -leay32 ||
check_lib openssl/ssl.h SSL_library_init
-lssl -lcrypto -lws2_32 -lgdi32 ||
diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
index 46eb3e6..c551ac7 100644
--- a/libavformat/tls_openssl.c
+++ b/libavformat/tls_openssl.c
@@ -43,6 +43,9 @@ typedef struct TLSContext {
 TLSShared tls_shared;
 SSL_CTX *ctx;
 SSL *ssl;
+#if OPENSSL_VERSION_NUMBER >= 0x101fL
+BIO_METHOD* url_bio_method;
+#endif
 } TLSContext;

 #if HAVE_THREADS
@@ -63,6 +66,87 @@ static unsigned long openssl_thread_id(void)
 #endif
 #endif

+static int url_bio_create(BIO *b)
+{
+#if OPENSSL_VERSION_NUMBER >= 0x101fL
+BIO_set_init(b, 1);
+BIO_set_data(b, NULL);
+BIO_set_flags(b, 0);
+#else
+b->init = 1;
+b->ptr = NULL;
+b->flags = 0;
+#endif
+return 1;
+}
+
+static int url_bio_destroy(BIO *b)
+{
+return 1;
+}
+
+#if OPENSSL_VERSION_NUMBER >= 0x101fL
+#define GET_BIO_DATA(x) BIO_get_data(x);
+#else
+#define GET_BIO_DATA(x) (x)->ptr;
+#endif
+
+static int url_bio_bread(BIO *b, char *buf, int len)
+{
+URLContext *h;
+int ret;
+h = GET_BIO_DATA(b);
+ret = ffurl_read(h, buf, len);
+if (ret >= 0)
+return ret;
+BIO_clear_retry_flags(b);
+if (ret == AVERROR_EXIT)
+return 0;
+return -1;
+}
+
+static int url_bio_bwrite(BIO *b, const char *buf, int len)
+{
+URLContext *h;
+int ret;
+h = GET_BIO_DATA(b);
+ret = ffurl_write(h, buf, len);
+if (ret >= 0)
+return ret;
+BIO_clear_retry_flags(b);
+if (ret == AVERROR_EXIT)
+return 0;
+return -1;
+}
+
+static long url_bio_ctrl(BIO *b, int cmd, long num, void *ptr)
+{
+if (cmd == BIO_CTRL_FLUSH) {
+BIO_clear_retry_flags(b);
+return 1;
+}
+return 0;
+}
+
+static int url_bio_bputs(BIO *b, const char *str)
+{
+return url_bio_bwrite(b, str, strlen(str));
+}
+
+#if OPENSSL_VERSION_NUMBER < 0x101fL
+static BIO_METHOD url_bio_method = {
+.type = BIO_TYPE_SOURCE_SINK,
+.name = "urlprotocol bio",
+.bwrite = url_bio_bwrite,
+.bread = url_bio_bread,
+.bputs = url_bio_bputs,
+.bgets = NULL,
+.ctrl = url_bio_ctrl,
+.create = url_bio_create,
+.destroy = url_bio_destroy,
+};
+#endif
+
 int ff_openssl_init(void)
 {
 avpriv_lock_avformat();
@@ -128,73 +212,14 @@ static int tls_close(URLContext *h)
 SSL_CTX_free(c->ctx);
 if (c->tls_shared.tcp)
 ffurl_close(c->tls_shared.tcp);
+#if OPENSSL_VERSION_NUMBER >= 0x101fL
+if (c->url_bio_method)
+BIO_meth_free(c->url_bio_method);
+#endif
 ff_openssl_deinit();
 return 0;
 }

-static int url_bio_create(BIO *b)
-{
-b->init = 1;
-b->ptr = NULL;
-b->flags = 0;
-return 1;
-}
-
-static int url_bio_destroy(BIO *b)
-{
-return 1;
-}
-
-static int url_bio_bread(BIO *b, char *buf, int len)
-{
-URLContext *h = b->ptr;
-int ret = ffurl_read(h, buf, len);
-if (ret >= 0)
-return ret;
-BIO_clear_retry_flags(b);
-if (ret == AVERROR_EXIT)
-return 0;
-return -1;
-}
-
-static int url_bio_bwrite(BIO *b, const char *buf, int len)
-{
-URLContext *h = b->ptr;
-int ret = ffurl_write(h, buf, len);
-if (ret >= 0)
-return ret;
-BIO_clear_retry_flags(b);
-if (ret == AVERROR_EXIT)
-return 0;
-return -1;
-}
-
-static long url_bio_ctrl(BIO *b, int cmd, long num, void *ptr)
-{
-if (cmd == BIO_CTRL_FLUSH) {
-BIO_clear_retry_flags(b);
-return 1;
-}
-return 0;
-}
-
-static int url_bio_bputs(BIO *b, const char *str)
-{
-return url_bio_bwrite(b, str, strlen(str));
-}
-
-static BIO_METHOD url_bio_method = {
-.type = BIO_TYPE_SOURCE_SINK,
-.name = "urlprotocol bio",
-.bwrite = url_bio_bwrite,
-.bread = url_bio_bread,
-.bputs = url_bio_bputs,
-.bgets = NULL,
-.ctrl = url_bio_ctrl,
-.create = url_bio_create,
-.destroy = url_bio_destroy,
-};
-
 static

Re: [FFmpeg-devel] [PATCH] avformat/udp: deprecate local_port option

2016-10-14 Thread Steven Liu
2016-10-15 10:19 GMT+08:00 Michael Niedermayer :

> On Sat, Oct 15, 2016 at 09:57:40AM +0800, Steven Liu wrote:
> [...]
> > and ping Luca Abeni
>
> iam not sure he is still maintaining udp, he hasnt been active since
> many years IIRC
>
ping Michael :-D

>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> There will always be a question for which you do not know the correct
> answer.
>
> ___
> 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


Re: [FFmpeg-devel] [PATCH] avformat/udp: deprecate local_port option

2016-10-14 Thread Michael Niedermayer
On Sat, Oct 15, 2016 at 09:57:40AM +0800, Steven Liu wrote:
[...]
> and ping Luca Abeni

iam not sure he is still maintaining udp, he hasnt been active since
many years IIRC

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct answer.


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/udp: deprecate local_port option

2016-10-14 Thread Steven Liu
2016-10-13 20:57 GMT+08:00 Steven Liu :

> ping
>
> 2016-10-12 14:21 GMT+08:00 Steven Liu :
>
>>
>> Signed-off-by: Steven Liu 
>> ---
>>  doc/protocols.texi|3 +++
>>  libavformat/udp.c |   19 ++-
>>  libavformat/version.h |3 +++
>>  3 files changed, 24 insertions(+), 1 deletions(-)
>>
>> diff --git a/doc/protocols.texi b/doc/protocols.texi
>> index 3abc5f3..85a3f56 100644
>> --- a/doc/protocols.texi
>> +++ b/doc/protocols.texi
>> @@ -1304,6 +1304,9 @@ input has enough packets to sustain it.
>>  When using @var{bitrate} this specifies the maximum number of bits in
>>  packet bursts.
>>
>> +@item local_port=@var{port}
>> +This is a deprecated option, you can use localport instead it.
>> +
>>  @item localport=@var{port}
>>  Override the local UDP port to bind with.
>>
>> diff --git a/libavformat/udp.c b/libavformat/udp.c
>> index 3835f98..af06b89 100644
>> --- a/libavformat/udp.c
>> +++ b/libavformat/udp.c
>> @@ -86,6 +86,9 @@ typedef struct UDPContext {
>>  int pkt_size;
>>  int is_multicast;
>>  int is_broadcast;
>> +#if FF_API_UDP_LOCAL_PORT
>> +int local_port_deprecated;
>> +#endif
>>  int local_port;
>>  int reuse_socket;
>>  int overrun_nonfatal;
>> @@ -123,7 +126,9 @@ static const AVOption options[] = {
>>  { "bitrate","Bits to send per second",
>>OFFSET(bitrate),AV_OPT_TYPE_INT64,  { .i64 = 0  }, 0,
>> INT64_MAX, .flags = E },
>>  { "burst_bits", "Max length of bursts in bits (when using
>> bitrate)", OFFSET(burst_bits),   AV_OPT_TYPE_INT64,  { .i64 = 0  }, 0,
>> INT64_MAX, .flags = E },
>>  { "localport",  "Local port",
>>   OFFSET(local_port), AV_OPT_TYPE_INT,{ .i64 = -1 },-1,
>> INT_MAX, D|E },
>> -{ "local_port", "Local port",
>>   OFFSET(local_port), AV_OPT_TYPE_INT,{ .i64 = -1 },-1,
>> INT_MAX, .flags = D|E },
>> +#if FF_API_UDP_LOCAL_PORT
>> +{ "local_port", "Local port",
>>   OFFSET(local_port_deprecated), AV_OPT_TYPE_INT,{ .i64 = -1 },
>>   -1, INT_MAX, .flags = D|E },
>> +#endif
>>  { "localaddr",  "Local address",
>>OFFSET(localaddr),  AV_OPT_TYPE_STRING, { .str = NULL },
>>.flags = D|E },
>>  { "udplite_coverage", "choose UDPLite head size which should be
>> validated by checksum", OFFSET(udplite_coverage), AV_OPT_TYPE_INT, {.i64 =
>> 0}, 0, INT_MAX, D|E },
>>  { "pkt_size",   "Maximum UDP packet size",
>>OFFSET(pkt_size),   AV_OPT_TYPE_INT,{ .i64 = 1472 },  -1,
>> INT_MAX, .flags = D|E },
>> @@ -377,6 +382,12 @@ static int udp_socket_create(URLContext *h, struct
>> sockaddr_storage *addr,
>>
>>  if (((struct sockaddr *) &s->dest_addr)->sa_family)
>>  family = ((struct sockaddr *) &s->dest_addr)->sa_family;
>> +#if FF_API_UDP_LOCAL_PORT
>> +if (s->local_port_deprecated >= 0) {
>> +av_log(s, AV_LOG_WARNING, "the local_port option is deprecated,
>> please use localport option\n");
>> +s->local_port = s->local_port_deprecated;
>> +}
>> +#endif
>>  res0 = udp_resolve_host(h, (localaddr && localaddr[0]) ? localaddr :
>> NULL,
>>  s->local_port,
>>  SOCK_DGRAM, family, AI_PASSIVE);
>> @@ -481,6 +492,12 @@ int ff_udp_set_remote_url(URLContext *h, const char
>> *uri)
>>  int ff_udp_get_local_port(URLContext *h)
>>  {
>>  UDPContext *s = h->priv_data;
>> +#if FF_API_UDP_LOCAL_PORT
>> +if (s->local_port_deprecated >= 0) {
>> +av_log(s, AV_LOG_WARNING, "the local_port option is deprecated,
>> please use localport option\n");
>> +s->local_port = s->local_port_deprecated;
>> +}
>> +#endif
>>  return s->local_port;
>>  }
>>
>> diff --git a/libavformat/version.h b/libavformat/version.h
>> index 92801b4..71c03ef 100644
>> --- a/libavformat/version.h
>> +++ b/libavformat/version.h
>> @@ -85,6 +85,9 @@
>>  #ifndef FF_API_HTTP_USER_AGENT
>>  #define FF_API_HTTP_USER_AGENT  (LIBAVFORMAT_VERSION_MAJOR < 58)
>>  #endif
>> +#ifndef FF_API_UDP_LOCAL_PORT
>> +#define FF_API_UDP_LOCAL_PORT   (LIBAVFORMAT_VERSION_MAJOR < 59)
>> +#endif
>>
>>  #ifndef FF_API_R_FRAME_RATE
>>  #define FF_API_R_FRAME_RATE1
>> --
>> 1.7.1
>>
>>
>>
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
>
hi wm4,

  What about this one?

and ping Luca Abeni
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [OPW] OPW Project Proposal

2016-10-14 Thread Michael Niedermayer
On Sat, Oct 15, 2016 at 03:33:27AM +0530, Pallavi Kumari wrote:
> Hi Michael,
> 
> Please find the task at https://github.com/atana1/audio_stream

The code should be a avfilter in libavfilter
also it should be using the existing fft code

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire


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


Re: [FFmpeg-devel] [PATCH 2/2] lavf/mov: support gopro hero moments udta tag

2016-10-14 Thread Michael Niedermayer
On Mon, Oct 10, 2016 at 12:00:01PM +0200, Jean Caillé wrote:
> From: Jean Caillé 
> 
> ---
>  libavformat/mov.c | 19 +++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index add1812..3e73320 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -268,6 +268,23 @@ static int mov_metadata_loci(MOVContext *c, AVIOContext 
> *pb, unsigned len)
>  return av_dict_set(&c->fc->metadata, key, buf, 0);
>  }
>  
> +static int mov_metadata_hmmt(MOVContext *c, AVIOContext *pb, unsigned len)
> +{
> +int i, n_hmmt;
> +
> +if (len < 2)
> +return 0;
> +if (c->ignore_chapters)
> +return 0;
> +
> +n_hmmt = avio_rb32(pb);
> +for (i = 0; i < n_hmmt; i++) {
> +int moment_time = avio_rb32(pb);

please add a eof check here
this loop could otherwise run for a long time eating both time and
memory even with a small file

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu


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


Re: [FFmpeg-devel] [PATCH 1/2] lavf/mov: support gopro firmware udta tag

2016-10-14 Thread Michael Niedermayer
On Mon, Oct 10, 2016 at 12:00:00PM +0200, Jean Caillé wrote:
> From: Jean Caillé 
> 
> ---
>  libavformat/mov.c | 1 +
>  1 file changed, 1 insertion(+)

applied

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.


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


Re: [FFmpeg-devel] [OPW] OPW Project Proposal

2016-10-14 Thread Pallavi Kumari
Hi Michael,

Please find the task at https://github.com/atana1/audio_stream


Regards,
Pallavi
nick - atana

On Wed, Oct 12, 2016 at 6:26 AM, Michael Niedermayer  wrote:

> On Tue, Oct 11, 2016 at 11:54:04PM +0200, Michael Niedermayer wrote:
> > On Tue, Oct 11, 2016 at 09:52:08PM +0530, Pallavi Kumari wrote:
> > > >> added the entry with the sugested addition
> > >
> > > >> also you didnt list "Expected results" so i added some
> > >
> > > Thank you.
> > >
> > > Is the preferred language C for this kind of filter? C++ ?
> >
> > C (optional assembly optimizations are welcome too for speed critical
> > parts)
> >
> >
> > >
> > > I don't see a qualification task on the wiki. Let me know so that that
> I
> > > can start with it  and with writing the application.
> >
> > added something
> >
> > also submit your code early! there likely will be some comments and
> > suggestions to change this and that. early submission means less work
> > changing things
>
> also when you start working on a qualification task please add
> yourself to
> https://trac.ffmpeg.org/wiki/SponsoringPrograms/Outreachy/2016-12-Qualis
>
> [...]
>
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> The greatest way to live with honor in this world is to be what we pretend
> to be. -- Socrates
>
> ___
> 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


Re: [FFmpeg-devel] [PATCH] avfilter/af_silenceremove: add optional tone when silence is removed

2016-10-14 Thread Michael Niedermayer
On Fri, Oct 14, 2016 at 06:09:51PM +, Greg Rowe wrote:
> Michael,
> 
> In the attached patch I've tried to make all of the changes you've pointed 
> out.  I also renamed tone_hz to tone_frequency on Moritz Barsnick's 
> suggestion.
> 
> Is there a good way to generate the tone while avoiding floating point 
> operations?  If there is then don't bother reviewing this patch and I'll make 
> that change once I know better how to do it.

see
libavfilter/asrc_sine.c
this code should probably be reused / factored
(note, any code moving/factoring of existing code should be in a
 seperate patch)

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.


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/udp: deprecate local_port option

2016-10-14 Thread wm4
On Sat, 8 Oct 2016 15:35:02 +0800
Steven Liu  wrote:

>

If you send a patch like this, make sure you do the following things:
- explain in the commit message WHY
- document the deprecation in the, you know, documentation
- document the replacement

It should be natural that this should be required, and everyone on this
project should follow this and similar guidelines to keep patch quality
high.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/vda: define av_vda_default_init2 when CONFIG_H264_VDA_HWACCEL equ 0

2016-10-14 Thread wm4
On Thu, 13 Oct 2016 20:57:07 +0800
Steven Liu  wrote:

> ping
> 
> 2016-10-12 17:36 GMT+08:00 Steven Liu :
> 
> > on OSX:
> > ../configure --disable-everything --enable-demuxer=hls make
> > error message: Undefined symbols for architecture x86_64:
> > "_av_vda_default_init2", referenced from:_videotoolbox_init in
> > ffmpeg_videotoolbox.o
> > so add av_vda_default_init2 when CONFIG_H264_VDA_HWACCEL=0
> >
> > Signed-off-by: Steven Liu 
> > ---
> >  libavcodec/vda.c |5 +
> >  1 files changed, 5 insertions(+), 0 deletions(-)
> >
> > diff --git a/libavcodec/vda.c b/libavcodec/vda.c
> > index 4670140..819ae03 100644
> > --- a/libavcodec/vda.c
> > +++ b/libavcodec/vda.c
> > @@ -73,6 +73,11 @@ int av_vda_default_init(AVCodecContext *avctx)
> >  return AVERROR(ENOSYS);
> >  }
> >
> > +int av_vda_default_init2(AVCodecContext *avctx, AVVDAContext *vdactx)
> > +{
> > +return AVERROR(ENOSYS);
> > +}
> > +
> >  void av_vda_default_free(AVCodecContext *ctx)
> >  {
> >  }
> > --
> > 1.7.1
> >
> >
> >
> > ___
> > 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

Patch ok, but I can't push for a while (and I'm not VDA maintainer).
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] add hds demuxer

2016-10-14 Thread wm4
On Fri, 14 Oct 2016 16:31:58 +0200
Nicolas George  wrote:

> Le tridi 23 vendémiaire, an CCXXV, Steven Liu a écrit :
> > > Rather than NIHing it, I think using libexpat would be a good choice
> > > (even if its API is terrible).  
> > ok, i'll learn how to use it, and use it next step. :-)  
> 
> While I agree that expat is way better than libxml2 for that task, it is
> still an external library. If on top of that the API is terrible, I do not
> see a very strong case, I am still rather in favour of a minimalistic XML
> parser in lavu. Of course, whoever does the work has the most say in the
> matter.
> 
> Regards,
> 

Several FFmpeg developers have expressed their reservation about this
idea. XML is very complex, so the big question is whether our XML
parser would really be better, safer, faster, easier to use, etc.
(probably not).

Anyway, what does matter for this patch is whether we can agree on a
XML library, and whether it's ok to make Steve Liu update his patch.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Developer "cehoyos" closed my bug without any explanation, and without solving it

2016-10-14 Thread wm4
On Tue, 11 Oct 2016 00:23:20 +0200
Alexey Eromenko  wrote:

> Hello all,
> 
> Bug #5882; Certain x264 videos do not play on Apple decoders
> (Quicktime/iTunes/iPad)
> 
> Today was closed by developer "cehoyos" without any explanation, and
> without any resolution.
> He treats all bugs like that ? Worse yet; he treats all people like bugs ?
> 

Yes, it's unfortunate that our bug tracker is maintained by a person
who just acts so stubburn.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] d3d11va: use the proper slice index

2016-10-14 Thread wm4
On Tue, 11 Oct 2016 10:18:06 +0200
Hendrik Leppkes  wrote:

> On Mon, Oct 10, 2016 at 11:34 PM, compn  wrote:
> > On Mon, 10 Oct 2016 17:07:06 +0200
> > Hendrik Leppkes  wrote:
> >  
> >> On Mon, Oct 10, 2016 at 4:01 PM, Michael Niedermayer  
> >> >
> >> > maybe our dxva2 maintainer wants a co maintainer?
> >> > if so would someone be interrested to help ?
> >> >  
> >>
> >> Unfortunately I have no way of testing the D3D11 stuff in there (and I  
> >
> > do you want a windows box with a d3d11 card? there are many companies
> > now using ffmpeg and they want to get boxes into developer hands for
> > testing.
> >  
> 
> I have all the hardware, but I have no software that actually uses
> d3d11, and ffmpeg itself also does not use it. Hence no testing
> options.

mpv supports it, if you need another API user than just vlc.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Improved selftest coverage for libavutil/fifo.c

2016-10-14 Thread Michael Niedermayer
On Thu, Oct 13, 2016 at 03:13:56PM -0700, Thomas Turner wrote:
> Tested functions: av_fifo_generic_peek(), av_fifo_grow()
> 
> Signed-off-by: Thomas Turner 
> ---
>  libavutil/tests/fifo.c | 39 +--
>  tests/ref/fate/fifo| 43 +++
>  2 files changed, 80 insertions(+), 2 deletions(-)
> 
> diff --git a/libavutil/tests/fifo.c b/libavutil/tests/fifo.c
> index e4d7edf..63e25c8 100644
> --- a/libavutil/tests/fifo.c
> +++ b/libavutil/tests/fifo.c
> @@ -17,14 +17,14 @@
>   */
>  
>  #include 
> -
> +#include 
>  #include "libavutil/fifo.h"
>  
>  int main(void)
>  {
>  /* create a FIFO buffer */
>  AVFifoBuffer *fifo = av_fifo_alloc(13 * sizeof(int));
> -int i, j, n;
> +int i, j, n, *p;
>  
>  /* fill data */
>  for (i = 0; av_fifo_space(fifo) >= sizeof(int); i++)
> @@ -46,6 +46,24 @@ int main(void)
>  }
>  printf("\n");
>  
> +/* generic peek at FIFO */
> +
> +n = av_fifo_size(fifo);
> +p = malloc(n);
> +if (p == NULL) {
> +fprintf(stderr, "failed to allocate memory.\n");

> +exit(-1);

we use exit(1) everywhere else
changed and applied

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin


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


Re: [FFmpeg-devel] [PATCH] avfilter/af_silenceremove: add optional tone when silence is removed

2016-10-14 Thread Greg Rowe

On Fri, Oct 14, 2016 at 18:09:51 +, Greg Rowe wrote:
You attached the old patch. ;-)


Is there a good way to generate the tone while avoiding floating
point operations?


Well that's embarrassing.  I'll fix that after we figure out how best to 
handle the tone generation.  :)




Good point: libavfilter/asrc_sine.c does exactly that, if I understand
the code correctly. And avoids math.h's sin() by creating a lookup
table. (I'm not sure whether your patch should have included math.h
explicitly. It was probably pulled in via avutil headers.)

Now I think you would be duplicating some stuff from there. Perhaps
something to be put into common functions and reused?


I saw that today.  There is also ff_generate_wave_table which I *think* 
is applicable but I'm not certain and didn't have the time yet to play with.




I removed the unrelated changes.


They might be worthwhile anyway, later then.


I'll submit a patch for those changes after this one get straightened 
out.  I have a patch I'd like to submit for the Sky Media format (a 
container format we use at Shoretel).  I thought I'd get my feet wet 
with this change first!


Thanks,
Greg

--
Greg Rowe
www.shoretel.com
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Adding support from some GoPro udta tags

2016-10-14 Thread Clément Bœsch
On Mon, Oct 10, 2016 at 11:59:59AM +0200, Jean Caillé wrote:
> 
> Hello,
> 
> GoPro sets some specific udta tags in their videos. Two of 
> those are the FIRM and HMMT udta tags.
> The FIRM tag is a string containing the firmware version.
> Tht MHHT tag contains a number of "Hero Moments" tags. Those moments are set 
> by 
> the user while recording and can be used to help finding interesting moments 
> in 
> a long video.
> 
> Proposed here are two patches for handling those udta tags. Note that
> as discussed with Clément Boesch, individual HMMT tags are set as chapters
> of the video.
> 
> Test footage : https://www.dropbox.com/s/zrx1nepiti5ajsj/GOPR8508.MP4
> 
> Test footage has firmware "HX1.01.02.00" and 4 Hero Moments, at around 5, 10, 
> 15 and 20 seconds.
> 
> As I am not yet a member of ffmpeg-devel, I would appreciate being cc'd 
> in order to receive feedback for the two patches.
> 
> Thank you for your review,
> 

ping on this.

The patchset had my review pre-posting on this ml, but it's a bit uncalled
for me to apply it, hence the ping.

Regards,

-- 
Clément B.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/af_silenceremove: add optional tone when silence is removed

2016-10-14 Thread Moritz Barsnick
On Fri, Oct 14, 2016 at 18:09:51 +, Greg Rowe wrote:
> In the attached patch I've tried to make all of the changes you've
> pointed out. I also renamed tone_hz to tone_frequency on Moritz
> Barsnick's suggestion.

You attached the old patch. ;-)

> Is there a good way to generate the tone while avoiding floating
> point operations?

Good point: libavfilter/asrc_sine.c does exactly that, if I understand
the code correctly. And avoids math.h's sin() by creating a lookup
table. (I'm not sure whether your patch should have included math.h
explicitly. It was probably pulled in via avutil headers.)

Now I think you would be duplicating some stuff from there. Perhaps
something to be put into common functions and reused?

> I removed the unrelated changes.

They might be worthwhile anyway, later then.

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


Re: [FFmpeg-devel] [PATCH] vp9: change order of operations in adapt_prob().

2016-10-14 Thread James Zern
On Fri, Oct 14, 2016 at 11:54 AM, Ronald S. Bultje  wrote:
> Hi Michael,
>
> On Fri, Oct 14, 2016 at 2:31 PM, Michael Niedermayer > wrote:
>
>> On Fri, Oct 14, 2016 at 08:29:37PM +0200, Michael Niedermayer wrote:
>> > On Fri, Oct 14, 2016 at 11:09:30AM -0700, James Zern wrote:
>> > > Ronald,
>> > >
>> > > On Fri, Oct 14, 2016 at 10:01 AM, Ronald S. Bultje 
>> wrote:
>> > > > This is intended to workaround bug "665 Integer Divide Instruction
>> May
>> > > > Cause Unpredictable Behavior" on some early AMD CPUs, which causes a
>> > > > div-by-zero in this codepath, such as reported in Mozilla bug
>> #1293996.
>> > > >
>> > > > Note that this isn't guaranteed to fix the bug, since a compiler is
>> free
>> > > > to reorder instructions that don't depend on each other. However, it
>> > > > appears to fix the bug in Firefox, and a similar patch was applied to
>> > > > libvpx also (see Chrome bug #599899).
>> > > >
>> > >
>> > > I recently made a few additional changes as this regressed in chrome
>> > > [1][2], but just like this change there's no guarantee it won't occur
>> > > again.
>> >
>> > maybe you can use empty "asm volatile(:::"memory")" statments to
>> > prevent unwanted instruction reordering by the compiler
>> > never tried something like this so dunno, also it would be specific
>> > to gcc compatible compilers but should not be architecture specific
>>
>> thinking again, why dont you write the function in asm for x86 ?
>> this would take the compiler out of the equation
>
>
> I think the primary reason is that "this seems to work". Don't forget that
> the bug is in the hardware, not in the code, so I don't want to make the
> code needlessly (well... maybe that's debatable) complicated for a problem
> that isn't really ours...
>
> But I guess I'm open to hearing everyone else's opinion on this - if people
> want me to make the workaround more persistent I can work on that.
>

That ended up being my view mostly due to the fact that I didn't have
access to the hardware. Even with assembly there is a
timing/scheduling element, so it may be less fragile, but I think the
bug could still occur.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] vp9: change order of operations in adapt_prob().

2016-10-14 Thread Ronald S. Bultje
Hi Michael,

On Fri, Oct 14, 2016 at 2:31 PM, Michael Niedermayer  wrote:

> On Fri, Oct 14, 2016 at 08:29:37PM +0200, Michael Niedermayer wrote:
> > On Fri, Oct 14, 2016 at 11:09:30AM -0700, James Zern wrote:
> > > Ronald,
> > >
> > > On Fri, Oct 14, 2016 at 10:01 AM, Ronald S. Bultje 
> wrote:
> > > > This is intended to workaround bug "665 Integer Divide Instruction
> May
> > > > Cause Unpredictable Behavior" on some early AMD CPUs, which causes a
> > > > div-by-zero in this codepath, such as reported in Mozilla bug
> #1293996.
> > > >
> > > > Note that this isn't guaranteed to fix the bug, since a compiler is
> free
> > > > to reorder instructions that don't depend on each other. However, it
> > > > appears to fix the bug in Firefox, and a similar patch was applied to
> > > > libvpx also (see Chrome bug #599899).
> > > >
> > >
> > > I recently made a few additional changes as this regressed in chrome
> > > [1][2], but just like this change there's no guarantee it won't occur
> > > again.
> >
> > maybe you can use empty "asm volatile(:::"memory")" statments to
> > prevent unwanted instruction reordering by the compiler
> > never tried something like this so dunno, also it would be specific
> > to gcc compatible compilers but should not be architecture specific
>
> thinking again, why dont you write the function in asm for x86 ?
> this would take the compiler out of the equation


I think the primary reason is that "this seems to work". Don't forget that
the bug is in the hardware, not in the code, so I don't want to make the
code needlessly (well... maybe that's debatable) complicated for a problem
that isn't really ours...

But I guess I'm open to hearing everyone else's opinion on this - if people
want me to make the workaround more persistent I can work on that.

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


[FFmpeg-devel] HLS Input -> tee muxer -> HLS+UDP output

2016-10-14 Thread Ibrahim Tachijian
Hey,

When using an HLS input transcoding processes can really be speeded up
compared to having a udp input simply because you have a few segments
cached and can transcode immediately as fast as CPU allows.

This means that ffmpeg will also produce the playlist and first segments
really quickly. This is all good.

The main problem is when we want to make the output also available in UDP.
Simply we use the tee muxer to trancode once and output to both hls and
udp. The problem is that UDP becomes bursty and is not "streamed".

We would like someway to use "-re" (realtime) output for the udp output but
not the HLS output.

Do you understand the reasonings and what can you suggest?

We thought that it might be possible to possibly use tee muxer to output to
stdout+hls and then launch a separate ffmpeg to do "-re" from stdout to
produce the multicast output. But isnt there a better way?

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


Re: [FFmpeg-devel] [PATCH] vp9: change order of operations in adapt_prob().

2016-10-14 Thread James Zern
On Fri, Oct 14, 2016 at 11:31 AM, Michael Niedermayer
 wrote:
> On Fri, Oct 14, 2016 at 08:29:37PM +0200, Michael Niedermayer wrote:
>> On Fri, Oct 14, 2016 at 11:09:30AM -0700, James Zern wrote:
>> > Ronald,
>> >
>> > On Fri, Oct 14, 2016 at 10:01 AM, Ronald S. Bultje  
>> > wrote:
>> > > This is intended to workaround bug "665 Integer Divide Instruction May
>> > > Cause Unpredictable Behavior" on some early AMD CPUs, which causes a
>> > > div-by-zero in this codepath, such as reported in Mozilla bug #1293996.
>> > >
>> > > Note that this isn't guaranteed to fix the bug, since a compiler is free
>> > > to reorder instructions that don't depend on each other. However, it
>> > > appears to fix the bug in Firefox, and a similar patch was applied to
>> > > libvpx also (see Chrome bug #599899).
>> > >
>> >
>> > I recently made a few additional changes as this regressed in chrome
>> > [1][2], but just like this change there's no guarantee it won't occur
>> > again.
>>
>> maybe you can use empty "asm volatile(:::"memory")" statments to
>> prevent unwanted instruction reordering by the compiler
>> never tried something like this so dunno, also it would be specific
>> to gcc compatible compilers but should not be architecture specific
>
> thinking again, why dont you write the function in asm for x86 ?
> this would take the compiler out of the equation
>

That could work, I started with a portion in assembly before making
the C changes, but didn't follow through with it.

> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> The educated differ from the uneducated as much as the living from the
> dead. -- Aristotle
>
> ___
> 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 2/2] lavd/decklink_dec: fix indentation

2016-10-14 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 libavdevice/decklink_dec.cpp | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 5318bbe..c98c51f 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -310,17 +310,17 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
 
 if (videoFrame->GetFlags() & bmdFrameHasNoInputSource) {
 if (ctx->draw_bars && videoFrame->GetPixelFormat() == 
bmdFormat8BitYUV) {
-unsigned bars[8] = {
-0xEA80EA80, 0xD292D210, 0xA910A9A5, 0x90229035,
-0x6ADD6ACA, 0x51EF515A, 0x286D28EF, 0x10801080 };
-int width  = videoFrame->GetWidth();
-int height = videoFrame->GetHeight();
-unsigned *p = (unsigned *)frameBytes;
-
-for (int y = 0; y < height; y++) {
-for (int x = 0; x < width; x += 2)
-*p++ = bars[(x * 8) / width];
-}
+unsigned bars[8] = {
+0xEA80EA80, 0xD292D210, 0xA910A9A5, 0x90229035,
+0x6ADD6ACA, 0x51EF515A, 0x286D28EF, 0x10801080 };
+int width  = videoFrame->GetWidth();
+int height = videoFrame->GetHeight();
+unsigned *p = (unsigned *)frameBytes;
+
+for (int y = 0; y < height; y++) {
+for (int x = 0; x < width; x += 2)
+*p++ = bars[(x * 8) / width];
+}
 }
 
 if (!no_video) {
-- 
2.6.6

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


[FFmpeg-devel] [PATCH 1/2] lavd/decklink_dec: add option to disable drawing bars on signal loss

2016-10-14 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 doc/indevs.texi | 4 
 libavdevice/decklink_common.h   | 1 +
 libavdevice/decklink_common_c.h | 1 +
 libavdevice/decklink_dec.cpp| 3 ++-
 libavdevice/decklink_dec_c.c| 1 +
 libavdevice/version.h   | 2 +-
 6 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index f693d7a..54f270b 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -273,6 +273,10 @@ Sets the video packet timestamp source. Must be 
@samp{video}, @samp{audio},
 Sets the audio packet timestamp source. Must be @samp{video}, @samp{audio},
 @samp{reference} or @samp{wallclock}. Defaults to @samp{audio}.
 
+@item draw_bars
+If set to @samp{true}, color bars are drawn in the event of a signal loss.
+Defaults to @samp{true}.
+
 @end table
 
 @subsection Examples
diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h
index d2d0ab2..bfa2b08 100644
--- a/libavdevice/decklink_common.h
+++ b/libavdevice/decklink_common.h
@@ -84,6 +84,7 @@ struct decklink_ctx {
 int duplex_mode;
 DecklinkPtsSource audio_pts_source;
 DecklinkPtsSource video_pts_source;
+int draw_bars;
 
 int frames_preroll;
 int frames_buffer;
diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h
index 3c5f218..d565631 100644
--- a/libavdevice/decklink_common_c.h
+++ b/libavdevice/decklink_common_c.h
@@ -46,6 +46,7 @@ struct decklink_cctx {
 DecklinkPtsSource video_pts_source;
 int audio_input;
 int video_input;
+int draw_bars;
 };
 
 #endif /* AVDEVICE_DECKLINK_COMMON_C_H */
diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 24b42e3..5318bbe 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -309,7 +309,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
   ctx->video_st->time_base.den);
 
 if (videoFrame->GetFlags() & bmdFrameHasNoInputSource) {
-if (videoFrame->GetPixelFormat() == bmdFormat8BitYUV) {
+if (ctx->draw_bars && videoFrame->GetPixelFormat() == 
bmdFormat8BitYUV) {
 unsigned bars[8] = {
 0xEA80EA80, 0xD292D210, 0xA910A9A5, 0x90229035,
 0x6ADD6ACA, 0x51EF515A, 0x286D28EF, 0x10801080 };
@@ -485,6 +485,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
 ctx->audio_input = decklink_audio_connection_map[cctx->audio_input];
 ctx->audio_pts_source = cctx->audio_pts_source;
 ctx->video_pts_source = cctx->video_pts_source;
+ctx->draw_bars = cctx->draw_bars;
 cctx->ctx = ctx;
 
 #if !CONFIG_LIBZVBI
diff --git a/libavdevice/decklink_dec_c.c b/libavdevice/decklink_dec_c.c
index 56bc439..543d16b 100644
--- a/libavdevice/decklink_dec_c.c
+++ b/libavdevice/decklink_dec_c.c
@@ -62,6 +62,7 @@ static const AVOption options[] = {
 { "video", NULL,  0,  
AV_OPT_TYPE_CONST, { .i64 = PTS_SRC_VIDEO}, 0, 0, DEC, "pts_source"},
 { "reference", NULL,  0,  
AV_OPT_TYPE_CONST, { .i64 = PTS_SRC_REFERENCE}, 0, 0, DEC, "pts_source"},
 { "wallclock", NULL,  0,  
AV_OPT_TYPE_CONST, { .i64 = PTS_SRC_WALLCLOCK}, 0, 0, DEC, "pts_source"},
+{ "draw_bars", "draw bars on signal loss" , OFFSET(draw_bars),
AV_OPT_TYPE_BOOL,  { .i64 = 1}, 0, 1, DEC },
 { NULL },
 };
 
diff --git a/libavdevice/version.h b/libavdevice/version.h
index 94a34fd..8603bb1 100644
--- a/libavdevice/version.h
+++ b/libavdevice/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVDEVICE_VERSION_MAJOR  57
 #define LIBAVDEVICE_VERSION_MINOR   0
-#define LIBAVDEVICE_VERSION_MICRO 102
+#define LIBAVDEVICE_VERSION_MICRO 103
 
 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
LIBAVDEVICE_VERSION_MINOR, \
-- 
2.6.6

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


Re: [FFmpeg-devel] [PATCH] vp9: change order of operations in adapt_prob().

2016-10-14 Thread Michael Niedermayer
On Fri, Oct 14, 2016 at 08:29:37PM +0200, Michael Niedermayer wrote:
> On Fri, Oct 14, 2016 at 11:09:30AM -0700, James Zern wrote:
> > Ronald,
> > 
> > On Fri, Oct 14, 2016 at 10:01 AM, Ronald S. Bultje  
> > wrote:
> > > This is intended to workaround bug "665 Integer Divide Instruction May
> > > Cause Unpredictable Behavior" on some early AMD CPUs, which causes a
> > > div-by-zero in this codepath, such as reported in Mozilla bug #1293996.
> > >
> > > Note that this isn't guaranteed to fix the bug, since a compiler is free
> > > to reorder instructions that don't depend on each other. However, it
> > > appears to fix the bug in Firefox, and a similar patch was applied to
> > > libvpx also (see Chrome bug #599899).
> > >
> > 
> > I recently made a few additional changes as this regressed in chrome
> > [1][2], but just like this change there's no guarantee it won't occur
> > again.
> 
> maybe you can use empty "asm volatile(:::"memory")" statments to
> prevent unwanted instruction reordering by the compiler
> never tried something like this so dunno, also it would be specific
> to gcc compatible compilers but should not be architecture specific

thinking again, why dont you write the function in asm for x86 ?
this would take the compiler out of the equation

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 


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


Re: [FFmpeg-devel] [PATCH] vp9: change order of operations in adapt_prob().

2016-10-14 Thread Michael Niedermayer
On Fri, Oct 14, 2016 at 11:09:30AM -0700, James Zern wrote:
> Ronald,
> 
> On Fri, Oct 14, 2016 at 10:01 AM, Ronald S. Bultje  wrote:
> > This is intended to workaround bug "665 Integer Divide Instruction May
> > Cause Unpredictable Behavior" on some early AMD CPUs, which causes a
> > div-by-zero in this codepath, such as reported in Mozilla bug #1293996.
> >
> > Note that this isn't guaranteed to fix the bug, since a compiler is free
> > to reorder instructions that don't depend on each other. However, it
> > appears to fix the bug in Firefox, and a similar patch was applied to
> > libvpx also (see Chrome bug #599899).
> >
> 
> I recently made a few additional changes as this regressed in chrome
> [1][2], but just like this change there's no guarantee it won't occur
> again.

maybe you can use empty "asm volatile(:::"memory")" statments to
prevent unwanted instruction reordering by the compiler
never tried something like this so dunno, also it would be specific
to gcc compatible compilers but should not be architecture specific

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No snowflake in an avalanche ever feels responsible. -- Voltaire


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


Re: [FFmpeg-devel] [PATCH]configure: Enable pie for toolchain=hardened.

2016-10-14 Thread Andreas Cadhalpun
On 14.10.2016 18:28, Michael Niedermayer wrote:
> On Thu, Oct 13, 2016 at 12:56:56AM +0200, Andreas Cadhalpun wrote:
>> If you want both NX and ASLR security features for an executable it has
>> to be built with '-pie' and must not contain text relocations.
> 
> this should not be true
> the difference between text relocations and lack there off is that
> without text relocations a binary is loaded and written into memory
> with text relocations the binary is loaded the addresses for
> relocations updated and writen into memory.
> There is at a theoretical level no difference in required access rights
> write to memory is neccessary at the load stage, no execute is needed
> here and once done rights can be fliped over into execute without write
> This may very well not work out that way in gnu linux but thats a
> implementation problem then not a fundamental issue in NX+ASLR+TEXRELs
> That is unless iam missing something
> 
> also a simple test:
> gcc xtest.c -pie -m32 -o xtest
> int main() {
> void *ref;
> asm (
> "mov $main, %0"
> :"=r"(ref)
> );
> printf("? %p\n", ref);
> //can we read it ?
> printf("R %d\n", *(int*)ref);
> //can we write it ?
> *(int*)ref = 123;
> 
> return 0;
> }
> 
> Executing this shows that the write is prevented and segfaults, the
> address is different on each run and we have a text relocation in it
> thats on a ancient ubuntu without special security patches that i
> remember

Interesting...
I was just rephrasing what I found on the web [1]:
"For NX to be useful, you need to make sure that all the executable
memory pages are loaded and set in stone right away; this makes text
relocation impossible"

Best regards,
Andreas


1: https://blog.flameeyes.eu/2009/11/the-pie-is-not-exactly-a-lie/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] vp9: change order of operations in adapt_prob().

2016-10-14 Thread James Zern
Ronald,

On Fri, Oct 14, 2016 at 10:01 AM, Ronald S. Bultje  wrote:
> This is intended to workaround bug "665 Integer Divide Instruction May
> Cause Unpredictable Behavior" on some early AMD CPUs, which causes a
> div-by-zero in this codepath, such as reported in Mozilla bug #1293996.
>
> Note that this isn't guaranteed to fix the bug, since a compiler is free
> to reorder instructions that don't depend on each other. However, it
> appears to fix the bug in Firefox, and a similar patch was applied to
> libvpx also (see Chrome bug #599899).
>

I recently made a few additional changes as this regressed in chrome
[1][2], but just like this change there's no guarantee it won't occur
again.

[1] 
https://chromium.googlesource.com/webm/libvpx/+/8b4210940ce4183d4cfded42c323612c0c6d1688
[2] 
https://chromium.googlesource.com/webm/libvpx/+/82ea74223771793628dbd812c2fd50afcfb8183a

> ---
>  libavcodec/vp9.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>

lgtm

> diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
> index cb2a4a2..3b72149 100644
> --- a/libavcodec/vp9.c
> +++ b/libavcodec/vp9.c
> @@ -3705,11 +3705,10 @@ static av_always_inline void adapt_prob(uint8_t *p, 
> unsigned ct0, unsigned ct1,
>  if (!ct)
>  return;
>
> +update_factor = FASTDIV(update_factor * FFMIN(ct, max_count), max_count);
>  p1 = *p;
> -p2 = ((ct0 << 8) + (ct >> 1)) / ct;
> +p2 = int64_t) ct0) << 8) + (ct >> 1)) / ct;
>  p2 = av_clip(p2, 1, 255);
> -ct = FFMIN(ct, max_count);
> -update_factor = FASTDIV(update_factor * ct, max_count);
>
>  // (p1 * (256 - update_factor) + p2 * update_factor + 128) >> 8
>  *p = p1 + (((p2 - p1) * update_factor + 128) >> 8);
> --
> 2.8.1
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/af_silenceremove: add optional tone when silence is removed

2016-10-14 Thread Greg Rowe
Michael,

In the attached patch I've tried to make all of the changes you've pointed out. 
 I also renamed tone_hz to tone_frequency on Moritz Barsnick's suggestion.

Is there a good way to generate the tone while avoiding floating point 
operations?  If there is then don't bother reviewing this patch and I'll make 
that change once I know better how to do it.

I removed the unrelated changes.  The two parameters, tone_duration and 
tone_frequency, are integers now.  The tone_duration parameter is changed from 
seconds to milliseconds.  I have updated the documentation to reflect that.  I 
moved the tone generation to an initialization function and fill a buffer that 
exists for the duration of the filter instead of needlessly generating the tone 
on the fly.  

Thanks,
Greg

-- 
Greg Rowe
www.shoretel.com

From 41405e90cb2fb41441a6cf29c7a0d14362fd1b1f Mon Sep 17 00:00:00 2001
From: Greg Rowe 
Date: Fri, 7 Oct 2016 13:39:58 -0400
Subject: [PATCH] avfilter/af_silenceremove: add optional tone when silence is
 removed

This commit adds two options to the af_silenceremove filter.  It adds
tone_duration and tone_hz making it possible to insert a tone when
silence is removed.  Tone insertion is disabled by default (by using a
tone_duration of 0.0 seconds).

Signed-off-by: Greg Rowe 
---
 Changelog  |   1 +
 doc/filters.texi   |  11 ++-
 libavfilter/af_silenceremove.c | 161 +++--
 libavfilter/version.h  |   2 +-
 4 files changed, 151 insertions(+), 24 deletions(-)

diff --git a/Changelog b/Changelog
index 0da009c..86e031c 100644
--- a/Changelog
+++ b/Changelog
@@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest 
within each release,
 releases are sorted from youngest to oldest.
 
 version :
+- Added optional tone insertion in af_silenceremove
 - libopenmpt demuxer
 - tee protocol
 - Changed metadata print option to accept general urls
diff --git a/doc/filters.texi b/doc/filters.texi
index 4b2f7bf..e09a303 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3340,7 +3340,8 @@ ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f 
null -
 
 @section silenceremove
 
-Remove silence from the beginning, middle or end of the audio.
+Remove silence from the beginning, middle or end of the audio while
+optionally inserting a tone where silence was removed.
 
 The filter accepts the following options:
 
@@ -3401,6 +3402,14 @@ Default value is @code{rms}.
 @item window
 Set ratio used to calculate size of window for detecting silence.
 Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
+
+@item tone_duration
+Set the duration of the tone inserted in the stream when silence is removed.  
A value of @code{0} disables tone insertion.
+Default value is @code{0.0}.
+
+@item tone_hz
+Set the frequency of the tone inserted in the stream when silence is removed.
+Default value is @code{1000.0}.
 @end table
 
 @subsection Examples
diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c
index f156d18..07cf428 100644
--- a/libavfilter/af_silenceremove.c
+++ b/libavfilter/af_silenceremove.c
@@ -3,6 +3,7 @@
  * Copyright (c) 2001 Chris Bagwell
  * Copyright (c) 2003 Donnie Smith
  * Copyright (c) 2014 Paul B Mahol
+ * Copyright (c) 2016 Shoretel 
  *
  * This file is part of FFmpeg.
  *
@@ -31,11 +32,20 @@
 #include "internal.h"
 
 enum SilenceMode {
-SILENCE_TRIM,
+SILENCE_TRIM = 0,
 SILENCE_TRIM_FLUSH,
 SILENCE_COPY,
 SILENCE_COPY_FLUSH,
-SILENCE_STOP
+SILENCE_STOP,
+SILENCE_END_MARKER
+};
+
+static const char* SILENCE_MODE_NAMES[] = {
+NULL_IF_CONFIG_SMALL("TRIM"),
+NULL_IF_CONFIG_SMALL("TRIM_FLUSH"),
+NULL_IF_CONFIG_SMALL("COPY"),
+NULL_IF_CONFIG_SMALL("COPY_FLUSH"),
+NULL_IF_CONFIG_SMALL("STOP")
 };
 
 typedef struct SilenceRemoveContext {
@@ -75,6 +85,10 @@ typedef struct SilenceRemoveContext {
 int detection;
 void (*update)(struct SilenceRemoveContext *s, double sample);
 double(*compute)(struct SilenceRemoveContext *s, double sample);
+
+double last_pts_seconds;
+double tone_duration;
+double tone_hz;
 } SilenceRemoveContext;
 
 #define OFFSET(x) offsetof(SilenceRemoveContext, x)
@@ -91,11 +105,51 @@ static const AVOption silenceremove_options[] = {
 {   "peak",  0,0,   AV_OPT_TYPE_CONST,
{.i64=0}, 0,   0, FLAGS, "detection" },
 {   "rms",   0,0,   AV_OPT_TYPE_CONST,
{.i64=1}, 0,   0, FLAGS, "detection" },
 { "window",  NULL, OFFSET(window_ratio),AV_OPT_TYPE_DOUBLE,   
{.dbl=0.02},  0,  10, FLAGS },
-{ NULL }
+{
+.name = "tone_duration",
+.help = "length of tone inserted when silence is detected (0 to 
disable)",
+.offset = OFFSET(tone_duration),
+.type = AV_OPT_TYPE_DOUBLE,
+.default_val = {.dbl=0.0},
+.min = 0.0,
+.max = D

Re: [FFmpeg-devel] [PATCH] RTSP: pass TLS args for RTSPS

2016-10-14 Thread Jay
Thanks to the suggestion from Compn on IRC, I set up a test server for this
patch. Once the patch is applied it can be tested as follows. The cert is
self signed and ( as with TLS ) the hostname is not verified with openssl.

wget
https://gist.githubusercontent.com/jayridge/c506515d969751610188152cee7ca2b2/raw/3c14ce37380f744393d15bebcca4c1cc80f3f55f/cert.pem
-O /tmp/cert.pem
./ffprobe 'rtsps://user:passw...@rtsps.jayridgeway.com:8554/test' -v debug
-ca_file /tmp/cert.pem -tls_verify 1


On Sat, Oct 1, 2016 at 4:20 PM  wrote:

> From: Jay Ridgeway 
>
>
> This patch enables TLS args for RTSPS. This is necessary for client
> certificates and cert validation.
>
> Squash changes from feedback into one patch.
>
> ---
>  libavformat/rtsp.c| 19 ---
>  libavformat/rtsp.h|  8 
>  libavformat/tls_gnutls.c  |  7 +++
>  libavformat/tls_openssl.c |  7 +++
>  libavformat/tls_schannel.c|  7 +++
>  libavformat/tls_securetransport.c |  7 +++
>  6 files changed, 52 insertions(+), 3 deletions(-)
>
> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> index c6292c5..53ecb6c 100644
> --- a/libavformat/rtsp.c
> +++ b/libavformat/rtsp.c
> @@ -78,6 +78,7 @@
>  { "reorder_queue_size", "set number of packets to buffer for handling
> of reordered packets", OFFSET(reordering_queue_size), AV_OPT_TYPE_INT, {
> .i64 = -1 }, -1, INT_MAX, DEC }, \
>  { "buffer_size","Underlying protocol send/receive buffer
> size",  OFFSET(buffer_size),   AV_OPT_TYPE_INT, {
> .i64 = -1 }, -1, INT_MAX, DEC|ENC } \
>
> +#define NONNULLSTR(s) (s ? s : "")
>
>  const AVOption ff_rtsp_options[] = {
>  { "initial_pause",  "do not start playing the stream immediately",
> OFFSET(initial_pause), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DEC },
> @@ -97,6 +98,10 @@ const AVOption ff_rtsp_options[] = {
>  { "stimeout", "set timeout (in microseconds) of socket TCP I/O
> operations", OFFSET(stimeout), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN,
> INT_MAX, DEC },
>  COMMON_OPTS(),
>  { "user-agent", "override User-Agent header", OFFSET(user_agent),
> AV_OPT_TYPE_STRING, {.str = LIBAVFORMAT_IDENT}, 0, 0, DEC },
> +{ "ca_file", "Certificate Authority database file", OFFSET(ca_file),
> AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC|ENC },
> +{ "tls_verify", "verify the peer certificate", OFFSET(verify),
> AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DEC|ENC},
> +{ "cert_file", "certificate file", OFFSET(cert_file),
> AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC|ENC },
> +{ "key_file", "private key file", OFFSET(key_file),
> AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC|ENC },
>  { NULL },
>  };
>
> @@ -1812,9 +1817,17 @@ redirect:
>  } else {
>  int ret;
>  /* open the tcp connection */
> -ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, NULL,
> -host, port,
> -"?timeout=%d", rt->stimeout);
> +if (strcmp("tls", lower_rtsp_proto) == 0) {
> +ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, NULL,
> +host, port,
> +
> "?timeout=%d&verify=%d&cafile=%s&cert_file=%s&key_file=%s",
> +rt->stimeout, rt->verify, NONNULLSTR(rt->ca_file),
> +NONNULLSTR(rt->cert_file),
> NONNULLSTR(rt->key_file));
> +} else {
> +ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, NULL,
> +host, port,
> +"?timeout=%d", rt->stimeout);
> +}
>  if ((ret = ffurl_open_whitelist(&rt->rtsp_hd, tcpname,
> AVIO_FLAG_READ_WRITE,
> &s->interrupt_callback, NULL,
> s->protocol_whitelist, s->protocol_blacklist, NULL)) < 0) {
>  err = ret;
> diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
> index 852fd67..fa872a8 100644
> --- a/libavformat/rtsp.h
> +++ b/libavformat/rtsp.h
> @@ -408,6 +408,14 @@ typedef struct RTSPState {
>
>  char default_lang[4];
>  int buffer_size;
> +
> +/** The following are used for RTSPS streams */
> +//@{
> +char *ca_file;
> +int verify;
> +char *cert_file;
> +char *key_file;
> +//@}
>  } RTSPState;
>
>  #define RTSP_FLAG_FILTER_SRC  0x1/**< Filter incoming UDP packets -
> 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   

Re: [FFmpeg-devel] [PATCH]configure: Enable pie for toolchain=hardened.

2016-10-14 Thread Michael Niedermayer
On Fri, Oct 14, 2016 at 06:28:32PM +0200, Michael Niedermayer wrote:
> On Thu, Oct 13, 2016 at 12:56:56AM +0200, Andreas Cadhalpun wrote:
> > On 12.10.2016 23:44, Carl Eugen Hoyos wrote:
> > > 2016-10-12 19:04 GMT+02:00 Andreas Cadhalpun 
> > > :
> > >> On 04.10.2016 12:24, Carl Eugen Hoyos wrote:
> > >>> Sorry if I miss something but with this patch, the hardening_check
> > >>> script succeeds here both for x86_32 and x86_64 (static and shared).
> > >>
> > >> This script uses a very simplistic approach for testing position
> > >> independent executables.
> > >> I think it just does the equivalent of 'readelf -h $PROGRAM | grep Type'.
> > >> If the Type is EXEC, it's a normal executable, and if it is DYN, it
> > >> assumes it's compiled as PIE.
> > > 
> > >> However, that doesn't guarantee that the executable is actually position
> > >> independent, i.e. does not contain text relocations.
> > > 
> > > My understanding of PIE is (very) limited but I suspect text relocations
> > > and PIE do not exclude each other.
> > 
> > As I understand it the literal meaning of position independent code is
> > code without text relocations, because those are what makes the code
> > position dependent. So in this literal sense PIE and text relocations
> > exclude each other.
> > (The -fPIC/-fPIE flags tell the compiler to produce code without text
> > relocations.)
> > 
> > The additional complication for executables is that ASLR doesn't work for
> > normal executables, because they are always mapped to the same point in
> > address space. The basic idea of PIE is to build the executables actually
> > as shared libraries, so that they can benefit from ASLR just as normal
> > shared libraries.
> > (The '-pie' flag tells the linker to produce such an executable.)
> > 
> > However, such a '-pie' executable is not necessarily position independent
> > in the literal sense, i.e. might contain text relocations.
> > In that sense PIE and text relocations don't exclude each other.
> > 
> 
> > If you want both NX and ASLR security features for an executable it has
> > to be built with '-pie' and must not contain text relocations.
> 
> this should not be true
> the difference between text relocations and lack there off is that
> without text relocations a binary is loaded and written into memory
> with text relocations the binary is loaded the addresses for
> relocations updated and writen into memory.
> There is at a theoretical level no difference in required access rights
> write to memory is neccessary at the load stage, no execute is needed
> here and once done rights can be fliped over into execute without write
> This may very well not work out that way in gnu linux but thats a
> implementation problem then not a fundamental issue in NX+ASLR+TEXRELs
> That is unless iam missing something
> 
> also a simple test:
> gcc xtest.c -pie -m32 -o xtest
> int main() {
> void *ref;
> asm (
> "mov $main, %0"
> :"=r"(ref)
> );
> printf("? %p\n", ref);
> //can we read it ?
> printf("R %d\n", *(int*)ref);
> //can we write it ?
> *(int*)ref = 123;
> 
> return 0;
> }
> 
> Executing this shows that the write is prevented and segfaults, the
> address is different on each run and we have a text relocation in it
> thats on a ancient ubuntu without special security patches that i
> remember

Heres an example for 64bit with ASLR+TEXREL+non writable code
gcc xtest.c -fPIE -pie  -o xtest

int main() {
void *ref;
asm (
"movabs $main, %0"
:"=r"(ref)
);
printf("? %p\n", ref);
//can we read it ?
printf("R %d\n", *(int*)ref);
//can we write it ?
*(int*)ref = 123;
printf("W\n");

return 0;
}

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No snowflake in an avalanche ever feels responsible. -- Voltaire


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


[FFmpeg-devel] [PATCH] vp9: change order of operations in adapt_prob().

2016-10-14 Thread Ronald S. Bultje
This is intended to workaround bug "665 Integer Divide Instruction May
Cause Unpredictable Behavior" on some early AMD CPUs, which causes a
div-by-zero in this codepath, such as reported in Mozilla bug #1293996.

Note that this isn't guaranteed to fix the bug, since a compiler is free
to reorder instructions that don't depend on each other. However, it
appears to fix the bug in Firefox, and a similar patch was applied to
libvpx also (see Chrome bug #599899).
---
 libavcodec/vp9.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index cb2a4a2..3b72149 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -3705,11 +3705,10 @@ static av_always_inline void adapt_prob(uint8_t *p, 
unsigned ct0, unsigned ct1,
 if (!ct)
 return;
 
+update_factor = FASTDIV(update_factor * FFMIN(ct, max_count), max_count);
 p1 = *p;
-p2 = ((ct0 << 8) + (ct >> 1)) / ct;
+p2 = int64_t) ct0) << 8) + (ct >> 1)) / ct;
 p2 = av_clip(p2, 1, 255);
-ct = FFMIN(ct, max_count);
-update_factor = FASTDIV(update_factor * ct, max_count);
 
 // (p1 * (256 - update_factor) + p2 * update_factor + 128) >> 8
 *p = p1 + (((p2 - p1) * update_factor + 128) >> 8);
-- 
2.8.1

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


[FFmpeg-devel] [PATCH] Improved selftest coverage for libavutil/fifo.c

2016-10-14 Thread Thomas Turner
Tested functions: av_fifo_generic_peek(), av_fifo_grow()

Signed-off-by: Thomas Turner 
---
 libavutil/tests/fifo.c | 39 +--
 tests/ref/fate/fifo| 43 +++
 2 files changed, 80 insertions(+), 2 deletions(-)

diff --git a/libavutil/tests/fifo.c b/libavutil/tests/fifo.c
index e4d7edf..63e25c8 100644
--- a/libavutil/tests/fifo.c
+++ b/libavutil/tests/fifo.c
@@ -17,14 +17,14 @@
  */
 
 #include 
-
+#include 
 #include "libavutil/fifo.h"
 
 int main(void)
 {
 /* create a FIFO buffer */
 AVFifoBuffer *fifo = av_fifo_alloc(13 * sizeof(int));
-int i, j, n;
+int i, j, n, *p;
 
 /* fill data */
 for (i = 0; av_fifo_space(fifo) >= sizeof(int); i++)
@@ -46,6 +46,24 @@ int main(void)
 }
 printf("\n");
 
+/* generic peek at FIFO */
+
+n = av_fifo_size(fifo);
+p = malloc(n);
+if (p == NULL) {
+fprintf(stderr, "failed to allocate memory.\n");
+exit(-1);
+}
+
+(void) av_fifo_generic_peek(fifo, p, n, NULL);
+
+/* read data at p */
+n /= sizeof(int);
+for(i = 0; i < n; ++i)
+printf("%d: %d\n", i, p[i]);
+
+putchar('\n');
+
 /* read data */
 for (i = 0; av_fifo_size(fifo) >= sizeof(int); i++) {
 av_fifo_generic_read(fifo, &j, sizeof(int), NULL);
@@ -67,8 +85,25 @@ int main(void)
 av_fifo_generic_peek_at(fifo, &j, i * sizeof(int), sizeof(j), NULL);
 printf("%d: %d\n", i, j);
 }
+putchar('\n');
+
+/* test fifo_grow */
+(void) av_fifo_grow(fifo, 15 * sizeof(int));
+
+/* fill data */
+n = av_fifo_size(fifo) / sizeof(int);
+for (i = n; av_fifo_space(fifo) >= sizeof(int); ++i)
+av_fifo_generic_write(fifo, &i, sizeof(int), NULL);
+
+/* peek_at at FIFO */
+n = av_fifo_size(fifo) / sizeof(int);
+for (i = 0; i < n; i++) {
+av_fifo_generic_peek_at(fifo, &j, i * sizeof(int), sizeof(j), NULL);
+printf("%d: %d\n", i, j);
+}
 
 av_fifo_free(fifo);
+free(p);
 
 return 0;
 }
diff --git a/tests/ref/fate/fifo b/tests/ref/fate/fifo
index 162d754..2b18ed5 100644
--- a/tests/ref/fate/fifo
+++ b/tests/ref/fate/fifo
@@ -38,6 +38,20 @@
 11: 11
 12: 12
 
+0: 0
+1: 1
+2: 2
+3: 3
+4: 4
+5: 5
+6: 6
+7: 7
+8: 8
+9: 9
+10: 10
+11: 11
+12: 12
+
 0 1 2 3 4 5 6 7 8 9 10 11 12
 0: 0
 1: 1
@@ -52,3 +66,32 @@
 10: 10
 11: 11
 12: 12
+
+0: 0
+1: 1
+2: 2
+3: 3
+4: 4
+5: 5
+6: 6
+7: 7
+8: 8
+9: 9
+10: 10
+11: 11
+12: 12
+13: 13
+14: 14
+15: 15
+16: 16
+17: 17
+18: 18
+19: 19
+20: 20
+21: 21
+22: 22
+23: 23
+24: 24
+25: 25
+26: 26
+27: 27
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH]configure: Enable pie for toolchain=hardened.

2016-10-14 Thread Michael Niedermayer
On Thu, Oct 13, 2016 at 12:56:56AM +0200, Andreas Cadhalpun wrote:
> On 12.10.2016 23:44, Carl Eugen Hoyos wrote:
> > 2016-10-12 19:04 GMT+02:00 Andreas Cadhalpun 
> > :
> >> On 04.10.2016 12:24, Carl Eugen Hoyos wrote:
> >>> Sorry if I miss something but with this patch, the hardening_check
> >>> script succeeds here both for x86_32 and x86_64 (static and shared).
> >>
> >> This script uses a very simplistic approach for testing position
> >> independent executables.
> >> I think it just does the equivalent of 'readelf -h $PROGRAM | grep Type'.
> >> If the Type is EXEC, it's a normal executable, and if it is DYN, it
> >> assumes it's compiled as PIE.
> > 
> >> However, that doesn't guarantee that the executable is actually position
> >> independent, i.e. does not contain text relocations.
> > 
> > My understanding of PIE is (very) limited but I suspect text relocations
> > and PIE do not exclude each other.
> 
> As I understand it the literal meaning of position independent code is
> code without text relocations, because those are what makes the code
> position dependent. So in this literal sense PIE and text relocations
> exclude each other.
> (The -fPIC/-fPIE flags tell the compiler to produce code without text
> relocations.)
> 
> The additional complication for executables is that ASLR doesn't work for
> normal executables, because they are always mapped to the same point in
> address space. The basic idea of PIE is to build the executables actually
> as shared libraries, so that they can benefit from ASLR just as normal
> shared libraries.
> (The '-pie' flag tells the linker to produce such an executable.)
> 
> However, such a '-pie' executable is not necessarily position independent
> in the literal sense, i.e. might contain text relocations.
> In that sense PIE and text relocations don't exclude each other.
> 

> If you want both NX and ASLR security features for an executable it has
> to be built with '-pie' and must not contain text relocations.

this should not be true
the difference between text relocations and lack there off is that
without text relocations a binary is loaded and written into memory
with text relocations the binary is loaded the addresses for
relocations updated and writen into memory.
There is at a theoretical level no difference in required access rights
write to memory is neccessary at the load stage, no execute is needed
here and once done rights can be fliped over into execute without write
This may very well not work out that way in gnu linux but thats a
implementation problem then not a fundamental issue in NX+ASLR+TEXRELs
That is unless iam missing something

also a simple test:
gcc xtest.c -pie -m32 -o xtest
int main() {
void *ref;
asm (
"mov $main, %0"
:"=r"(ref)
);
printf("? %p\n", ref);
//can we read it ?
printf("R %d\n", *(int*)ref);
//can we write it ?
*(int*)ref = 123;

return 0;
}

Executing this shows that the write is prevented and segfaults, the
address is different on each run and we have a text relocation in it
thats on a ancient ubuntu without special security patches that i
remember

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates


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


Re: [FFmpeg-devel] [PATCH] add hds demuxer

2016-10-14 Thread Steven Liu
2016-10-15 0:10 GMT+08:00 Steven Liu :

>
>
> 2016-10-15 0:04 GMT+08:00 Ricardo Constantino :
>
>>
>> On 2016-10-14 14:53, Steven Liu wrote:
>> > @@ -295,6 +295,7 @@ External library support:
>> > on OSX if openssl and gnutls are not used
>> [autodetect]
>> >--enable-x11grab enable X11 grabbing (legacy) [no]
>> >--disable-xlib   disable xlib [autodetect]
>> > +  --enable-xml2disable XML parsing using the C library
>> libxml2 [no]
>> "enable XML parsing" here.
>> >--disable-zlib   disable zlib [autodetect]
>> >
>> >The following libraries provide various hardware acceleration
>> features:
>> > @@ -1552,6 +1553,7 @@ EXTERNAL_LIBRARY_LIST="
>> >  videotoolbox
>> >  x11grab
>> >  xlib
>> > +xml2
>> >  zlib
>> >  "
>> >
>> > @@ -2854,6 +2856,7 @@ eac3_demuxer_select="ac3_parser"
>> >  f4v_muxer_select="mov_muxer"
>> >  fifo_muxer_deps="threads"
>> >  flac_demuxer_select="flac_parser"
>> > +hds_demuxer_deps="xml2"
>> >  hds_muxer_select="flv_muxer"
>> >  hls_muxer_select="mpegts_muxer"
>> >  image2_alias_pix_demuxer_select="image2_demuxer"
>> > @@ -5675,6 +5678,7 @@ enabled jni   && { [ $target_os =
>> "android" ] && check_header jni.h
>> > check_lib2 "dlfcn.h" dlopen -ldl; }
>> >  enabled ladspa&& { check_header ladspa.h || die "ERROR:
>> ladspa.h header not found"; }
>> >  enabled libiec61883   && require libiec61883
>> libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394
>> -liec61883
>> > +enabled xml2  && { require_pkg_config libxml-2.0
>> libxml2/libxml/xmlversion.h xmlCheckVersion || disabled-xml2; }
>> Just leave the require_pkg_config. If the user enabled xml2 and it wasn't
>> detected then configure is supposed to fail.
>>
> ok let me test it
>
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
>
[root@iZ62asjbo9rZ include]# rm -rf libxml2
[root@iZ62asjbo9rZ include]#
[root@iZ62asjbo9rZ include]#
[root@iZ62asjbo9rZ include]#
[root@iZ62asjbo9rZ include]# exit
exit
[git@iZ62asjbo9rZ include]$
[git@iZ62asjbo9rZ include]$ cd ~/FFmpeg_down/linux/
[git@iZ62asjbo9rZ linux]$ ../configure --disable-everything
--enable-demuxer=hds --disable-yasm --enable-protocol=file
--enable-decoder=h264 --enable-decoder=aac --enable-xml2
ERROR: libxml-2.0 not found using pkg-config

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
ffmpeg-u...@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solve the problem.

the above is:

+enabled xml2  && { require_pkg_config libxml-2.0
libxml2/libxml/xmlversion.h xmlCheckVersion; }


[git@iZ62asjbo9rZ linux]$ vim 。。、^C
[git@iZ62asjbo9rZ linux]$
[git@iZ62asjbo9rZ linux]$ vim ../configure
[git@iZ62asjbo9rZ linux]$ ../configure --disable-everything
--enable-demuxer=hds --disable-yasm --enable-protocol=file
--enable-decoder=h264 --enable-decoder=aac --enable-xml2
ERROR: libxml-2.0 not found using pkg-config

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
ffmpeg-u...@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solve the problem.
[git@iZ62asjbo9rZ linux]$


the above is:

+enabled xml2  && { require_pkg_config libxml-2.0
libxml2/libxml/xmlversion.h xmlCheckVersion || disabled xml2; }



this is reference:

enabled avfoundation_indev && { check_header_objcc
AVFoundation/AVFoundation.h || disable avfoundation_indev; }
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] add hds demuxer

2016-10-14 Thread Steven Liu
2016-10-15 0:04 GMT+08:00 Ricardo Constantino :

>
> On 2016-10-14 14:53, Steven Liu wrote:
> > @@ -295,6 +295,7 @@ External library support:
> > on OSX if openssl and gnutls are not used
> [autodetect]
> >--enable-x11grab enable X11 grabbing (legacy) [no]
> >--disable-xlib   disable xlib [autodetect]
> > +  --enable-xml2disable XML parsing using the C library
> libxml2 [no]
> "enable XML parsing" here.
> >--disable-zlib   disable zlib [autodetect]
> >
> >The following libraries provide various hardware acceleration
> features:
> > @@ -1552,6 +1553,7 @@ EXTERNAL_LIBRARY_LIST="
> >  videotoolbox
> >  x11grab
> >  xlib
> > +xml2
> >  zlib
> >  "
> >
> > @@ -2854,6 +2856,7 @@ eac3_demuxer_select="ac3_parser"
> >  f4v_muxer_select="mov_muxer"
> >  fifo_muxer_deps="threads"
> >  flac_demuxer_select="flac_parser"
> > +hds_demuxer_deps="xml2"
> >  hds_muxer_select="flv_muxer"
> >  hls_muxer_select="mpegts_muxer"
> >  image2_alias_pix_demuxer_select="image2_demuxer"
> > @@ -5675,6 +5678,7 @@ enabled jni   && { [ $target_os =
> "android" ] && check_header jni.h
> > check_lib2 "dlfcn.h" dlopen -ldl; }
> >  enabled ladspa&& { check_header ladspa.h || die "ERROR:
> ladspa.h header not found"; }
> >  enabled libiec61883   && require libiec61883 libiec61883/iec61883.h
> iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
> > +enabled xml2  && { require_pkg_config libxml-2.0
> libxml2/libxml/xmlversion.h xmlCheckVersion || disabled-xml2; }
> Just leave the require_pkg_config. If the user enabled xml2 and it wasn't
> detected then configure is supposed to fail.
>
ok let me test it

> ___
> 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] add hds demuxer

2016-10-14 Thread Steven Liu
patch update.

test passed:
Linux:
../configure
MingW:
../configure --cc='ccache x86_64-w64-mingw32-gcc'   --arch=x86_64 
--target-os=mingw32 --cross-prefix=x86_64-w64-mingw32- --disable-yasm

test passed with hds demux
Linux:
../configure --enable-xml2
OSX:
../configure --disable-everything --enable-demuxer=hds --disable-yasm 
--enable-protocol=file --enable-decoder=h264 --enable-decoder=aac --enable-xml2

init add hds demuxer
TODO: xml parser from libxml to libexpat or simpleparser[implementation by 
myself]
TODO: docs, version bump,
TODO: option passing support (as seperate commit/patch)
TODO: refine AMF parser
TODO: refine Metadata

Based-on: patch by CORY MCCARTHY 
Based-on: patch by Gorilla Maguila 
Signed-off-by: Steven Liu 
---
 configure |4 +
 libavformat/Makefile  |1 +
 libavformat/allformats.c  |2 +-
 libavformat/amfmetadata.c |  219 +
 libavformat/amfmetadata.h |   39 +++
 libavformat/f4fbox.c  |  381 +++
 libavformat/f4fbox.h  |   95 ++
 libavformat/f4mmanifest.c |  324 +++
 libavformat/f4mmanifest.h |   59 
 libavformat/flvtag.c  |  370 ++
 libavformat/flvtag.h  |   32 ++
 libavformat/hdsdec.c  |  759 +
 12 files changed, 2284 insertions(+), 1 deletions(-)
 create mode 100644 libavformat/amfmetadata.c
 create mode 100644 libavformat/amfmetadata.h
 create mode 100644 libavformat/f4fbox.c
 create mode 100644 libavformat/f4fbox.h
 create mode 100644 libavformat/f4mmanifest.c
 create mode 100644 libavformat/f4mmanifest.h
 create mode 100644 libavformat/flvtag.c
 create mode 100644 libavformat/flvtag.h
 create mode 100644 libavformat/hdsdec.c

diff --git a/configure b/configure
index 8d9b21b..6938b28 100755
--- a/configure
+++ b/configure
@@ -295,6 +295,7 @@ External library support:
on OSX if openssl and gnutls are not used 
[autodetect]
   --enable-x11grab enable X11 grabbing (legacy) [no]
   --disable-xlib   disable xlib [autodetect]
+  --enable-xml2enable XML parsing using the C library libxml2 [no]
   --disable-zlib   disable zlib [autodetect]
 
   The following libraries provide various hardware acceleration features:
@@ -1552,6 +1553,7 @@ EXTERNAL_LIBRARY_LIST="
 videotoolbox
 x11grab
 xlib
+xml2
 zlib
 "
 
@@ -2854,6 +2856,7 @@ eac3_demuxer_select="ac3_parser"
 f4v_muxer_select="mov_muxer"
 fifo_muxer_deps="threads"
 flac_demuxer_select="flac_parser"
+hds_demuxer_deps="xml2"
 hds_muxer_select="flv_muxer"
 hls_muxer_select="mpegts_muxer"
 image2_alias_pix_demuxer_select="image2_demuxer"
@@ -5675,6 +5678,7 @@ enabled jni   && { [ $target_os = "android" ] 
&& check_header jni.h
check_lib2 "dlfcn.h" dlopen -ldl; }
 enabled ladspa&& { check_header ladspa.h || die "ERROR: ladspa.h 
header not found"; }
 enabled libiec61883   && require libiec61883 libiec61883/iec61883.h 
iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
+enabled xml2  && { require_pkg_config libxml-2.0 
libxml2/libxml/xmlversion.h xmlCheckVersion || disabled-xml2; }
 enabled libass&& require_pkg_config libass ass/ass.h 
ass_library_init
 enabled libbluray && require_pkg_config libbluray libbluray/bluray.h 
bd_open
 enabled libbs2b   && require_pkg_config libbs2b bs2b.h bs2b_open
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 5d827d3..e2b4dd4 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -202,6 +202,7 @@ OBJS-$(CONFIG_H264_DEMUXER)  += h264dec.o 
rawdec.o
 OBJS-$(CONFIG_H264_MUXER)+= rawenc.o
 OBJS-$(CONFIG_HASH_MUXER)+= hashenc.o
 OBJS-$(CONFIG_HDS_MUXER) += hdsenc.o
+OBJS-$(CONFIG_HDS_DEMUXER)   += hdsdec.o amfmetadata.o 
f4mmanifest.o f4fbox.o flvtag.o
 OBJS-$(CONFIG_HEVC_DEMUXER)  += hevcdec.o rawdec.o
 OBJS-$(CONFIG_HEVC_MUXER)+= rawenc.o
 OBJS-$(CONFIG_HLS_DEMUXER)   += hls.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 6a216ef..39505c3 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -146,9 +146,9 @@ void av_register_all(void)
 REGISTER_MUXDEMUX(H263, h263);
 REGISTER_MUXDEMUX(H264, h264);
 REGISTER_MUXER   (HASH, hash);
-REGISTER_MUXER   (HDS,  hds);
 REGISTER_MUXDEMUX(HEVC, hevc);
 REGISTER_MUXDEMUX(HLS,  hls);
+REGISTER_MUXDEMUX(HDS,  hds);
 REGISTER_DEMUXER (HNM,  hnm);
 REGISTER_MUXDEMUX(ICO,  ico);
 REGISTER_DEMUXER (IDCIN,idcin);
diff --git a/libavformat/amfmetadata.c b/libavformat/amfmetadata.c
new file mode 100644
index 000..0e7a2ea
--- /dev/null
+++ b/libavformat/amfmetadata.c
@@ -0,0 +1,219 @@
+/*
+

Re: [FFmpeg-devel] [PATCH] add hds demuxer

2016-10-14 Thread Ricardo Constantino

On 2016-10-14 14:53, Steven Liu wrote:
> @@ -295,6 +295,7 @@ External library support:
> on OSX if openssl and gnutls are not used 
> [autodetect]
>--enable-x11grab enable X11 grabbing (legacy) [no]
>--disable-xlib   disable xlib [autodetect]
> +  --enable-xml2disable XML parsing using the C library libxml2 
> [no]
"enable XML parsing" here.
>--disable-zlib   disable zlib [autodetect]
>  
>The following libraries provide various hardware acceleration features:
> @@ -1552,6 +1553,7 @@ EXTERNAL_LIBRARY_LIST="
>  videotoolbox
>  x11grab
>  xlib
> +xml2
>  zlib
>  "
>  
> @@ -2854,6 +2856,7 @@ eac3_demuxer_select="ac3_parser"
>  f4v_muxer_select="mov_muxer"
>  fifo_muxer_deps="threads"
>  flac_demuxer_select="flac_parser"
> +hds_demuxer_deps="xml2"
>  hds_muxer_select="flv_muxer"
>  hls_muxer_select="mpegts_muxer"
>  image2_alias_pix_demuxer_select="image2_demuxer"
> @@ -5675,6 +5678,7 @@ enabled jni   && { [ $target_os = "android" 
> ] && check_header jni.h
> check_lib2 "dlfcn.h" dlopen -ldl; }
>  enabled ladspa&& { check_header ladspa.h || die "ERROR: ladspa.h 
> header not found"; }
>  enabled libiec61883   && require libiec61883 libiec61883/iec61883.h 
> iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
> +enabled xml2  && { require_pkg_config libxml-2.0 
> libxml2/libxml/xmlversion.h xmlCheckVersion || disabled-xml2; }
Just leave the require_pkg_config. If the user enabled xml2 and it wasn't 
detected then configure is supposed to fail.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libopenjpegenc: recreate image data buffer after encoding frame

2016-10-14 Thread Andreas Cadhalpun
On 14.10.2016 06:07, Michael Bradshaw wrote:
> On Thu, Oct 13, 2016 at 12:21 PM, Andreas Cadhalpun <
> andreas.cadhal...@googlemail.com> wrote:
>>
>> OK. Attached patch does that for openjpeg 2.
>> I didn't change the behavior for openjpeg 1, as reusing the image works
>> there.
> 
> 
> Looks good to me. Thanks! Please feel free to apply it.

Pushed.

Best regards,
Andreas

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


Re: [FFmpeg-devel] [PATCH]configure: Enable pie for toolchain=hardened.

2016-10-14 Thread Andreas Cadhalpun
On 14.10.2016 15:02, Carl Eugen Hoyos wrote:
> 2016-10-04 12:24 GMT+02:00 Carl Eugen Hoyos :
> 
>> Sorry if I miss something but with this patch, the hardening_check
>> script succeeds here both for x86_32 and x86_64 (static and shared).
> 
> Tested successfully on x86_64 and x86_32 Linux (pie actually works
> on my very old system). On Debian hppa, the patch makes no
> difference, I cannot test m68k.

I guess gcc nowadays just ignores the flag if it wouldn't work.

> Since my gcc manual states that -fPIE is needed for -pie, I decided
> to use that.

In practice it shouldn't make a difference, because -fPIC is added
to CFLAGS after -fPIE anyway, which I think overrides it.

Best regards,
Andreas
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] ffmpeg_cleanup: fix crash with unrecognized codec

2016-10-14 Thread Michael Niedermayer
On Fri, Oct 14, 2016 at 12:33:50AM -0700, James Zern wrote:
> since:
> 3e5e5bd Merge commit '398f015f077c6a2406deffd9e37ff34b9c7bb3bc'
> 
> Signed-off-by: James Zern 
> ---
>  ffmpeg.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu


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


[FFmpeg-devel] [PATCH] libavcodec/nvenc.c: add test for Temporal AQ support

2016-10-14 Thread Sven C. Dack

Adds a check to see if the hardware supports temporal aq.


>From a68d7b359d53a4d858a25a146489f24a39f4dad0 Mon Sep 17 00:00:00 2001
From: "Sven C. Dack" 
Date: Fri, 14 Oct 2016 15:12:27 +0100
Subject: [PATCH] libavcodec/nvenc.c: add test for Temporal AQ support

---
 libavcodec/nvenc.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index e6c1c94..2505c3d 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -356,6 +356,12 @@ static int nvenc_check_capabilities(AVCodecContext *avctx)
 return AVERROR(ENOSYS);
 }
 
+ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_TEMPORAL_AQ);
+if (ctx->temporal_aq > 0 && ret <= 0) {
+av_log(avctx, AV_LOG_VERBOSE, "Temporal AQ not supported\n");
+return AVERROR(ENOSYS);
+}
+
 return 0;
 }
 
-- 
2.9.3

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


Re: [FFmpeg-devel] [PATCH] libopenjpegenc: fix out-of-bounds reads when filling the edges

2016-10-14 Thread Andreas Cadhalpun
On 14.10.2016 06:08, Michael Bradshaw wrote:
> On Thu, Oct 13, 2016 at 6:49 PM, Michael Niedermayer > wrote:
>>
>>>  libopenjpegenc.c |   18 +-
>>>  1 file changed, 9 insertions(+), 9 deletions(-)
>>> 17061aee3e88729993c9581f688cbfda01fccaac  0001-libopenjpegenc-fix-out-
>> of-bounds-reads-when-filling-.patch
>>> From 1461064c1eaabb71661f9ff68b94f35a1b98e3b5 Mon Sep 17 00:00:00 2001
>>> From: Andreas Cadhalpun 
>>> Date: Thu, 13 Oct 2016 22:14:46 +0200
>>> Subject: [PATCH] libopenjpegenc: fix out-of-bounds reads when filling the
>>>  edges
>>>
>>> The calculation of width/height should round up, not round down to
>>> prevent setting width or height to 0.
>>>
>>> Also image->comps[compno].w is unsigned (at least in openjpeg2), so the
>>> calculation could silently wrap around without the explicit cast to int.
>>
>> LGTM, iam not libopenjpegenc maintainer though
> 
> 
> Looks good to me too. Please feel free to apply it. Thanks!

Pushed.

Best regards,
Andreas

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


Re: [FFmpeg-devel] [PATCH] add hds demuxer

2016-10-14 Thread Steven Liu
2016-10-14 22:31 GMT+08:00 Nicolas George :

> Le tridi 23 vendémiaire, an CCXXV, Steven Liu a écrit :
> > > Rather than NIHing it, I think using libexpat would be a good choice
> > > (even if its API is terrible).
> > ok, i'll learn how to use it, and use it next step. :-)
>
> While I agree that expat is way better than libxml2 for that task, it is
> still an external library. If on top of that the API is terrible, I do not
> see a very strong case, I am still rather in favour of a minimalistic XML
> parser in lavu. Of course, whoever does the work has the most say in the
> matter.
>
 I think it's hard work for me,  but i'll do my best.
 I have list the TODO for next step in the new patch comments.

> 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


Re: [FFmpeg-devel] [PATCH] add hds demuxer

2016-10-14 Thread Nicolas George
Le tridi 23 vendémiaire, an CCXXV, Steven Liu a écrit :
> > Rather than NIHing it, I think using libexpat would be a good choice
> > (even if its API is terrible).
> ok, i'll learn how to use it, and use it next step. :-)

While I agree that expat is way better than libxml2 for that task, it is
still an external library. If on top of that the API is terrible, I do not
see a very strong case, I am still rather in favour of a minimalistic XML
parser in lavu. Of course, whoever does the work has the most say in the
matter.

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] add hds demuxer

2016-10-14 Thread Steven Liu
patch update.

test passed:
Linux:
../configure
MingW:
../configure --cc='ccache x86_64-w64-mingw32-gcc'   --arch=x86_64 
--target-os=mingw32 --cross-prefix=x86_64-w64-mingw32- --disable-yasm

test passed with hds demux
Linux:
../configure --enable-xml2
OSX:
../configure --disable-everything --enable-demuxer=hds --disable-yasm 
--enable-protocol=file --enable-decoder=h264 --enable-decoder=aac --enable-xml2

init add hds demuxer
TODO: xml parser from libxml to libexpat or simpleparser[implementation by 
myself]
TODO: docs, version bump,
TODO: option passing support (as seperate commit/patch)
TODO: refine AMF parser
TODO: refine Metadata

Based-on: patch by CORY MCCARTHY 
Based-on: patch by Gorilla Maguila 
Signed-off-by: Steven Liu 
---
 configure |4 +
 libavformat/Makefile  |1 +
 libavformat/allformats.c  |2 +-
 libavformat/amfmetadata.c |  219 +
 libavformat/amfmetadata.h |   39 +++
 libavformat/f4fbox.c  |  381 +++
 libavformat/f4fbox.h  |   95 ++
 libavformat/f4mmanifest.c |  324 +++
 libavformat/f4mmanifest.h |   59 
 libavformat/flvtag.c  |  370 ++
 libavformat/flvtag.h  |   32 ++
 libavformat/hdsdec.c  |  759 +
 12 files changed, 2284 insertions(+), 1 deletions(-)
 create mode 100644 libavformat/amfmetadata.c
 create mode 100644 libavformat/amfmetadata.h
 create mode 100644 libavformat/f4fbox.c
 create mode 100644 libavformat/f4fbox.h
 create mode 100644 libavformat/f4mmanifest.c
 create mode 100644 libavformat/f4mmanifest.h
 create mode 100644 libavformat/flvtag.c
 create mode 100644 libavformat/flvtag.h
 create mode 100644 libavformat/hdsdec.c

diff --git a/configure b/configure
index 8d9b21b..6938b28 100755
--- a/configure
+++ b/configure
@@ -295,6 +295,7 @@ External library support:
on OSX if openssl and gnutls are not used 
[autodetect]
   --enable-x11grab enable X11 grabbing (legacy) [no]
   --disable-xlib   disable xlib [autodetect]
+  --enable-xml2disable XML parsing using the C library libxml2 [no]
   --disable-zlib   disable zlib [autodetect]
 
   The following libraries provide various hardware acceleration features:
@@ -1552,6 +1553,7 @@ EXTERNAL_LIBRARY_LIST="
 videotoolbox
 x11grab
 xlib
+xml2
 zlib
 "
 
@@ -2854,6 +2856,7 @@ eac3_demuxer_select="ac3_parser"
 f4v_muxer_select="mov_muxer"
 fifo_muxer_deps="threads"
 flac_demuxer_select="flac_parser"
+hds_demuxer_deps="xml2"
 hds_muxer_select="flv_muxer"
 hls_muxer_select="mpegts_muxer"
 image2_alias_pix_demuxer_select="image2_demuxer"
@@ -5675,6 +5678,7 @@ enabled jni   && { [ $target_os = "android" ] 
&& check_header jni.h
check_lib2 "dlfcn.h" dlopen -ldl; }
 enabled ladspa&& { check_header ladspa.h || die "ERROR: ladspa.h 
header not found"; }
 enabled libiec61883   && require libiec61883 libiec61883/iec61883.h 
iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
+enabled xml2  && { require_pkg_config libxml-2.0 
libxml2/libxml/xmlversion.h xmlCheckVersion || disabled-xml2; }
 enabled libass&& require_pkg_config libass ass/ass.h 
ass_library_init
 enabled libbluray && require_pkg_config libbluray libbluray/bluray.h 
bd_open
 enabled libbs2b   && require_pkg_config libbs2b bs2b.h bs2b_open
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 5d827d3..e2b4dd4 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -202,6 +202,7 @@ OBJS-$(CONFIG_H264_DEMUXER)  += h264dec.o 
rawdec.o
 OBJS-$(CONFIG_H264_MUXER)+= rawenc.o
 OBJS-$(CONFIG_HASH_MUXER)+= hashenc.o
 OBJS-$(CONFIG_HDS_MUXER) += hdsenc.o
+OBJS-$(CONFIG_HDS_DEMUXER)   += hdsdec.o amfmetadata.o 
f4mmanifest.o f4fbox.o flvtag.o
 OBJS-$(CONFIG_HEVC_DEMUXER)  += hevcdec.o rawdec.o
 OBJS-$(CONFIG_HEVC_MUXER)+= rawenc.o
 OBJS-$(CONFIG_HLS_DEMUXER)   += hls.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 6a216ef..39505c3 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -146,9 +146,9 @@ void av_register_all(void)
 REGISTER_MUXDEMUX(H263, h263);
 REGISTER_MUXDEMUX(H264, h264);
 REGISTER_MUXER   (HASH, hash);
-REGISTER_MUXER   (HDS,  hds);
 REGISTER_MUXDEMUX(HEVC, hevc);
 REGISTER_MUXDEMUX(HLS,  hls);
+REGISTER_MUXDEMUX(HDS,  hds);
 REGISTER_DEMUXER (HNM,  hnm);
 REGISTER_MUXDEMUX(ICO,  ico);
 REGISTER_DEMUXER (IDCIN,idcin);
diff --git a/libavformat/amfmetadata.c b/libavformat/amfmetadata.c
new file mode 100644
index 000..0e7a2ea
--- /dev/null
+++ b/libavformat/amfmetadata.c
@@ -0,0 +1,219 @@
+/*

Re: [FFmpeg-devel] h264_nvenc encoding issue

2016-10-14 Thread Sven C. Dack

On 14/10/16 13:47, tyt xtreme wrote:

Hi,

I already post my mail to ffmpeg-users group regarding this issue but no
one could help me out and advised to ask more experienced users. So i hope
you can tell me something and sorry posting here.

Here is my re-encoding command's output (Windows 8.1 with Bash):
*$ ffmpeg -i perspective.mp4 -c:v h264_nvenc -profile:v high -preset:v fast
perspective_out.mp4*


Thanks for the pictures. Could you also provide a piece of the original video 
file?

Also, please stay on the ffmpeg-user list. ffmpeg-devel is primarily for 
development of ffmpeg, where people send in patches and discuss implementation 
details. We still need to figure out if your problem can be reproduced and where 
it originates from before we can conclude anything (i.e. if its a user error or 
a software error).


Cheers





ffmpeg version N-81960-g1bda0ee Copyright (c) 2000-2016 the FFmpeg
developers
   built with gcc 5.4.0 (GCC)
   configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth
--enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme
--enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264
--enable-libopenjpeg --enable-libopus --enable-librtmp
--enable-libschroedinger --enable-libsnappy --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg
--enable-lzma --enable-decklink --enable-zlib
   libavutil  55. 32.100 / 55. 32.100
   libavcodec 57. 61.100 / 57. 61.100
   libavformat57. 51.103 / 57. 51.103
   libavdevice57.  0.102 / 57.  0.102
   libavfilter 6. 63.100 /  6. 63.100
   libswscale  4.  1.100 /  4.  1.100
   libswresample   2.  2.100 /  2.  2.100
   libpostproc54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'perspective.mp4':
   Metadata:
 major_brand : isom
 minor_version   : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf57.50.100
   Duration: 00:07:27.87, start: 2.132000, bitrate: 10235 kb/s
 Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 /
0x31637661), yuv420p(tv, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 10233 kb/s,
24.94 fps, 29.97 tbr, 1000k tbn, 2000k tbc (default)
 Metadata:
   handler_name: VideoHandler
File 'perspective_out.mp4' already exists. Overwrite ? [y/N] y
Output #0, mp4, to 'perspective_out.mp4':
   Metadata:
 major_brand : isom
 minor_version   : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf57.51.103
 Stream #0:0(eng): Video: h264 (h264_nvenc) (High) ([33][0][0][0] /
0x0021), yuv420p, 3840x2160 [SAR 1:1 DAR 16:9], q=-1--1, 2000 kb/s, 29.97
fps, 30k tbn, 29.97 tbc (default)
 Metadata:
   handler_name: VideoHandler
   encoder : Lavc57.61.100 h264_nvenc
 Side data:
   cpb: bitrate max/min/avg: 0/0/200 buffer size: 400 vbv_delay:
-1
Stream mapping:
   Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_nvenc))
Press [q] to stop, [?] for help
Past duration 0.731316 too large8815kB time=00:00:27.22
bitrate=2652.4kbits/s dup=206 drop=0 speed=3.95x


The output is far away from optimal. It's kind of green,red colored &
ghosty. Attached - resized - image samples about the original and output
frames. Any idea why encoder doing this? I'm using GeForce GTX 980 Ti 6Gb
GPU.

Thanks!


___
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


Re: [FFmpeg-devel] [PATCH] add hds demuxer

2016-10-14 Thread Steven Liu
2016-10-14 20:32 GMT+08:00 Carl Eugen Hoyos :

> 2016-10-13 16:15 GMT+02:00 Steven Liu :
>
> > Is this right? Or can you give me a doc link to learn this.
>
> I am not really a "doc" type, more "trial-and-error", sorry.
>
Sorry for my abbreviations , s/doc/documentation/g

>
> You should - imo - take your original patch as you sent it,
> temporarily move the libxml2 header on your system away
> and make sure that FFmpeg still builds (without hds support).
> The zmbv decoder would be an example of a component
> that similarly depends on a systems library.
>
patch will update.

>
> In any case, you have check wm4's suggestion and if you
> don't like it, you have to explain why.
>
> Carl Eugen
> ___
> 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


Re: [FFmpeg-devel] [PATCH] add hds demuxer

2016-10-14 Thread Steven Liu
2016-10-14 20:00 GMT+08:00 wm4 :

> On Thu, 13 Oct 2016 11:27:12 +0200
> Nicolas George  wrote:
>
> > Le duodi 22 vendémiaire, an CCXXV, Steven Liu a écrit :
> > > init add hds demuxer
> > >
> > > Based-on: patch by CORY MCCARTHY 
> > > Based-on: patch by Gorilla Maguila 
> > > Signed-off-by: Steven Liu 
> >
> > Thanks for the update.
> >
> > I think I already said it when it was first submitted: I am not really
> happy
> > about the use of libxml2. I remember a time when libxml2 was a "security
> > advisory of the week" kind of library, and looking at the changelog, it
> does
> > not seem to have progressed a lot since.
> >
> > To be fair, implementing a full-featured XML parser is very hard work and
> > time-consuming.
> >
> > But really, almost nobody needs that, and especially not FFmpeg. What we
> > need is a parser capable of reading elements, attributes, text in three
> > standard encodings, and that is all. Implementing this should be
> reasonably
> > short work for a decent developer.
> >
> > Of course, since I can not volunteer to do it myself soon, I will not
> > consider it grounds for rejecting the patch. But please consider it. If
> > libxml2 is enabled by default, that makes it a security concern; if it is
> > not, that gives this code much less usefulness and testing.
> >
> > Regards,
> >
>
> Rather than NIHing it, I think using libexpat would be a good choice
> (even if its API is terrible).
>
ok, i'll learn how to use it, and use it next step. :-)

> ___
> 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


Re: [FFmpeg-devel] [PATCH] mov: move stsd finalization to an appropriate place

2016-10-14 Thread Carl Eugen Hoyos
2016-10-14 13:56 GMT+02:00 Hendrik Leppkes :
> mov_finalize_stsd_codec parses stream information from the ALAC extradata,
> so run it after the extradata processing is completed in mov_read_stsd.

Please mention ticket #5826 if your patch fixes the issue.

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


Re: [FFmpeg-devel] [PATCH] avfilter/af_silenceremove: add optional tone when silence is removed

2016-10-14 Thread Moritz Barsnick
>  enum SilenceMode {
> -SILENCE_TRIM,
> +SILENCE_TRIM = 0,
>  SILENCE_TRIM_FLUSH,
>  SILENCE_COPY,
>  SILENCE_COPY_FLUSH,
> -SILENCE_STOP
> +SILENCE_STOP,
> +SILENCE_END_MARKER
> +};
> +
> +static const char* SILENCE_MODE_NAMES[] = {
> +NULL_IF_CONFIG_SMALL("TRIM"),
> +NULL_IF_CONFIG_SMALL("TRIM_FLUSH"),
> +NULL_IF_CONFIG_SMALL("COPY"),
> +NULL_IF_CONFIG_SMALL("COPY_FLUSH"),
> +NULL_IF_CONFIG_SMALL("STOP")
>  };

This (and related functions) is probably unrelated to the feature
you're adding, and rather a commodity, so I guess it should be in a
separate patch.

And I personally would probably name the frequency option
"tone_frequency" as just that, and not with its unit Hz as "tone_hz",
but that's cosmetic.

Moritz

P.S.: Nice feature for debug.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH]lavf/rtp_g726: Map mime type G726 to the g726le decoder

2016-10-14 Thread Carl Eugen Hoyos
Hi!

Attached patch fixes ticket #5890, completely untested.

Please comment, Carl Eugen
From 8c5bb7f00be92f3adf08a6d46a6888dd2ab707b5 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Fri, 14 Oct 2016 15:05:05 +0200
Subject: [PATCH] lavf/rtpdec_g726: Map mime type G726 to g726le.

Add new mime types AAL2-G726 for g726 as suggested in rfc 3551.

This patch will break applications that incorrectly use big-endian
G.726 with mime type G726 but we know of at least one device (DVTel
camera) that correctly implements the rfc, so do the same.

Fixes ticket #5890.
---
 Changelog |1 +
 libavformat/rtpdec_g726.c |8 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 32f0bd4..2b8b5e1 100644
--- a/Changelog
+++ b/Changelog
@@ -37,6 +37,7 @@ version :
 - libfaac encoder removed
 - Matroska muxer now writes CRC32 elements by default in all Level 1 elements
 - sidedata video and asidedata audio filter
+- Changed mapping of rtp MIME type G726 to codec g726le.
 
 
 version 3.1:
diff --git a/libavformat/rtpdec_g726.c b/libavformat/rtpdec_g726.c
index 172a4b3..2de09ac 100644
--- a/libavformat/rtpdec_g726.c
+++ b/libavformat/rtpdec_g726.c
@@ -36,10 +36,16 @@ static av_cold int g726_ ## bitrate ##_init(AVFormatContext 
*s, int st_index, \
 } \
 \
 RTPDynamicProtocolHandler ff_g726_ ## bitrate ## _dynamic_handler = { \
-.enc_name   = "G726-" #bitrate, \
+.enc_name   = "AAL2-G726-" #bitrate, \
 .codec_type = AVMEDIA_TYPE_AUDIO, \
 .codec_id   = AV_CODEC_ID_ADPCM_G726, \
 .init   = g726_ ## bitrate ## _init, \
+}; \
+RTPDynamicProtocolHandler ff_g726le_ ## bitrate ## _dynamic_handler = { \
+.enc_name   = "G726-" #bitrate, \
+.codec_type = AVMEDIA_TYPE_AUDIO, \
+.codec_id   = AV_CODEC_ID_ADPCM_G726LE, \
+.init   = g726_ ## bitrate ## _init, \
 }
 
 RTP_G726_HANDLER(16);
-- 
1.7.10.4

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


Re: [FFmpeg-devel] [PATCH]configure: Enable pie for toolchain=hardened.

2016-10-14 Thread Carl Eugen Hoyos
2016-10-04 12:24 GMT+02:00 Carl Eugen Hoyos :

> Sorry if I miss something but with this patch, the hardening_check
> script succeeds here both for x86_32 and x86_64 (static and shared).

Tested successfully on x86_64 and x86_32 Linux (pie actually works
on my very old system). On Debian hppa, the patch makes no
difference, I cannot test m68k.

Since my gcc manual states that -fPIE is needed for -pie, I decided
to use that.

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


Re: [FFmpeg-devel] [PATCH] add hds demuxer

2016-10-14 Thread Carl Eugen Hoyos
2016-10-13 16:15 GMT+02:00 Steven Liu :

> Is this right? Or can you give me a doc link to learn this.

I am not really a "doc" type, more "trial-and-error", sorry.

You should - imo - take your original patch as you sent it,
temporarily move the libxml2 header on your system away
and make sure that FFmpeg still builds (without hds support).
The zmbv decoder would be an example of a component
that similarly depends on a systems library.

In any case, you have check wm4's suggestion and if you
don't like it, you have to explain why.

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


[FFmpeg-devel] [PATCH] mov: move stsd finalization to an appropriate place

2016-10-14 Thread Hendrik Leppkes
mov_finalize_stsd_codec parses stream information from the ALAC extradata,
so run it after the extradata processing is completed in mov_read_stsd.

Fixes playback of 96kHz ALAC streams muxed by qaac or the reference alac 
encoder.
---
 libavformat/mov.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index a15c8d1..5ede1ed 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2288,7 +2288,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext 
*pb, int entries)
 if (pb->eof_reached)
 return AVERROR_EOF;
 
-return mov_finalize_stsd_codec(c, pb, st, sc);
+return 0;
 }
 
 static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
@@ -2340,7 +2340,7 @@ static int mov_read_stsd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 memcpy(st->codecpar->extradata, sc->extradata[0], 
sc->extradata_size[0]);
 }
 
-return 0;
+return mov_finalize_stsd_codec(c, pb, st, sc);
 fail:
 av_freep(&sc->extradata);
 av_freep(&sc->extradata_size);
-- 
2.10.1.windows.1

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


Re: [FFmpeg-devel] [PATCH] add hds demuxer

2016-10-14 Thread wm4
On Thu, 13 Oct 2016 11:27:12 +0200
Nicolas George  wrote:

> Le duodi 22 vendémiaire, an CCXXV, Steven Liu a écrit :
> > init add hds demuxer
> > 
> > Based-on: patch by CORY MCCARTHY 
> > Based-on: patch by Gorilla Maguila 
> > Signed-off-by: Steven Liu   
> 
> Thanks for the update.
> 
> I think I already said it when it was first submitted: I am not really happy
> about the use of libxml2. I remember a time when libxml2 was a "security
> advisory of the week" kind of library, and looking at the changelog, it does
> not seem to have progressed a lot since.
> 
> To be fair, implementing a full-featured XML parser is very hard work and
> time-consuming.
> 
> But really, almost nobody needs that, and especially not FFmpeg. What we
> need is a parser capable of reading elements, attributes, text in three
> standard encodings, and that is all. Implementing this should be reasonably
> short work for a decent developer.
> 
> Of course, since I can not volunteer to do it myself soon, I will not
> consider it grounds for rejecting the patch. But please consider it. If
> libxml2 is enabled by default, that makes it a security concern; if it is
> not, that gives this code much less usefulness and testing.
> 
> Regards,
> 

Rather than NIHing it, I think using libexpat would be a good choice
(even if its API is terrible).
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] openssl: Support version 1.1.0.

2016-10-14 Thread wm4
On Mon, 10 Oct 2016 02:39:51 +1100
Matt Oliver  wrote:

> ---
>  configure |   3 +-
>  libavformat/tls_openssl.c | 159
> --
>  2 files changed, 98 insertions(+), 64 deletions(-)
> 
> diff --git a/configure b/configure
> index df6ffa2..750684a 100755
> --- a/configure
> +++ b/configure
> @@ -5813,7 +5813,8 @@ enabled omx   && { check_header
> OMX_Core.h ||
>  add_cflags -isystem/opt/vc/include/IL
> ; }
>  check_header OMX_Core.h ; } ||
> die "ERROR: OpenMAX IL headers not found"; }
> -enabled openssl   && { use_pkg_config openssl openssl/ssl.h
> SSL_library_init ||
> +enabled openssl   && { use_pkg_config openssl openssl/ssl.h
> OPENSSL_init_ssl ||
> +   use_pkg_config openssl openssl/ssl.h
> SSL_library_init ||
> check_lib openssl/ssl.h SSL_library_init
> -lssl -lcrypto ||
> check_lib openssl/ssl.h SSL_library_init
> -lssl32 -leay32 ||
> check_lib openssl/ssl.h SSL_library_init
> -lssl -lcrypto -lws2_32 -lgdi32 ||
> diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
> index 46eb3e6..4effb39 100644
> --- a/libavformat/tls_openssl.c
> +++ b/libavformat/tls_openssl.c
> @@ -63,6 +63,85 @@ static unsigned long openssl_thread_id(void)
>  #endif
>  #endif
> 
> +static int url_bio_create(BIO *b)
> +{
> +#if OPENSSL_VERSION_NUMBER >= 0x101fL
> +BIO_set_init(b, 1);
> +BIO_set_data(b, NULL);
> +BIO_set_flags(b, 0);
> +#else
> +b->init = 1;
> +b->ptr = NULL;
> +b->flags = 0;
> +#endif
> +return 1;
> +}
> +
> +static int url_bio_destroy(BIO *b)
> +{
> +return 1;
> +}
> +
> +#if OPENSSL_VERSION_NUMBER >= 0x101fL
> +#define BIO_GET_DATA(x) BIO_get_data(x);
> +#else
> +#define BIO_GET_DATA(x) x->ptr;
> +#endif
> +
> +static int url_bio_bread(BIO *b, char *buf, int len)
> +{
> +URLContext *h = BIO_GET_DATA(b);
> +int ret = ffurl_read(h, buf, len);
> +if (ret >= 0)
> +return ret;
> +BIO_clear_retry_flags(b);
> +if (ret == AVERROR_EXIT)
> +return 0;
> +return -1;
> +}
> +
> +static int url_bio_bwrite(BIO *b, const char *buf, int len)
> +{
> +URLContext *h = BIO_GET_DATA(b);
> +int ret = ffurl_write(h, buf, len);
> +if (ret >= 0)
> +return ret;
> +BIO_clear_retry_flags(b);
> +if (ret == AVERROR_EXIT)
> +return 0;
> +return -1;
> +}
> +
> +static long url_bio_ctrl(BIO *b, int cmd, long num, void *ptr)
> +{
> +if (cmd == BIO_CTRL_FLUSH) {
> +BIO_clear_retry_flags(b);
> +return 1;
> +}
> +return 0;
> +}
> +
> +static int url_bio_bputs(BIO *b, const char *str)
> +{
> +return url_bio_bwrite(b, str, strlen(str));
> +}
> +
> +#if OPENSSL_VERSION_NUMBER >= 0x101fL
> +static BIO_METHOD* url_bio_method;

More global mutable data? Are you serious? We've been trying our best
to avoid these, and only awful APIs like OpenSSL or GnuTLS force us to
have them (as well as our own awful APIs). Please remove this global if
possible.

> +#else
> +static BIO_METHOD url_bio_method = {
> +.type = BIO_TYPE_SOURCE_SINK,
> +.name = "urlprotocol bio",
> +.bwrite = url_bio_bwrite,
> +.bread = url_bio_bread,
> +.bputs = url_bio_bputs,
> +.bgets = NULL,
> +.ctrl = url_bio_ctrl,
> +.create = url_bio_create,
> +.destroy = url_bio_destroy,
> +};
> +#endif
> +
>  int ff_openssl_init(void)
>  {
>  avpriv_lock_avformat();
> @@ -86,6 +165,15 @@ int ff_openssl_init(void)
>  #endif
>  }
>  #endif
> +#if OPENSSL_VERSION_NUMBER >= 0x101fL
> +url_bio_method = BIO_meth_new(BIO_TYPE_SOURCE_SINK, "urlprotocol
> bio");
> +BIO_meth_set_write(url_bio_method, url_bio_bwrite);
> +BIO_meth_set_read(url_bio_method, url_bio_bread);
> +BIO_meth_set_puts(url_bio_method, url_bio_bputs);
> +BIO_meth_set_ctrl(url_bio_method, url_bio_ctrl);
> +BIO_meth_set_create(url_bio_method, url_bio_create);
> +BIO_meth_set_destroy(url_bio_method, url_bio_destroy);
> +#endif
>  }
>  openssl_init++;
>  avpriv_unlock_avformat();
> @@ -107,6 +195,9 @@ void ff_openssl_deinit(void)
>  av_free(openssl_mutexes);
>  }
>  #endif
> +#if OPENSSL_VERSION_NUMBER >= 0x101fL
> +BIO_meth_free(url_bio_method);
> +#endif
>  }
>  avpriv_unlock_avformat();
>  }
> @@ -132,69 +223,6 @@ static int tls_close(URLContext *h)
>  return 0;
>  }
> 
> -static int url_bio_create(BIO *b)
> -{
> -b->init = 1;
> -b->ptr = NULL;
> -b->flags = 0;
> -return 1;
> -}
> -
> -static int url_bio_destroy(BIO *b)
> -{
> -return 1;
> -}
> -
> -static int url_bio_bread(BIO *b, char *buf, int len)
> -{
> -URLContext *h = b->ptr;
> -int ret = ffurl_read(h, buf, len);
> -if (ret

Re: [FFmpeg-devel] [PATCH] Select cubic and lanczos as alternative where super-sampling is not supported

2016-10-14 Thread Sven C. Dack

*ping*

The patch didn't seem to have caught anyone's interest. Could somebody please 
apply it or say what's wrong?


Thanks

On 09/09/16 10:55, Sven C. Dack wrote:
CUDA/NPP doesn't allow super-sampling in some cases and the module then prints 
an error message "NPP resize error: -23".


Example:
$ ffmpeg -f lavfi -i testsrc=duration=1:size=hd1080:rate=1 -pix_fmt nv12 -vf 
hwupload_cuda,scale_npp=w=1920:h=720:interp_algo=super:format=nv12,hwdownload 
-f null -

ffmpeg version N-81609-g7b3bc36 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 6.2.0 (GCC)
  configuration: --prefix=/home/sven/av --enable-gpl --enable-version3 
--enable-nonfree --arch=x86_64 --cpu=native --enable-debug --disable-shared 
--enable-static --enable-libvorbis --enable-libopus --enable-libx264 
--enable-libx265 --enable-opengl --enable-opencl --enable-vaapi --enable-vdpau 
--enable-cuda --enable-cuvid --enable-nvenc --enable-libnpp 
--extra-cflags='-I/home/sven/av/include -I/usr/local/cuda/include 
-I/usr/local/Video_Codec_SDK_7.0.1/Samples/common/inc' 
--extra-ldflags='-L/home/sven/av/lib -L/usr/local/cuda/lib64' --ar=gcc-ar 
--nm=gcc-nm --ranlib=true

  libavutil  55. 29.100 / 55. 29.100
  libavcodec 57. 55.101 / 57. 55.101
  libavformat57. 48.103 / 57. 48.103
  libavdevice57.  0.102 / 57.  0.102
  libavfilter 6. 61.100 /  6. 61.100
  libswscale  4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc54.  0.100 / 54.  0.100
Input #0, lavfi, from 'testsrc=duration=1:size=hd1080:rate=1':
  Duration: N/A, start: 0.00, bitrate: N/A
Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 1920x1080 [SAR 
1:1 DAR 16:9], 1 tbr, 1 tbn, 1 tbc
[null @ 0x36aa440] Using AVStream.codec to pass codec parameters to muxers is 
deprecated, use AVStream.codecpar instead.

Output #0, null, to 'pipe:':
  Metadata:
encoder : Lavf57.48.103
Stream #0:0: Video: wrapped_avframe, nv12, 1920x720 [SAR 2:3 DAR 16:9], 
q=2-31, 200 kb/s, 1 fps, 1 tbn, 1 tbc

Metadata:
  encoder : Lavc57.55.101 wrapped_avframe
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
[Parsed_scale_npp_1 @ 0x3ae8fa0] NPP resize error: -23
Failed to inject frame into filter network: Unknown error occurred
Conversion failed!

Super-sampling is currently only supported by CUDA/NPP when the output 
dimensions are both smaller than the input dimensions. The patch lets ffmpeg 
select an alternative algorithm and prints a warning in such cases.


Sven




___
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] ffmpeg_cleanup: fix crash with unrecognized codec

2016-10-14 Thread James Zern
since:
3e5e5bd Merge commit '398f015f077c6a2406deffd9e37ff34b9c7bb3bc'

Signed-off-by: James Zern 
---
 ffmpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 693981f..af8ed76 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -533,7 +533,7 @@ static void ffmpeg_cleanup(int ret)
 avcodec_free_context(&ost->enc_ctx);
 avcodec_parameters_free(&ost->ref_par);
 
-while (av_fifo_size(ost->muxing_queue)) {
+while (ost->muxing_queue && av_fifo_size(ost->muxing_queue)) {
 AVPacket pkt;
 av_fifo_generic_read(ost->muxing_queue, &pkt, sizeof(pkt), NULL);
 av_packet_unref(&pkt);
-- 
2.8.0.rc3.226.g39d4020

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