[FFmpeg-devel] [PATCH] Modified force_key_frames option to accept frame numbers

2014-11-10 Thread Sylvester Zaluga
Attached a patch which allows for passing in frame numbers
at which key frames should be forced. 

The current modes in which force_key_frames operate are:

* force_key_frames 1,2,3,4,5  - parameter is interpreted as timestamps
* force_key_frames expr:gte(t,n_forced) - parameter is an expression

The patch adds support for third mode:
* force_key_frames n:0,25,50,75,100  - interpret parameter as frame numbers

I find this useful for avoiding float precision-related
issues that surface when key frames are forced at specified timestamps.

My use case is as follows:
* generate output video with settings for HD video
* extract key frame numbers from HD video
* generate SD video with key frames at identical positions
* In my application, do video LODing by switching HD/SD video 
  depending on available bandwith

For generating the SD video I was using force_key_frames with timestamps,
but every-so-often a key frame would be forced too early.

The same behaviour could be achieved with an expression, for example:

expr:bitor(eq(n,0),bitor(eq(n,25),bitor(eq(n,50),bitor(eq(n,75),bitor(eq(n,100),0)

This, however, is suboptimal, and not very clean. Additionally, there is
a size limit for expressions, so it can not be used for longer videos.

Please let me know any feedback you have on this patch or the approach used.

Thanks,
Sylwester Zaluga

Signed-off-by: Sylwester Zaluga sylwek...@outlook.com
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Modified force_key_frames command line option to accept frame numbers

2014-11-10 Thread Sylvester Zaluga

 @item -force_key_frames[:@var{stream_specifier}] @var{time}[,@var{time}...] 
(@emph{output,per-stream})
+@item -force_key_frames[:@var{stream_specifier}] 
n:@var{number}[,@var{number}...] (@emph{output,per-stream})
 @item -force_key_frames[:@var{stream_specifier}] expr:@var{expr} 
(@emph{output,per-stream})
-Force key frames at the specified timestamps, more precisely at the first
-frames after each specified time.
+Force key frames at the specified timestamps (more precisely at the first
+frames after each specified time) or at the specified frame numbers.
+
+If the argument is prefixed with @code{n:}, the comma-separated @var{number}
+strings will be interpreted as numbers / indices of frames that should
+be forced to be key frames.
 
 If the argument is prefixed with @code{expr:}, the string @var{expr}
 is interpreted like an expression and is evaluated for each frame. A
@@ -606,6 +611,11 @@ before the beginning of every chapter:
 -force_key_frames 0:05:00,chapters-0.1
 @end example
 
+For example, to insert at predefined frame numbers:
+@example
+-force_key_frames n:0,25,50,75,100,125,150,175,200,225,250
+@end example
+
 The expression in @var{expr} can contain the following constants:
 @table @option
 @item n
diff --git a/ffmpeg.c b/ffmpeg.c
index 1fd0ece..969222d 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1039,6 +1039,11 @@ static void do_video_out(AVFormatContext *s,
 }
 
 ost-forced_keyframes_expr_const_values[FKF_N] += 1;
+} else if (ost-forced_kf_n_index  ost-forced_kf_n_count 
+ost-frame_number == ost-forced_kf_n_pts[ost-forced_kf_n_index]) 
{
+av_dlog(NULL, force_key_frame (number mode): n:%d\n, 
ost-frame_number);
+ost-forced_kf_n_index++;
+forced_keyframe = 1;
 }
 
 if (forced_keyframe) {
@@ -2333,6 +2338,12 @@ static InputStream *get_input_stream(OutputStream *ost)
 return NULL;
 }
 
+static int compare_int(const void *a, const void *b)
+{
+int va = *(int *)a, vb = *(int *)b;
+return va  vb ? -1 : va  vb ? +1 : 0;
+}
+
 static int compare_int64(const void *a, const void *b)
 {
 int64_t va = *(int64_t *)a, vb = *(int64_t *)b;
@@ -2402,6 +2413,53 @@ static void parse_forced_key_frames(char *kf, 
OutputStream *ost,
 ost-forced_kf_pts   = pts;
 }
 
+static void parse_forced_key_frames_n(char *kf, OutputStream *ost,
+  AVCodecContext *avctx)
+{
+char *p;
+int n = 1, i, size, index = 0;
+int kf_n, kf_n_prev, *pts;
+
+for (p = kf; *p; p++)
+if (*p == ',')
+n++;
+size = n;
+pts = av_malloc_array(size, sizeof(*pts));
+if (!pts) {
+av_log(NULL, AV_LOG_FATAL, Could not allocate forced key frames 
array.\n);
+exit_program(1);
+}
+
+p = kf;
+for (i = 0; i  n; i++) {
+char *next = strchr(p, ',');
+
+if (next)
+*next++ = 0;
+
+kf_n = parse_number_or_die(force_key_frames (numbers), p, OPT_INT, 
0, INT_MAX);
+av_assert1(index  size);
+pts[index++] = kf_n;
+
+p = next;
+}
+
+av_assert0(index == size);
+qsort(pts, size, sizeof(*pts), compare_int);
+
+kf_n_prev = -1;
+for (i = 0; i  n; i++) {
+if (pts[i] == kf_n_prev) {
+av_log(NULL, AV_LOG_FATAL, Duplicated forced key frame 
number.\n);
+exit_program(1);
+}
+kf_n_prev = pts[i];
+}
+
+ost-forced_kf_n_count = size;
+ost-forced_kf_n_pts   = pts;
+}
+
 static void report_new_stream(int input_index, AVPacket *pkt)
 {
 InputFile *file = input_files[input_index];
@@ -2815,6 +2873,8 @@ static int transcode_init(void)
 ost-forced_keyframes_expr_const_values[FKF_N_FORCED] 
= 0;
 
ost-forced_keyframes_expr_const_values[FKF_PREV_FORCED_N] = NAN;
 
ost-forced_keyframes_expr_const_values[FKF_PREV_FORCED_T] = NAN;
+} else if (!strncmp(ost-forced_keyframes, n:, 2)) {
+parse_forced_key_frames_n(ost-forced_keyframes+2, 
ost, ost-enc_ctx);
 } else {
 parse_forced_key_frames(ost-forced_keyframes, ost, 
ost-enc_ctx);
 }
@@ -3775,6 +3835,7 @@ static int transcode(void)
 ost-logfile = NULL;
 }
 av_freep(ost-forced_kf_pts);
+av_freep(ost-forced_kf_n_pts);
 av_freep(ost-apad);
 av_dict_free(ost-encoder_opts);
 av_dict_free(ost-swr_opts);
diff --git a/ffmpeg.h b/ffmpeg.h
index c456603..539b8bd 100644
--- a/ffmpeg.h
+++ b/ffmpeg.h
@@ -400,6 +400,9 @@ typedef struct OutputStream {
 int64_t *forced_kf_pts;
 int forced_kf_count;
 int forced_kf_index;
+int *forced_kf_n_pts;/* list of forced key frame numbers / 
indices */
+int forced_kf_n_count;   /* count of forced key frame 

[FFmpeg-devel] [PATCH] Modified force_key_frames command line option to accept frame numbers

2014-11-10 Thread Sylvester Zaluga

 @item -force_key_frames[:@var{stream_specifier}] @var{time}[,@var{time}...] 
(@emph{output,per-stream})
+@item -force_key_frames[:@var{stream_specifier}] 
n:@var{number}[,@var{number}...] (@emph{output,per-stream})
 @item -force_key_frames[:@var{stream_specifier}] expr:@var{expr} 
(@emph{output,per-stream})
-Force key frames at the specified timestamps, more precisely at the first
-frames after each specified time.
+Force key frames at the specified timestamps (more precisely at the first
+frames after each specified time) or at the specified frame numbers.
+
+If the argument is prefixed with @code{n:}, the comma-separated @var{number}
+strings will be interpreted as numbers / indices of frames that should
+be forced to be key frames.
 
 If the argument is prefixed with @code{expr:}, the string @var{expr}
 is interpreted like an expression and is evaluated for each frame. A
@@ -606,6 +611,11 @@ before the beginning of every chapter:
 -force_key_frames 0:05:00,chapters-0.1
 @end example
 
+For example, to insert at predefined frame numbers:
+@example
+-force_key_frames n:0,25,50,75,100,125,150,175,200,225,250
+@end example
+
 The expression in @var{expr} can contain the following constants:
 @table @option
 @item n
diff --git a/ffmpeg.c b/ffmpeg.c
index 1fd0ece..969222d 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1039,6 +1039,11 @@ static void do_video_out(AVFormatContext *s,
 }
 
 ost-forced_keyframes_expr_const_values[FKF_N] += 1;
+} else if (ost-forced_kf_n_index  ost-forced_kf_n_count 
+ost-frame_number == ost-forced_kf_n_pts[ost-forced_kf_n_index]) 
{
+av_dlog(NULL, force_key_frame (number mode): n:%d\n, 
ost-frame_number);
+ost-forced_kf_n_index++;
+forced_keyframe = 1;
 }
 
 if (forced_keyframe) {
@@ -2333,6 +2338,12 @@ static InputStream *get_input_stream(OutputStream *ost)
 return NULL;
 }
 
+static int compare_int(const void *a, const void *b)
+{
+int va = *(int *)a, vb = *(int *)b;
+return va  vb ? -1 : va  vb ? +1 : 0;
+}
+
 static int compare_int64(const void *a, const void *b)
 {
 int64_t va = *(int64_t *)a, vb = *(int64_t *)b;
@@ -2402,6 +2413,53 @@ static void parse_forced_key_frames(char *kf, 
OutputStream *ost,
 ost-forced_kf_pts   = pts;
 }
 
+static void parse_forced_key_frames_n(char *kf, OutputStream *ost,
+  AVCodecContext *avctx)
+{
+char *p;
+int n = 1, i, size, index = 0;
+int kf_n, kf_n_prev, *pts;
+
+for (p = kf; *p; p++)
+if (*p == ',')
+n++;
+size = n;
+pts = av_malloc_array(size, sizeof(*pts));
+if (!pts) {
+av_log(NULL, AV_LOG_FATAL, Could not allocate forced key frames 
array.\n);
+exit_program(1);
+}
+
+p = kf;
+for (i = 0; i  n; i++) {
+char *next = strchr(p, ',');
+
+if (next)
+*next++ = 0;
+
+kf_n = parse_number_or_die(force_key_frames (numbers), p, OPT_INT, 
0, INT_MAX);
+av_assert1(index  size);
+pts[index++] = kf_n;
+
+p = next;
+}
+
+av_assert0(index == size);
+qsort(pts, size, sizeof(*pts), compare_int);
+
+kf_n_prev = -1;
+for (i = 0; i  n; i++) {
+if (pts[i] == kf_n_prev) {
+av_log(NULL, AV_LOG_FATAL, Duplicated forced key frame 
number.\n);
+exit_program(1);
+}
+kf_n_prev = pts[i];
+}
+
+ost-forced_kf_n_count = size;
+ost-forced_kf_n_pts   = pts;
+}
+
 static void report_new_stream(int input_index, AVPacket *pkt)
 {
 InputFile *file = input_files[input_index];
@@ -2815,6 +2873,8 @@ static int transcode_init(void)
 ost-forced_keyframes_expr_const_values[FKF_N_FORCED] 
= 0;
 
ost-forced_keyframes_expr_const_values[FKF_PREV_FORCED_N] = NAN;
 
ost-forced_keyframes_expr_const_values[FKF_PREV_FORCED_T] = NAN;
+} else if (!strncmp(ost-forced_keyframes, n:, 2)) {
+parse_forced_key_frames_n(ost-forced_keyframes+2, 
ost, ost-enc_ctx);
 } else {
 parse_forced_key_frames(ost-forced_keyframes, ost, 
ost-enc_ctx);
 }
@@ -3775,6 +3835,7 @@ static int transcode(void)
 ost-logfile = NULL;
 }
 av_freep(ost-forced_kf_pts);
+av_freep(ost-forced_kf_n_pts);
 av_freep(ost-apad);
 av_dict_free(ost-encoder_opts);
 av_dict_free(ost-swr_opts);
diff --git a/ffmpeg.h b/ffmpeg.h
index c456603..539b8bd 100644
--- a/ffmpeg.h
+++ b/ffmpeg.h
@@ -400,6 +400,9 @@ typedef struct OutputStream {
 int64_t *forced_kf_pts;
 int forced_kf_count;
 int forced_kf_index;
+int *forced_kf_n_pts;/* list of forced key frame numbers / 
indices */
+int forced_kf_n_count;   /* count of forced key frame 

[FFmpeg-devel] Modified force_key_frames option to accept frame numbers

2014-11-10 Thread Sylvester Zaluga
***Sending again, this time with diff***

Attached a patch which allows for passing in frame numbers
at which key frames should be forced. 

The current modes in which force_key_frames operate are:

* force_key_frames 1,2,3,4,5  - parameter is interpreted as timestamps
* force_key_frames expr:gte(t,n_forced) - parameter is an expression

The patch adds support for third mode:
* force_key_frames n:0,25,50,75,100  - interpret parameter as frame numbers

I find this useful for avoiding float precision-related
issues that surface when key frames are forced at specified timestamps.

My use case is as follows:
* generate output video with settings for HD video
* extract key frame numbers from HD video
* generate SD video with key frames at identical positions
* In my application, do video LODing by switching HD/SD video 
  depending on bandwith

For generating the SD video I was using force_key_frames with timestamps,
but every-so-often a key frame would be forced too early.

The same behaviour could be achieved with an expression, for example:

expr:bitor(eq(n,0),bitor(eq(n,25),bitor(eq(n,50),bitor(eq(n,75),bitor(eq(n,100),0)

This, however, is suboptimal, and not very clean. Additionally, there is
a size limit for expressions, so it can not be used for longer videos.

Please let me know any feedback you have on this patch or the approach used.

Thanks,
Sylwester Zaluga

Signed-off-by: Sylwester Zaluga sylwek...@outlook.com


diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index d774aba..5d15f6f 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -586,9 +586,14 @@ Show QP histogram
 Deprecated see -bsf
 
 @item -force_key_frames[:@var{stream_specifier}] @var{time}[,@var{time}...] 
(@emph{output,per-stream})
+@item -force_key_frames[:@var{stream_specifier}] 
n:@var{number}[,@var{number}...] (@emph{output,per-stream})
 @item -force_key_frames[:@var{stream_specifier}] expr:@var{expr} 
(@emph{output,per-stream})
-Force key frames at the specified timestamps, more precisely at the first
-frames after each specified time.
+Force key frames at the specified timestamps (more precisely at the first
+frames after each specified time) or at the specified frame numbers.
+
+If the argument is prefixed with @code{n:}, the comma-separated @var{number}
+strings will be interpreted as numbers / indices of frames that should
+be forced to be key frames.
 
 If the argument is prefixed with @code{expr:}, the string @var{expr}
 is interpreted like an expression and is evaluated for each frame. A
@@ -606,6 +611,11 @@ before the beginning of every chapter:
 -force_key_frames 0:05:00,chapters-0.1
 @end example
 
+For example, to insert at predefined frame numbers:
+@example
+-force_key_frames n:0,25,50,75,100,125,150,175,200,225,250
+@end example
+
 The expression in @var{expr} can contain the following constants:
 @table @option
 @item n
diff --git a/ffmpeg.c b/ffmpeg.c
index 1fd0ece..969222d 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1039,6 +1039,11 @@ static void do_video_out(AVFormatContext *s,
 }
 
 ost-forced_keyframes_expr_const_values[FKF_N] += 1;
+} else if (ost-forced_kf_n_index  ost-forced_kf_n_count 
+ost-frame_number == ost-forced_kf_n_pts[ost-forced_kf_n_index]) 
{
+av_dlog(NULL, force_key_frame (number mode): n:%d\n, 
ost-frame_number);
+ost-forced_kf_n_index++;
+forced_keyframe = 1;
 }
 
 if (forced_keyframe) {
@@ -2333,6 +2338,12 @@ static InputStream *get_input_stream(OutputStream *ost)
 return NULL;
 }
 
+static int compare_int(const void *a, const void *b)
+{
+int va = *(int *)a, vb = *(int *)b;
+return va  vb ? -1 : va  vb ? +1 : 0;
+}
+
 static int compare_int64(const void *a, const void *b)
 {
 int64_t va = *(int64_t *)a, vb = *(int64_t *)b;
@@ -2402,6 +2413,53 @@ static void parse_forced_key_frames(char *kf, 
OutputStream *ost,
 ost-forced_kf_pts   = pts;
 }
 
+static void parse_forced_key_frames_n(char *kf, OutputStream *ost,
+  AVCodecContext *avctx)
+{
+char *p;
+int n = 1, i, size, index = 0;
+int kf_n, kf_n_prev, *pts;
+
+for (p = kf; *p; p++)
+if (*p == ',')
+n++;
+size = n;
+pts = av_malloc_array(size, sizeof(*pts));
+if (!pts) {
+av_log(NULL, AV_LOG_FATAL, Could not allocate forced key frames 
array.\n);
+exit_program(1);
+}
+
+p = kf;
+for (i = 0; i  n; i++) {
+char *next = strchr(p, ',');
+
+if (next)
+*next++ = 0;
+
+kf_n = parse_number_or_die(force_key_frames (numbers), p, OPT_INT, 
0, INT_MAX);
+av_assert1(index  size);
+pts[index++] = kf_n;
+
+p = next;
+}
+
+av_assert0(index == size);
+qsort(pts, size, sizeof(*pts), compare_int);
+
+kf_n_prev = -1;
+for (i = 0; i  n; i++) {
+if (pts[i] == kf_n_prev) {
+av_log(NULL, AV_LOG_FATAL, Duplicated forced key frame 

Re: [FFmpeg-devel] Modified force_key_frames option to accept frame numbers

2014-11-10 Thread Lou Logan
Hi,

On Sun, Nov 9, 2014, at 02:42 PM, Sylvester Zaluga wrote:
 ***Sending again, this time with diff***

You sent four similar messages to the mailing list:

https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2014-November/165155.html
https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2014-November/165156.html
https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2014-November/165157.html
https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2014-November/165158.html

Which one(s) should we review?

Usually I discard extra/duplicates in the queue, but at some of them
seemed to vary slightly and I was feeling somewhat lazy.

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


[FFmpeg-devel] Resubmit patch02 - Fwd: [patch 4/4] Fix bug for POWERLE: libswscale/ppc/swscale_altivec.c

2014-11-10 Thread rongyan
Hi,
New patch please find in the attachment. There are two patches to re-submit, 
this is the second.
The fate test result is here:
 
 Rong Yan
  

 

 --  --
  ??: Tony Lin;linzhaolo...@gmail.com;
 : 2014??11??10??(??) 11:32
 ??: rongyanrongyan...@foxmail.com; 
 
 : Fwd: [FFmpeg-devel] [patch 4/4] Fix bug for POWERLE: 
libswscale/ppc/swscale_altivec.c

 

 
 Forwarded conversation
Subject: [FFmpeg-devel] [patch 4/4] Fix bug for POWERLE: 
libswscale/ppc/swscale_altivec.c


From: rongyan rongyan...@foxmail.com
Date: 2014-11-07 17:43 GMT+08:00
To: ffmpeg-devel ffmpeg-devel@ffmpeg.org


Hi,
There are 4 patches presented to fix bugs for POWER8 little endian. I will send 
4 patches in 4 different email. This is the fourth.

It fixed the function hScale_altivec_real(), yuv2planeX_16_altivec(), 
yuv2planeX_8().

The fate test result on POWER BE and POWER LE after merge these 4 patches are 
attached here to facilitate the review:

 The passed test cases change from 1679/2182 to 2010/2236.




 Rong Yan


 --
   The world has enough for everyone's need, but not enough for everyone's 
greed.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


--
From: Michael Niedermayer michae...@gmx.at
Date: 2014-11-08 1:54 GMT+08:00
To: FFmpeg development discussions and patches ffmpeg-devel@ffmpeg.org


 
  swscale_altivec.c |  142 
 +++---
  1 file changed, 50 insertions(+), 92 deletions(-)
 0c364d48e08b7df42bee5e269fe46b2d7be0f4b9  
 0004-libswscale-ppc-swscale_altivec.c-fix-hScale_altivec_.patch
 From 9ec626726d1cc30db54390ee81f52cfe53ebeedf Mon Sep 17 00:00:00 2001
 From: Rong Yan rongyan...@gmail.com
 Date: Fri, 7 Nov 2014 09:09:09 +
 Subject: [PATCH 4/4] libswscale/ppc/swscale_altivec.c : fix
  hScale_altivec_real() yuv2planeX_16_altivec() yuv2planeX_8() for POWER LE

 ---
  libswscale/ppc/swscale_altivec.c | 142 
 ++-
  1 file changed, 50 insertions(+), 92 deletions(-)

 diff --git a/libswscale/ppc/swscale_altivec.c 
 b/libswscale/ppc/swscale_altivec.c
 index 86f40ab..1673b8b 100644
 --- a/libswscale/ppc/swscale_altivec.c
 +++ b/libswscale/ppc/swscale_altivec.c
 @@ -29,20 +29,30 @@
  #include libavutil/attributes.h
  #include libavutil/cpu.h
  #include yuv2rgb_altivec.h
 +#include libavutil/ppc/util_altivec.h

  #if HAVE_ALTIVEC
  #define vzero vec_splat_s32(0)

 -#define yuv2planeX_8(d1, d2, l1, src, x, perm, filter) do { \
 -vector signed short l2  = vec_ld(((x)  1) + 16, src); \
 -vector signed short ls  = vec_perm(l1, l2, perm);   \
 -vector signed int   i1  = vec_mule(filter, ls); \
 -vector signed int   i2  = vec_mulo(filter, ls); \
 -vector signed int   vf1 = vec_mergeh(i1, i2);   \
 -vector signed int   vf2 = vec_mergel(i1, i2);   \
 -d1 = vec_add(d1, vf1);  \
 -d2 = vec_add(d2, vf2);  \
 -l1 = l2;\
 +#if HAVE_BIGENDIAN
 +#define  GET_VF(a, b) {\
 +a = vec_mergeh(i1, i2);\
 +b = vec_mergel(i1, i2);\
 +}
 +#else
 +#define  GET_VF(a, b) {\
 +a = vec_mergel(i2, i1);\
 +b = vec_mergeh(i2, i1);\
 +}
 +#endif
 +
 +#define yuv2planeX_8(d1, d2, l1, src, x, filter) do {\
 +vector signed int   i1  = vec_mule(filter, l1);\
 +vector signed int   i2  = vec_mulo(filter, l1);\
 +vector signed int   vf1, vf2;\
 +GET_VF(vf1, vf2);\
 +d1 = vec_add(d1, vf1);\
 +d2 = vec_add(d2, vf2);\
  } while (0)

  static void yuv2planeX_16_altivec(const int16_t *filter, int filterSize,

 @@ -66,16 +76,13 @@ static void yuv2planeX_16_altivec(const int16_t *filter, 
 int filterSize,
  vo4 = vec_ld(48, val);

  for (j = 0; j  filterSize; j++) {
 -vector signed short l1, vLumFilter = vec_ld(j  1, filter);
 -vector unsigned char perm, perm0 = vec_lvsl(j  1, filter);
 -vLumFilter = vec_perm(vLumFilter, vLumFilter, perm0);
 +vector signed short l1, l2;
 +vector signed short vLumFilter = (vector signed 
 short)unaligned_load(j  1, filter);
  vLumFilter = vec_splat(vLumFilter, 0); // lumFilter[j] is loaded 8 
 times in vLumFilter
 -
 -perm = vec_lvsl(x  1, src[j]);
 -l1   = vec_ld(x  1, src[j]);
 -
 -yuv2planeX_8(vo1, vo2, l1, src[j], x, perm, vLumFilter);
 -yuv2planeX_8(vo3, vo4, l1, src[j], x + 8, perm, vLumFilter);
 +l1  = (vector signed short)unaligned_load(x  1, src[j]);
 +l2  = (vector signed short)unaligned_load(((x)  1) + 16, src[j]);
 +yuv2planeX_8(vo1, vo2, l1, src[j], x, vLumFilter);
 +yuv2planeX_8(vo3, vo4, l2, 

[FFmpeg-devel] ffmpeg git hooks

2014-11-10 Thread Michael Niedermayer
Hi

Are the hooks which are used for ffmpeg git publically visible
somewhere ?
iam asking as we would like to submit patches to fix some issues
in them.
For example we would like to add tests/fate/*.mak to the exceptions
which allow tabs

Thanks
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] Fwd: [PATCH] lavfi: add xbr filter

2014-11-10 Thread Stefano Sabatini
On date Sunday 2014-11-09 23:06:17 +0530, arwa arif encoded:
[...]
 From 04b57f43e5904b9016001b86daa96c9a88f64b0e Mon Sep 17 00:00:00 2001
 From: Arwa Arif arwaarif1...@gmail.com
 Date: Thu, 30 Oct 2014 22:06:20 +0530
 Subject: [PATCH] lavfi: add xbr filter xBR
 
 ---
  Changelog|1 +
  LICENSE.md   |1 +
  configure|1 +
  doc/filters.texi |4 +
  libavfilter/Makefile |1 +
  libavfilter/allfilters.c |1 +
  libavfilter/vf_xbr.c |  758 
 ++
  7 files changed, 767 insertions(+)
  create mode 100644 libavfilter/vf_xbr.c

Congratulations! I think we can consider this qualification task
closed :-).
-- 
FFmpeg = Faithful and Fascinating Mastodontic Power Encoding/decoding Guide
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/4] lavu/opt: check for NULL before parsing

2014-11-10 Thread Michael Niedermayer
On Mon, Nov 10, 2014 at 06:22:07AM +0100, Lukasz Marek wrote:
 On 10.11.2014 03:21, Michael Niedermayer wrote:
 On Sun, Nov 09, 2014 at 11:22:46PM +0100, Lukasz Marek wrote:
 set_string_binary crashes with called with val=NULL
 
 Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
 ---
   libavutil/opt.c | 6 +-
   1 file changed, 5 insertions(+), 1 deletion(-)
 
 diff --git a/libavutil/opt.c b/libavutil/opt.c
 index fca5354..bc62044 100644
 --- a/libavutil/opt.c
 +++ b/libavutil/opt.c
 @@ -126,11 +126,15 @@ static int set_string_binary(void *obj, const 
 AVOption *o, const char *val, uint
   {
   int *lendst = (int *)(dst + 1);
   uint8_t *bin, *ptr;
 -int len = strlen(val);
 +int len;
 
   av_freep(dst);
   *lendst = 0;
 
 +if (!val)
 +return AVERROR(EINVAL);
 
 this deallocates dest and then returns failure
 shouldnt it either not fail or not change the state of dst ?
 
 Yes, it is inconsistent.  I changed to return 0.
 Also, I added check for length 0 to avoid malloc returned some
 pointer for 0 bytes block.
 

  opt.c |5 -
  1 file changed, 4 insertions(+), 1 deletion(-)
 8cb5253a3e91283bd427ebe3a0124c0f890d0535  
 0001-lavu-opt-check-for-NULL-before-parsing.patch
 From e67c9094e67cb01e2ec2dcc0a7da19ed9c03 Mon Sep 17 00:00:00 2001
 From: Lukasz Marek lukasz.m.lu...@gmail.com
 Date: Sun, 9 Nov 2014 23:15:58 +0100
 Subject: [PATCH 1/4] lavu/opt: check for NULL before parsing

LGTM

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.


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


Re: [FFmpeg-devel] [PATCH 4/4] fate: add opt-test

2014-11-10 Thread Michael Niedermayer
On Sun, Nov 09, 2014 at 11:22:49PM +0100, Lukasz Marek wrote:
 ---
  tests/fate/libavutil.mak |  4 +++
  tests/ref/fate/opt   | 90 
 
  2 files changed, 94 insertions(+)

LGTM

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

It is what and why we do it that matters, not just one of them.


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


Re: [FFmpeg-devel] OPW Qualification Task: Enable daemon mode for FFserver

2014-11-10 Thread Nicolas George
Le decadi 20 brumaire, an CCXXIII, Binathi Bingi a écrit :
 I use nano editor.

If you expect you will work on source codes (not necessarily just FFmpeg) a
lot, I believe taking the time of learning a better editor would be a very
good investment.

 I tried to remove trailing whitespace in git patch using git format-patch
 -b -w -1
 Please find the attached patch.

Unfortunately, that will not work: the -w option (and -b is just a subset)
will make diff consider that foo and foo  are the same and not output a
pair of lines for them. But if you change foo into bar , or if you
insert bar , then diff must output a '+' line, and then it will output
+foo , not +foo.

Furthermore, I am not sure it would have been a good idea anyway: the
trailing spaces could have leaked again somewhere, for example if you forget
-w sometimes. Better remove them as upstream as possible.

If your editor does not allow it directly, you can easily use sed to fix the
files:

sed -i 's/  *$//' ffserver.c

 From c9d037758693a1522258a64849f7629d7cbd7408 Mon Sep 17 00:00:00 2001
 From: Binathi binti...@gmail.com
 Date: Tue, 4 Nov 2014 21:42:07 +0530
 Subject: [PATCH] Restore Daemon mode in FFserver
 
 Signed-off-by: Binathi Bingi binti...@gmail.com
 ---
  doc/ffserver.conf |  5 +
  doc/ffserver.texi |  7 ---
  ffserver.c| 33 +
  ffserver_config.c |  4 +++-
  ffserver_config.h |  1 +
  5 files changed, 46 insertions(+), 4 deletions(-)

Apart from the trailing spaces problem, the code looks good to me now. In
normal circumstances, the trailing spaces could probably be removed by the
committer, but for a qualification task it is probably best to have the
patch committed as is.

Also, I other people have given comments on the patches, they should be
allowed some time to give advice if any.

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] Modified force_key_frames option to accept frame numbers

2014-11-10 Thread Nicolas George
Le nonidi 19 brumaire, an CCXXIII, Sylvester Zaluga a écrit :
 ***Sending again, this time with diff***

Better use git format-patch (or git send-email), so that you have authorship
and date information.

 Attached a patch which allows for passing in frame numbers
 at which key frames should be forced. 
 
 The current modes in which force_key_frames operate are:
 
 * force_key_frames 1,2,3,4,5  - parameter is interpreted as timestamps
 * force_key_frames expr:gte(t,n_forced) - parameter is an expression
 
 The patch adds support for third mode:
 * force_key_frames n:0,25,50,75,100  - interpret parameter as frame numbers
 
 I find this useful for avoiding float precision-related
 issues that surface when key frames are forced at specified timestamps.

I will not actually oppose the feature, but every time people insist on
working with frame numbers instead of timestamp, I feel they are doing
something incorrectly.

In this particular case, you can easily work around the floating point
rounding issues, since the rounding behaviour of -force_key_frames is
specified: more precisely at the first frames after each specified time.
You just have to make sure your timestamps are rounded down. For example,
with 24000/1001 FPS: 4.21 4.25 4.30* 4.34 4.38, you need to write 4.29, not
4.30, but you can also write any value between 4.25425 and the actual
4.295958333. (4.25+4.30)/2 = 4.275 should always work.

 My use case is as follows:
 * generate output video with settings for HD video
 * extract key frame numbers from HD video
 * generate SD video with key frames at identical positions
 * In my application, do video LODing by switching HD/SD video 
   depending on bandwith

What happens if, in order to lower even more the SD bitrate, you decide to
add the decimate filter? Frame numbers are jumbled, while timestamps are
preserved. Working with frame numbers is fragile.

(Also, note that with some codecs, forcing a lot of keyframes will have a
dramatic effect on the efficiency of the encoding.)

Regards,

-- 
  Nicolas George


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


[FFmpeg-devel] [PATCH] Enables parsing DVD color palette directly from IFO file

2014-11-10 Thread TOYAMA Shin-ichi
Attached patch enables parsing DVD color palette directly from IFO 
file via -palette option using syntax `-palette ifo:filename`

This is a straightforward implementation of the procedure 
described in the following post to ffmpeg-user mailing list.

http://ffmpeg.org/pipermail/ffmpeg-user/2013-September/017584.html

-- 
TOYAMA Shin-ichi mailto:sh...@wmail.plala.or.jp

0001-Enables-parsing-DVD-color-palette-directly-from-IFO-.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] allow tabs in *.mak, they are part of the makefile syntax

2014-11-10 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer michae...@gmx.at
---
 update |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/update b/update
index 86d51db..92e645d 100644
--- a/update
+++ b/update
@@ -67,7 +67,7 @@ check_ending_newline () {
 
 
 check_tabs () {
-  for file in $(git diff-tree --name-only --diff-filter=A|C|M|R -r $REVISION 
| tail -n +2 | egrep -v 
'Makefile.*|common.mak|library.mak|subdir.mak|clean-diff|\.diff|\.patch' | 
egrep $@) ; do
+  for file in $(git diff-tree --name-only --diff-filter=A|C|M|R -r $REVISION 
| tail -n +2 | egrep -v 
'Makefile.*|common.mak|library.mak|subdir.mak|clean-diff|\.diff|\.patch|\.mak' 
| egrep $@) ; do
 if is_text_file $REVISION $file 2 /dev/null ; then
   if git cat-file -p $REVISION:$file | grep -e ' '  /dev/null; then
 echoerr In $REVISION:
-- 
1.7.9.5

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


Re: [FFmpeg-devel] [PATCH] Enables parsing DVD color palette directly from IFO file

2014-11-10 Thread Nicolas George
Le decadi 20 brumaire, an CCXXIII, TOYAMA Shin-ichi a écrit :
 Attached patch enables parsing DVD color palette directly from IFO 
 file via -palette option using syntax `-palette ifo:filename`
 
 This is a straightforward implementation of the procedure 
 described in the following post to ffmpeg-user mailing list.
 
 http://ffmpeg.org/pipermail/ffmpeg-user/2013-September/017584.html

Thanks for the patch. See comments below.

 From c9e41ac2fbf6e518372be3057e8e794745190496 Mon Sep 17 00:00:00 2001
 From: Shin-ichi Toyama sh...@wmail.plala.or.jp
 Date: Mon, 10 Nov 2014 22:13:35 +0900
 Subject: [PATCH] Enables parsing DVD color palette directly from IFO file via
  -palette option using syntax `-palette ifo:filename'
 
 ---

  libavcodec/dvdsubdec.c | 47 +++

The update for the documentation is missing.

  1 file changed, 47 insertions(+)
 
 diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
 index bb28d9e..b09eb61 100644
 --- a/libavcodec/dvdsubdec.c
 +++ b/libavcodec/dvdsubdec.c
 @@ -28,6 +28,7 @@
  #include libavutil/opt.h
  #include libavutil/imgutils.h
  #include libavutil/avstring.h
 +#include libavutil/bswap.h
  
  typedef struct DVDSubContext
  {
 @@ -574,13 +575,59 @@ static int dvdsub_decode(AVCodecContext *avctx,
  static void parse_palette(DVDSubContext *ctx, char *p)
  {
  int i;
 +char ifo[_MAX_PATH];
 +FILE *in;
 +uint32_t sp_pgci, pgci, off_pgc, pgc;
 +uint8_t c, Y, Cr, Cb, R, G, B;
  
  ctx-has_palette = 1;
 +

 +  if (strncmp(p, ifo:, 4) == 0) {

This can be discussed, but I would prefer having a separate -ifo_file
option.

 +strncpy (ifo, p+4, _MAX_PATH);

The string copy is useless: just use p+4 as file name. Furthermore,
_MAX_PATH is evil.

 +if((in=fopen(ifo, r))==NULL){

Please respect the surrounding coding style: four spaces (no tabs) indent,
spaces between structure keyword and parentheses, spaces around operators,
opening block braces on the same line with spaces before.

 +  fprintf(stderr, [dvdsubdec.c] Warning: Failed to open IFO file\n);

You must use av_log(). And please also add a translation of errno for the
cause of error.

 +  ctx-has_palette = 0;
 +  return;
 +}
 +/* Obtain Start Point of PGCI */
 +fseek(in, 0xCC, SEEK_SET);
 +fread(sp_pgci, 4, 1, in);
 +sp_pgci=av_be2ne32(sp_pgci);

 +

Trailing spaces can not be committed in the official repository. There are
other cases below.

 +/* Obtain Offset to VTS_PGCI */
 +pgci = sp_pgci * 2048;
 +fseek(in, pgci + 0x0C, SEEK_SET);
 +fread(off_pgc, 4, 1, in);
 +off_pgc=av_be2ne32(off_pgc);

Missing failure tests.

 +
 +/* Obtain Color pallet Start Point */

Typo in comment.

 +pgc = pgci + off_pgc;
 +fseek(in, pgc + 0xA4, SEEK_SET);
 +
 +for(i=0;i16;i++)
 +{

 +  fread(c,  1, 1, in);
 +  fread(Y,  1, 1, in);
 +  fread(Cr, 1, 1, in);
 +  fread(Cb, 1, 1, in);

You could replace that with a single read into an array; that would not
allow to call the variables R, Cr, Cb, but that does not matter much.

 +
 +  /* YCrCb - RGB conversion */
 +  Cr = Cr - 128;
 +  Cb = Cb - 128;

 +  R = Y + Cr + (Cr2) + (Cr3) + (Cr5);
 +  G = Y - ((Cb2) + (Cb4) + (Cb5)) - ((Cr1) + (Cr3) + (Cr4) + 
 (Cr5));
 +  B = Y + Cb + (Cb1) + (Cb2) + (Cb6);

Are these he official formulas? The shifts look like premature optimization.

 +
 +  ctx-palette[i] = (R16) + (G8) + B;

Are you sure neither R, G, B overflow? If they can, they must be clipped.

 +}
 +fclose(in);
 +  } else {
  for(i=0;i16;i++) {
  ctx-palette[i] = strtoul(p, p, 16);
  while(*p == ',' || av_isspace(*p))
  p++;
  }
 +  }
  }
  
  static int dvdsub_parse_extradata(AVCodecContext *avctx)

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] Enables parsing DVD color palette directly from IFO file

2014-11-10 Thread James Darnley
On 2014-11-10 15:01, Nicolas George wrote:
 +  fread(c,  1, 1, in);
 +  fread(Y,  1, 1, in);
 +  fread(Cr, 1, 1, in);
 +  fread(Cb, 1, 1, in);
 
 You could replace that with a single read into an array; that would not
 allow to call the variables R, Cr, Cb, but that does not matter much.

Perhaps a union (or an array of a union type) would preserve the
readability of separate variables and still allow one read.  Or is that
not portable between LE and BE?




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


Re: [FFmpeg-devel] [PATCH] Enables parsing DVD color palette directly from IFO file

2014-11-10 Thread Hendrik Leppkes
On Mon, Nov 10, 2014 at 3:01 PM, Nicolas George geo...@nsup.org wrote:


  +
  +  /* YCrCb - RGB conversion */
  +  Cr = Cr - 128;
  +  Cb = Cb - 128;

  +  R = Y + Cr + (Cr2) + (Cr3) + (Cr5);
  +  G = Y - ((Cb2) + (Cb4) + (Cb5)) - ((Cr1) + (Cr3) +
 (Cr4) + (Cr5));
  +  B = Y + Cb + (Cb1) + (Cb2) + (Cb6);

 Are these he official formulas? The shifts look like premature
 optimization.


We have conversion macros for those, see yuv_a_to_rgba at the beginning of
the same file.
In fact, if you just read all the YCbCr stuff into a fixed-size buffer
first, you might even be able to use the same function for the entire
conversion.

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


Re: [FFmpeg-devel] Resubmit patch01 - RE: [patch 2/4] Fix bug for POWERLE: libavcodec/ppc/me_cmp.c

2014-11-10 Thread Michael Niedermayer
On Mon, Nov 10, 2014 at 05:01:56PM +0800, rongyan wrote:
 Hi,
  New patch please find in the attachment. There are two patches to re-submit, 
 this is the first.
  The fate test result is here:
  
  Rong Yan
[...]

 -vector unsigned char pix2l  = vec_ld(0,  pix2);
 -vector unsigned char pix2r  = vec_ld(16, pix2);
 -vector unsigned char pix2v  = vec_perm(pix2l, pix2r, perm1);
 -vector unsigned char pix2iv = vec_perm(pix2l, pix2r, perm2);
 +vector unsigned char pix2v  = VEC_LD(0,  pix2);
 +vector unsigned char pix2iv = VEC_LD(1,  pix2);

this doubles the number of vec_ld() on big endian


[...]
 @@ -356,11 +168,8 @@ static int sad16_xy2_altivec(MpegEncContext *v, uint8_t 
 *pix1, uint8_t *pix2,
   * pix1v: pix1[0] - pix1[15]
   * pix3v: pix3[0] - pix3[15]  pix3iv: pix3[1] - pix3[16] */
  pix1v  = vec_ld(0, pix1);
 -
 -pix2l  = vec_ld(0, pix3);
 -pix2r  = vec_ld(16, pix3);
 -pix3v  = vec_perm(pix2l, pix2r, perm1);
 -pix3iv = vec_perm(pix2l, pix2r, perm2);
 +pix3v  = VEC_LD(0, pix3);
 +pix3iv = VEC_LD(1, pix3);
  
  /* Note that AltiVec does have vec_avg, but this works on vector 
 pairs
   * and rounds up. We could do avg(avg(a, b), avg(c, d)), but the

this also doubles the number of vec_ld() on big endian

[...]

-- 
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] OPW Qualification Task: Enable daemon mode for FFserver

2014-11-10 Thread Stefano Sabatini
On date Monday 2014-11-10 13:26:14 +0530, Binathi Bingi encoded:
[...]
 From c9d037758693a1522258a64849f7629d7cbd7408 Mon Sep 17 00:00:00 2001
 From: Binathi binti...@gmail.com

Provide complete name, the patch is used to track copyright.

 Date: Tue, 4 Nov 2014 21:42:07 +0530
 Subject: [PATCH] Restore Daemon mode in FFserver
 
 Signed-off-by: Binathi Bingi binti...@gmail.com
 ---
  doc/ffserver.conf |  5 +
  doc/ffserver.texi |  7 ---
  ffserver.c| 33 +
  ffserver_config.c |  4 +++-
  ffserver_config.h |  1 +
  5 files changed, 46 insertions(+), 4 deletions(-)
 
 diff --git a/doc/ffserver.conf b/doc/ffserver.conf
 index b756961..0b63555 100644
 --- a/doc/ffserver.conf
 +++ b/doc/ffserver.conf
 @@ -25,6 +25,11 @@ MaxBandwidth 1000
  # '-' is the standard output.
  CustomLog -
  

 +# Suppress NoDaemon and enable Daemon, if you want to launch ffserver in 
 daemon mode.
 +# If no option is specified, default option is NoDaemon.
 +#NoDaemon
 +#Daemon

Why NoDaemon followed by Daemon? This is confusing.

 +
  ##
  # Definition of the live feeds. Each live feed contains one video
  # and/or audio sequence coming from an ffmpeg encoder or another
 diff --git a/doc/ffserver.texi b/doc/ffserver.texi
 index 77273d2..5d5fc0f 100644
 --- a/doc/ffserver.texi
 +++ b/doc/ffserver.texi
 @@ -405,9 +405,10 @@ In case the commandline option @option{-d} is specified 
 this option is
  ignored, and the log is written to standard output.
  

  @item NoDaemon
 -Set no-daemon mode. This option is currently ignored since now
 -@command{ffserver} will always work in no-daemon mode, and is
 -deprecated.
 +Set no-daemon mode. This is the default.

It would be nice to provide a more lenghty explanation about the
daemon mode. Why is it useful? How does it differ with the NoDaemon
mode? Why and how is it useful?

 +
 +@item Daemon

 +Set daemon mode. The default is NoDaemon

missing ending dot.

  @end table
  
  @section Feed section
 diff --git a/ffserver.c b/ffserver.c
 index ea2a2ae..8b005b9 100644
 --- a/ffserver.c
 +++ b/ffserver.c
 @@ -3671,6 +3671,7 @@ static void handle_child_exit(int sig)
  static void opt_debug(void)
  {
  config.debug = 1;
 +config.ffserver_daemon = 0;
  snprintf(config.logfilename, sizeof(config.logfilename), -);
  }
  
 @@ -3737,6 +3738,38 @@ int main(int argc, char **argv)
  
  compute_bandwidth();

 +if (config.ffserver_daemon) {
 +pid_t ffserver_id = 0;
 +pid_t sid = 0;
 +int fd;
 +ffserver_id = fork();
 + 
 +if (ffserver_id  0) {
 +ret = AVERROR(errno);
 +av_log(NULL, AV_LOG_ERROR, Impossible to start in daemon mode: 
 %s\n, av_err2str(ret));
 +exit(1);
 +}
 +   
 +if (ffserver_id  0)
 +exit(0);
 + 
 +sid = setsid();
 +if (sid  0)
 +exit(1);
 +
 +fd = open(/dev/null, O_RDWR,0);
 +if (fd  0) {
 +ret = AVERROR(errno);

 +av_log(NULL, AV_LOG_ERROR, Unable to repoen file descriptors: 
 %s\n, av_err2str(ret));

typo: repoen

 +exit(1);
 +}
 +dup2(fd, 0);  
 +dup2(fd, 2); 

 +if (strcmp(config.logfilename,-) != 0)

nit: logfilename,_-

[...]
-- 
FFmpeg = Fanciful Fabulous Mysterious Perennial Evil Generator
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Resubmit patch02 - Fwd: [patch 4/4] Fix bug for POWERLE: libswscale/ppc/swscale_altivec.c

2014-11-10 Thread Michael Niedermayer
On Mon, Nov 10, 2014 at 05:03:22PM +0800, rongyan wrote:
 Hi,
 New patch please find in the attachment. There are two patches to re-submit, 
 this is the second.
 The fate test result is here:
  
  Rong Yan
   
 
  
 
  -- 原始邮件 --
   发件人: Tony Lin;linzhaolo...@gmail.com;
  发送时间: 2014年11月10日(星期一) 中午11:32
  收件人: rongyanrongyan...@foxmail.com; 
  
  主题: Fwd: [FFmpeg-devel] [patch 4/4] Fix bug for POWERLE: 
 libswscale/ppc/swscale_altivec.c
 
  
 
  
  Forwarded conversation
 Subject: [FFmpeg-devel] [patch 4/4] Fix bug for POWERLE: 
 libswscale/ppc/swscale_altivec.c
 
 
 From: rongyan rongyan...@foxmail.com
 Date: 2014-11-07 17:43 GMT+08:00
 To: ffmpeg-devel ffmpeg-devel@ffmpeg.org
 
 
 Hi,
 There are 4 patches presented to fix bugs for POWER8 little endian. I will 
 send 4 patches in 4 different email. This is the fourth.
 
 It fixed the function hScale_altivec_real(), yuv2planeX_16_altivec(), 
 yuv2planeX_8().
 
 The fate test result on POWER BE and POWER LE after merge these 4 patches are 
 attached here to facilitate the review:
 
  The passed test cases change from 1679/2182 to 2010/2236.
 
 
 
 
  Rong Yan
 
 
  --
The world has enough for everyone's need, but not enough for everyone's 
 greed.
 ___
 ffmpeg-devel mailing list
 ffmpeg-devel@ffmpeg.org
 http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 
 
 --
 From: Michael Niedermayer michae...@gmx.at
 Date: 2014-11-08 1:54 GMT+08:00
 To: FFmpeg development discussions and patches ffmpeg-devel@ffmpeg.org
 
 
  
   swscale_altivec.c |  142 
  +++---
   1 file changed, 50 insertions(+), 92 deletions(-)
  0c364d48e08b7df42bee5e269fe46b2d7be0f4b9  
  0004-libswscale-ppc-swscale_altivec.c-fix-hScale_altivec_.patch
  From 9ec626726d1cc30db54390ee81f52cfe53ebeedf Mon Sep 17 00:00:00 2001
  From: Rong Yan rongyan...@gmail.com
  Date: Fri, 7 Nov 2014 09:09:09 +
  Subject: [PATCH 4/4] libswscale/ppc/swscale_altivec.c : fix
   hScale_altivec_real() yuv2planeX_16_altivec() yuv2planeX_8() for POWER LE
 
  ---
   libswscale/ppc/swscale_altivec.c | 142 
  ++-
   1 file changed, 50 insertions(+), 92 deletions(-)
 
  diff --git a/libswscale/ppc/swscale_altivec.c 
  b/libswscale/ppc/swscale_altivec.c
  index 86f40ab..1673b8b 100644
  --- a/libswscale/ppc/swscale_altivec.c
  +++ b/libswscale/ppc/swscale_altivec.c
  @@ -29,20 +29,30 @@
   #include libavutil/attributes.h
   #include libavutil/cpu.h
   #include yuv2rgb_altivec.h
  +#include libavutil/ppc/util_altivec.h
 
   #if HAVE_ALTIVEC
   #define vzero vec_splat_s32(0)
 
  -#define yuv2planeX_8(d1, d2, l1, src, x, perm, filter) do { \
  -vector signed short l2  = vec_ld(((x)  1) + 16, src); \
  -vector signed short ls  = vec_perm(l1, l2, perm);   \
  -vector signed int   i1  = vec_mule(filter, ls); \
  -vector signed int   i2  = vec_mulo(filter, ls); \
  -vector signed int   vf1 = vec_mergeh(i1, i2);   \
  -vector signed int   vf2 = vec_mergel(i1, i2);   \
  -d1 = vec_add(d1, vf1);  \
  -d2 = vec_add(d2, vf2);  \
  -l1 = l2;\
  +#if HAVE_BIGENDIAN
  +#define  GET_VF(a, b) {\
  +a = vec_mergeh(i1, i2);\
  +b = vec_mergel(i1, i2);\
  +}
  +#else
  +#define  GET_VF(a, b) {\
  +a = vec_mergel(i2, i1);\
  +b = vec_mergeh(i2, i1);\
  +}
  +#endif
  +
  +#define yuv2planeX_8(d1, d2, l1, src, x, filter) do {\
  +vector signed int   i1  = vec_mule(filter, l1);\
  +vector signed int   i2  = vec_mulo(filter, l1);\
  +vector signed int   vf1, vf2;\
  +GET_VF(vf1, vf2);\
  +d1 = vec_add(d1, vf1);\
  +d2 = vec_add(d2, vf2);\
   } while (0)
 
   static void yuv2planeX_16_altivec(const int16_t *filter, int filterSize,
 
  @@ -66,16 +76,13 @@ static void yuv2planeX_16_altivec(const int16_t 
  *filter, int filterSize,
   vo4 = vec_ld(48, val);
 
   for (j = 0; j  filterSize; j++) {
  -vector signed short l1, vLumFilter = vec_ld(j  1, filter);
  -vector unsigned char perm, perm0 = vec_lvsl(j  1, filter);
  -vLumFilter = vec_perm(vLumFilter, vLumFilter, perm0);
  +vector signed short l1, l2;
  +vector signed short vLumFilter = (vector signed 
  short)unaligned_load(j  1, filter);
   vLumFilter = vec_splat(vLumFilter, 0); // lumFilter[j] is loaded 8 
  times in vLumFilter
  -
  -perm = vec_lvsl(x  1, src[j]);
  -l1   = vec_ld(x  1, src[j]);
  -
  -yuv2planeX_8(vo1, vo2, l1, src[j], x, perm, vLumFilter);
  -yuv2planeX_8(vo3, vo4, l1, src[j], x + 8, perm, vLumFilter);
  +l1  = (vector signed short)unaligned_load(x  1, 

Re: [FFmpeg-devel] [PATCH] Enables parsing DVD color palette directly from IFO file

2014-11-10 Thread TOYAMA Shin-ichi
Nicolas George wrote in 20141110140122.ga22...@phare.normalesup.org
Thanks for the patch. See comments below.

Thank you for your quick reply.
I will go through many comments from you and others, and will post 
revised patch in some time.

# I think it will take long for me to update documents ...

-- 
TOYAMA Shin-ichi mailto:sh...@wmail.plala.or.jp
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avformat/mov: strengthen some table allocations

2014-11-10 Thread Clément Bœsch
From: Clément Bœsch clem...@stupeflix.com

---
 libavformat/mov.c | 35 ++-
 1 file changed, 14 insertions(+), 21 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 6ba7b96..4010668 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1272,10 +1272,9 @@ static int mov_read_stco(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 
 if (!entries)
 return 0;
-if (entries = UINT_MAX/sizeof(int64_t))
-return AVERROR_INVALIDDATA;
 
-sc-chunk_offsets = av_malloc(entries * sizeof(int64_t));
+av_free(sc-chunk_offsets);
+sc-chunk_offsets = av_malloc_array(entries, sizeof(*sc-chunk_offsets));
 if (!sc-chunk_offsets)
 return AVERROR(ENOMEM);
 sc-chunk_count = entries;
@@ -1869,9 +1868,8 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 
 if (!entries)
 return 0;
-if (entries = UINT_MAX / sizeof(*sc-stsc_data))
-return AVERROR_INVALIDDATA;
-sc-stsc_data = av_malloc(entries * sizeof(*sc-stsc_data));
+av_free(sc-stsc_data);
+sc-stsc_data = av_malloc_array(entries, sizeof(*sc-stsc_data));
 if (!sc-stsc_data)
 return AVERROR(ENOMEM);
 
@@ -1903,9 +1901,8 @@ static int mov_read_stps(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 avio_rb32(pb); // version + flags
 
 entries = avio_rb32(pb);
-if (entries = UINT_MAX / sizeof(*sc-stps_data))
-return AVERROR_INVALIDDATA;
-sc-stps_data = av_malloc(entries * sizeof(*sc-stps_data));
+av_free(sc-stps_data);
+sc-stps_data = av_malloc_array(entries, sizeof(*sc-stps_data));
 if (!sc-stps_data)
 return AVERROR(ENOMEM);
 
@@ -1947,9 +1944,8 @@ static int mov_read_stss(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 st-need_parsing = AVSTREAM_PARSE_HEADERS;
 return 0;
 }
-if (entries = UINT_MAX / sizeof(int))
-return AVERROR_INVALIDDATA;
-sc-keyframes = av_malloc(entries * sizeof(int));
+av_free(sc-keyframes);
+sc-keyframes = av_malloc_array(entries, sizeof(*sc-keyframes));
 if (!sc-keyframes)
 return AVERROR(ENOMEM);
 
@@ -2008,9 +2004,10 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 
 if (!entries)
 return 0;
-if (entries = UINT_MAX / sizeof(int) || entries = (UINT_MAX - 4) / 
field_size)
+if (entries = (UINT_MAX - 4) / field_size)
 return AVERROR_INVALIDDATA;
-sc-sample_sizes = av_malloc(entries * sizeof(int));
+av_free(sc-sample_sizes);
+sc-sample_sizes = av_malloc_array(entries, sizeof(*sc-sample_sizes));
 if (!sc-sample_sizes)
 return AVERROR(ENOMEM);
 
@@ -2064,11 +2061,8 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 av_dlog(c-fc, track[%i].stts.entries = %i\n,
 c-fc-nb_streams-1, entries);
 
-if (entries = UINT_MAX / sizeof(*sc-stts_data))
-return -1;
-
 av_free(sc-stts_data);
-sc-stts_data = av_malloc(entries * sizeof(*sc-stts_data));
+sc-stts_data = av_malloc_array(entries, sizeof(*sc-stts_data));
 if (!sc-stts_data)
 return AVERROR(ENOMEM);
 
@@ -2207,9 +2201,8 @@ static int mov_read_sbgp(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 entries = avio_rb32(pb);
 if (!entries)
 return 0;
-if (entries = UINT_MAX / sizeof(*sc-rap_group))
-return AVERROR_INVALIDDATA;
-sc-rap_group = av_malloc(entries * sizeof(*sc-rap_group));
+av_free(sc-rap_group);
+sc-rap_group = av_malloc_array(entries, sizeof(*sc-rap_group));
 if (!sc-rap_group)
 return AVERROR(ENOMEM);
 
-- 
2.1.3

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


Re: [FFmpeg-devel] OPW Qualification Task: Enable daemon mode for FFserver

2014-11-10 Thread Binathi Bingi
Hi there,

Please find the attached patch with modifications.

Regards,

Binathi

On Mon, Nov 10, 2014 at 8:42 PM, Stefano Sabatini stefa...@gmail.com
wrote:

 On date Monday 2014-11-10 13:26:14 +0530, Binathi Bingi encoded:
 [...]
  From c9d037758693a1522258a64849f7629d7cbd7408 Mon Sep 17 00:00:00 2001
  From: Binathi binti...@gmail.com

 Provide complete name, the patch is used to track copyright.

  Date: Tue, 4 Nov 2014 21:42:07 +0530
  Subject: [PATCH] Restore Daemon mode in FFserver
 
  Signed-off-by: Binathi Bingi binti...@gmail.com
  ---
   doc/ffserver.conf |  5 +
   doc/ffserver.texi |  7 ---
   ffserver.c| 33 +
   ffserver_config.c |  4 +++-
   ffserver_config.h |  1 +
   5 files changed, 46 insertions(+), 4 deletions(-)
 
  diff --git a/doc/ffserver.conf b/doc/ffserver.conf
  index b756961..0b63555 100644
  --- a/doc/ffserver.conf
  +++ b/doc/ffserver.conf
  @@ -25,6 +25,11 @@ MaxBandwidth 1000
   # '-' is the standard output.
   CustomLog -
 

  +# Suppress NoDaemon and enable Daemon, if you want to launch ffserver
 in daemon mode.
  +# If no option is specified, default option is NoDaemon.
  +#NoDaemon
  +#Daemon

 Why NoDaemon followed by Daemon? This is confusing.

  +
   ##
   # Definition of the live feeds. Each live feed contains one video
   # and/or audio sequence coming from an ffmpeg encoder or another
  diff --git a/doc/ffserver.texi b/doc/ffserver.texi
  index 77273d2..5d5fc0f 100644
  --- a/doc/ffserver.texi
  +++ b/doc/ffserver.texi
  @@ -405,9 +405,10 @@ In case the commandline option @option{-d} is
 specified this option is
   ignored, and the log is written to standard output.
 

   @item NoDaemon
  -Set no-daemon mode. This option is currently ignored since now
  -@command{ffserver} will always work in no-daemon mode, and is
  -deprecated.
  +Set no-daemon mode. This is the default.

 It would be nice to provide a more lenghty explanation about the
 daemon mode. Why is it useful? How does it differ with the NoDaemon
 mode? Why and how is it useful?

  +
  +@item Daemon

  +Set daemon mode. The default is NoDaemon

 missing ending dot.

   @end table
 
   @section Feed section
  diff --git a/ffserver.c b/ffserver.c
  index ea2a2ae..8b005b9 100644
  --- a/ffserver.c
  +++ b/ffserver.c
  @@ -3671,6 +3671,7 @@ static void handle_child_exit(int sig)
   static void opt_debug(void)
   {
   config.debug = 1;
  +config.ffserver_daemon = 0;
   snprintf(config.logfilename, sizeof(config.logfilename), -);
   }
 
  @@ -3737,6 +3738,38 @@ int main(int argc, char **argv)
 
   compute_bandwidth();
 
  +if (config.ffserver_daemon) {
  +pid_t ffserver_id = 0;
  +pid_t sid = 0;
  +int fd;
  +ffserver_id = fork();
  +
  +if (ffserver_id  0) {
  +ret = AVERROR(errno);
  +av_log(NULL, AV_LOG_ERROR, Impossible to start in daemon
 mode: %s\n, av_err2str(ret));
  +exit(1);
  +}
  +
  +if (ffserver_id  0)
  +exit(0);
  +
  +sid = setsid();
  +if (sid  0)
  +exit(1);
  +
  +fd = open(/dev/null, O_RDWR,0);
  +if (fd  0) {
  +ret = AVERROR(errno);

  +av_log(NULL, AV_LOG_ERROR, Unable to repoen file
 descriptors: %s\n, av_err2str(ret));

 typo: repoen

  +exit(1);
  +}
  +dup2(fd, 0);
  +dup2(fd, 2);

  +if (strcmp(config.logfilename,-) != 0)

 nit: logfilename,_-

 [...]
 --
 FFmpeg = Fanciful Fabulous Mysterious Perennial Evil Generator
 ___
 ffmpeg-devel mailing list
 ffmpeg-devel@ffmpeg.org
 http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

From 091b4a02c9325bea32b7f745d028ea72c8e1537e Mon Sep 17 00:00:00 2001
From: Binathi Bingi binti...@gmail.com
Date: Tue, 4 Nov 2014 21:42:07 +0530
Subject: [PATCH] Restore Daemon mode in FFserver

Signed-off-by: Binathi Bingi binti...@gmail.com

 Author:Binathi Bingi binti...@gmail.com
---
 doc/ffserver.conf |  4 
 doc/ffserver.texi | 11 +++
 ffserver.c| 34 ++
 ffserver_config.c |  4 ++--
 ffserver_config.h |  1 +
 5 files changed, 48 insertions(+), 6 deletions(-)

diff --git a/doc/ffserver.conf b/doc/ffserver.conf
index b756961..a017b3c 100644
--- a/doc/ffserver.conf
+++ b/doc/ffserver.conf
@@ -25,6 +25,10 @@ MaxBandwidth 1000
 # '-' is the standard output.
 CustomLog -
 
+# Enable Daemon, to launch FFserver in Daemon mode.
+# For NoDaemon mode, suppress Daemon.
+#Daemon
+
 ##
 # Definition of the live feeds. Each live feed contains one video
 # and/or audio sequence coming from an ffmpeg encoder or another
diff --git a/doc/ffserver.texi b/doc/ffserver.texi
index 77273d2..0c10c2f 100644
--- a/doc/ffserver.texi
+++ b/doc/ffserver.texi
@@ -404,10 +404,13 @@ If 

[FFmpeg-devel] fix for colorspace minimum option value

2014-11-10 Thread jon

From 616d5017d8d2e566db3deb2696cc1672f2019777 Mon Sep 17 00:00:00 2001
From: Jon Morley j...@tweaksoftware.com
Date: Mon, 10 Nov 2014 10:43:42 -0800
Subject: [PATCH] options_table.h: min value for colorspace is 0
 (AVCOL_SPC_RGB)

The min value for colorspace should be zero and not one since the first
valid index into the frame colorspace array is AVCOL_SPC_RGB which is 0.
---
 libavcodec/options_table.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index d617ae7..b72fbb1 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -432,7 +432,7 @@ static const AVOption avcodec_options[] = {
 {iec61966_2_1, IEC 61966-2-1,0, AV_OPT_TYPE_CONST, {.i64 = 
AVCOL_TRC_IEC61966_2_1 }, INT_MIN, INT_MAX, V|E|D, color_trc_type},
 {bt2020_10bit, BT.2020 - 10 bit, 0, AV_OPT_TYPE_CONST, {.i64 = 
AVCOL_TRC_BT2020_10 },INT_MIN, INT_MAX, V|E|D, color_trc_type},
 {bt2020_12bit, BT.2020 - 12 bit, 0, AV_OPT_TYPE_CONST, {.i64 = 
AVCOL_TRC_BT2020_12 },INT_MIN, INT_MAX, V|E|D, color_trc_type},
-{colorspace, color space, OFFSET(colorspace), AV_OPT_TYPE_INT, 
{.i64 = AVCOL_SPC_UNSPECIFIED }, 1, AVCOL_SPC_NB-1, V|E|D, 
colorspace_type},
+{colorspace, color space, OFFSET(colorspace), AV_OPT_TYPE_INT, 
{.i64 = AVCOL_SPC_UNSPECIFIED }, 0, AVCOL_SPC_NB-1, V|E|D, 
colorspace_type},
 {rgb, RGB, 0, AV_OPT_TYPE_CONST, {.i64 = 
AVCOL_SPC_RGB }, INT_MIN, INT_MAX, V|E|D, colorspace_type},
 {bt709,   BT.709,  0, AV_OPT_TYPE_CONST, {.i64 = 
AVCOL_SPC_BT709 },   INT_MIN, INT_MAX, V|E|D, colorspace_type},
 {unspecified, Unspecified, 0, AV_OPT_TYPE_CONST, {.i64 = 
AVCOL_SPC_UNSPECIFIED }, INT_MIN, INT_MAX, V|E|D, colorspace_type},

--
1.8.5.2 (Apple Git-48)

From 616d5017d8d2e566db3deb2696cc1672f2019777 Mon Sep 17 00:00:00 2001
From: Jon Morley j...@tweaksoftware.com
Date: Mon, 10 Nov 2014 10:43:42 -0800
Subject: [PATCH] options_table.h: min value for colorspace is 0
 (AVCOL_SPC_RGB)

The min value for colorspace should be zero and not one since the first
valid index into the frame colorspace array is AVCOL_SPC_RGB which is 0.
---
 libavcodec/options_table.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index d617ae7..b72fbb1 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -432,7 +432,7 @@ static const AVOption avcodec_options[] = {
 {iec61966_2_1, IEC 61966-2-1,0, AV_OPT_TYPE_CONST, {.i64 = 
AVCOL_TRC_IEC61966_2_1 }, INT_MIN, INT_MAX, V|E|D, color_trc_type},
 {bt2020_10bit, BT.2020 - 10 bit, 0, AV_OPT_TYPE_CONST, {.i64 = 
AVCOL_TRC_BT2020_10 },INT_MIN, INT_MAX, V|E|D, color_trc_type},
 {bt2020_12bit, BT.2020 - 12 bit, 0, AV_OPT_TYPE_CONST, {.i64 = 
AVCOL_TRC_BT2020_12 },INT_MIN, INT_MAX, V|E|D, color_trc_type},
-{colorspace, color space, OFFSET(colorspace), AV_OPT_TYPE_INT, {.i64 = 
AVCOL_SPC_UNSPECIFIED }, 1, AVCOL_SPC_NB-1, V|E|D, colorspace_type},
+{colorspace, color space, OFFSET(colorspace), AV_OPT_TYPE_INT, {.i64 = 
AVCOL_SPC_UNSPECIFIED }, 0, AVCOL_SPC_NB-1, V|E|D, colorspace_type},
 {rgb, RGB, 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_RGB },  
   INT_MIN, INT_MAX, V|E|D, colorspace_type},
 {bt709,   BT.709,  0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_BT709 
},   INT_MIN, INT_MAX, V|E|D, colorspace_type},
 {unspecified, Unspecified, 0, AV_OPT_TYPE_CONST, {.i64 = 
AVCOL_SPC_UNSPECIFIED }, INT_MIN, INT_MAX, V|E|D, colorspace_type},
-- 
1.8.5.2 (Apple Git-48)

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


[FFmpeg-devel] [PATCH] lavd/avfoundation: Use internal av_strtok instead of std lib strtok

2014-11-10 Thread Thilo Borgmann
Hi,

proposed on github. I don't see any reason why not to stick to internal variants
if we have one.

-Thilo
From ae4efc96a742ede2fa59ca6cc59ffc1979c75f72 Mon Sep 17 00:00:00 2001
From: Thilo Borgmann thilo.borgm...@mail.de
Date: Mon, 10 Nov 2014 20:31:14 +0100
Subject: [PATCH] lavd/avfoundation: Use internal av_strtok instead of std lib
 strtok

---
 libavdevice/avfoundation.m | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index 5e5f70b..e756225 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -30,6 +30,7 @@
 
 #include libavutil/pixdesc.h
 #include libavutil/opt.h
+#include libavutil/avstring.h
 #include libavformat/internal.h
 #include libavutil/internal.h
 #include libavutil/time.h
@@ -253,12 +254,13 @@ static void parse_device_name(AVFormatContext *s)
 {
 AVFContext *ctx = (AVFContext*)s-priv_data;
 char *tmp = av_strdup(s-filename);
+char *save;
 
 if (tmp[0] != ':') {
-ctx-video_filename = strtok(tmp,  :);
-ctx-audio_filename = strtok(NULL, :);
+ctx-video_filename = av_strtok(tmp,  :, save);
+ctx-audio_filename = av_strtok(NULL, :, save);
 } else {
-ctx-audio_filename = strtok(tmp,  :);
+ctx-audio_filename = av_strtok(tmp,  :, save);
 }
 }
 
-- 
1.8.3.2

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


Re: [FFmpeg-devel] [PATCH] lavd/avfoundation: Use internal av_strtok instead of std lib strtok

2014-11-10 Thread Michael Niedermayer
On Mon, Nov 10, 2014 at 08:36:37PM +0100, Thilo Borgmann wrote:
 Hi,
 
 proposed on github. I don't see any reason why not to stick to internal 
 variants
 if we have one.
 
 -Thilo

  avfoundation.m |8 +---
  1 file changed, 5 insertions(+), 3 deletions(-)
 d51346e5fd9e1b4c142c0f48e3a7eabf3f16db6b  
 0001-lavd-avfoundation-Use-internal-av_strtok-instead-of-.patch
 From ae4efc96a742ede2fa59ca6cc59ffc1979c75f72 Mon Sep 17 00:00:00 2001
 From: Thilo Borgmann thilo.borgm...@mail.de
 Date: Mon, 10 Nov 2014 20:31:14 +0100
 Subject: [PATCH] lavd/avfoundation: Use internal av_strtok instead of std lib
  strtok

applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire


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


[FFmpeg-devel] [PATCH 2/2] x86/flacdsp: add SSE2 and AVX decorrelate functions

2014-11-10 Thread James Almer
Signed-off-by: James Almer jamr...@gmail.com
---
Now also with indep8 (x86_64 only), and I'm pretty much done with these.

 libavcodec/arm/flacdsp_init_arm.c |   2 +-
 libavcodec/flacdec.c  |   6 +-
 libavcodec/flacdsp.c  |   6 +-
 libavcodec/flacdsp.h  |   6 +-
 libavcodec/flacenc.c  |   2 +-
 libavcodec/x86/flacdsp.asm| 254 ++
 libavcodec/x86/flacdsp_init.c |  63 +-
 7 files changed, 327 insertions(+), 12 deletions(-)

diff --git a/libavcodec/arm/flacdsp_init_arm.c 
b/libavcodec/arm/flacdsp_init_arm.c
index 9ddb268..df1b19c 100644
--- a/libavcodec/arm/flacdsp_init_arm.c
+++ b/libavcodec/arm/flacdsp_init_arm.c
@@ -24,7 +24,7 @@
 void ff_flac_lpc_16_arm(int32_t *samples, const int coeffs[32], int order,
 int qlevel, int len);
 
-av_cold void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt,
+av_cold void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt, 
int channels,
  int bps)
 {
 if (bps = 16  CONFIG_FLAC_DECODER)
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index f131665..9b1e428 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -111,7 +111,7 @@ static av_cold int flac_decode_init(AVCodecContext *avctx)
 if (ret  0)
 return ret;
 flac_set_bps(s);
-ff_flacdsp_init(s-dsp, avctx-sample_fmt, s-bps);
+ff_flacdsp_init(s-dsp, avctx-sample_fmt, s-channels, s-bps);
 s-got_streaminfo = 1;
 
 return 0;
@@ -173,7 +173,7 @@ static int parse_streaminfo(FLACContext *s, const uint8_t 
*buf, int buf_size)
 if (ret  0)
 return ret;
 flac_set_bps(s);
-ff_flacdsp_init(s-dsp, s-avctx-sample_fmt, s-bps);
+ff_flacdsp_init(s-dsp, s-avctx-sample_fmt, s-channels, s-bps);
 s-got_streaminfo = 1;
 
 return 0;
@@ -472,7 +472,7 @@ static int decode_frame(FLACContext *s)
 ret = allocate_buffers(s);
 if (ret  0)
 return ret;
-ff_flacdsp_init(s-dsp, s-avctx-sample_fmt, s-bps);
+ff_flacdsp_init(s-dsp, s-avctx-sample_fmt, s-channels, s-bps);
 s-got_streaminfo = 1;
 dump_headers(s-avctx, (FLACStreaminfo *)s);
 }
diff --git a/libavcodec/flacdsp.c b/libavcodec/flacdsp.c
index b15bc74..a83eb83 100644
--- a/libavcodec/flacdsp.c
+++ b/libavcodec/flacdsp.c
@@ -85,7 +85,7 @@ static void flac_lpc_32_c(int32_t *decoded, const int 
coeffs[32],
 
 }
 
-av_cold void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt,
+av_cold void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int 
channels,
  int bps)
 {
 if (bps  16) {
@@ -127,7 +127,7 @@ av_cold void ff_flacdsp_init(FLACDSPContext *c, enum 
AVSampleFormat fmt,
 }
 
 if (ARCH_ARM)
-ff_flacdsp_init_arm(c, fmt, bps);
+ff_flacdsp_init_arm(c, fmt, channels, bps);
 if (ARCH_X86)
-ff_flacdsp_init_x86(c, fmt, bps);
+ff_flacdsp_init_x86(c, fmt, channels, bps);
 }
diff --git a/libavcodec/flacdsp.h b/libavcodec/flacdsp.h
index 14f3466..417381c 100644
--- a/libavcodec/flacdsp.h
+++ b/libavcodec/flacdsp.h
@@ -31,8 +31,8 @@ typedef struct FLACDSPContext {
const int32_t coefs[32], int shift);
 } FLACDSPContext;
 
-void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int bps);
-void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt, int bps);
-void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int bps);
+void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int channels, 
int bps);
+void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt, int 
channels, int bps);
+void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int 
channels, int bps);
 
 #endif /* AVCODEC_FLACDSP_H */
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index 3b72888..e66ef3d 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -428,7 +428,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
   s-options.max_prediction_order, FF_LPC_TYPE_LEVINSON);
 
 ff_bswapdsp_init(s-bdsp);
-ff_flacdsp_init(s-flac_dsp, avctx-sample_fmt,
+ff_flacdsp_init(s-flac_dsp, avctx-sample_fmt, channels,
 avctx-bits_per_raw_sample);
 
 dprint_compression_options(s);
diff --git a/libavcodec/x86/flacdsp.asm b/libavcodec/x86/flacdsp.asm
index 37ee87b..6dcddd9 100644
--- a/libavcodec/x86/flacdsp.asm
+++ b/libavcodec/x86/flacdsp.asm
@@ -72,3 +72,257 @@ ALIGN 16
 LPC_32 xop
 %endif
 LPC_32 sse4
+
+;--
+;void ff_flac_decorrelate_[lrm]s_16_sse2(uint8_t **out, int32_t **in, int 
channels,
+;   int len, int shift);
+;--
+%macro FLAC_DECORRELATE_16 3-4

Re: [FFmpeg-devel] fix for colorspace minimum option value

2014-11-10 Thread Michael Niedermayer
On Mon, Nov 10, 2014 at 10:49:42AM -0800, jon wrote:
 From 616d5017d8d2e566db3deb2696cc1672f2019777 Mon Sep 17 00:00:00 2001
 From: Jon Morley j...@tweaksoftware.com
 Date: Mon, 10 Nov 2014 10:43:42 -0800
 Subject: [PATCH] options_table.h: min value for colorspace is 0
  (AVCOL_SPC_RGB)
 
 The min value for colorspace should be zero and not one since the first
 valid index into the frame colorspace array is AVCOL_SPC_RGB which is 0.
 ---
  libavcodec/options_table.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


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


Re: [FFmpeg-devel] [PATCH] vf_interlace: Add SIMD for lowpass filter

2014-11-10 Thread Carl Eugen Hoyos
Kieran Kunhya kierank at obe.tv writes:

  libavfilter/vf_interlace.c  | 55 -

patching file libavfilter/vf_interlace.c
Hunk #1 FAILED at 30.
Hunk #2 FAILED at 70.
Hunk #3 FAILED at 116.
Hunk #4 succeeded at 152 (offset -1 lines).
Hunk #5 succeeded at 202 (offset -2 lines).
3 out of 5 hunks FAILED -- saving rejects to file libavfilter/vf_interlace.c.rej

Sorry if my test was somehow incorrect.

Carl Eugen

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


Re: [FFmpeg-devel] [PATCH] vf_interlace: Add SIMD for lowpass filter

2014-11-10 Thread James Almer
On 10/11/14 6:42 PM, Kieran Kunhya wrote:

Can't test since it doesn't apply cleanly, but here are a few comments anyway.

 diff --git a/libavfilter/x86/vf_interlace.asm 
 b/libavfilter/x86/vf_interlace.asm
 new file mode 100644
 index 000..40b10fc
 --- /dev/null
 +++ b/libavfilter/x86/vf_interlace.asm
 @@ -0,0 +1,80 @@
 +;*
 +;* x86-optimized functions for interlace filter
 +;*
 +;* Copyright (C) 2014 Kieran Kunhya kier...@obe.tv
 +;*
 +;* This file is part of Libav.
 +;*
 +;* Libav is free software; you can redistribute it and/or modify
 +;* it under the terms of the GNU General Public License as published by
 +;* the Free Software Foundation; either version 2 of the License, or
 +;* (at your option) any later version.
 +;*
 +;* Libav is distributed in the hope that it will be useful,
 +;* but WITHOUT ANY WARRANTY; without even the implied warranty of
 +;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +;* GNU General Public License for more details.
 +;*
 +;* You should have received a copy of the GNU General Public License along
 +;* with Libav; if not, write to the Free Software Foundation, Inc.,
 +;* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 +;**
 +
 +%include libavutil/x86/x86util.asm
 +
 +SECTION_RODATA
 +
 +pw_1: times  8 dw 1
 +
 +SECTION .text
 +
 +%macro LOWPASS_LINE 0
 +cglobal lowpass_line, 5, 5

You're using m6, you need to declare 7 xmm regs.
Also, naming the regs would be better than using r*.

 +add r0, r1
 +add r2, r1
 +add r3, r1
 +add r4, r1
 +neg r1
 +
 +pxor m6, m6
 +
 +.loop
 +mova m0, [r2+r1]
 +punpcklbw m1, m0, m6
 +punpckhbw m0, m6
 +psllw m0, 1
 +psllw m1, 1
 +
 +mova m2, [r3+r1]
 +punpcklbw m3, m2, m6
 +punpckhbw m2, m6
 +
 +mova m4, [r4+r1]
 +punpcklbw m5, m4, m6
 +punpckhbw m4, m6
 +
 +paddw m1, m3
 +paddw m1, m5
 +
 +paddw m0, m2
 +paddw m0, m4
 +
 +paddw m0, [pw_1]
 +paddw m1, [pw_1]
 +
 +psrlw m0, 2
 +psrlw m1, 2

Can't pavgw be used here?

 +
 +packuswb m1, m0
 +mova [r0+r1], m1
 +
 +add r1, mmsize
 +jl .loop
 +REP_RET
 +%endmacro
 +
 +INIT_XMM sse2
 +LOWPASS_LINE
 +
 +INIT_XMM avx
 +LOWPASS_LINE


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


Re: [FFmpeg-devel] [PATCH] vf_interlace: Add SIMD for lowpass filter

2014-11-10 Thread Kieran Kunhya
 Can't pavgw be used here?

I don't think so?

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


[FFmpeg-devel] [PATCH] ffplay: signal the frame queue before closing audio

2014-11-10 Thread Marton Balint
Fixed regression caused by 631ac655c00e978e19d05dab572bc1ffd6078c63 when ffplay
does not quit if the audio thread is blocked.

Signed-off-by: Marton Balint c...@passwd.hu
---
 ffplay.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index 490bffa..f79161d 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2786,9 +2786,8 @@ static void stream_component_close(VideoState *is, int 
stream_index)
 switch (avctx-codec_type) {
 case AVMEDIA_TYPE_AUDIO:
 packet_queue_abort(is-audioq);
-
-SDL_CloseAudio();
 frame_queue_signal(is-sampq);
+SDL_CloseAudio();
 SDL_WaitThread(is-audio_tid, NULL);
 
 decoder_destroy(is-auddec);
-- 
2.1.2

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


[FFmpeg-devel] [PATCH] Fixes for the Icecast protocol

2014-11-10 Thread epirat07

Fixed space vs. tab messup
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/3] allow tabs in *.mak, they are part of the makefile syntax

2014-11-10 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer michae...@gmx.at
---
 update |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/update b/update
index 86d51db..92e645d 100644
--- a/update
+++ b/update
@@ -67,7 +67,7 @@ check_ending_newline () {
 
 
 check_tabs () {
-  for file in $(git diff-tree --name-only --diff-filter=A|C|M|R -r $REVISION 
| tail -n +2 | egrep -v 
'Makefile.*|common.mak|library.mak|subdir.mak|clean-diff|\.diff|\.patch' | 
egrep $@) ; do
+  for file in $(git diff-tree --name-only --diff-filter=A|C|M|R -r $REVISION 
| tail -n +2 | egrep -v 
'Makefile.*|common.mak|library.mak|subdir.mak|clean-diff|\.diff|\.patch|\.mak' 
| egrep $@) ; do
 if is_text_file $REVISION $file 2 /dev/null ; then
   if git cat-file -p $REVISION:$file | grep -e ' '  /dev/null; then
 echoerr In $REVISION:
-- 
1.7.9.5

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


Re: [FFmpeg-devel] [PATCH] allow tabs in *.mak, they are part of the makefile syntax

2014-11-10 Thread Michael Niedermayer
On Mon, Nov 10, 2014 at 12:25:20PM -0800, Timothy Gu wrote:
 What is this? Next time would you mind adding a [TAG] in the summary? thanks!
 
 On Mon, Nov 10, 2014 at 5:57 AM, Michael Niedermayer michae...@gmx.at wrote:
  Signed-off-by: Michael Niedermayer michae...@gmx.at
  ---
   update |2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
 
  diff --git a/update b/update
  index 86d51db..92e645d 100644
  --- a/update
  +++ b/update
  @@ -67,7 +67,7 @@ check_ending_newline () {
 
 
   check_tabs () {
  -  for file in $(git diff-tree --name-only --diff-filter=A|C|M|R -r 
  $REVISION | tail -n +2
  | egrep -v
  'Makefile.*|common.mak|library.mak|subdir.mak|clean-diff|\.diff|\.patch'
  | egrep $@) ; do
 
  +  for file in $(git diff-tree --name-only --diff-filter=A|C|M|R -r 
  $REVISION | tail -n +2
  | egrep -v
  'Makefile.*|common.mak|library.mak|subdir.mak|clean-diff|\.diff|\.patch|\.mak'
  | egrep $@) ; do
 
 you can remove all the other .mak's.

done  new patchset posted

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

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus


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


Re: [FFmpeg-devel] [PATCH] Fixes for the Icecast protocol

2014-11-10 Thread Timothy Gu
Hi,

On Monday, November 10, 2014, epira...@gmail.com wrote:

 From: ePirat epira...@gmail.com javascript:;


Real name please.



 Send 100-continue header so we detect errors before sending data
 Use a default content-type (content-type is required since Icecast 2.4.1)


These are two unrelated changes and should therefore be split into two
patches.


 ---
  libavformat/icecast.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

 diff --git a/libavformat/icecast.c b/libavformat/icecast.c
 index 7d60e44..b477528 100644
 --- a/libavformat/icecast.c
 +++ b/libavformat/icecast.c
 @@ -60,7 +60,7 @@ static const AVOption options[] = {
  { ice_public, set if stream is public, OFFSET(public),
 AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, E },
  { user_agent, override User-Agent header, OFFSET(user_agent),
 AV_OPT_TYPE_STRING, { 0 }, 0, 0, E },
  { password, set password, OFFSET(pass), AV_OPT_TYPE_STRING, { 0
 }, 0, 0, E },



 -{ content_type, set content-type, MUST be set if not audio/mpeg,
 OFFSET(content_type), AV_OPT_TYPE_STRING, { 0 }, 0, 0, E },
 +{ content_type, set content-type, MUST be set if not audio/mpeg,
 OFFSET(content_type), AV_OPT_TYPE_STRING, { .str = audio/mpeg }, 0, 0, E
 },




  { legacy_icecast, use legacy SOURCE method, for Icecast  v2.4,
 OFFSET(legacy_icecast), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, E },
  { NULL }
  };
 @@ -115,8 +115,8 @@ static int icecast_open(URLContext *h, const char
 *uri, int flags)
  av_dict_set(opt_dict, auth_type, basic, 0);
  av_dict_set(opt_dict, headers, headers, 0);
  av_dict_set(opt_dict, chunked_post, 0, 0);



 -if (NOT_EMPTY(s-content_type))
 -av_dict_set(opt_dict, content_type, s-content_type, 0);
 +av_dict_set(opt_dict, content_type, s-content_type, 0);


This change LGTM.


 +   av_dict_set(opt_dict, send_expect_100, 1, 0);


Not sure about this one.

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


Re: [FFmpeg-devel] [PATCH 1/3] allow tabs in *.mak, they are part of the makefile syntax

2014-11-10 Thread Timothy Gu
On Monday, November 10, 2014, Michael Niedermayer michae...@gmx.at wrote:

 Signed-off-by: Michael Niedermayer michae...@gmx.at javascript:;
 ---
  update |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)


LGTM

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


[FFmpeg-devel] [PATCH 2/3] remove redundant explicit file.mak cases from the tab test

2014-11-10 Thread Timothy Gu
On Monday, November 10, 2014, Michael Niedermayer michae...@gmx.at
javascript:_e(%7B%7D,'cvml','michae...@gmx.at'); wrote:

 ---
  update |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)


LGTM if tested.

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


Re: [FFmpeg-devel] [PATCH 3/3] allow fate references to lack the final newline

2014-11-10 Thread Timothy Gu
On Monday, November 10, 2014, Michael Niedermayer michae...@gmx.at wrote:

 From: Lukasz Marek lukasz.m.lu...@gmail.com javascript:;

 ---
  update |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)


LGTM if tested.

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


Re: [FFmpeg-devel] [PATCH 1/4] ffserver_config: drop requirement video size being multiple of 16

2014-11-10 Thread Lukasz Marek

On 01.11.2014 22:20, Reynaldo H. Verdejo Pinochet wrote:

Hi

On 10/31/2014 11:00 PM, Lukasz Marek wrote:

[..]
diff --git a/ffserver_config.c b/ffserver_config.c
index d589ff2..f11db03 100644
--- a/ffserver_config.c
+++ b/ffserver_config.c
@@ -819,8 +819,6 @@ static int ffserver_parse_config_stream(FFServerConfig 
*config, const char *cmd,
  ret = av_parse_video_size(w, h, arg);
  if (ret  0)
  ERROR(Invalid video size '%s'\n, arg);
-else if ((w % 16) || (h % 16))
-ERROR(Image size must be a multiple of 16\n);
[..]


OK if always safe. Otherwise demote to WARNING()


Changed to warning when (w%2) || (h%2).
with current constraints 360p is not even possible to be used.

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


Re: [FFmpeg-devel] [PATCH] Fixes for the Icecast protocol

2014-11-10 Thread Carl Eugen Hoyos
Timothy Gu timothygu99 at gmail.com writes:

  From: ePirat epirat07 at gmail.com javascript:;
 
 Real name please.

Could you elaborate?

There are both active developers who don't use 
real names and copyright holders for different 
source files who chose to use an alias.
Why shouldn't this be ok in this case?

Carl Eugen

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


[FFmpeg-devel] [PATCH 2/2] Icecast: Use 100-continue if possible for proper error handling

2014-11-10 Thread epirat07
From: Marvin Scholz epira...@gmail.com

Using 100-continue ffmpeg will only send data if the server confirms it,
so if there is an error with auth or mounpoint, this allows that it is
properly reported to the user. Else ffmpeg sends data and just quits at
some point without an error message.
---
 libavformat/icecast.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/icecast.c b/libavformat/icecast.c
index d7a2d18..d1e467e 100644
--- a/libavformat/icecast.c
+++ b/libavformat/icecast.c
@@ -116,6 +116,7 @@ static int icecast_open(URLContext *h, const char *uri, int 
flags)
 av_dict_set(opt_dict, headers, headers, 0);
 av_dict_set(opt_dict, chunked_post, 0, 0);
 av_dict_set(opt_dict, content_type, s-content_type, 0);
+av_dict_set(opt_dict, send_expect_100, s-legacy_icecast ? 0 : 1, 
0);
 if (NOT_EMPTY(s-user_agent))
 av_dict_set(opt_dict, user_agent, s-user_agent, 0);
 
-- 
2.1.0

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


[FFmpeg-devel] [PATCH 1/2] Icecast: always send a content-type

2014-11-10 Thread epirat07
From: Marvin Scholz epira...@gmail.com

use a default (audio/mpeg for historical reason) if none. Required since 
Icecast 2.4.1
---
 libavformat/icecast.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavformat/icecast.c b/libavformat/icecast.c
index 7d60e44..d7a2d18 100644
--- a/libavformat/icecast.c
+++ b/libavformat/icecast.c
@@ -60,7 +60,7 @@ static const AVOption options[] = {
 { ice_public, set if stream is public, OFFSET(public), 
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, E },
 { user_agent, override User-Agent header, OFFSET(user_agent), 
AV_OPT_TYPE_STRING, { 0 }, 0, 0, E },
 { password, set password, OFFSET(pass), AV_OPT_TYPE_STRING, { 0 }, 0, 
0, E },
-{ content_type, set content-type, MUST be set if not audio/mpeg, 
OFFSET(content_type), AV_OPT_TYPE_STRING, { 0 }, 0, 0, E },
+{ content_type, set content-type, MUST be set if not audio/mpeg, 
OFFSET(content_type), AV_OPT_TYPE_STRING, { .str = audio/mpeg }, 0, 0, E },
 { legacy_icecast, use legacy SOURCE method, for Icecast  v2.4, 
OFFSET(legacy_icecast), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, E },
 { NULL }
 };
@@ -115,8 +115,7 @@ static int icecast_open(URLContext *h, const char *uri, int 
flags)
 av_dict_set(opt_dict, auth_type, basic, 0);
 av_dict_set(opt_dict, headers, headers, 0);
 av_dict_set(opt_dict, chunked_post, 0, 0);
-if (NOT_EMPTY(s-content_type))
-av_dict_set(opt_dict, content_type, s-content_type, 0);
+av_dict_set(opt_dict, content_type, s-content_type, 0);
 if (NOT_EMPTY(s-user_agent))
 av_dict_set(opt_dict, user_agent, s-user_agent, 0);
 
-- 
2.1.0

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


Re: [FFmpeg-devel] [PATCH 3/4] web/style.less: colors: Reindent and use more obvious functions

2014-11-10 Thread Timothy Gu
On Thu, Nov 6, 2014 at 6:55 PM, Timothy Gu timothyg...@gmail.com wrote:
 Signed-off-by: Timothy Gu timothyg...@gmail.com
 ---
 I feel like using hsl() in this case is clearer that the color is plain
 gray. Bikeshedding welcome.
 ---
  src/less/style.less | 31 +++
  1 file changed, 19 insertions(+), 12 deletions(-)

Ping, and CC'ing db0 who is the maintainer of the website.

[...]

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


[FFmpeg-devel] Resubmit patch02 - [patch 4/4] Fix bug forPOWERLE: libswscale/ppc/swscale_altivec.c

2014-11-10 Thread rongyan
Hi,
Thanks for your patience and review.
New patch please find in the attachment. This is the second of two.
The fate test result is here:
 
 Regards,
Rong Yan
   
 

 Subject: [FFmpeg-devel] Resubmit patch02 - Fwd: [patch 4/4] Fix bug for 
POWERLE: libswscale/ppc/swscale_altivec.c


From: rongyan rongyan...@foxmail.com
Date: 2014-11-10 17:03 GMT+08:00
To: ffmpeg-devel ffmpeg-devel@ffmpeg.org
Cc: Tony Lin linzhaolo...@gmail.com


Hi,
New patch please find in the attachment. There are two patches to re-submit, 
this is the second.
The fate test result is here:

 Rong Yan




 --  --
  ??: Tony Lin;linzhaolo...@gmail.com;
 : 2014??11??10??(??) 11:32
 ??: rongyanrongyan...@foxmail.com;

 : Fwd: [FFmpeg-devel] [patch 4/4] Fix bug for POWERLE: 
libswscale/ppc/swscale_altivec.c




 Forwarded conversation
Subject: [FFmpeg-devel] [patch 4/4] Fix bug for POWERLE: 
libswscale/ppc/swscale_altivec.c


From: rongyan rongyan...@foxmail.com
Date: 2014-11-07 17:43 GMT+08:00
To: ffmpeg-devel ffmpeg-devel@ffmpeg.org


Hi,
There are 4 patches presented to fix bugs for POWER8 little endian. I will send 
4 patches in 4 different email. This is the fourth.

It fixed the function hScale_altivec_real(), yuv2planeX_16_altivec(), 
yuv2planeX_8().

The fate test result on POWER BE and POWER LE after merge these 4 patches are 
attached here to facilitate the review:

 The passed test cases change from 1679/2182 to 2010/2236.




 Rong Yan


 --
   The world has enough for everyone's need, but not enough for everyone's 
greed.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


--
From: Michael Niedermayer michae...@gmx.at
Date: 2014-11-08 1:54 GMT+08:00
To: FFmpeg development discussions and patches ffmpeg-devel@ffmpeg.org



  swscale_altivec.c |  142 
 +++---
  1 file changed, 50 insertions(+), 92 deletions(-)
 0c364d48e08b7df42bee5e269fe46b2d7be0f4b9  
 0004-libswscale-ppc-swscale_altivec.c-fix-hScale_altivec_.patch
 From 9ec626726d1cc30db54390ee81f52cfe53ebeedf Mon Sep 17 00:00:00 2001
 From: Rong Yan rongyan...@gmail.com
 Date: Fri, 7 Nov 2014 09:09:09 +
 Subject: [PATCH 4/4] libswscale/ppc/swscale_altivec.c : fix
  hScale_altivec_real() yuv2planeX_16_altivec() yuv2planeX_8() for POWER LE

 ---
  libswscale/ppc/swscale_altivec.c | 142 
 ++-
  1 file changed, 50 insertions(+), 92 deletions(-)

 diff --git a/libswscale/ppc/swscale_altivec.c 
 b/libswscale/ppc/swscale_altivec.c
 index 86f40ab..1673b8b 100644
 --- a/libswscale/ppc/swscale_altivec.c
 +++ b/libswscale/ppc/swscale_altivec.c
 @@ -29,20 +29,30 @@
  #include libavutil/attributes.h
  #include libavutil/cpu.h
  #include yuv2rgb_altivec.h
 +#include libavutil/ppc/util_altivec.h

  #if HAVE_ALTIVEC
  #define vzero vec_splat_s32(0)

 -#define yuv2planeX_8(d1, d2, l1, src, x, perm, filter) do { \
 -vector signed short l2  = vec_ld(((x)  1) + 16, src); \
 -vector signed short ls  = vec_perm(l1, l2, perm);   \
 -vector signed int   i1  = vec_mule(filter, ls); \
 -vector signed int   i2  = vec_mulo(filter, ls); \
 -vector signed int   vf1 = vec_mergeh(i1, i2);   \
 -vector signed int   vf2 = vec_mergel(i1, i2);   \
 -d1 = vec_add(d1, vf1);  \
 -d2 = vec_add(d2, vf2);  \
 -l1 = l2;\
 +#if HAVE_BIGENDIAN
 +#define  GET_VF(a, b) {\
 +a = vec_mergeh(i1, i2);\
 +b = vec_mergel(i1, i2);\
 +}
 +#else
 +#define  GET_VF(a, b) {\
 +a = vec_mergel(i2, i1);\
 +b = vec_mergeh(i2, i1);\
 +}
 +#endif
 +
 +#define yuv2planeX_8(d1, d2, l1, src, x, filter) do {\
 +vector signed int   i1  = vec_mule(filter, l1);\
 +vector signed int   i2  = vec_mulo(filter, l1);\
 +vector signed int   vf1, vf2;\
 +GET_VF(vf1, vf2);\
 +d1 = vec_add(d1, vf1);\
 +d2 = vec_add(d2, vf2);\
  } while (0)

  static void yuv2planeX_16_altivec(const int16_t *filter, int filterSize,

 @@ -66,16 +76,13 @@ static void yuv2planeX_16_altivec(const int16_t *filter, 
 int filterSize,
  vo4 = vec_ld(48, val);

  for (j = 0; j  filterSize; j++) {
 -vector signed short l1, vLumFilter = vec_ld(j  1, filter);
 -vector unsigned char perm, perm0 = vec_lvsl(j  1, filter);
 -vLumFilter = vec_perm(vLumFilter, vLumFilter, perm0);
 +vector signed short l1, l2;
 +vector signed short vLumFilter = (vector signed 
 short)unaligned_load(j  1, filter);
  vLumFilter = 

[FFmpeg-devel] [PATCH 3/9] lavf/ffm: store/restore private codec context

2014-11-10 Thread Lukasz Marek
TODO: bump micro

Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
---
 libavformat/ffmdec.c | 41 -
 libavformat/ffmenc.c | 27 +--
 2 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index 448762b..bba3b36 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -23,6 +23,7 @@
 
 #include libavutil/intreadwrite.h
 #include libavutil/intfloat.h
+#include libavutil/opt.h
 #include avformat.h
 #include internal.h
 #include ffm.h
@@ -237,6 +238,8 @@ static int ffm2_read_header(AVFormatContext *s)
 AVIOContext *pb = s-pb;
 AVCodecContext *codec;
 int ret;
+int f_main = 0, f_cprv, f_stvi, f_stau;
+char *buffer;
 
 ffm-packet_size = avio_rb32(pb);
 if (ffm-packet_size != FFM_PACKET_SIZE) {
@@ -267,10 +270,15 @@ static int ffm2_read_header(AVFormatContext *s)
 
 switch(id) {
 case MKBETAG('M', 'A', 'I', 'N'):
+if (f_main++) {
+ret = AVERROR(EINVAL);
+goto fail;
+}
 avio_rb32(pb); /* nb_streams */
 avio_rb32(pb); /* total bitrate */
 break;
 case MKBETAG('C', 'O', 'M', 'M'):
+f_cprv = f_stvi = f_stau = 0;
 st = avformat_new_stream(s, NULL);
 if (!st) {
 ret = AVERROR(ENOMEM);
@@ -291,12 +299,13 @@ static int ffm2_read_header(AVFormatContext *s)
 if (ff_get_extradata(codec, pb, avio_rb32(pb))  0)
 return AVERROR(ENOMEM);
 }
-avio_seek(pb, next, SEEK_SET);
-id = avio_rb32(pb);
-size = avio_rb32(pb);
-next = avio_tell(pb) + size;
-switch(id) {
+break;
+//TODO: reident
 case MKBETAG('S', 'T', 'V', 'I'):
+if (f_stvi++) {
+ret = AVERROR(EINVAL);
+goto fail;
+}
 codec-time_base.num = avio_rb32(pb);
 codec-time_base.den = avio_rb32(pb);
 codec-width = avio_rb16(pb);
@@ -343,11 +352,33 @@ static int ffm2_read_header(AVFormatContext *s)
 codec-refs = avio_rb32(pb);
 break;
 case MKBETAG('S', 'T', 'A', 'U'):
+if (f_stau++) {
+ret = AVERROR(EINVAL);
+goto fail;
+}
 codec-sample_rate = avio_rb32(pb);
 codec-channels = avio_rl16(pb);
 codec-frame_size = avio_rl16(pb);
 break;
+case MKBETAG('C', 'P', 'R', 'V'):
+if (f_cprv++) {
+ret = AVERROR(EINVAL);
+goto fail;
+}
+codec-codec = avcodec_find_encoder(codec-codec_id);
+buffer = av_malloc(size + 1);
+codec-priv_data = av_mallocz(codec-codec-priv_data_size);
+if (!buffer || !codec-priv_data) {
+av_free(buffer);
+av_freep(codec-priv_data);
+ret = AVERROR(ENOMEM);
+goto fail;
 }
+*(const AVClass**)codec-priv_data = codec-codec-priv_class;
+av_opt_set_defaults(codec-priv_data);
+avio_get_str(pb, size, buffer, size + 1);
+av_set_options_string(codec-priv_data, buffer, =, ,);
+av_freep(buffer);
 break;
 }
 avio_seek(pb, next, SEEK_SET);
diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c
index eb809eb..f307f8f 100644
--- a/libavformat/ffmenc.c
+++ b/libavformat/ffmenc.c
@@ -23,6 +23,7 @@
 #include libavutil/intfloat.h
 #include libavutil/avassert.h
 #include libavutil/parseutils.h
+#include libavutil/opt.h
 #include avformat.h
 #include internal.h
 #include ffm.h
@@ -93,6 +94,24 @@ static void write_header_chunk(AVIOContext *pb, AVIOContext 
*dpb, unsigned id)
 av_free(dyn_buf);
 }
 
+static int ffm_write_header_codec_private_ctx(AVIOContext *pb, void 
*priv_data, int type)
+{
+AVIOContext *tmp;
+char *buf = NULL;
+
+if (priv_data) {
+if (avio_open_dyn_buf(tmp)  0)
+return AVERROR(ENOMEM);
+av_opt_serialize(priv_data, AV_OPT_FLAG_ENCODING_PARAM | type, 1, 
buf, '=', ',');
+if (buf  strlen(buf)) {
+avio_put_str(tmp, buf);
+write_header_chunk(pb, tmp, MKBETAG('C', 'P', 'R', 'V'));
+}
+av_free(buf);
+}
+return 0;
+}
+
 static int ffm_write_header(AVFormatContext *s)
 {
 FFMContext *ffm = s-priv_data;
@@ -100,10 +119,10 @@ static int ffm_write_header(AVFormatContext *s)
 AVStream *st;
 AVIOContext *pb = s-pb;
 AVCodecContext *codec;
-int bit_rate, i;
+int bit_rate, i, ret;
 
 if (t = av_dict_get(s-metadata, creation_time, NULL, 0)) {
-int ret = av_parse_time(ffm-start_time, t-value, 0);
+ret = 

[FFmpeg-devel] [PATCH 4/9] ffmpeg_opt: allow to force codec in new_output_stream

2014-11-10 Thread Lukasz Marek
Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
---
 ffmpeg_opt.c | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 77ef0c4..1b3f73a 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -1036,11 +1036,12 @@ static int get_preset_file_2(const char *preset_name, 
const char *codec_name, AV
 return ret;
 }
 
-static void choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream 
*ost)
+static void choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream 
*ost, const AVCodec *forced_codec)
 {
-char *codec_name = NULL;
+const char *codec_name = forced_codec ? forced_codec-name : NULL;
 
-MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, ost-st);
+if (!codec_name)
+MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, ost-st);
 if (!codec_name) {
 ost-st-codec-codec_id = av_guess_codec(s-oformat, NULL, 
s-filename,
   NULL, 
ost-st-codec-codec_type);
@@ -1053,7 +1054,7 @@ static void choose_encoder(OptionsContext *o, 
AVFormatContext *s, OutputStream *
 }
 }
 
-static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, 
enum AVMediaType type, int source_index)
+static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, 
enum AVMediaType type, int source_index, const AVCodec *forced_codec)
 {
 OutputStream *ost;
 AVStream *st = avformat_new_stream(oc, NULL);
@@ -1080,7 +1081,7 @@ static OutputStream *new_output_stream(OptionsContext *o, 
AVFormatContext *oc, e
 ost-index  = idx;
 ost-st = st;
 st-codec-codec_type = type;
-choose_encoder(o, oc, ost);
+choose_encoder(o, oc, ost, forced_codec);
 
 ost-enc_ctx = avcodec_alloc_context3(ost-enc);
 if (!ost-enc_ctx) {
@@ -1276,7 +1277,7 @@ static OutputStream *new_video_stream(OptionsContext *o, 
AVFormatContext *oc, in
 AVCodecContext *video_enc;
 char *frame_rate = NULL, *frame_aspect_ratio = NULL;
 
-ost = new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO, source_index);
+ost = new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO, source_index, NULL);
 st  = ost-st;
 video_enc = ost-enc_ctx;
 
@@ -1437,7 +1438,7 @@ static OutputStream *new_audio_stream(OptionsContext *o, 
AVFormatContext *oc, in
 OutputStream *ost;
 AVCodecContext *audio_enc;
 
-ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO, source_index);
+ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO, source_index, NULL);
 st  = ost-st;
 
 audio_enc = ost-enc_ctx;
@@ -1507,7 +1508,7 @@ static OutputStream *new_data_stream(OptionsContext *o, 
AVFormatContext *oc, int
 {
 OutputStream *ost;
 
-ost = new_output_stream(o, oc, AVMEDIA_TYPE_DATA, source_index);
+ost = new_output_stream(o, oc, AVMEDIA_TYPE_DATA, source_index, NULL);
 if (!ost-stream_copy) {
 av_log(NULL, AV_LOG_FATAL, Data stream encoding not supported yet 
(only streamcopy)\n);
 exit_program(1);
@@ -1518,7 +1519,7 @@ static OutputStream *new_data_stream(OptionsContext *o, 
AVFormatContext *oc, int
 
 static OutputStream *new_attachment_stream(OptionsContext *o, AVFormatContext 
*oc, int source_index)
 {
-OutputStream *ost = new_output_stream(o, oc, AVMEDIA_TYPE_ATTACHMENT, 
source_index);
+OutputStream *ost = new_output_stream(o, oc, AVMEDIA_TYPE_ATTACHMENT, 
source_index, NULL);
 ost-stream_copy = 1;
 ost-finished= 1;
 return ost;
@@ -1530,7 +1531,7 @@ static OutputStream *new_subtitle_stream(OptionsContext 
*o, AVFormatContext *oc,
 OutputStream *ost;
 AVCodecContext *subtitle_enc;
 
-ost = new_output_stream(o, oc, AVMEDIA_TYPE_SUBTITLE, source_index);
+ost = new_output_stream(o, oc, AVMEDIA_TYPE_SUBTITLE, source_index, NULL);
 st  = ost-st;
 subtitle_enc = ost-enc_ctx;
 
@@ -1638,7 +1639,7 @@ static int read_ffserver_streams(OptionsContext *o, 
AVFormatContext *s, const ch
 av_log(s, AV_LOG_ERROR, no encoder found for codec id %i\n, 
ic-streams[i]-codec-codec_id);
 return AVERROR(EINVAL);
 }
-ost   = new_output_stream(o, s, codec-type, -1);
+ost   = new_output_stream(o, s, codec-type, -1, NULL);
 st= ost-st;
 avctx = st-codec;
 ost-enc = codec;
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 5/9] ffmpeg_opt: use codec private context in ffserver streams

2014-11-10 Thread Lukasz Marek
Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
---
 ffmpeg_opt.c | 48 
 1 file changed, 32 insertions(+), 16 deletions(-)

diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 1b3f73a..fdbab58 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -1618,6 +1618,35 @@ static int copy_chapters(InputFile *ifile, OutputFile 
*ofile, int copy_metadata)
 return 0;
 }
 
+static int ffserver_streams_copy_context(AVCodecContext *dest, const 
AVCodecContext *src)
+{
+int ret;
+if ((ret = avcodec_copy_context(dest, src))  0)
+return ret;
+if (src-priv_data) {
+if (dest-priv_data  *(const AVClass**)src-priv_data != *(const 
AVClass**)dest-priv_data) {
+av_opt_free(dest-priv_data);
+av_freep(dest-priv_data);
+}
+if (!dest-priv_data) {
+if (!src-codec) {
+av_log(NULL, AV_LOG_WARNING, Cannot copy codec private 
options. They won't get applied.\n);
+return 0;
+}
+dest-priv_data = av_mallocz(src-codec-priv_data_size);
+if (!dest-priv_data)
+return AVERROR(ENOMEM);
+*(const AVClass**)dest-priv_data = src-codec-priv_class;
+}
+av_opt_copy(dest-priv_data, src-priv_data);
+} else if (dest-priv_data) {
+av_opt_free(dest-priv_data);
+av_freep(dest-priv_data);
+}
+
+return 0;
+}
+
 static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const 
char *filename)
 {
 int i, err;
@@ -1632,35 +1661,22 @@ static int read_ffserver_streams(OptionsContext *o, 
AVFormatContext *s, const ch
 AVStream *st;
 OutputStream *ost;
 AVCodec *codec;
-AVCodecContext *avctx;
 
 codec = avcodec_find_encoder(ic-streams[i]-codec-codec_id);
 if (!codec) {
 av_log(s, AV_LOG_ERROR, no encoder found for codec id %i\n, 
ic-streams[i]-codec-codec_id);
 return AVERROR(EINVAL);
 }
-ost   = new_output_stream(o, s, codec-type, -1, NULL);
+ost   = new_output_stream(o, s, codec-type, -1, codec);
 st= ost-st;
-avctx = st-codec;
-ost-enc = codec;
 
-// FIXME: a more elegant solution is needed
-memcpy(st, ic-streams[i], sizeof(AVStream));
-st-cur_dts = 0;
-st-info = av_malloc(sizeof(*st-info));
-memcpy(st-info, ic-streams[i]-info, sizeof(*st-info));
-st-codec= avctx;
-avcodec_copy_context(st-codec, ic-streams[i]-codec);
+ffserver_streams_copy_context(st-codec, ic-streams[i]-codec);
 
 if (st-codec-codec_type == AVMEDIA_TYPE_AUDIO  !ost-stream_copy)
 choose_sample_fmt(st, codec);
 else if (st-codec-codec_type == AVMEDIA_TYPE_VIDEO  
!ost-stream_copy)
 choose_pixel_fmt(st, st-codec, codec, st-codec-pix_fmt);
-avcodec_copy_context(ost-enc_ctx, st-codec);
-if (ost-enc_ctx-priv_data) {
-av_opt_free(ost-enc_ctx-priv_data);
-av_freep(ost-enc_ctx-priv_data);
-}
+ffserver_streams_copy_context(ost-enc_ctx, st-codec);
 }
 
 avformat_close_input(ic);
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 6/9] ffserver_config: handle codec private options

2014-11-10 Thread Lukasz Marek
This commit allows to set codec's private option.
As side effect this commit also improves preset support.

Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
---
 Changelog |   1 +
 doc/ffserver.texi |  10 ++-
 ffserver_config.c | 219 ++
 ffserver_config.h |   9 ++-
 4 files changed, 153 insertions(+), 86 deletions(-)

diff --git a/Changelog b/Changelog
index 30a1dd2..e0ba0ce 100644
--- a/Changelog
+++ b/Changelog
@@ -11,6 +11,7 @@ version next:
 - XCB-based screen-grabber
 - UDP-Lite support (RFC 3828)
 - xBR scaling filter
+- ffserver supports codec private options
 
 version 2.4:
 - Icecast protocol
diff --git a/doc/ffserver.texi b/doc/ffserver.texi
index 77273d2..b7c5b6a 100644
--- a/doc/ffserver.texi
+++ b/doc/ffserver.texi
@@ -589,8 +589,9 @@ Set sampling frequency for audio. When using low bitrates, 
you should
 lower this frequency to 22050 or 11025. The supported frequencies
 depend on the selected audio codec.
 
-@item AVOptionAudio @var{option} @var{value} (@emph{encoding,audio})
-Set generic option for audio stream.
+@item AVOptionAudio [@var{codec}:]@var{option} @var{value} 
(@emph{encoding,audio})
+Set generic or private option for audio stream.
+Private option must be prefixed with codec name or codec must be defined 
before.
 
 @item AVPresetAudio @var{preset} (@emph{encoding,audio})
 Set preset for audio stream.
@@ -667,8 +668,9 @@ Set video @option{qdiff} encoding option.
 @item DarkMask @var{float} (@emph{encoding,video})
 Set @option{lumi_mask}/@option{dark_mask} encoding options.
 
-@item AVOptionVideo @var{option} @var{value} (@emph{encoding,video})
-Set generic option for video stream.
+@item AVOptionVideo [@var{codec}:]@var{option} @var{value} 
(@emph{encoding,video})
+Set generic or private option for video stream.
+Private option must be prefixed with codec name or codec must be defined 
before.
 
 @item AVPresetVideo @var{preset} (@emph{encoding,video})
 Set preset for video stream.
diff --git a/ffserver_config.c b/ffserver_config.c
index ac89063..da5c85b 100644
--- a/ffserver_config.c
+++ b/ffserver_config.c
@@ -31,6 +31,11 @@
 #include cmdutils.h
 #include ffserver_config.h
 
+static int ffserver_save_avoption(AVCodecContext *ctx, const char *opt, const 
char *arg,
+  AVDictionary **dict, int type, 
FFServerConfig *config, int line_num);
+static void vreport_config_error(const char *filename, int line_num, int 
log_level, int *errors, const char *fmt, va_list vl);
+static void report_config_error(const char *filename, int line_num, int 
log_level, int *errors, const char *fmt, ...);
+
 /* FIXME: make ffserver work with IPv6 */
 /* resolve host with also IP address parsing */
 static int resolve_host(struct in_addr *sin_addr, const char *hostname)
@@ -246,36 +251,33 @@ static void add_codec(FFServerStream *stream, 
AVCodecContext *av)
 stream-streams[stream-nb_streams++] = st;
 }
 
-static enum AVCodecID opt_codec(const char *name, enum AVMediaType type)
-{
-AVCodec *codec = avcodec_find_encoder_by_name(name);
-
-if (!codec || codec-type != type)
-return AV_CODEC_ID_NONE;
-return codec-id;
-}
-
-static int ffserver_opt_default(const char *opt, const char *arg,
-   AVCodecContext *avctx, int type)
+static int ffserver_set_codec(AVCodecContext *ctx, const char *codec_name, 
FFServerConfig *config, int line_num)
 {
-int ret = 0;
-const AVOption *o = av_opt_find(avctx, opt, NULL, type, 0);
-if(o)
-ret = av_opt_set(avctx, opt, arg, 0);
-return ret;
+int ret;
+AVCodec *codec = avcodec_find_encoder_by_name(codec_name);
+if (!codec || codec-type != ctx-codec_type) {
+report_config_error(config-filename, line_num, AV_LOG_ERROR,
+config-errors, Invalid codec name: %s\n, 
codec_name);
+return 0;
+}
+if (ctx-codec_id == AV_CODEC_ID_NONE  !ctx-priv_data) {
+if ((ret = avcodec_get_context_defaults3(ctx, codec))  0)
+return ret;
+ctx-codec = codec;
+}
+if (ctx-codec_id != codec-id)
+report_config_error(config-filename, line_num, AV_LOG_ERROR, 
config-errors,
+Inconsistent configuration: trying to set %s 
codec option, but %s codec is used previously\n,
+codec_name, avcodec_get_name(ctx-codec_id));
+return 0;
 }
 
-static int ffserver_opt_preset(const char *arg,
-   AVCodecContext *avctx, int type,
-   enum AVCodecID *audio_id, enum AVCodecID *video_id)
+static int ffserver_opt_preset(const char *arg, AVCodecContext *avctx, 
FFServerConfig *config, int line_num)
 {
 FILE *f=NULL;
 char filename[1000], tmp[1000], tmp2[1000], line[1000];
 int ret = 0;
-AVCodec *codec = NULL;
-
-if (avctx)
-codec = avcodec_find_encoder(avctx-codec_id);
+AVCodec *codec = avcodec_find_encoder(avctx-codec_id);
 
 if 

[FFmpeg-devel] [PATCH 8/9] bavcodec/options_table: add pixel_format and video_size options

2014-11-10 Thread Lukasz Marek
Adding these options simplify ffm format implementation based on AVOption API.

Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
---
 libavcodec/options_table.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index beb767c..5dd0359 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -488,6 +488,8 @@ static const AVOption avcodec_options[] = {
 {bt, NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AV_FIELD_BT }, 0, 0, V|D|E, 
field_order },
 {dump_separator, set information dump field separator, 
OFFSET(dump_separator), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, 
A|V|S|D|E},
 {codec_whitelist, List of decoders that are allowed to be used, 
OFFSET(codec_whitelist), AV_OPT_TYPE_STRING, { .str = NULL },  CHAR_MIN, 
CHAR_MAX, A|V|S|D },
+{pixel_format, set pixel format, OFFSET(pix_fmt), AV_OPT_TYPE_PIXEL_FMT, 
{.i64=AV_PIX_FMT_NONE}, -1, INT_MAX, 0 },
+{video_size, set video size, OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, 
{.str=NULL}, 0, INT_MAX, 0 },
 {NULL},
 };
 
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 7/9] libavcodec/options_table: set min to -1 for timecode_frame_start

2014-11-10 Thread Lukasz Marek
timecode_frame_start is set to -1 in avcodec_get_context_defaults3()
AVOptions API complains about it.

Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
---
 libavcodec/options_table.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index b72fbb1..beb767c 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -398,7 +398,7 @@ static const AVOption avcodec_options[] = {
 {compression_level, NULL, OFFSET(compression_level), AV_OPT_TYPE_INT, {.i64 
= FF_COMPRESSION_DEFAULT }, INT_MIN, INT_MAX, V|A|E},
 {min_prediction_order, NULL, OFFSET(min_prediction_order), AV_OPT_TYPE_INT, 
{.i64 = -1 }, INT_MIN, INT_MAX, A|E},
 {max_prediction_order, NULL, OFFSET(max_prediction_order), AV_OPT_TYPE_INT, 
{.i64 = -1 }, INT_MIN, INT_MAX, A|E},
-{timecode_frame_start, GOP timecode frame start number, in non-drop-frame 
format, OFFSET(timecode_frame_start), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, 
INT64_MAX, V|E},
+{timecode_frame_start, GOP timecode frame start number, in non-drop-frame 
format, OFFSET(timecode_frame_start), AV_OPT_TYPE_INT64, {.i64 = 0 }, -1, 
INT64_MAX, V|E},
 #if FF_API_REQUEST_CHANNELS
 {request_channels, set desired number of audio channels, 
OFFSET(request_channels), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D},
 #endif
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 9/9] lavf/ffm: use AVOption API to store/restore stream properties

2014-11-10 Thread Lukasz Marek
This is a generic solution that will not reqiore modifications when new options 
are added.
This also fixes problem with current implementation when qmin or qmax=-1.
Only 8 bits was sent and read back as 255.

Fixes #1275
Fixes #1461

Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
---
 libavformat/ffmdec.c | 20 +++
 libavformat/ffmenc.c | 70 +++-
 2 files changed, 40 insertions(+), 50 deletions(-)

diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index bba3b36..a1b9e9b 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -380,6 +380,26 @@ static int ffm2_read_header(AVFormatContext *s)
 av_set_options_string(codec-priv_data, buffer, =, ,);
 av_freep(buffer);
 break;
+case MKBETAG('S', '2', 'V', 'I'):
+if (f_stvi++) {
+ret = AVERROR(EINVAL);
+goto fail;
+}
+buffer = av_malloc(size);
+avio_get_str(pb, INT_MAX, buffer, size);
+av_set_options_string(codec, buffer, =, ,);
+av_freep(buffer);
+break;
+case MKBETAG('S', '2', 'A', 'U'):
+if (f_stau++) {
+ret = AVERROR(EINVAL);
+goto fail;
+}
+buffer = av_malloc(size);
+avio_get_str(pb, INT_MAX, buffer, size);
+av_set_options_string(codec, buffer, =, ,);
+av_freep(buffer);
+break;
 }
 avio_seek(pb, next, SEEK_SET);
 }
diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c
index f307f8f..7c5debb 100644
--- a/libavformat/ffmenc.c
+++ b/libavformat/ffmenc.c
@@ -112,6 +112,22 @@ static int ffm_write_header_codec_private_ctx(AVIOContext 
*pb, void *priv_data,
 return 0;
 }
 
+static int ffm_write_header_codec_ctx(AVIOContext *pb, AVCodecContext *ctx, 
unsigned tag)
+{
+AVIOContext *tmp;
+char *buf = NULL;
+
+if (avio_open_dyn_buf(tmp)  0)
+return AVERROR(ENOMEM);
+/* Second parameter could be AV_OPT_FLAG_ENCODING_PARAM | 
AV_OPT_FLAG_AUDIO/VIDEO_PARAM,
+   but some required options don't have this flags. Skipping defaults 
should be enough. */
+av_opt_serialize(ctx, 0, 1, buf, '=', ',');
+avio_put_str(tmp, buf);
+write_header_chunk(pb, tmp, tag);
+av_free(buf);
+return 0;
+}
+
 static int ffm_write_header(AVFormatContext *s)
 {
 FFMContext *ffm = s-priv_data;
@@ -172,59 +188,13 @@ static int ffm_write_header(AVFormatContext *s)
 /* specific info */
 switch(codec-codec_type) {
 case AVMEDIA_TYPE_VIDEO:
-avio_wb32(pb, codec-time_base.num);
-avio_wb32(pb, codec-time_base.den);
-avio_wb16(pb, codec-width);
-avio_wb16(pb, codec-height);
-avio_wb16(pb, codec-gop_size);
-avio_wb32(pb, codec-pix_fmt);
-avio_w8(pb, codec-qmin);
-avio_w8(pb, codec-qmax);
-avio_w8(pb, codec-max_qdiff);
-avio_wb16(pb, (int) (codec-qcompress * 1.0));
-avio_wb16(pb, (int) (codec-qblur * 1.0));
-avio_wb32(pb, codec-bit_rate_tolerance);
-avio_put_str(pb, codec-rc_eq ? codec-rc_eq : tex^qComp);
-avio_wb32(pb, codec-rc_max_rate);
-avio_wb32(pb, codec-rc_min_rate);
-avio_wb32(pb, codec-rc_buffer_size);
-avio_wb64(pb, av_double2int(codec-i_quant_factor));
-avio_wb64(pb, av_double2int(codec-b_quant_factor));
-avio_wb64(pb, av_double2int(codec-i_quant_offset));
-avio_wb64(pb, av_double2int(codec-b_quant_offset));
-avio_wb32(pb, codec-dct_algo);
-avio_wb32(pb, codec-strict_std_compliance);
-avio_wb32(pb, codec-max_b_frames);
-avio_wb32(pb, codec-mpeg_quant);
-avio_wb32(pb, codec-intra_dc_precision);
-avio_wb32(pb, codec-me_method);
-avio_wb32(pb, codec-mb_decision);
-avio_wb32(pb, codec-nsse_weight);
-avio_wb32(pb, codec-frame_skip_cmp);
-avio_wb64(pb, av_double2int(codec-rc_buffer_aggressivity));
-avio_wb32(pb, codec-codec_tag);
-avio_w8(pb, codec-thread_count);
-avio_wb32(pb, codec-coder_type);
-avio_wb32(pb, codec-me_cmp);
-avio_wb32(pb, codec-me_subpel_quality);
-avio_wb32(pb, codec-me_range);
-avio_wb32(pb, codec-keyint_min);
-avio_wb32(pb, codec-scenechange_threshold);
-avio_wb32(pb, codec-b_frame_strategy);
-avio_wb64(pb, av_double2int(codec-qcompress));
-avio_wb64(pb, av_double2int(codec-qblur));
-avio_wb32(pb, codec-max_qdiff);
-avio_wb32(pb, codec-refs);
-write_header_chunk(s-pb, pb, MKBETAG('S', 'T', 'V', 'I'));
-if ((ret = ffm_write_header_codec_private_ctx(s-pb, 
codec-priv_data, 

Re: [FFmpeg-devel] [PATCH] Fixes for the Icecast protocol

2014-11-10 Thread Lukasz Marek
W dniu wtorek, 11 listopada 2014 Marvin Scholz epira...@gmail.com
napisał(a):

 Please ignore the patches I sent before ([PATCH 1/2] ffserver_config: drop
 requirement videosize being multiple of 16), git send-email did
 something unexpected and somehow picked the wrong ones… This mailing list
 stuff drives me crazy.


Ahh, that explains a bit. :)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel