[FFmpeg-devel] [PATCH] Add support for vp9 in iso-bmff

2016-06-10 Thread Kongqun Yang
Implemented according to the draft specification
"VP Codec ISO Media File Format Binding":
http://www.webmproject.org/vp9/#draft-vp-codec-iso-media-file-format-binding

Change-Id: Iaa7ddf5524b17e8d79cd1923b26f096d6e91
---
 libavformat/Makefile |   2 +-
 libavformat/isom.c   |   3 +
 libavformat/movenc.c |  15 +
 libavformat/vpx.c| 170 +++
 libavformat/vpx.h|  33 ++
 5 files changed, 222 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/vpx.c
 create mode 100644 libavformat/vpx.h

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 6684ead..33d6027 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -276,7 +276,7 @@ OBJS-$(CONFIG_MM_DEMUXER)+= mm.o
 OBJS-$(CONFIG_MMF_DEMUXER)   += mmf.o
 OBJS-$(CONFIG_MMF_MUXER) += mmf.o rawenc.o
 OBJS-$(CONFIG_MOV_DEMUXER)   += mov.o mov_chan.o replaygain.o
-OBJS-$(CONFIG_MOV_MUXER) += movenc.o avc.o hevc.o \
+OBJS-$(CONFIG_MOV_MUXER) += movenc.o avc.o hevc.o vpx.o \
 movenchint.o mov_chan.o rtp.o \
 movenccenc.o rawutils.o
 OBJS-$(CONFIG_MP2_MUXER) += mp3enc.o rawenc.o id3v2enc.o
diff --git a/libavformat/isom.c b/libavformat/isom.c
index b1757e2..9a65268 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -59,6 +59,7 @@ const AVCodecTag ff_mp4_obj_type[] = {
 { AV_CODEC_ID_AC3 , 0xA5 },
 { AV_CODEC_ID_EAC3, 0xA6 },
 { AV_CODEC_ID_DTS , 0xA9 }, /* mp4ra.org */
+{ AV_CODEC_ID_VP9 , 0xC0 }, /* non standard, update when there is 
a standard value */
 { AV_CODEC_ID_TSCC2   , 0xD0 }, /* non standard, camtasia uses it */
 { AV_CODEC_ID_VORBIS  , 0xDD }, /* non standard, gpac uses it */
 { AV_CODEC_ID_DVD_SUBTITLE, 0xE0 }, /* non standard, see 
unsupported-embedded-subs-2.mp4 */
@@ -179,6 +180,8 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
 { AV_CODEC_ID_H264, MKTAG('a', 'i', 'v', 'x') }, /* XAVC 4:2:2 10bit */
 { AV_CODEC_ID_H264, MKTAG('r', 'v', '6', '4') }, /* X-Com Radvision */
 
+{ AV_CODEC_ID_VP9,  MKTAG('v', 'p', '0', '9') }, /* VP9 */
+
 { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', ' ') },
 { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', '1') }, /* Apple MPEG-1 
Camcorder */
 { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'e', 'g') }, /* MPEG */
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 2f00091..1471b12 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -49,6 +49,7 @@
 #include "hevc.h"
 #include "rtpenc.h"
 #include "mov_chan.h"
+#include "vpx.h"
 
 static const AVOption options[] = {
 { "movflags", "MOV muxer flags", offsetof(MOVMuxContext, flags), 
AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, 
"movflags" },
@@ -1039,6 +1040,17 @@ static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack 
*track)
 return update_size(pb, pos);
 }
 
+static int mov_write_vpcc_tag(AVIOContext *pb, MOVTrack *track)
+{
+int64_t pos = avio_tell(pb);
+
+avio_wb32(pb, 0);
+ffio_wfourcc(pb, "vpcC");
+avio_wb32(pb, 0); /* version & flags */
+ff_isom_write_vpcc(pb, track->par);
+return update_size(pb, pos);
+}
+
 static int mov_write_hvcc_tag(AVIOContext *pb, MOVTrack *track)
 {
 int64_t pos = avio_tell(pb);
@@ -1143,6 +1155,7 @@ static int mp4_get_codec_tag(AVFormatContext *s, MOVTrack 
*track)
 
 if  (track->par->codec_id == AV_CODEC_ID_H264)  tag = 
MKTAG('a','v','c','1');
 else if (track->par->codec_id == AV_CODEC_ID_HEVC)  tag = 
MKTAG('h','e','v','1');
+else if (track->par->codec_id == AV_CODEC_ID_VP9)   tag = 
MKTAG('v','p','0','9');
 else if (track->par->codec_id == AV_CODEC_ID_AC3)   tag = 
MKTAG('a','c','-','3');
 else if (track->par->codec_id == AV_CODEC_ID_EAC3)  tag = 
MKTAG('e','c','-','3');
 else if (track->par->codec_id == AV_CODEC_ID_DIRAC) tag = 
MKTAG('d','r','a','c');
@@ -1758,6 +1771,8 @@ static int mov_write_video_tag(AVIOContext *pb, 
MOVMuxContext *mov, MOVTrack *tr
 mov_write_avcc_tag(pb, track);
 if (track->mode == MODE_IPOD)
 mov_write_uuid_tag_ipod(pb);
+} else if (track->par->codec_id == AV_CODEC_ID_VP9) {
+mov_write_vpcc_tag(pb, track);
 } else if (track->par->codec_id == AV_CODEC_ID_VC1 && track->vos_len > 0)
 mov_write_dvc1_tag(pb, track);
 else if (track->par->codec_id == AV_CODEC_ID_VP6F ||
diff --git a/libavformat/vpx.c b/libavformat/vpx.c
new file mode 100644
index 000..5125187
--- /dev/null
+++ b/libavformat/vpx.c
@@ -0,0 +1,170 @@
+/*
+ * VPX helper functions for muxers
+ *
+ * Copyright (c) 2016 Google Inc.
+ * Copyright (c) 2016 KongQun Yang (kqy...@google.com)
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or

[FFmpeg-devel] [PATCH] libopusenc: Add channel mapping family argument

2016-06-10 Thread Michael Graczyk
The libopus encoder has a parameter called "channel mapping family" which
is used to specify inter-channel relationships for the purpose of encoding.
I have added a new command line argument which makes it possible to forward
the mapping family parameter along to libopus.

With this parameter, it is possible to choose between encoding multichannel
audio streams as surround sound (with interchannel masking and channel
coupling) versus independent channels (no interchannel masking nor channel
coupling).

Example usage:

$ wget https://samples.ffmpeg.org/A-codecs/wavpcm/8_Channel_ID.wav -O in.wav

# Use the old behavior. Header contains layout, but no masking
$ ./ffmpeg -y -i in.wav -c:a opus -mapping_family -1 out.ogg

# Use libopus surround mode. Masking + automatic channel coupling
$ ./ffmpeg -y -i in.wav -c:a opus -mapping_family 1 out.ogg

# Use libopus with independent channels. No header info, no masking, no
coupling
$ ./ffmpeg -y -i in.wav -c:a opus -mapping_family 255 out.ogg

This patch also makes it possible to encode up to 254 channels with opus
using channel mapping family 255.

$ head -c 1728000 /dev/urandom > noise.raw
$ ./ffmpeg -y -f s16le -ar 48000 -ac 18 -i noise.raw -c:a opus
-mapping_family 255 out.opus


Questions:

1. I had to remove .channel_layouts form ff_libopus_encoder to allow the
encoder to accept streams with more than 8 channels. Is that the right way
to extend the encoder? Based on a discussion on #ffmpeg it seemed like
removing the .channel_layouts field would be the only way to allow more
than 16 channels.
2. Am I using AVFrame.data correctly? I recall reading somewhere that
channels after the eighth would be stored in extended_data, but from the
documentation it seems like that is only the case for planar data.


Thanks for reading,
Michael Graczyk
From 439972c08894480d5cfde62dc1bccf8eff80d7c6 Mon Sep 17 00:00:00 2001
From: Michael Graczyk 
Date: Mon, 23 May 2016 12:49:54 -0700
Subject: [PATCH] libopusenc: Add channel mapping family argument

The default value of -1 indicates that ffmpeg should determine the channel
mapping automatically, which was the behavior before this commit.

Unless the -mapping_family argument is provided, behavior should be unchanged.
---
 doc/encoders.texi   |   6 +++
 libavcodec/libopusenc.c | 125 +---
 2 files changed, 93 insertions(+), 38 deletions(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index f38cad3..51ccb66 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1184,6 +1184,12 @@ following: 4000, 6000, 8000, 12000, or 2, 
corresponding to
 narrowband, mediumband, wideband, super wideband, and fullband
 respectively. The default is 0 (cutoff disabled).
 
+@item mapping_family (@emph{mapping_family})
+Set channel mapping family to be used by the encoder. The default is -1
+(determine channel mapping and layout from channel count). Other values include
+0 for stereo, 1 for surround sound, and 255 for independent streams with an
+unspecified channel layout.
+
 @end table
 
 @section libvorbis
diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c
index 3f3e80d..fdaf567 100644
--- a/libavcodec/libopusenc.c
+++ b/libavcodec/libopusenc.c
@@ -38,6 +38,7 @@ typedef struct LibopusEncOpts {
 float frame_duration;
 int packet_size;
 int max_bandwidth;
+int mapping_family;
 } LibopusEncOpts;
 
 typedef struct LibopusEncContext {
@@ -47,6 +48,7 @@ typedef struct LibopusEncContext {
 uint8_t *samples;
 LibopusEncOpts opts;
 AudioFrameQueue afq;
+const uint8_t *encoder_channel_map;
 } LibopusEncContext;
 
 static const uint8_t opus_coupled_streams[8] = {
@@ -77,8 +79,10 @@ static const uint8_t libavcodec_libopus_channel_map[8][8] = {
 { 0, 1, 6, 7, 4, 5, 2, 3 },
 };
 
+
 static void libopus_write_header(AVCodecContext *avctx, int stream_count,
  int coupled_stream_count,
+ int mapping_family,
  const uint8_t *channel_mapping)
 {
 uint8_t *p   = avctx->extradata;
@@ -93,7 +97,7 @@ static void libopus_write_header(AVCodecContext *avctx, int 
stream_count,
 
 /* Channel mapping */
 if (channels > 2) {
-bytestream_put_byte(&p, channels <= 8 ? 1 : 255);
+bytestream_put_byte(&p, mapping_family);
 bytestream_put_byte(&p, stream_count);
 bytestream_put_byte(&p, coupled_stream_count);
 bytestream_put_buffer(&p, channel_mapping, channels);
@@ -159,37 +163,11 @@ static int libopus_configure_encoder(AVCodecContext 
*avctx, OpusMSEncoder *enc,
 static av_cold int libopus_encode_init(AVCodecContext *avctx)
 {
 LibopusEncContext *opus = avctx->priv_data;
-const uint8_t *channel_mapping;
 OpusMSEncoder *enc;
+uint8_t libopus_channel_mapping[255];
 int ret = OPUS_OK;
 int coupled_stream_count, header_size, frame_size;
 
-coupled_stream_count = opus_coupled_streams[avctx->channels - 1];
-  

[FFmpeg-devel] [PATCH 2/2] avfilter/vf_histogram: indent histogram options

2016-06-10 Thread Dave Rice
Some indentation after the previous patch.
Dave Rice


0002-avfilter-vf_histogram-indent-histogram-options.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/2] avfilter/vf_histogram: shortcuts for histogram options

2016-06-10 Thread Dave Rice
This patch adds some shortcuts for the histogram filter's options in a way that 
is consistent with the waveform and vectorscope filter.
Dave Rice



0001-avfilter-vf_histogram-shortcuts-for-histogram-option.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/img2dec: add ppm pipe demuxer

2016-06-10 Thread Michael Niedermayer
On Fri, Jun 10, 2016 at 03:34:28PM +0200, Clément Bœsch wrote:
> On Fri, Jun 10, 2016 at 04:28:55AM +0200, Michael Niedermayer wrote:
> > On Thu, Jun 09, 2016 at 04:35:02PM +0200, Clément Bœsch wrote:
> > > On Thu, Jun 09, 2016 at 03:59:30PM +0200, Clément Bœsch wrote:
> > > > On Thu, Jun 09, 2016 at 01:35:19PM +, Carl Eugen Hoyos wrote:
> > > > > Clément Bœsch  pkh.me> writes:
> > > > > 
> > > > > > +if (b[3] == '#')
> > > > > > +return AVPROBE_SCORE_EXTENSION + 1;
> > > > > > +if (b[3] >= '0' && b[3] <= '9')
> > > > > > +return AVPROBE_SCORE_MAX - 1;
> > > > > 
> > > > > Imo, this should be:
> > > > > if (b[3] == '#' || (b[3] >= '0' && b[3] <= '9'))
> > > > >   return AVPROBE_SCORE_EXTENSION + 2;
> > > > > or similar
> > > > > 
> > > > > I count 37 and 34 bits which is only a little more than 
> > > > > the usual 32 bit for EXTENSION + 1.
> > > > > 
> > > > 
> > > > Sure. Changed locally, will push soon, thanks.
> > > > 
> > > 
> > > For some reasons it makes seeking with pgm somehow working. The reference
> > > test doesn't look that great IIUC, but seeking in these file with ffplay
> > > is fine AFAICT.
> > 
> > it seems it messes with pgmyuv detection (which i think was filename 
> > extension based)
> > 
> > example:
> > ./ffmpeg -i matrixbench_mpeg2.mpg -pix_fmt yuv420p16be -vframes 1 
> > test.pgmyuv
> > ./ffplay-ref test.pgmyuv
> > Input #0, image2, from 'test.pgmyuv':B vq=0KB sq=0B f=0/0
> >   Duration: 00:00:00.04, start: 0.00, bitrate: 248835 kb/s
> > Stream #0:0: Video: pgmyuv, yuv420p16le, 720x576, 25 tbr, 25 tbn
> > 
> > ./ffplay test.pgmyuv
> > Input #0, ppm_pipe, from 'test.pgmyuv':vq=0KB sq=0B f=0/0
> >   Duration: N/A, bitrate: N/A
> > Stream #0:0: Video: ppm, gray16le, 720x864, 25 tbr, 25 tbn, 25 tbc
> > 
> 
> Yes, this is a good thing (same thing happens if you s/pgmyuv/png/).

iam not sure i understand
when storing yuv420p16be in test.pgmyuv prior to the patch the file
can be read after the patch its read incorrectly as gray16
this admitably is a annoying as probably the only way to detect the
difference is the file extension

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [RFC] Bugs and CC

2016-06-10 Thread Clément Bœsch
On Fri, Jun 10, 2016 at 11:21:04PM +0200, Hendrik Leppkes wrote:
> On Fri, Jun 10, 2016 at 10:36 AM, Michael Niedermayer
>  wrote:
> > Hi all
> >
> > Should the author of a commit causing a regression be added to the CC
> > of bugs if he has a trac account ?
> >
> > iam thinking yes because i quite often find out about regressions
> > by running into them by chance on trac which is ofte long after
> > the git hash that caused the regression was added to the ticket
> >
> 
> If its a patch written by me, I would be fine getting notifications if
> it breaks something.

Same here.

But I think this rule should be restricted to people who are active. I
don't think people who left the project for one reason or another would
want to be nagged about such thing.

[...]

-- 
Clément B.


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


Re: [FFmpeg-devel] [RFC] Bugs and CC

2016-06-10 Thread Hendrik Leppkes
On Fri, Jun 10, 2016 at 10:36 AM, Michael Niedermayer
 wrote:
> Hi all
>
> Should the author of a commit causing a regression be added to the CC
> of bugs if he has a trac account ?
>
> iam thinking yes because i quite often find out about regressions
> by running into them by chance on trac which is ofte long after
> the git hash that caused the regression was added to the ticket
>

If its a patch written by me, I would be fine getting notifications if
it breaks something.
What I wouldn't like is getting CC'ed on merge commits just because I
facilitated the merge, but any potential regression might be from the
author of the original commit which was merged.

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


Re: [FFmpeg-devel] [PATCH] avcodec/cfhd: Set dimensions unconditionally

2016-06-10 Thread Michael Niedermayer
On Fri, Jun 10, 2016 at 09:18:23PM +0200, Paul B Mahol wrote:
> On 6/10/16, Michael Niedermayer  wrote:
> > Fixes Ticket5215
> >
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/cfhd.c |5 +
> >  1 file changed, 5 insertions(+)
> >
> 
> lgtm

applied

thx

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

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


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


Re: [FFmpeg-devel] [RFC] Bugs and CC

2016-06-10 Thread Michael Niedermayer
On Fri, Jun 10, 2016 at 04:23:58PM -0300, James Almer wrote:
> On 6/10/2016 3:59 PM, Michael Niedermayer wrote:
> > On Fri, Jun 10, 2016 at 10:38:19AM +, Carl Eugen Hoyos wrote:
> >> Michael Niedermayer  niedermayer.cc> writes:
> >>
> >>> Should the author of a commit causing a regression be added to 
> >>> the CC of bugs if he has a trac account ?
> >>
> >> The reason I am not doing this is that it was heavily discouraged 
> >> in the past.
> > 
> > arent you mixing ML with trac here ?
> > CC is discouraged for ML but for trac i think it would be helpfull
> > because the alternative is for everone to check every git hash
> > that gets added to a ticket ... if one doesnt want to miss bugs
> > one caused
> 
> I have never seen CC being discouraged for ML replies. They are in
> fact useful seeing that sometimes contributors unsubscribe because
> they dislike high traffic lists like this one but still maintain or
> otherwise fix code they submitted if it broke something.
> The emails may also appear as higher priority depending on your
> provider and client if you're cc'd while subscribed.

what was discouraged was CCing people who are subscribed as it causes
duplicate mails in multiple folders in many setups which many
developers did not like


> 
> Adding someone as CC on a trac ticket would generate traffic of
> emails for every new comment made in that ticket, which can be
> annoying, so I'd say a better idea would to be email the author of
> the code in question once to inform them of the regression and a
> link to the ticket, and let them add themselves as CC if needed.

dont you want to read the comments to a regression ticket caused by
"you" anyway ?

for me getting a mail to inform me and requireing me to add myself
to the CC, at least for me thats more work as i would always want to
be CCed, it also would be more work for the person sending such
notify mails as the CC is more automatic




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

Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued


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


[FFmpeg-devel] [PATCH] avformat/tee: Support arbitrary number of slaves

2016-06-10 Thread sebechlebskyjan
From: Jan Sebechlebsky 

Signed-off-by: Jan Sebechlebsky 
---
 libavformat/tee.c | 27 +--
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/libavformat/tee.c b/libavformat/tee.c
index 806beaa..427e999 100644
--- a/libavformat/tee.c
+++ b/libavformat/tee.c
@@ -27,8 +27,6 @@
 #include "avformat.h"
 #include "avio_internal.h"
 
-#define MAX_SLAVES 16
-
 typedef enum {
 ON_SLAVE_FAILURE_ABORT  = 1,
 ON_SLAVE_FAILURE_IGNORE = 2
@@ -52,7 +50,7 @@ typedef struct TeeContext {
 const AVClass *class;
 unsigned nb_slaves;
 unsigned nb_alive;
-TeeSlave slaves[MAX_SLAVES];
+TeeSlave *slaves;
 } TeeContext;
 
 static const char *const slave_delim = "|";
@@ -203,6 +201,8 @@ static void close_slaves(AVFormatContext *avf)
 for (i = 0; i < tee->nb_slaves; i++) {
 close_slave(&tee->slaves[i]);
 }
+
+av_freep(&tee->slaves);
 }
 
 static int open_slave(AVFormatContext *avf, char *slave, TeeSlave *tee_slave)
@@ -443,17 +443,17 @@ static int tee_write_header(AVFormatContext *avf)
 TeeContext *tee = avf->priv_data;
 unsigned nb_slaves = 0, i;
 const char *filename = avf->filename;
-char *slaves[MAX_SLAVES];
+char **slaves = NULL;
 int ret;
 
 while (*filename) {
-if (nb_slaves == MAX_SLAVES) {
-av_log(avf, AV_LOG_ERROR, "Maximum %d slave muxers reached.\n",
-   MAX_SLAVES);
-ret = AVERROR_PATCHWELCOME;
+char *slave = av_get_token(&filename, slave_delim);
+if (!slave) {
+ret = AVERROR(ENOMEM);
 goto fail;
 }
-if (!(slaves[nb_slaves++] = av_get_token(&filename, slave_delim))) {
+dynarray_add(&slaves, &nb_slaves, slave);
+if (!slaves) {
 ret = AVERROR(ENOMEM);
 goto fail;
 }
@@ -461,6 +461,10 @@ static int tee_write_header(AVFormatContext *avf)
 filename++;
 }
 
+if (!(tee->slaves = calloc(nb_slaves, sizeof(*tee->slaves {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
 tee->nb_slaves = tee->nb_alive = nb_slaves;
 
 for (i = 0; i < nb_slaves; i++) {
@@ -483,12 +487,13 @@ static int tee_write_header(AVFormatContext *avf)
 av_log(avf, AV_LOG_WARNING, "Input stream #%d is not mapped "
"to any slave.\n", i);
 }
+av_free(slaves);
 return 0;
-
 fail:
 for (i = 0; i < nb_slaves; i++)
 av_freep(&slaves[i]);
 close_slaves(avf);
+av_free(slaves);
 return ret;
 }
 
@@ -505,6 +510,8 @@ static int tee_write_trailer(AVFormatContext *avf)
 ret_all = ret;
 }
 }
+
+av_freep(&tee->slaves);
 return ret_all;
 }
 
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH] avcodec/cfhd: Set dimensions unconditionally

2016-06-10 Thread Paul B Mahol
On 6/10/16, Michael Niedermayer  wrote:
> Fixes Ticket5215
>
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/cfhd.c |5 +
>  1 file changed, 5 insertions(+)
>

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


Re: [FFmpeg-devel] [RFC] Bugs and CC

2016-06-10 Thread James Almer
On 6/10/2016 3:59 PM, Michael Niedermayer wrote:
> On Fri, Jun 10, 2016 at 10:38:19AM +, Carl Eugen Hoyos wrote:
>> Michael Niedermayer  niedermayer.cc> writes:
>>
>>> Should the author of a commit causing a regression be added to 
>>> the CC of bugs if he has a trac account ?
>>
>> The reason I am not doing this is that it was heavily discouraged 
>> in the past.
> 
> arent you mixing ML with trac here ?
> CC is discouraged for ML but for trac i think it would be helpfull
> because the alternative is for everone to check every git hash
> that gets added to a ticket ... if one doesnt want to miss bugs
> one caused

I have never seen CC being discouraged for ML replies. They are in
fact useful seeing that sometimes contributors unsubscribe because
they dislike high traffic lists like this one but still maintain or
otherwise fix code they submitted if it broke something.
The emails may also appear as higher priority depending on your
provider and client if you're cc'd while subscribed.

Adding someone as CC on a trac ticket would generate traffic of
emails for every new comment made in that ticket, which can be
annoying, so I'd say a better idea would to be email the author of
the code in question once to inform them of the regression and a
link to the ticket, and let them add themselves as CC if needed.

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

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


Re: [FFmpeg-devel] [RFC] Bugs and CC

2016-06-10 Thread Marton Balint


On Fri, 10 Jun 2016, Michael Niedermayer wrote:


Hi all

Should the author of a commit causing a regression be added to the CC
of bugs if he has a trac account ?


I think this is a good idea. I would like to know about regressions I 
caused. If a bug becomes annoying for any reason, I will just remove 
myself from cc, but I think this is unlikely.


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


[FFmpeg-devel] [PATCH] avcodec/cfhd: Set dimensions unconditionally

2016-06-10 Thread Michael Niedermayer
Fixes Ticket5215

Signed-off-by: Michael Niedermayer 
---
 libavcodec/cfhd.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index 0e6abe0..74facd4 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -438,6 +438,11 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, 
int *got_frame,
 return ret;
 }
 }
+ret = ff_set_dimensions(avctx, s->coded_width, s->coded_height);
+if (ret < 0)
+return ret;
+frame.f->width =
+frame.f->height = 0;
 
 if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
 return ret;
-- 
1.7.9.5

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


Re: [FFmpeg-devel] [RFC] Bugs and CC

2016-06-10 Thread Michael Niedermayer
On Fri, Jun 10, 2016 at 10:38:19AM +, Carl Eugen Hoyos wrote:
> Michael Niedermayer  niedermayer.cc> writes:
> 
> > Should the author of a commit causing a regression be added to 
> > the CC of bugs if he has a trac account ?
> 
> The reason I am not doing this is that it was heavily discouraged 
> in the past.

arent you mixing ML with trac here ?
CC is discouraged for ML but for trac i think it would be helpfull
because the alternative is for everone to check every git hash
that gets added to a ticket ... if one doesnt want to miss bugs
one caused


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

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


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


Re: [FFmpeg-devel] [PATCH] avformat/flvenc: support codec config change mid stream

2016-06-10 Thread Ivan Grigoriev
Resubmitted as two separate commits
http://ffmpeg.org/pipermail/ffmpeg-devel/2016-June/195162.html

Ivan Grigoriev

On Fri, Jun 10, 2016 at 1:39 PM, Carl Eugen Hoyos  wrote:

> Ivan  gmail.com> writes:
>
> > +flv_write_codec_header(s, s->streams[i]->codecpar);
>
> If you make facturing out this code a separate commit,
> it will make reviewing much easier.
>
> Carl Eugen
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] libavformat/flvenc: support for codec configuration change mid stream

2016-06-10 Thread Ivan
---
 libavformat/flvenc.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index cf8d221..6fd7792 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -566,6 +566,19 @@ static int flv_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 else
 flags_size = 1;
 
+if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264
+|| par->codec_id == AV_CODEC_ID_MPEG4) {
+int side_size = 0;
+uint8_t *side = av_packet_get_side_data(pkt, 
AV_PKT_DATA_NEW_EXTRADATA, &side_size);
+if (side && side_size > 0 && (side_size != par->extradata_size || 
memcmp(side, par->extradata, side_size))) {
+av_free(par->extradata);
+par->extradata = av_mallocz(side_size + 
AV_INPUT_BUFFER_PADDING_SIZE);
+memcpy(par->extradata, side, side_size);
+par->extradata_size = side_size;
+flv_write_codec_header(s, par);
+}
+}
+
 if (flv->delay == AV_NOPTS_VALUE)
 flv->delay = -pkt->dts;
 
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 1/2] libavformat/flvenc: refactoring: extracted method for writing codec headers

2016-06-10 Thread Ivan
---
 libavformat/flvenc.c | 116 ---
 1 file changed, 64 insertions(+), 52 deletions(-)

diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index d62ff70..cf8d221 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -343,12 +343,74 @@ static int unsupported_codec(AVFormatContext *s,
 return AVERROR(ENOSYS);
 }
 
+static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par) 
{
+int64_t data_size;
+AVIOContext *pb = s->pb;
+FLVContext *flv = s->priv_data;
+
+if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264
+|| par->codec_id == AV_CODEC_ID_MPEG4) {
+int64_t pos;
+avio_w8(pb,
+par->codec_type == AVMEDIA_TYPE_VIDEO ?
+FLV_TAG_TYPE_VIDEO : FLV_TAG_TYPE_AUDIO);
+avio_wb24(pb, 0); // size patched later
+avio_wb24(pb, 0); // ts
+avio_w8(pb, 0);   // ts ext
+avio_wb24(pb, 0); // streamid
+pos = avio_tell(pb);
+if (par->codec_id == AV_CODEC_ID_AAC) {
+avio_w8(pb, get_audio_flags(s, par));
+avio_w8(pb, 0); // AAC sequence header
+
+if (!par->extradata_size && flv->flags & 1) {
+PutBitContext pbc;
+int samplerate_index;
+int channels = flv->audio_par->channels
+- (flv->audio_par->channels == 8 ? 1 : 0);
+uint8_t data[2];
+
+for (samplerate_index = 0; samplerate_index < 16;
+samplerate_index++)
+if (flv->audio_par->sample_rate
+== mpeg4audio_sample_rates[samplerate_index])
+break;
+
+init_put_bits(&pbc, data, sizeof(data));
+put_bits(&pbc, 5, flv->audio_par->profile + 1); //profile
+put_bits(&pbc, 4, samplerate_index); //sample rate index
+put_bits(&pbc, 4, channels);
+put_bits(&pbc, 1, 0); //frame length - 1024 samples
+put_bits(&pbc, 1, 0); //does not depend on core coder
+put_bits(&pbc, 1, 0); //is not extension
+flush_put_bits(&pbc);
+
+avio_w8(pb, data[0]);
+avio_w8(pb, data[1]);
+
+av_log(s, AV_LOG_WARNING, "AAC sequence header: %02x %02x.\n",
+data[0], data[1]);
+}
+avio_write(pb, par->extradata, par->extradata_size);
+} else {
+avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags
+avio_w8(pb, 0); // AVC sequence header
+avio_wb24(pb, 0); // composition time
+ff_isom_write_avcc(pb, par->extradata, par->extradata_size);
+}
+data_size = avio_tell(pb) - pos;
+avio_seek(pb, -data_size - 10, SEEK_CUR);
+avio_wb24(pb, data_size);
+avio_skip(pb, data_size + 10 - 3);
+avio_wb32(pb, data_size + 11); // previous tag size
+}
+}
+
 static int flv_write_header(AVFormatContext *s)
 {
 int i;
 AVIOContext *pb = s->pb;
 FLVContext *flv = s->priv_data;
-int64_t data_size;
 
 for (i = 0; i < s->nb_streams; i++) {
 AVCodecParameters *par = s->streams[i]->codecpar;
@@ -446,57 +508,7 @@ static int flv_write_header(AVFormatContext *s)
 write_metadata(s, 0);
 
 for (i = 0; i < s->nb_streams; i++) {
-AVCodecParameters *par = s->streams[i]->codecpar;
-if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == 
AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4) {
-int64_t pos;
-avio_w8(pb, par->codec_type == AVMEDIA_TYPE_VIDEO ?
-FLV_TAG_TYPE_VIDEO : FLV_TAG_TYPE_AUDIO);
-avio_wb24(pb, 0); // size patched later
-avio_wb24(pb, 0); // ts
-avio_w8(pb, 0);   // ts ext
-avio_wb24(pb, 0); // streamid
-pos = avio_tell(pb);
-if (par->codec_id == AV_CODEC_ID_AAC) {
-avio_w8(pb, get_audio_flags(s, par));
-avio_w8(pb, 0); // AAC sequence header
-
-if (!par->extradata_size && flv->flags & 1) {
-PutBitContext pbc;
-int samplerate_index;
-int channels = flv->audio_par->channels - 
(flv->audio_par->channels == 8 ? 1 : 0);
-uint8_t data[2];
-
-for (samplerate_index = 0; samplerate_index < 16; 
samplerate_index++)
-if (flv->audio_par->sample_rate == 
mpeg4audio_sample_rates[samplerate_index])
-break;
-
-init_put_bits(&pbc, data, sizeof(data));
-put_bits(&pbc, 5, flv->audio_par->profile + 1); //profile
-put_bits(&pbc, 4, samplerate_index); //sample rate index
-put_bits(&pbc, 4, channels);
-put_bits

[FFmpeg-devel] [PATCH] avutil/threadmessage.h: Fix swapped comments

2016-06-10 Thread sebechlebskyjan
From: Jan Sebechlebsky 

Fix swapped descriptions of av_thread_message_queue_set_err_send
and av_thread_message_queue_set_err_recv.

Signed-off-by: Jan Sebechlebsky 
---
 libavutil/threadmessage.h | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavutil/threadmessage.h b/libavutil/threadmessage.h
index e256cae..8480a0a 100644
--- a/libavutil/threadmessage.h
+++ b/libavutil/threadmessage.h
@@ -69,10 +69,10 @@ int av_thread_message_queue_recv(AVThreadMessageQueue *mq,
 /**
  * Set the sending error code.
  *
- * If the error code is set to non-zero, av_thread_message_queue_recv() will
- * return it immediately when there are no longer available messages.
- * Conventional values, such as AVERROR_EOF or AVERROR(EAGAIN), can be used
- * to cause the receiving thread to stop or suspend its operation.
+ * If the error code is set to non-zero, av_thread_message_queue_send() will
+ * return it immediately. Conventional values, such as AVERROR_EOF or
+ * AVERROR(EAGAIN), can be used to cause the sending thread to stop or
+ * suspend its operation.
  */
 void av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq,
   int err);
@@ -80,10 +80,10 @@ void 
av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq,
 /**
  * Set the receiving error code.
  *
- * If the error code is set to non-zero, av_thread_message_queue_send() will
- * return it immediately. Conventional values, such as AVERROR_EOF or
- * AVERROR(EAGAIN), can be used to cause the sending thread to stop or
- * suspend its operation.
+ * If the error code is set to non-zero, av_thread_message_queue_recv() will
+ * return it immediately when there are no longer available messages.
+ * Conventional values, such as AVERROR_EOF or AVERROR(EAGAIN), can be used
+ * to cause the receiving thread to stop or suspend its operation.
  */
 void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq,
   int err);
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH] lavu/intmath.h: fix compilation with msvc10.

2016-06-10 Thread Matt Oliver
On 10 June 2016 at 05:30, Michael Niedermayer 
wrote:

> On Mon, Jun 06, 2016 at 05:11:34PM +1000, Matt Oliver wrote:
> > ---
> >  libavutil/x86/intmath.h | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h
> > index f58b0d0..de177dd 100644
> > --- a/libavutil/x86/intmath.h
> > +++ b/libavutil/x86/intmath.h
> > @@ -47,6 +47,7 @@ static av_always_inline av_const int
> ff_log2_x86(unsigned
> > int v)
> >  #   endif
> >  #   define ff_log2_16bit av_log2
> >
> > +#if defined(_MSC_VER) && (_MSC_VER >= 1700)
> >  #   define ff_ctz(v) _tzcnt_u32(v)
>
> should this not be some configre based chec like
> CONFIG_TZCNT_U32
> ?
>

It could be but this is just checking for the availability of an intrinsic
used with msvc that is available for all msvc versions except 2010. So a
configure chck would just tell us what this code is doing anyway. Given
that this is msvc specific I didnt think it worth cluttering up configure
for such a rare usecase. Especially seeing as how we are not also checking
for all the gcc specific builtins or icl intrinsics used in this file and
in others and adding all those to configure would add considerable bloat.
So it can be added to configure if desired but for such a simple and msvc
specific case I would recommend not affecting other build chains by adding
it to configure.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/img2dec: add ppm pipe demuxer

2016-06-10 Thread Clément Bœsch
On Fri, Jun 10, 2016 at 04:28:55AM +0200, Michael Niedermayer wrote:
> On Thu, Jun 09, 2016 at 04:35:02PM +0200, Clément Bœsch wrote:
> > On Thu, Jun 09, 2016 at 03:59:30PM +0200, Clément Bœsch wrote:
> > > On Thu, Jun 09, 2016 at 01:35:19PM +, Carl Eugen Hoyos wrote:
> > > > Clément Bœsch  pkh.me> writes:
> > > > 
> > > > > +if (b[3] == '#')
> > > > > +return AVPROBE_SCORE_EXTENSION + 1;
> > > > > +if (b[3] >= '0' && b[3] <= '9')
> > > > > +return AVPROBE_SCORE_MAX - 1;
> > > > 
> > > > Imo, this should be:
> > > > if (b[3] == '#' || (b[3] >= '0' && b[3] <= '9'))
> > > >   return AVPROBE_SCORE_EXTENSION + 2;
> > > > or similar
> > > > 
> > > > I count 37 and 34 bits which is only a little more than 
> > > > the usual 32 bit for EXTENSION + 1.
> > > > 
> > > 
> > > Sure. Changed locally, will push soon, thanks.
> > > 
> > 
> > For some reasons it makes seeking with pgm somehow working. The reference
> > test doesn't look that great IIUC, but seeking in these file with ffplay
> > is fine AFAICT.
> 
> it seems it messes with pgmyuv detection (which i think was filename 
> extension based)
> 
> example:
> ./ffmpeg -i matrixbench_mpeg2.mpg -pix_fmt yuv420p16be -vframes 1 test.pgmyuv
> ./ffplay-ref test.pgmyuv
> Input #0, image2, from 'test.pgmyuv':B vq=0KB sq=0B f=0/0
>   Duration: 00:00:00.04, start: 0.00, bitrate: 248835 kb/s
> Stream #0:0: Video: pgmyuv, yuv420p16le, 720x576, 25 tbr, 25 tbn
> 
> ./ffplay test.pgmyuv
> Input #0, ppm_pipe, from 'test.pgmyuv':vq=0KB sq=0B f=0/0
>   Duration: N/A, bitrate: N/A
> Stream #0:0: Video: ppm, gray16le, 720x864, 25 tbr, 25 tbn, 25 tbc
> 

Yes, this is a good thing (same thing happens if you s/pgmyuv/png/).

I now realize I forgot to attach the diff, so new patch attached.

So the question is: are the FATE changes that affect the "pipe" tests OK?

Playback and seeking in tests/data/lavf/{pbmpipe.pbm,ppmpipe.ppm,
pgmpipe.pgm} now looks OK but the seek ref tests looks odd to me.

-- 
Clément B.
From b3380ad077e2da8bf50505b904f96d22b50b1564 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= 
Date: Wed, 8 Jun 2016 15:16:34 +0200
Subject: [PATCH] lavf/img2dec: add ppm pipe demuxer

---
 libavformat/Makefile|  1 +
 libavformat/allformats.c|  1 +
 libavformat/img2dec.c   | 14 +
 libavformat/version.h   |  4 ++--
 tests/ref/seek/lavf-pbmpipe | 50 -
 tests/ref/seek/lavf-pgmpipe | 50 -
 tests/ref/seek/lavf-ppmpipe | 50 -
 7 files changed, 99 insertions(+), 71 deletions(-)

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 6684ead..6f473b0 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -229,6 +229,7 @@ OBJS-$(CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER)  += img2dec.o img2.o
 OBJS-$(CONFIG_IMAGE_PCX_PIPE_DEMUXER) += img2dec.o img2.o
 OBJS-$(CONFIG_IMAGE_PICTOR_PIPE_DEMUXER)  += img2dec.o img2.o
 OBJS-$(CONFIG_IMAGE_PNG_PIPE_DEMUXER) += img2dec.o img2.o
+OBJS-$(CONFIG_IMAGE_PPM_PIPE_DEMUXER) += img2dec.o img2.o
 OBJS-$(CONFIG_IMAGE_QDRAW_PIPE_DEMUXER)   += img2dec.o img2.o
 OBJS-$(CONFIG_IMAGE_SGI_PIPE_DEMUXER) += img2dec.o img2.o
 OBJS-$(CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER) += img2dec.o img2.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index ddf540c..0e3322f 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -359,6 +359,7 @@ void av_register_all(void)
 REGISTER_DEMUXER (IMAGE_PCX_PIPE,image_pcx_pipe);
 REGISTER_DEMUXER (IMAGE_PICTOR_PIPE, image_pictor_pipe);
 REGISTER_DEMUXER (IMAGE_PNG_PIPE,image_png_pipe);
+REGISTER_DEMUXER (IMAGE_PPM_PIPE,image_ppm_pipe);
 REGISTER_DEMUXER (IMAGE_QDRAW_PIPE,  image_qdraw_pipe);
 REGISTER_DEMUXER (IMAGE_SGI_PIPE,image_sgi_pipe);
 REGISTER_DEMUXER (IMAGE_SUNRAST_PIPE,image_sunrast_pipe);
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index 1b0e608..ea07633 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -862,6 +862,19 @@ static int webp_probe(AVProbeData *p)
 return 0;
 }
 
+static int ppm_probe(AVProbeData *p)
+{
+const uint8_t *b = p->buf;
+
+if (b[0] == 'P' && b[1] >= '0' && b[1] <= '7') {
+while (b[2] == '\r')
+b++;
+if (b[2] == '\n' && (b[3] == '#' || (b[3] >= '0' && b[3] <= '9')))
+return AVPROBE_SCORE_EXTENSION + 2;
+}
+return 0;
+}
+
 #define IMAGEAUTO_DEMUXER(imgname, codecid)\
 static const AVClass imgname ## _class = {\
 .class_name = AV_STRINGIFY(imgname) " demuxer",\
@@ -891,6 +904,7 @@ IMAGEAUTO_DEMUXER(jpegls,  AV_CODEC_ID_JPEGLS)
 IMAGEAUTO_DEMUXER(pcx, AV_CODEC_ID_PCX)
 IMAGEAUTO_DEMUXER(pictor,  AV_CODEC_ID_PICTOR)
 IMAGEAUTO_DEMUXER(png, AV_CODEC_ID_PNG)
+IMAGEAUTO_DEMUXER(ppm, AV_CODEC_ID_PPM)
 IMAGEAUTO_DEMUXER(

[FFmpeg-devel] [PATCH] lavc/mediacodecdec_h264: use ff_h264_decode_extradata to extract PPS/SPS

2016-06-10 Thread Matthieu Bouron
From: Matthieu Bouron 

Fixes playback of HLS streams on MediaTek devices which requires PPS/SPS
to be set in their respective csd-{0,1} buffers.
---

Hello,

The attached patch fixes playback of HLS streams on MediaTek devices which
requires PPS/SPS to be set in their respetive csd-{0,1} buffers (instead of
having sps+pps in the csd-0 which works on other devices).

I'm not sure if I can use the ff_h264_decode_extradata this way (or at least
initialize the H264Context with zeroes minus the avctx field).

Matthieu

---
 configure   |   2 +-
 libavcodec/mediacodecdec_h264.c | 140 +---
 2 files changed, 30 insertions(+), 112 deletions(-)

diff --git a/configure b/configure
index 7c463a5..508affe 100755
--- a/configure
+++ b/configure
@@ -2544,7 +2544,7 @@ h264_d3d11va_hwaccel_select="h264_decoder"
 h264_dxva2_hwaccel_deps="dxva2"
 h264_dxva2_hwaccel_select="h264_decoder"
 h264_mediacodec_decoder_deps="mediacodec"
-h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_parser"
+h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_decoder h264_parser"
 h264_mmal_decoder_deps="mmal"
 h264_mmal_decoder_select="mmal"
 h264_mmal_hwaccel_deps="mmal"
diff --git a/libavcodec/mediacodecdec_h264.c b/libavcodec/mediacodecdec_h264.c
index 52e48ae..69e9122 100644
--- a/libavcodec/mediacodecdec_h264.c
+++ b/libavcodec/mediacodecdec_h264.c
@@ -32,6 +32,7 @@
 #include "libavutil/atomic.h"
 
 #include "avcodec.h"
+#include "h264.h"
 #include "internal.h"
 #include "mediacodecdec.h"
 #include "mediacodec_wrapper.h"
@@ -50,104 +51,6 @@ typedef struct MediaCodecH264DecContext {
 
 } MediaCodecH264DecContext;
 
-static int h264_extradata_to_annexb_sps_pps(AVCodecContext *avctx,
-uint8_t **extradata_annexb, int *extradata_annexb_size,
-int *sps_offset, int *sps_size,
-int *pps_offset, int *pps_size)
-{
-uint16_t unit_size;
-uint64_t total_size = 0;
-
-uint8_t i, j, unit_nb;
-uint8_t sps_seen = 0;
-uint8_t pps_seen = 0;
-
-const uint8_t *extradata;
-static const uint8_t nalu_header[4] = { 0x00, 0x00, 0x00, 0x01 };
-
-if (avctx->extradata_size < 8) {
-av_log(avctx, AV_LOG_ERROR,
-"Too small extradata size, corrupted stream or invalid MP4/AVCC 
bitstream\n");
-return AVERROR(EINVAL);
-}
-
-*extradata_annexb = NULL;
-*extradata_annexb_size = 0;
-
-*sps_offset = *sps_size = 0;
-*pps_offset = *pps_size = 0;
-
-extradata = avctx->extradata + 4;
-
-/* skip length size */
-extradata++;
-
-for (j = 0; j < 2; j ++) {
-
-if (j == 0) {
-/* number of sps unit(s) */
-unit_nb = *extradata++ & 0x1f;
-} else {
-/* number of pps unit(s) */
-unit_nb = *extradata++;
-}
-
-for (i = 0; i < unit_nb; i++) {
-int err;
-
-unit_size   = AV_RB16(extradata);
-total_size += unit_size + 4;
-
-if (total_size > INT_MAX) {
-av_log(avctx, AV_LOG_ERROR,
-"Too big extradata size, corrupted stream or invalid 
MP4/AVCC bitstream\n");
-av_freep(extradata_annexb);
-return AVERROR(EINVAL);
-}
-
-if (extradata + 2 + unit_size > avctx->extradata + 
avctx->extradata_size) {
-av_log(avctx, AV_LOG_ERROR, "Packet header is not contained in 
global extradata, "
-"corrupted stream or invalid MP4/AVCC bitstream\n");
-av_freep(extradata_annexb);
-return AVERROR(EINVAL);
-}
-
-if ((err = av_reallocp(extradata_annexb, total_size)) < 0) {
-return err;
-}
-
-memcpy(*extradata_annexb + total_size - unit_size - 4, 
nalu_header, 4);
-memcpy(*extradata_annexb + total_size - unit_size, extradata + 2, 
unit_size);
-extradata += 2 + unit_size;
-}
-
-if (unit_nb) {
-if (j == 0) {
-sps_seen = 1;
-*sps_size = total_size;
-} else {
-pps_seen = 1;
-*pps_size = total_size - *sps_size;
-*pps_offset = *sps_size;
-}
-}
-}
-
-*extradata_annexb_size = total_size;
-
-if (!sps_seen)
-av_log(avctx, AV_LOG_WARNING,
-   "Warning: SPS NALU missing or invalid. "
-   "The resulting stream may not play.\n");
-
-if (!pps_seen)
-av_log(avctx, AV_LOG_WARNING,
-   "Warning: PPS NALU missing or invalid. "
-   "The resulting stream may not play.\n");
-
-return 0;
-}
-
 static av_cold int mediacodec_decode_close(AVCodecContext *avctx)
 {
 MediaCodecH264DecContext *s = avctx->priv_data;
@@ -164,7 +67,12 @@ static av_cold int mediacodec_decode_close(AVCodecContext 
*avctx)
 
 static av_cold int mediacodec_decode_init(AVCodecContext *avctx)
 {
+i

Re: [FFmpeg-devel] [PATCH] swscale/swscale-test: Code to test scaler with slices

2016-06-10 Thread Pedro Arthur
patch applied.

2016-06-09 15:16 GMT-03:00 Michael Niedermayer :

> On Wed, Jun 08, 2016 at 10:04:46PM -0300, Pedro Arthur wrote:
> > Hi, I took the time to investigate it and I find a few bugs which I'm
> > attaching a patch for them.
>
> patches LGTM
>
>
> > Yet I'm not convinced that it is a definitive fix, since the output of
> > swscale-test differs in some cases when scaling the whole frame or in
> > slices.
>
> swscale-test tests alot, really alot
> some of the things it test are possibly buggy independant of slices
> i didnt check what remains though
>
>
> > Also there is a few fixes needed in this patch which took me a while to
> > figure out because I blindly trusted the patch was correct.
>
> never trust code, especially not a patch just posted that could not
> have been fully tested
>
> also thanks alot for looking into this!
>
>
> >
> > 2016-06-05 9:27 GMT-03:00 Michael Niedermayer :
> >
> > > +src_tmp[0] += srcStride[0] * i * STEP;
> > >
> > here it should be:
> > src_tmp[0] += srcStride[0] * i;
> >
> > +if (src_tmp[2]) {
> > > +int step = STEP >> desc_src->log2_chroma_h;
> > >
> > +src_tmp[1] += srcStride[1] * i * step;
> > > +src_tmp[2] += srcStride[2] * i * step;
> > > +}
> > > +if (src_tmp[3])
> > > +src_tmp[3] += srcStride[3] * i * STEP;
> > >
> > The same applies for the above code.
> >
> > Regards,
> > Pedro.
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Let us carefully observe those good qualities wherein our enemies excel us
> and endeavor to excel them, by avoiding what is faulty, and imitating what
> is excellent in them. -- Plutarch
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] Remove Benjamin Larsson from MAINTAINERS

2016-06-10 Thread compn
On Fri, 10 Jun 2016 04:09:26 +0200
Michael Niedermayer  wrote:

> On Thu, Jun 09, 2016 at 10:01:27PM +0200, Michael Niedermayer wrote:
> > On Thu, Jun 09, 2016 at 09:21:22PM +0200, Benjamin Larsson wrote:
> > > ---
> > >  MAINTAINERS | 9 ++---
> > >  1 file changed, 2 insertions(+), 7 deletions(-)
> > 
> > may i ask why you leave ?
> > i understand you where leaning more toward the fork and where
> > inactive for a long time but still, it almost feels inpolite of me
> > to just apply this without asking
> 
> i received a private reply from ben about this
> just saying so it doesnt look like he ignored the question

Benjamin also removed himself from libav consulting as well.

http://lists.libav.org/pipermail/libav-devel/2016-June/077471.html

the usual reason for not being a consultant anymore is that the dev got
a full time job. or realized that they do not have enough free time to
work on small consulting jobs.

working on ffmpeg, libav or any other multimedia oss project is an
interesting way to get hired. or to start their own video related
business. :)

devs come and go, the number one reason is lack of free time. thats
whats nice about open source, you can pick it up and drop it whenever.

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


Re: [FFmpeg-devel] FFmpeg 3.1

2016-06-10 Thread Matthieu Bouron
On Mon, Jun 06, 2016 at 10:23:20AM +0200, Matthieu Bouron wrote:
> On Mon, Jun 06, 2016 at 03:28:19AM +0200, Michael Niedermayer wrote:
> > Hi all
> > 
> > its time for making the next major release
> > If you want something in dont forget to push it to git master
> 
> I'd like to have the 3 pending MediaCodec patches merged before the
> release.

I'd like to have an upcoming MediaCodec patch which fixes playback of HLS
streams (and more generally annex-b streams) on MediaTek devices. The
issue has been reported by an user.

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


[FFmpeg-devel] [PATCH] avutil: add GBRAP10 pixel format support

2016-06-10 Thread Paul B Mahol
Hi,

patches attached.
From 3ca8b04b1675d0ae8691526d640584babcfa0acd Mon Sep 17 00:00:00 2001
From: Paul B Mahol 
Date: Fri, 10 Jun 2016 12:48:09 +0200
Subject: [PATCH 1/3] avutil: add 10-bit planar RGB with alpha

Signed-off-by: Paul B Mahol 
---
 libavutil/pixdesc.c | 28 
 libavutil/pixfmt.h  |  4 
 2 files changed, 32 insertions(+)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 4136980..0dffa4d 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2060,6 +2060,34 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
  AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
 },
+[AV_PIX_FMT_GBRAP10LE] = {
+.name = "gbrap10le",
+.nb_components = 4,
+.log2_chroma_w = 0,
+.log2_chroma_h = 0,
+.comp = {
+{ 2, 2, 0, 0, 10, 1, 9, 1 },   /* R */
+{ 0, 2, 0, 0, 10, 1, 9, 1 },   /* G */
+{ 1, 2, 0, 0, 10, 1, 9, 1 },   /* B */
+{ 3, 2, 0, 0, 10, 1, 9, 1 },   /* A */
+},
+.flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
+ AV_PIX_FMT_FLAG_ALPHA,
+},
+[AV_PIX_FMT_GBRAP10BE] = {
+.name = "gbrap10be",
+.nb_components = 4,
+.log2_chroma_w = 0,
+.log2_chroma_h = 0,
+.comp = {
+{ 2, 2, 0, 0, 10, 1, 9, 1 },   /* R */
+{ 0, 2, 0, 0, 10, 1, 9, 1 },   /* G */
+{ 1, 2, 0, 0, 10, 1, 9, 1 },   /* B */
+{ 3, 2, 0, 0, 10, 1, 9, 1 },   /* A */
+},
+.flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
+ AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
+},
 };
 #if FF_API_PLUS1_MINUS1
 FF_ENABLE_DEPRECATION_WARNINGS
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index bc0cf9e..0fc7848 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -300,6 +300,9 @@ enum AVPixelFormat {
 AV_PIX_FMT_GBRAP12BE,  ///< planar GBR 4:4:4:4 48bpp, big-endian
 AV_PIX_FMT_GBRAP12LE,  ///< planar GBR 4:4:4:4 48bpp, little-endian
 
+AV_PIX_FMT_GBRAP10BE,  ///< planar GBR 4:4:4:4 40bpp, big-endian
+AV_PIX_FMT_GBRAP10LE,  ///< planar GBR 4:4:4:4 40bpp, little-endian
+
 AV_PIX_FMT_NB,///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
 };
 
@@ -355,6 +358,7 @@ enum AVPixelFormat {
 #define AV_PIX_FMT_GBRP12AV_PIX_FMT_NE(GBRP12BE,GBRP12LE)
 #define AV_PIX_FMT_GBRP14AV_PIX_FMT_NE(GBRP14BE,GBRP14LE)
 #define AV_PIX_FMT_GBRP16AV_PIX_FMT_NE(GBRP16BE,GBRP16LE)
+#define AV_PIX_FMT_GBRAP10   AV_PIX_FMT_NE(GBRAP10BE,   GBRAP10LE)
 #define AV_PIX_FMT_GBRAP12   AV_PIX_FMT_NE(GBRAP12BE,   GBRAP12LE)
 #define AV_PIX_FMT_GBRAP16   AV_PIX_FMT_NE(GBRAP16BE,   GBRAP16LE)
 
-- 
2.5.0

From ca485a6c1fd8494c11e5b9859fdaf5e116d6245d Mon Sep 17 00:00:00 2001
From: Paul B Mahol 
Date: Fri, 10 Jun 2016 13:01:26 +0200
Subject: [PATCH 2/3] swscale: add input support for gbrap10 pixel format

Signed-off-by: Paul B Mahol 
---
 libswscale/input.c | 6 ++
 libswscale/utils.c | 6 ++
 2 files changed, 12 insertions(+)

diff --git a/libswscale/input.c b/libswscale/input.c
index eed0f49..14ab5ab 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -978,6 +978,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_GBRP9LE:
 c->readChrPlanar = planar_rgb9le_to_uv;
 break;
+case AV_PIX_FMT_GBRAP10LE:
 case AV_PIX_FMT_GBRP10LE:
 c->readChrPlanar = planar_rgb10le_to_uv;
 break;
@@ -995,6 +996,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_GBRP9BE:
 c->readChrPlanar = planar_rgb9be_to_uv;
 break;
+case AV_PIX_FMT_GBRAP10BE:
 case AV_PIX_FMT_GBRP10BE:
 c->readChrPlanar = planar_rgb10be_to_uv;
 break;
@@ -1258,6 +1260,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_GBRP9LE:
 c->readLumPlanar = planar_rgb9le_to_y;
 break;
+case AV_PIX_FMT_GBRAP10LE:
+c->readAlpPlanar = planar_rgb10le_to_a;
 case AV_PIX_FMT_GBRP10LE:
 c->readLumPlanar = planar_rgb10le_to_y;
 break;
@@ -1277,6 +1281,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_GBRP9BE:
 c->readLumPlanar = planar_rgb9be_to_y;
 break;
+case AV_PIX_FMT_GBRAP10BE:
+c->readAlpPlanar = planar_rgb10be_to_a;
 case AV_PIX_FMT_GBRP10BE:
 c->readLumPlanar = planar_rgb10be_to_y;
 break;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 63a8226..576d8f0 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -218,6 +218,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
 [AV_PIX_FMT_GBRP9BE] = { 1, 1 },
 [AV_PIX_FMT_GBRP10LE]= { 1, 1

Re: [FFmpeg-devel] [PATCH] avformat/flvenc: support codec config change mid stream

2016-06-10 Thread Carl Eugen Hoyos
Ivan  gmail.com> writes:

> +flv_write_codec_header(s, s->streams[i]->codecpar);

If you make facturing out this code a separate commit, 
it will make reviewing much easier.

Carl Eugen

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


Re: [FFmpeg-devel] [RFC] Bugs and CC

2016-06-10 Thread Carl Eugen Hoyos
Michael Niedermayer  niedermayer.cc> writes:

> Should the author of a commit causing a regression be added to 
> the CC of bugs if he has a trac account ?

The reason I am not doing this is that it was heavily discouraged 
in the past.

Carl Eugen

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


[FFmpeg-devel] [PATCH 2/2] ffmpeg: Add cuvid hwaccel support

2016-06-10 Thread Timo Rothenpieler
---
 Makefile   |   1 +
 ffmpeg.c   |   5 ++
 ffmpeg.h   |   3 +
 ffmpeg_cuvid.c | 237 +
 ffmpeg_opt.c   |   3 +
 5 files changed, 249 insertions(+)
 create mode 100644 ffmpeg_cuvid.c

diff --git a/Makefile b/Makefile
index 0ff4a87..4eca5d1 100644
--- a/Makefile
+++ b/Makefile
@@ -36,6 +36,7 @@ OBJS-ffmpeg-$(CONFIG_VAAPI)   += ffmpeg_vaapi.o
 ifndef CONFIG_VIDEOTOOLBOX
 OBJS-ffmpeg-$(CONFIG_VDA) += ffmpeg_videotoolbox.o
 endif
+OBJS-ffmpeg-$(CONFIG_CUVID)   += ffmpeg_cuvid.o
 OBJS-ffmpeg-$(HAVE_DXVA2_LIB) += ffmpeg_dxva2.o
 OBJS-ffmpeg-$(HAVE_VDPAU_X11) += ffmpeg_vdpau.o
 OBJS-ffserver += ffserver_config.o
diff --git a/ffmpeg.c b/ffmpeg.c
index 7c60075..652774f 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3063,6 +3063,11 @@ static int transcode_init(void)
 exit_program(1);
 #endif
 
+#if CONFIG_CUVID
+if (cuvid_transcode_init(ost))
+exit_program(1);
+#endif
+
 if (!ost->filter &&
 (enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO ||
  enc_ctx->codec_type == AVMEDIA_TYPE_AUDIO)) {
diff --git a/ffmpeg.h b/ffmpeg.h
index 20a1bf7..f09d33b 100644
--- a/ffmpeg.h
+++ b/ffmpeg.h
@@ -66,6 +66,7 @@ enum HWAccelID {
 HWACCEL_VIDEOTOOLBOX,
 HWACCEL_QSV,
 HWACCEL_VAAPI,
+HWACCEL_CUVID,
 };
 
 typedef struct HWAccel {
@@ -585,5 +586,7 @@ int qsv_init(AVCodecContext *s);
 int qsv_transcode_init(OutputStream *ost);
 int vaapi_decode_init(AVCodecContext *avctx);
 int vaapi_device_init(const char *device);
+int cuvid_init(AVCodecContext *s);
+int cuvid_transcode_init(OutputStream *ost);
 
 #endif /* FFMPEG_H */
diff --git a/ffmpeg_cuvid.c b/ffmpeg_cuvid.c
new file mode 100644
index 000..7fb47a2
--- /dev/null
+++ b/ffmpeg_cuvid.c
@@ -0,0 +1,237 @@
+/*
+ * 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 "libavutil/hwcontext.h"
+#include "libavutil/hwcontext_cuda.h"
+
+#include "ffmpeg.h"
+
+#include 
+#include 
+
+typedef struct CUVIDContext {
+AVBufferRef *hw_frames_ctx;
+} CUVIDContext;
+
+static void cuvid_uninit(AVCodecContext *avctx)
+{
+InputStream  *ist = avctx->opaque;
+CUVIDContext *ctx = ist->hwaccel_ctx;
+
+if (ctx) {
+av_buffer_unref(&ctx->hw_frames_ctx);
+av_freep(&ctx);
+}
+
+av_buffer_unref(&ist->hw_frames_ctx);
+
+ist->hwaccel_ctx = 0;
+ist->hwaccel_uninit = 0;
+}
+
+int cuvid_init(AVCodecContext *avctx)
+{
+InputStream  *ist = avctx->opaque;
+CUVIDContext *ctx = ist->hwaccel_ctx;
+
+av_log(NULL, AV_LOG_TRACE, "Initializing cuvid hwaccel\n");
+
+if (!ctx) {
+av_log(NULL, AV_LOG_ERROR, "CUVID transcoding is not initialized. "
+   "-hwaccel cuvid should only be used for one-to-one CUVID 
transcoding "
+   "with no (software) filters.\n");
+return AVERROR(EINVAL);
+}
+
+return 0;
+}
+
+static void cuvid_ctx_free(AVHWDeviceContext *ctx)
+{
+AVCUDADeviceContext *hwctx = ctx->hwctx;
+cuCtxDestroy(hwctx->cuda_ctx);
+}
+
+int cuvid_transcode_init(OutputStream *ost)
+{
+InputStream *ist;
+const enum AVPixelFormat *pix_fmt;
+AVCUDADeviceContext *device_hwctx;
+AVHWDeviceContext *device_ctx;
+AVHWFramesContext *hwframe_ctx;
+CUVIDContext *ctx = NULL;
+CUdevice device;
+CUcontext cuda_ctx = NULL;
+CUcontext dummy;
+CUresult err;
+int ret = 0;
+
+av_log(NULL, AV_LOG_TRACE, "Initializing cuvid transcoding\n");
+
+if (ost->source_index < 0)
+return 0;
+
+ist = input_streams[ost->source_index];
+
+/* check if the encoder supports CUVID */
+if (!ost->enc->pix_fmts)
+goto cancel;
+for (pix_fmt = ost->enc->pix_fmts; *pix_fmt != AV_PIX_FMT_NONE; pix_fmt++)
+if (*pix_fmt == AV_PIX_FMT_CUDA)
+break;
+if (*pix_fmt == AV_PIX_FMT_NONE)
+goto cancel;
+
+/* check if the decoder supports CUVID */
+if (ist->hwaccel_id != HWACCEL_CUVID || !ist->dec || !ist->dec->pix_fmts)
+goto cancel;
+for (pix_fmt = ist->dec->pix_fmts; *pix_fmt != AV_PIX_FMT_NONE; pix_fmt++)
+if (*pix_fmt == AV_PIX_FMT_CUDA)
+break;
+if (*pix_fmt == AV_PIX_FMT_NONE)
+goto cancel;
+
+  

[FFmpeg-devel] [PATCH 1/2] avcodec/cuvid: add cuvid decoder

2016-06-10 Thread Timo Rothenpieler
---
 Changelog  |   2 +
 MAINTAINERS|   1 +
 configure  |  34 +++
 libavcodec/Makefile|   5 +
 libavcodec/allcodecs.c |  10 +
 libavcodec/cuvid.c | 698 +
 libavcodec/version.h   |   2 +-
 7 files changed, 751 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/cuvid.c

diff --git a/Changelog b/Changelog
index 3d4997f..d44f607 100644
--- a/Changelog
+++ b/Changelog
@@ -40,6 +40,8 @@ version :
 - MagicYUV decoder
 - OpenExr improvements (tile data and B44/B44A support)
 - BitJazz SheerVideo decoder
+- CUDA CUVID H264/HEVC decoder
+
 
 version 3.0:
 - Common Encryption (CENC) MP4 encoding and decoding support
diff --git a/MAINTAINERS b/MAINTAINERS
index 23c0bab..4fe999d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -163,6 +163,7 @@ Codecs:
   cpia.cStephan Hilb
   crystalhd.c   Philip Langdale
   cscd.cReimar Doeffinger
+  cuvid.c   Timo Rothenpieler
   dca.c Kostya Shishkov, Benjamin Larsson
   dirac*Rostislav Pehlivanov
   dnxhd*Baptiste Coudurier
diff --git a/configure b/configure
index 7c463a5..a220fa1 100755
--- a/configure
+++ b/configure
@@ -158,6 +158,7 @@ Hardware accelerators:
 
 Hardware-accelerated decoding/encoding:
   --enable-cudaenable dynamically linked CUDA [no]
+  --enable-cuvid   enable CUVID support [autodetect]
   --enable-libmfx  enable HW acceleration through libmfx
   --enable-mmalenable decoding via MMAL [no]
   --enable-nvenc   enable NVIDIA NVENC support [no]
@@ -1567,6 +1568,7 @@ FEATURE_LIST="
 
 HW_CODECS_LIST="
 cuda
+cuvid
 libmfx
 mmal
 nvenc
@@ -2522,6 +2524,7 @@ audiotoolbox_extralibs="-framework CoreFoundation 
-framework AudioToolbox -frame
 
 # hardware accelerators
 crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
+cuvid_deps="cuda"
 d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder ID3D11VideoContext"
 dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode"
 vaapi_deps="va_va_h"
@@ -2539,6 +2542,7 @@ h263_vaapi_hwaccel_select="h263_decoder"
 h263_videotoolbox_hwaccel_deps="videotoolbox"
 h263_videotoolbox_hwaccel_select="h263_decoder"
 h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
+h264_cuvid_hwaccel_deps="cuda cuvid CUVIDH264PICPARAMS"
 h264_d3d11va_hwaccel_deps="d3d11va"
 h264_d3d11va_hwaccel_select="h264_decoder"
 h264_dxva2_hwaccel_deps="dxva2"
@@ -2564,6 +2568,7 @@ h264_vdpau_hwaccel_deps="vdpau"
 h264_vdpau_hwaccel_select="h264_decoder"
 h264_videotoolbox_hwaccel_deps="videotoolbox"
 h264_videotoolbox_hwaccel_select="h264_decoder"
+hevc_cuvid_hwaccel_deps="cuda cuvid CUVIDHEVCPICPARAMS"
 hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
 hevc_d3d11va_hwaccel_select="hevc_decoder"
 hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
@@ -2618,6 +2623,7 @@ mpeg4_videotoolbox_hwaccel_deps="videotoolbox"
 mpeg4_videotoolbox_hwaccel_select="mpeg4_decoder"
 msmpeg4_crystalhd_decoder_select="crystalhd"
 vc1_crystalhd_decoder_select="crystalhd"
+vc1_cuvid_hwaccel_deps="cuda cuvid CUVIDVC1PICPARAMS"
 vc1_d3d11va_hwaccel_deps="d3d11va"
 vc1_d3d11va_hwaccel_select="vc1_decoder"
 vc1_dxva2_hwaccel_deps="dxva2"
@@ -2633,6 +2639,8 @@ vc1_vdpau_decoder_deps="vdpau"
 vc1_vdpau_decoder_select="vc1_decoder"
 vc1_vdpau_hwaccel_deps="vdpau"
 vc1_vdpau_hwaccel_select="vc1_decoder"
+vp8_cuvid_hwaccel_deps="cuda cuvid CUVIDVP9PICPARAMS"
+vp9_cuvid_hwaccel_deps="cuda cuvid CUVIDVP9PICPARAMS"
 vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
 vp9_d3d11va_hwaccel_select="vp9_decoder"
 vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"
@@ -2657,6 +2665,8 @@ hwupload_cuda_filter_deps="cuda"
 scale_npp_filter_deps="cuda libnpp"
 
 nvenc_encoder_deps="nvenc"
+h264_cuvid_decoder_deps="cuda cuvid CUVIDH264PICPARAMS"
+h264_cuvid_decoder_select="h264_mp4toannexb_bsf h264_cuvid_hwaccel"
 h264_qsv_decoder_deps="libmfx"
 h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec 
h264_qsv_hwaccel"
 h264_qsv_encoder_deps="libmfx"
@@ -2664,6 +2674,8 @@ h264_qsv_encoder_select="qsvenc"
 h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
 h264_vaapi_encoder_select="vaapi_encode golomb"
 
+hevc_cuvid_decoder_deps="cuda cuvid CUVIDHEVCPICPARAMS"
+hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf hevc_cuvid_hwaccel"
 hevc_qsv_decoder_deps="libmfx"
 hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec 
hevc_qsv_hwaccel"
 hevc_qsv_encoder_deps="libmfx"
@@ -2677,6 +2689,13 @@ mpeg2_qsv_encoder_select="qsvenc"
 nvenc_h264_encoder_deps="nvenc"
 nvenc_hevc_encoder_deps="nvenc"
 
+vc1_cuvid_decoder_deps="cuda cuvid CUVIDVC1PICPARAMS"
+vc1_cuvid_decoder_select="vc1_cuvid_hwaccel"
+vp8_cuvid_decoder_deps="cuda cuvid CUVIDVP9PICPARAMS"
+vp8_cuvid_decoder_select="vp8_cuvid_hwaccel"
+vp9_cuvid_

[FFmpeg-devel] [PATCH 0/2] Add CUDA CUVID decoder/hwaccel

2016-06-10 Thread Timo Rothenpieler
Will push later today if there are no further comments or objections.


Timo Rothenpieler (2):
  avcodec/cuvid: add cuvid decoder
  ffmpeg: Add cuvid hwaccel support

 Changelog  |   2 +
 MAINTAINERS|   1 +
 Makefile   |   1 +
 configure  |  34 +++
 ffmpeg.c   |   5 +
 ffmpeg.h   |   3 +
 ffmpeg_cuvid.c | 237 +
 ffmpeg_opt.c   |   3 +
 libavcodec/Makefile|   5 +
 libavcodec/allcodecs.c |  10 +
 libavcodec/cuvid.c | 698 +
 libavcodec/version.h   |   2 +-
 12 files changed, 1000 insertions(+), 1 deletion(-)
 create mode 100644 ffmpeg_cuvid.c
 create mode 100644 libavcodec/cuvid.c

-- 
2.8.4

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


[FFmpeg-devel] [RFC] Bugs and CC

2016-06-10 Thread Michael Niedermayer
Hi all

Should the author of a commit causing a regression be added to the CC
of bugs if he has a trac account ?

iam thinking yes because i quite often find out about regressions
by running into them by chance on trac which is ofte long after
the git hash that caused the regression was added to the ticket

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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