[FFmpeg-devel] [PATCH 1/4] avcodec/metasound_data: remove unused variable

2015-08-20 Thread Ganesh Ajjanagadde
Fixes -Wunused-const-variable from
http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1

Signed-off-by: Ganesh Ajjanagadde 
---
 libavcodec/metasound_data.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/libavcodec/metasound_data.c b/libavcodec/metasound_data.c
index e439b3d..da2548a 100644
--- a/libavcodec/metasound_data.c
+++ b/libavcodec/metasound_data.c
@@ -14946,10 +14946,6 @@ static const uint16_t bark_tab_s16_128[] = {
 2, 2, 2, 3, 3, 5, 7, 12, 25, 67
 };
 
-static const uint16_t bark_tab_s16_64[] = {
-1, 1, 2, 2, 3, 6, 11, 38
-};
-
 static const uint16_t bark_tab_l16s_1024[] = {
   9,   9,   8,   9,  10,   9,  10,  10,
  10,  12,  11,  13,  13,  14,  16,  17,
-- 
2.5.0

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


[FFmpeg-devel] [PATCH 2/4] avcodec/aacsbr_fixed: remove unused variable

2015-08-20 Thread Ganesh Ajjanagadde
Fixes -Wunused-const-variable from
http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1

Signed-off-by: Ganesh Ajjanagadde 
---
 libavcodec/aacsbr_fixed.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/aacsbr_fixed.c b/libavcodec/aacsbr_fixed.c
index 5a5c9cc..1fc7385 100644
--- a/libavcodec/aacsbr_fixed.c
+++ b/libavcodec/aacsbr_fixed.c
@@ -76,7 +76,6 @@ static VLC vlc_sbr[10];
 static void aacsbr_func_ptr_init(AACSBRContext *c);
 static const int CONST_LN2   = Q31(0.6931471806/256);  // ln(2)/256
 static const int CONST_RECIP_LN2 = Q31(0.7213475204);  // 0.5/ln(2)
-static const int CONST_SQRT2 = Q30(0.7071067812);  // sqrt(2)/2
 static const int CONST_076923= Q31(0.76923076923076923077f);
 
 int fixed_log_table[10] =
-- 
2.5.0

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


[FFmpeg-devel] [PATCH 3/4] avformat/ftp: use correct enum type

2015-08-20 Thread Ganesh Ajjanagadde
Fixes -Wenum-conversion from
http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1

Signed-off-by: Ganesh Ajjanagadde 
---
 libavformat/ftp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/ftp.c b/libavformat/ftp.c
index 51f491c..dcb588d 100644
--- a/libavformat/ftp.c
+++ b/libavformat/ftp.c
@@ -651,7 +651,7 @@ static int ftp_connect(URLContext *h, const char *url)
 FTPContext *s = h->priv_data;
 
 s->state = DISCONNECTED;
-s->listing_method = UNKNOWN;
+s->listing_method = UNKNOWN_METHOD;
 s->filesize = -1;
 s->position = 0;
 s->features = NULL;
-- 
2.5.0

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


[FFmpeg-devel] [PATCH 4/4] avformat/webmdashenc: fix uninitialized variable

2015-08-20 Thread Ganesh Ajjanagadde
Fixes -Wsometimes-uninitialized from
http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1

Signed-off-by: Ganesh Ajjanagadde 
---
 libavformat/webmdashenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
index 76ea423..ecce4d3 100644
--- a/libavformat/webmdashenc.c
+++ b/libavformat/webmdashenc.c
@@ -388,7 +388,7 @@ static int write_adaptation_set(AVFormatContext *s, int 
as_index)
 
 for (i = 0; i < as->nb_streams; i++) {
 char *representation_id = NULL;
-int ret;
+int ret = -1;
 if (w->is_live) {
 AVDictionaryEntry *filename =
 av_dict_get(s->streams[as->streams[i]]->metadata, FILENAME, 
NULL, 0);
-- 
2.5.0

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


Re: [FFmpeg-devel] [PATCH 1/4] avcodec/metasound_data: remove unused variable

2015-08-20 Thread Ganesh Ajjanagadde
On Thu, Aug 20, 2015 at 4:28 AM, Ganesh Ajjanagadde
 wrote:
> Fixes -Wunused-const-variable from
> http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1
>
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libavcodec/metasound_data.c | 4 
>  1 file changed, 4 deletions(-)
>
> diff --git a/libavcodec/metasound_data.c b/libavcodec/metasound_data.c
> index e439b3d..da2548a 100644
> --- a/libavcodec/metasound_data.c
> +++ b/libavcodec/metasound_data.c
> @@ -14946,10 +14946,6 @@ static const uint16_t bark_tab_s16_128[] = {
>  2, 2, 2, 3, 3, 5, 7, 12, 25, 67
>  };
>
> -static const uint16_t bark_tab_s16_64[] = {
> -1, 1, 2, 2, 3, 6, 11, 38
> -};
> -
>  static const uint16_t bark_tab_l16s_1024[] = {
>9,   9,   8,   9,  10,   9,  10,  10,
>   10,  12,  11,  13,  13,  14,  16,  17,
> --
> 2.5.0
>

Some comments:
1. I am still working on the remaining warnings and sent these mainly
for feedback.
If people think these are too trivial/waste of time I will refrain
from these in future.
2. If above are ok, I can squash complete warning cleanup (from this
file) into single
patch if that is preferred.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] lavf/http: Parse and/or expose various client data.

2015-08-20 Thread Nicolas George
Thanks for the patch. A few remarks, specific to the stand-alone-commit
version or that I had not yet spotted.


Le tridi 3 fructidor, an CCXXIII, Stephan Holljes a écrit :
> Signed-off-by: Stephan Holljes 
> ---
>  libavformat/http.c | 40 ++--
>  1 file changed, 38 insertions(+), 2 deletions(-)

Maybe list the features in the details of the commit message.

> 
> diff --git a/libavformat/http.c b/libavformat/http.c
> index a136918..bfe6801 100644
> --- a/libavformat/http.c
> +++ b/libavformat/http.c
> @@ -64,12 +64,14 @@ typedef struct HTTPContext {
>  int64_t chunksize;
>  int64_t off, end_off, filesize;
>  char *location;

> +char *host;
>  HTTPAuthState auth_state;
>  HTTPAuthState proxy_auth_state;
>  char *headers;
>  char *mime_type;
>  char *user_agent;
>  char *content_type;
> +char *body;
>  /* Set if the server correctly handles Connection: close and will close
>   * the connection after feeding us the content. */
>  int willclose;
> @@ -107,10 +109,14 @@ typedef struct HTTPContext {
>  int reconnect;
>  int listen;
>  char *resource;
> +char *query;
> +char *http_version;
>  int reply_code;
> +char *reply_text;

Do you have a system to choose where you add each field? If not, maybe it
would be a good idea to group thematically: everything that is for server
only together, with "strings parsed from the header" even more together.

>  int is_multi_client;
>  HandshakeState handshake_step;
>  int is_connected_server;

> +int skip_read_header;

This one belongs in another patch.

>  } HTTPContext;
>  
>  #define OFFSET(x) offsetof(HTTPContext, x)
> @@ -123,6 +129,7 @@ static const AVOption options[] = {
>  { "chunked_post", "use(s) chunked transfer-encoding for posts", 
> OFFSET(chunked_post), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, D | E },
>  { "headers", "set custom HTTP headers, can override built in default 
> headers", OFFSET(headers), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D | E },
>  { "content_type", "set a specific content type for the POST messages", 
> OFFSET(content_type), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D | E },
> +{ "body", "set the body of a simple HTTP reply", OFFSET(body), 
> AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
>  { "user_agent", "override User-Agent header", OFFSET(user_agent), 
> AV_OPT_TYPE_STRING, { .str = DEFAULT_USER_AGENT }, 0, 0, D },
>  { "user-agent", "override User-Agent header", OFFSET(user_agent), 
> AV_OPT_TYPE_STRING, { .str = DEFAULT_USER_AGENT }, 0, 0, D },
>  { "multiple_requests", "use persistent connections", 
> OFFSET(multiple_requests), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D | E },
> @@ -141,10 +148,14 @@ static const AVOption options[] = {
>  { "offset", "initial byte offset", OFFSET(off), AV_OPT_TYPE_INT64, { 
> .i64 = 0 }, 0, INT64_MAX, D },
>  { "end_offset", "try to limit the request to bytes preceding this 
> offset", OFFSET(end_off), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, D },
>  { "method", "Override the HTTP method or set the expected HTTP method 
> from a client", OFFSET(method), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D 
> | E },
> +{ "http_version", "The http version string received from a client.", 
> OFFSET(http_version), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, D | 
> AV_OPT_FLAG_READONLY },
>  { "reconnect", "auto reconnect after disconnect before EOF", 
> OFFSET(reconnect), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D },
>  { "listen", "listen on HTTP", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 
> 0 }, 0, 2, D | E },
>  { "resource", "The resource requested by a client", OFFSET(resource), 
> AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
> +{ "query", "The query requested by a client", OFFSET(query), 
> AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
>  { "reply_code", "The http status code to return to a client", 
> OFFSET(reply_code), AV_OPT_TYPE_INT, { .i64 = 200}, INT_MIN, 599, E},
> +{ "reply_text", "Set a custom reply text to replace standard HTTP 
> replies", OFFSET(reply_text), AV_OPT_TYPE_STRING, { .str = NULL}, 0, 0, E},
> +{ "hostname", "The Host-parameter of an incoming HTTP request.", 
> OFFSET(host), AV_OPT_TYPE_STRING, { .str = NULL}, 0, 0, E},
>  { NULL }
>  };
>  
> @@ -506,6 +517,7 @@ static int http_accept(URLContext *s, URLContext **c)
>  HTTPContext *cc;
>  URLContext *sl = sc->hd;
>  URLContext *cl = NULL;
> +char *peeraddr;
>  
>  av_assert0(sc->listen);
>  if ((ret = ffurl_alloc(c, s->filename, s->flags, 
> &sl->interrupt_callback)) < 0)
> @@ -515,6 +527,9 @@ static int http_accept(URLContext *s, URLContext **c)
>  goto fail;
>  cc->hd = cl;
>  cc->is_multi_client = 1;

> +if ((ret = av_opt_get(cc, "sock_addr_str", AV_OPT_SEARCH_CHILDREN, 
> &peeraddr)) < 0)
> +return ret;
> +av_log(s, AV_LOG_TRACE, "Peer address: %s\n", peeraddr);

av_opt_get() s

Re: [FFmpeg-devel] [PATCH 2/2] lavf/http: Add error codes 301 and 503 and make replies more customizable

2015-08-20 Thread Nicolas George
Le tridi 3 fructidor, an CCXXIII, Stephan Holljes a écrit :
> Signed-off-by: Stephan Holljes 
> ---
>  libavformat/http.c | 44 +++-
>  1 file changed, 39 insertions(+), 5 deletions(-)
> 
> diff --git a/libavformat/http.c b/libavformat/http.c
> index bfe6801..996c130 100644
> --- a/libavformat/http.c
> +++ b/libavformat/http.c
> @@ -331,9 +331,10 @@ int ff_http_averror(int status_code, int default_averror)
>  static int http_write_reply(URLContext* h, int status_code)
>  {
>  int ret, body = 0, reply_code, message_len;
> -const char *reply_text, *content_type;
> +const char *reply_text, *content_type, *location = NULL, *headers = 
> "\r\n";
>  HTTPContext *s = h->priv_data;
>  char message[BUFFER_SIZE];
> +char body_content[BUFFER_SIZE];
>  content_type = "text/plain";
>  
>  if (status_code < 0)
> @@ -359,28 +360,61 @@ static int http_write_reply(URLContext* h, int 
> status_code)
>  reply_text = "OK";
>  content_type = "application/octet-stream";
>  break;
> +case 301:
> +reply_code = 301;
> +reply_text = "Moved Permanently";

> +if (av_strcasecmp(s->method, "HEAD")) {

Why only for HEAD?

> +if (!s->location) {
> +av_log(s, AV_LOG_WARNING, "Reply code 301, but no 
> redirection url set\n");
> +break;
> +}
> +location = av_strdup(s->location);
> +}
> +
> +break;
>  case AVERROR_HTTP_SERVER_ERROR:
>  case 500:
>  reply_code = 500;
>  reply_text = "Internal server error";
>  break;
> +case 503:
> +reply_code = 503;
> +reply_text = "Service Unavailable";
> +break;
>  default:
>  return AVERROR(EINVAL);
>  }
> +if (s->reply_text)
> +reply_text = s->reply_text;
> +if (s->content_type)
> +content_type = s->content_type;
> +if (s->headers)
> +headers = s->headers;
> +if (s->body) {
> +av_strlcpy(body_content, s->body, BUFFER_SIZE);
> +body = 1;
> +} else {
> +snprintf(body_content, BUFFER_SIZE, "%03d %s\r\n", reply_code, 
> reply_text);
> +}
> +
>  if (body) {
>  s->chunked_post = 0;

>  message_len = snprintf(message, sizeof(message),
>   "HTTP/1.1 %03d %s\r\n"
>   "Content-Type: %s\r\n"
>   "Content-Length: %zu\r\n"
> + "%s%s"
> + "%s"
>   "\r\n"
> - "%03d %s\r\n",
> + "%s",
>   reply_code,
>   reply_text,
>   content_type,
> - strlen(reply_text) + 6, // 3 digit status code + space + 
> \r\n
> - reply_code,
> - reply_text);
> + strlen(body_content),
> + location ? "Location: " : "",
> + location ? location : "",
> + headers,
> + body_content);

Since you are including data from the application in the message, you can no
longer be certain that the "messsage" buffer is long enough in all cases.
Actually, the size of the buffer is MAX_URL_SIZE, and location may be that
to.

At the very least you need to check message_len against sizeof(message), but
using a dynamically allocated buffer is probably better. I would suggest to
use AVBPrint, because it makes error checking lightweight (just test
is_truncated at the end) and because it makes adding conditional parts (the
location) easier.

>  } else {
>  s->chunked_post = 1;
>  message_len = snprintf(message, sizeof(message),

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH v8] Add support for Audible AA files

2015-08-20 Thread Michael Niedermayer
On Thu, Aug 20, 2015 at 05:34:22AM +0300, Vesselin Bontchev wrote:
> Hi!
> 
> It would be awesome to have this patch merged in FFmpeg.
> 
> Vesselin

>  doc/demuxers.texi|6 
>  doc/general.texi |2 
>  libavformat/Makefile |1 
>  libavformat/aadec.c  |  303 
> +++
>  libavformat/allformats.c |1 
>  5 files changed, 313 insertions(+)
> 1b3ed66f9a364bf8831785c23308565bc7a35d99  
> 0001-Add-support-for-Audible-AA-files.patch
> From d8a6d0d7052ebdb7caa8dd9a7d571a68339d7acc Mon Sep 17 00:00:00 2001
> From: Vesselin Bontchev 
> Date: Sun, 19 Jul 2015 23:16:36 +0200
> Subject: [PATCH] Add support for Audible AA files
> 
> https://en.wikipedia.org/wiki/Audible.com#Quality
> ---
>  doc/demuxers.texi|   6 +
>  doc/general.texi |   2 +
>  libavformat/Makefile |   1 +
>  libavformat/aadec.c  | 303 
> +++
>  libavformat/allformats.c |   1 +
>  5 files changed, 313 insertions(+)
>  create mode 100644 libavformat/aadec.c

if you want to maintain this code in the future then please add
yourself to the MAINTAINERs file and send me your public ssh key for
git write access


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 1
"Used only once"- "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."


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


Re: [FFmpeg-devel] [PATCH 3/4] avformat/ftp: use correct enum type

2015-08-20 Thread Michael Niedermayer
On Thu, Aug 20, 2015 at 04:29:12AM -0400, Ganesh Ajjanagadde wrote:
> Fixes -Wenum-conversion from
> http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1
> 
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libavformat/ftp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied

thanks

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

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein


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/4] avcodec/metasound_data: remove unused variable

2015-08-20 Thread Michael Niedermayer
On Thu, Aug 20, 2015 at 04:34:19AM -0400, Ganesh Ajjanagadde wrote:
> On Thu, Aug 20, 2015 at 4:28 AM, Ganesh Ajjanagadde
>  wrote:
> > Fixes -Wunused-const-variable from
> > http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1
> >
> > Signed-off-by: Ganesh Ajjanagadde 
> > ---
> >  libavcodec/metasound_data.c | 4 
> >  1 file changed, 4 deletions(-)
> >
> > diff --git a/libavcodec/metasound_data.c b/libavcodec/metasound_data.c
> > index e439b3d..da2548a 100644
> > --- a/libavcodec/metasound_data.c
> > +++ b/libavcodec/metasound_data.c
> > @@ -14946,10 +14946,6 @@ static const uint16_t bark_tab_s16_128[] = {
> >  2, 2, 2, 3, 3, 5, 7, 12, 25, 67
> >  };
> >
> > -static const uint16_t bark_tab_s16_64[] = {
> > -1, 1, 2, 2, 3, 6, 11, 38
> > -};
> > -
> >  static const uint16_t bark_tab_l16s_1024[] = {
> >9,   9,   8,   9,  10,   9,  10,  10,
> >   10,  12,  11,  13,  13,  14,  16,  17,
> > --
> > 2.5.0
> >
> 
> Some comments:
> 1. I am still working on the remaining warnings and sent these mainly
> for feedback.
> If people think these are too trivial/waste of time I will refrain
> from these in future.

> 2. If above are ok, I can squash complete warning cleanup (from this
> file) into single
> patch if that is preferred.

i dont think this particular table removial should be squashed with
anything as its quite possible the table would be used in the future
and a seperate commit is (slihgtly) easier to revert

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

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato


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


[FFmpeg-devel] [RFC]fps filter

2015-08-20 Thread Carl Eugen Hoyos
Hi!

I finally realized why -vf fps=3/1001,fieldmatch,decimate does 
not always work / produces ugly output.
The issue is not related to fieldmatch and/or decimate but to the 
fps filter: It (sometimes) drops frames even if the framerate is 
increased. So the question is: Is it a good idea that fps (iiuc) 
never increases frame duration when increasing the frame rate, not 
even if that would avoid frame drops? What is the use-case for the 
current behaviour?
Work-around is to use -vf dejudder,fps... but I wonder why this 
should be necessary in the general case (and if it really works for 
long samples).

A sample with such timestamps is in  
http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket3968/
The relevant part starts after 85 seconds iirc. Note that later on, 
the frame rate gets reduced to 20fps, so the output file will never 
look completely clean (at least as long as Michael doesn't commit 
his new fps filter).

ffmpeg -i input -r does not show this behaviour afaict, it does not 
drop frames if it can be avoided.

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


Re: [FFmpeg-devel] [PATCH 2/4] avcodec/aacsbr_fixed: remove unused variable

2015-08-20 Thread Ronald S. Bultje
Hi,

On Thu, Aug 20, 2015 at 4:28 AM, Ganesh Ajjanagadde 
wrote:

> Fixes -Wunused-const-variable from
>
> http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1
>
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libavcodec/aacsbr_fixed.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/libavcodec/aacsbr_fixed.c b/libavcodec/aacsbr_fixed.c
> index 5a5c9cc..1fc7385 100644
> --- a/libavcodec/aacsbr_fixed.c
> +++ b/libavcodec/aacsbr_fixed.c
> @@ -76,7 +76,6 @@ static VLC vlc_sbr[10];
>  static void aacsbr_func_ptr_init(AACSBRContext *c);
>  static const int CONST_LN2   = Q31(0.6931471806/256);  // ln(2)/256
>  static const int CONST_RECIP_LN2 = Q31(0.7213475204);  // 0.5/ln(2)
> -static const int CONST_SQRT2 = Q30(0.7071067812);  // sqrt(2)/2
>  static const int CONST_076923= Q31(0.76923076923076923077f);


ok.

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


[FFmpeg-devel] [PATCH] QSV : Added look ahead rate control mode

2015-08-20 Thread Sven Dueking
From: Sven Dueking 

---
 libavcodec/qsvenc.c  | 36 +---
 libavcodec/qsvenc.h  | 12 
 libavcodec/qsvenc_h264.c | 12 
 3 files changed, 57 insertions(+), 3 deletions(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 1532258..935abdd 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -106,10 +106,21 @@ static int init_video_param(AVCodecContext *avctx, 
QSVEncContext *q)
 } else if (avctx->rc_max_rate == avctx->bit_rate) {
 q->param.mfx.RateControlMethod = MFX_RATECONTROL_CBR;
 ratecontrol_desc = "constant bitrate (CBR)";
-} else if (!avctx->rc_max_rate) {
+}
+else if (!avctx->rc_max_rate) {
+#if QSV_VERSION_ATLEAST(1,7)
+if (q->look_ahead) {
+q->param.mfx.RateControlMethod = MFX_RATECONTROL_LA;
+ratecontrol_desc = "lookahead (LA)";
+} else {
+#endif
 q->param.mfx.RateControlMethod = MFX_RATECONTROL_AVBR;
 ratecontrol_desc = "average variable bitrate (AVBR)";
-} else {
+#if QSV_VERSION_ATLEAST(1,7)
+}
+#endif
+}
+else {
 q->param.mfx.RateControlMethod = MFX_RATECONTROL_VBR;
 ratecontrol_desc = "variable bitrate (VBR)";
 }
@@ -132,6 +143,9 @@ static int init_video_param(AVCodecContext *avctx, 
QSVEncContext *q)
 
 break;
 case MFX_RATECONTROL_AVBR:
+#if QSV_VERSION_ATLEAST(1,7)
+case MFX_RATECONTROL_LA:
+#endif
 q->param.mfx.TargetKbps  = avctx->bit_rate / 1000;
 q->param.mfx.Convergence = q->avbr_convergence;
 q->param.mfx.Accuracy= q->avbr_accuracy;
@@ -151,7 +165,23 @@ static int init_video_param(AVCodecContext *avctx, 
QSVEncContext *q)
 
 q->extparam[0] = (mfxExtBuffer *)&q->extco;
 
-q->param.ExtParam= q->extparam;
+#if QSV_VERSION_ATLEAST(1,6)
+q->extco2.Header.BufferId  = MFX_EXTBUFF_CODING_OPTION2;
+q->extco2.Header.BufferSz  = sizeof(q->extco2);
+
+#if QSV_VERSION_ATLEAST(1,7)
+// valid value range is from 10 to 100 inclusive
+// to instruct the encoder to use the default value this should be set 
to zero
+q->extco2.LookAheadDepth= q->look_ahead_depth != 0 ? FFMAX(10, 
q->look_ahead_depth) : 0;
+#endif
+#if QSV_VERSION_ATLEAST(1,8)
+q->extco2.LookAheadDS   = q->look_ahead_downsampling;
+#endif
+
+q->extparam[1] = (mfxExtBuffer *)&q->extco2;
+
+#endif
+   q->param.ExtParam= q->extparam;
 q->param.NumExtParam = FF_ARRAY_ELEMS(q->extparam);
 }
 
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index 2316488..c096a54 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -50,7 +50,12 @@ typedef struct QSVEncContext {
 mfxFrameAllocRequest req;
 
 mfxExtCodingOption  extco;
+#if QSV_VERSION_ATLEAST(1,6)
+mfxExtCodingOption2 extco2;
+mfxExtBuffer *extparam[2];
+#else
 mfxExtBuffer *extparam[1];
+#endif
 
 AVFifoBuffer *async_fifo;
 
@@ -62,6 +67,13 @@ typedef struct QSVEncContext {
 int avbr_accuracy;
 int avbr_convergence;
 int pic_timing_sei;
+#if QSV_VERSION_ATLEAST(1,7)
+int look_ahead;
+int look_ahead_depth;
+#endif
+#if QSV_VERSION_ATLEAST(1,8)
+int look_ahead_downsampling;
+#endif
 
 char *load_plugins;
 } QSVEncContext;
diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
index b15f6b2..bd401e1 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -71,6 +71,18 @@ static const AVOption options[] = {
 { "avbr_convergence", "Convergence of the AVBR ratecontrol", 
OFFSET(qsv.avbr_convergence), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
 { "pic_timing_sei","Insert picture timing SEI with pic_struct_syntax 
element", OFFSET(qsv.pic_timing_sei), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE },
 
+#if QSV_VERSION_ATLEAST(1,7)
+{ "look_ahead",   "Use VBR algorithm with look ahead",
OFFSET(qsv.look_ahead),   AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE },
+{ "look_ahead_depth", "Depth of look ahead in number frames", 
OFFSET(qsv.look_ahead_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, VE },
+#endif
+
+#if QSV_VERSION_ATLEAST(1,8)
+{ "look_ahead_downsampling", NULL, OFFSET(qsv.look_ahead_downsampling), 
AV_OPT_TYPE_INT, { .i64 = MFX_LOOKAHEAD_DS_UNKNOWN }, 0, INT_MAX, VE, 
"look_ahead_downsampling" },
+{ "unknown", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
MFX_LOOKAHEAD_DS_UNKNOWN }, INT_MIN, INT_MAX, VE, "look_ahead_downsampling" 
},
+{ "off", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
MFX_LOOKAHEAD_DS_OFF }, INT_MIN, INT_MAX, VE, "look_ahead_downsampling" 
},
+{ "2x" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
MFX_LOOKAHEAD_DS_2x  }, INT_MIN, INT_MAX, VE, "look_ahead_downsampling" 
},
+#endif
+
 { "profile", NULL, OFFSET(qsv.profile), AV_OPT_TYPE_INT, { .i64 = 
MFX_PROFILE_UNKNOWN }, 0, INT_MAX, VE, "profile" },
 { "unkno

Re: [FFmpeg-devel] [PATCH 4/4] avformat/webmdashenc: fix uninitialized variable

2015-08-20 Thread Ronald S. Bultje
Hi,

On Thu, Aug 20, 2015 at 4:29 AM, Ganesh Ajjanagadde 
wrote:

> Fixes -Wsometimes-uninitialized from
>
> http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1
>
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libavformat/webmdashenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
> index 76ea423..ecce4d3 100644
> --- a/libavformat/webmdashenc.c
> +++ b/libavformat/webmdashenc.c
> @@ -388,7 +388,7 @@ static int write_adaptation_set(AVFormatContext *s,
> int as_index)
>
>  for (i = 0; i < as->nb_streams; i++) {
>  char *representation_id = NULL;
> -int ret;
> +int ret = -1;
>  if (w->is_live) {
>  AVDictionaryEntry *filename =
>  av_dict_get(s->streams[as->streams[i]]->metadata,
> FILENAME, NULL, 0);
> --
> 2.5.0


This only happens when filename is NULL. Returning -1 seems
counterintuitive then, we should probably return AVERROR(EINVAL) or
something analogous. We can also decrease the scope for that by simply
returning AVERROR(EINVAL) Directly if filename is NULL, rather than
(ab)using ret for that.

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


Re: [FFmpeg-devel] [PATCH 1/2] lavf/http: Parse and/or expose various client data.

2015-08-20 Thread Stephan Holljes
On Thu, Aug 20, 2015 at 11:02 AM, Nicolas George  wrote:
> Thanks for the patch. A few remarks, specific to the stand-alone-commit
> version or that I had not yet spotted.
>
>
> Le tridi 3 fructidor, an CCXXIII, Stephan Holljes a écrit :
>> Signed-off-by: Stephan Holljes 
>> ---
>>  libavformat/http.c | 40 ++--
>>  1 file changed, 38 insertions(+), 2 deletions(-)
>
> Maybe list the features in the details of the commit message.
>
>>
>> diff --git a/libavformat/http.c b/libavformat/http.c
>> index a136918..bfe6801 100644
>> --- a/libavformat/http.c
>> +++ b/libavformat/http.c
>> @@ -64,12 +64,14 @@ typedef struct HTTPContext {
>>  int64_t chunksize;
>>  int64_t off, end_off, filesize;
>>  char *location;
>
>> +char *host;
>>  HTTPAuthState auth_state;
>>  HTTPAuthState proxy_auth_state;
>>  char *headers;
>>  char *mime_type;
>>  char *user_agent;
>>  char *content_type;
>> +char *body;
>>  /* Set if the server correctly handles Connection: close and will close
>>   * the connection after feeding us the content. */
>>  int willclose;
>> @@ -107,10 +109,14 @@ typedef struct HTTPContext {
>>  int reconnect;
>>  int listen;
>>  char *resource;
>> +char *query;
>> +char *http_version;
>>  int reply_code;
>> +char *reply_text;
>
> Do you have a system to choose where you add each field? If not, maybe it
> would be a good idea to group thematically: everything that is for server
> only together, with "strings parsed from the header" even more together.

My system has been to put things that seem related together. I will
think of a logical order and create a different patch that reorders
the fields.

>
>>  int is_multi_client;
>>  HandshakeState handshake_step;
>>  int is_connected_server;
>
>> +int skip_read_header;
>
> This one belongs in another patch.

Ah, of course.

>
>>  } HTTPContext;
>>
>>  #define OFFSET(x) offsetof(HTTPContext, x)
>> @@ -123,6 +129,7 @@ static const AVOption options[] = {
>>  { "chunked_post", "use(s) chunked transfer-encoding for posts", 
>> OFFSET(chunked_post), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, D | E },
>>  { "headers", "set custom HTTP headers, can override built in default 
>> headers", OFFSET(headers), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D | E },
>>  { "content_type", "set a specific content type for the POST messages", 
>> OFFSET(content_type), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D | E },
>> +{ "body", "set the body of a simple HTTP reply", OFFSET(body), 
>> AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
>>  { "user_agent", "override User-Agent header", OFFSET(user_agent), 
>> AV_OPT_TYPE_STRING, { .str = DEFAULT_USER_AGENT }, 0, 0, D },
>>  { "user-agent", "override User-Agent header", OFFSET(user_agent), 
>> AV_OPT_TYPE_STRING, { .str = DEFAULT_USER_AGENT }, 0, 0, D },
>>  { "multiple_requests", "use persistent connections", 
>> OFFSET(multiple_requests), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D | E },
>> @@ -141,10 +148,14 @@ static const AVOption options[] = {
>>  { "offset", "initial byte offset", OFFSET(off), AV_OPT_TYPE_INT64, { 
>> .i64 = 0 }, 0, INT64_MAX, D },
>>  { "end_offset", "try to limit the request to bytes preceding this 
>> offset", OFFSET(end_off), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, D },
>>  { "method", "Override the HTTP method or set the expected HTTP method 
>> from a client", OFFSET(method), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D 
>> | E },
>> +{ "http_version", "The http version string received from a client.", 
>> OFFSET(http_version), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, D | 
>> AV_OPT_FLAG_READONLY },
>>  { "reconnect", "auto reconnect after disconnect before EOF", 
>> OFFSET(reconnect), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D },
>>  { "listen", "listen on HTTP", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 
>> 0 }, 0, 2, D | E },
>>  { "resource", "The resource requested by a client", OFFSET(resource), 
>> AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
>> +{ "query", "The query requested by a client", OFFSET(query), 
>> AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
>>  { "reply_code", "The http status code to return to a client", 
>> OFFSET(reply_code), AV_OPT_TYPE_INT, { .i64 = 200}, INT_MIN, 599, E},
>> +{ "reply_text", "Set a custom reply text to replace standard HTTP 
>> replies", OFFSET(reply_text), AV_OPT_TYPE_STRING, { .str = NULL}, 0, 0, E},
>> +{ "hostname", "The Host-parameter of an incoming HTTP request.", 
>> OFFSET(host), AV_OPT_TYPE_STRING, { .str = NULL}, 0, 0, E},
>>  { NULL }
>>  };
>>
>> @@ -506,6 +517,7 @@ static int http_accept(URLContext *s, URLContext **c)
>>  HTTPContext *cc;
>>  URLContext *sl = sc->hd;
>>  URLContext *cl = NULL;
>> +char *peeraddr;
>>
>>  av_assert0(sc->listen);
>>  if ((ret = ffurl_alloc(c, s->filename, s->flags, 
>> &sl->interrupt_callback)) < 0)
>> @@ -515,6 

Re: [FFmpeg-devel] [PATCH 2/2] lavf/http: Add error codes 301 and 503 and make replies more customizable

2015-08-20 Thread Stephan Holljes
On Thu, Aug 20, 2015 at 11:08 AM, Nicolas George  wrote:
> Le tridi 3 fructidor, an CCXXIII, Stephan Holljes a écrit :
>> Signed-off-by: Stephan Holljes 
>> ---
>>  libavformat/http.c | 44 +++-
>>  1 file changed, 39 insertions(+), 5 deletions(-)
>>
>> diff --git a/libavformat/http.c b/libavformat/http.c
>> index bfe6801..996c130 100644
>> --- a/libavformat/http.c
>> +++ b/libavformat/http.c
>> @@ -331,9 +331,10 @@ int ff_http_averror(int status_code, int 
>> default_averror)
>>  static int http_write_reply(URLContext* h, int status_code)
>>  {
>>  int ret, body = 0, reply_code, message_len;
>> -const char *reply_text, *content_type;
>> +const char *reply_text, *content_type, *location = NULL, *headers = 
>> "\r\n";
>>  HTTPContext *s = h->priv_data;
>>  char message[BUFFER_SIZE];
>> +char body_content[BUFFER_SIZE];
>>  content_type = "text/plain";
>>
>>  if (status_code < 0)
>> @@ -359,28 +360,61 @@ static int http_write_reply(URLContext* h, int 
>> status_code)
>>  reply_text = "OK";
>>  content_type = "application/octet-stream";
>>  break;
>> +case 301:
>> +reply_code = 301;
>> +reply_text = "Moved Permanently";
>
>> +if (av_strcasecmp(s->method, "HEAD")) {
>
> Why only for HEAD?

It's the opposite. When the request was HEAD, the location header is
not set, otherwise it is.

>
>> +if (!s->location) {
>> +av_log(s, AV_LOG_WARNING, "Reply code 301, but no 
>> redirection url set\n");
>> +break;
>> +}
>> +location = av_strdup(s->location);
>> +}
>> +
>> +break;
>>  case AVERROR_HTTP_SERVER_ERROR:
>>  case 500:
>>  reply_code = 500;
>>  reply_text = "Internal server error";
>>  break;
>> +case 503:
>> +reply_code = 503;
>> +reply_text = "Service Unavailable";
>> +break;
>>  default:
>>  return AVERROR(EINVAL);
>>  }
>> +if (s->reply_text)
>> +reply_text = s->reply_text;
>> +if (s->content_type)
>> +content_type = s->content_type;
>> +if (s->headers)
>> +headers = s->headers;
>> +if (s->body) {
>> +av_strlcpy(body_content, s->body, BUFFER_SIZE);
>> +body = 1;
>> +} else {
>> +snprintf(body_content, BUFFER_SIZE, "%03d %s\r\n", reply_code, 
>> reply_text);
>> +}
>> +
>>  if (body) {
>>  s->chunked_post = 0;
>
>>  message_len = snprintf(message, sizeof(message),
>>   "HTTP/1.1 %03d %s\r\n"
>>   "Content-Type: %s\r\n"
>>   "Content-Length: %zu\r\n"
>> + "%s%s"
>> + "%s"
>>   "\r\n"
>> - "%03d %s\r\n",
>> + "%s",
>>   reply_code,
>>   reply_text,
>>   content_type,
>> - strlen(reply_text) + 6, // 3 digit status code + space + 
>> \r\n
>> - reply_code,
>> - reply_text);
>> + strlen(body_content),
>> + location ? "Location: " : "",
>> + location ? location : "",
>> + headers,
>> + body_content);
>
> Since you are including data from the application in the message, you can no
> longer be certain that the "messsage" buffer is long enough in all cases.
> Actually, the size of the buffer is MAX_URL_SIZE, and location may be that
> to.
>
> At the very least you need to check message_len against sizeof(message), but
> using a dynamically allocated buffer is probably better. I would suggest to
> use AVBPrint, because it makes error checking lightweight (just test
> is_truncated at the end) and because it makes adding conditional parts (the
> location) easier.

AVBPrint is perfect for this, thanks! New patch uses AVBPrint.

>
>>  } else {
>>  s->chunked_post = 1;
>>  message_len = snprintf(message, sizeof(message),
>
> Regards,
>
> --
>   Nicolas George
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

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


Re: [FFmpeg-devel] [PATCH 1/2] lavf/http: Parse and/or expose various client data.

2015-08-20 Thread Nicolas George
Le tridi 3 fructidor, an CCXXIII, Stephan Holljes a écrit :
> Added to all while(!av_isspace(p)) loops in the server code.

You may want to send this part in a stand-alone patch, since it is actually
a bug in the current code.

> This is more or less temporal, since the user-agent field is/will be
> used by ffserver.
> Once headers are handled by an AVDictionary this code will probably be 
> removed.

I suspect you meant "temporary". In that case, I suggest to leave that bit
out, until either it is replaced by AVDictionary or the FFserver patch
itself is ready, whatever comes first: even with the API marked
experimental, it is not nice to start offering an option and then remove it
if it can be avoided.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH 2/2] lavf/http: Add error codes 301 and 503 and make replies more customizable

2015-08-20 Thread Nicolas George
Le tridi 3 fructidor, an CCXXIII, Stephan Holljes a écrit :
> It's the opposite. When the request was HEAD, the location header is
> not set, otherwise it is.

Indeed, but still, why? I just checked with a random Apache server, and HEAD
also returns the Location header.

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] [PATCHv2] avformat/webmdashenc: fix uninitialized variable

2015-08-20 Thread Ganesh Ajjanagadde
Fixes -Wsometimes-uninitialized from
http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1

Signed-off-by: Ganesh Ajjanagadde 
---
 libavformat/webmdashenc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
index 76ea423..898e464 100644
--- a/libavformat/webmdashenc.c
+++ b/libavformat/webmdashenc.c
@@ -392,10 +392,10 @@ static int write_adaptation_set(AVFormatContext *s, int 
as_index)
 if (w->is_live) {
 AVDictionaryEntry *filename =
 av_dict_get(s->streams[as->streams[i]]->metadata, FILENAME, 
NULL, 0);
-if (!filename ||
-(ret = parse_filename(filename->value, &representation_id, 
NULL, NULL))) {
+if (!filename)
+return AVERROR(EINVAL);
+if (ret = parse_filename(filename->value, &representation_id, 
NULL, NULL))
 return ret;
-}
 } else {
 representation_id = av_asprintf("%d", w->representation_id++);
 if (!representation_id) return AVERROR(ENOMEM);
-- 
2.5.0

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


[FFmpeg-devel] [PATCH] avfilter/vf_dejudder: use the name 's' for the pointer to the private context

2015-08-20 Thread Paul B Mahol
This is shorter and consistent across filters.

Signed-off-by: Paul B Mahol 
---
 libavfilter/vf_dejudder.c | 66 +++
 1 file changed, 33 insertions(+), 33 deletions(-)

diff --git a/libavfilter/vf_dejudder.c b/libavfilter/vf_dejudder.c
index ab525b6..4705cb6 100644
--- a/libavfilter/vf_dejudder.c
+++ b/libavfilter/vf_dejudder.c
@@ -55,7 +55,7 @@
 #include "internal.h"
 #include "video.h"
 
-typedef struct {
+typedef struct DejudderContext {
 const AVClass *class;
 int64_t *ringbuff;
 int i1, i2, i3, i4;
@@ -80,40 +80,40 @@ AVFILTER_DEFINE_CLASS(dejudder);
 static int config_out_props(AVFilterLink *outlink)
 {
 AVFilterContext *ctx = outlink->src;
-DejudderContext *dj = ctx->priv;
+DejudderContext *s = ctx->priv;
 AVFilterLink *inlink = outlink->src->inputs[0];
 
-outlink->time_base = av_mul_q(inlink->time_base, av_make_q(1, 2 * 
dj->cycle));
-outlink->frame_rate = av_mul_q(inlink->frame_rate, av_make_q(2 * 
dj->cycle, 1));
+outlink->time_base = av_mul_q(inlink->time_base, av_make_q(1, 2 * 
s->cycle));
+outlink->frame_rate = av_mul_q(inlink->frame_rate, av_make_q(2 * s->cycle, 
1));
 
-av_log(ctx, AV_LOG_VERBOSE, "cycle:%d\n", dj->cycle);
+av_log(ctx, AV_LOG_VERBOSE, "cycle:%d\n", s->cycle);
 
 return 0;
 }
 
 static av_cold int dejudder_init(AVFilterContext *ctx)
 {
-DejudderContext *dj = ctx->priv;
+DejudderContext *s = ctx->priv;
 
-dj->ringbuff = av_mallocz_array(dj->cycle+2, sizeof(*dj->ringbuff));
-if (!dj->ringbuff)
+s->ringbuff = av_mallocz_array(s->cycle+2, sizeof(*s->ringbuff));
+if (!s->ringbuff)
 return AVERROR(ENOMEM);
 
-dj->new_pts = 0;
-dj->i1 = 0;
-dj->i2 = 1;
-dj->i3 = 2;
-dj->i4 = 3;
-dj->start_count = dj->cycle + 2;
+s->new_pts = 0;
+s->i1 = 0;
+s->i2 = 1;
+s->i3 = 2;
+s->i4 = 3;
+s->start_count = s->cycle + 2;
 
 return 0;
 }
 
 static av_cold void dejudder_uninit(AVFilterContext *ctx)
 {
-DejudderContext *dj = ctx->priv;
+DejudderContext *s = ctx->priv;
 
-av_freep(&(dj->ringbuff));
+av_freep(&(s->ringbuff));
 }
 
 static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
@@ -121,36 +121,36 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 int k;
 AVFilterContext *ctx  = inlink->dst;
 AVFilterLink *outlink = ctx->outputs[0];
-DejudderContext *dj   = ctx->priv;
-int64_t *judbuff  = dj->ringbuff;
+DejudderContext *s   = ctx->priv;
+int64_t *judbuff  = s->ringbuff;
 int64_t next_pts  = frame->pts;
 int64_t offset;
 
 if (next_pts == AV_NOPTS_VALUE)
 return ff_filter_frame(outlink, frame);
 
-if (dj->start_count) {
-dj->start_count--;
-dj->new_pts = next_pts * 2 * dj->cycle;
+if (s->start_count) {
+s->start_count--;
+s->new_pts = next_pts * 2 * s->cycle;
 } else {
-if (next_pts < judbuff[dj->i2]) {
-offset = next_pts + judbuff[dj->i3] - judbuff[dj->i4] - 
judbuff[dj->i1];
-for (k = 0; k < dj->cycle + 2; k++)
+if (next_pts < judbuff[s->i2]) {
+offset = next_pts + judbuff[s->i3] - judbuff[s->i4] - 
judbuff[s->i1];
+for (k = 0; k < s->cycle + 2; k++)
 judbuff[k] += offset;
 }
-dj->new_pts += (dj->cycle - 1) * (judbuff[dj->i3] - judbuff[dj->i1])
-+ (dj->cycle + 1) * (next_pts - judbuff[dj->i4]);
+s->new_pts += (s->cycle - 1) * (judbuff[s->i3] - judbuff[s->i1])
++ (s->cycle + 1) * (next_pts - judbuff[s->i4]);
 }
 
-judbuff[dj->i2] = next_pts;
-dj->i1 = dj->i2;
-dj->i2 = dj->i3;
-dj->i3 = dj->i4;
-dj->i4 = (dj->i4 + 1) % (dj->cycle + 2);
+judbuff[s->i2] = next_pts;
+s->i1 = s->i2;
+s->i2 = s->i3;
+s->i3 = s->i4;
+s->i4 = (s->i4 + 1) % (s->cycle + 2);
 
-frame->pts = dj->new_pts;
+frame->pts = s->new_pts;
 
-for (k = 0; k < dj->cycle + 2; k++)
+for (k = 0; k < s->cycle + 2; k++)
 av_log(ctx, AV_LOG_DEBUG, "%"PRId64"\t", judbuff[k]);
 av_log(ctx, AV_LOG_DEBUG, "next=%"PRId64", new=%"PRId64"\n", next_pts, 
frame->pts);
 
-- 
1.7.11.2

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


Re: [FFmpeg-devel] [PATCH 1/2] lavf/http: Parse and/or expose various client data.

2015-08-20 Thread Stephan Holljes
On Thu, Aug 20, 2015 at 5:15 PM, Nicolas George  wrote:
> Le tridi 3 fructidor, an CCXXIII, Stephan Holljes a écrit :
>> Added to all while(!av_isspace(p)) loops in the server code.
>
> You may want to send this part in a stand-alone patch, since it is actually
> a bug in the current code.
>
>> This is more or less temporal, since the user-agent field is/will be
>> used by ffserver.
>> Once headers are handled by an AVDictionary this code will probably be 
>> removed.
>
> I suspect you meant "temporary". In that case, I suggest to leave that bit
> out, until either it is replaced by AVDictionary or the FFserver patch
> itself is ready, whatever comes first: even with the API marked
> experimental, it is not nice to start offering an option and then remove it
> if it can be avoided.

Should the same be done for the Host-parameter sent by the client too?

>
> 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 2/2] lavf/http: Add error codes 301 and 503 and make replies more customizable

2015-08-20 Thread Stephan Holljes
On Thu, Aug 20, 2015 at 5:17 PM, Nicolas George  wrote:
> Le tridi 3 fructidor, an CCXXIII, Stephan Holljes a écrit :
>> It's the opposite. When the request was HEAD, the location header is
>> not set, otherwise it is.
>
> Indeed, but still, why? I just checked with a random Apache server, and HEAD
> also returns the Location header.

Oh wow, I misread the RFC (again). Sorry. Conditional removed.

>
> 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 1/2] lavf/http: Parse and/or expose various client data.

2015-08-20 Thread Nicolas George
Le tridi 3 fructidor, an CCXXIII, Stephan Holljes a écrit :
> Should the same be done for the Host-parameter sent by the client too?

It can be discussed.

On one hand, the Host field has a special meaning for the protocol, unlike
User-Agent that is only used for logging, so it makes sense to give it a
special meaning.

On the other hand, if there is a mechanism to access all fields, there is no
reason to have a special case for it.

Actually, I suspect you could have written the code for the AVDictionary
(with a hardcoded total size limit to avoid DoS, for now) in the time before
my reply.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH 1/2] lavf/http: Parse and/or expose various client data.

2015-08-20 Thread Stephan Holljes
On Thu, Aug 20, 2015 at 5:32 PM, Nicolas George  wrote:
> Le tridi 3 fructidor, an CCXXIII, Stephan Holljes a écrit :
>> Should the same be done for the Host-parameter sent by the client too?
>
> It can be discussed.
>
> On one hand, the Host field has a special meaning for the protocol, unlike
> User-Agent that is only used for logging, so it makes sense to give it a
> special meaning.

In ffserver the User-Agent is used to decide how to deal with a
client. (WMP being a special case.)

>
> On the other hand, if there is a mechanism to access all fields, there is no
> reason to have a special case for it.
>
> Actually, I suspect you could have written the code for the AVDictionary
> (with a hardcoded total size limit to avoid DoS, for now) in the time before
> my reply.

That sounds pretty optimistic. Maybe it is trivial for you, but from
my standpoint it looks like a rather large-ish undertaking to rewrite
all the header-parsing code to utilize an AVDictionary.

I also just noticed that the user_agent field was already present
before I wrote any code in http.c, but I do agree that it should not
be treated any different than other header-fields.

>
> Regards,
>
> --
>   Nicolas George
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

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


[FFmpeg-devel] [PATCH] lavf/http: Fix parsing http request data to not read over '\0'.

2015-08-20 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 libavformat/http.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index a136918..18df34e 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -716,7 +716,7 @@ static int process_line(URLContext *h, char *line, int 
line_count,
 if (s->is_connected_server) {
 // HTTP method
 method = p;
-while (!av_isspace(*p))
+while (*p && !av_isspace(*p))
 p++;
 *(p++) = '\0';
 av_log(h, AV_LOG_TRACE, "Received method: %s\n", method);
@@ -753,7 +753,7 @@ static int process_line(URLContext *h, char *line, int 
line_count,
 while (av_isspace(*p))
 p++;
 version = p;
-while (!av_isspace(*p))
+while (*p && !av_isspace(*p))
 p++;
 *p = '\0';
 if (av_strncasecmp(version, "HTTP/", 5)) {
-- 
2.1.0

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


[FFmpeg-devel] [PATCH 1/2] lavf/http: Parse and/or expose various client data.

2015-08-20 Thread Stephan Holljes
Introduce the ability to set reply body and reply text and read the
url-query, http-version and host parameter.

Signed-off-by: Stephan Holljes 
---
 libavformat/http.c | 32 ++--
 1 file changed, 30 insertions(+), 2 deletions(-)

Does not export User-Agent, unlike the previous version.

diff --git a/libavformat/http.c b/libavformat/http.c
index 18df34e..0932e06 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -64,12 +64,14 @@ typedef struct HTTPContext {
 int64_t chunksize;
 int64_t off, end_off, filesize;
 char *location;
+char *host;
 HTTPAuthState auth_state;
 HTTPAuthState proxy_auth_state;
 char *headers;
 char *mime_type;
 char *user_agent;
 char *content_type;
+char *body;
 /* Set if the server correctly handles Connection: close and will close
  * the connection after feeding us the content. */
 int willclose;
@@ -107,7 +109,10 @@ typedef struct HTTPContext {
 int reconnect;
 int listen;
 char *resource;
+char *query;
+char *http_version;
 int reply_code;
+char *reply_text;
 int is_multi_client;
 HandshakeState handshake_step;
 int is_connected_server;
@@ -123,6 +128,7 @@ static const AVOption options[] = {
 { "chunked_post", "use(s) chunked transfer-encoding for posts", 
OFFSET(chunked_post), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, D | E },
 { "headers", "set custom HTTP headers, can override built in default 
headers", OFFSET(headers), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D | E },
 { "content_type", "set a specific content type for the POST messages", 
OFFSET(content_type), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D | E },
+{ "body", "set the body of a simple HTTP reply", OFFSET(body), 
AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
 { "user_agent", "override User-Agent header", OFFSET(user_agent), 
AV_OPT_TYPE_STRING, { .str = DEFAULT_USER_AGENT }, 0, 0, D },
 { "user-agent", "override User-Agent header", OFFSET(user_agent), 
AV_OPT_TYPE_STRING, { .str = DEFAULT_USER_AGENT }, 0, 0, D },
 { "multiple_requests", "use persistent connections", 
OFFSET(multiple_requests), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D | E },
@@ -141,10 +147,14 @@ static const AVOption options[] = {
 { "offset", "initial byte offset", OFFSET(off), AV_OPT_TYPE_INT64, { .i64 
= 0 }, 0, INT64_MAX, D },
 { "end_offset", "try to limit the request to bytes preceding this offset", 
OFFSET(end_off), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, D },
 { "method", "Override the HTTP method or set the expected HTTP method from 
a client", OFFSET(method), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D | E },
+{ "http_version", "The http version string received from a client.", 
OFFSET(http_version), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, D | 
AV_OPT_FLAG_READONLY },
 { "reconnect", "auto reconnect after disconnect before EOF", 
OFFSET(reconnect), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D },
 { "listen", "listen on HTTP", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 
}, 0, 2, D | E },
 { "resource", "The resource requested by a client", OFFSET(resource), 
AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
+{ "query", "The query requested by a client", OFFSET(query), 
AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
 { "reply_code", "The http status code to return to a client", 
OFFSET(reply_code), AV_OPT_TYPE_INT, { .i64 = 200}, INT_MIN, 599, E},
+{ "reply_text", "Set a custom reply text to replace standard HTTP 
replies", OFFSET(reply_text), AV_OPT_TYPE_STRING, { .str = NULL}, 0, 0, E},
+{ "hostname", "The Host-parameter of an incoming HTTP request.", 
OFFSET(host), AV_OPT_TYPE_STRING, { .str = NULL}, 0, 0, E},
 { NULL }
 };
 
@@ -506,6 +516,7 @@ static int http_accept(URLContext *s, URLContext **c)
 HTTPContext *cc;
 URLContext *sl = sc->hd;
 URLContext *cl = NULL;
+char *peeraddr;
 
 av_assert0(sc->listen);
 if ((ret = ffurl_alloc(c, s->filename, s->flags, &sl->interrupt_callback)) 
< 0)
@@ -702,7 +713,7 @@ static int process_line(URLContext *h, char *line, int 
line_count,
 {
 HTTPContext *s = h->priv_data;
 const char *auto_method =  h->flags & AVIO_FLAG_READ ? "POST" : "GET";
-char *tag, *p, *end, *method, *resource, *version;
+char *tag, *p, *end, *method, *resource, *query = NULL, *version;
 int ret;
 
 /* end of header */
@@ -720,6 +731,7 @@ static int process_line(URLContext *h, char *line, int 
line_count,
 p++;
 *(p++) = '\0';
 av_log(h, AV_LOG_TRACE, "Received method: %s\n", method);
+av_log(h, AV_LOG_TRACE, "Expected method: %s\n", s->method);
 if (s->method) {
 if (av_strcasecmp(s->method, method)) {
 av_log(h, AV_LOG_ERROR, "Received and expected HTTP method 
do not match. (%s expected, %s received)\n",
@@ -742,12 +754,22 @@ static int process_line(URLContext *h, char *line, int 
line_count,

[FFmpeg-devel] [PATCH 2/2] lavf/http: Rework http_write_reply()

2015-08-20 Thread Stephan Holljes
Add error codes 301 and 503, make replies more customizable
and use AVBPrint for strings.

Signed-off-by: Stephan Holljes 
---
 libavformat/http.c | 75 +-
 1 file changed, 63 insertions(+), 12 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 0932e06..4ee2e72 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -27,6 +27,7 @@
 
 #include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
+#include "libavutil/bprint.h"
 #include "libavutil/opt.h"
 
 #include "avformat.h"
@@ -330,11 +331,15 @@ int ff_http_averror(int status_code, int default_averror)
 static int http_write_reply(URLContext* h, int status_code)
 {
 int ret, body = 0, reply_code, message_len;
-const char *reply_text, *content_type;
+const char *reply_text, *content_type, *location = NULL, *headers = "\r\n";
 HTTPContext *s = h->priv_data;
-char message[BUFFER_SIZE];
+AVBPrint message;
+AVBPrint body_content;
 content_type = "text/plain";
 
+av_bprint_init(&message,  BUFFER_SIZE, AV_BPRINT_SIZE_AUTOMATIC);
+av_bprint_init(&body_content, BUFFER_SIZE, AV_BPRINT_SIZE_AUTOMATIC);
+
 if (status_code < 0)
 body = 1;
 switch (status_code) {
@@ -358,31 +363,70 @@ static int http_write_reply(URLContext* h, int 
status_code)
 reply_text = "OK";
 content_type = "application/octet-stream";
 break;
+case 301:
+reply_code = 301;
+reply_text = "Moved Permanently";
+if (!s->location) {
+av_log(s, AV_LOG_WARNING, "Reply code 301, but no redirection url 
set\n");
+break;
+}
+location = s->location;
+
+break;
 case AVERROR_HTTP_SERVER_ERROR:
 case 500:
 reply_code = 500;
 reply_text = "Internal server error";
 break;
+case 503:
+reply_code = 503;
+reply_text = "Service Unavailable";
+break;
 default:
 return AVERROR(EINVAL);
 }
+if (s->reply_text)
+reply_text = s->reply_text;
+if (s->content_type)
+content_type = s->content_type;
+if (s->headers)
+headers = s->headers;
+if (s->body) {
+av_bprintf(&body_content, s->body);
+body = 1;
+} else {
+av_bprintf(&body_content, "%03d %s\r\n", reply_code, reply_text);
+}
+
+if (!av_bprint_is_complete(&body_content)) {
+av_log(s, AV_LOG_WARNING, "Content truncated.\n");
+message_len = body_content.size;
+} else
+message_len = body_content.len;
+
 if (body) {
 s->chunked_post = 0;
-message_len = snprintf(message, sizeof(message),
+av_bprintf(&message,
  "HTTP/1.1 %03d %s\r\n"
  "Content-Type: %s\r\n"
- "Content-Length: %zu\r\n"
- "\r\n"
- "%03d %s\r\n",
+ "Content-Length: %zu\r\n",
  reply_code,
  reply_text,
  content_type,
- strlen(reply_text) + 6, // 3 digit status code + space + \r\n
- reply_code,
- reply_text);
+ message_len);
+if (location)
+av_bprintf(&message,
+ "Location: %s\r\n", location);
+av_bprintf(&message,
+ "%s"
+ "\r\n"
+ "%s",
+ headers,
+ body_content.str);
+
 } else {
 s->chunked_post = 1;
-message_len = snprintf(message, sizeof(message),
+av_bprintf(&message,
  "HTTP/1.1 %03d %s\r\n"
  "Content-Type: %s\r\n"
  "Transfer-Encoding: chunked\r\n"
@@ -391,8 +435,15 @@ static int http_write_reply(URLContext* h, int status_code)
  reply_text,
  content_type);
 }
-av_log(h, AV_LOG_TRACE, "HTTP reply header: \n%s\n", message);
-if ((ret = ffurl_write(s->hd, message, message_len)) < 0)
+if (!av_bprint_is_complete(&message)) {
+av_log(s, AV_LOG_WARNING, "Reply truncated.\n");
+message_len = message.size;
+} else
+message_len = message.len;
+
+av_log(h, AV_LOG_TRACE, "HTTP reply header: \n%s\n", message.str);
+
+if ((ret = ffurl_write(s->hd, message.str, message_len)) < 0)
 return ret;
 return 0;
 }
-- 
2.1.0

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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_dejudder: use the name 's' for the pointer to the private context

2015-08-20 Thread Ganesh Ajjanagadde
On Thu, Aug 20, 2015 at 11:24 AM, Paul B Mahol  wrote:
> This is shorter and consistent across filters.
>
> Signed-off-by: Paul B Mahol 
> ---
>  libavfilter/vf_dejudder.c | 66 
> +++
>  1 file changed, 33 insertions(+), 33 deletions(-)
>
> diff --git a/libavfilter/vf_dejudder.c b/libavfilter/vf_dejudder.c
> index ab525b6..4705cb6 100644
> --- a/libavfilter/vf_dejudder.c
> +++ b/libavfilter/vf_dejudder.c
> @@ -55,7 +55,7 @@
>  #include "internal.h"
>  #include "video.h"
>
> -typedef struct {
> +typedef struct DejudderContext {

This should not be part of this patch.
Doing a random scan through filters,
it seems like there is a lack of consistency on this typedef:
see e.g vf_decimate, vf_bbox (written by others),
af_aphaser (written by you), and this one (in its current state).

If you want consistency in this, perhaps a single patch going through
all filters and unifying this would be useful.

As an aside, I do not like typedef of structures at all;
note that kernel coding style expressly forbids this:
see e.g
https://stackoverflow.com/questions/252780/why-should-we-typedef-a-struct-so-often-in-c
(Jens and Jerry Hick's answer) and comments for that.
However, this is rampant in FFmpeg,
and will need further discussion.
Notice that the developer documentation does not cover this.

>  const AVClass *class;
>  int64_t *ringbuff;
>  int i1, i2, i3, i4;
> @@ -80,40 +80,40 @@ AVFILTER_DEFINE_CLASS(dejudder);
>  static int config_out_props(AVFilterLink *outlink)
>  {
>  AVFilterContext *ctx = outlink->src;
> -DejudderContext *dj = ctx->priv;
> +DejudderContext *s = ctx->priv;
>  AVFilterLink *inlink = outlink->src->inputs[0];
>
> -outlink->time_base = av_mul_q(inlink->time_base, av_make_q(1, 2 * 
> dj->cycle));
> -outlink->frame_rate = av_mul_q(inlink->frame_rate, av_make_q(2 * 
> dj->cycle, 1));
> +outlink->time_base = av_mul_q(inlink->time_base, av_make_q(1, 2 * 
> s->cycle));
> +outlink->frame_rate = av_mul_q(inlink->frame_rate, av_make_q(2 * 
> s->cycle, 1));
>
> -av_log(ctx, AV_LOG_VERBOSE, "cycle:%d\n", dj->cycle);
> +av_log(ctx, AV_LOG_VERBOSE, "cycle:%d\n", s->cycle);
>
>  return 0;
>  }
>
>  static av_cold int dejudder_init(AVFilterContext *ctx)
>  {
> -DejudderContext *dj = ctx->priv;
> +DejudderContext *s = ctx->priv;
>
> -dj->ringbuff = av_mallocz_array(dj->cycle+2, sizeof(*dj->ringbuff));
> -if (!dj->ringbuff)
> +s->ringbuff = av_mallocz_array(s->cycle+2, sizeof(*s->ringbuff));
> +if (!s->ringbuff)
>  return AVERROR(ENOMEM);
>
> -dj->new_pts = 0;
> -dj->i1 = 0;
> -dj->i2 = 1;
> -dj->i3 = 2;
> -dj->i4 = 3;
> -dj->start_count = dj->cycle + 2;
> +s->new_pts = 0;
> +s->i1 = 0;
> +s->i2 = 1;
> +s->i3 = 2;
> +s->i4 = 3;
> +s->start_count = s->cycle + 2;
>
>  return 0;
>  }
>
>  static av_cold void dejudder_uninit(AVFilterContext *ctx)
>  {
> -DejudderContext *dj = ctx->priv;
> +DejudderContext *s = ctx->priv;
>
> -av_freep(&(dj->ringbuff));
> +av_freep(&(s->ringbuff));
>  }
>
>  static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
> @@ -121,36 +121,36 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
> *frame)
>  int k;
>  AVFilterContext *ctx  = inlink->dst;
>  AVFilterLink *outlink = ctx->outputs[0];
> -DejudderContext *dj   = ctx->priv;
> -int64_t *judbuff  = dj->ringbuff;
> +DejudderContext *s   = ctx->priv;
> +int64_t *judbuff  = s->ringbuff;
>  int64_t next_pts  = frame->pts;
>  int64_t offset;
>
>  if (next_pts == AV_NOPTS_VALUE)
>  return ff_filter_frame(outlink, frame);
>
> -if (dj->start_count) {
> -dj->start_count--;
> -dj->new_pts = next_pts * 2 * dj->cycle;
> +if (s->start_count) {
> +s->start_count--;
> +s->new_pts = next_pts * 2 * s->cycle;
>  } else {
> -if (next_pts < judbuff[dj->i2]) {
> -offset = next_pts + judbuff[dj->i3] - judbuff[dj->i4] - 
> judbuff[dj->i1];
> -for (k = 0; k < dj->cycle + 2; k++)
> +if (next_pts < judbuff[s->i2]) {
> +offset = next_pts + judbuff[s->i3] - judbuff[s->i4] - 
> judbuff[s->i1];
> +for (k = 0; k < s->cycle + 2; k++)
>  judbuff[k] += offset;
>  }
> -dj->new_pts += (dj->cycle - 1) * (judbuff[dj->i3] - judbuff[dj->i1])
> -+ (dj->cycle + 1) * (next_pts - judbuff[dj->i4]);
> +s->new_pts += (s->cycle - 1) * (judbuff[s->i3] - judbuff[s->i1])
> ++ (s->cycle + 1) * (next_pts - judbuff[s->i4]);
>  }
>
> -judbuff[dj->i2] = next_pts;
> -dj->i1 = dj->i2;
> -dj->i2 = dj->i3;
> -dj->i3 = dj->i4;
> -dj->i4 = (dj->i4 + 1) % (dj->cycle + 2);
> +judbuff[s->i2] = next_pts;
> +s->i1 = s->i2;
> +s->i2 = s->i3;
> +s->i3 = s->i4;
> +s->i4 = (s->i4 + 1) % (s->cycle + 2);
>
> -fr

Re: [FFmpeg-devel] [PATCH] lavf/http: Fix parsing http request data to not read over '\0'.

2015-08-20 Thread Nicolas George
Le tridi 3 fructidor, an CCXXIII, Stephan Holljes a écrit :
> Signed-off-by: Stephan Holljes 
> ---
>  libavformat/http.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

LGTM, thanks.

Note to Hendrik and the others who took over the merging: Until recently,
Michael pulled from my tree and pushed, to avoid interfering with the
merging process. What what is more convenient for you?

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH 1/2] lavf/http: Parse and/or expose various client data.

2015-08-20 Thread Nicolas George
Le tridi 3 fructidor, an CCXXIII, Stephan Holljes a écrit :
> In ffserver the User-Agent is used to decide how to deal with a
> client. (WMP being a special case.)

Ok, but that is special case for a specific application.

> That sounds pretty optimistic. Maybe it is trivial for you, but from
> my standpoint it looks like a rather large-ish undertaking to rewrite
> all the header-parsing code to utilize an AVDictionary.

You do not need to change the code to use the dictionary. That would be a
lot of work, but I do not think it would be very interesting. All you need
to do is to is to put all the headers in a dictionary, before the parsing
(or after, but if you do it before, the parsing can alter the buffer, that
is more convenient).

In http.c, near "!av_strcasecmp(tag, "Location")", you have the header name
in "tag" and its value in "p", just do a av_dict_add() on them with a bit of
tracking for the total number.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_dejudder: use the name 's' for the pointer to the private context

2015-08-20 Thread Paul B Mahol
On 8/20/15, Ganesh Ajjanagadde  wrote:
> On Thu, Aug 20, 2015 at 11:24 AM, Paul B Mahol  wrote:
>> This is shorter and consistent across filters.
>>
>> Signed-off-by: Paul B Mahol 
>> ---
>>  libavfilter/vf_dejudder.c | 66
>> +++
>>  1 file changed, 33 insertions(+), 33 deletions(-)
>>
>> diff --git a/libavfilter/vf_dejudder.c b/libavfilter/vf_dejudder.c
>> index ab525b6..4705cb6 100644
>> --- a/libavfilter/vf_dejudder.c
>> +++ b/libavfilter/vf_dejudder.c
>> @@ -55,7 +55,7 @@
>>  #include "internal.h"
>>  #include "video.h"
>>
>> -typedef struct {
>> +typedef struct DejudderContext {
>
> This should not be part of this patch.
> Doing a random scan through filters,
> it seems like there is a lack of consistency on this typedef:
> see e.g vf_decimate, vf_bbox (written by others),
> af_aphaser (written by you), and this one (in its current state).
>
> If you want consistency in this, perhaps a single patch going through
> all filters and unifying this would be useful.
>
> As an aside, I do not like typedef of structures at all;
> note that kernel coding style expressly forbids this:
> see e.g
> https://stackoverflow.com/questions/252780/why-should-we-typedef-a-struct-so-often-in-c
> (Jens and Jerry Hick's answer) and comments for that.
> However, this is rampant in FFmpeg,
> and will need further discussion.
> Notice that the developer documentation does not cover this.
>
>>  const AVClass *class;
>>  int64_t *ringbuff;
>>  int i1, i2, i3, i4;
>> @@ -80,40 +80,40 @@ AVFILTER_DEFINE_CLASS(dejudder);
>>  static int config_out_props(AVFilterLink *outlink)
>>  {
>>  AVFilterContext *ctx = outlink->src;
>> -DejudderContext *dj = ctx->priv;
>> +DejudderContext *s = ctx->priv;
>>  AVFilterLink *inlink = outlink->src->inputs[0];
>>
>> -outlink->time_base = av_mul_q(inlink->time_base, av_make_q(1, 2 *
>> dj->cycle));
>> -outlink->frame_rate = av_mul_q(inlink->frame_rate, av_make_q(2 *
>> dj->cycle, 1));
>> +outlink->time_base = av_mul_q(inlink->time_base, av_make_q(1, 2 *
>> s->cycle));
>> +outlink->frame_rate = av_mul_q(inlink->frame_rate, av_make_q(2 *
>> s->cycle, 1));
>>
>> -av_log(ctx, AV_LOG_VERBOSE, "cycle:%d\n", dj->cycle);
>> +av_log(ctx, AV_LOG_VERBOSE, "cycle:%d\n", s->cycle);
>>
>>  return 0;
>>  }
>>
>>  static av_cold int dejudder_init(AVFilterContext *ctx)
>>  {
>> -DejudderContext *dj = ctx->priv;
>> +DejudderContext *s = ctx->priv;
>>
>> -dj->ringbuff = av_mallocz_array(dj->cycle+2, sizeof(*dj->ringbuff));
>> -if (!dj->ringbuff)
>> +s->ringbuff = av_mallocz_array(s->cycle+2, sizeof(*s->ringbuff));
>> +if (!s->ringbuff)
>>  return AVERROR(ENOMEM);
>>
>> -dj->new_pts = 0;
>> -dj->i1 = 0;
>> -dj->i2 = 1;
>> -dj->i3 = 2;
>> -dj->i4 = 3;
>> -dj->start_count = dj->cycle + 2;
>> +s->new_pts = 0;
>> +s->i1 = 0;
>> +s->i2 = 1;
>> +s->i3 = 2;
>> +s->i4 = 3;
>> +s->start_count = s->cycle + 2;
>>
>>  return 0;
>>  }
>>
>>  static av_cold void dejudder_uninit(AVFilterContext *ctx)
>>  {
>> -DejudderContext *dj = ctx->priv;
>> +DejudderContext *s = ctx->priv;
>>
>> -av_freep(&(dj->ringbuff));
>> +av_freep(&(s->ringbuff));
>>  }
>>
>>  static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
>> @@ -121,36 +121,36 @@ static int filter_frame(AVFilterLink *inlink,
>> AVFrame *frame)
>>  int k;
>>  AVFilterContext *ctx  = inlink->dst;
>>  AVFilterLink *outlink = ctx->outputs[0];
>> -DejudderContext *dj   = ctx->priv;
>> -int64_t *judbuff  = dj->ringbuff;
>> +DejudderContext *s   = ctx->priv;
>> +int64_t *judbuff  = s->ringbuff;
>>  int64_t next_pts  = frame->pts;
>>  int64_t offset;
>>
>>  if (next_pts == AV_NOPTS_VALUE)
>>  return ff_filter_frame(outlink, frame);
>>
>> -if (dj->start_count) {
>> -dj->start_count--;
>> -dj->new_pts = next_pts * 2 * dj->cycle;
>> +if (s->start_count) {
>> +s->start_count--;
>> +s->new_pts = next_pts * 2 * s->cycle;
>>  } else {
>> -if (next_pts < judbuff[dj->i2]) {
>> -offset = next_pts + judbuff[dj->i3] - judbuff[dj->i4] -
>> judbuff[dj->i1];
>> -for (k = 0; k < dj->cycle + 2; k++)
>> +if (next_pts < judbuff[s->i2]) {
>> +offset = next_pts + judbuff[s->i3] - judbuff[s->i4] -
>> judbuff[s->i1];
>> +for (k = 0; k < s->cycle + 2; k++)
>>  judbuff[k] += offset;
>>  }
>> -dj->new_pts += (dj->cycle - 1) * (judbuff[dj->i3] -
>> judbuff[dj->i1])
>> -+ (dj->cycle + 1) * (next_pts - judbuff[dj->i4]);
>> +s->new_pts += (s->cycle - 1) * (judbuff[s->i3] - judbuff[s->i1])
>> ++ (s->cycle + 1) * (next_pts - judbuff[s->i4]);
>>  }
>>
>> -judbuff[dj->i2] = next_pts;
>> -dj->i1 = dj->i2;
>> -dj->i2 = dj->i3;
>> -dj->i3 = dj->i4;
>> -dj-

[FFmpeg-devel] [PATCH v9] Add support for Audible AA files

2015-08-20 Thread Vesselin Bontchev
This patch revision (v9) adds me to the MAINTAINERS file.

VesselinFrom a9457dead0dac503c9aeca8d49bc89d5c9b607d9 Mon Sep 17 00:00:00 2001
From: Vesselin Bontchev 
Date: Sun, 19 Jul 2015 23:16:36 +0200
Subject: [PATCH] Add support for Audible AA files

https://en.wikipedia.org/wiki/Audible.com#Quality
---
 MAINTAINERS  |   1 +
 doc/demuxers.texi|   6 +
 doc/general.texi |   2 +
 libavformat/Makefile |   1 +
 libavformat/aadec.c  | 303 +++
 libavformat/allformats.c |   1 +
 6 files changed, 314 insertions(+)
 create mode 100644 libavformat/aadec.c

diff --git a/MAINTAINERS b/MAINTAINERS
index b2aaf3c..94405e3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -399,6 +399,7 @@ Generic parts:
 
 Muxers/Demuxers:
   4xm.c Mike Melanson
+  aadec.c   Vesselin Bontchev (vesselin.bontchev at yandex dot com)
   adtsenc.c Robert Swain
   afc.c Paul B Mahol
   aiffdec.c Baptiste Coudurier, Matthieu Bouron
diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index eb7cd4b..34bfc9b 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -18,6 +18,12 @@ enabled demuxers.
 
 The description of some of the currently available demuxers follows.
 
+@section aa
+
+Audible Format 2, 3, and 4 demuxer.
+
+This demuxer is used to demux Audible Format 2, 3, and 4 (.aa) files.
+
 @section applehttp
 
 Apple HTTP Live Streaming demuxer.
diff --git a/doc/general.texi b/doc/general.texi
index a260e79..2b782e0 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -228,6 +228,8 @@ library:
 @item 8088flex TMV  @tab   @tab X
 @item AAX   @tab   @tab X
 @tab Audible Enhanced Audio format, used in audiobooks.
+@item AA@tab   @tab X
+@tab Audible Format 2, 3, and 4, used in audiobooks.
 @item ACT Voice @tab   @tab X
 @tab contains G.729 audio
 @item Adobe Filmstrip   @tab X @tab X
diff --git a/libavformat/Makefile b/libavformat/Makefile
index cc73fd8..466da51 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -59,6 +59,7 @@ OBJS-$(CONFIG_SHARED)+= log2_tab.o golomb_tab.o
 
 # muxers/demuxers
 OBJS-$(CONFIG_A64_MUXER) += a64.o rawenc.o
+OBJS-$(CONFIG_AA_DEMUXER)+= aadec.o
 OBJS-$(CONFIG_AAC_DEMUXER)   += aacdec.o apetag.o img2.o rawdec.o
 OBJS-$(CONFIG_AC3_DEMUXER)   += ac3dec.o rawdec.o
 OBJS-$(CONFIG_AC3_MUXER) += rawenc.o
diff --git a/libavformat/aadec.c b/libavformat/aadec.c
new file mode 100644
index 000..8e6140e
--- /dev/null
+++ b/libavformat/aadec.c
@@ -0,0 +1,303 @@
+/*
+ * Audible AA demuxer
+ * Copyright (c) 2015 Vesselin Bontchev
+ *
+ * Header parsing is borrowed from https://github.com/jteeuwen/audible project.
+ * Copyright (c) 2001-2014, Jim Teeuwen
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ *list of conditions and the following disclaimer.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "avformat.h"
+#include "internal.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/tea.h"
+#include "libavutil/opt.h"
+
+#define AA_MAGIC 1469084982 /* this identifies an audible .aa file */
+#define MAX_CODEC_SECOND_SIZE 3982
+#define MAX_TOC_ENTRIES 16
+#define MAX_DICTIONARY_ENTRIES 128
+#define TEA_BLOCK_SIZE 8
+
+typedef struct AADemuxContext {
+AVClass *class;
+uint8_t *aa_fixed_key;
+int aa_fixed_key_len;
+int codec_second_size;
+int current_codec_second_size;
+int chapter_idx;
+struct AVTEA *tea_ctx;
+uint8_t file_key[16];
+int64_t current_chapter_size;
+} AADemuxContext;
+
+static int get_second_size(char *codec_name)
+{
+int result = -1;
+
+if (!strcmp(codec_name, "mp332")) {
+result = 3982;
+} else if (!strcmp(codec_name, "acelp16")) {
+result = 2000;
+} else if (!strcmp(codec_name

Re: [FFmpeg-devel] [PATCH] avfilter/vf_dejudder: use the name 's' for the pointer to the private context

2015-08-20 Thread Ganesh Ajjanagadde
On Thu, Aug 20, 2015 at 12:59 PM, Paul B Mahol  wrote:
> On 8/20/15, Ganesh Ajjanagadde  wrote:
>> On Thu, Aug 20, 2015 at 11:24 AM, Paul B Mahol  wrote:
>>> This is shorter and consistent across filters.
>>>
>>> Signed-off-by: Paul B Mahol 
>>> ---
>>>  libavfilter/vf_dejudder.c | 66
>>> +++
>>>  1 file changed, 33 insertions(+), 33 deletions(-)
>>>
>>> diff --git a/libavfilter/vf_dejudder.c b/libavfilter/vf_dejudder.c
>>> index ab525b6..4705cb6 100644
>>> --- a/libavfilter/vf_dejudder.c
>>> +++ b/libavfilter/vf_dejudder.c
>>> @@ -55,7 +55,7 @@
>>>  #include "internal.h"
>>>  #include "video.h"
>>>
>>> -typedef struct {
>>> +typedef struct DejudderContext {
>>
>> This should not be part of this patch.
>> Doing a random scan through filters,
>> it seems like there is a lack of consistency on this typedef:
>> see e.g vf_decimate, vf_bbox (written by others),
>> af_aphaser (written by you), and this one (in its current state).
>>
>> If you want consistency in this, perhaps a single patch going through
>> all filters and unifying this would be useful.
>>
>> As an aside, I do not like typedef of structures at all;
>> note that kernel coding style expressly forbids this:
>> see e.g
>> https://stackoverflow.com/questions/252780/why-should-we-typedef-a-struct-so-often-in-c
>> (Jens and Jerry Hick's answer) and comments for that.
>> However, this is rampant in FFmpeg,
>> and will need further discussion.
>> Notice that the developer documentation does not cover this.
>>
>>>  const AVClass *class;
>>>  int64_t *ringbuff;
>>>  int i1, i2, i3, i4;
>>> @@ -80,40 +80,40 @@ AVFILTER_DEFINE_CLASS(dejudder);
>>>  static int config_out_props(AVFilterLink *outlink)
>>>  {
>>>  AVFilterContext *ctx = outlink->src;
>>> -DejudderContext *dj = ctx->priv;
>>> +DejudderContext *s = ctx->priv;
>>>  AVFilterLink *inlink = outlink->src->inputs[0];
>>>
>>> -outlink->time_base = av_mul_q(inlink->time_base, av_make_q(1, 2 *
>>> dj->cycle));
>>> -outlink->frame_rate = av_mul_q(inlink->frame_rate, av_make_q(2 *
>>> dj->cycle, 1));
>>> +outlink->time_base = av_mul_q(inlink->time_base, av_make_q(1, 2 *
>>> s->cycle));
>>> +outlink->frame_rate = av_mul_q(inlink->frame_rate, av_make_q(2 *
>>> s->cycle, 1));
>>>
>>> -av_log(ctx, AV_LOG_VERBOSE, "cycle:%d\n", dj->cycle);
>>> +av_log(ctx, AV_LOG_VERBOSE, "cycle:%d\n", s->cycle);
>>>
>>>  return 0;
>>>  }
>>>
>>>  static av_cold int dejudder_init(AVFilterContext *ctx)
>>>  {
>>> -DejudderContext *dj = ctx->priv;
>>> +DejudderContext *s = ctx->priv;
>>>
>>> -dj->ringbuff = av_mallocz_array(dj->cycle+2, sizeof(*dj->ringbuff));
>>> -if (!dj->ringbuff)
>>> +s->ringbuff = av_mallocz_array(s->cycle+2, sizeof(*s->ringbuff));
>>> +if (!s->ringbuff)
>>>  return AVERROR(ENOMEM);
>>>
>>> -dj->new_pts = 0;
>>> -dj->i1 = 0;
>>> -dj->i2 = 1;
>>> -dj->i3 = 2;
>>> -dj->i4 = 3;
>>> -dj->start_count = dj->cycle + 2;
>>> +s->new_pts = 0;
>>> +s->i1 = 0;
>>> +s->i2 = 1;
>>> +s->i3 = 2;
>>> +s->i4 = 3;
>>> +s->start_count = s->cycle + 2;
>>>
>>>  return 0;
>>>  }
>>>
>>>  static av_cold void dejudder_uninit(AVFilterContext *ctx)
>>>  {
>>> -DejudderContext *dj = ctx->priv;
>>> +DejudderContext *s = ctx->priv;
>>>
>>> -av_freep(&(dj->ringbuff));
>>> +av_freep(&(s->ringbuff));
>>>  }
>>>
>>>  static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
>>> @@ -121,36 +121,36 @@ static int filter_frame(AVFilterLink *inlink,
>>> AVFrame *frame)
>>>  int k;
>>>  AVFilterContext *ctx  = inlink->dst;
>>>  AVFilterLink *outlink = ctx->outputs[0];
>>> -DejudderContext *dj   = ctx->priv;
>>> -int64_t *judbuff  = dj->ringbuff;
>>> +DejudderContext *s   = ctx->priv;
>>> +int64_t *judbuff  = s->ringbuff;
>>>  int64_t next_pts  = frame->pts;
>>>  int64_t offset;
>>>
>>>  if (next_pts == AV_NOPTS_VALUE)
>>>  return ff_filter_frame(outlink, frame);
>>>
>>> -if (dj->start_count) {
>>> -dj->start_count--;
>>> -dj->new_pts = next_pts * 2 * dj->cycle;
>>> +if (s->start_count) {
>>> +s->start_count--;
>>> +s->new_pts = next_pts * 2 * s->cycle;
>>>  } else {
>>> -if (next_pts < judbuff[dj->i2]) {
>>> -offset = next_pts + judbuff[dj->i3] - judbuff[dj->i4] -
>>> judbuff[dj->i1];
>>> -for (k = 0; k < dj->cycle + 2; k++)
>>> +if (next_pts < judbuff[s->i2]) {
>>> +offset = next_pts + judbuff[s->i3] - judbuff[s->i4] -
>>> judbuff[s->i1];
>>> +for (k = 0; k < s->cycle + 2; k++)
>>>  judbuff[k] += offset;
>>>  }
>>> -dj->new_pts += (dj->cycle - 1) * (judbuff[dj->i3] -
>>> judbuff[dj->i1])
>>> -+ (dj->cycle + 1) * (next_pts - judbuff[dj->i4]);
>>> +s->new_pts += (s->cycle - 1) * (judbuff[s->i3] - judbuff[s->i1])
>>> +

Re: [FFmpeg-devel] [PATCHv2] avformat/webmdashenc: fix uninitialized variable

2015-08-20 Thread Ronald S. Bultje
Hi,

On Thu, Aug 20, 2015 at 11:18 AM, Ganesh Ajjanagadde  wrote:

> Fixes -Wsometimes-uninitialized from
>
> http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1
>
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libavformat/webmdashenc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
> index 76ea423..898e464 100644
> --- a/libavformat/webmdashenc.c
> +++ b/libavformat/webmdashenc.c
> @@ -392,10 +392,10 @@ static int write_adaptation_set(AVFormatContext *s,
> int as_index)
>  if (w->is_live) {
>  AVDictionaryEntry *filename =
>  av_dict_get(s->streams[as->streams[i]]->metadata,
> FILENAME, NULL, 0);
> -if (!filename ||
> -(ret = parse_filename(filename->value,
> &representation_id, NULL, NULL))) {
> +if (!filename)
> +return AVERROR(EINVAL);
> +if (ret = parse_filename(filename->value, &representation_id,
> NULL, NULL))
>  return ret;
> -}
>  } else {
>  representation_id = av_asprintf("%d", w->representation_id++);
>  if (!representation_id) return AVERROR(ENOMEM);
> --
> 2.5.0


lgtm.

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


Re: [FFmpeg-devel] [PATCH 1/2] lavf/http: Parse and/or expose various client data.

2015-08-20 Thread Stephan Holljes
On Thu, Aug 20, 2015 at 6:51 PM, Nicolas George  wrote:
> Le tridi 3 fructidor, an CCXXIII, Stephan Holljes a écrit :
>> In ffserver the User-Agent is used to decide how to deal with a
>> client. (WMP being a special case.)
>
> Ok, but that is special case for a specific application.
>
>> That sounds pretty optimistic. Maybe it is trivial for you, but from
>> my standpoint it looks like a rather large-ish undertaking to rewrite
>> all the header-parsing code to utilize an AVDictionary.
>
> You do not need to change the code to use the dictionary. That would be a
> lot of work, but I do not think it would be very interesting. All you need
> to do is to is to put all the headers in a dictionary, before the parsing
> (or after, but if you do it before, the parsing can alter the buffer, that
> is more convenient).
>
> In http.c, near "!av_strcasecmp(tag, "Location")", you have the header name
> in "tag" and its value in "p", just do a av_dict_add() on them with a bit of
> tracking for the total number.

You are right, it was quite simple if I just keep a copy. I will send
a patch shortly.

>
> Regards,
>
> --
>   Nicolas George
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

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


[FFmpeg-devel] [PATCH] lavf/http: Export headers as AVDictionary

2015-08-20 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 libavformat/http.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/libavformat/http.c b/libavformat/http.c
index 3fd0496..2c51491 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -48,6 +48,7 @@
 #define MAX_REDIRECTS 8
 #define HTTP_SINGLE   1
 #define HTTP_MUTLI2
+#define MAX_HEADER_LINES 100
 typedef enum {
 LOWER_PROTO,
 READ_HEADERS,
@@ -69,6 +70,8 @@ typedef struct HTTPContext {
 HTTPAuthState auth_state;
 HTTPAuthState proxy_auth_state;
 char *headers;
+AVDictionary *headers_dict;
+int nb_headers;
 char *mime_type;
 char *user_agent;
 char *content_type;
@@ -130,6 +133,7 @@ static const AVOption options[] = {
 { "chunked_post", "use(s) chunked transfer-encoding for posts", 
OFFSET(chunked_post), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, D | E },
 { "skip_read_header", "skip lower protocol initialization and reading HTTP 
headers.", OFFSET(skip_read_header), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, E },
 { "headers", "set custom HTTP headers, can override built in default 
headers", OFFSET(headers), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D | E },
+{ "headers_dict", "Contains the parsed headers as a dictionary.", 
OFFSET(headers_dict), AV_OPT_TYPE_DICT, { 0 }, 0, 0, AV_OPT_FLAG_EXPORT | D | E 
},
 { "content_type", "set a specific content type for the POST messages", 
OFFSET(content_type), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D | E },
 { "body", "set the body of a simple HTTP reply", OFFSET(body), 
AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
 { "user_agent", "override User-Agent header", OFFSET(user_agent), 
AV_OPT_TYPE_STRING, { .str = DEFAULT_USER_AGENT }, 0, 0, D },
@@ -922,6 +926,10 @@ static int process_line(URLContext *h, char *line, int 
line_count,
 return AVERROR(ENOMEM);
 }
 }
+if (s->nb_headers < MAX_HEADER_LINES) {
+av_dict_set(&s->headers_dict, tag, p, 0);
+s->nb_headers++;
+}
 return 1;
 }
 
@@ -1044,6 +1052,7 @@ static int http_read_header(URLContext *h, int 
*new_location)
 int err = 0;
 
 s->chunksize = -1;
+s->nb_headers = 0;
 
 for (;;) {
 if ((err = http_get_line(s, line, sizeof(line))) < 0)
-- 
2.1.0

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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_dejudder: use the name 's' for the pointer to the private context

2015-08-20 Thread Clément Bœsch
On Thu, Aug 20, 2015 at 01:10:43PM -0400, Ganesh Ajjanagadde wrote:
[...]
> I know what s is doing, I just fail to see the connection between the name
> "s" and "filter private context".

s originally stands for struct iirc

-- 
Clément B.


pgperHJDLxk01.pgp
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_dejudder: use the name 's' for the pointer to the private context

2015-08-20 Thread Ganesh Ajjanagadde
On Thu, Aug 20, 2015 at 1:53 PM, Clément Bœsch  wrote:
> On Thu, Aug 20, 2015 at 01:10:43PM -0400, Ganesh Ajjanagadde wrote:
> [...]
>> I know what s is doing, I just fail to see the connection between the name
>> "s" and "filter private context".
>
> s originally stands for struct iirc

If that is the case, then it is essentially the most uninformative
name one can use.
At least "p" tells us that it is private.
Note that if we did not use typedefs for the structs, it actually
conveys zero information.
I am now even more convinced that changing things to "s" across
filters is a bad idea.

>
> --
> Clément B.
>
> ___
> 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] lavf/http: Export headers as AVDictionary

2015-08-20 Thread Stephan Holljes
Actually I just noticed that Pragma-headers may appear multiple times.
What would be a good way to handle that? I thought about expanding the
header tag from "Pragma" to "Pragma-%02d" with either an incrementing
number or just using s->nb_headers. Is there a better solution?

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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_dejudder: use the name 's' for the pointer to the private context

2015-08-20 Thread Michael Niedermayer
On Thu, Aug 20, 2015 at 02:06:18PM -0400, Ganesh Ajjanagadde wrote:
> On Thu, Aug 20, 2015 at 1:53 PM, Clément Bœsch  wrote:
> > On Thu, Aug 20, 2015 at 01:10:43PM -0400, Ganesh Ajjanagadde wrote:
> > [...]
> >> I know what s is doing, I just fail to see the connection between the name
> >> "s" and "filter private context".
> >
> > s originally stands for struct iirc
> 
> If that is the case, then it is essentially the most uninformative
> name one can use.

> At least "p" tells us that it is private.

if p means private what would be used for public ?


[...]
-- 
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] ffserver: use -b instead of -ab for setting audio bitrate.

2015-08-20 Thread Paul B Mahol
On 8/18/15, Ronald S. Bultje  wrote:
> ---
>  ffserver_config.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/ffserver_config.c b/ffserver_config.c
> index 06bd8ac..de8a454 100644
> --- a/ffserver_config.c
> +++ b/ffserver_config.c
> @@ -230,9 +230,9 @@ static void add_codec(FFServerStream *stream,
> AVCodecContext *av,
>  /* compute default parameters */
>  switch(av->codec_type) {
>  case AVMEDIA_TYPE_AUDIO:
> -if (!av_dict_get(recommended, "ab", NULL, 0)) {
> +if (!av_dict_get(recommended, "b", NULL, 0)) {
>  av->bit_rate = 64000;
> -av_dict_set_int(&recommended, "ab", av->bit_rate, 0);
> +av_dict_set_int(&recommended, "b", av->bit_rate, 0);
>  WARNING("Setting default value for audio bit rate = %d. "
>  "Use NoDefaults to disable it.\n",
>  av->bit_rate);
> @@ -923,7 +923,7 @@ static int ffserver_parse_config_stream(FFServerConfig
> *config, const char *cmd,
>  ffserver_get_arg(arg, sizeof(arg), p);
>  ffserver_set_float_param(&f, arg, 1000, -FLT_MAX, FLT_MAX, config,
>  "Invalid %s: '%s'\n", cmd, arg);
> -if (ffserver_save_avoption_int("ab", (int64_t)lrintf(f),
> +if (ffserver_save_avoption_int("b", (int64_t)lrintf(f),
> AV_OPT_FLAG_AUDIO_PARAM, config) <
> 0)
>  goto nomem;
>  } else if (!av_strcasecmp(cmd, "AudioChannels")) {
> --
> 2.1.2


I guess this is ok, assuming video bit rate can differ from audio bit
rate when set inside ffserver.

>
> ___
> 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/vf_dejudder: use the name 's' for the pointer to the private context

2015-08-20 Thread Ganesh Ajjanagadde
On Thu, Aug 20, 2015 at 2:59 PM, Michael Niedermayer
 wrote:
> On Thu, Aug 20, 2015 at 02:06:18PM -0400, Ganesh Ajjanagadde wrote:
>> On Thu, Aug 20, 2015 at 1:53 PM, Clément Bœsch  wrote:
>> > On Thu, Aug 20, 2015 at 01:10:43PM -0400, Ganesh Ajjanagadde wrote:
>> > [...]
>> >> I know what s is doing, I just fail to see the connection between the name
>> >> "s" and "filter private context".
>> >
>> > s originally stands for struct iirc
>>
>> If that is the case, then it is essentially the most uninformative
>> name one can use.
>
>> At least "p" tells us that it is private.
>
> if p means private what would be used for public ?

Personally I am not in favor of p,
as it is still too ambiguous as you rightly point out.
I instead favor the short abbreviation approach.
Nevertheless, I still consider this better than s,
if people have a non negotiable constraint of requiring a single character.

>
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> No snowflake in an avalanche ever feels responsible. -- Voltaire
>
> ___
> 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] [PATCHv2] avformat/webmdashenc: fix uninitialized variable

2015-08-20 Thread Michael Niedermayer
On Thu, Aug 20, 2015 at 01:14:10PM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On Thu, Aug 20, 2015 at 11:18 AM, Ganesh Ajjanagadde  > wrote:
> 
> > Fixes -Wsometimes-uninitialized from
> >
> > http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1
> >
> > Signed-off-by: Ganesh Ajjanagadde 
> > ---
> >  libavformat/webmdashenc.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
> > index 76ea423..898e464 100644
> > --- a/libavformat/webmdashenc.c
> > +++ b/libavformat/webmdashenc.c
> > @@ -392,10 +392,10 @@ static int write_adaptation_set(AVFormatContext *s,
> > int as_index)
> >  if (w->is_live) {
> >  AVDictionaryEntry *filename =
> >  av_dict_get(s->streams[as->streams[i]]->metadata,
> > FILENAME, NULL, 0);
> > -if (!filename ||
> > -(ret = parse_filename(filename->value,
> > &representation_id, NULL, NULL))) {
> > +if (!filename)
> > +return AVERROR(EINVAL);
> > +if (ret = parse_filename(filename->value, &representation_id,
> > NULL, NULL))
> >  return ret;
> > -}
> >  } else {
> >  representation_id = av_asprintf("%d", w->representation_id++);
> >  if (!representation_id) return AVERROR(ENOMEM);
> > --
> > 2.5.0
> 
> 
> lgtm.

applied

thanks

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

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact


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/4] avcodec/aacsbr_fixed: remove unused variable

2015-08-20 Thread Michael Niedermayer
On Thu, Aug 20, 2015 at 09:33:31AM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On Thu, Aug 20, 2015 at 4:28 AM, Ganesh Ajjanagadde 
> wrote:
> 
> > Fixes -Wunused-const-variable from
> >
> > http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1
> >
> > Signed-off-by: Ganesh Ajjanagadde 
> > ---
> >  libavcodec/aacsbr_fixed.c | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/libavcodec/aacsbr_fixed.c b/libavcodec/aacsbr_fixed.c
> > index 5a5c9cc..1fc7385 100644
> > --- a/libavcodec/aacsbr_fixed.c
> > +++ b/libavcodec/aacsbr_fixed.c
> > @@ -76,7 +76,6 @@ static VLC vlc_sbr[10];
> >  static void aacsbr_func_ptr_init(AACSBRContext *c);
> >  static const int CONST_LN2   = Q31(0.6931471806/256);  // ln(2)/256
> >  static const int CONST_RECIP_LN2 = Q31(0.7213475204);  // 0.5/ln(2)
> > -static const int CONST_SQRT2 = Q30(0.7071067812);  // sqrt(2)/2
> >  static const int CONST_076923= Q31(0.76923076923076923077f);
> 
> 
> ok.

applied

@Ganesh, if you want a git write account, send me your public ssh key

thanks

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

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell


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/vf_dejudder: use the name 's' for the pointer to the private context

2015-08-20 Thread Nicholas Robbins
On Thursday, August 20, 2015 3:13 PM, Ganesh Ajjanagadde  
wrote:
>
>
>On Thu, Aug 20, 2015 at 2:59 PM, Michael Niedermayer
> wrote:
>> On Thu, Aug 20, 2015 at 02:06:18PM -0400, Ganesh Ajjanagadde wrote:
>>> On Thu, Aug 20, 2015 at 1:53 PM, Clément Bœsch  wrote:
>>> > On Thu, Aug 20, 2015 at 01:10:43PM -0400, Ganesh Ajjanagadde wrote:
>>> > [...]
>>> >> I know what s is doing, I just fail to see the connection between the 
>>> >> name
>>> >> "s" and "filter private context".
>>> >
>>> > s originally stands for struct iirc
>>>
>>> If that is the case, then it is essentially the most uninformative
>>> name one can use.
>>
>>> At least "p" tells us that it is private.
>>
>> if p means private what would be used for public ?
>
>Personally I am not in favor of p,
>as it is still too ambiguous as you rightly point out.
>I instead favor the short abbreviation approach.
>Nevertheless, I still consider this better than s,
>if people have a non negotiable constraint of requiring a single character.


As the original author of the filter. I have absolutely no opinion.

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


Re: [FFmpeg-devel] [PATCH] api-seek-test: first version

2015-08-20 Thread Michael Niedermayer
On Fri, Jul 31, 2015 at 04:01:43PM +0300, Ludmila Glinskih wrote:
> Works only with video stream.
> First pass without seeking -- counts crcs of a frames and store it in an 
> array.
> After that it seeks a lot in different places and checks if crcs of these 
> frames and crcs of frames in array are the same.
> ---
>  tests/api/Makefile|   1 +
>  tests/api/api-seek-test.c | 278 
> ++
>  tests/fate/api.mak|   6 +
>  3 files changed, 285 insertions(+)
>  create mode 100644 tests/api/api-seek-test.c

applied

if you want to maintain the code in the future then please send a
patch that adds you to the MAINTAINERs file and to me your public ssh
key for git write access

thanks

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

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.


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


Re: [FFmpeg-devel] [PATCH] api-band-test: first version

2015-08-20 Thread Michael Niedermayer
Hi ludmila

did you see my reply on the ML (its also below)? as you didnt reply ...

On Tue, Aug 11, 2015 at 03:31:05AM +0200, Michael Niedermayer wrote:
> On Tue, Jul 28, 2015 at 09:54:06PM +0300, Ludmila Glinskih wrote:
> > Works only for flv, h263 and huffyuv decoders, for video with yuv420p pixel 
> > format.
> > Makes only one pass through the file (this should be changed to two passes)
> > ---
> >  tests/api/Makefile|   1 +
> >  tests/api/api-band-test.c | 229 
> > ++
> >  tests/fate/api.mak|   6 ++
> >  3 files changed, 236 insertions(+)
> >  create mode 100644 tests/api/api-band-test.c
> > 
> > diff --git a/tests/api/Makefile b/tests/api/Makefile
> > index 704987e..46fccb8 100644
> > --- a/tests/api/Makefile
> > +++ b/tests/api/Makefile
> > @@ -1,5 +1,6 @@
> >  APITESTPROGS-$(call ENCDEC, FLAC, FLAC) += api-flac
> >  APITESTPROGS-$(call DEMDEC, H264, H264) += api-h264
> > +APITESTPROGS-$(call DEMDEC, H263, H263) += api-band
> >  APITESTPROGS += $(APITESTPROGS-yes)
> >  
> >  APITESTOBJS  := $(APITESTOBJS:%=$(APITESTSDIR)%) 
> > $(APITESTPROGS:%=$(APITESTSDIR)/%-test.o)
> > diff --git a/tests/api/api-band-test.c b/tests/api/api-band-test.c
> > new file mode 100644
> > index 000..075b781
> > --- /dev/null
> > +++ b/tests/api/api-band-test.c
> > @@ -0,0 +1,229 @@
> > +/*
> > + * Copyright (c) 2015 Ludmila Glinskih
> > + *
> > + * Permission is hereby granted, free of charge, to any person obtaining a 
> > copy
> > + * of this software and associated documentation files (the "Software"), 
> > to deal
> > + * in the Software without restriction, including without limitation the 
> > rights
> > + * to use, copy, modify, merge, publish, distribute, sublicense, and/or 
> > sell
> > + * copies of the Software, and to permit persons to whom the Software is
> > + * furnished to do so, subject to the following conditions:
> > + *
> > + * The above copyright notice and this permission notice shall be included 
> > in
> > + * all copies or substantial portions of the Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
> > OR
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 
> > OTHER
> > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
> > FROM,
> > + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 
> > IN
> > + * THE SOFTWARE.
> > + */
> > +
> > +/**
> > + * draw_horiz_band test.
> > + */
> > +
> > +#include "libavutil/adler32.h"
> > +#include "libavcodec/avcodec.h"
> > +#include "libavformat/avformat.h"
> > +#include "libavutil/imgutils.h"
> > +
> > +uint8_t *slice_byte_buffer;
> > +uint8_t slice_byte_buffer_size;
> > +int draw_horiz_band_called;
> > +
> > +static void draw_horiz_band(AVCodecContext *ctx, const AVFrame *fr, int 
> > offset[4],
> > +int slice_position, int type, int height)
> > +{
> > +int i;
> > +
> > +draw_horiz_band_called = 1;
> > +
> > +if (!strcmp(av_get_pix_fmt_name(ctx->pix_fmt), "yuv420p")) {
> > +for (i = 0; i < height; i++) {
> > +memcpy(slice_byte_buffer + ctx->width * slice_position + i * 
> > ctx->width,
> > +   fr->data[0] + offset[0] + i * fr->linesize[0], 
> > ctx->width);
> > +}
> > +for (i = 0; i < height / 2; i++) {
> > +memcpy(slice_byte_buffer + ctx->width * ctx->height + 
> > ctx->width * slice_position / 4 + i * ctx->width / 2,
> > +   fr->data[1] + offset[1] + i * fr->linesize[1], 
> > ctx->width / 2);
> > +}
> > +for (i = 0; i < height / 2; i++) {
> > +memcpy(slice_byte_buffer + 5 * ctx->width * ctx->height / 4 + 
> > ctx->width * slice_position / 4 + i * ctx->width / 2,
> > +   fr->data[2] + offset[2] + i * fr->linesize[2], 
> > ctx->width / 2);
> > +}
> > +}
> > +
> > +else if (!strcmp(av_get_pix_fmt_name(ctx->pix_fmt), "yuv422p")) {
> > +for (i = 0; i < height; i++) {
> > +memcpy(slice_byte_buffer + ctx->width * slice_position + i * 
> > ctx->width,
> > +   fr->data[0] + offset[0] + i * fr->linesize[0], 
> > ctx->width);
> > +}
> > +for (i = 0; i < height; i++) {
> > +memcpy(slice_byte_buffer + ctx->width * ctx->height + 
> > ctx->width * slice_position / 2 + i * ctx->width / 2,
> > +   fr->data[1] + offset[1] + i * fr->linesize[1], 
> > ctx->width / 2);
> > +}
> > +for (i = 0; i < height; i++) {
> > +memcpy(slice_byte_buffer + 3 * ctx->width * ctx->height / 2 + 
> > ctx->width * slice_position / 2 + i * ctx->width / 2,
> > +   fr->data[2] + offset[2] + i * fr->linesize[2], 
> > ctx->width / 2);
> > +}
> 
> This s

Re: [FFmpeg-devel] [PATCH 02/13] avfilter: add missing FF_API_AVFILTERPAD_PUBLIC guard

2015-08-20 Thread Andreas Cadhalpun
On 20.08.2015 01:33, Michael Niedermayer wrote:
> On Tue, Aug 18, 2015 at 11:47:45PM +0200, Andreas Cadhalpun wrote:
>>  graph2dot.c |3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>> 560d5f42580115baf305ba8ff985202b248b4864  
>> 0001-graph2dot-use-avfilter_pad_get_name-accessor-functio.patch
>> From 5c8d576ed73499cb41d8b7c5952f5917bca0df22 Mon Sep 17 00:00:00 2001
>> From: Andreas Cadhalpun 
>> Date: Tue, 18 Aug 2015 23:07:37 +0200
>> Subject: [PATCH] graph2dot: use avfilter_pad_get_name accessor function
> 
> LGTM

Pushed.

Best regards,
Andreas

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


Re: [FFmpeg-devel] [PATCH 2/4] avcodec/aacsbr_fixed: remove unused variable

2015-08-20 Thread Ganesh Ajjanagadde
On Thu, Aug 20, 2015 at 3:31 PM, Michael Niedermayer
 wrote:
> On Thu, Aug 20, 2015 at 09:33:31AM -0400, Ronald S. Bultje wrote:
>> Hi,
>>
>> On Thu, Aug 20, 2015 at 4:28 AM, Ganesh Ajjanagadde 
>> wrote:
>>
>> > Fixes -Wunused-const-variable from
>> >
>> > http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1
>> >
>> > Signed-off-by: Ganesh Ajjanagadde 
>> > ---
>> >  libavcodec/aacsbr_fixed.c | 1 -
>> >  1 file changed, 1 deletion(-)
>> >
>> > diff --git a/libavcodec/aacsbr_fixed.c b/libavcodec/aacsbr_fixed.c
>> > index 5a5c9cc..1fc7385 100644
>> > --- a/libavcodec/aacsbr_fixed.c
>> > +++ b/libavcodec/aacsbr_fixed.c
>> > @@ -76,7 +76,6 @@ static VLC vlc_sbr[10];
>> >  static void aacsbr_func_ptr_init(AACSBRContext *c);
>> >  static const int CONST_LN2   = Q31(0.6931471806/256);  // ln(2)/256
>> >  static const int CONST_RECIP_LN2 = Q31(0.7213475204);  // 0.5/ln(2)
>> > -static const int CONST_SQRT2 = Q30(0.7071067812);  // sqrt(2)/2
>> >  static const int CONST_076923= Q31(0.76923076923076923077f);
>>
>>
>> ok.
>
> applied
>
> @Ganesh, if you want a git write account, send me your public ssh key

Unless you consider it a burden to apply patches as opposed to me pushing,
I would prefer not to be entrusted with this responsibility at this stage.
Maybe in a year or two,
assuming I still continue with this work and the offer still stands.

>
> thanks
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> During times of universal deceit, telling the truth becomes a
> revolutionary act. -- George Orwell
>
> ___
> 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 2/4] avcodec/aacsbr_fixed: remove unused variable

2015-08-20 Thread Michael Niedermayer
On Thu, Aug 20, 2015 at 04:44:17PM -0400, Ganesh Ajjanagadde wrote:
> On Thu, Aug 20, 2015 at 3:31 PM, Michael Niedermayer
>  wrote:
> > On Thu, Aug 20, 2015 at 09:33:31AM -0400, Ronald S. Bultje wrote:
> >> Hi,
> >>
> >> On Thu, Aug 20, 2015 at 4:28 AM, Ganesh Ajjanagadde 
> >> 
> >> wrote:
> >>
> >> > Fixes -Wunused-const-variable from
> >> >
> >> > http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1
> >> >
> >> > Signed-off-by: Ganesh Ajjanagadde 
> >> > ---
> >> >  libavcodec/aacsbr_fixed.c | 1 -
> >> >  1 file changed, 1 deletion(-)
> >> >
> >> > diff --git a/libavcodec/aacsbr_fixed.c b/libavcodec/aacsbr_fixed.c
> >> > index 5a5c9cc..1fc7385 100644
> >> > --- a/libavcodec/aacsbr_fixed.c
> >> > +++ b/libavcodec/aacsbr_fixed.c
> >> > @@ -76,7 +76,6 @@ static VLC vlc_sbr[10];
> >> >  static void aacsbr_func_ptr_init(AACSBRContext *c);
> >> >  static const int CONST_LN2   = Q31(0.6931471806/256);  // ln(2)/256
> >> >  static const int CONST_RECIP_LN2 = Q31(0.7213475204);  // 0.5/ln(2)
> >> > -static const int CONST_SQRT2 = Q30(0.7071067812);  // sqrt(2)/2
> >> >  static const int CONST_076923= Q31(0.76923076923076923077f);
> >>
> >>
> >> ok.
> >
> > applied
> >
> > @Ganesh, if you want a git write account, send me your public ssh key
> 
> Unless you consider it a burden to apply patches as opposed to me pushing,
> I would prefer not to be entrusted with this responsibility at this stage.
> Maybe in a year or two,

np, but please remind me in a year, i will forget

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

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.


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/4] avcodec/metasound_data: remove unused variable

2015-08-20 Thread Ganesh Ajjanagadde
On Thu, Aug 20, 2015 at 6:37 AM, Michael Niedermayer
 wrote:
> On Thu, Aug 20, 2015 at 04:34:19AM -0400, Ganesh Ajjanagadde wrote:
>> On Thu, Aug 20, 2015 at 4:28 AM, Ganesh Ajjanagadde
>>  wrote:
>> > Fixes -Wunused-const-variable from
>> > http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1
>> >
>> > Signed-off-by: Ganesh Ajjanagadde 
>> > ---
>> >  libavcodec/metasound_data.c | 4 
>> >  1 file changed, 4 deletions(-)
>> >
>> > diff --git a/libavcodec/metasound_data.c b/libavcodec/metasound_data.c
>> > index e439b3d..da2548a 100644
>> > --- a/libavcodec/metasound_data.c
>> > +++ b/libavcodec/metasound_data.c
>> > @@ -14946,10 +14946,6 @@ static const uint16_t bark_tab_s16_128[] = {
>> >  2, 2, 2, 3, 3, 5, 7, 12, 25, 67
>> >  };
>> >
>> > -static const uint16_t bark_tab_s16_64[] = {
>> > -1, 1, 2, 2, 3, 6, 11, 38
>> > -};
>> > -
>> >  static const uint16_t bark_tab_l16s_1024[] = {
>> >9,   9,   8,   9,  10,   9,  10,  10,
>> >   10,  12,  11,  13,  13,  14,  16,  17,
>> > --
>> > 2.5.0
>> >
>>
>> Some comments:
>> 1. I am still working on the remaining warnings and sent these mainly
>> for feedback.
>> If people think these are too trivial/waste of time I will refrain
>> from these in future.
>
>> 2. If above are ok, I can squash complete warning cleanup (from this
>> file) into single
>> patch if that is preferred.
>
> i dont think this particular table removial should be squashed with
> anything as its quite possible the table would be used in the future
> and a seperate commit is (slihgtly) easier to revert

Perhaps nontrivial unused stuff (which one can't come up with in a few minutes)
should simply be commented out.
It will be easier for a future developer to work on it,
since they won't have to go through the git logs to find the commit removing
the data.

Do you prefer the commenting out, or the deletion?

>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> When the tyrant has disposed of foreign enemies by conquest or treaty, and
> there is nothing more to fear from them, then he is always stirring up
> some war or other, in order that the people may require a leader. -- Plato
>
> ___
> 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 1/4] avcodec/metasound_data: remove unused variable

2015-08-20 Thread Michael Niedermayer
On Thu, Aug 20, 2015 at 05:12:40PM -0400, Ganesh Ajjanagadde wrote:
> On Thu, Aug 20, 2015 at 6:37 AM, Michael Niedermayer
>  wrote:
> > On Thu, Aug 20, 2015 at 04:34:19AM -0400, Ganesh Ajjanagadde wrote:
> >> On Thu, Aug 20, 2015 at 4:28 AM, Ganesh Ajjanagadde
> >>  wrote:
> >> > Fixes -Wunused-const-variable from
> >> > http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1
> >> >
> >> > Signed-off-by: Ganesh Ajjanagadde 
> >> > ---
> >> >  libavcodec/metasound_data.c | 4 
> >> >  1 file changed, 4 deletions(-)
> >> >
> >> > diff --git a/libavcodec/metasound_data.c b/libavcodec/metasound_data.c
> >> > index e439b3d..da2548a 100644
> >> > --- a/libavcodec/metasound_data.c
> >> > +++ b/libavcodec/metasound_data.c
> >> > @@ -14946,10 +14946,6 @@ static const uint16_t bark_tab_s16_128[] = {
> >> >  2, 2, 2, 3, 3, 5, 7, 12, 25, 67
> >> >  };
> >> >
> >> > -static const uint16_t bark_tab_s16_64[] = {
> >> > -1, 1, 2, 2, 3, 6, 11, 38
> >> > -};
> >> > -
> >> >  static const uint16_t bark_tab_l16s_1024[] = {
> >> >9,   9,   8,   9,  10,   9,  10,  10,
> >> >   10,  12,  11,  13,  13,  14,  16,  17,
> >> > --
> >> > 2.5.0
> >> >
> >>
> >> Some comments:
> >> 1. I am still working on the remaining warnings and sent these mainly
> >> for feedback.
> >> If people think these are too trivial/waste of time I will refrain
> >> from these in future.
> >
> >> 2. If above are ok, I can squash complete warning cleanup (from this
> >> file) into single
> >> patch if that is preferred.
> >
> > i dont think this particular table removial should be squashed with
> > anything as its quite possible the table would be used in the future
> > and a seperate commit is (slihgtly) easier to revert
> 
> Perhaps nontrivial unused stuff (which one can't come up with in a few 
> minutes)
> should simply be commented out.
> It will be easier for a future developer to work on it,
> since they won't have to go through the git logs to find the commit removing
> the data.
> 
> Do you prefer the commenting out, or the deletion?

i think commenting out is a good idea

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

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.


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


[FFmpeg-devel] [PATCH] lavf/http: implement directory listing callbacks for Apache

2015-08-20 Thread Mariusz Szczepańczyk
---
 configure  |   3 +
 libavformat/http.c | 194 +
 2 files changed, 197 insertions(+)

diff --git a/configure b/configure
index e67ddf6..401e041 100755
--- a/configure
+++ b/configure
@@ -265,6 +265,7 @@ External library support:
   --enable-libxcb-shm  enable X11 grabbing shm communication [autodetect]
   --enable-libxcb-xfixes   enable X11 grabbing mouse rendering [autodetect]
   --enable-libxcb-shapeenable X11 grabbing shape rendering [autodetect]
+  --enable-libxml2 enable HTML parsing via libxml2 [no]
   --enable-libxvid enable Xvid encoding via xvidcore,
native MPEG-4/Xvid encoder exists [no]
   --enable-libzmq  enable message passing via libzmq [no]
@@ -1428,6 +1429,7 @@ EXTERNAL_LIBRARY_LIST="
 libxcb_shm
 libxcb_shape
 libxcb_xfixes
+libxml2
 libxvid
 libzmq
 libzvbi
@@ -5309,6 +5311,7 @@ enabled libx265   && require_pkg_config x265 
x265.h x265_api_get &&
  { check_cpp_condition x265.h "X265_BUILD >= 57" ||
die "ERROR: libx265 version must be >= 57."; }
 enabled libxavs   && require libxavs xavs.h xavs_encoder_encode -lxavs
+enabled libxml2   && require_pkg_config libxml-2.0 libxml/parser.h 
xmlInitParser
 enabled libxvid   && require libxvid xvid.h xvid_global -lxvidcore
 enabled libzmq&& require_pkg_config libzmq zmq.h zmq_ctx_new
 enabled libzvbi   && require libzvbi libzvbi.h vbi_decoder_new -lzvbi
diff --git a/libavformat/http.c b/libavformat/http.c
index 1eb716b..df45958 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -21,6 +21,10 @@
 
 #include "config.h"
 
+#if CONFIG_LIBXML2
+#include 
+#endif /* CONFIG_LIBXML2 */
+
 #if CONFIG_ZLIB
 #include 
 #endif /* CONFIG_ZLIB */
@@ -54,6 +58,16 @@ typedef enum {
 FINISH
 }HandshakeState;
 
+typedef struct AVIODirEntryQueueNode {
+struct AVIODirEntry *entry;
+struct AVIODirEntryQueueNode *next;
+} AVIODirEntryQueueNode;
+
+typedef struct AVIODirEntryQueue {
+struct AVIODirEntryQueueNode *front;
+struct AVIODirEntryQueueNode *rear;
+} AVIODirEntryQueue;
+
 typedef struct HTTPContext {
 const AVClass *class;
 URLContext *hd;
@@ -70,6 +84,7 @@ typedef struct HTTPContext {
 char *mime_type;
 char *user_agent;
 char *content_type;
+char *server;
 /* Set if the server correctly handles Connection: close and will close
  * the connection after feeding us the content. */
 int willclose;
@@ -111,6 +126,11 @@ typedef struct HTTPContext {
 int is_multi_client;
 HandshakeState handshake_step;
 int is_connected_server;
+#if CONFIG_LIBXML2
+htmlParserCtxtPtr html_parser;
+AVIODirEntryQueue *entry_queue;
+AVIODirEntry *entry;
+#endif /* CONFIG_LIBXML2 */
 } HTTPContext;
 
 #define OFFSET(x) offsetof(HTTPContext, x)
@@ -808,6 +828,8 @@ static int process_line(URLContext *h, char *line, int 
line_count,
 if (!strcmp(p, "close"))
 s->willclose = 1;
 } else if (!av_strcasecmp(tag, "Server")) {
+av_free(s->server);
+s->server = av_strdup(p);
 if (!av_strcasecmp(p, "AkamaiGHost")) {
 s->is_akamai = 1;
 } else if (!av_strncasecmp(p, "MediaGateway", 12)) {
@@ -1409,6 +1431,7 @@ static int http_close(URLContext *h)
 if (s->hd)
 ffurl_closep(&s->hd);
 av_dict_free(&s->chained_options);
+av_freep(&s->server);
 return ret;
 }
 
@@ -1471,6 +1494,167 @@ static int http_get_file_handle(URLContext *h)
 return ffurl_get_file_handle(s->hd);
 }
 
+#if CONFIG_LIBXML2
+static void avio_dir_entry_queue_push(AVIODirEntryQueue *queue, AVIODirEntry 
*entry)
+{
+AVIODirEntryQueueNode *node;
+
+if (!queue)
+return;
+
+node = av_mallocz(sizeof(AVIODirEntryQueueNode));
+node->entry = entry;
+if (!queue->front) {
+queue->front = queue->rear = node;
+} else {
+queue->rear->next = node;
+queue->rear = node;
+}
+}
+
+static AVIODirEntry *avio_dir_entry_queue_pop(AVIODirEntryQueue *queue)
+{
+AVIODirEntry *entry;
+AVIODirEntryQueueNode *tmp;
+
+if (!queue || !queue->front)
+return NULL;
+
+tmp = queue->front;
+entry = queue->front->entry;
+if (queue->front == queue->rear)
+queue->front = queue->rear = NULL;
+else
+queue->front = queue->front->next;
+
+av_freep(&tmp);
+
+return entry;
+}
+
+static const char *get_attr(const xmlChar **attrs, const char *key)
+{
+unsigned char i;
+
+if (!attrs)
+return NULL;
+
+for (i = 0; attrs[i] && i < UCHAR_MAX - 1; i += 2) {
+if (!strcmp(attrs[i], key))
+return attrs[i + 1];
+}
+
+return NULL;
+}
+
+static void parse_apache(void *ctx, const xmlChar *tag, const xmlChar **attrs)
+{
+URLContext *h = (URLContext *) ctx;
+  

[FFmpeg-devel] [PATCH] avcodec/metasound_data: comment out unused variable

2015-08-20 Thread Ganesh Ajjanagadde
Fixes -Wunused-const-variable from
http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1

Signed-off-by: Ganesh Ajjanagadde 
---
 libavcodec/metasound_data.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/metasound_data.c b/libavcodec/metasound_data.c
index e439b3d..6d87117 100644
--- a/libavcodec/metasound_data.c
+++ b/libavcodec/metasound_data.c
@@ -14946,9 +14946,10 @@ static const uint16_t bark_tab_s16_128[] = {
 2, 2, 2, 3, 3, 5, 7, 12, 25, 67
 };
 
+/* unused
 static const uint16_t bark_tab_s16_64[] = {
 1, 1, 2, 2, 3, 6, 11, 38
-};
+}; */
 
 static const uint16_t bark_tab_l16s_1024[] = {
   9,   9,   8,   9,  10,   9,  10,  10,
-- 
2.5.0

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


Re: [FFmpeg-devel] [PATCH] lavf/http: implement directory listing callbacks for Apache

2015-08-20 Thread Ganesh Ajjanagadde
On Thu, Aug 20, 2015 at 5:32 PM, Mariusz Szczepańczyk
 wrote:
> ---
>  configure  |   3 +
>  libavformat/http.c | 194 
> +
>  2 files changed, 197 insertions(+)
>
> diff --git a/configure b/configure
> index e67ddf6..401e041 100755
> --- a/configure
> +++ b/configure
> @@ -265,6 +265,7 @@ External library support:
>--enable-libxcb-shm  enable X11 grabbing shm communication [autodetect]
>--enable-libxcb-xfixes   enable X11 grabbing mouse rendering [autodetect]
>--enable-libxcb-shapeenable X11 grabbing shape rendering [autodetect]
> +  --enable-libxml2 enable HTML parsing via libxml2 [no]
>--enable-libxvid enable Xvid encoding via xvidcore,
> native MPEG-4/Xvid encoder exists [no]
>--enable-libzmq  enable message passing via libzmq [no]
> @@ -1428,6 +1429,7 @@ EXTERNAL_LIBRARY_LIST="
>  libxcb_shm
>  libxcb_shape
>  libxcb_xfixes
> +libxml2
>  libxvid
>  libzmq
>  libzvbi
> @@ -5309,6 +5311,7 @@ enabled libx265   && require_pkg_config x265 
> x265.h x265_api_get &&
>   { check_cpp_condition x265.h "X265_BUILD >= 57" 
> ||
> die "ERROR: libx265 version must be >= 57."; }
>  enabled libxavs   && require libxavs xavs.h xavs_encoder_encode 
> -lxavs
> +enabled libxml2   && require_pkg_config libxml-2.0 libxml/parser.h 
> xmlInitParser
>  enabled libxvid   && require libxvid xvid.h xvid_global -lxvidcore
>  enabled libzmq&& require_pkg_config libzmq zmq.h zmq_ctx_new
>  enabled libzvbi   && require libzvbi libzvbi.h vbi_decoder_new -lzvbi
> diff --git a/libavformat/http.c b/libavformat/http.c
> index 1eb716b..df45958 100644
> --- a/libavformat/http.c
> +++ b/libavformat/http.c
> @@ -21,6 +21,10 @@
>
>  #include "config.h"
>
> +#if CONFIG_LIBXML2
> +#include 
> +#endif /* CONFIG_LIBXML2 */
> +
>  #if CONFIG_ZLIB
>  #include 
>  #endif /* CONFIG_ZLIB */
> @@ -54,6 +58,16 @@ typedef enum {
>  FINISH
>  }HandshakeState;
>
> +typedef struct AVIODirEntryQueueNode {
> +struct AVIODirEntry *entry;
> +struct AVIODirEntryQueueNode *next;
> +} AVIODirEntryQueueNode;
> +
> +typedef struct AVIODirEntryQueue {
> +struct AVIODirEntryQueueNode *front;
> +struct AVIODirEntryQueueNode *rear;
> +} AVIODirEntryQueue;
> +
>  typedef struct HTTPContext {
>  const AVClass *class;
>  URLContext *hd;
> @@ -70,6 +84,7 @@ typedef struct HTTPContext {
>  char *mime_type;
>  char *user_agent;
>  char *content_type;
> +char *server;
>  /* Set if the server correctly handles Connection: close and will close
>   * the connection after feeding us the content. */
>  int willclose;
> @@ -111,6 +126,11 @@ typedef struct HTTPContext {
>  int is_multi_client;
>  HandshakeState handshake_step;
>  int is_connected_server;
> +#if CONFIG_LIBXML2
> +htmlParserCtxtPtr html_parser;
> +AVIODirEntryQueue *entry_queue;
> +AVIODirEntry *entry;
> +#endif /* CONFIG_LIBXML2 */
>  } HTTPContext;
>
>  #define OFFSET(x) offsetof(HTTPContext, x)
> @@ -808,6 +828,8 @@ static int process_line(URLContext *h, char *line, int 
> line_count,
>  if (!strcmp(p, "close"))
>  s->willclose = 1;
>  } else if (!av_strcasecmp(tag, "Server")) {
> +av_free(s->server);
> +s->server = av_strdup(p);
>  if (!av_strcasecmp(p, "AkamaiGHost")) {
>  s->is_akamai = 1;
>  } else if (!av_strncasecmp(p, "MediaGateway", 12)) {
> @@ -1409,6 +1431,7 @@ static int http_close(URLContext *h)
>  if (s->hd)
>  ffurl_closep(&s->hd);
>  av_dict_free(&s->chained_options);
> +av_freep(&s->server);
>  return ret;
>  }
>
> @@ -1471,6 +1494,167 @@ static int http_get_file_handle(URLContext *h)
>  return ffurl_get_file_handle(s->hd);
>  }
>
> +#if CONFIG_LIBXML2
> +static void avio_dir_entry_queue_push(AVIODirEntryQueue *queue, AVIODirEntry 
> *entry)
> +{
> +AVIODirEntryQueueNode *node;
> +
> +if (!queue)
> +return;
> +
> +node = av_mallocz(sizeof(AVIODirEntryQueueNode));
> +node->entry = entry;
> +if (!queue->front) {
> +queue->front = queue->rear = node;
> +} else {
> +queue->rear->next = node;
> +queue->rear = node;
> +}
> +}
> +
> +static AVIODirEntry *avio_dir_entry_queue_pop(AVIODirEntryQueue *queue)
> +{
> +AVIODirEntry *entry;
> +AVIODirEntryQueueNode *tmp;
> +
> +if (!queue || !queue->front)
> +return NULL;
> +
> +tmp = queue->front;
> +entry = queue->front->entry;
> +if (queue->front == queue->rear)
> +queue->front = queue->rear = NULL;
> +else
> +queue->front = queue->front->next;
> +
> +av_freep(&tmp);
> +
> +return entry;
> +}
> +
> +static const char *get_attr(const xmlChar **attrs, const char *key)

Re: [FFmpeg-devel] [PATCH] lavf/http: implement directory listing callbacks for Apache

2015-08-20 Thread Mariusz Szczepańczyk
On Thu, Aug 20, 2015 at 11:38 PM, Ganesh Ajjanagadde 
wrote:

> On Thu, Aug 20, 2015 at 5:32 PM, Mariusz Szczepańczyk
>  wrote:
> > ---
> >  configure  |   3 +
> >  libavformat/http.c | 194
> +
> >  2 files changed, 197 insertions(+)
> >
> > diff --git a/configure b/configure
> > index e67ddf6..401e041 100755
> > --- a/configure
> > +++ b/configure
> > @@ -265,6 +265,7 @@ External library support:
> >--enable-libxcb-shm  enable X11 grabbing shm communication
> [autodetect]
> >--enable-libxcb-xfixes   enable X11 grabbing mouse rendering
> [autodetect]
> >--enable-libxcb-shapeenable X11 grabbing shape rendering
> [autodetect]
> > +  --enable-libxml2 enable HTML parsing via libxml2 [no]
> >--enable-libxvid enable Xvid encoding via xvidcore,
> > native MPEG-4/Xvid encoder exists [no]
> >--enable-libzmq  enable message passing via libzmq [no]
> > @@ -1428,6 +1429,7 @@ EXTERNAL_LIBRARY_LIST="
> >  libxcb_shm
> >  libxcb_shape
> >  libxcb_xfixes
> > +libxml2
> >  libxvid
> >  libzmq
> >  libzvbi
> > @@ -5309,6 +5311,7 @@ enabled libx265   && require_pkg_config
> x265 x265.h x265_api_get &&
> >   { check_cpp_condition x265.h "X265_BUILD
> >= 57" ||
> > die "ERROR: libx265 version must be >=
> 57."; }
> >  enabled libxavs   && require libxavs xavs.h xavs_encoder_encode
> -lxavs
> > +enabled libxml2   && require_pkg_config libxml-2.0
> libxml/parser.h xmlInitParser
> >  enabled libxvid   && require libxvid xvid.h xvid_global
> -lxvidcore
> >  enabled libzmq&& require_pkg_config libzmq zmq.h zmq_ctx_new
> >  enabled libzvbi   && require libzvbi libzvbi.h vbi_decoder_new
> -lzvbi
> > diff --git a/libavformat/http.c b/libavformat/http.c
> > index 1eb716b..df45958 100644
> > --- a/libavformat/http.c
> > +++ b/libavformat/http.c
> > @@ -21,6 +21,10 @@
> >
> >  #include "config.h"
> >
> > +#if CONFIG_LIBXML2
> > +#include 
> > +#endif /* CONFIG_LIBXML2 */
> > +
> >  #if CONFIG_ZLIB
> >  #include 
> >  #endif /* CONFIG_ZLIB */
> > @@ -54,6 +58,16 @@ typedef enum {
> >  FINISH
> >  }HandshakeState;
> >
> > +typedef struct AVIODirEntryQueueNode {
> > +struct AVIODirEntry *entry;
> > +struct AVIODirEntryQueueNode *next;
> > +} AVIODirEntryQueueNode;
> > +
> > +typedef struct AVIODirEntryQueue {
> > +struct AVIODirEntryQueueNode *front;
> > +struct AVIODirEntryQueueNode *rear;
> > +} AVIODirEntryQueue;
> > +
> >  typedef struct HTTPContext {
> >  const AVClass *class;
> >  URLContext *hd;
> > @@ -70,6 +84,7 @@ typedef struct HTTPContext {
> >  char *mime_type;
> >  char *user_agent;
> >  char *content_type;
> > +char *server;
> >  /* Set if the server correctly handles Connection: close and will
> close
> >   * the connection after feeding us the content. */
> >  int willclose;
> > @@ -111,6 +126,11 @@ typedef struct HTTPContext {
> >  int is_multi_client;
> >  HandshakeState handshake_step;
> >  int is_connected_server;
> > +#if CONFIG_LIBXML2
> > +htmlParserCtxtPtr html_parser;
> > +AVIODirEntryQueue *entry_queue;
> > +AVIODirEntry *entry;
> > +#endif /* CONFIG_LIBXML2 */
> >  } HTTPContext;
> >
> >  #define OFFSET(x) offsetof(HTTPContext, x)
> > @@ -808,6 +828,8 @@ static int process_line(URLContext *h, char *line,
> int line_count,
> >  if (!strcmp(p, "close"))
> >  s->willclose = 1;
> >  } else if (!av_strcasecmp(tag, "Server")) {
> > +av_free(s->server);
> > +s->server = av_strdup(p);
> >  if (!av_strcasecmp(p, "AkamaiGHost")) {
> >  s->is_akamai = 1;
> >  } else if (!av_strncasecmp(p, "MediaGateway", 12)) {
> > @@ -1409,6 +1431,7 @@ static int http_close(URLContext *h)
> >  if (s->hd)
> >  ffurl_closep(&s->hd);
> >  av_dict_free(&s->chained_options);
> > +av_freep(&s->server);
> >  return ret;
> >  }
> >
> > @@ -1471,6 +1494,167 @@ static int http_get_file_handle(URLContext *h)
> >  return ffurl_get_file_handle(s->hd);
> >  }
> >
> > +#if CONFIG_LIBXML2
> > +static void avio_dir_entry_queue_push(AVIODirEntryQueue *queue,
> AVIODirEntry *entry)
> > +{
> > +AVIODirEntryQueueNode *node;
> > +
> > +if (!queue)
> > +return;
> > +
> > +node = av_mallocz(sizeof(AVIODirEntryQueueNode));
> > +node->entry = entry;
> > +if (!queue->front) {
> > +queue->front = queue->rear = node;
> > +} else {
> > +queue->rear->next = node;
> > +queue->rear = node;
> > +}
> > +}
> > +
> > +static AVIODirEntry *avio_dir_entry_queue_pop(AVIODirEntryQueue *queue)
> > +{
> > +AVIODirEntry *entry;
> > +AVIODirEntryQueueNode *tmp;
> > +
> > +if (!queue || !queue->front)
> > +return NULL;
> > +
> 

Re: [FFmpeg-devel] [PATCH] avcodec/metasound_data: comment out unused variable

2015-08-20 Thread Michael Niedermayer
On Thu, Aug 20, 2015 at 05:34:52PM -0400, Ganesh Ajjanagadde wrote:
> Fixes -Wunused-const-variable from
> http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1
> 
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libavcodec/metasound_data.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

applied

thanks

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

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable


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


Re: [FFmpeg-devel] [PATCH] lavf/http: implement directory listing callbacks for Apache

2015-08-20 Thread Ganesh Ajjanagadde
On Thu, Aug 20, 2015 at 5:48 PM, Mariusz Szczepańczyk
 wrote:
> On Thu, Aug 20, 2015 at 11:38 PM, Ganesh Ajjanagadde 
> wrote:
>
>> On Thu, Aug 20, 2015 at 5:32 PM, Mariusz Szczepańczyk
>>  wrote:
>> > ---
>> >  configure  |   3 +
>> >  libavformat/http.c | 194
>> +
>> >  2 files changed, 197 insertions(+)
>> >
>> > diff --git a/configure b/configure
>> > index e67ddf6..401e041 100755
>> > --- a/configure
>> > +++ b/configure
>> > @@ -265,6 +265,7 @@ External library support:
>> >--enable-libxcb-shm  enable X11 grabbing shm communication
>> [autodetect]
>> >--enable-libxcb-xfixes   enable X11 grabbing mouse rendering
>> [autodetect]
>> >--enable-libxcb-shapeenable X11 grabbing shape rendering
>> [autodetect]
>> > +  --enable-libxml2 enable HTML parsing via libxml2 [no]
>> >--enable-libxvid enable Xvid encoding via xvidcore,
>> > native MPEG-4/Xvid encoder exists [no]
>> >--enable-libzmq  enable message passing via libzmq [no]
>> > @@ -1428,6 +1429,7 @@ EXTERNAL_LIBRARY_LIST="
>> >  libxcb_shm
>> >  libxcb_shape
>> >  libxcb_xfixes
>> > +libxml2
>> >  libxvid
>> >  libzmq
>> >  libzvbi
>> > @@ -5309,6 +5311,7 @@ enabled libx265   && require_pkg_config
>> x265 x265.h x265_api_get &&
>> >   { check_cpp_condition x265.h "X265_BUILD
>> >= 57" ||
>> > die "ERROR: libx265 version must be >=
>> 57."; }
>> >  enabled libxavs   && require libxavs xavs.h xavs_encoder_encode
>> -lxavs
>> > +enabled libxml2   && require_pkg_config libxml-2.0
>> libxml/parser.h xmlInitParser
>> >  enabled libxvid   && require libxvid xvid.h xvid_global
>> -lxvidcore
>> >  enabled libzmq&& require_pkg_config libzmq zmq.h zmq_ctx_new
>> >  enabled libzvbi   && require libzvbi libzvbi.h vbi_decoder_new
>> -lzvbi
>> > diff --git a/libavformat/http.c b/libavformat/http.c
>> > index 1eb716b..df45958 100644
>> > --- a/libavformat/http.c
>> > +++ b/libavformat/http.c
>> > @@ -21,6 +21,10 @@
>> >
>> >  #include "config.h"
>> >
>> > +#if CONFIG_LIBXML2
>> > +#include 
>> > +#endif /* CONFIG_LIBXML2 */
>> > +
>> >  #if CONFIG_ZLIB
>> >  #include 
>> >  #endif /* CONFIG_ZLIB */
>> > @@ -54,6 +58,16 @@ typedef enum {
>> >  FINISH
>> >  }HandshakeState;
>> >
>> > +typedef struct AVIODirEntryQueueNode {
>> > +struct AVIODirEntry *entry;
>> > +struct AVIODirEntryQueueNode *next;
>> > +} AVIODirEntryQueueNode;
>> > +
>> > +typedef struct AVIODirEntryQueue {
>> > +struct AVIODirEntryQueueNode *front;
>> > +struct AVIODirEntryQueueNode *rear;
>> > +} AVIODirEntryQueue;
>> > +
>> >  typedef struct HTTPContext {
>> >  const AVClass *class;
>> >  URLContext *hd;
>> > @@ -70,6 +84,7 @@ typedef struct HTTPContext {
>> >  char *mime_type;
>> >  char *user_agent;
>> >  char *content_type;
>> > +char *server;
>> >  /* Set if the server correctly handles Connection: close and will
>> close
>> >   * the connection after feeding us the content. */
>> >  int willclose;
>> > @@ -111,6 +126,11 @@ typedef struct HTTPContext {
>> >  int is_multi_client;
>> >  HandshakeState handshake_step;
>> >  int is_connected_server;
>> > +#if CONFIG_LIBXML2
>> > +htmlParserCtxtPtr html_parser;
>> > +AVIODirEntryQueue *entry_queue;
>> > +AVIODirEntry *entry;
>> > +#endif /* CONFIG_LIBXML2 */
>> >  } HTTPContext;
>> >
>> >  #define OFFSET(x) offsetof(HTTPContext, x)
>> > @@ -808,6 +828,8 @@ static int process_line(URLContext *h, char *line,
>> int line_count,
>> >  if (!strcmp(p, "close"))
>> >  s->willclose = 1;
>> >  } else if (!av_strcasecmp(tag, "Server")) {
>> > +av_free(s->server);
>> > +s->server = av_strdup(p);
>> >  if (!av_strcasecmp(p, "AkamaiGHost")) {
>> >  s->is_akamai = 1;
>> >  } else if (!av_strncasecmp(p, "MediaGateway", 12)) {
>> > @@ -1409,6 +1431,7 @@ static int http_close(URLContext *h)
>> >  if (s->hd)
>> >  ffurl_closep(&s->hd);
>> >  av_dict_free(&s->chained_options);
>> > +av_freep(&s->server);
>> >  return ret;
>> >  }
>> >
>> > @@ -1471,6 +1494,167 @@ static int http_get_file_handle(URLContext *h)
>> >  return ffurl_get_file_handle(s->hd);
>> >  }
>> >
>> > +#if CONFIG_LIBXML2
>> > +static void avio_dir_entry_queue_push(AVIODirEntryQueue *queue,
>> AVIODirEntry *entry)
>> > +{
>> > +AVIODirEntryQueueNode *node;
>> > +
>> > +if (!queue)
>> > +return;
>> > +
>> > +node = av_mallocz(sizeof(AVIODirEntryQueueNode));
>> > +node->entry = entry;
>> > +if (!queue->front) {
>> > +queue->front = queue->rear = node;
>> > +} else {
>> > +queue->rear->next = node;
>> > +queue->rear = node;
>> > +}
>> > +}
>> > +
>> > +static AVIODirEn

Re: [FFmpeg-devel] [PATCH] QSV : Added look ahead rate control mode

2015-08-20 Thread Michael Niedermayer
On Thu, Aug 20, 2015 at 02:34:22PM +0100, Sven Dueking wrote:
> From: Sven Dueking 
> 
> ---
>  libavcodec/qsvenc.c  | 36 +---
>  libavcodec/qsvenc.h  | 12 
>  libavcodec/qsvenc_h264.c | 12 
>  3 files changed, 57 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index 1532258..935abdd 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -106,10 +106,21 @@ static int init_video_param(AVCodecContext *avctx, 
> QSVEncContext *q)
>  } else if (avctx->rc_max_rate == avctx->bit_rate) {
>  q->param.mfx.RateControlMethod = MFX_RATECONTROL_CBR;
>  ratecontrol_desc = "constant bitrate (CBR)";

> -} else if (!avctx->rc_max_rate) {
> +}
> +else if (!avctx->rc_max_rate) {

unrelated and unneeded change, the style is also inconsistent with
the rest of the file


> +#if QSV_VERSION_ATLEAST(1,7)
> +if (q->look_ahead) {
> +q->param.mfx.RateControlMethod = MFX_RATECONTROL_LA;
> +ratecontrol_desc = "lookahead (LA)";
> +} else {
> +#endif
>  q->param.mfx.RateControlMethod = MFX_RATECONTROL_AVBR;
>  ratecontrol_desc = "average variable bitrate (AVBR)";
> +#if QSV_VERSION_ATLEAST(1,7)
> +}
> +#endif

you can avoid one #if:

+#if QSV_VERSION_ATLEAST(1,7)
+if (q->look_ahead) {
+q->param.mfx.RateControlMethod = MFX_RATECONTROL_LA;
+ratecontrol_desc = "lookahead (LA)";
+} else
+#endif
 {
q->param.mfx.RateControlMethod = MFX_RATECONTROL_AVBR;
ratecontrol_desc = "average variable bitrate (AVBR)";
 }



> -} else {
> +}
> +else {

unrelated and unneeded change

please read your patch before submiting and makre sure its clean
and there are no obvious and easy ways to simplify that havnt been
done.


>  q->param.mfx.RateControlMethod = MFX_RATECONTROL_VBR;
>  ratecontrol_desc = "variable bitrate (VBR)";
>  }
> @@ -132,6 +143,9 @@ static int init_video_param(AVCodecContext *avctx, 
> QSVEncContext *q)
>  
>  break;
>  case MFX_RATECONTROL_AVBR:
> +#if QSV_VERSION_ATLEAST(1,7)
> +case MFX_RATECONTROL_LA:
> +#endif
>  q->param.mfx.TargetKbps  = avctx->bit_rate / 1000;
>  q->param.mfx.Convergence = q->avbr_convergence;
>  q->param.mfx.Accuracy= q->avbr_accuracy;
> @@ -151,7 +165,23 @@ static int init_video_param(AVCodecContext *avctx, 
> QSVEncContext *q)
>  
>  q->extparam[0] = (mfxExtBuffer *)&q->extco;
>  
> -q->param.ExtParam= q->extparam;
> +#if QSV_VERSION_ATLEAST(1,6)
> +q->extco2.Header.BufferId  = MFX_EXTBUFF_CODING_OPTION2;
> +q->extco2.Header.BufferSz  = sizeof(q->extco2);
> +
> +#if QSV_VERSION_ATLEAST(1,7)
> +// valid value range is from 10 to 100 inclusive
> +// to instruct the encoder to use the default value this should be 
> set to zero
> +q->extco2.LookAheadDepth= q->look_ahead_depth != 0 ? 
> FFMAX(10, q->look_ahead_depth) : 0;
> +#endif
> +#if QSV_VERSION_ATLEAST(1,8)
> +q->extco2.LookAheadDS   = q->look_ahead_downsampling;
> +#endif
> +
> +q->extparam[1] = (mfxExtBuffer *)&q->extco2;
> +
> +#endif

> + q->param.ExtParam= q->extparam;

tabs are forbidden in *.c/h files


>  q->param.NumExtParam = FF_ARRAY_ELEMS(q->extparam);
>  }
>  
> diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
> index 2316488..c096a54 100644
> --- a/libavcodec/qsvenc.h
> +++ b/libavcodec/qsvenc.h
> @@ -50,7 +50,12 @@ typedef struct QSVEncContext {
>  mfxFrameAllocRequest req;
>  
>  mfxExtCodingOption  extco;
> +#if QSV_VERSION_ATLEAST(1,6)
> +mfxExtCodingOption2 extco2;
> +mfxExtBuffer *extparam[2];
> +#else
>  mfxExtBuffer *extparam[1];
> +#endif
>  
>  AVFifoBuffer *async_fifo;
>  
> @@ -62,6 +67,13 @@ typedef struct QSVEncContext {
>  int avbr_accuracy;
>  int avbr_convergence;
>  int pic_timing_sei;

> +#if QSV_VERSION_ATLEAST(1,7)
> +int look_ahead;
> +int look_ahead_depth;
> +#endif
> +#if QSV_VERSION_ATLEAST(1,8)
> +int look_ahead_downsampling;
> +#endif

these do not need to be conditional


>  
>  char *load_plugins;
>  } QSVEncContext;
> diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
> index b15f6b2..bd401e1 100644
> --- a/libavcodec/qsvenc_h264.c
> +++ b/libavcodec/qsvenc_h264.c
> @@ -71,6 +71,18 @@ static const AVOption options[] = {
>  { "avbr_convergence", "Convergence of the AVBR ratecontrol", 
> OFFSET(qsv.avbr_convergence), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
>  { "pic_timing_sei","Insert picture timing SEI with pic_struct_syntax 
> element", OFFSET(qsv.pic_timing_sei), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE 
> },
>  
> +#if QSV_VERSION_ATLEAST(1,7)
> +{ "look_ahead",   "Use VBR algorithm with look ahead",
> OFFSET(qsv.look_ahead

Re: [FFmpeg-devel] [PATCH] lavf/http: implement directory listing callbacks for Apache

2015-08-20 Thread Mariusz Szczepańczyk
On Thu, Aug 20, 2015 at 11:59 PM, Ganesh Ajjanagadde 
wrote:

> On Thu, Aug 20, 2015 at 5:48 PM, Mariusz Szczepańczyk
>  wrote:
> > On Thu, Aug 20, 2015 at 11:38 PM, Ganesh Ajjanagadde 
> > wrote:
> >
> >> On Thu, Aug 20, 2015 at 5:32 PM, Mariusz Szczepańczyk
> >>  wrote:
> >> > ---
> >> >  configure  |   3 +
> >> >  libavformat/http.c | 194
> >> +
> >> >  2 files changed, 197 insertions(+)
> >> >
> >> > diff --git a/configure b/configure
> >> > index e67ddf6..401e041 100755
> >> > --- a/configure
> >> > +++ b/configure
> >> > @@ -265,6 +265,7 @@ External library support:
> >> >--enable-libxcb-shm  enable X11 grabbing shm communication
> >> [autodetect]
> >> >--enable-libxcb-xfixes   enable X11 grabbing mouse rendering
> >> [autodetect]
> >> >--enable-libxcb-shapeenable X11 grabbing shape rendering
> >> [autodetect]
> >> > +  --enable-libxml2 enable HTML parsing via libxml2 [no]
> >> >--enable-libxvid enable Xvid encoding via xvidcore,
> >> > native MPEG-4/Xvid encoder exists [no]
> >> >--enable-libzmq  enable message passing via libzmq [no]
> >> > @@ -1428,6 +1429,7 @@ EXTERNAL_LIBRARY_LIST="
> >> >  libxcb_shm
> >> >  libxcb_shape
> >> >  libxcb_xfixes
> >> > +libxml2
> >> >  libxvid
> >> >  libzmq
> >> >  libzvbi
> >> > @@ -5309,6 +5311,7 @@ enabled libx265   && require_pkg_config
> >> x265 x265.h x265_api_get &&
> >> >   { check_cpp_condition x265.h "X265_BUILD
> >> >= 57" ||
> >> > die "ERROR: libx265 version must be >=
> >> 57."; }
> >> >  enabled libxavs   && require libxavs xavs.h
> xavs_encoder_encode
> >> -lxavs
> >> > +enabled libxml2   && require_pkg_config libxml-2.0
> >> libxml/parser.h xmlInitParser
> >> >  enabled libxvid   && require libxvid xvid.h xvid_global
> >> -lxvidcore
> >> >  enabled libzmq&& require_pkg_config libzmq zmq.h
> zmq_ctx_new
> >> >  enabled libzvbi   && require libzvbi libzvbi.h
> vbi_decoder_new
> >> -lzvbi
> >> > diff --git a/libavformat/http.c b/libavformat/http.c
> >> > index 1eb716b..df45958 100644
> >> > --- a/libavformat/http.c
> >> > +++ b/libavformat/http.c
> >> > @@ -21,6 +21,10 @@
> >> >
> >> >  #include "config.h"
> >> >
> >> > +#if CONFIG_LIBXML2
> >> > +#include 
> >> > +#endif /* CONFIG_LIBXML2 */
> >> > +
> >> >  #if CONFIG_ZLIB
> >> >  #include 
> >> >  #endif /* CONFIG_ZLIB */
> >> > @@ -54,6 +58,16 @@ typedef enum {
> >> >  FINISH
> >> >  }HandshakeState;
> >> >
> >> > +typedef struct AVIODirEntryQueueNode {
> >> > +struct AVIODirEntry *entry;
> >> > +struct AVIODirEntryQueueNode *next;
> >> > +} AVIODirEntryQueueNode;
> >> > +
> >> > +typedef struct AVIODirEntryQueue {
> >> > +struct AVIODirEntryQueueNode *front;
> >> > +struct AVIODirEntryQueueNode *rear;
> >> > +} AVIODirEntryQueue;
> >> > +
> >> >  typedef struct HTTPContext {
> >> >  const AVClass *class;
> >> >  URLContext *hd;
> >> > @@ -70,6 +84,7 @@ typedef struct HTTPContext {
> >> >  char *mime_type;
> >> >  char *user_agent;
> >> >  char *content_type;
> >> > +char *server;
> >> >  /* Set if the server correctly handles Connection: close and will
> >> close
> >> >   * the connection after feeding us the content. */
> >> >  int willclose;
> >> > @@ -111,6 +126,11 @@ typedef struct HTTPContext {
> >> >  int is_multi_client;
> >> >  HandshakeState handshake_step;
> >> >  int is_connected_server;
> >> > +#if CONFIG_LIBXML2
> >> > +htmlParserCtxtPtr html_parser;
> >> > +AVIODirEntryQueue *entry_queue;
> >> > +AVIODirEntry *entry;
> >> > +#endif /* CONFIG_LIBXML2 */
> >> >  } HTTPContext;
> >> >
> >> >  #define OFFSET(x) offsetof(HTTPContext, x)
> >> > @@ -808,6 +828,8 @@ static int process_line(URLContext *h, char *line,
> >> int line_count,
> >> >  if (!strcmp(p, "close"))
> >> >  s->willclose = 1;
> >> >  } else if (!av_strcasecmp(tag, "Server")) {
> >> > +av_free(s->server);
> >> > +s->server = av_strdup(p);
> >> >  if (!av_strcasecmp(p, "AkamaiGHost")) {
> >> >  s->is_akamai = 1;
> >> >  } else if (!av_strncasecmp(p, "MediaGateway", 12)) {
> >> > @@ -1409,6 +1431,7 @@ static int http_close(URLContext *h)
> >> >  if (s->hd)
> >> >  ffurl_closep(&s->hd);
> >> >  av_dict_free(&s->chained_options);
> >> > +av_freep(&s->server);
> >> >  return ret;
> >> >  }
> >> >
> >> > @@ -1471,6 +1494,167 @@ static int http_get_file_handle(URLContext *h)
> >> >  return ffurl_get_file_handle(s->hd);
> >> >  }
> >> >
> >> > +#if CONFIG_LIBXML2
> >> > +static void avio_dir_entry_queue_push(AVIODirEntryQueue *queue,
> >> AVIODirEntry *entry)
> >> > +{
> >> > +AVIODirEntryQueueNode *node;
> >> > +
> >> > +if (!queue)
> >> > +

[FFmpeg-devel] [PATCH 1/3] avformat/hls: correct comment for ensure_playlist()

2015-08-20 Thread Ganesh Ajjanagadde
Comment was previously slightly incorrect.
Also, it was placed in the wrong location.

Signed-off-by: Ganesh Ajjanagadde 
---
 libavformat/hls.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index caecbde..82dd744 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -482,7 +482,9 @@ static void handle_rendition_args(struct rendition_info 
*info, const char *key,
 /* used by parse_playlist to allocate a new variant+playlist when the
  * playlist is detected to be a Media Playlist (not Master Playlist)
  * and we have no parent Master Playlist (parsing of which would have
- * allocated the variant and playlist already) */
+ * allocated the variant and playlist already)
+ * *pls == NULL  => Master Playlist or parentless Media Playlist
+ * *pls != NULL => parented Media Playlist, playlist+variant allocated */
 static int ensure_playlist(HLSContext *c, struct playlist **pls, const char 
*url)
 {
 if (*pls)
@@ -493,8 +495,6 @@ static int ensure_playlist(HLSContext *c, struct playlist 
**pls, const char *url
 return 0;
 }
 
-/* pls = NULL  => Master Playlist or parentless Media Playlist
- * pls = !NULL => parented Media Playlist, playlist+variant allocated */
 static int open_in(HLSContext *c, AVIOContext **in, const char *url)
 {
 AVDictionary *tmp = NULL;
-- 
2.5.0

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


[FFmpeg-devel] [PATCH 2/3] avformat/hls: comment out unused function

2015-08-20 Thread Ganesh Ajjanagadde
Fixes -Wunused-function from
http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1

Signed-off-by: Ganesh Ajjanagadde 
---
 libavformat/hls.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 82dd744..8a83e40 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -495,6 +495,7 @@ static int ensure_playlist(HLSContext *c, struct playlist 
**pls, const char *url
 return 0;
 }
 
+/* unused
 static int open_in(HLSContext *c, AVIOContext **in, const char *url)
 {
 AVDictionary *tmp = NULL;
@@ -506,7 +507,7 @@ static int open_in(HLSContext *c, AVIOContext **in, const 
char *url)
 
 av_dict_free(&tmp);
 return ret;
-}
+} */
 
 static int url_connect(struct playlist *pls, AVDictionary *opts, AVDictionary 
*opts2)
 {
-- 
2.5.0

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


[FFmpeg-devel] [PATCH 3/3] avcodec/jpeg2000: comment out unused variable

2015-08-20 Thread Ganesh Ajjanagadde
Fixes -Wunused-const-variable from
http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1

Signed-off-by: Ganesh Ajjanagadde 
---
 libavcodec/jpeg2000.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index 8765017..09654e8 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -189,7 +189,7 @@ void ff_jpeg2000_set_significance(Jpeg2000T1Context *t1, 
int x, int y,
 t1->flags[(y - 1) * t1->stride + x - 1] |= JPEG2000_T1_SIG_SE;
 }
 
-static const uint8_t lut_gain[2][4] = { { 0, 0, 0, 0 }, { 0, 1, 1, 2 } };
+// static const uint8_t lut_gain[2][4] = { { 0, 0, 0, 0 }, { 0, 1, 1, 2 } }; 
(unused)
 
 int ff_jpeg2000_init_component(Jpeg2000Component *comp,
Jpeg2000CodingStyle *codsty,
-- 
2.5.0

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


Re: [FFmpeg-devel] [PATCH 3/3] avcodec/jpeg2000: comment out unused variable

2015-08-20 Thread Ganesh Ajjanagadde
On Thu, Aug 20, 2015 at 7:28 PM, Ganesh Ajjanagadde
 wrote:
> Fixes -Wunused-const-variable from
> http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1
>
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libavcodec/jpeg2000.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
> index 8765017..09654e8 100644
> --- a/libavcodec/jpeg2000.c
> +++ b/libavcodec/jpeg2000.c
> @@ -189,7 +189,7 @@ void ff_jpeg2000_set_significance(Jpeg2000T1Context *t1, 
> int x, int y,
>  t1->flags[(y - 1) * t1->stride + x - 1] |= JPEG2000_T1_SIG_SE;
>  }
>
> -static const uint8_t lut_gain[2][4] = { { 0, 0, 0, 0 }, { 0, 1, 1, 2 } };
> +// static const uint8_t lut_gain[2][4] = { { 0, 0, 0, 0 }, { 0, 1, 1, 2 } }; 
> (unused)
>
>  int ff_jpeg2000_init_component(Jpeg2000Component *comp,
> Jpeg2000CodingStyle *codsty,
> --
> 2.5.0
>

This patch series takes care of all unused warnings from
http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1
except for the ones in libswscale/swscale.c
I left these because I know it is being actively worked on by Pedro
for his GSoC.
@Pedro: you might want to look at this.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] lavf/file: check for dirent.h support

2015-08-20 Thread Mariusz Szczepańczyk
On Thu, Jun 25, 2015 at 12:09 PM, Michael Niedermayer 
wrote:

> On Wed, Jun 24, 2015 at 03:25:18AM +0200, Mariusz Szczepańczyk wrote:
> > On Tue, Jun 23, 2015 at 8:34 PM, Michael Niedermayer 
> > wrote:
> >
> > > On Mon, Jun 22, 2015 at 12:01:33AM +0200, Mariusz Szczepańczyk wrote:
> > > > ---
> > > >  configure  |  2 ++
> > > >  libavformat/file.c | 34 ++
> > > >  2 files changed, 36 insertions(+)
> > >
> > > this and the previous patch fails to build
> > >
> > > make distclean ; ./configure --disable-sdl && make -j12
> > >
> > > libavformat/file.c: In function ‘file_read_dir’:
> > > libavformat/file.c:302:10: error: ‘DT_FIFO’ undeclared (first use in
> this
> > > function)
> > > libavformat/file.c:302:10: note: each undeclared identifier is reported
> > > only once for each function it appears in
> > > libavformat/file.c:305:10: error: ‘DT_CHR’ undeclared (first use in
> this
> > > function)
> > > libavformat/file.c:308:10: error: ‘DT_DIR’ undeclared (first use in
> this
> > > function)
> > > libavformat/file.c:311:10: error: ‘DT_BLK’ undeclared (first use in
> this
> > > function)
> > > libavformat/file.c:314:10: error: ‘DT_REG’ undeclared (first use in
> this
> > > function)
> > > libavformat/file.c:317:10: error: ‘DT_LNK’ undeclared (first use in
> this
> > > function)
> > > libavformat/file.c:320:10: error: ‘DT_SOCK’ undeclared (first use in
> this
> > > function)
> > > libavformat/file.c:323:10: error: ‘DT_UNKNOWN’ undeclared (first use in
> > > this function)
> > > make: *** [libavformat/file.o] Error 1
> > > make: *** Waiting for unfinished jobs
> > >
> > > sdl disable is needed to reproduce  as sdls pkgcnonfig adds
> > > GNU_SOURCE i suspect
> > >
> >
> > Added contraint on _GNU_SOURCE and now it compiles fine on my linux in
> both
> > cases (with or without sdl).
>
> The code probably should #ifdef DT_... like DT_FIFO
> also are both variants needed ?
> are there systems lacking some of the S_IS*() ? or is there some
> disadvantage in their use ? (i dont know, just asking ...)
>
> testing for _GNU_SOURCE is not correct, nothing gurantees that the
> compiler or headers know or react to _GNU_SOURCE
>

Yet another try.

Completely removed reliance on DT_* and added definitions for some S_* that
can be missing.
From 820bd4aa5b064861935f8ef9e37a19bf459620c8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mariusz=20Szczepa=C5=84czyk?= 
Date: Mon, 29 Jun 2015 00:13:43 +0200
Subject: [PATCH 2/2] lavf/file: check for dirent.h support

---
 configure  |  2 ++
 libavformat/file.c | 80 +++---
 2 files changed, 54 insertions(+), 28 deletions(-)

diff --git a/configure b/configure
index e67ddf6..5b6b30d 100755
--- a/configure
+++ b/configure
@@ -1692,6 +1692,7 @@ HEADERS_LIST="
 dev_video_bktr_ioctl_bt848_h
 dev_video_meteor_ioctl_meteor_h
 direct_h
+dirent_h
 dlfcn_h
 d3d11_h
 dxva_h
@@ -5104,6 +5105,7 @@ enabled xlib &&
 
 check_header CoreServices/CoreServices.h
 check_header direct.h
+check_header dirent.h
 check_header dlfcn.h
 check_header d3d11.h
 check_header dxva.h
diff --git a/libavformat/file.c b/libavformat/file.c
index 407540c..df4c836 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -23,7 +23,9 @@
 #include "libavutil/internal.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#if HAVE_DIRENT_H
 #include 
+#endif
 #include 
 #if HAVE_IO_H
 #include 
@@ -45,6 +47,24 @@
 #  endif
 #endif
 
+/* Not available in POSIX.1-1996 */
+#ifndef S_ISLNK
+#  ifdef S_IFLNK
+#define S_ISLNK(m) (((m) & S_IFLNK) == S_IFLNK)
+#  else
+#define S_ISLNK(m) 0
+#  endif
+#endif
+
+/* Not available in POSIX.1-1996 */
+#ifndef S_ISSOCK
+#  ifdef S_IFSOCK
+#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+#  else
+#define S_ISSOCK(m) 0
+#  endif
+#endif
+
 /* standard file protocol */
 
 typedef struct FileContext {
@@ -52,7 +72,9 @@ typedef struct FileContext {
 int fd;
 int trunc;
 int blocksize;
+#if HAVE_DIRENT_H
 DIR *dir;
+#endif
 } FileContext;
 
 static const AVOption file_options[] = {
@@ -229,6 +251,7 @@ static int file_close(URLContext *h)
 
 static int file_open_dir(URLContext *h)
 {
+#if HAVE_DIRENT_H
 FileContext *c = h->priv_data;
 
 c->dir = opendir(h->filename);
@@ -236,10 +259,14 @@ static int file_open_dir(URLContext *h)
 return AVERROR(errno);
 
 return 0;
+#else
+return AVERROR(ENOSYS);
+#endif /* HAVE_DIRENT_H */
 }
 
 static int file_read_dir(URLContext *h, AVIODirEntry **next)
 {
+#if HAVE_DIRENT_H
 FileContext *c = h->priv_data;
 struct dirent *dir;
 char *fullpath = NULL;
@@ -259,7 +286,24 @@ static int file_read_dir(URLContext *h, AVIODirEntry **next)
 fullpath = av_append_path_component(h->filename, dir->d_name);
 if (fullpath) {
 struct stat st;
-if (!stat(fullpath, &st)) {
+if (!lstat(fullpath, &st)) {
+if (S_ISDIR(st.st_mode))
+(*n

[FFmpeg-devel] [PATCH] ffserver: cast PID to int64_t before printing

2015-08-20 Thread Ganesh Ajjanagadde
Unfortunately, there is no portable format specifier for PID's.
Furthermore, it is not safe to assume pid_t <= 32 bit in size,
see e.g http://unix.derkeiler.com/Mailing-Lists/AIX-L/2010-08/msg8.html.
Right now, it is ok to assume pid_t <= 32 bit in size, but this may change in 
the future.
Also, this patch fixes warning due to lack of an appropriate cast from
http://fate.ffmpeg.org/report.cgi?time=20150820233505&slot=x86-opensolaris-gcc4.3.
Note that this method of handling pid_t is in line with what nginx does.

Signed-off-by: Ganesh Ajjanagadde 
---
 ffserver.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index 5c8810a..b854453 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -1936,7 +1936,7 @@ static void compute_status(HTTPContext *c)
 
 avio_printf(pb, "Feed %s", stream->filename);
 if (stream->pid) {
-avio_printf(pb, "Running as pid %d.\n", stream->pid);
+avio_printf(pb, "Running as pid %ld.\n", (int64_t) stream->pid);
 
 #if defined(linux)
 {
@@ -1945,8 +1945,8 @@ static void compute_status(HTTPContext *c)
 
 /* This is somewhat linux specific I guess */
 snprintf(ps_cmd, sizeof(ps_cmd),
- "ps -o \"%%cpu,cputime\" --no-headers %d",
- stream->pid);
+ "ps -o \"%%cpu,cputime\" --no-headers %ld",
+ (int64_t) stream->pid);
 
  pid_stat = popen(ps_cmd, "r");
  if (pid_stat) {
@@ -3778,8 +3778,8 @@ static void handle_child_exit(int sig)
 uptime = time(0) - feed->pid_start;
 feed->pid = 0;
 fprintf(stderr,
-"%s: Pid %d exited with status %d after %d seconds\n",
-feed->filename, pid, status, uptime);
+"%s: Pid %ld exited with status %d after %d seconds\n",
+feed->filename, (int64_t) pid, status, uptime);
 
 if (uptime < 30)
 /* Turn off any more restarts */
-- 
2.5.0

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


Re: [FFmpeg-devel] [PATCH] ffserver: cast PID to int64_t before printing

2015-08-20 Thread Timothy Gu
On Thu, Aug 20, 2015 at 6:03 PM Ganesh Ajjanagadde 
wrote:

> -avio_printf(pb, "Running as pid %d.\n", stream->pid);
> +avio_printf(pb, "Running as pid %ld.\n", (int64_t)
> stream->pid);
>

You need `"%" PRIi64` as the format specifier.

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


Re: [FFmpeg-devel] [PATCH] ffserver: cast PID to int64_t before printing

2015-08-20 Thread Ganesh Ajjanagadde
On Thu, Aug 20, 2015 at 9:29 PM, Timothy Gu  wrote:
> On Thu, Aug 20, 2015 at 6:03 PM Ganesh Ajjanagadde 
> wrote:
>>
>> -avio_printf(pb, "Running as pid %d.\n", stream->pid);
>> +avio_printf(pb, "Running as pid %ld.\n", (int64_t)
>> stream->pid);
>
>
> You need `"%" PRIi64` as the format specifier.

You are right. Thanks, will post updated patch.

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


[FFmpeg-devel] [PATCHv2] ffserver: cast PID to int64_t before printing

2015-08-20 Thread Ganesh Ajjanagadde
Unfortunately, there is no portable format specifier for PID's.
Furthermore, it is not safe to assume pid_t <= 32 bit in size,
see e.g http://unix.derkeiler.com/Mailing-Lists/AIX-L/2010-08/msg8.html.
Right now, it is ok to assume pid_t <= 32 bit in size, but this may change in 
the future.
Also, this patch fixes warning due to lack of an appropriate cast from
http://fate.ffmpeg.org/report.cgi?time=20150820233505&slot=x86-opensolaris-gcc4.3.
Note that this method of handling pid_t is in line with what nginx does.

Signed-off-by: Ganesh Ajjanagadde 
---
 ffserver.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index 5c8810a..8b6e441 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -1936,7 +1936,7 @@ static void compute_status(HTTPContext *c)
 
 avio_printf(pb, "Feed %s", stream->filename);
 if (stream->pid) {
-avio_printf(pb, "Running as pid %d.\n", stream->pid);
+avio_printf(pb, "Running as pid %"PRId64".\n", (int64_t) 
stream->pid);
 
 #if defined(linux)
 {
@@ -1945,8 +1945,8 @@ static void compute_status(HTTPContext *c)
 
 /* This is somewhat linux specific I guess */
 snprintf(ps_cmd, sizeof(ps_cmd),
- "ps -o \"%%cpu,cputime\" --no-headers %d",
- stream->pid);
+ "ps -o \"%%cpu,cputime\" --no-headers %"PRId64"",
+ (int64_t) stream->pid);
 
  pid_stat = popen(ps_cmd, "r");
  if (pid_stat) {
@@ -3778,8 +3778,8 @@ static void handle_child_exit(int sig)
 uptime = time(0) - feed->pid_start;
 feed->pid = 0;
 fprintf(stderr,
-"%s: Pid %d exited with status %d after %d seconds\n",
-feed->filename, pid, status, uptime);
+"%s: Pid %"PRId64" exited with status %d after %d 
seconds\n",
+feed->filename, (int64_t) pid, status, uptime);
 
 if (uptime < 30)
 /* Turn off any more restarts */
-- 
2.5.0

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


Re: [FFmpeg-devel] [PATCH] ffserver: cast PID to int64_t before printing

2015-08-20 Thread Ganesh Ajjanagadde
On Thu, Aug 20, 2015 at 10:03 PM, Ganesh Ajjanagadde
 wrote:
> On Thu, Aug 20, 2015 at 9:29 PM, Timothy Gu  wrote:
>> On Thu, Aug 20, 2015 at 6:03 PM Ganesh Ajjanagadde 
>> wrote:
>>>
>>> -avio_printf(pb, "Running as pid %d.\n", stream->pid);
>>> +avio_printf(pb, "Running as pid %ld.\n", (int64_t)
>>> stream->pid);
>>
>>
>> You need `"%" PRIi64` as the format specifier.
>
> You are right. Thanks, will post updated patch.

So I used PRId64 instead of PRIi64.
Is there an issue with that?

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


[FFmpeg-devel] [PATCH] all: use { 0 } for zero initializing compound data structures

2015-08-20 Thread Ganesh Ajjanagadde
C Standard guarantees that { 0 } will do a correct zero initialization.
We use this for consistency across the project.

Signed-off-by: Ganesh Ajjanagadde 
---
 ffplay.c  | 2 +-
 ffserver.c| 2 +-
 libavcodec/aacdec_template.c  | 2 +-
 libavcodec/aacpsy.c   | 4 ++--
 libavcodec/alsdec.c   | 2 +-
 libavcodec/dct-test.c | 4 ++--
 libavcodec/error_resilience.c | 2 +-
 libavcodec/escape124.c| 2 +-
 libavcodec/hevc_mvs.c | 2 +-
 libavcodec/hevc_refs.c| 2 +-
 libavcodec/intrax8dsp.c   | 4 ++--
 libavcodec/libvo-aacenc.c | 2 +-
 libavcodec/qsvdec.c   | 6 +++---
 libavcodec/smacker.c  | 6 +++---
 libavformat/mpegts.c  | 4 ++--
 libavformat/rtsp.c| 2 +-
 16 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index cde88db..7a00c84 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1661,7 +1661,7 @@ static int queue_picture(VideoState *is, AVFrame 
*src_frame, double pts, double
 
 /* if the frame is not skipped, then display it */
 if (vp->bmp) {
-AVPicture pict = { { 0 } };
+AVPicture pict = { 0 };
 
 /* get a pointer on the bitmap */
 SDL_LockYUVOverlay (vp->bmp);
diff --git a/ffserver.c b/ffserver.c
index 8b6e441..cefa91e 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -3814,7 +3814,7 @@ static const OptionDef options[] = {
 
 int main(int argc, char **argv)
 {
-struct sigaction sigact = { { 0 } };
+struct sigaction sigact = { 0 };
 int ret = 0;
 
 config.filename = av_strdup("/etc/ffserver.conf");
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index c2d7d05..19b903e 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -258,7 +258,7 @@ static int count_paired_channels(uint8_t (*layout_map)[3], 
int tags, int pos,
 static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
 {
 int i, n, total_non_cc_elements;
-struct elem_to_channel e2c_vec[4 * MAX_ELEM_ID] = { { 0 } };
+struct elem_to_channel e2c_vec[4 * MAX_ELEM_ID] = { 0 };
 int num_front_channels, num_side_channels, num_back_channels;
 uint64_t layout;
 
diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
index 82b670d..13f0959 100644
--- a/libavcodec/aacpsy.c
+++ b/libavcodec/aacpsy.c
@@ -403,7 +403,7 @@ static av_unused FFPsyWindowInfo 
psy_3gpp_window(FFPsyContext *ctx,
 AacPsyChannel *pch  = &pctx->ch[channel];
 uint8_t grouping = 0;
 int next_type= pch->next_window_seq;
-FFPsyWindowInfo wi  = { { 0 } };
+FFPsyWindowInfo wi  = { 0 };
 
 if (la) {
 float s[8], v;
@@ -839,7 +839,7 @@ static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx, 
const float *audio,
 int attacks[AAC_NUM_BLOCKS_SHORT + 1] = { 0 };
 float clippings[AAC_NUM_BLOCKS_SHORT];
 int i;
-FFPsyWindowInfo wi = { { 0 } };
+FFPsyWindowInfo wi = { 0 };
 
 if (la) {
 float hpfsmpl[AAC_BLOCK_SIZE_LONG];
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index ebd364e..928d716 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1107,7 +1107,7 @@ static int decode_blocks(ALSDecContext *ctx, unsigned int 
ra_frame,
 unsigned int offset = 0;
 unsigned int b;
 int ret;
-ALSBlockData bd[2] = { { 0 } };
+ALSBlockData bd[2] = { 0 };
 
 bd[0].ra_block = ra_frame;
 bd[0].const_block  = ctx->const_block;
diff --git a/libavcodec/dct-test.c b/libavcodec/dct-test.c
index 56e1a62..f3e278e 100644
--- a/libavcodec/dct-test.c
+++ b/libavcodec/dct-test.c
@@ -98,8 +98,8 @@ static const struct algo idct_tab[] = {
 #elif ARCH_X86
 #include "x86/dct-test.c"
 #else
-static const struct algo fdct_tab_arch[] = { { 0 } };
-static const struct algo idct_tab_arch[] = { { 0 } };
+static const struct algo fdct_tab_arch[] = { 0 };
+static const struct algo idct_tab_arch[] = { 0 };
 #endif
 
 #define AANSCALE_BITS 12
diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index 2c741a4..8513168 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -445,7 +445,7 @@ static void guess_mv(ERContext *s)
 for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
 for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
 const int mb_xy= mb_x + mb_y * s->mb_stride;
-int mv_predictor[8][2] = { { 0 } };
+int mv_predictor[8][2] = { 0 };
 int ref[8] = { 0 };
 int pred_count = 0;
 int j;
diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c
index efcac64..4ccde14 100644
--- a/libavcodec/escape124.c
+++ b/libavcodec/escape124.c
@@ -164,7 +164,7 @@ static MacroBlock decode_macroblock(Escape124Context* s, 
GetBitContext* gb,
 // This condition can occur with invalid bitstreams and
 // *codebook_index == 2
 if (bl

Re: [FFmpeg-devel] [PATCH] all: use { 0 } for zero initializing compound data structures

2015-08-20 Thread Clément Bœsch
On Thu, Aug 20, 2015 at 10:19:51PM -0400, Ganesh Ajjanagadde wrote:
> C Standard guarantees that { 0 } will do a correct zero initialization.
> We use this for consistency across the project.
> 

See 392b4b663c450f5522f7c1442da91f7647db6bf0

[...]

-- 
Clément B.


pgpdV6ih4k4YG.pgp
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] ffserver: cast PID to int64_t before printing

2015-08-20 Thread Clément Bœsch
On Thu, Aug 20, 2015 at 10:17:15PM -0400, Ganesh Ajjanagadde wrote:
> On Thu, Aug 20, 2015 at 10:03 PM, Ganesh Ajjanagadde
>  wrote:
> > On Thu, Aug 20, 2015 at 9:29 PM, Timothy Gu  wrote:
> >> On Thu, Aug 20, 2015 at 6:03 PM Ganesh Ajjanagadde 
> >> wrote:
> >>>
> >>> -avio_printf(pb, "Running as pid %d.\n", stream->pid);
> >>> +avio_printf(pb, "Running as pid %ld.\n", (int64_t)
> >>> stream->pid);
> >>
> >>
> >> You need `"%" PRIi64` as the format specifier.
> >
> > You are right. Thanks, will post updated patch.
> 
> So I used PRId64 instead of PRIi64.
> Is there an issue with that?
> 

I don't think so

-- 
Clément B.


pgpMyP7sfhjTz.pgp
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel