[FFmpeg-devel] [PATCH] apng: Support inter-frame compression

2015-08-18 Thread Donny Yang
The current algorithm is just "try all the combinations, and pick the best".
It's not very fast either, probably due to a lot of copying, but will do for
an initial implementation.

Signed-off-by: Donny Yang 
---
 libavcodec/pngenc.c | 420 +++-
 1 file changed, 384 insertions(+), 36 deletions(-)

diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index af8ca4e..f6ad830 100644
--- a/libavcodec/pngenc.c
+++ b/libavcodec/pngenc.c
@@ -36,6 +36,14 @@
 
 #define IOBUF_SIZE 4096
 
+typedef struct APNGFctlChunk {
+uint32_t sequence_number;
+uint32_t width, height;
+uint32_t x_offset, y_offset;
+uint16_t delay_num, delay_den;
+uint8_t dispose_op, blend_op;
+} APNGFctlChunk;
+
 typedef struct PNGEncContext {
 AVClass *class;
 HuffYUVEncDSPContext hdsp;
@@ -59,6 +67,12 @@ typedef struct PNGEncContext {
 // APNG
 uint32_t palette_checksum;   // Used to ensure a single unique palette
 uint32_t sequence_number;
+
+AVFrame *prev_frame;
+AVFrame *last_frame;
+APNGFctlChunk last_frame_fctl;
+uint8_t *last_frame_packet;
+size_t last_frame_packet_size;
 } PNGEncContext;
 
 static void png_get_interlaced_row(uint8_t *dst, int row_size,
@@ -403,7 +417,7 @@ static int encode_frame(AVCodecContext *avctx, const 
AVFrame *pict)
 uint8_t *progressive_buf = NULL;
 uint8_t *top_buf = NULL;
 
-row_size = (avctx->width * s->bits_per_pixel + 7) >> 3;
+row_size = (pict->width * s->bits_per_pixel + 7) >> 3;
 
 crow_base = av_malloc((row_size + 32) << (s->filter_type == 
PNG_FILTER_VALUE_MIXED));
 if (!crow_base) {
@@ -430,16 +444,16 @@ static int encode_frame(AVCodecContext *avctx, const 
AVFrame *pict)
 for (pass = 0; pass < NB_PASSES; pass++) {
 /* NOTE: a pass is completely omitted if no pixels would be
  * output */
-pass_row_size = ff_png_pass_row_size(pass, s->bits_per_pixel, 
avctx->width);
+pass_row_size = ff_png_pass_row_size(pass, s->bits_per_pixel, 
pict->width);
 if (pass_row_size > 0) {
 top = NULL;
-for (y = 0; y < avctx->height; y++)
+for (y = 0; y < pict->height; y++)
 if ((ff_png_pass_ymask[pass] << (y & 7)) & 0x80) {
 ptr = p->data[0] + y * p->linesize[0];
 FFSWAP(uint8_t *, progressive_buf, top_buf);
 png_get_interlaced_row(progressive_buf, pass_row_size,
s->bits_per_pixel, pass,
-   ptr, avctx->width);
+   ptr, pict->width);
 crow = png_choose_filter(s, crow_buf, progressive_buf,
  top, pass_row_size, 
s->bits_per_pixel >> 3);
 png_write_row(avctx, crow, pass_row_size + 1);
@@ -449,7 +463,7 @@ static int encode_frame(AVCodecContext *avctx, const 
AVFrame *pict)
 }
 } else {
 top = NULL;
-for (y = 0; y < avctx->height; y++) {
+for (y = 0; y < pict->height; y++) {
 ptr = p->data[0] + y * p->linesize[0];
 crow = png_choose_filter(s, crow_buf, ptr, top,
  row_size, s->bits_per_pixel >> 3);
@@ -530,6 +544,272 @@ static int encode_png(AVCodecContext *avctx, AVPacket 
*pkt,
 return 0;
 }
 
+static int apng_do_inverse_blend(AVFrame *output, const AVFrame *input,
+  APNGFctlChunk *fctl_chunk, uint8_t bpp)
+{
+// output: background, input: foreground
+// output the image such that when blended with the background, will 
produce the foreground
+
+unsigned int x, y;
+unsigned int leftmost_x = input->width;
+unsigned int rightmost_x = 0;
+unsigned int topmost_y = input->height;
+unsigned int bottommost_y = 0;
+const uint8_t *input_data = input->data[0];
+uint8_t *output_data = output->data[0];
+ptrdiff_t input_linesize = input->linesize[0];
+ptrdiff_t output_linesize = output->linesize[0];
+
+// Find bounding box of changes
+for (y = 0; y < input->height; ++y) {
+for (x = 0; x < input->width; ++x) {
+if (!memcmp(input_data + bpp * x, output_data + bpp * x, bpp))
+continue;
+
+if (x < leftmost_x)
+leftmost_x = x;
+if (x >= rightmost_x)
+rightmost_x = x + 1;
+if (y < topmost_y)
+topmost_y = y;
+if (y >= bottommost_y)
+bottommost_y = y + 1;
+}
+
+input_data += input_linesize;
+output_data += output_linesize;
+}
+
+if (leftmost_x == input->width && rightmost_x == 0) {
+// Empty frame
+// APNG does not support empty frames, so we make it a 1x1 frame
+leftmost_x = topmost_y = 0;
+

[FFmpeg-devel] [PATCH] apng: Support inter-frame compression

2015-08-18 Thread Donny Yang
The current algorithm is just "try all the combinations, and pick the best".
It's not very fast either, probably due to a lot of copying, but will do for
an initial implementation.

Signed-off-by: Donny Yang 
---
 libavcodec/pngenc.c | 420 +++-
 1 file changed, 384 insertions(+), 36 deletions(-)

diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index af8ca4e..6e982c2 100644
--- a/libavcodec/pngenc.c
+++ b/libavcodec/pngenc.c
@@ -36,6 +36,14 @@
 
 #define IOBUF_SIZE 4096
 
+typedef struct APNGFctlChunk {
+uint32_t sequence_number;
+uint32_t width, height;
+uint32_t x_offset, y_offset;
+uint16_t delay_num, delay_den;
+uint8_t dispose_op, blend_op;
+} APNGFctlChunk;
+
 typedef struct PNGEncContext {
 AVClass *class;
 HuffYUVEncDSPContext hdsp;
@@ -59,6 +67,12 @@ typedef struct PNGEncContext {
 // APNG
 uint32_t palette_checksum;   // Used to ensure a single unique palette
 uint32_t sequence_number;
+
+AVFrame *prev_frame;
+AVFrame *last_frame;
+APNGFctlChunk last_frame_fctl;
+uint8_t *last_frame_packet;
+size_t last_frame_packet_size;
 } PNGEncContext;
 
 static void png_get_interlaced_row(uint8_t *dst, int row_size,
@@ -403,7 +417,7 @@ static int encode_frame(AVCodecContext *avctx, const 
AVFrame *pict)
 uint8_t *progressive_buf = NULL;
 uint8_t *top_buf = NULL;
 
-row_size = (avctx->width * s->bits_per_pixel + 7) >> 3;
+row_size = (pict->width * s->bits_per_pixel + 7) >> 3;
 
 crow_base = av_malloc((row_size + 32) << (s->filter_type == 
PNG_FILTER_VALUE_MIXED));
 if (!crow_base) {
@@ -430,16 +444,16 @@ static int encode_frame(AVCodecContext *avctx, const 
AVFrame *pict)
 for (pass = 0; pass < NB_PASSES; pass++) {
 /* NOTE: a pass is completely omitted if no pixels would be
  * output */
-pass_row_size = ff_png_pass_row_size(pass, s->bits_per_pixel, 
avctx->width);
+pass_row_size = ff_png_pass_row_size(pass, s->bits_per_pixel, 
pict->width);
 if (pass_row_size > 0) {
 top = NULL;
-for (y = 0; y < avctx->height; y++)
+for (y = 0; y < pict->height; y++)
 if ((ff_png_pass_ymask[pass] << (y & 7)) & 0x80) {
 ptr = p->data[0] + y * p->linesize[0];
 FFSWAP(uint8_t *, progressive_buf, top_buf);
 png_get_interlaced_row(progressive_buf, pass_row_size,
s->bits_per_pixel, pass,
-   ptr, avctx->width);
+   ptr, pict->width);
 crow = png_choose_filter(s, crow_buf, progressive_buf,
  top, pass_row_size, 
s->bits_per_pixel >> 3);
 png_write_row(avctx, crow, pass_row_size + 1);
@@ -449,7 +463,7 @@ static int encode_frame(AVCodecContext *avctx, const 
AVFrame *pict)
 }
 } else {
 top = NULL;
-for (y = 0; y < avctx->height; y++) {
+for (y = 0; y < pict->height; y++) {
 ptr = p->data[0] + y * p->linesize[0];
 crow = png_choose_filter(s, crow_buf, ptr, top,
  row_size, s->bits_per_pixel >> 3);
@@ -530,6 +544,272 @@ static int encode_png(AVCodecContext *avctx, AVPacket 
*pkt,
 return 0;
 }
 
+static int apng_do_inverse_blend(AVFrame *output, const AVFrame *input,
+  APNGFctlChunk *fctl_chunk, uint8_t bpp)
+{
+// output: background, input: foreground
+// output the image such that when blended with the background, will 
produce the foreground
+
+unsigned int x, y;
+unsigned int leftmost_x = input->width;
+unsigned int rightmost_x = 0;
+unsigned int topmost_y = input->height;
+unsigned int bottommost_y = 0;
+const uint8_t *input_data = input->data[0];
+uint8_t *output_data = output->data[0];
+size_t input_linesize = input->linesize[0];
+size_t output_linesize = output->linesize[0];
+
+// Find bounding box of changes
+for (y = 0; y < input->height; ++y) {
+for (x = 0; x < input->width; ++x) {
+if (!memcmp(input_data + bpp * x, output_data + bpp * x, bpp))
+continue;
+
+if (x < leftmost_x)
+leftmost_x = x;
+if (x >= rightmost_x)
+rightmost_x = x + 1;
+if (y < topmost_y)
+topmost_y = y;
+if (y >= bottommost_y)
+bottommost_y = y + 1;
+}
+
+input_data += input_linesize;
+output_data += output_linesize;
+}
+
+if (leftmost_x == input->width && rightmost_x == 0) {
+// Empty frame
+// APNG does not support empty frames, so we make it a 1x1 frame
+leftmost_x = topmost_y = 0;
+ri

Re: [FFmpeg-devel] [PATCH] doc/indevs: add various missing options

2015-08-18 Thread Thilo Borgmann
Am 19.08.15 um 03:46 schrieb Lou Logan:
> Signed-off-by: Lou Logan 
> ---
>  doc/indevs.texi | 161 
> +++-
>  1 file changed, 160 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/indevs.texi b/doc/indevs.texi
> index 6f47504..9c81b82 100644
> --- a/doc/indevs.texi
> +++ b/doc/indevs.texi
[...]
>  @section avfoundation
>  
>  AVFoundation input device.
> @@ -114,6 +126,19 @@ und the first one in this list is used instead. 
> Available pixel formats are:
>   bgr48be, uyvy422, yuva444p, yuva444p16le, yuv444p, yuv422p16, yuv422p10, 
> yuv444p10,
>   yuv420p, nv12, yuyv422, gray}
>  
> +@item -framerate
> +Set grabbing frame rate. Default is @code{ntsc}, corresponding to a
> +frame rate of @code{3/1001}.
> +
> +@item -video_size
> +Set the video frame size.
> +
> +@item -capture_cursor
> +Capture the mouse pointer. Default is 0.
> +
> +@item -capture_mouse_clicks
> +Capture the screen mouse clicks. Default is 0.
> +

thanks!

-Thilo

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


Re: [FFmpeg-devel] GSoC Weekly report (libswscale)

2015-08-18 Thread Pedro Arthur
Added copyright.
I've tried to push it (git push ffmpeg master --dry-run) but got the
following error:
fatal: remote error: access denied or repository not exported: /ffmpeg.git
with remote:
ffmpeggit+ssh://source.ffmpeg.org/ffmpeg.git (fetch)
ffmpeggit+ssh://source.ffmpeg.org/ffmpeg.git (push)

is it correct?
Anyway I'm attaching the patch.



2015-08-18 22:48 GMT-03:00 James Almer :

> On 18/08/15 6:30 PM, Pedro Arthur wrote:
> > diff --git a/libswscale/vscale.c b/libswscale/vscale.c
> > new file mode 100644
> > index 000..b62b385
> > --- /dev/null
> > +++ b/libswscale/vscale.c
> > @@ -0,0 +1,268 @@
> > +#include "swscale_internal.h"
> > +
> > +static int lum_planar_vscale(SwsContext *c, SwsFilterDescriptor *desc,
> int sliceY, int sliceH)
>
> Please add a copyright header before pushing.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
From deedf31c05dee4896a867b45790ded94c173a959 Mon Sep 17 00:00:00 2001
From: Pedro Arthur 
Date: Tue, 18 Aug 2015 11:47:55 -0300
Subject: [PATCH] swscale: refactor vertical scaler

---
 libswscale/Makefile   |   1 +
 libswscale/slice.c|  20 ++-
 libswscale/swscale.c  |  88 +++--
 libswscale/swscale_internal.h |  20 ++-
 libswscale/vscale.c   | 287 ++
 libswscale/x86/swscale.c  |   6 +-
 6 files changed, 380 insertions(+), 42 deletions(-)
 create mode 100644 libswscale/vscale.c

diff --git a/libswscale/Makefile b/libswscale/Makefile
index b2b6381..e70e358 100644
--- a/libswscale/Makefile
+++ b/libswscale/Makefile
@@ -17,6 +17,7 @@ OBJS = alphablend.o \
yuv2rgb.o\
slice.o  \
hscale.o \
+   vscale.o \
 
 OBJS-$(CONFIG_SHARED)+= log2_tab.o
 
diff --git a/libswscale/slice.c b/libswscale/slice.c
index 611e4e6..8fd16d3 100644
--- a/libswscale/slice.c
+++ b/libswscale/slice.c
@@ -214,6 +214,7 @@ int ff_init_filters(SwsContext * c)
 int index;
 int num_ydesc;
 int num_cdesc;
+int num_vdesc = isPlanarYUV(c->dstFormat) && !isGray(c->dstFormat) ? 2 : 1;
 int need_lum_conv = c->lumToYV12 || c->readLumPlanar || c->alpToYV12 || c->readAlpPlanar;
 int need_chr_conv = c->chrToYV12 || c->readChrPlanar;
 int srcIdx, dstIdx;
@@ -228,8 +229,8 @@ int ff_init_filters(SwsContext * c)
 num_ydesc = need_lum_conv ? 2 : 1;
 num_cdesc = need_chr_conv ? 2 : 1;
 
-c->numSlice = FFMAX(num_ydesc, num_cdesc) + 1;
-c->numDesc = num_ydesc + num_cdesc;
+c->numSlice = FFMAX(num_ydesc, num_cdesc) + 2;
+c->numDesc = num_ydesc + num_cdesc + num_vdesc;
 c->descIndex[0] = num_ydesc;
 c->descIndex[1] = num_ydesc + num_cdesc;
 
@@ -243,12 +244,13 @@ int ff_init_filters(SwsContext * c)
 
 res = alloc_slice(&c->slice[0], c->srcFormat, c->srcH, c->chrSrcH, c->chrSrcHSubSample, c->chrSrcVSubSample, 0);
 if (res < 0) goto cleanup;
-for (i = 1; i < c->numSlice-1; ++i) {
+for (i = 1; i < c->numSlice-2; ++i) {
 res = alloc_slice(&c->slice[i], c->srcFormat, c->vLumFilterSize + MAX_LINES_AHEAD, c->vChrFilterSize + MAX_LINES_AHEAD, c->chrSrcHSubSample, c->chrSrcVSubSample, 0);
 if (res < 0) goto cleanup;
 res = alloc_lines(&c->slice[i], FFALIGN(c->srcW*2+78, 16), c->srcW);
 if (res < 0) goto cleanup;
 }
+// horizontal scaler output
 res = alloc_slice(&c->slice[i], c->srcFormat, c->vLumFilterSize + MAX_LINES_AHEAD, c->vChrFilterSize + MAX_LINES_AHEAD, c->chrDstHSubSample, c->chrDstVSubSample, 1);
 if (res < 0) goto cleanup;
 res = alloc_lines(&c->slice[i], dst_stride, c->dstW);
@@ -256,6 +258,11 @@ int ff_init_filters(SwsContext * c)
 
 fill_ones(&c->slice[i], dst_stride>>1, c->dstBpc == 16);
 
+// vertical scaler output
+++i;
+res = alloc_slice(&c->slice[i], c->dstFormat, c->dstH, c->chrDstH, c->chrDstHSubSample, c->chrDstVSubSample, 0);
+if (res < 0) goto cleanup;
+
 index = 0;
 srcIdx = 0;
 dstIdx = 1;
@@ -290,6 +297,13 @@ int ff_init_filters(SwsContext * c)
 ff_init_desc_no_chr(&c->desc[index], &c->slice[srcIdx], &c->slice[dstIdx]);
 }
 
+++index;
+{
+srcIdx = c->numSlice - 2;
+dstIdx = c->numSlice - 1;
+ff_init_vscale(c, c->desc + index, c->slice + srcIdx, c->slice + dstIdx);
+}
+
 return 0;
 
 cleanup:
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 03019d4..d87efda 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -326,8 +326,8 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 #endif
 const int dstW   = c->dstW;
 const int dstH   = c->dstH;
-const int chrDstW= c->chrDstW;
 #ifndef 

Re: [FFmpeg-devel] [PATCH] doc/indevs: add various missing options

2015-08-18 Thread Ganesh Ajjanagadde
On Tue, Aug 18, 2015 at 9:46 PM, Lou Logan  wrote:
> Signed-off-by: Lou Logan 
> ---
>  doc/indevs.texi | 161 
> +++-
>  1 file changed, 160 insertions(+), 1 deletion(-)
>
> diff --git a/doc/indevs.texi b/doc/indevs.texi
> index 6f47504..9c81b82 100644
> --- a/doc/indevs.texi
> +++ b/doc/indevs.texi
> @@ -51,6 +51,18 @@ ffmpeg -f alsa -i hw:0 alsaout.wav
>  For more information see:
>  @url{http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html}
>
> +@subsection Options
> +
> +@table @option
> +
> +@item sample_rate
> +Set the sample rate in Hz. Default is 48000.
> +
> +@item channels
> +Set the number of channels. Default is 2.
> +
> +@end table
> +
>  @section avfoundation
>
>  AVFoundation input device.
> @@ -114,6 +126,19 @@ und the first one in this list is used instead. 
> Available pixel formats are:
>   bgr48be, uyvy422, yuva444p, yuva444p16le, yuv444p, yuv422p16, yuv422p10, 
> yuv444p10,
>   yuv420p, nv12, yuyv422, gray}
>
> +@item -framerate
> +Set grabbing frame rate. Default is @code{ntsc}, corresponding to a
> +frame rate of @code{3/1001}.

minor nit on article usage: set grabbing frame rate -> set the
grabbing frame rate.
I mention this since it is mostly correct and helps consistency.

> +
> +@item -video_size
> +Set the video frame size.
> +
> +@item -capture_cursor
> +Capture the mouse pointer. Default is 0.
> +
> +@item -capture_mouse_clicks
> +Capture the screen mouse clicks. Default is 0.
> +
>  @end table
>
>  @subsection Examples
> @@ -150,6 +175,36 @@ $ ffmpeg -f avfoundation -pixel_format bgr0 -i 
> "default:none" out.avi
>
>  BSD video input device.
>
> +@subsection Options
> +
> +@table @option
> +
> +@item framerate
> +Set the frame rate.
> +
> +@item video_size
> +Set the video frame size. Default is @code{vga}.
> +
> +@item standard
> +
> +Available values are:
> +@table @samp
> +@item pal
> +
> +@item ntsc
> +
> +@item secam
> +
> +@item paln
> +
> +@item palm
> +
> +@item ntscj
> +
> +@end table
> +
> +@end table
> +
>  @section decklink
>
>  The decklink input device provides capture capabilities for Blackmagic
> @@ -429,6 +484,27 @@ $ ffmpeg -f dshow -show_video_device_dialog true 
> -crossbar_video_input_pin_numbe
>
>  Linux DV 1394 input device.
>
> +@subsection Options
> +
> +@table @option
> +
> +@item framerate
> +Set the frame rate. Default is 25.
> +
> +@item standard
> +
> +Available values are:
> +@table @samp
> +@item pal
> +
> +@item ntsc
> +
> +@end table
> +
> +Default value is @code{ntsc}.
> +
> +@end table
> +
>  @section fbdev
>
>  Linux framebuffer input device.
> @@ -441,6 +517,8 @@ console. It is accessed through a file device node, 
> usually
>  For more detailed information read the file
>  Documentation/fb/framebuffer.txt included in the Linux source tree.
>
> +See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).

Sourceforge has run into trouble with ad blockers/malware heuristics
due to the crapware that comes
loaded on a bunch of stuff there:
https://news.ycombinator.com/item?id=9738305
Ideally one would like a non Sourceforge link, but I can't find a
better link for this purpose.
Thus it is fine with me unless someone can find a better link.

> +
>  To record from the framebuffer device @file{/dev/fb0} with
>  @command{ffmpeg}:
>  @example
> @@ -452,7 +530,14 @@ You can take a single screenshot image with the command:
>  ffmpeg -f fbdev -framerate 1 -i /dev/fb0 -frames:v 1 screenshot.jpeg
>  @end example
>
> -See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).
> +@subsection Options
> +
> +@table @option
> +
> +@item framerate
> +Set the frame rate. Default is 25.
> +
> +@end table
>
>  @section gdigrab
>
> @@ -638,6 +723,15 @@ $ jack_connect metro:120_bpm ffmpeg:input_1
>  For more information read:
>  @url{http://jackaudio.org/}
>
> +@subsection Options
> +
> +@table @option
> +
> +@item channels
> +Set number of channels. Default is 2.

minor nit on article usage: Set number of channels -> Set the number of channels

> +
> +@end table
> +
>  @section lavfi
>
>  Libavfilter input virtual device.
> @@ -678,6 +772,9 @@ Set the filename of the filtergraph to be read and sent 
> to the other
>  filters. Syntax of the filtergraph is the same as the one specified by
>  the option @var{graph}.
>
> +@item dumpgraph
> +Dump graph to stderr.
> +
>  @end table
>
>  @subsection Examples
> @@ -879,6 +976,19 @@ ffmpeg -f oss -i /dev/dsp /tmp/oss.wav
>  For more information about OSS see:
>  @url{http://manuals.opensound.com/usersguide/dsp.html}
>
> +@subsection Options
> +
> +@table @option
> +
> +@item sample_rate
> +Set the sample rate in Hz. Default is 48000.
> +
> +@item channels
> +Set the number of channels. Default is 2.
> +
> +@end table
> +
> +
>  @section pulse
>
>  PulseAudio input device.
> @@ -919,6 +1029,10 @@ Specify the number of bytes per frame, by default it is 
> set to 1024.
>  @item fragment_size
>  Specify the minimal buffering fragment in PulseAudio, it wi

Re: [FFmpeg-devel] GSoC Weekly report (libswscale)

2015-08-18 Thread James Almer
On 18/08/15 6:30 PM, Pedro Arthur wrote:
> diff --git a/libswscale/vscale.c b/libswscale/vscale.c
> new file mode 100644
> index 000..b62b385
> --- /dev/null
> +++ b/libswscale/vscale.c
> @@ -0,0 +1,268 @@
> +#include "swscale_internal.h"
> +
> +static int lum_planar_vscale(SwsContext *c, SwsFilterDescriptor *desc, int 
> sliceY, int sliceH)

Please add a copyright header before pushing.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] doc/indevs: add various missing options

2015-08-18 Thread Lou Logan
Signed-off-by: Lou Logan 
---
 doc/indevs.texi | 161 +++-
 1 file changed, 160 insertions(+), 1 deletion(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index 6f47504..9c81b82 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -51,6 +51,18 @@ ffmpeg -f alsa -i hw:0 alsaout.wav
 For more information see:
 @url{http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html}
 
+@subsection Options
+
+@table @option
+
+@item sample_rate
+Set the sample rate in Hz. Default is 48000.
+
+@item channels
+Set the number of channels. Default is 2.
+
+@end table
+
 @section avfoundation
 
 AVFoundation input device.
@@ -114,6 +126,19 @@ und the first one in this list is used instead. Available 
pixel formats are:
  bgr48be, uyvy422, yuva444p, yuva444p16le, yuv444p, yuv422p16, yuv422p10, 
yuv444p10,
  yuv420p, nv12, yuyv422, gray}
 
+@item -framerate
+Set grabbing frame rate. Default is @code{ntsc}, corresponding to a
+frame rate of @code{3/1001}.
+
+@item -video_size
+Set the video frame size.
+
+@item -capture_cursor
+Capture the mouse pointer. Default is 0.
+
+@item -capture_mouse_clicks
+Capture the screen mouse clicks. Default is 0.
+
 @end table
 
 @subsection Examples
@@ -150,6 +175,36 @@ $ ffmpeg -f avfoundation -pixel_format bgr0 -i 
"default:none" out.avi
 
 BSD video input device.
 
+@subsection Options
+
+@table @option
+
+@item framerate
+Set the frame rate.
+
+@item video_size
+Set the video frame size. Default is @code{vga}.
+
+@item standard
+
+Available values are:
+@table @samp
+@item pal
+
+@item ntsc
+
+@item secam
+
+@item paln
+
+@item palm
+
+@item ntscj
+
+@end table
+
+@end table
+
 @section decklink
 
 The decklink input device provides capture capabilities for Blackmagic
@@ -429,6 +484,27 @@ $ ffmpeg -f dshow -show_video_device_dialog true 
-crossbar_video_input_pin_numbe
 
 Linux DV 1394 input device.
 
+@subsection Options
+
+@table @option
+
+@item framerate
+Set the frame rate. Default is 25.
+
+@item standard
+
+Available values are:
+@table @samp
+@item pal
+
+@item ntsc
+
+@end table
+
+Default value is @code{ntsc}.
+
+@end table
+
 @section fbdev
 
 Linux framebuffer input device.
@@ -441,6 +517,8 @@ console. It is accessed through a file device node, usually
 For more detailed information read the file
 Documentation/fb/framebuffer.txt included in the Linux source tree.
 
+See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).
+
 To record from the framebuffer device @file{/dev/fb0} with
 @command{ffmpeg}:
 @example
@@ -452,7 +530,14 @@ You can take a single screenshot image with the command:
 ffmpeg -f fbdev -framerate 1 -i /dev/fb0 -frames:v 1 screenshot.jpeg
 @end example
 
-See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).
+@subsection Options
+
+@table @option
+
+@item framerate
+Set the frame rate. Default is 25.
+
+@end table
 
 @section gdigrab
 
@@ -638,6 +723,15 @@ $ jack_connect metro:120_bpm ffmpeg:input_1
 For more information read:
 @url{http://jackaudio.org/}
 
+@subsection Options
+
+@table @option
+
+@item channels
+Set number of channels. Default is 2.
+
+@end table
+
 @section lavfi
 
 Libavfilter input virtual device.
@@ -678,6 +772,9 @@ Set the filename of the filtergraph to be read and sent to 
the other
 filters. Syntax of the filtergraph is the same as the one specified by
 the option @var{graph}.
 
+@item dumpgraph
+Dump graph to stderr.
+
 @end table
 
 @subsection Examples
@@ -879,6 +976,19 @@ ffmpeg -f oss -i /dev/dsp /tmp/oss.wav
 For more information about OSS see:
 @url{http://manuals.opensound.com/usersguide/dsp.html}
 
+@subsection Options
+
+@table @option
+
+@item sample_rate
+Set the sample rate in Hz. Default is 48000.
+
+@item channels
+Set the number of channels. Default is 2.
+
+@end table
+
+
 @section pulse
 
 PulseAudio input device.
@@ -919,6 +1029,10 @@ Specify the number of bytes per frame, by default it is 
set to 1024.
 @item fragment_size
 Specify the minimal buffering fragment in PulseAudio, it will affect the
 audio latency. By default it is unset.
+
+@item wallclock
+Set the initial PTS using the current time. Default is 1.
+
 @end table
 
 @subsection Examples
@@ -954,6 +1068,22 @@ ffmpeg -f qtkit -i "default" out.mpg
 ffmpeg -f qtkit -list_devices true -i ""
 @end example
 
+@subsection Options
+
+@table @option
+
+@item frame_rate
+Set frame rate. Default is 30.
+
+@item list_devices
+If set to @code{true}, print a list of devices and exit. Default is
+@code{false}.
+
+@item video_device_index
+Select video device by index for devices with same name (starts at 0).
+
+@end table
+
 @section sndio
 
 sndio input device.
@@ -971,6 +1101,18 @@ command:
 ffmpeg -f sndio -i /dev/audio0 /tmp/oss.wav
 @end example
 
+@subsection Options
+
+@table @option
+
+@item sample_rate
+Set the sample rate in Hz. Default is 48000.
+
+@item channels
+Set the number of channels. Default is 2.
+
+@end table
+
 @section video4linux2, v4l2
 
 Video4Linux2 input video devic

Re: [FFmpeg-devel] GSoC Weekly report (libswscale)

2015-08-18 Thread Michael Niedermayer
On Tue, Aug 18, 2015 at 06:30:28PM -0300, Pedro Arthur wrote:
> Patch with alpha fixed.
> 
> 2015-08-18 18:07 GMT-03:00 Michael Niedermayer :
> 
> > On Tue, Aug 18, 2015 at 04:27:42PM -0300, Pedro Arthur wrote:
> > > Attached patch with new vertical scaler code, added license and fixed
> > > compiler warnings.
> >
> >
> > split and applied first patch, had to change 2 asserts to make it work
> > without the vscale code
> >
> > [...]
> >
> > --
> > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >
> > Republics decline into democracies and democracies degenerate into
> > despotisms. -- Aristotle
> >
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> >

>  Makefile   |1 
>  slice.c|   20 +++
>  swscale.c  |   88 ++---
>  swscale_internal.h |   20 +++
>  vscale.c   |  268 
> +
>  x86/swscale.c  |6 -
>  6 files changed, 361 insertions(+), 42 deletions(-)
> a9980f543258376a8e333cdcc68115157db73bff  vscale.patch
> From 01e23c1b2302d9e4627a0ac872203f76d31a0492 Mon Sep 17 00:00:00 2001
> From: Pedro Arthur 
> Date: Tue, 18 Aug 2015 11:47:55 -0300
> Subject: [PATCH] swscale: refactor vertical scaler

patch looks good to me
feel free to push unless you prefer that i apply/push it

thanks
[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH] lavfi: fix compilation with FF_API_OLD_FILTER_OPTS=0.

2015-08-18 Thread James Almer
On 16/08/15 11:26 PM, Ronald S. Bultje wrote:
> ---
>  ffmpeg_filter.c | 2 +-
>  libavfilter/avfilter.c  | 3 ++-
>  libavfilter/vf_aspect.c | 2 +-
>  3 files changed, 4 insertions(+), 3 deletions(-)
> 

LGTM

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


Re: [FFmpeg-devel] [PATCH]Postpone vdpau removal

2015-08-18 Thread Philip Langdale

On 2015-08-18 15:59, Andreas Cadhalpun wrote:

On 18.08.2015 23:15, Philip Langdale wrote:

On 2015-08-18 14:05, Carl Eugen Hoyos wrote:

Ronald S. Bultje  gmail.com> writes:


> Attached patch postpones the vdpau removal.
> The decoders were only deprecated today, so give
> users time until the next version bump.

No.


Then please revert a383f226
I am listed as vdpau maintainer and I object to the patch.


Do we have any known applications that still use the old API.
Even mplayer, of all things, uses the new API.


I'm not exactly sure what you meant here, but FF_API_VDPAU
is mainly about the (AV_)PIX_FMT_VDPAU_* pixel formats, which
mplayer is still using, e.g. [1].


mplayer contains code that handles these formats, but by using the new
API, it will never actually see content on those formats. This is now
dead code in mplayer.

I can't speak for the other applications.


There are also libavg [2], mlt [3] and handbrake [4].

Considering also FF_API_CAP_VDPAU there is additionally 
gmerlin-avdecoder [5].

And mplayer is also using this API [6].

Best regards,
Andreas


1:
https://sources.debian.net/src/mplayer/2:1.1.1%2Bsvn37434-1/libmpcodecs/vd_ffmpeg.c/?hl=1133#L1133
2:
https://sources.debian.net/src/libavg/1.8.1-1/src/video/VDPAUDecoder.cpp/?hl=214#L214
3:
https://sources.debian.net/src/mlt/0.9.8-1/src/modules/avformat/vdpau.c/?hl=243#L243
4:
https://sources.debian.net/src/handbrake/0.10.2%2Bds1-1/libhb/vadxva2.c/?hl=696#L696
5:
https://sources.debian.net/src/gmerlin-avdecoder/1.2.0~dfsg-5/lib/video_ffmpeg.c/?hl=260#L260
6:
https://sources.debian.net/src/mplayer/2:1.1.1%2Bsvn37434-1/libvo/vo_vdpau.c/?hl=177#L177
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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


Re: [FFmpeg-devel] [PATCH]Postpone vdpau removal

2015-08-18 Thread Andreas Cadhalpun
On 18.08.2015 23:15, Philip Langdale wrote:
> On 2015-08-18 14:05, Carl Eugen Hoyos wrote:
>> Ronald S. Bultje  gmail.com> writes:
>>
>>> > Attached patch postpones the vdpau removal.
>>> > The decoders were only deprecated today, so give
>>> > users time until the next version bump.
>>>
>>> No.
>>
>> Then please revert a383f226
>> I am listed as vdpau maintainer and I object to the patch.
> 
> Do we have any known applications that still use the old API.
> Even mplayer, of all things, uses the new API.

I'm not exactly sure what you meant here, but FF_API_VDPAU
is mainly about the (AV_)PIX_FMT_VDPAU_* pixel formats, which
mplayer is still using, e.g. [1].
There are also libavg [2], mlt [3] and handbrake [4].

Considering also FF_API_CAP_VDPAU there is additionally gmerlin-avdecoder [5].
And mplayer is also using this API [6].

Best regards,
Andreas


1: 
https://sources.debian.net/src/mplayer/2:1.1.1%2Bsvn37434-1/libmpcodecs/vd_ffmpeg.c/?hl=1133#L1133
2: 
https://sources.debian.net/src/libavg/1.8.1-1/src/video/VDPAUDecoder.cpp/?hl=214#L214
3: 
https://sources.debian.net/src/mlt/0.9.8-1/src/modules/avformat/vdpau.c/?hl=243#L243
4: 
https://sources.debian.net/src/handbrake/0.10.2%2Bds1-1/libhb/vadxva2.c/?hl=696#L696
5: 
https://sources.debian.net/src/gmerlin-avdecoder/1.2.0~dfsg-5/lib/video_ffmpeg.c/?hl=260#L260
6: 
https://sources.debian.net/src/mplayer/2:1.1.1%2Bsvn37434-1/libvo/vo_vdpau.c/?hl=177#L177
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/5] vaapi: define a single pixel format for VA-API (AV_PIX_FMT_VAAPI).

2015-08-18 Thread wm4
On Wed, 19 Aug 2015 00:02:52 +0200
Andreas Cadhalpun  wrote:

> On 18.08.2015 17:26, Gwenole Beauchesne wrote:
> > Deprecate older VA pixel formats (MOCO, IDCT) as it is now very unlikely
> > to ever be useful in the future. Only keep plain AV_PIX_FMT_VAAPI format
> > that is aliased to the older VLD variant.
> > 
> > Signed-off-by: Gwenole Beauchesne 
> > ---
> >  libavcodec/h263dec.c |  2 +-
> >  libavcodec/h264_slice.c  |  2 +-
> >  libavcodec/mpeg12dec.c   |  2 +-
> >  libavcodec/vaapi_h264.c  |  2 +-
> >  libavcodec/vaapi_mpeg2.c |  2 +-
> >  libavcodec/vaapi_mpeg4.c |  4 ++--
> >  libavcodec/vaapi_vc1.c   |  4 ++--
> >  libavcodec/vc1dec.c  |  2 +-
> >  libavutil/pixdesc.c  |  9 +
> >  libavutil/pixfmt.h   | 12 
> >  libavutil/version.h  |  3 +++
> >  11 files changed, 34 insertions(+), 10 deletions(-)
> > 
> [...]
> > --- a/libavutil/version.h
> > +++ b/libavutil/version.h
> > @@ -107,6 +107,9 @@
> >  #ifndef FF_API_AVFRAME_LAVC
> >  #define FF_API_AVFRAME_LAVC (LIBAVUTIL_VERSION_MAJOR < 55)
> >  #endif
> > +#ifndef FF_API_VAAPI
> > +#define FF_API_VAAPI(LIBAVUTIL_VERSION_MAJOR < 55)
> > +#endif
> 
> I think the deprecation should be at least in one release before it is 
> removed.
> Hence using '< 56' would be better.
> Also mentioning this change in doc/APIchanges would be good.
> 
> The same goes for FF_API_VAAPI_CONTEXT from the second patch.
> 
> Best regards,
> Andreas

I concur that a deprecation (still working) and its replacement should
at least be in 1 release.

In this case the author was probably not aware that the next major bump
will happen soon.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]Postpone vdpau removal

2015-08-18 Thread wm4
On Tue, 18 Aug 2015 18:04:22 -0400
compn  wrote:

> On Tue, 18 Aug 2015 23:36:12 +0200
> wm4  wrote:
> 
> > On Tue, 18 Aug 2015 21:05:44 + (UTC)
> > Carl Eugen Hoyos  wrote:
> > 
> > > Ronald S. Bultje  gmail.com> writes:
> > > 
> > > > > Attached patch postpones the vdpau removal.
> > > > > The decoders were only deprecated today, so give 
> > > > > users time until the next version bump.
> > > > 
> > > > No.
> > > 
> > > Then please revert a383f226
> > > I am listed as vdpau maintainer and I object to the patch.
> > 
> > Why?
> > 
> > Also, the maintainer list means absolutely nothing.
> 
> ffmpeg maintainers file means a lot, please read ffmpeg developer
> policy/rules docs:
> http://ffmpeg.org/developer.html
> 
> (well probably you do not care about the rules anyway, but feel free to
> propose to rm maintainers, then we can vote on it! yay voting)

Oh, I do. Such as the rule that deprecated stuff will eventually be
deleted.

Why has the maintainer not been aware that his code was deprecated for
years?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]Postpone vdpau removal

2015-08-18 Thread compn
On Tue, 18 Aug 2015 23:36:12 +0200
wm4  wrote:

> On Tue, 18 Aug 2015 21:05:44 + (UTC)
> Carl Eugen Hoyos  wrote:
> 
> > Ronald S. Bultje  gmail.com> writes:
> > 
> > > > Attached patch postpones the vdpau removal.
> > > > The decoders were only deprecated today, so give 
> > > > users time until the next version bump.
> > > 
> > > No.
> > 
> > Then please revert a383f226
> > I am listed as vdpau maintainer and I object to the patch.
> 
> Why?
> 
> Also, the maintainer list means absolutely nothing.

ffmpeg maintainers file means a lot, please read ffmpeg developer
policy/rules docs:
http://ffmpeg.org/developer.html

(well probably you do not care about the rules anyway, but feel free to
propose to rm maintainers, then we can vote on it! yay voting)

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


Re: [FFmpeg-devel] [PATCH 1/5] vaapi: define a single pixel format for VA-API (AV_PIX_FMT_VAAPI).

2015-08-18 Thread Andreas Cadhalpun
On 18.08.2015 17:26, Gwenole Beauchesne wrote:
> Deprecate older VA pixel formats (MOCO, IDCT) as it is now very unlikely
> to ever be useful in the future. Only keep plain AV_PIX_FMT_VAAPI format
> that is aliased to the older VLD variant.
> 
> Signed-off-by: Gwenole Beauchesne 
> ---
>  libavcodec/h263dec.c |  2 +-
>  libavcodec/h264_slice.c  |  2 +-
>  libavcodec/mpeg12dec.c   |  2 +-
>  libavcodec/vaapi_h264.c  |  2 +-
>  libavcodec/vaapi_mpeg2.c |  2 +-
>  libavcodec/vaapi_mpeg4.c |  4 ++--
>  libavcodec/vaapi_vc1.c   |  4 ++--
>  libavcodec/vc1dec.c  |  2 +-
>  libavutil/pixdesc.c  |  9 +
>  libavutil/pixfmt.h   | 12 
>  libavutil/version.h  |  3 +++
>  11 files changed, 34 insertions(+), 10 deletions(-)
> 
[...]
> --- a/libavutil/version.h
> +++ b/libavutil/version.h
> @@ -107,6 +107,9 @@
>  #ifndef FF_API_AVFRAME_LAVC
>  #define FF_API_AVFRAME_LAVC (LIBAVUTIL_VERSION_MAJOR < 55)
>  #endif
> +#ifndef FF_API_VAAPI
> +#define FF_API_VAAPI(LIBAVUTIL_VERSION_MAJOR < 55)
> +#endif

I think the deprecation should be at least in one release before it is removed.
Hence using '< 56' would be better.
Also mentioning this change in doc/APIchanges would be good.

The same goes for FF_API_VAAPI_CONTEXT from the second patch.

Best regards,
Andreas

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


Re: [FFmpeg-devel] [PATCH] */version.h: Add note/recommandition about bumping major

2015-08-18 Thread Andreas Cadhalpun
On 18.08.2015 12:28, Michael Niedermayer wrote:
> From: Michael Niedermayer 
> 
> If preferred, i can also apply this after the bump, in case its felt that
> this would cause too much delay/work
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/version.h  |4 
>  libavformat/version.h |5 +
>  libavutil/version.h   |4 
>  3 files changed, 13 insertions(+)
> 
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 1b37a9e..cf9c924 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -46,6 +46,10 @@
>   * FF_API_* defines may be placed below to indicate public API that will be
>   * dropped at a future version bump. The defines themselves are not part of
>   * the public API and may change, break or disappear at any time.
> + *
> + * @note, when bumping the major version it is recommandeded to manually
> + * disable each FF_API_* in its own commit instead of disabling them all
> + * at once through the bump. This improves the git bissect-ability of the 
> change.
>   */

I think that is a good idea, but instead of disabling the FF_API_* defines
they should be removed together with the code guarded by them.
Otherwise chances are that the old, disabled code will never get removed,
see e.g. FF_API_OLD_GRAPH_PARSE.

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


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

2015-08-18 Thread Andreas Cadhalpun
On 18.08.2015 05:34, Michael Niedermayer wrote:
> On Sat, Aug 08, 2015 at 01:31:51PM +0200, Andreas Cadhalpun wrote:
>> Signed-off-by: Andreas Cadhalpun 
>> ---
>>  libavfilter/avfilter.c | 2 ++
>>  1 file changed, 2 insertions(+)
> 
> tools/graph2dot fails to build without FF_API_AVFILTERPAD_PUBLIC
> it seems

Yes, though it's only indirectly related to this patch.
Anyway, patch for that attached.

Best regards,
Andreas

>From 5c8d576ed73499cb41d8b7c5952f5917bca0df22 Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun 
Date: Tue, 18 Aug 2015 23:07:37 +0200
Subject: [PATCH] graph2dot: use avfilter_pad_get_name accessor function

---
 tools/graph2dot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/graph2dot.c b/tools/graph2dot.c
index 23c7331..21d0795 100644
--- a/tools/graph2dot.c
+++ b/tools/graph2dot.c
@@ -79,7 +79,8 @@ static void print_digraph(FILE *outfile, AVFilterGraph *graph)
 
 fprintf(outfile, "\"%s\" -> \"%s\" [ label= \"inpad:%s -> outpad:%s\\n",
 filter_ctx_label, dst_filter_ctx_label,
-link->srcpad->name, link->dstpad->name);
+avfilter_pad_get_name(link->srcpad, 0),
+avfilter_pad_get_name(link->dstpad, 0));
 
 if (link->type == AVMEDIA_TYPE_VIDEO) {
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
-- 
2.5.0

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


Re: [FFmpeg-devel] [PATCH]Postpone vdpau removal

2015-08-18 Thread wm4
On Tue, 18 Aug 2015 21:05:44 + (UTC)
Carl Eugen Hoyos  wrote:

> Ronald S. Bultje  gmail.com> writes:
> 
> > > Attached patch postpones the vdpau removal.
> > > The decoders were only deprecated today, so give 
> > > users time until the next version bump.
> > 
> > No.
> 
> Then please revert a383f226
> I am listed as vdpau maintainer and I object to the patch.

Why?

Also, the maintainer list means absolutely nothing.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]Postpone vdpau removal

2015-08-18 Thread wm4
On Tue, 18 Aug 2015 22:58:59 +0200
Carl Eugen Hoyos  wrote:

> Hi!
> 
> Attached patch postpones the vdpau removal.
> The decoders were only deprecated today, so give users time until the next 
> version bump.
> 
> Carl Eugen

-1

Your argument is ridiculous too. They were deprecated long ago, it's
only a technicality.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] GSoC Weekly report (libswscale)

2015-08-18 Thread Pedro Arthur
Patch with alpha fixed.

2015-08-18 18:07 GMT-03:00 Michael Niedermayer :

> On Tue, Aug 18, 2015 at 04:27:42PM -0300, Pedro Arthur wrote:
> > Attached patch with new vertical scaler code, added license and fixed
> > compiler warnings.
>
>
> split and applied first patch, had to change 2 asserts to make it work
> without the vscale code
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Republics decline into democracies and democracies degenerate into
> despotisms. -- Aristotle
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
From 01e23c1b2302d9e4627a0ac872203f76d31a0492 Mon Sep 17 00:00:00 2001
From: Pedro Arthur 
Date: Tue, 18 Aug 2015 11:47:55 -0300
Subject: [PATCH] swscale: refactor vertical scaler

---
 libswscale/Makefile   |   1 +
 libswscale/slice.c|  20 +++-
 libswscale/swscale.c  |  88 --
 libswscale/swscale_internal.h |  20 +++-
 libswscale/vscale.c   | 268 ++
 libswscale/x86/swscale.c  |   6 +-
 6 files changed, 361 insertions(+), 42 deletions(-)
 create mode 100644 libswscale/vscale.c

diff --git a/libswscale/Makefile b/libswscale/Makefile
index b2b6381..e70e358 100644
--- a/libswscale/Makefile
+++ b/libswscale/Makefile
@@ -17,6 +17,7 @@ OBJS = alphablend.o \
yuv2rgb.o\
slice.o  \
hscale.o \
+   vscale.o \
 
 OBJS-$(CONFIG_SHARED)+= log2_tab.o
 
diff --git a/libswscale/slice.c b/libswscale/slice.c
index 611e4e6..8fd16d3 100644
--- a/libswscale/slice.c
+++ b/libswscale/slice.c
@@ -214,6 +214,7 @@ int ff_init_filters(SwsContext * c)
 int index;
 int num_ydesc;
 int num_cdesc;
+int num_vdesc = isPlanarYUV(c->dstFormat) && !isGray(c->dstFormat) ? 2 : 1;
 int need_lum_conv = c->lumToYV12 || c->readLumPlanar || c->alpToYV12 || c->readAlpPlanar;
 int need_chr_conv = c->chrToYV12 || c->readChrPlanar;
 int srcIdx, dstIdx;
@@ -228,8 +229,8 @@ int ff_init_filters(SwsContext * c)
 num_ydesc = need_lum_conv ? 2 : 1;
 num_cdesc = need_chr_conv ? 2 : 1;
 
-c->numSlice = FFMAX(num_ydesc, num_cdesc) + 1;
-c->numDesc = num_ydesc + num_cdesc;
+c->numSlice = FFMAX(num_ydesc, num_cdesc) + 2;
+c->numDesc = num_ydesc + num_cdesc + num_vdesc;
 c->descIndex[0] = num_ydesc;
 c->descIndex[1] = num_ydesc + num_cdesc;
 
@@ -243,12 +244,13 @@ int ff_init_filters(SwsContext * c)
 
 res = alloc_slice(&c->slice[0], c->srcFormat, c->srcH, c->chrSrcH, c->chrSrcHSubSample, c->chrSrcVSubSample, 0);
 if (res < 0) goto cleanup;
-for (i = 1; i < c->numSlice-1; ++i) {
+for (i = 1; i < c->numSlice-2; ++i) {
 res = alloc_slice(&c->slice[i], c->srcFormat, c->vLumFilterSize + MAX_LINES_AHEAD, c->vChrFilterSize + MAX_LINES_AHEAD, c->chrSrcHSubSample, c->chrSrcVSubSample, 0);
 if (res < 0) goto cleanup;
 res = alloc_lines(&c->slice[i], FFALIGN(c->srcW*2+78, 16), c->srcW);
 if (res < 0) goto cleanup;
 }
+// horizontal scaler output
 res = alloc_slice(&c->slice[i], c->srcFormat, c->vLumFilterSize + MAX_LINES_AHEAD, c->vChrFilterSize + MAX_LINES_AHEAD, c->chrDstHSubSample, c->chrDstVSubSample, 1);
 if (res < 0) goto cleanup;
 res = alloc_lines(&c->slice[i], dst_stride, c->dstW);
@@ -256,6 +258,11 @@ int ff_init_filters(SwsContext * c)
 
 fill_ones(&c->slice[i], dst_stride>>1, c->dstBpc == 16);
 
+// vertical scaler output
+++i;
+res = alloc_slice(&c->slice[i], c->dstFormat, c->dstH, c->chrDstH, c->chrDstHSubSample, c->chrDstVSubSample, 0);
+if (res < 0) goto cleanup;
+
 index = 0;
 srcIdx = 0;
 dstIdx = 1;
@@ -290,6 +297,13 @@ int ff_init_filters(SwsContext * c)
 ff_init_desc_no_chr(&c->desc[index], &c->slice[srcIdx], &c->slice[dstIdx]);
 }
 
+++index;
+{
+srcIdx = c->numSlice - 2;
+dstIdx = c->numSlice - 1;
+ff_init_vscale(c, c->desc + index, c->slice + srcIdx, c->slice + dstIdx);
+}
+
 return 0;
 
 cleanup:
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 5faf1e6..be950ed 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -326,8 +326,8 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 #endif
 const int dstW   = c->dstW;
 const int dstH   = c->dstH;
-const int chrDstW= c->chrDstW;
 #ifndef NEW_FILTER
+const int chrDstW= c->chrDstW;
 const int chrSrcW= c->chrSrcW;
 const int lumXInc= c->lumXInc;
 const int chrXInc= c->chrXInc;
@@ -341,9 +341,9 @@ static int swscale(SwsContext *c, const 

Re: [FFmpeg-devel] [PATCH]Postpone vdpau removal

2015-08-18 Thread Hendrik Leppkes
On Tue, Aug 18, 2015 at 10:58 PM, Carl Eugen Hoyos  wrote:
> The decoders were only deprecated today, so give users time until the next
> version bump.
>

They have been deprecated for over 2 years now, it was just lacking a
lot of version guards around various places.
Adding the missing guards does not constitute "deprecating them today".

More specifically, on the API side, their codec capability (ie. thing
that actually makes them work in the code) was deprecated in
549294fbbe1c00fee37dc4d3f291b98945e11094, which specifically lists the
alternative in the APIchanges as well.

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


Re: [FFmpeg-devel] [PATCH] doc/indevs: fix typos

2015-08-18 Thread Lou Logan
On Tue, 18 Aug 2015 17:04:22 -0400, Ronald S. Bultje wrote:

> lgtm.
> 
> Ronald

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


Re: [FFmpeg-devel] [PATCH]Postpone vdpau removal

2015-08-18 Thread Philip Langdale

On 2015-08-18 14:05, Carl Eugen Hoyos wrote:

Ronald S. Bultje  gmail.com> writes:


> Attached patch postpones the vdpau removal.
> The decoders were only deprecated today, so give
> users time until the next version bump.

No.


Then please revert a383f226
I am listed as vdpau maintainer and I object to the patch.


Do we have any known applications that still use the old API.
Even mplayer, of all things, uses the new API.

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


Re: [FFmpeg-devel] GSoC Weekly report (libswscale)

2015-08-18 Thread Michael Niedermayer
On Tue, Aug 18, 2015 at 04:27:42PM -0300, Pedro Arthur wrote:
> Attached patch with new vertical scaler code, added license and fixed
> compiler warnings.


split and applied first patch, had to change 2 asserts to make it work
without the vscale code

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle


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


Re: [FFmpeg-devel] [PATCH]Postpone vdpau removal

2015-08-18 Thread Carl Eugen Hoyos
Ronald S. Bultje  gmail.com> writes:

> > Attached patch postpones the vdpau removal.
> > The decoders were only deprecated today, so give 
> > users time until the next version bump.
> 
> No.

Then please revert a383f226
I am listed as vdpau maintainer and I object to the patch.

Thank you, Carl Eugen

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


Re: [FFmpeg-devel] [PATCH] doc/indevs: fix typos

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

On Tue, Aug 18, 2015 at 4:57 PM, Lou Logan  wrote:

> Fixes ticket #4784 as found by rodarmor.
>
> Signed-off-by: Lou Logan 
> ---
>
> I did not test examples.
>
> ---
>
>  doc/indevs.texi | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/doc/indevs.texi b/doc/indevs.texi
> index d5415bb..6f47504 100644
> --- a/doc/indevs.texi
> +++ b/doc/indevs.texi
> @@ -444,12 +444,12 @@ Documentation/fb/framebuffer.txt included in the
> Linux source tree.
>  To record from the framebuffer device @file{/dev/fb0} with
>  @command{ffmpeg}:
>  @example
> -ffmpeg -f fbdev -r 10 -i /dev/fb0 out.avi
> +ffmpeg -f fbdev -framerate 10 -i /dev/fb0 out.avi
>  @end example
>
>  You can take a single screenshot image with the command:
>  @example
> -ffmpeg -f fbdev -frames:v 1 -r 1 -i /dev/fb0 screenshot.jpeg
> +ffmpeg -f fbdev -framerate 1 -i /dev/fb0 -frames:v 1 screenshot.jpeg
>  @end example
>
>  See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).
> --
> 2.5.0


lgtm.

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


Re: [FFmpeg-devel] [PATCH]Postpone vdpau removal

2015-08-18 Thread Ronald S. Bultje
Hi Carl,

On Tue, Aug 18, 2015 at 4:58 PM, Carl Eugen Hoyos  wrote:

> Hi!
>
> Attached patch postpones the vdpau removal.
> The decoders were only deprecated today, so give users time until the next
> version bump.


No.

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


[FFmpeg-devel] [PATCH]Postpone vdpau removal

2015-08-18 Thread Carl Eugen Hoyos
Hi!

Attached patch postpones the vdpau removal.
The decoders were only deprecated today, so give users time until the next 
version bump.

Carl Eugen
diff --git a/libavutil/version.h b/libavutil/version.h
index 653f530..e118be0 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -108,7 +108,7 @@
 #define FF_API_AVFRAME_LAVC (LIBAVUTIL_VERSION_MAJOR < 55)
 #endif
 #ifndef FF_API_VDPAU
-#define FF_API_VDPAU(LIBAVUTIL_VERSION_MAJOR < 55)
+#define FF_API_VDPAU(LIBAVUTIL_VERSION_MAJOR < 56)
 #endif
 #ifndef FF_API_GET_CHANNEL_LAYOUT_COMPAT
 #define FF_API_GET_CHANNEL_LAYOUT_COMPAT (LIBAVUTIL_VERSION_MAJOR < 55)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] doc/indevs: fix typos

2015-08-18 Thread Lou Logan
Fixes ticket #4784 as found by rodarmor.

Signed-off-by: Lou Logan 
---

I did not test examples.

---

 doc/indevs.texi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index d5415bb..6f47504 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -444,12 +444,12 @@ Documentation/fb/framebuffer.txt included in the Linux 
source tree.
 To record from the framebuffer device @file{/dev/fb0} with
 @command{ffmpeg}:
 @example
-ffmpeg -f fbdev -r 10 -i /dev/fb0 out.avi
+ffmpeg -f fbdev -framerate 10 -i /dev/fb0 out.avi
 @end example
 
 You can take a single screenshot image with the command:
 @example
-ffmpeg -f fbdev -frames:v 1 -r 1 -i /dev/fb0 screenshot.jpeg
+ffmpeg -f fbdev -framerate 1 -i /dev/fb0 -frames:v 1 screenshot.jpeg
 @end example
 
 See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).
-- 
2.5.0

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


Re: [FFmpeg-devel] GSoC Weekly report (libswscale)

2015-08-18 Thread Michael Niedermayer
On Tue, Aug 18, 2015 at 04:27:42PM -0300, Pedro Arthur wrote:
> Attached patch with new vertical scaler code, added license and fixed
> compiler warnings.

the vscaler works much better now than prevously, theres one bug left
in it though

./ffplay ./laraShadow_dl.flv -vf 
scale=400x400:flags=16,format=yuva420p,colorchannelmixer=ga=1

shows some horizotal line artifacts in the green channel (alpha from sws)

wget https://samples.mplayerhq.hu/FLV/flash_with_alpha/laraShadow_dl.flv

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

What does censorship reveal? It reveals fear. -- Julian Assange


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


Re: [FFmpeg-devel] [PATCH 1/2] Prepare for removal of obsolete FF_IDCT_* members.

2015-08-18 Thread wm4
On Mon, 17 Aug 2015 18:02:17 -0400
"Ronald S. Bultje"  wrote:

> Hi,
> 
> On Mon, Aug 17, 2015 at 5:45 PM, wm4  wrote:
> 
> > On Mon, 17 Aug 2015 15:41:03 -0400
> > "Ronald S. Bultje"  wrote:
> >
> > > ---
> > >  libavcodec/avcodec.h   | 2 --
> > >  libavcodec/avdct.c | 2 ++
> > >  libavcodec/options_table.h | 2 --
> > >  3 files changed, 2 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > > index 6b824d5..6f9b026 100644
> > > --- a/libavcodec/avcodec.h
> > > +++ b/libavcodec/avcodec.h
> > > @@ -2947,9 +2947,7 @@ typedef struct AVCodecContext {
> > >  int dct_algo;
> > >  #define FF_DCT_AUTO0
> > >  #define FF_DCT_FASTINT 1
> > > -#if FF_API_UNUSED_MEMBERS
> > >  #define FF_DCT_INT 2
> > > -#endif /* FF_API_UNUSED_MEMBERS */
> > >  #define FF_DCT_MMX 3
> > >  #define FF_DCT_ALTIVEC 5
> > >  #define FF_DCT_FAAN6
> > > diff --git a/libavcodec/avdct.c b/libavcodec/avdct.c
> > > index f92c691..3b622ba 100644
> > > --- a/libavcodec/avdct.c
> > > +++ b/libavcodec/avdct.c
> > > @@ -58,7 +58,9 @@ static const AVOption avdct_options[] = {
> > >  #if FF_API_ARCH_ALPHA
> > >  {"simplealpha", "experimental / for debugging", 0, AV_OPT_TYPE_CONST,
> > {.i64 = FF_IDCT_SIMPLEALPHA }, INT_MIN, INT_MAX, V|E|D, "idct"},
> > >  #endif
> > > +#if FF_API_UNUSED_MEMBERS
> > >  {"ipp", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 =
> > FF_IDCT_IPP }, INT_MIN, INT_MAX, V|E|D, "idct"},
> > > +#endif
> > >  {"xvid", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 =
> > FF_IDCT_XVID }, INT_MIN, INT_MAX, V|E|D, "idct"},
> > >  {"xvidmmx", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64
> > = FF_IDCT_XVID }, INT_MIN, INT_MAX, V|E|D, "idct"},
> > >  {"faani", "floating point AAN IDCT (experimental / for debugging)", 0,
> > AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_FAAN }, INT_MIN, INT_MAX, V|D|E, "idct"},
> > > diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
> > > index fd9c045..8dabb65 100644
> > > --- a/libavcodec/options_table.h
> > > +++ b/libavcodec/options_table.h
> > > @@ -203,9 +203,7 @@ static const AVOption avcodec_options[] = {
> > >  {"dct", "DCT algorithm", OFFSET(dct_algo), AV_OPT_TYPE_INT, {.i64 =
> > DEFAULT }, 0, INT_MAX, V|E, "dct"},
> > >  {"auto", "autoselect a good one (default)", 0, AV_OPT_TYPE_CONST, {.i64
> > = FF_DCT_AUTO }, INT_MIN, INT_MAX, V|E, "dct"},
> > >  {"fastint", "fast integer", 0, AV_OPT_TYPE_CONST, {.i64 =
> > FF_DCT_FASTINT }, INT_MIN, INT_MAX, V|E, "dct"},
> > > -#if FF_API_UNUSED_MEMBERS
> > >  {"int", "accurate integer", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_INT },
> > INT_MIN, INT_MAX, V|E, "dct"},
> > > -#endif /* FF_API_UNUSED_MEMBERS */
> > >  {"mmx", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_MMX }, INT_MIN,
> > INT_MAX, V|E, "dct"},
> > >  {"altivec", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_ALTIVEC },
> > INT_MIN, INT_MAX, V|E, "dct"},
> > >  {"faan", "floating point AAN DCT", 0, AV_OPT_TYPE_CONST, {.i64 =
> > FF_DCT_FAAN }, INT_MIN, INT_MAX, V|E, "dct"},
> >
> > I guess these weren't really unused, while "ipp" can go?
> 
> 
> Right, "int" is used in various fate tests and I can't be bothered to
> figure out whether that's useful or not. "ipp" is unused except for the
> mention in avdct.c, so removing that makes everyone happy.

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


Re: [FFmpeg-devel] [PATCH 3/3] doc/metadata: Default timestamp unit is nanoseconds

2015-08-18 Thread Michael Niedermayer
On Fri, Aug 14, 2015 at 10:46:55PM +0200, Alexander Strasser wrote:
> Signed-off-by: Alexander Strasser 
> ---
>  doc/metadata.texi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

LGTM

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH 1/3] lavc: put remaining bits of vdpau-in-decoder under FF_API_CAP_VDPAU.

2015-08-18 Thread wm4
On Mon, 17 Aug 2015 17:07:59 -0400
"Ronald S. Bultje"  wrote:

> ---
>  libavcodec/error_resilience.c |  2 ++
>  libavcodec/h263dec.c  |  2 ++
>  libavcodec/h264.c |  4 
>  libavcodec/h264_picture.c |  4 
>  libavcodec/h264_slice.c   | 16 
>  libavcodec/mpeg12dec.c| 20 +---
>  libavcodec/mpegpicture.c  |  6 +-
>  libavcodec/mpegvideo.c| 11 +--
>  libavcodec/utils.c|  2 ++
>  libavcodec/vc1dec.c   | 28 +---
>  10 files changed, 78 insertions(+), 17 deletions(-)
> 
> diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
> index b3b46d1..2c741a4 100644
> --- a/libavcodec/error_resilience.c
> +++ b/libavcodec/error_resilience.c
> @@ -777,7 +777,9 @@ void ff_er_frame_start(ERContext *s)
>  static int er_supported(ERContext *s)
>  {
>  if(s->avctx->hwaccel && s->avctx->hwaccel->decode_slice   ||
> +#if FF_API_CAP_VDPAU
> s->avctx->codec->capabilities&AV_CODEC_CAP_HWACCEL_VDPAU  ||
> +#endif
> !s->cur_pic.f  ||
> s->cur_pic.field_picture
>  )
> diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
> index 7fa7090..8f28a94 100644
> --- a/libavcodec/h263dec.c
> +++ b/libavcodec/h263dec.c
> @@ -603,10 +603,12 @@ retry:
>  if (!s->divx_packed && !avctx->hwaccel)
>  ff_thread_finish_setup(avctx);
>  
> +#if FF_API_CAP_VDPAU
>  if (CONFIG_MPEG4_VDPAU_DECODER && (s->avctx->codec->capabilities & 
> AV_CODEC_CAP_HWACCEL_VDPAU)) {
>  ff_vdpau_mpeg4_decode_picture(avctx->priv_data, s->gb.buffer, 
> s->gb.buffer_end - s->gb.buffer);
>  goto frame_end;
>  }
> +#endif
>  
>  if (avctx->hwaccel) {
>  ret = avctx->hwaccel->start_frame(avctx, s->gb.buffer,
> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
> index 8b575be..24e209c 100644
> --- a/libavcodec/h264.c
> +++ b/libavcodec/h264.c
> @@ -1561,9 +1561,11 @@ again:
>  if (h->avctx->hwaccel &&
>  (ret = h->avctx->hwaccel->start_frame(h->avctx, buf, 
> buf_size)) < 0)
>  goto end;
> +#if FF_API_CAP_VDPAU
>  if (CONFIG_H264_VDPAU_DECODER &&
>  h->avctx->codec->capabilities & 
> AV_CODEC_CAP_HWACCEL_VDPAU)
>  ff_vdpau_h264_picture_start(h);
> +#endif
>  }
>  
>  if (sl->redundant_pic_count == 0) {
> @@ -1573,6 +1575,7 @@ again:
> consumed);
>  if (ret < 0)
>  goto end;
> +#if FF_API_CAP_VDPAU
>  } else if (CONFIG_H264_VDPAU_DECODER &&
> h->avctx->codec->capabilities & 
> AV_CODEC_CAP_HWACCEL_VDPAU) {
>  ff_vdpau_add_data_chunk(h->cur_pic_ptr->f->data[0],
> @@ -1581,6 +1584,7 @@ again:
>  ff_vdpau_add_data_chunk(h->cur_pic_ptr->f->data[0],
>  &buf[buf_index - consumed],
>  consumed);
> +#endif
>  } else
>  context_count++;
>  }
> diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c
> index 81d90d7..289c4be 100644
> --- a/libavcodec/h264_picture.c
> +++ b/libavcodec/h264_picture.c
> @@ -157,9 +157,11 @@ int ff_h264_field_end(H264Context *h, H264SliceContext 
> *sl, int in_setup)
>  int err = 0;
>  h->mb_y = 0;
>  
> +#if FF_API_CAP_VDPAU
>  if (CONFIG_H264_VDPAU_DECODER &&
>  h->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU)
>  ff_vdpau_h264_set_reference_frames(h);
> +#endif
>  
>  if (in_setup || !(avctx->active_thread_type & FF_THREAD_FRAME)) {
>  if (!h->droppable) {
> @@ -177,9 +179,11 @@ int ff_h264_field_end(H264Context *h, H264SliceContext 
> *sl, int in_setup)
> "hardware accelerator failed to decode picture\n");
>  }
>  
> +#if FF_API_CAP_VDPAU
>  if (CONFIG_H264_VDPAU_DECODER &&
>  h->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU)
>  ff_vdpau_h264_picture_complete(h);
> +#endif
>  
>  #if CONFIG_ERROR_RESILIENCE
>  av_assert0(sl == h->slice_ctx);
> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
> index b088392..25034f7 100644
> --- a/libavcodec/h264_slice.c
> +++ b/libavcodec/h264_slice.c
> @@ -612,8 +612,11 @@ static int h264_frame_start(H264Context *h)
>  
>  if ((ret = alloc_picture(h, pic)) < 0)
>  return ret;
> -if(!h->frame_recovered && !h->avctx->hwaccel &&
> -   !(h->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU))
> +if(!h->frame_recovered && !h->avctx->hwaccel
> +#if FF_API_CAP_VDPAU
> +   && !(h->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU)
>

Re: [FFmpeg-devel] GSoC Weekly report (libswscale)

2015-08-18 Thread Pedro Arthur
Attached patch with new vertical scaler code, added license and fixed
compiler warnings.


2015-08-17 20:35 GMT-03:00 Michael Niedermayer :

> On Mon, Aug 17, 2015 at 05:35:32PM -0300, Pedro Arthur wrote:
> > ops, added missing file.
> >
> >
> > 2015-08-17 17:31 GMT-03:00 Pedro Arthur :
> >
> > >
> > >
> > > 2015-08-17 0:19 GMT-03:00 Michael Niedermayer  >:
> > >
> > >> also feel free to split the batch addition into a seperate commit
> > >> (should be easy as you already have a versionn with and without)
> > >>
> > > Attached proper patchs.
> > >
> > > also, please send me your public ssh key, i think you should have
> > >> direct write access to ffmpeg git
> > >>
> > > I've sent it privately.
> > >
>
> applied patches
>
> please add license headers to the new files
> also please put variables which are just used by the old code
> under #ifndef NEW_FILTER  or something so they do not produce warnings
>
> the comments also could benefit from spellchecking but thats not
> important ATM
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Freedom in capitalist society always remains about the same as it was in
> ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
From 4bb7303d1849bbccd98c5c74c3c90d228b489bef Mon Sep 17 00:00:00 2001
From: Pedro Arthur 
Date: Tue, 18 Aug 2015 15:06:49 -0300
Subject: [PATCH 1/2] swscale: added copyrights & fixed compiler warnings

---
 libswscale/hscale.c   | 20 
 libswscale/slice.c| 20 
 libswscale/swscale.c  | 24 +++-
 libswscale/swscale_internal.h |  6 --
 libswscale/x86/swscale.c  | 15 +++
 5 files changed, 66 insertions(+), 19 deletions(-)

diff --git a/libswscale/hscale.c b/libswscale/hscale.c
index c8543a2..ca09576 100644
--- a/libswscale/hscale.c
+++ b/libswscale/hscale.c
@@ -1,3 +1,23 @@
+/*
+ * Copyright (C) 2015 Pedro Arthur 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
 #include "swscale_internal.h"
 
 static int lum_h_scale(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int sliceH)
diff --git a/libswscale/slice.c b/libswscale/slice.c
index 242367d..611e4e6 100644
--- a/libswscale/slice.c
+++ b/libswscale/slice.c
@@ -1,3 +1,23 @@
+/*
+ * Copyright (C) 2015 Pedro Arthur 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
 #include "swscale_internal.h"
 
 static void free_lines(SwsSlice *s)
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index e5bab9c..5faf1e6 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -321,35 +321,45 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 {
 /* load a few things into local vars to make the code more readable?
  * and faster */
+#ifndef NEW_FILTER
 const int srcW   = c->srcW;
+#endif
 const int dstW   = c->dstW;
 const int dstH   = c->dstH;
 const int chrDstW= c->chrDstW;
+#ifndef NEW_FILTER
 const int chrSrcW= c->chrSrcW;
 const int lumXInc= c->lumXInc;
 const int chrXInc= c->chrXInc;
+#endif
 const enum AVPixelFormat dstFormat = c->dstFormat;
 const int flags  = c->flags;
 int32_t *vLumFilterPos   = c->vLumFilterPos;
 int32_t *vChrFilterPos 

Re: [FFmpeg-devel] [PATCH]lavf/mov: Support alac extradata in wave atom v2

2015-08-18 Thread Michael Niedermayer
On Mon, Aug 17, 2015 at 07:59:56PM +, Carl Eugen Hoyos wrote:
> Michael Niedermayer  niedermayer.cc> writes:
> 
> > +ffio_ensure_seekback(pb, 8);
> > +buffer = avio_rb64(pb);
> > +atom.size -= 8;
> > +if (  (buffer & 0x) == MKBETAG('f','r','m','a')
> > +&& buffer >> 32 <= atom.size
> > +&& buffer >> 32 >= 8) {
> > +avio_skip(pb,  - 8);
> > +atom.size += 8;
> 
> I tested that QT expects the frma atom first 
> in the wave atom, so this variant is ok as 
> far as I can tell.

feel free to push the variant you tested

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

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


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


Re: [FFmpeg-devel] [PATCH] configure: force -mconsole when linking SDL under MinGW

2015-08-18 Thread Michael Niedermayer
On Tue, Aug 18, 2015 at 07:04:21PM +, Timothy Gu wrote:
> On Tue, Aug 18, 2015 at 9:01 AM Stephen Hutchinson  wrote:
> 
> > When building SDL with MinGW, it sets -mwindows with the
> > assumption that the application is a GUI application. If this
> > is linked without passing -mconsole to configure via
> > --extra-ldflags, stdout will be silenced from cmd.exe while
> > running FFmpeg.
> >
> > The -mwindows flag that causes this behavior is included in the
> > sdl_libs variable, so append -mconsole there rather than create
> > an sdl_ldflags case just to insert it (especially if -mconsole
> > must come *after* -mwindows in order to be effective).
> > ---
> >  configure | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> 
> LGTM.

applied

thanks

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

The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"


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


Re: [FFmpeg-devel] [PATCH] configure: force -mconsole when linking SDL under MinGW

2015-08-18 Thread Timothy Gu
On Tue, Aug 18, 2015 at 9:01 AM Stephen Hutchinson  wrote:

> When building SDL with MinGW, it sets -mwindows with the
> assumption that the application is a GUI application. If this
> is linked without passing -mconsole to configure via
> --extra-ldflags, stdout will be silenced from cmd.exe while
> running FFmpeg.
>
> The -mwindows flag that causes this behavior is included in the
> sdl_libs variable, so append -mconsole there rather than create
> an sdl_ldflags case just to insert it (especially if -mconsole
> must come *after* -mwindows in order to be effective).
> ---
>  configure | 3 +++
>  1 file changed, 3 insertions(+)
>

LGTM.

[...]

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


Re: [FFmpeg-devel] [PATCH 1/2] checkasm: Explicitly declare function prototypes

2015-08-18 Thread Michael Niedermayer
On Sun, Aug 16, 2015 at 06:40:56PM +0200, Henrik Gramner wrote:
> Now we no longer have to rely on function pointers intentionally
> declared without specified argument types.
> 
> This makes it easier to support functions with floating point parameters
> or return values as well as functions returning 64-bit values on 32-bit
> architectures. It also avoids having to explicitly cast strides to
> ptrdiff_t for example.
> ---
>  tests/checkasm/Makefile |  3 +--
>  tests/checkasm/bswapdsp.c   |  2 ++
>  tests/checkasm/checkasm.c   |  6 +++---
>  tests/checkasm/checkasm.h   | 38 ++
>  tests/checkasm/h264pred.c   | 32 
>  tests/checkasm/h264qpel.c   |  7 ---
>  tests/checkasm/x86/checkasm.asm |  4 ++--
>  7 files changed, 54 insertions(+), 38 deletions(-)

tested on 32&64bit x86, qemu arm & mips

should be ok

Thanks

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

Democracy is the form of government in which you can choose your dictator


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


Re: [FFmpeg-devel] [PATCH] Undeprecate av_opt_set_defaults2().

2015-08-18 Thread Michael Niedermayer
On Tue, Aug 18, 2015 at 11:02:17AM -0400, Ronald S. Bultje wrote:
> ---
>  libavutil/opt.c |  5 +
>  libavutil/opt.h | 12 +---
>  2 files changed, 10 insertions(+), 7 deletions(-)

LGTM

thanks

[...]
-- 
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] libx264: Add option to force IDR frames

2015-08-18 Thread Michael Niedermayer
On Tue, Aug 18, 2015 at 02:00:17PM +0100, Derek Buitenhuis wrote:
> Currently, when forcing an I frame, via API, or via the ffmpeg cli,
> using -force_key_frames, we still let x264 decide what sort of
> keyframe to user. In some cases, it is useful to be able to force
> an IDR frame, e.g. for cutting streams.
> 
> Signed-off-by: Derek Buitenhuis 
> ---
>  libavcodec/libx264.c | 5 -
>  libavcodec/version.h | 2 +-
>  2 files changed, 5 insertions(+), 2 deletions(-)

LGTM unless someone wants to extend the API to pass this per frame
.pict_type or .keyframe or whatever

thanks

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

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


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


[FFmpeg-devel] [PATCH] configure: force -mconsole when linking SDL under MinGW

2015-08-18 Thread Stephen Hutchinson
When building SDL with MinGW, it sets -mwindows with the
assumption that the application is a GUI application. If this
is linked without passing -mconsole to configure via 
--extra-ldflags, stdout will be silenced from cmd.exe while
running FFmpeg.

The -mwindows flag that causes this behavior is included in the
sdl_libs variable, so append -mconsole there rather than create
an sdl_ldflags case just to insert it (especially if -mconsole
must come *after* -mwindows in order to be effective).
---
 configure | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configure b/configure
index 55cc7fb..1086c47 100755
--- a/configure
+++ b/configure
@@ -5376,6 +5376,9 @@ if ! disabled sdl; then
 disable sdl
 fi
 fi
+if test $target_os = "mingw32"; then
+sdl_libs="$sdl_libs -mconsole"
+fi
 fi
 enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
 
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH 1/6] options: mark av_get_{int, double, q} as deprecated.

2015-08-18 Thread Michael Niedermayer
On Mon, Aug 17, 2015 at 11:52:14AM -0400, Ronald S. Bultje wrote:
> Convert last users to av_opt_get_*() counterparts.
> ---
>  libavfilter/af_aresample.c | 17 +
>  libavfilter/x86/vf_spp.c   |  4 +++-
>  libavutil/opt.h|  3 +++
>  3 files changed, 15 insertions(+), 9 deletions(-)

LGTM

thx

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

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


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


Re: [FFmpeg-devel] [PATCH] libx264: Add option to force IDR frames

2015-08-18 Thread Yusuke Nakamura
2015-08-19 0:20 GMT+09:00 Carl Eugen Hoyos :

> Hendrik Leppkes  gmail.com> writes:
>
> > Whats the other reason for forcing a keyframe, ie.
> > why don't we always set IDR?
>
> I don't know if x264 supports it (and I wanted to ask)
> but h264 reference frames can be older than the last
> I-frame (but not older than the last IDR-frame).
> The I-frame is no recovery point in that case iiuc.
>
> Carl Eugen
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

x264 can make I-picture as a random accessible point when using Open-GOP
feature (recovery_frame_cnt == 0). I don't know there is guarantee that AVC
decoder always discards undecodable leading pictures in output order when
seeking to such I-picture, but at least recent ISO Base Media has a feature
for handling this situation correctly.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/6] FF_OPT_TYPE_* -> AV_OPT_TYPE_*.

2015-08-18 Thread Michael Niedermayer
On Mon, Aug 17, 2015 at 11:52:15AM -0400, Ronald S. Bultje wrote:
> ---
>  libavcodec/dvbsubdec.c   |  6 +++---
>  libavcodec/frwu.c|  2 +-
>  libavcodec/h264.c|  4 ++--
>  libavcodec/libvpxenc.c   |  6 +++---
>  libavcodec/mpeg4videodec.c   |  4 ++--
>  libavcodec/s302m.c   | 10 +-
>  libavcodec/v210dec.c |  2 +-
>  libavformat/hls.c|  2 +-
>  libavformat/mov.c|  6 +++---
>  libavformat/tedcaptionsdec.c |  2 +-
>  10 files changed, 22 insertions(+), 22 deletions(-)

i thought i already ok-ed this

but
LGTM

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

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


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


[FFmpeg-devel] [PATCH 4/5] hwaccel: add infrastructure to hold accelerator config options.

2015-08-18 Thread Gwenole Beauchesne
The options are live from AVHWaccel.init() to AVHWAccel.uninit(). As such,
they are specific to an active hwaccel and have a meaning to that hwaccel
only during initialization. Options can be initialized by the user during
AVCodecContext.get_format() with hwaccel-specific (public) helper functions.

This is an internal infrastructure change/addition only.

Signed-off-by: Gwenole Beauchesne 
---
 libavcodec/internal.h | 14 ++
 libavcodec/utils.c|  2 ++
 2 files changed, 16 insertions(+)

diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 0daf669..866ed12 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -163,6 +163,20 @@ typedef struct AVCodecInternal {
  * hwaccel-specific private data
  */
 void *hwaccel_priv_data;
+
+/**
+ * Hardware acceleration config options.
+ *
+ * Those options are live from AVHWAccel.init() to AVHWAccel.uninit().
+ * As such, they are specific to an active hwaccel and have a meaning
+ * to that specific hwaccel only during initialization. Initialization
+ * occurs during AVCodecContext.get_format() through hwaccel-specific
+ * helper functions.
+ *
+ * Options are written by the user and read by the hwaccel. Exposing
+ * hwaccel options to the user is not permitted.
+ */
+AVDictionary *hwaccel_config;
 } AVCodecInternal;
 
 struct AVCodecDefault {
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 22dcc82..338b6bf 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1231,6 +1231,7 @@ int ff_get_format(AVCodecContext *avctx, const enum 
AVPixelFormat *fmt)
 if (avctx->hwaccel && avctx->hwaccel->uninit)
 avctx->hwaccel->uninit(avctx);
 av_freep(&avctx->internal->hwaccel_priv_data);
+av_dict_free(&avctx->internal->hwaccel_config);
 avctx->hwaccel = NULL;
 
 ret = avctx->get_format(avctx, choices);
@@ -2921,6 +2922,7 @@ av_cold int avcodec_close(AVCodecContext *avctx)
 if (avctx->hwaccel && avctx->hwaccel->uninit)
 avctx->hwaccel->uninit(avctx);
 av_freep(&avctx->internal->hwaccel_priv_data);
+av_dict_free(&avctx->internal->hwaccel_config);
 
 av_freep(&avctx->internal);
 }
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 5/5] vaapi: add support for new config options.

2015-08-18 Thread Gwenole Beauchesne
Add support for modern and flexible config options for vaapi decoders.
Accessors are available to handle those:
- av_vaapi_set_display():
  Binds a user supplied VA display to a codec context
- av_vaapi_set_config():
  Configures the VA-API decoder with a key/value pair
- av_vaapi_set_config_int():
  Configures the VA-API decoder with a key/value pair(int).

The current set of config options is:
- "display": the VA display handle (pointer)
- "config": the VA config id (uint32_t)
- "context": the VA context (pipeline) id (uint32_t)

The whole vaapi_context structure is now not needed, and thus deprecated.

Signed-off-by: Gwenole Beauchesne 
---
 doc/APIchanges  |  6 
 libavcodec/vaapi.c  | 66 
 libavcodec/vaapi.h  | 73 +++--
 libavcodec/vaapi_internal.h |  1 +
 4 files changed, 139 insertions(+), 7 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index cce2ddb..6d05b8b 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,12 @@ libavutil: 2014-08-09
 
 API changes, most recent first:
 
+2015-xx-xx - lavc 56.58.0 - vaapi.h
+  Add new APIs to configure hwaccel/vaapi decoders: av_vaapi_set_display(),
+  av_vaapi_set_config(), av_vaapi_set_config_str().
+  Deprecate vaapi_context structure, which is no longer used for
+  initializing a VA-API decode pipeline.
+
 2015-xx-xx - lavu 54.30.0
   xxx -  Add av_blowfish_alloc().
   xxx -  Add av_rc4_alloc().
diff --git a/libavcodec/vaapi.c b/libavcodec/vaapi.c
index 1ae71a5..f73a42e 100644
--- a/libavcodec/vaapi.c
+++ b/libavcodec/vaapi.c
@@ -41,19 +41,75 @@ static void destroy_buffers(VADisplay display, VABufferID 
*buffers, unsigned int
 }
 }
 
+#define OFFSET(x) offsetof(FFVAContext, x)
+static const AVOption FFVAContextOptions[] = {
+{ AV_VAAPI_CONFIG_OPTION_DISPLAY, "VA display handle", OFFSET(display),
+  AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, UINTPTR_MAX },
+{ AV_VAAPI_CONFIG_OPTION_CONFIG, "VA config id", OFFSET(config_id),
+  AV_OPT_TYPE_INT, { .i64 = VA_INVALID_ID }, 0, UINT32_MAX },
+{ AV_VAAPI_CONFIG_OPTION_CONTEXT, "VA context id", OFFSET(context_id),
+  AV_OPT_TYPE_INT, { .i64 = VA_INVALID_ID }, 0, UINT32_MAX },
+{ NULL, }
+};
+#undef OFFSET
+
+static const AVClass FFVAContextClass = {
+.class_name = "FFVAContext",
+.item_name  = av_default_item_name,
+.option = FFVAContextOptions,
+.version= LIBAVUTIL_VERSION_INT,
+};
+
+static const AVOption *get_option(const char *key, const char *unit)
+{
+const AVClass *klass = &FFVAContextClass;
+
+return av_opt_find2(&klass, key, unit, 0, AV_OPT_SEARCH_FAKE_OBJ, NULL);
+}
+
+int av_vaapi_set_display(AVCodecContext *avctx, VADisplay display)
+{
+return av_vaapi_set_config_int(avctx, AV_VAAPI_CONFIG_OPTION_DISPLAY,
+   (int64_t)(intptr_t)display);
+}
+
+int av_vaapi_set_config(AVCodecContext *avctx, const char *key,
+const char *value)
+{
+if (!get_option(key, NULL))
+return AVERROR(EINVAL);
+return av_dict_set(&avctx->internal->hwaccel_config, key, value, 0);
+}
+
+int av_vaapi_set_config_int(AVCodecContext *avctx, const char *key,
+int64_t value)
+{
+if (!get_option(key, NULL))
+return AVERROR(EINVAL);
+return av_dict_set_int(&avctx->internal->hwaccel_config, key, value, 0);
+}
+
 int ff_vaapi_context_init(AVCodecContext *avctx)
 {
 FFVAContext * const vactx = ff_vaapi_get_context(avctx);
-const struct vaapi_context * const user_vactx = avctx->hwaccel_context;
 
-vactx->display  = user_vactx->display;
-vactx->config_id= user_vactx->config_id;
-vactx->context_id   = user_vactx->context_id;
+vactx->klass = &FFVAContextClass;
+av_opt_set_defaults(vactx);
+
+#if FF_API_VAAPI_CONTEXT
+if (avctx->hwaccel_context) {
+const struct vaapi_context * const user_vactx = avctx->hwaccel_context;
+vactx->display  = user_vactx->display;
+vactx->config_id= user_vactx->config_id;
+vactx->context_id   = user_vactx->context_id;
+}
+#endif
 
 vactx->pic_param_buf_id = VA_INVALID_ID;
 vactx->iq_matrix_buf_id = VA_INVALID_ID;
 vactx->bitplane_buf_id  = VA_INVALID_ID;
-return 0;
+
+return av_opt_set_dict(vactx, &avctx->internal->hwaccel_config);
 }
 
 int ff_vaapi_context_fini(AVCodecContext *avctx)
diff --git a/libavcodec/vaapi.h b/libavcodec/vaapi.h
index 4448a2e..22b9336 100644
--- a/libavcodec/vaapi.h
+++ b/libavcodec/vaapi.h
@@ -32,7 +32,9 @@
 
 #include 
 #include 
+#include 
 #include "version.h"
+#include "avcodec.h"
 
 /**
  * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding
@@ -48,7 +50,12 @@
  * during initialization or through each AVCodecContext.get_buffer()
  * function call. In any case, they must be valid prior to calling
  * decoding functions.
+ *
+ * T

[FFmpeg-devel] [PATCH 2/5] vaapi: streamline public context structure.

2015-08-18 Thread Gwenole Beauchesne
Move libavcodec managed objects from the public struct vaapi_context
to a new privately owned FFVAContext. This is done so that to clean up
and streamline the public structure, but also to prepare for new codec
support, thus requiring new internal data to be added in there.

The AVCodecContext.hwaccel_context, that holds the public vaapi_context,
shall no longer be accessed from within vaapi_*.c codec support files.

Signed-off-by: Gwenole Beauchesne 
---
 libavcodec/vaapi.c  | 34 +-
 libavcodec/vaapi.h  | 16 
 libavcodec/vaapi_h264.c | 10 +++---
 libavcodec/vaapi_internal.h | 42 --
 libavcodec/vaapi_mpeg2.c|  8 ++--
 libavcodec/vaapi_mpeg4.c| 11 +--
 libavcodec/vaapi_vc1.c  | 11 +--
 libavcodec/version.h|  3 +++
 8 files changed, 111 insertions(+), 24 deletions(-)

diff --git a/libavcodec/vaapi.c b/libavcodec/vaapi.c
index 6ac22e6..880e3d6 100644
--- a/libavcodec/vaapi.c
+++ b/libavcodec/vaapi.c
@@ -41,7 +41,23 @@ static void destroy_buffers(VADisplay display, VABufferID 
*buffers, unsigned int
 }
 }
 
-int ff_vaapi_render_picture(struct vaapi_context *vactx, VASurfaceID surface)
+int ff_vaapi_context_init(AVCodecContext *avctx)
+{
+FFVAContext * const vactx = ff_vaapi_get_context(avctx);
+const struct vaapi_context * const user_vactx = avctx->hwaccel_context;
+
+vactx->display  = user_vactx->display;
+vactx->config_id= user_vactx->config_id;
+vactx->context_id   = user_vactx->context_id;
+return 0;
+}
+
+int ff_vaapi_context_fini(AVCodecContext *avctx)
+{
+return 0;
+}
+
+int ff_vaapi_render_picture(FFVAContext *vactx, VASurfaceID surface)
 {
 VABufferID va_buffers[3];
 unsigned int n_va_buffers = 0;
@@ -81,7 +97,7 @@ int ff_vaapi_render_picture(struct vaapi_context *vactx, 
VASurfaceID surface)
 return 0;
 }
 
-int ff_vaapi_commit_slices(struct vaapi_context *vactx)
+int ff_vaapi_commit_slices(FFVAContext *vactx)
 {
 VABufferID *slice_buf_ids;
 VABufferID slice_param_buf_id, slice_data_buf_id;
@@ -121,7 +137,7 @@ int ff_vaapi_commit_slices(struct vaapi_context *vactx)
 return 0;
 }
 
-static void *alloc_buffer(struct vaapi_context *vactx, int type, unsigned int 
size, uint32_t *buf_id)
+static void *alloc_buffer(FFVAContext *vactx, int type, unsigned int size, 
uint32_t *buf_id)
 {
 void *data = NULL;
 
@@ -133,22 +149,22 @@ static void *alloc_buffer(struct vaapi_context *vactx, 
int type, unsigned int si
 return data;
 }
 
-void *ff_vaapi_alloc_pic_param(struct vaapi_context *vactx, unsigned int size)
+void *ff_vaapi_alloc_pic_param(FFVAContext *vactx, unsigned int size)
 {
 return alloc_buffer(vactx, VAPictureParameterBufferType, size, 
&vactx->pic_param_buf_id);
 }
 
-void *ff_vaapi_alloc_iq_matrix(struct vaapi_context *vactx, unsigned int size)
+void *ff_vaapi_alloc_iq_matrix(FFVAContext *vactx, unsigned int size)
 {
 return alloc_buffer(vactx, VAIQMatrixBufferType, size, 
&vactx->iq_matrix_buf_id);
 }
 
-uint8_t *ff_vaapi_alloc_bitplane(struct vaapi_context *vactx, uint32_t size)
+uint8_t *ff_vaapi_alloc_bitplane(FFVAContext *vactx, uint32_t size)
 {
 return alloc_buffer(vactx, VABitPlaneBufferType, size, 
&vactx->bitplane_buf_id);
 }
 
-VASliceParameterBufferBase *ff_vaapi_alloc_slice(struct vaapi_context *vactx, 
const uint8_t *buffer, uint32_t size)
+VASliceParameterBufferBase *ff_vaapi_alloc_slice(FFVAContext *vactx, const 
uint8_t *buffer, uint32_t size)
 {
 uint8_t *slice_params;
 VASliceParameterBufferBase *slice_param;
@@ -181,7 +197,7 @@ VASliceParameterBufferBase *ff_vaapi_alloc_slice(struct 
vaapi_context *vactx, co
 
 void ff_vaapi_common_end_frame(AVCodecContext *avctx)
 {
-struct vaapi_context * const vactx = avctx->hwaccel_context;
+FFVAContext * const vactx = ff_vaapi_get_context(avctx);
 
 ff_dlog(avctx, "ff_vaapi_common_end_frame()\n");
 
@@ -202,7 +218,7 @@ void ff_vaapi_common_end_frame(AVCodecContext *avctx)
 CONFIG_VC1_VAAPI_HWACCEL   || CONFIG_WMV3_VAAPI_HWACCEL
 int ff_vaapi_mpeg_end_frame(AVCodecContext *avctx)
 {
-struct vaapi_context * const vactx = avctx->hwaccel_context;
+FFVAContext * const vactx = ff_vaapi_get_context(avctx);
 MpegEncContext *s = avctx->priv_data;
 int ret;
 
diff --git a/libavcodec/vaapi.h b/libavcodec/vaapi.h
index 815a27e..4448a2e 100644
--- a/libavcodec/vaapi.h
+++ b/libavcodec/vaapi.h
@@ -31,6 +31,8 @@
  */
 
 #include 
+#include 
+#include "version.h"
 
 /**
  * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding
@@ -72,12 +74,14 @@ struct vaapi_context {
  */
 uint32_t context_id;
 
+#if FF_API_VAAPI_CONTEXT
 /**
  * VAPictureParameterBuffer ID
  *
  * - encoding: unused
  * - decoding: Set by libavcodec
  */
+attribute_deprecated
 uint32_t pic_param_buf_id;
 
 /**
@@ -86,6 +90,7 @@ struct vaapi_context {
  

[FFmpeg-devel] [PATCH 3/5] vaapi: fix usage of invalid buffer ids.

2015-08-18 Thread Gwenole Beauchesne
Invalid buffer ids are defined by VA_INVALID_ID. Use that through out
vaapi_*.c support files now that we have private data initialized and
managed by libavcodec. Previously, the only requirement for the public
vaapi_context struct was to be zero-initialized.

This fixes support for 3rdparty VA drivers that strictly conform to
the API whereby an invalid buffer id is VA_INVALID_ID and the first
valid buffer id can actually be zero.

Signed-off-by: Gwenole Beauchesne 
---
 libavcodec/vaapi.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/libavcodec/vaapi.c b/libavcodec/vaapi.c
index 880e3d6..1ae71a5 100644
--- a/libavcodec/vaapi.c
+++ b/libavcodec/vaapi.c
@@ -34,9 +34,9 @@ static void destroy_buffers(VADisplay display, VABufferID 
*buffers, unsigned int
 {
 unsigned int i;
 for (i = 0; i < n_buffers; i++) {
-if (buffers[i]) {
+if (buffers[i] != VA_INVALID_ID) {
 vaDestroyBuffer(display, buffers[i]);
-buffers[i] = 0;
+buffers[i] = VA_INVALID_ID;
 }
 }
 }
@@ -49,6 +49,10 @@ int ff_vaapi_context_init(AVCodecContext *avctx)
 vactx->display  = user_vactx->display;
 vactx->config_id= user_vactx->config_id;
 vactx->context_id   = user_vactx->context_id;
+
+vactx->pic_param_buf_id = VA_INVALID_ID;
+vactx->iq_matrix_buf_id = VA_INVALID_ID;
+vactx->bitplane_buf_id  = VA_INVALID_ID;
 return 0;
 }
 
@@ -62,18 +66,18 @@ int ff_vaapi_render_picture(FFVAContext *vactx, VASurfaceID 
surface)
 VABufferID va_buffers[3];
 unsigned int n_va_buffers = 0;
 
-if (!vactx->pic_param_buf_id)
+if (vactx->pic_param_buf_id == VA_INVALID_ID)
 return 0;
 
 vaUnmapBuffer(vactx->display, vactx->pic_param_buf_id);
 va_buffers[n_va_buffers++] = vactx->pic_param_buf_id;
 
-if (vactx->iq_matrix_buf_id) {
+if (vactx->iq_matrix_buf_id != VA_INVALID_ID) {
 vaUnmapBuffer(vactx->display, vactx->iq_matrix_buf_id);
 va_buffers[n_va_buffers++] = vactx->iq_matrix_buf_id;
 }
 
-if (vactx->bitplane_buf_id) {
+if (vactx->bitplane_buf_id != VA_INVALID_ID) {
 vaUnmapBuffer(vactx->display, vactx->bitplane_buf_id);
 va_buffers[n_va_buffers++] = vactx->bitplane_buf_id;
 }
@@ -113,7 +117,7 @@ int ff_vaapi_commit_slices(FFVAContext *vactx)
 return -1;
 vactx->slice_buf_ids = slice_buf_ids;
 
-slice_param_buf_id = 0;
+slice_param_buf_id = VA_INVALID_ID;
 if (vaCreateBuffer(vactx->display, vactx->context_id,
VASliceParameterBufferType,
vactx->slice_param_size,
@@ -122,7 +126,7 @@ int ff_vaapi_commit_slices(FFVAContext *vactx)
 return -1;
 vactx->slice_count = 0;
 
-slice_data_buf_id = 0;
+slice_data_buf_id = VA_INVALID_ID;
 if (vaCreateBuffer(vactx->display, vactx->context_id,
VASliceDataBufferType,
vactx->slice_data_size,
@@ -141,7 +145,7 @@ static void *alloc_buffer(FFVAContext *vactx, int type, 
unsigned int size, uint3
 {
 void *data = NULL;
 
-*buf_id = 0;
+*buf_id = VA_INVALID_ID;
 if (vaCreateBuffer(vactx->display, vactx->context_id,
type, size, 1, NULL, buf_id) == VA_STATUS_SUCCESS)
 vaMapBuffer(vactx->display, *buf_id, &data);
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 1/5] vaapi: define a single pixel format for VA-API (AV_PIX_FMT_VAAPI).

2015-08-18 Thread Gwenole Beauchesne
Deprecate older VA pixel formats (MOCO, IDCT) as it is now very unlikely
to ever be useful in the future. Only keep plain AV_PIX_FMT_VAAPI format
that is aliased to the older VLD variant.

Signed-off-by: Gwenole Beauchesne 
---
 libavcodec/h263dec.c |  2 +-
 libavcodec/h264_slice.c  |  2 +-
 libavcodec/mpeg12dec.c   |  2 +-
 libavcodec/vaapi_h264.c  |  2 +-
 libavcodec/vaapi_mpeg2.c |  2 +-
 libavcodec/vaapi_mpeg4.c |  4 ++--
 libavcodec/vaapi_vc1.c   |  4 ++--
 libavcodec/vc1dec.c  |  2 +-
 libavutil/pixdesc.c  |  9 +
 libavutil/pixfmt.h   | 12 
 libavutil/version.h  |  3 +++
 11 files changed, 34 insertions(+), 10 deletions(-)

diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 7fa7090..e647e40 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -718,7 +718,7 @@ frame_end:
 
 const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[] = {
 #if CONFIG_H263_VAAPI_HWACCEL || CONFIG_MPEG4_VAAPI_HWACCEL
-AV_PIX_FMT_VAAPI_VLD,
+AV_PIX_FMT_VAAPI,
 #endif
 #if CONFIG_H263_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL
 AV_PIX_FMT_VDPAU,
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 48f501b..7b35c08 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -943,7 +943,7 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, 
int force_callback)
 *fmt++ = AV_PIX_FMT_D3D11VA_VLD;
 #endif
 #if CONFIG_H264_VAAPI_HWACCEL
-*fmt++ = AV_PIX_FMT_VAAPI_VLD;
+*fmt++ = AV_PIX_FMT_VAAPI;
 #endif
 #if CONFIG_H264_VDA_HWACCEL
 *fmt++ = AV_PIX_FMT_VDA_VLD;
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index c7a5701..d2bedbc 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1209,7 +1209,7 @@ static const enum AVPixelFormat 
mpeg2_hwaccel_pixfmt_list_420[] = {
 AV_PIX_FMT_D3D11VA_VLD,
 #endif
 #if CONFIG_MPEG2_VAAPI_HWACCEL
-AV_PIX_FMT_VAAPI_VLD,
+AV_PIX_FMT_VAAPI,
 #endif
 #if CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL
 AV_PIX_FMT_VIDEOTOOLBOX,
diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c
index 151aca9..55ee2fc 100644
--- a/libavcodec/vaapi_h264.c
+++ b/libavcodec/vaapi_h264.c
@@ -359,7 +359,7 @@ AVHWAccel ff_h264_vaapi_hwaccel = {
 .name   = "h264_vaapi",
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_H264,
-.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
+.pix_fmt= AV_PIX_FMT_VAAPI,
 .start_frame= vaapi_h264_start_frame,
 .end_frame  = vaapi_h264_end_frame,
 .decode_slice   = vaapi_h264_decode_slice,
diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c
index 87fab89..27c69cd 100644
--- a/libavcodec/vaapi_mpeg2.c
+++ b/libavcodec/vaapi_mpeg2.c
@@ -138,7 +138,7 @@ AVHWAccel ff_mpeg2_vaapi_hwaccel = {
 .name   = "mpeg2_vaapi",
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_MPEG2VIDEO,
-.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
+.pix_fmt= AV_PIX_FMT_VAAPI,
 .start_frame= vaapi_mpeg2_start_frame,
 .end_frame  = ff_vaapi_mpeg_end_frame,
 .decode_slice   = vaapi_mpeg2_decode_slice,
diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c
index 9b283f7..5b2e9d4 100644
--- a/libavcodec/vaapi_mpeg4.c
+++ b/libavcodec/vaapi_mpeg4.c
@@ -141,7 +141,7 @@ AVHWAccel ff_mpeg4_vaapi_hwaccel = {
 .name   = "mpeg4_vaapi",
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_MPEG4,
-.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
+.pix_fmt= AV_PIX_FMT_VAAPI,
 .start_frame= vaapi_mpeg4_start_frame,
 .end_frame  = ff_vaapi_mpeg_end_frame,
 .decode_slice   = vaapi_mpeg4_decode_slice,
@@ -153,7 +153,7 @@ AVHWAccel ff_h263_vaapi_hwaccel = {
 .name   = "h263_vaapi",
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_H263,
-.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
+.pix_fmt= AV_PIX_FMT_VAAPI,
 .start_frame= vaapi_mpeg4_start_frame,
 .end_frame  = ff_vaapi_mpeg_end_frame,
 .decode_slice   = vaapi_mpeg4_decode_slice,
diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c
index 7ef9f2a..63d514d 100644
--- a/libavcodec/vaapi_vc1.c
+++ b/libavcodec/vaapi_vc1.c
@@ -339,7 +339,7 @@ AVHWAccel ff_wmv3_vaapi_hwaccel = {
 .name   = "wmv3_vaapi",
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_WMV3,
-.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
+.pix_fmt= AV_PIX_FMT_VAAPI,
 .start_frame= vaapi_vc1_start_frame,
 .end_frame  = ff_vaapi_mpeg_end_frame,
 .decode_slice   = vaapi_vc1_decode_slice,
@@ -350,7 +350,7 @@ AVHWAccel ff_vc1_vaapi_hwaccel = {
 .name   = "vc1_vaapi",
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_VC1,
-.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
+.pix_fmt= AV_PIX_FMT_VAAPI,
 .start_frame= va

Re: [FFmpeg-devel] [PATCH] libx264: Add option to force IDR frames

2015-08-18 Thread Carl Eugen Hoyos
Hendrik Leppkes  gmail.com> writes:

> Whats the other reason for forcing a keyframe, ie. 
> why don't we always set IDR?

I don't know if x264 supports it (and I wanted to ask) 
but h264 reference frames can be older than the last 
I-frame (but not older than the last IDR-frame).
The I-frame is no recovery point in that case iiuc.

Carl Eugen

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


Re: [FFmpeg-devel] [PATCH] libx264: Add option to force IDR frames

2015-08-18 Thread Hendrik Leppkes
On Tue, Aug 18, 2015 at 5:15 PM, Derek Buitenhuis
 wrote:
> On 8/18/2015 4:05 PM, Hendrik Leppkes wrote:
>> Whats the other reason for forcing a keyframe, ie. why don't we always set 
>> IDR?
>
> The other reason would be seek points I guess?
>

Isn't seeking just like cutting? The decoder won't get to see any data
before the seek point.

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


Re: [FFmpeg-devel] [PATCH] 0001 - added PicTimingSSEI-libavcodec-qsvenc_h264.c

2015-08-18 Thread Carl Eugen Hoyos
Sven Dueking  gmail.com> writes:

> +q->extco.PicTimingSEI = q->pic_timing_sei == 1 ?

> OFFSET(qsv.pic_timing_sei), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX

There is a discrepancy between the possible and the used values...

I suggest you remove the "== 1" and set the max value to 1.

And there is a problem with your commit message ("0001").

Carl Eugen

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


Re: [FFmpeg-devel] [PATCH] libx264: Add option to force IDR frames

2015-08-18 Thread Derek Buitenhuis
On 8/18/2015 4:05 PM, Hendrik Leppkes wrote:
> Whats the other reason for forcing a keyframe, ie. why don't we always set 
> IDR?

The other reason would be seek points I guess?

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


Re: [FFmpeg-devel] [PATCH 3/3] lavu: comment out wrong value check in get_version() after api bump.

2015-08-18 Thread Michael Niedermayer
On Mon, Aug 17, 2015 at 05:08:01PM -0400, Ronald S. Bultje wrote:
> ---
>  libavutil/utils.c | 2 ++
>  1 file changed, 2 insertions(+)

ok

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

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle


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


Re: [FFmpeg-devel] [PATCH] libx264: Add option to force IDR frames

2015-08-18 Thread Hendrik Leppkes
On Tue, Aug 18, 2015 at 3:00 PM, Derek Buitenhuis
 wrote:
> Currently, when forcing an I frame, via API, or via the ffmpeg cli,
> using -force_key_frames, we still let x264 decide what sort of
> keyframe to user. In some cases, it is useful to be able to force
> an IDR frame, e.g. for cutting streams.
>

Whats the other reason for forcing a keyframe, ie. why don't we always set IDR?

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


[FFmpeg-devel] [PATCH] Undeprecate av_opt_set_defaults2().

2015-08-18 Thread Ronald S. Bultje
---
 libavutil/opt.c |  5 +
 libavutil/opt.h | 12 +---
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 62db1b5..580586e 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1177,20 +1177,17 @@ int av_opt_show2(void *obj, void *av_log_obj, int 
req_flags, int rej_flags)
 
 void av_opt_set_defaults(void *s)
 {
-#if FF_API_OLD_AVOPTIONS
 av_opt_set_defaults2(s, 0, 0);
 }
 
 void av_opt_set_defaults2(void *s, int mask, int flags)
 {
-#endif
 const AVOption *opt = NULL;
 while ((opt = av_opt_next(s, opt))) {
 void *dst = ((uint8_t*)s) + opt->offset;
-#if FF_API_OLD_AVOPTIONS
+
 if ((opt->flags & mask) != flags)
 continue;
-#endif
 
 if (opt->flags & AV_OPT_FLAG_READONLY)
 continue;
diff --git a/libavutil/opt.h b/libavutil/opt.h
index 481d096..4f2b46e 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -441,10 +441,16 @@ int av_opt_show2(void *obj, void *av_log_obj, int 
req_flags, int rej_flags);
  */
 void av_opt_set_defaults(void *s);
 
-#if FF_API_OLD_AVOPTIONS
-attribute_deprecated
+/**
+ * Set the values of all AVOption fields to their default values. Only these
+ * AVOption fields for which (opt->flags & mask) == flags will have their
+ * default applied to s.
+ *
+ * @param s an AVOption-enabled struct (its first member must be a pointer to 
AVClass)
+ * @param mask combination of AV_OPT_FLAG_*
+ * @param flags combination of AV_OPT_FLAG_*
+ */
 void av_opt_set_defaults2(void *s, int mask, int flags);
-#endif
 
 /**
  * Parse the key/value pairs list in opts. For each key/value pair
-- 
2.1.2

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


[FFmpeg-devel] [PATCH] 0001 - added PicTimingSSEI-libavcodec-qsvenc_h264.c

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

---
 libavcodec/qsvenc.c  | 3 +++
 libavcodec/qsvenc.h  | 1 +
 libavcodec/qsvenc_h264.c | 1 +
 3 files changed, 5 insertions(+)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index e5d3fa6..52e416c 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -146,6 +146,9 @@ static int init_video_param(AVCodecContext *avctx, 
QSVEncContext *q)
 q->extco.CAVLC= avctx->coder_type == FF_CODER_TYPE_VLC 
?
 MFX_CODINGOPTION_ON : 
MFX_CODINGOPTION_UNKNOWN;
 
+q->extco.PicTimingSEI = q->pic_timing_sei == 1 ?
+   MFX_CODINGOPTION_ON : 
MFX_CODINGOPTION_OFF;
+
 q->extparam[0] = (mfxExtBuffer *)&q->extco;
 
 q->param.ExtParam= q->extparam;
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index 19be2aa..2316488 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -61,6 +61,7 @@ typedef struct QSVEncContext {
 int preset;
 int avbr_accuracy;
 int avbr_convergence;
+int pic_timing_sei;
 
 char *load_plugins;
 } QSVEncContext;
diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
index 95396fc..bbdaa4d 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -69,6 +69,7 @@ static const AVOption options[] = {
 { "idr_interval", "Distance (in I-frames) between IDR frames", 
OFFSET(qsv.idr_interval), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
 { "avbr_accuracy","Accuracy of the AVBR ratecontrol",
OFFSET(qsv.avbr_accuracy),AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
 { "avbr_convergence", "Convergence of the AVBR ratecontrol", 
OFFSET(qsv.avbr_convergence), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
+{ "pic_timing_sei","Insert picture timing SEI with pic_struct_syntax 
element", OFFSET(qsv.pic_timing_sei), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 
INT_MAX, VE },
 
 { "profile", NULL, OFFSET(qsv.profile), AV_OPT_TYPE_INT, { .i64 = 
MFX_PROFILE_UNKNOWN }, 0, INT_MAX, VE, "profile" },
 { "unknown" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_UNKNOWN 
 }, INT_MIN, INT_MAX, VE, "profile" },
-- 
1.8.3.1

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


Re: [FFmpeg-devel] [PATCH] Replace av_dlog with ff_dlog.

2015-08-18 Thread Michael Niedermayer
On Tue, Aug 18, 2015 at 08:02:28AM -0400, Ronald S. Bultje wrote:
> ff_dlog checks compilability, and is non-public. av_dlog is deprecated
> and no longer exists if FF_API_DLOG=0.
> ---
>  ffmpeg.c |  2 +-
>  libavcodec/ccaption_dec.c| 13 +++--
>  libavcodec/libzvbi-teletextdec.c |  7 ---
>  libavcodec/proresdec2.c  |  9 +
>  libavdevice/lavfi.c  |  7 ---
>  libavdevice/v4l.c|  3 ++-
>  libavfilter/src_movie.c  |  3 ++-
>  libavfilter/vf_histeq.c  |  5 +++--
>  libavfilter/vf_palettegen.c  |  5 +++--
>  libavfilter/vf_paletteuse.c  |  3 ++-
>  libavfilter/vsrc_cellauto.c  |  3 ++-
>  libavfilter/vsrc_life.c  |  3 ++-
>  libavformat/avienc.c |  5 +++--
>  libavformat/ffmdec.c |  9 +
>  libavformat/ftp.c| 23 ---
>  libavformat/mov.c|  3 ++-
>  libavformat/mpegts.c |  3 ++-
>  libavformat/segment.c|  3 ++-
>  libavformat/swfdec.c |  3 ++-
>  19 files changed, 65 insertions(+), 47 deletions(-)

LGTM

thanks

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

Those who are best at talking, realize last or never when they are wrong.


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


Re: [FFmpeg-devel] [PATCH] configure: Use pkg-config for libkvazaar.

2015-08-18 Thread Michael Niedermayer
On Tue, Aug 18, 2015 at 08:27:51AM -0400, Ganesh Ajjanagadde wrote:
> On Tue, Aug 18, 2015 at 6:57 AM, Michael Niedermayer
>  wrote:
> > On Tue, Aug 18, 2015 at 09:04:41AM +0300, Arttu Ylä-Outinen wrote:
> >> Signed-off-by: Arttu Ylä-Outinen 
> >> ---
> >>  configure |2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/configure b/configure
> >> index 55cc7fb..3fa37b7 100755
> >> --- a/configure
> >> +++ b/configure
> >> @@ -5226,7 +5226,7 @@ enabled libgsm&& { for gsm_hdr in 
> >> "gsm.h" "gsm/gsm.h"; do
> >> check_lib "${gsm_hdr}" gsm_create 
> >> -lgsm && break;
> >> done || die "ERROR: libgsm not found"; }
> >>  enabled libilbc   && require libilbc ilbc.h 
> >> WebRtcIlbcfix_InitDecode -lilbc
> >> -enabled libkvazaar&& require2 libkvazaar kvazaar.h kvz_api_get 
> >> -lkvazaar
> >> +enabled libkvazaar&& require_pkg_config kvazaar kvazaar.h 
> >> kvz_api_get
> >>  enabled libmfx&& require_pkg_config libmfx "mfx/mfxvideo.h" 
> >> MFXInit
> >>  enabled libmodplug&& require_pkg_config libmodplug 
> >> libmodplug/modplug.h ModPlug_Load
> >>  enabled libmp3lame&& require "libmp3lame >= 3.98.3" lame/lame.h 
> >> lame_set_VBR_quality -lmp3lame
> >
> > applied
> 
> I am fine with this patch, but as per the discussion on Ticket #4197:
> https://trac.ffmpeg.org/ticket/4197#comment:29
> don't we support detection without pkg_config as a fallback?

we do for some libs


> As you can see from this, I am not in favor of unnecessary
> complication of configure,
> but there are some developers who have concerns about this.

I have no oppinon on pkg_config vs no pkg_config at all as long as it
works.

Also i think the primary question about supporting fallbacks
is if there is a volunteer to maintain such support.
If there is, there should be no objections against it. Basically all
work such fallback would cause would have to be done by whoever
volunteers to maintain it. Of course if there is a volunteer, people
should still work together and not try to cause each other extra work
and rather help.

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

What does censorship reveal? It reveals fear. -- Julian Assange


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


[FFmpeg-devel] [PATCH] libx264: Add option to force IDR frames

2015-08-18 Thread Derek Buitenhuis
Currently, when forcing an I frame, via API, or via the ffmpeg cli,
using -force_key_frames, we still let x264 decide what sort of
keyframe to user. In some cases, it is useful to be able to force
an IDR frame, e.g. for cutting streams.

Signed-off-by: Derek Buitenhuis 
---
 libavcodec/libx264.c | 5 -
 libavcodec/version.h | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index c017685..a54743e 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -82,6 +82,7 @@ typedef struct X264Context {
 int nal_hrd;
 int avcintra_class;
 int motion_est;
+int forced_idr;
 char *x264_params;
 } X264Context;
 
@@ -270,7 +271,8 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, 
const AVFrame *frame,
 
 x4->pic.i_pts  = frame->pts;
 x4->pic.i_type =
-frame->pict_type == AV_PICTURE_TYPE_I ? X264_TYPE_KEYFRAME :
+frame->pict_type == AV_PICTURE_TYPE_I ?
+(x4->forced_idr >= 0 ? X264_TYPE_IDR : 
X264_TYPE_KEYFRAME) :
 frame->pict_type == AV_PICTURE_TYPE_P ? X264_TYPE_P :
 frame->pict_type == AV_PICTURE_TYPE_B ? X264_TYPE_B :
 X264_TYPE_AUTO;
@@ -875,6 +877,7 @@ static const AVOption options[] = {
 { "umh",   NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_UMH },  
INT_MIN, INT_MAX, VE, "motion-est" },
 { "esa",   NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_ESA },  
INT_MIN, INT_MAX, VE, "motion-est" },
 { "tesa",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_TESA }, 
INT_MIN, INT_MAX, VE, "motion-est" },
+{ "forced-idr",   "If forcing keyframes, force them as IDR frames.",   
   OFFSET(forced_idr),  AV_OPT_TYPE_INT,{ .i64 = -1 
}, -1, 1, VE },
 { "x264-params",  "Override the x264 configuration using a :-separated 
list of key=value parameters", OFFSET(x264_params), AV_OPT_TYPE_STRING, { 0 }, 
0, 0, VE },
 { NULL },
 };
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 1b37a9e..2e7cf40 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -30,7 +30,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR 56
 #define LIBAVCODEC_VERSION_MINOR  57
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
-- 
1.8.3.1

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


Re: [FFmpeg-devel] [PATCH] configure: Use pkg-config for libkvazaar.

2015-08-18 Thread wm4
On Tue, 18 Aug 2015 08:27:51 -0400
Ganesh Ajjanagadde  wrote:

> On Tue, Aug 18, 2015 at 6:57 AM, Michael Niedermayer
>  wrote:
> > On Tue, Aug 18, 2015 at 09:04:41AM +0300, Arttu Ylä-Outinen wrote:
> >> Signed-off-by: Arttu Ylä-Outinen 
> >> ---
> >>  configure |2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/configure b/configure
> >> index 55cc7fb..3fa37b7 100755
> >> --- a/configure
> >> +++ b/configure
> >> @@ -5226,7 +5226,7 @@ enabled libgsm&& { for gsm_hdr in 
> >> "gsm.h" "gsm/gsm.h"; do
> >> check_lib "${gsm_hdr}" gsm_create 
> >> -lgsm && break;
> >> done || die "ERROR: libgsm not found"; }
> >>  enabled libilbc   && require libilbc ilbc.h 
> >> WebRtcIlbcfix_InitDecode -lilbc
> >> -enabled libkvazaar&& require2 libkvazaar kvazaar.h kvz_api_get 
> >> -lkvazaar
> >> +enabled libkvazaar&& require_pkg_config kvazaar kvazaar.h 
> >> kvz_api_get
> >>  enabled libmfx&& require_pkg_config libmfx "mfx/mfxvideo.h" 
> >> MFXInit
> >>  enabled libmodplug&& require_pkg_config libmodplug 
> >> libmodplug/modplug.h ModPlug_Load
> >>  enabled libmp3lame&& require "libmp3lame >= 3.98.3" lame/lame.h 
> >> lame_set_VBR_quality -lmp3lame
> >
> > applied
> 
> I am fine with this patch, but as per the discussion on Ticket #4197:
> https://trac.ffmpeg.org/ticket/4197#comment:29
> don't we support detection without pkg_config as a fallback?
> As you can see from this, I am not in favor of unnecessary
> complication of configure,
> but there are some developers who have concerns about this.

We could avoid drama this time, so just let it rest.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] configure: Use pkg-config for libkvazaar.

2015-08-18 Thread Ganesh Ajjanagadde
On Tue, Aug 18, 2015 at 6:57 AM, Michael Niedermayer
 wrote:
> On Tue, Aug 18, 2015 at 09:04:41AM +0300, Arttu Ylä-Outinen wrote:
>> Signed-off-by: Arttu Ylä-Outinen 
>> ---
>>  configure |2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/configure b/configure
>> index 55cc7fb..3fa37b7 100755
>> --- a/configure
>> +++ b/configure
>> @@ -5226,7 +5226,7 @@ enabled libgsm&& { for gsm_hdr in "gsm.h" 
>> "gsm/gsm.h"; do
>> check_lib "${gsm_hdr}" gsm_create -lgsm 
>> && break;
>> done || die "ERROR: libgsm not found"; }
>>  enabled libilbc   && require libilbc ilbc.h 
>> WebRtcIlbcfix_InitDecode -lilbc
>> -enabled libkvazaar&& require2 libkvazaar kvazaar.h kvz_api_get 
>> -lkvazaar
>> +enabled libkvazaar&& require_pkg_config kvazaar kvazaar.h 
>> kvz_api_get
>>  enabled libmfx&& require_pkg_config libmfx "mfx/mfxvideo.h" 
>> MFXInit
>>  enabled libmodplug&& require_pkg_config libmodplug 
>> libmodplug/modplug.h ModPlug_Load
>>  enabled libmp3lame&& require "libmp3lame >= 3.98.3" lame/lame.h 
>> lame_set_VBR_quality -lmp3lame
>
> applied

I am fine with this patch, but as per the discussion on Ticket #4197:
https://trac.ffmpeg.org/ticket/4197#comment:29
don't we support detection without pkg_config as a fallback?
As you can see from this, I am not in favor of unnecessary
complication of configure,
but there are some developers who have concerns about this.

>
> if you want a git write account, please send me your public ssh key
>
> thanks
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] ffserver: use -b instead of -ab for setting audio bitrate.

2015-08-18 Thread Ronald S. Bultje
---
 ffserver_config.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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

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


[FFmpeg-devel] [PATCH] Replace av_dlog with ff_dlog.

2015-08-18 Thread Ronald S. Bultje
ff_dlog checks compilability, and is non-public. av_dlog is deprecated
and no longer exists if FF_API_DLOG=0.
---
 ffmpeg.c |  2 +-
 libavcodec/ccaption_dec.c| 13 +++--
 libavcodec/libzvbi-teletextdec.c |  7 ---
 libavcodec/proresdec2.c  |  9 +
 libavdevice/lavfi.c  |  7 ---
 libavdevice/v4l.c|  3 ++-
 libavfilter/src_movie.c  |  3 ++-
 libavfilter/vf_histeq.c  |  5 +++--
 libavfilter/vf_palettegen.c  |  5 +++--
 libavfilter/vf_paletteuse.c  |  3 ++-
 libavfilter/vsrc_cellauto.c  |  3 ++-
 libavfilter/vsrc_life.c  |  3 ++-
 libavformat/avienc.c |  5 +++--
 libavformat/ffmdec.c |  9 +
 libavformat/ftp.c| 23 ---
 libavformat/mov.c|  3 ++-
 libavformat/mpegts.c |  3 ++-
 libavformat/segment.c|  3 ++-
 libavformat/swfdec.c |  3 ++-
 19 files changed, 65 insertions(+), 47 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 81f5e26..537c759 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1151,7 +1151,7 @@ static void do_video_out(AVFormatContext *s,
 ost->forced_keyframes_expr_const_values[FKF_T] = pts_time;
 res = av_expr_eval(ost->forced_keyframes_pexpr,
ost->forced_keyframes_expr_const_values, NULL);
-av_dlog(NULL, "force_key_frame: n:%f n_forced:%f prev_forced_n:%f 
t:%f prev_forced_t:%f -> res:%f\n",
+ff_dlog(NULL, "force_key_frame: n:%f n_forced:%f prev_forced_n:%f 
t:%f prev_forced_t:%f -> res:%f\n",
 ost->forced_keyframes_expr_const_values[FKF_N],
 ost->forced_keyframes_expr_const_values[FKF_N_FORCED],
 ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_N],
diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index 264d21c..9f67caa 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -21,6 +21,7 @@
 
 #include "avcodec.h"
 #include "ass.h"
+#include "libavutil/internal.h"
 #include "libavutil/opt.h"
 
 #define SCREEN_ROWS 15
@@ -451,9 +452,9 @@ static void handle_char(CCaptionSubContext *ctx, char hi, 
char lo, int64_t pts)
 ctx->prev_cmd[0] = 0;
 ctx->prev_cmd[1] = 0;
 if (lo)
-   av_dlog(ctx, "(%c,%c)\n",hi,lo);
+   ff_dlog(ctx, "(%c,%c)\n",hi,lo);
 else
-   av_dlog(ctx, "(%c)\n",hi);
+   ff_dlog(ctx, "(%c)\n",hi);
 }
 
 static int process_cc608(CCaptionSubContext *ctx, int64_t pts, uint8_t hi, 
uint8_t lo)
@@ -493,21 +494,21 @@ static int process_cc608(CCaptionSubContext *ctx, int64_t 
pts, uint8_t hi, uint8
 ret = handle_edm(ctx, pts);
 } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x2D ) {
 /* carriage return */
-av_dlog(ctx, "carriage return\n");
+ff_dlog(ctx, "carriage return\n");
 reap_screen(ctx, pts);
 roll_up(ctx);
 ctx->screen_changed = 1;
 ctx->cursor_column = 0;
 } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x2F ) {
 /* end of caption */
-av_dlog(ctx, "handle_eoc\n");
+ff_dlog(ctx, "handle_eoc\n");
 ret = handle_eoc(ctx, pts);
 } else if (hi>=0x20) {
 /* Standard characters (always in pairs) */
 handle_char(ctx, hi, lo, pts);
 } else {
 /* Ignoring all other non data code */
-av_dlog(ctx, "Unknown command 0x%hhx 0x%hhx\n", hi, lo);
+ff_dlog(ctx, "Unknown command 0x%hhx 0x%hhx\n", hi, lo);
 }
 
 /* set prev command */
@@ -553,7 +554,7 @@ static int decode(AVCodecContext *avctx, void *data, int 
*got_sub, AVPacket *avp
 {
 int start_time = av_rescale_q(ctx->start_time, avctx->time_base, 
(AVRational){ 1, 100 });
 int end_time = av_rescale_q(ctx->end_time, avctx->time_base, 
(AVRational){ 1, 100 });
-av_dlog(ctx, "cdp writing data (%s)\n",ctx->buffer.str);
+ff_dlog(ctx, "cdp writing data (%s)\n",ctx->buffer.str);
 ret = ff_ass_add_rect_bprint(sub, &ctx->buffer, start_time, 
end_time - start_time);
 if (ret < 0)
 return ret;
diff --git a/libavcodec/libzvbi-teletextdec.c b/libavcodec/libzvbi-teletextdec.c
index 32d983c..3733d88 100644
--- a/libavcodec/libzvbi-teletextdec.c
+++ b/libavcodec/libzvbi-teletextdec.c
@@ -22,6 +22,7 @@
 #include "libavcodec/ass.h"
 #include "libavutil/opt.h"
 #include "libavutil/bprint.h"
+#include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/log.h"
 
@@ -274,7 +275,7 @@ static int gen_sub_bitmap(TeletextContext *ctx, 
AVSubtitleRect *sub_rect, vbi_pa
 b = VBI_B(page->color_map[ci]);
 a = VBI_A(page->color_map[ci]);
 ((uint32_t *)sub_rect->pict.data[1])[ci] = RGBA(r, g, b, a);
-av_dlog(ctx, "palette %0x\n", ((uint32_t 
*)sub_rect->pict.data[1])[ci]);
+ff_dlog(ctx, "palette %0x\n", ((uint32_t 
*)sub_rect->pict

Re: [FFmpeg-devel] [PATCH] lavfi: add error message to help users convert to new lavfi syntax.

2015-08-18 Thread Michael Niedermayer
On Mon, Aug 17, 2015 at 08:05:05PM -0400, Ronald S. Bultje wrote:
> ---
>  libavfilter/avfilter.c | 13 -
>  libavfilter/version.h  |  3 +++
>  2 files changed, 15 insertions(+), 1 deletion(-)

LGTM

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

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates


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


Re: [FFmpeg-devel] [PATCH 3/3] Replace av_dlog with ff_dlog.

2015-08-18 Thread Michael Niedermayer
On Mon, Aug 17, 2015 at 08:45:53PM -0400, Ronald S. Bultje wrote:
> ff_dlog checks compilability, and is non-public. av_dlog is deprecated
> and no longer exists if FF_API_DLOG=0.
> ---
>  ffmpeg.c|  2 +-
>  libavcodec/ccaption_dec.c   | 13 +++--
>  libavcodec/proresdec2.c |  9 +
>  libavdevice/lavfi.c |  7 ---
>  libavfilter/src_movie.c |  3 ++-
>  libavfilter/vf_palettegen.c |  5 +++--
>  libavfilter/vf_paletteuse.c |  3 ++-
>  libavfilter/vsrc_cellauto.c |  3 ++-
>  libavfilter/vsrc_life.c |  3 ++-
>  libavformat/avienc.c|  5 +++--
>  libavformat/ffmdec.c|  9 +
>  libavformat/ftp.c   | 23 ---
>  libavformat/mov.c   |  3 ++-
>  libavformat/mpegts.c|  3 ++-
>  libavformat/segment.c   |  3 ++-
>  libavformat/swfdec.c|  3 ++-
>  16 files changed, 56 insertions(+), 41 deletions(-)

the patch LGTM but
This is missing some av_dlog()
libavcodec/libzvbi-teletextdec.c:av_dlog(ctx, "palette %0x\n", 
((uint32_t *)sub_rect->pict.data[1])[ci]);
libavcodec/libzvbi-teletextdec.c:av_dlog(avctx, "ctx=%p buf_size=%d 
lines=%u pkt_pts=%7.3f\n",
libavcodec/libzvbi-teletextdec.c:av_dlog(avctx, "lines_total=%u\n", 
ctx->lines_processed);
libavdevice/v4l.c:av_dlog(s1, "v4l: colour=%d hue=%d brightness=%d 
constrast=%d whiteness=%d\n",
libavfilter/vf_histeq.c:av_dlog(ctx, "in[%d]: %u\n", x, 
histeq->in_histogram[x]);
libavfilter/vf_histeq.c:av_dlog(ctx, "out[%d]: %u\n", x, 
histeq->out_histogram[x]);

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

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


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


Re: [FFmpeg-devel] [PATCH] configure: Use pkg-config for libkvazaar.

2015-08-18 Thread Michael Niedermayer
On Tue, Aug 18, 2015 at 09:04:41AM +0300, Arttu Ylä-Outinen wrote:
> Signed-off-by: Arttu Ylä-Outinen 
> ---
>  configure |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 55cc7fb..3fa37b7 100755
> --- a/configure
> +++ b/configure
> @@ -5226,7 +5226,7 @@ enabled libgsm&& { for gsm_hdr in "gsm.h" 
> "gsm/gsm.h"; do
> check_lib "${gsm_hdr}" gsm_create -lgsm 
> && break;
> done || die "ERROR: libgsm not found"; }
>  enabled libilbc   && require libilbc ilbc.h WebRtcIlbcfix_InitDecode 
> -lilbc
> -enabled libkvazaar&& require2 libkvazaar kvazaar.h kvz_api_get 
> -lkvazaar
> +enabled libkvazaar&& require_pkg_config kvazaar kvazaar.h kvz_api_get
>  enabled libmfx&& require_pkg_config libmfx "mfx/mfxvideo.h" 
> MFXInit
>  enabled libmodplug&& require_pkg_config libmodplug 
> libmodplug/modplug.h ModPlug_Load
>  enabled libmp3lame&& require "libmp3lame >= 3.98.3" lame/lame.h 
> lame_set_VBR_quality -lmp3lame

applied

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

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] [PATCH 3/6] lavc: deprecate -ab as part of FF_API_OLD_AVOPTIONS.

2015-08-18 Thread wm4
On Tue, 18 Aug 2015 03:56:21 +0200
Michael Niedermayer  wrote:

> On Mon, Aug 17, 2015 at 01:38:19PM -0400, Ronald S. Bultje wrote:
> > Hi,
> > 
> > On Mon, Aug 17, 2015 at 1:12 PM, Michael Niedermayer  > > wrote:
> > 
> > > On Mon, Aug 17, 2015 at 11:52:16AM -0400, Ronald S. Bultje wrote:
> > > > ---
> > > >  libavcodec/options_table.h | 2 ++
> > > >  1 file changed, 2 insertions(+)
> > >
> > > googling for
> > > ffmpeg "-ab"
> > > has 332.000 matches
> > >
> > > ffmpeg "-b:a"
> > > has 64.100 matches
> > >
> > > this patch is simply a bad idea
> > 
> > 
> > So, there's a few practical problems here. A) if we remove flag/mask from
> > the set_defaults calls (other patch in this set), the audio is also used
> > for the video ones (since we ignore media type), and thus we use (after
> > FF_API_OLD_AVOPTIONS is 0) the audio bitrate as default for video also.
> > That's bad, and causes some fate failures. We can workaround that by
> > inverting the ordering of these two, but then, the general one _always_
> > (even before FF_API_OLD_AVOPTIONS=0) takes precedence over the audio one,
> > so all fate results without explicit bitrate change from ab=128k to
> > ab=200k. (I'm working around that by making each fate test set bitrate
> > explicit where relevant.)
> > 
> 
> > Alternate suggestion: I don't mind if -ab gets a workaround in ffmpeg.c,
> > but I'd like to remove it from the libav* code.
> 
> ffserver seems to have "ab" hardcoded in
> ffserver_config.c
> this will need some change too, i dont know the code so i dont know
> what needs to be done / if a simple change to "b" is sufficient
> it seems to work with "b" better than with "ab" though after
> FF_API_OLD_AVOPTIONS=0)

Feel free to send a patch. Barely anyone here cares about ffserver.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] */version.h: Add note/recommandition about bumping major

2015-08-18 Thread Michael Niedermayer
From: Michael Niedermayer 

If preferred, i can also apply this after the bump, in case its felt that
this would cause too much delay/work

Signed-off-by: Michael Niedermayer 
---
 libavcodec/version.h  |4 
 libavformat/version.h |5 +
 libavutil/version.h   |4 
 3 files changed, 13 insertions(+)

diff --git a/libavcodec/version.h b/libavcodec/version.h
index 1b37a9e..cf9c924 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -46,6 +46,10 @@
  * FF_API_* defines may be placed below to indicate public API that will be
  * dropped at a future version bump. The defines themselves are not part of
  * the public API and may change, break or disappear at any time.
+ *
+ * @note, when bumping the major version it is recommandeded to manually
+ * disable each FF_API_* in its own commit instead of disabling them all
+ * at once through the bump. This improves the git bissect-ability of the 
change.
  */
 
 #ifndef FF_API_VIMA_DECODER
diff --git a/libavformat/version.h b/libavformat/version.h
index 3ddba0c..e2b4b95 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -47,6 +47,11 @@
  * FF_API_* defines may be placed below to indicate public API that will be
  * dropped at a future version bump. The defines themselves are not part of
  * the public API and may change, break or disappear at any time.
+ *
+ * @note, when bumping the major version it is recommandeded to manually
+ * disable each FF_API_* in its own commit instead of disabling them all
+ * at once through the bump. This improves the git bissect-ability of the 
change.
+ *
  */
 #ifndef FF_API_LAVF_BITEXACT
 #define FF_API_LAVF_BITEXACT(LIBAVFORMAT_VERSION_MAJOR < 57)
diff --git a/libavutil/version.h b/libavutil/version.h
index 653f530..c0b13c6 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -77,6 +77,10 @@
  * dropped at a future version bump. The defines themselves are not part of
  * the public API and may change, break or disappear at any time.
  *
+ * @note, when bumping the major version it is recommandeded to manually
+ * disable each FF_API_* in its own commit instead of disabling them all
+ * at once through the bump. This improves the git bissect-ability of the 
change.
+ *
  * @{
  */
 
-- 
1.7.9.5

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


Re: [FFmpeg-devel] [PATCH] configure: Use pkg-config for libkvazaar.

2015-08-18 Thread wm4
On Tue, 18 Aug 2015 09:04:41 +0300
Arttu Ylä-Outinen  wrote:

> Signed-off-by: Arttu Ylä-Outinen 
> ---
>  configure |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 55cc7fb..3fa37b7 100755
> --- a/configure
> +++ b/configure
> @@ -5226,7 +5226,7 @@ enabled libgsm&& { for gsm_hdr in "gsm.h" 
> "gsm/gsm.h"; do
> check_lib "${gsm_hdr}" gsm_create -lgsm 
> && break;
> done || die "ERROR: libgsm not found"; }
>  enabled libilbc   && require libilbc ilbc.h WebRtcIlbcfix_InitDecode 
> -lilbc
> -enabled libkvazaar&& require2 libkvazaar kvazaar.h kvz_api_get 
> -lkvazaar
> +enabled libkvazaar&& require_pkg_config kvazaar kvazaar.h kvz_api_get
>  enabled libmfx&& require_pkg_config libmfx "mfx/mfxvideo.h" 
> MFXInit
>  enabled libmodplug&& require_pkg_config libmodplug 
> libmodplug/modplug.h ModPlug_Load
>  enabled libmp3lame&& require "libmp3lame >= 3.98.3" lame/lame.h 
> lame_set_VBR_quality -lmp3lame

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


Re: [FFmpeg-devel] [PATCH 4/4] vaapi: add interfaces to properly initialize context.

2015-08-18 Thread wm4
On Tue, 18 Aug 2015 10:33:20 +0200
Gwenole Beauchesne  wrote:

> Hi,
> 
> 2015-08-17 22:26 GMT+02:00 wm4 :
> > On Mon, 17 Aug 2015 19:17:53 +0200
> > Gwenole Beauchesne  wrote:
> >
> >> Add av_vaapi_context_init() and av_vaapi_context_alloc() helper functions
> >> so that to properly initialize the vaapi_context structure, and allow for
> >> future extensions without breaking the API/ABI.
> >>
> >> The new version and flags fields are inserted after the last known user
> >> initialized field, and actually useful field at all, i.e. VA context_id.
> >> This is safe because the vaapi_context structure was required to be zero
> >> initialized in the past. And, since those new helper functions and changes
> >> cause the AV_VAAPI_CONTEXT_VERSION to be bumped, we can track older struct
> >> requirements from within libavcodec.
> >>
> >> Besides, it is now required by design, and actual usage, that the vaapi
> >> context structure be completely initialized once and for all before the
> >> AVCodecContext.get_format() function ever completes.
> >>
> >> Signed-off-by: Gwenole Beauchesne 
> >> ---
> >>  libavcodec/vaapi.c  | 30 +++
> >>  libavcodec/vaapi.h  | 59 
> >> +
> >>  libavcodec/vaapi_internal.h |  1 +
> >>  3 files changed, 85 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/libavcodec/vaapi.c b/libavcodec/vaapi.c
> >> index 1ae71a5..4d3e2f3 100644
> >> --- a/libavcodec/vaapi.c
> >> +++ b/libavcodec/vaapi.c
> >> @@ -41,11 +41,41 @@ static void destroy_buffers(VADisplay display, 
> >> VABufferID *buffers, unsigned int
> >>  }
> >>  }
> >>
> >> +/* Allocates a vaapi_context structure */
> >> +struct vaapi_context *av_vaapi_context_alloc(unsigned int flags)
> >> +{
> >> +struct vaapi_context *vactx;
> >> +
> >> +vactx = av_malloc(sizeof(*vactx));
> >> +if (!vactx)
> >> +return NULL;
> >> +
> >> +av_vaapi_context_init(vactx, AV_VAAPI_CONTEXT_VERSION, flags);
> >> +return vactx;
> >> +}
> >> +
> >> +/* Initializes a vaapi_context structure with safe defaults */
> >> +void av_vaapi_context_init(struct vaapi_context *vactx, unsigned int 
> >> version,
> >> +   unsigned int flags)
> >> +{
> >> +vactx->display  = NULL;
> >> +vactx->config_id= VA_INVALID_ID;
> >> +vactx->context_id   = VA_INVALID_ID;
> >> +
> >> +if (version > 0) {
> >> +vactx->version  = version;
> >> +vactx->flags= flags;
> >> +}
> >> +}
> >> +
> >>  int ff_vaapi_context_init(AVCodecContext *avctx)
> >>  {
> >>  FFVAContext * const vactx = ff_vaapi_get_context(avctx);
> >>  const struct vaapi_context * const user_vactx = 
> >> avctx->hwaccel_context;
> >>
> >> +if (user_vactx->version > 0)
> >> +vactx->flags= user_vactx->flags;
> >> +
> >>  vactx->display  = user_vactx->display;
> >>  vactx->config_id= user_vactx->config_id;
> >>  vactx->context_id   = user_vactx->context_id;
> >> diff --git a/libavcodec/vaapi.h b/libavcodec/vaapi.h
> >> index 4448a2e..1f032a0 100644
> >> --- a/libavcodec/vaapi.h
> >> +++ b/libavcodec/vaapi.h
> >> @@ -40,14 +40,16 @@
> >>   * @{
> >>   */
> >>
> >> +#define AV_VAAPI_CONTEXT_VERSION 1
> >> +
> >>  /**
> >>   * This structure is used to share data between the FFmpeg library and
> >>   * the client video application.
> >> - * This shall be zero-allocated and available as
> >> - * AVCodecContext.hwaccel_context. All user members can be set once
> >> - * during initialization or through each AVCodecContext.get_buffer()
> >> - * function call. In any case, they must be valid prior to calling
> >> - * decoding functions.
> >> + *
> >> + * This shall be initialized with av_vaapi_context_init(), or
> >> + * indirectly through av_vaapi_context_alloc(), and made available as
> >> + * AVCodecContext.hwaccel_context. All user members must be properly
> >> + * initialized before AVCodecContext.get_format() completes.
> >>   */
> >>  struct vaapi_context {
> >>  /**
> >> @@ -74,6 +76,29 @@ struct vaapi_context {
> >>   */
> >>  uint32_t context_id;
> >>
> >> +/**
> >> + * This field must be set to AV_VAAPI_CONTEXT_VERSION
> >> + *
> >> + * @since Version 1.
> >> + *
> >> + * - encoding: unused
> >> + * - decoding: Set by user, through av_vaapi_context_init()
> >> + */
> >> +unsigned int version;
> >
> > Not sure if I see any point in this. Normally, backwards-compatible ABI
> > additions can add fields in FFmpeg, but the API user doesn't get a way
> > to check whether a field is really there.
> >
> > Or in other words, the level of ABI compatibility we target is that
> > newer libav* libs work with old application binaries, but not the other
> > way around.
> 
> Yes, and I have reasons to see why this mechanism is needed.
> 
> Imagine some old application binaries doesn't allocate the context
> through the supplied helper fun

Re: [FFmpeg-devel] [PATCH 1/4] vaapi: define a single pixel format for VA-API (AV_PIX_FMT_VAAPI).

2015-08-18 Thread Gwenole Beauchesne
Hi,

2015-08-18 10:43 GMT+02:00 Hendrik Leppkes :
> On Tue, Aug 18, 2015 at 10:35 AM, Gwenole Beauchesne  
> wrote:
>> 2015-08-17 21:53 GMT+02:00 wm4 :
>>> On Mon, 17 Aug 2015 19:17:50 +0200
>>> Gwenole Beauchesne  wrote:
>>>
 Deprecate older VA pixel formats (MOCO, IDCT) as it is now very unlikely
 to ever be useful in the future. Only keep plain AV_PIX_FMT_VAAPI format
 that is aliased to the older VLD variant.

 Signed-off-by: Gwenole Beauchesne 
 ---
  libavcodec/h263dec.c |  2 +-
  libavcodec/h264_slice.c  |  2 +-
  libavcodec/mpeg12dec.c   |  2 +-
  libavcodec/vaapi_h264.c  |  2 +-
  libavcodec/vaapi_mpeg2.c |  2 +-
  libavcodec/vaapi_mpeg4.c |  4 ++--
  libavcodec/vaapi_vc1.c   |  4 ++--
  libavcodec/vc1dec.c  |  2 +-
  libavutil/pixdesc.c  |  9 +
  libavutil/pixfmt.h   | 11 +++
  libavutil/version.h  |  3 +++
  11 files changed, 33 insertions(+), 10 deletions(-)

 diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
 index 7fa7090..e647e40 100644
 --- a/libavcodec/h263dec.c
 +++ b/libavcodec/h263dec.c
 @@ -718,7 +718,7 @@ frame_end:

  const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[] = {
  #if CONFIG_H263_VAAPI_HWACCEL || CONFIG_MPEG4_VAAPI_HWACCEL
 -AV_PIX_FMT_VAAPI_VLD,
 +AV_PIX_FMT_VAAPI,
  #endif
  #if CONFIG_H263_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL
  AV_PIX_FMT_VDPAU,
 diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
 index 48f501b..7b35c08 100644
 --- a/libavcodec/h264_slice.c
 +++ b/libavcodec/h264_slice.c
 @@ -943,7 +943,7 @@ static enum AVPixelFormat get_pixel_format(H264Context 
 *h, int force_callback)
  *fmt++ = AV_PIX_FMT_D3D11VA_VLD;
  #endif
  #if CONFIG_H264_VAAPI_HWACCEL
 -*fmt++ = AV_PIX_FMT_VAAPI_VLD;
 +*fmt++ = AV_PIX_FMT_VAAPI;
  #endif
  #if CONFIG_H264_VDA_HWACCEL
  *fmt++ = AV_PIX_FMT_VDA_VLD;
 diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
 index c7a5701..d2bedbc 100644
 --- a/libavcodec/mpeg12dec.c
 +++ b/libavcodec/mpeg12dec.c
 @@ -1209,7 +1209,7 @@ static const enum AVPixelFormat 
 mpeg2_hwaccel_pixfmt_list_420[] = {
  AV_PIX_FMT_D3D11VA_VLD,
  #endif
  #if CONFIG_MPEG2_VAAPI_HWACCEL
 -AV_PIX_FMT_VAAPI_VLD,
 +AV_PIX_FMT_VAAPI,
  #endif
  #if CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL
  AV_PIX_FMT_VIDEOTOOLBOX,
 diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c
 index 151aca9..55ee2fc 100644
 --- a/libavcodec/vaapi_h264.c
 +++ b/libavcodec/vaapi_h264.c
 @@ -359,7 +359,7 @@ AVHWAccel ff_h264_vaapi_hwaccel = {
  .name   = "h264_vaapi",
  .type   = AVMEDIA_TYPE_VIDEO,
  .id = AV_CODEC_ID_H264,
 -.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
 +.pix_fmt= AV_PIX_FMT_VAAPI,
  .start_frame= vaapi_h264_start_frame,
  .end_frame  = vaapi_h264_end_frame,
  .decode_slice   = vaapi_h264_decode_slice,
 diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c
 index 87fab89..27c69cd 100644
 --- a/libavcodec/vaapi_mpeg2.c
 +++ b/libavcodec/vaapi_mpeg2.c
 @@ -138,7 +138,7 @@ AVHWAccel ff_mpeg2_vaapi_hwaccel = {
  .name   = "mpeg2_vaapi",
  .type   = AVMEDIA_TYPE_VIDEO,
  .id = AV_CODEC_ID_MPEG2VIDEO,
 -.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
 +.pix_fmt= AV_PIX_FMT_VAAPI,
  .start_frame= vaapi_mpeg2_start_frame,
  .end_frame  = ff_vaapi_mpeg_end_frame,
  .decode_slice   = vaapi_mpeg2_decode_slice,
 diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c
 index 9b283f7..5b2e9d4 100644
 --- a/libavcodec/vaapi_mpeg4.c
 +++ b/libavcodec/vaapi_mpeg4.c
 @@ -141,7 +141,7 @@ AVHWAccel ff_mpeg4_vaapi_hwaccel = {
  .name   = "mpeg4_vaapi",
  .type   = AVMEDIA_TYPE_VIDEO,
  .id = AV_CODEC_ID_MPEG4,
 -.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
 +.pix_fmt= AV_PIX_FMT_VAAPI,
  .start_frame= vaapi_mpeg4_start_frame,
  .end_frame  = ff_vaapi_mpeg_end_frame,
  .decode_slice   = vaapi_mpeg4_decode_slice,
 @@ -153,7 +153,7 @@ AVHWAccel ff_h263_vaapi_hwaccel = {
  .name   = "h263_vaapi",
  .type   = AVMEDIA_TYPE_VIDEO,
  .id = AV_CODEC_ID_H263,
 -.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
 +.pix_fmt= AV_PIX_FMT_VAAPI,
  .start_frame= vaapi_mpeg4_start_frame,
  .end_frame  = ff_vaapi_mpeg_end_frame,
  .decode_slice   = vaapi_mpeg4_decode_slice,
 diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c
 index 

Re: [FFmpeg-devel] [PATCH 1/4] vaapi: define a single pixel format for VA-API (AV_PIX_FMT_VAAPI).

2015-08-18 Thread Hendrik Leppkes
On Tue, Aug 18, 2015 at 10:35 AM, Gwenole Beauchesne  wrote:
> 2015-08-17 21:53 GMT+02:00 wm4 :
>> On Mon, 17 Aug 2015 19:17:50 +0200
>> Gwenole Beauchesne  wrote:
>>
>>> Deprecate older VA pixel formats (MOCO, IDCT) as it is now very unlikely
>>> to ever be useful in the future. Only keep plain AV_PIX_FMT_VAAPI format
>>> that is aliased to the older VLD variant.
>>>
>>> Signed-off-by: Gwenole Beauchesne 
>>> ---
>>>  libavcodec/h263dec.c |  2 +-
>>>  libavcodec/h264_slice.c  |  2 +-
>>>  libavcodec/mpeg12dec.c   |  2 +-
>>>  libavcodec/vaapi_h264.c  |  2 +-
>>>  libavcodec/vaapi_mpeg2.c |  2 +-
>>>  libavcodec/vaapi_mpeg4.c |  4 ++--
>>>  libavcodec/vaapi_vc1.c   |  4 ++--
>>>  libavcodec/vc1dec.c  |  2 +-
>>>  libavutil/pixdesc.c  |  9 +
>>>  libavutil/pixfmt.h   | 11 +++
>>>  libavutil/version.h  |  3 +++
>>>  11 files changed, 33 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
>>> index 7fa7090..e647e40 100644
>>> --- a/libavcodec/h263dec.c
>>> +++ b/libavcodec/h263dec.c
>>> @@ -718,7 +718,7 @@ frame_end:
>>>
>>>  const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[] = {
>>>  #if CONFIG_H263_VAAPI_HWACCEL || CONFIG_MPEG4_VAAPI_HWACCEL
>>> -AV_PIX_FMT_VAAPI_VLD,
>>> +AV_PIX_FMT_VAAPI,
>>>  #endif
>>>  #if CONFIG_H263_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL
>>>  AV_PIX_FMT_VDPAU,
>>> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
>>> index 48f501b..7b35c08 100644
>>> --- a/libavcodec/h264_slice.c
>>> +++ b/libavcodec/h264_slice.c
>>> @@ -943,7 +943,7 @@ static enum AVPixelFormat get_pixel_format(H264Context 
>>> *h, int force_callback)
>>>  *fmt++ = AV_PIX_FMT_D3D11VA_VLD;
>>>  #endif
>>>  #if CONFIG_H264_VAAPI_HWACCEL
>>> -*fmt++ = AV_PIX_FMT_VAAPI_VLD;
>>> +*fmt++ = AV_PIX_FMT_VAAPI;
>>>  #endif
>>>  #if CONFIG_H264_VDA_HWACCEL
>>>  *fmt++ = AV_PIX_FMT_VDA_VLD;
>>> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
>>> index c7a5701..d2bedbc 100644
>>> --- a/libavcodec/mpeg12dec.c
>>> +++ b/libavcodec/mpeg12dec.c
>>> @@ -1209,7 +1209,7 @@ static const enum AVPixelFormat 
>>> mpeg2_hwaccel_pixfmt_list_420[] = {
>>>  AV_PIX_FMT_D3D11VA_VLD,
>>>  #endif
>>>  #if CONFIG_MPEG2_VAAPI_HWACCEL
>>> -AV_PIX_FMT_VAAPI_VLD,
>>> +AV_PIX_FMT_VAAPI,
>>>  #endif
>>>  #if CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL
>>>  AV_PIX_FMT_VIDEOTOOLBOX,
>>> diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c
>>> index 151aca9..55ee2fc 100644
>>> --- a/libavcodec/vaapi_h264.c
>>> +++ b/libavcodec/vaapi_h264.c
>>> @@ -359,7 +359,7 @@ AVHWAccel ff_h264_vaapi_hwaccel = {
>>>  .name   = "h264_vaapi",
>>>  .type   = AVMEDIA_TYPE_VIDEO,
>>>  .id = AV_CODEC_ID_H264,
>>> -.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
>>> +.pix_fmt= AV_PIX_FMT_VAAPI,
>>>  .start_frame= vaapi_h264_start_frame,
>>>  .end_frame  = vaapi_h264_end_frame,
>>>  .decode_slice   = vaapi_h264_decode_slice,
>>> diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c
>>> index 87fab89..27c69cd 100644
>>> --- a/libavcodec/vaapi_mpeg2.c
>>> +++ b/libavcodec/vaapi_mpeg2.c
>>> @@ -138,7 +138,7 @@ AVHWAccel ff_mpeg2_vaapi_hwaccel = {
>>>  .name   = "mpeg2_vaapi",
>>>  .type   = AVMEDIA_TYPE_VIDEO,
>>>  .id = AV_CODEC_ID_MPEG2VIDEO,
>>> -.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
>>> +.pix_fmt= AV_PIX_FMT_VAAPI,
>>>  .start_frame= vaapi_mpeg2_start_frame,
>>>  .end_frame  = ff_vaapi_mpeg_end_frame,
>>>  .decode_slice   = vaapi_mpeg2_decode_slice,
>>> diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c
>>> index 9b283f7..5b2e9d4 100644
>>> --- a/libavcodec/vaapi_mpeg4.c
>>> +++ b/libavcodec/vaapi_mpeg4.c
>>> @@ -141,7 +141,7 @@ AVHWAccel ff_mpeg4_vaapi_hwaccel = {
>>>  .name   = "mpeg4_vaapi",
>>>  .type   = AVMEDIA_TYPE_VIDEO,
>>>  .id = AV_CODEC_ID_MPEG4,
>>> -.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
>>> +.pix_fmt= AV_PIX_FMT_VAAPI,
>>>  .start_frame= vaapi_mpeg4_start_frame,
>>>  .end_frame  = ff_vaapi_mpeg_end_frame,
>>>  .decode_slice   = vaapi_mpeg4_decode_slice,
>>> @@ -153,7 +153,7 @@ AVHWAccel ff_h263_vaapi_hwaccel = {
>>>  .name   = "h263_vaapi",
>>>  .type   = AVMEDIA_TYPE_VIDEO,
>>>  .id = AV_CODEC_ID_H263,
>>> -.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
>>> +.pix_fmt= AV_PIX_FMT_VAAPI,
>>>  .start_frame= vaapi_mpeg4_start_frame,
>>>  .end_frame  = ff_vaapi_mpeg_end_frame,
>>>  .decode_slice   = vaapi_mpeg4_decode_slice,
>>> diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c
>>> index 7ef9f2a..63d514d 100644
>>> --- a/libavcodec/vaapi_vc1.c
>>> +++ b/libavcodec/vaapi_vc1.c
>>> @@ -339,7 +339,7 @@ AVHWAccel ff_wmv3_vaapi_hwaccel = {
>>>  .name 

Re: [FFmpeg-devel] [PATCH 4/4] vaapi: add interfaces to properly initialize context.

2015-08-18 Thread Hendrik Leppkes
On Tue, Aug 18, 2015 at 10:33 AM, Gwenole Beauchesne  wrote:
> Hi,
>
> 2015-08-17 22:26 GMT+02:00 wm4 :
>> On Mon, 17 Aug 2015 19:17:53 +0200
>> Gwenole Beauchesne  wrote:
>>
>>> Add av_vaapi_context_init() and av_vaapi_context_alloc() helper functions
>>> so that to properly initialize the vaapi_context structure, and allow for
>>> future extensions without breaking the API/ABI.
>>>
>>> The new version and flags fields are inserted after the last known user
>>> initialized field, and actually useful field at all, i.e. VA context_id.
>>> This is safe because the vaapi_context structure was required to be zero
>>> initialized in the past. And, since those new helper functions and changes
>>> cause the AV_VAAPI_CONTEXT_VERSION to be bumped, we can track older struct
>>> requirements from within libavcodec.
>>>
>>> Besides, it is now required by design, and actual usage, that the vaapi
>>> context structure be completely initialized once and for all before the
>>> AVCodecContext.get_format() function ever completes.
>>>
>>> Signed-off-by: Gwenole Beauchesne 
>>> ---
>>>  libavcodec/vaapi.c  | 30 +++
>>>  libavcodec/vaapi.h  | 59 
>>> +
>>>  libavcodec/vaapi_internal.h |  1 +
>>>  3 files changed, 85 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/libavcodec/vaapi.c b/libavcodec/vaapi.c
>>> index 1ae71a5..4d3e2f3 100644
>>> --- a/libavcodec/vaapi.c
>>> +++ b/libavcodec/vaapi.c
>>> @@ -41,11 +41,41 @@ static void destroy_buffers(VADisplay display, 
>>> VABufferID *buffers, unsigned int
>>>  }
>>>  }
>>>
>>> +/* Allocates a vaapi_context structure */
>>> +struct vaapi_context *av_vaapi_context_alloc(unsigned int flags)
>>> +{
>>> +struct vaapi_context *vactx;
>>> +
>>> +vactx = av_malloc(sizeof(*vactx));
>>> +if (!vactx)
>>> +return NULL;
>>> +
>>> +av_vaapi_context_init(vactx, AV_VAAPI_CONTEXT_VERSION, flags);
>>> +return vactx;
>>> +}
>>> +
>>> +/* Initializes a vaapi_context structure with safe defaults */
>>> +void av_vaapi_context_init(struct vaapi_context *vactx, unsigned int 
>>> version,
>>> +   unsigned int flags)
>>> +{
>>> +vactx->display  = NULL;
>>> +vactx->config_id= VA_INVALID_ID;
>>> +vactx->context_id   = VA_INVALID_ID;
>>> +
>>> +if (version > 0) {
>>> +vactx->version  = version;
>>> +vactx->flags= flags;
>>> +}
>>> +}
>>> +
>>>  int ff_vaapi_context_init(AVCodecContext *avctx)
>>>  {
>>>  FFVAContext * const vactx = ff_vaapi_get_context(avctx);
>>>  const struct vaapi_context * const user_vactx = avctx->hwaccel_context;
>>>
>>> +if (user_vactx->version > 0)
>>> +vactx->flags= user_vactx->flags;
>>> +
>>>  vactx->display  = user_vactx->display;
>>>  vactx->config_id= user_vactx->config_id;
>>>  vactx->context_id   = user_vactx->context_id;
>>> diff --git a/libavcodec/vaapi.h b/libavcodec/vaapi.h
>>> index 4448a2e..1f032a0 100644
>>> --- a/libavcodec/vaapi.h
>>> +++ b/libavcodec/vaapi.h
>>> @@ -40,14 +40,16 @@
>>>   * @{
>>>   */
>>>
>>> +#define AV_VAAPI_CONTEXT_VERSION 1
>>> +
>>>  /**
>>>   * This structure is used to share data between the FFmpeg library and
>>>   * the client video application.
>>> - * This shall be zero-allocated and available as
>>> - * AVCodecContext.hwaccel_context. All user members can be set once
>>> - * during initialization or through each AVCodecContext.get_buffer()
>>> - * function call. In any case, they must be valid prior to calling
>>> - * decoding functions.
>>> + *
>>> + * This shall be initialized with av_vaapi_context_init(), or
>>> + * indirectly through av_vaapi_context_alloc(), and made available as
>>> + * AVCodecContext.hwaccel_context. All user members must be properly
>>> + * initialized before AVCodecContext.get_format() completes.
>>>   */
>>>  struct vaapi_context {
>>>  /**
>>> @@ -74,6 +76,29 @@ struct vaapi_context {
>>>   */
>>>  uint32_t context_id;
>>>
>>> +/**
>>> + * This field must be set to AV_VAAPI_CONTEXT_VERSION
>>> + *
>>> + * @since Version 1.
>>> + *
>>> + * - encoding: unused
>>> + * - decoding: Set by user, through av_vaapi_context_init()
>>> + */
>>> +unsigned int version;
>>
>> Not sure if I see any point in this. Normally, backwards-compatible ABI
>> additions can add fields in FFmpeg, but the API user doesn't get a way
>> to check whether a field is really there.
>>
>> Or in other words, the level of ABI compatibility we target is that
>> newer libav* libs work with old application binaries, but not the other
>> way around.
>
> Yes, and I have reasons to see why this mechanism is needed.
>
> Imagine some old application binaries doesn't allocate the context
> through the supplied helper functions. Without knowing the original
> layout of the user supplied vaapi_context, we could be in a situation
> where we read past th

Re: [FFmpeg-devel] [PATCH 1/4] vaapi: define a single pixel format for VA-API (AV_PIX_FMT_VAAPI).

2015-08-18 Thread Gwenole Beauchesne
2015-08-17 21:53 GMT+02:00 wm4 :
> On Mon, 17 Aug 2015 19:17:50 +0200
> Gwenole Beauchesne  wrote:
>
>> Deprecate older VA pixel formats (MOCO, IDCT) as it is now very unlikely
>> to ever be useful in the future. Only keep plain AV_PIX_FMT_VAAPI format
>> that is aliased to the older VLD variant.
>>
>> Signed-off-by: Gwenole Beauchesne 
>> ---
>>  libavcodec/h263dec.c |  2 +-
>>  libavcodec/h264_slice.c  |  2 +-
>>  libavcodec/mpeg12dec.c   |  2 +-
>>  libavcodec/vaapi_h264.c  |  2 +-
>>  libavcodec/vaapi_mpeg2.c |  2 +-
>>  libavcodec/vaapi_mpeg4.c |  4 ++--
>>  libavcodec/vaapi_vc1.c   |  4 ++--
>>  libavcodec/vc1dec.c  |  2 +-
>>  libavutil/pixdesc.c  |  9 +
>>  libavutil/pixfmt.h   | 11 +++
>>  libavutil/version.h  |  3 +++
>>  11 files changed, 33 insertions(+), 10 deletions(-)
>>
>> diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
>> index 7fa7090..e647e40 100644
>> --- a/libavcodec/h263dec.c
>> +++ b/libavcodec/h263dec.c
>> @@ -718,7 +718,7 @@ frame_end:
>>
>>  const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[] = {
>>  #if CONFIG_H263_VAAPI_HWACCEL || CONFIG_MPEG4_VAAPI_HWACCEL
>> -AV_PIX_FMT_VAAPI_VLD,
>> +AV_PIX_FMT_VAAPI,
>>  #endif
>>  #if CONFIG_H263_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL
>>  AV_PIX_FMT_VDPAU,
>> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
>> index 48f501b..7b35c08 100644
>> --- a/libavcodec/h264_slice.c
>> +++ b/libavcodec/h264_slice.c
>> @@ -943,7 +943,7 @@ static enum AVPixelFormat get_pixel_format(H264Context 
>> *h, int force_callback)
>>  *fmt++ = AV_PIX_FMT_D3D11VA_VLD;
>>  #endif
>>  #if CONFIG_H264_VAAPI_HWACCEL
>> -*fmt++ = AV_PIX_FMT_VAAPI_VLD;
>> +*fmt++ = AV_PIX_FMT_VAAPI;
>>  #endif
>>  #if CONFIG_H264_VDA_HWACCEL
>>  *fmt++ = AV_PIX_FMT_VDA_VLD;
>> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
>> index c7a5701..d2bedbc 100644
>> --- a/libavcodec/mpeg12dec.c
>> +++ b/libavcodec/mpeg12dec.c
>> @@ -1209,7 +1209,7 @@ static const enum AVPixelFormat 
>> mpeg2_hwaccel_pixfmt_list_420[] = {
>>  AV_PIX_FMT_D3D11VA_VLD,
>>  #endif
>>  #if CONFIG_MPEG2_VAAPI_HWACCEL
>> -AV_PIX_FMT_VAAPI_VLD,
>> +AV_PIX_FMT_VAAPI,
>>  #endif
>>  #if CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL
>>  AV_PIX_FMT_VIDEOTOOLBOX,
>> diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c
>> index 151aca9..55ee2fc 100644
>> --- a/libavcodec/vaapi_h264.c
>> +++ b/libavcodec/vaapi_h264.c
>> @@ -359,7 +359,7 @@ AVHWAccel ff_h264_vaapi_hwaccel = {
>>  .name   = "h264_vaapi",
>>  .type   = AVMEDIA_TYPE_VIDEO,
>>  .id = AV_CODEC_ID_H264,
>> -.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
>> +.pix_fmt= AV_PIX_FMT_VAAPI,
>>  .start_frame= vaapi_h264_start_frame,
>>  .end_frame  = vaapi_h264_end_frame,
>>  .decode_slice   = vaapi_h264_decode_slice,
>> diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c
>> index 87fab89..27c69cd 100644
>> --- a/libavcodec/vaapi_mpeg2.c
>> +++ b/libavcodec/vaapi_mpeg2.c
>> @@ -138,7 +138,7 @@ AVHWAccel ff_mpeg2_vaapi_hwaccel = {
>>  .name   = "mpeg2_vaapi",
>>  .type   = AVMEDIA_TYPE_VIDEO,
>>  .id = AV_CODEC_ID_MPEG2VIDEO,
>> -.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
>> +.pix_fmt= AV_PIX_FMT_VAAPI,
>>  .start_frame= vaapi_mpeg2_start_frame,
>>  .end_frame  = ff_vaapi_mpeg_end_frame,
>>  .decode_slice   = vaapi_mpeg2_decode_slice,
>> diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c
>> index 9b283f7..5b2e9d4 100644
>> --- a/libavcodec/vaapi_mpeg4.c
>> +++ b/libavcodec/vaapi_mpeg4.c
>> @@ -141,7 +141,7 @@ AVHWAccel ff_mpeg4_vaapi_hwaccel = {
>>  .name   = "mpeg4_vaapi",
>>  .type   = AVMEDIA_TYPE_VIDEO,
>>  .id = AV_CODEC_ID_MPEG4,
>> -.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
>> +.pix_fmt= AV_PIX_FMT_VAAPI,
>>  .start_frame= vaapi_mpeg4_start_frame,
>>  .end_frame  = ff_vaapi_mpeg_end_frame,
>>  .decode_slice   = vaapi_mpeg4_decode_slice,
>> @@ -153,7 +153,7 @@ AVHWAccel ff_h263_vaapi_hwaccel = {
>>  .name   = "h263_vaapi",
>>  .type   = AVMEDIA_TYPE_VIDEO,
>>  .id = AV_CODEC_ID_H263,
>> -.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
>> +.pix_fmt= AV_PIX_FMT_VAAPI,
>>  .start_frame= vaapi_mpeg4_start_frame,
>>  .end_frame  = ff_vaapi_mpeg_end_frame,
>>  .decode_slice   = vaapi_mpeg4_decode_slice,
>> diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c
>> index 7ef9f2a..63d514d 100644
>> --- a/libavcodec/vaapi_vc1.c
>> +++ b/libavcodec/vaapi_vc1.c
>> @@ -339,7 +339,7 @@ AVHWAccel ff_wmv3_vaapi_hwaccel = {
>>  .name   = "wmv3_vaapi",
>>  .type   = AVMEDIA_TYPE_VIDEO,
>>  .id = AV_CODEC_ID_WMV3,
>> -.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
>> +.pix_fmt

Re: [FFmpeg-devel] [PATCH 4/4] vaapi: add interfaces to properly initialize context.

2015-08-18 Thread Gwenole Beauchesne
Hi,

2015-08-17 22:26 GMT+02:00 wm4 :
> On Mon, 17 Aug 2015 19:17:53 +0200
> Gwenole Beauchesne  wrote:
>
>> Add av_vaapi_context_init() and av_vaapi_context_alloc() helper functions
>> so that to properly initialize the vaapi_context structure, and allow for
>> future extensions without breaking the API/ABI.
>>
>> The new version and flags fields are inserted after the last known user
>> initialized field, and actually useful field at all, i.e. VA context_id.
>> This is safe because the vaapi_context structure was required to be zero
>> initialized in the past. And, since those new helper functions and changes
>> cause the AV_VAAPI_CONTEXT_VERSION to be bumped, we can track older struct
>> requirements from within libavcodec.
>>
>> Besides, it is now required by design, and actual usage, that the vaapi
>> context structure be completely initialized once and for all before the
>> AVCodecContext.get_format() function ever completes.
>>
>> Signed-off-by: Gwenole Beauchesne 
>> ---
>>  libavcodec/vaapi.c  | 30 +++
>>  libavcodec/vaapi.h  | 59 
>> +
>>  libavcodec/vaapi_internal.h |  1 +
>>  3 files changed, 85 insertions(+), 5 deletions(-)
>>
>> diff --git a/libavcodec/vaapi.c b/libavcodec/vaapi.c
>> index 1ae71a5..4d3e2f3 100644
>> --- a/libavcodec/vaapi.c
>> +++ b/libavcodec/vaapi.c
>> @@ -41,11 +41,41 @@ static void destroy_buffers(VADisplay display, 
>> VABufferID *buffers, unsigned int
>>  }
>>  }
>>
>> +/* Allocates a vaapi_context structure */
>> +struct vaapi_context *av_vaapi_context_alloc(unsigned int flags)
>> +{
>> +struct vaapi_context *vactx;
>> +
>> +vactx = av_malloc(sizeof(*vactx));
>> +if (!vactx)
>> +return NULL;
>> +
>> +av_vaapi_context_init(vactx, AV_VAAPI_CONTEXT_VERSION, flags);
>> +return vactx;
>> +}
>> +
>> +/* Initializes a vaapi_context structure with safe defaults */
>> +void av_vaapi_context_init(struct vaapi_context *vactx, unsigned int 
>> version,
>> +   unsigned int flags)
>> +{
>> +vactx->display  = NULL;
>> +vactx->config_id= VA_INVALID_ID;
>> +vactx->context_id   = VA_INVALID_ID;
>> +
>> +if (version > 0) {
>> +vactx->version  = version;
>> +vactx->flags= flags;
>> +}
>> +}
>> +
>>  int ff_vaapi_context_init(AVCodecContext *avctx)
>>  {
>>  FFVAContext * const vactx = ff_vaapi_get_context(avctx);
>>  const struct vaapi_context * const user_vactx = avctx->hwaccel_context;
>>
>> +if (user_vactx->version > 0)
>> +vactx->flags= user_vactx->flags;
>> +
>>  vactx->display  = user_vactx->display;
>>  vactx->config_id= user_vactx->config_id;
>>  vactx->context_id   = user_vactx->context_id;
>> diff --git a/libavcodec/vaapi.h b/libavcodec/vaapi.h
>> index 4448a2e..1f032a0 100644
>> --- a/libavcodec/vaapi.h
>> +++ b/libavcodec/vaapi.h
>> @@ -40,14 +40,16 @@
>>   * @{
>>   */
>>
>> +#define AV_VAAPI_CONTEXT_VERSION 1
>> +
>>  /**
>>   * This structure is used to share data between the FFmpeg library and
>>   * the client video application.
>> - * This shall be zero-allocated and available as
>> - * AVCodecContext.hwaccel_context. All user members can be set once
>> - * during initialization or through each AVCodecContext.get_buffer()
>> - * function call. In any case, they must be valid prior to calling
>> - * decoding functions.
>> + *
>> + * This shall be initialized with av_vaapi_context_init(), or
>> + * indirectly through av_vaapi_context_alloc(), and made available as
>> + * AVCodecContext.hwaccel_context. All user members must be properly
>> + * initialized before AVCodecContext.get_format() completes.
>>   */
>>  struct vaapi_context {
>>  /**
>> @@ -74,6 +76,29 @@ struct vaapi_context {
>>   */
>>  uint32_t context_id;
>>
>> +/**
>> + * This field must be set to AV_VAAPI_CONTEXT_VERSION
>> + *
>> + * @since Version 1.
>> + *
>> + * - encoding: unused
>> + * - decoding: Set by user, through av_vaapi_context_init()
>> + */
>> +unsigned int version;
>
> Not sure if I see any point in this. Normally, backwards-compatible ABI
> additions can add fields in FFmpeg, but the API user doesn't get a way
> to check whether a field is really there.
>
> Or in other words, the level of ABI compatibility we target is that
> newer libav* libs work with old application binaries, but not the other
> way around.

Yes, and I have reasons to see why this mechanism is needed.

Imagine some old application binaries doesn't allocate the context
through the supplied helper functions. Without knowing the original
layout of the user supplied vaapi_context, we could be in a situation
where we read past the end of the struct. The current patch series
doesn't present it, but future ones can enlarge the public
vaapi_context with various other needed fields for configuration.
Aside of "hwaccel v2 plans",