Re: [FFmpeg-devel] [PATCH] - libavdevices/decklink_*.cpp: formatting change to remove uneeded spaces in initializers

2016-08-02 Thread Timothy Gu
On Tue, Aug 2, 2016 at 10:17 PM Felt, Patrick 
wrote:

> ---
> libavdevice/decklink_common.cpp | 10 +-
> libavdevice/decklink_dec.cpp| 18 +-
> libavdevice/decklink_enc.cpp| 26 +-
> 3 files changed, 27 insertions(+), 27 deletions(-)
>

Pushed. If you could use git send-email to send patches, or at least send a
git formatted patch with a commit message and an author, that would be the
best.

Thanks,

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


Re: [FFmpeg-devel] [PATCH] af_hdcd: add flags to AVOption defs

2016-08-02 Thread Timothy Gu
On Mon, Aug 1, 2016 at 8:56 AM Burt P  wrote:

> Signed-off-by: Burt P 
> ---
>  libavfilter/af_hdcd.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>

Applied. You might also want to look into using AV_OPT_TYPE_BOOL for these
two options.

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


Re: [FFmpeg-devel] [PATCH] jni, mediacodec: Return ENOSYS on unsupported platforms

2016-08-02 Thread Timothy Gu
On Tue, Aug 2, 2016 at 8:42 PM Timothy Gu  wrote:

> On Tue, Aug 2, 2016 at 6:30 PM James Almer  wrote:
>
>> On 8/2/2016 7:28 PM, Timothy Gu wrote:
>> > ---
>> >  libavcodec/jni.c| 9 -
>> >  libavcodec/mediacodec.c | 6 --
>> >  2 files changed, 8 insertions(+), 7 deletions(-)
>> >
>>
>> I'd say split this in two patches, so you can easily cherry-pick
>> the jni part for release branches 3.0 and 3.1.
>>
>
> Done locally. Thanks for noticing.
>

Split up and pushed.

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


[FFmpeg-devel] [PATCH] - libavdevices/decklink_*.cpp: formatting change to remove uneeded spaces in initializers

2016-08-02 Thread Felt, Patrick
---
libavdevice/decklink_common.cpp | 10 +-
libavdevice/decklink_dec.cpp| 18 +-
libavdevice/decklink_enc.cpp| 26 +-
3 files changed, 27 insertions(+), 27 deletions(-)


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


Re: [FFmpeg-devel] snapshots differ from git clone

2016-08-02 Thread Jan Ehrhardt
Nicolas George in gmane.comp.video.ffmpeg.devel (Wed, 3 Aug 2016
01:22:18 +0200):
>Actually, I was talking about snapshots generated by gitweb. I realize now
>that the snapshot we are talking are generated differently, and they contain
>a full pack of the .git directory. That makes them roughly equivalent to a
>full clone. But bigger.

It really makes them equivalent. Once unpacked, you can do everything on
it with git commands. In my workaround for resolving the stale files
issue I was using git stash, but git pull is possible as well. So for an
initial setup of the build environment it is faster to grab a snapshot,
unpack it and optionally do a git pull.

@Michael Niedermayer: The stale files did not re-appear, so the issue
was solved. Thanks.
-- 
Jan
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec/vdpau: clean up vdpau_internal.h

2016-08-02 Thread James Almer
Also don't include it on files that don't need it.

This reduces differences with libav

Signed-off-by: James Almer 
---
Untested with VDPAU enabled.

 libavcodec/mpeg12.c |  1 -
 libavcodec/svq3.c   |  1 -
 libavcodec/vdpau_internal.h | 10 +-
 3 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 7c14052..a61d45b 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -39,7 +39,6 @@
 #include "mpeg12data.h"
 #include "mpegvideodata.h"
 #include "bytestream.h"
-#include "vdpau_internal.h"
 #include "thread.h"
 
 uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3];
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 223819f..bb4508c 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -53,7 +53,6 @@
 #include "mathops.h"
 #include "rectangle.h"
 #include "tpeldsp.h"
-#include "vdpau_internal.h"
 
 #if CONFIG_ZLIB
 #include 
diff --git a/libavcodec/vdpau_internal.h b/libavcodec/vdpau_internal.h
index 8a63733..77800af 100644
--- a/libavcodec/vdpau_internal.h
+++ b/libavcodec/vdpau_internal.h
@@ -24,15 +24,13 @@
 #ifndef AVCODEC_VDPAU_INTERNAL_H
 #define AVCODEC_VDPAU_INTERNAL_H
 
-#include "config.h"
 #include 
-#if CONFIG_VDPAU
 #include 
-#endif
 
 #include "libavutil/frame.h"
 
 #include "avcodec.h"
+#include "vdpau.h"
 
 /** Extract VdpVideoSurface from an AVFrame */
 static inline uintptr_t ff_vdpau_get_surface_id(AVFrame *pic)
@@ -40,8 +38,6 @@ static inline uintptr_t ff_vdpau_get_surface_id(AVFrame *pic)
 return (uintptr_t)pic->data[3];
 }
 
-struct vdpau_picture_context;
-#if CONFIG_VDPAU
 union VDPAUPictureInfo {
 VdpPictureInfoH264h264;
 VdpPictureInfoMPEG1Or2mpeg;
@@ -55,8 +51,6 @@ union VDPAUPictureInfo {
 #endif
 };
 
-#include "vdpau.h"
-
 typedef struct VDPAUHWContext {
 AVVDPAUContext context;
 VdpDevice device;
@@ -114,8 +108,6 @@ struct vdpau_picture_context {
 
 int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile,
  int level);
-#endif //CONFIG_VDPAU
-
 int ff_vdpau_common_uninit(AVCodecContext *avctx);
 
 int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic,
-- 
2.9.1

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


Re: [FFmpeg-devel] [PATCH] jni, mediacodec: Return ENOSYS on unsupported platforms

2016-08-02 Thread Timothy Gu
On Tue, Aug 2, 2016 at 6:30 PM James Almer  wrote:

> On 8/2/2016 7:28 PM, Timothy Gu wrote:
> > ---
> >  libavcodec/jni.c| 9 -
> >  libavcodec/mediacodec.c | 6 --
> >  2 files changed, 8 insertions(+), 7 deletions(-)
> >
>
> I'd say split this in two patches, so you can easily cherry-pick
> the jni part for release branches 3.0 and 3.1.
>

Done locally. Thanks for noticing.

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


Re: [FFmpeg-devel] [PATCH] jni, mediacodec: Return ENOSYS on unsupported platforms

2016-08-02 Thread James Almer
On 8/2/2016 7:28 PM, Timothy Gu wrote:
> ---
>  libavcodec/jni.c| 9 -
>  libavcodec/mediacodec.c | 6 --
>  2 files changed, 8 insertions(+), 7 deletions(-)
> 

I'd say split this in two patches, so you can easily cherry-pick
the jni part for release branches 3.0 and 3.1.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavcodec/dnxhd: Enable 12-bit DNxHR support.

2016-08-02 Thread Michael Niedermayer
On Mon, Aug 01, 2016 at 11:26:12PM -0700, Steven Robertson wrote:
> 10- and 12-bit DNxHR use the same DC coefficient decoding process and
> VLC table, just with a different shift value. From SMPTE 2019-1:2016,
> 8.2.4 DC Coefficient Decoding:
> 
> "For 8-bit video sampling, the maximum value of η=11 and for
> 10-/12-bit video sampling, the maximum value of η=13."
> 
> A sample file will be uploaded to show that with this patch, things
> decode correctly:
> dnxhr_hqx_12bit_1080p_smpte_colorbars_davinci_resolve.mov
> 
> Signed-off-by: Steven Robertson 
> ---
>  libavcodec/dnxhddec.c | 7 +--
>  1 file changed, 1 insertion(+), 6 deletions(-)

applied

can you add a fate test

thx

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

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf


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


Re: [FFmpeg-devel] [PATCH] jni, mediacodec: Return ENOSYS on unsupported platforms

2016-08-02 Thread Michael Niedermayer
On Tue, Aug 02, 2016 at 03:28:10PM -0700, Timothy Gu wrote:
> ---
>  libavcodec/jni.c| 9 -
>  libavcodec/mediacodec.c | 6 --
>  2 files changed, 8 insertions(+), 7 deletions(-)

builds on all systems that are easy testable here

[...]
-- 
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] snapshots differ from git clone

2016-08-02 Thread Michael Niedermayer
On Tue, Aug 02, 2016 at 10:41:09PM +, Timothy Gu wrote:
> On Tue, Aug 2, 2016 at 3:10 PM Nicolas George  wrote:
> 
> > Le sextidi 16 thermidor, an CCXXIV, Jan Ehrhardt a écrit :
> > > Because it is faster to download a snapshot and extract it than
> > > doing a git clone
> >
> > I suggest you consider doing a shallow clone (--depth 1). It should take
> > roughly the same time as getting and unpacking a snapshot. IIRC, one of the
> > minor perks of doing that is that the version script will give a more
> > useful
> > version tag.
> >
> 
> At least here, Git is still slower. In addition, https://git.ffmpeg.org
> doesn't seem to support --depth.
> 
> $ time curl https://www.ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 | tar
> -jxf -
> real 0m10.331s
> user 0m2.272s
> sys 0m0.312s
> $ git clone --depth=1 https://git.ffmpeg.org/ffmpeg.git ffmpeg2
> Cloning into 'ffmpeg2'...
> fatal: The remote end hung up unexpectedly
> fatal: protocol error: bad pack header

this is due to git wanting to write temporary files into the repository
which is not writable.
Making it writable would be trivial and thats how linaro seems to
have "fixed" it, but iam not sure thats a good idea security wise
Updatng the git to something beyond whats available from the official
ubuntu we use might fix this but then future security updates would
become harder.
(recent git is available at
 https://launchpad.net/~git-core/+archive/ubuntu/ppa
 so we would still have distro provided packages but security support
 would be an open question ...)
so while all solutions are kind of not hard, iam a bit undecided
what should be done about that 

[...]

-- 
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] snapshots differ from git clone

2016-08-02 Thread Nicolas George
Le septidi 17 thermidor, an CCXXIV, Carl Eugen Hoyos a écrit :
> This would be a bug.

No, that would be an inherent limitation of the snapshots: they do not
contain anything that can give an accurate version.

Actually, I was talking about snapshots generated by gitweb. I realize now
that the snapshot we are talking are generated differently, and they contain
a full pack of the .git directory. That makes them roughly equivalent to a
full clone. But bigger.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] snapshots differ from git clone

2016-08-02 Thread Carl Eugen Hoyos
Hi!

2016-08-03 0:09 GMT+02:00 Nicolas George :
> IIRC, one of the minor perks of doing that is that the version
> script will give a more useful version tag.

This would be a bug.

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


Re: [FFmpeg-devel] snapshots differ from git clone

2016-08-02 Thread Nicolas George
Le sextidi 16 thermidor, an CCXXIV, Timothy Gu a écrit :
> In addition, https://git.ffmpeg.org doesn't seem to support --depth.

git://source.ffmpeg.org/ffmpeg (i.e. the videolan server) does. It would
probably be better if our server did too, but I do not know how.

> $ time git clone --depth=1 https://github.com/FFmpeg/FFmpeg.git ffmpeg2
> real 0m17.540s

Slower indeed, but still much faster than a full clone, and with a few
benefits compared to a snapshot.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] How to force key frame for h264_qsv encoder?

2016-08-02 Thread Chao Liu
Need to add some code like following here

if (frame->pict_type == AV_PICTURE_TYPE_I) {
enc_ctrl->FrameType = MFX_FRAMETYPE_I | MFX_FRAMETYPE_IDR |
MFX_FRAMETYPE_REF;
 }


On Mon, Aug 1, 2016 at 1:20 PM, Chao Liu  wrote:

> Hi,
> Looks like h264_qsv doesn't respect AVFrame.pict_type now.
> It always encodes to non-key frames except for the first frame.
> Is this a bug of ffmpeg or QSV doesn't support key frames?
>
> Command I use:
> ffmpeg -debug_ts -i orig.mp4 -force_key_frames 'expr:gte(t,n_forced)'
> -look_ahead 0 -c:v h264_qsv -b:v 800k -maxrate 1600k -preset faster test.mp4
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] snapshots differ from git clone

2016-08-02 Thread Timothy Gu
On Tue, Aug 2, 2016 at 3:10 PM Nicolas George  wrote:

> Le sextidi 16 thermidor, an CCXXIV, Jan Ehrhardt a écrit :
> > Because it is faster to download a snapshot and extract it than
> > doing a git clone
>
> I suggest you consider doing a shallow clone (--depth 1). It should take
> roughly the same time as getting and unpacking a snapshot. IIRC, one of the
> minor perks of doing that is that the version script will give a more
> useful
> version tag.
>

At least here, Git is still slower. In addition, https://git.ffmpeg.org
doesn't seem to support --depth.

$ time curl https://www.ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 | tar
-jxf -
real 0m10.331s
user 0m2.272s
sys 0m0.312s
$ git clone --depth=1 https://git.ffmpeg.org/ffmpeg.git ffmpeg2
Cloning into 'ffmpeg2'...
fatal: The remote end hung up unexpectedly
fatal: protocol error: bad pack header
$ time git clone --depth=1 https://github.com/FFmpeg/FFmpeg.git ffmpeg2
real 0m17.540s
user 0m1.308s
sys 0m0.308s

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


[FFmpeg-devel] [PATCH] jni, mediacodec: Return ENOSYS on unsupported platforms

2016-08-02 Thread Timothy Gu
---
 libavcodec/jni.c| 9 -
 libavcodec/mediacodec.c | 6 --
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/libavcodec/jni.c b/libavcodec/jni.c
index 32456f5..85dcf2a 100644
--- a/libavcodec/jni.c
+++ b/libavcodec/jni.c
@@ -20,19 +20,18 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "config.h"
+
 #include 
 
-#include "config.h"
+#include "libavutil/error.h"
 #include "jni.h"
 
 #if CONFIG_JNI
-
-#include 
 #include 
 #include 
 
 #include "libavutil/log.h"
-#include "libavutil/error.h"
 #include "ffjni.h"
 
 void *java_vm;
@@ -69,7 +68,7 @@ void *av_jni_get_java_vm(void *log_ctx)
 
 int av_jni_set_java_vm(void *vm, void *log_ctx)
 {
-return 0;
+return AVERROR(ENOSYS);
 }
 
 void *av_jni_get_java_vm(void *log_ctx)
diff --git a/libavcodec/mediacodec.c b/libavcodec/mediacodec.c
index cd8766f..a658f0e 100644
--- a/libavcodec/mediacodec.c
+++ b/libavcodec/mediacodec.c
@@ -22,6 +22,8 @@
 
 #include "config.h"
 
+#include "libavutil/error.h"
+
 #if CONFIG_H264_MEDIACODEC_HWACCEL
 
 #include 
@@ -108,7 +110,7 @@ AVMediaCodecContext *av_mediacodec_alloc_context(void)
 
 int av_mediacodec_default_init(AVCodecContext *avctx, AVMediaCodecContext 
*ctx, void *surface)
 {
-return 0;
+return AVERROR(ENOSYS);
 }
 
 void av_mediacodec_default_free(AVCodecContext *avctx)
@@ -117,7 +119,7 @@ void av_mediacodec_default_free(AVCodecContext *avctx)
 
 int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render)
 {
-return 0;
+return AVERROR(ENOSYS);
 }
 
 #endif
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH 1/2] mem: Order function prototypes semantically

2016-08-02 Thread Timothy Gu
On Tue, Aug 2, 2016 at 3:13 PM Michael Niedermayer 
wrote:

> On Sun, Jul 31, 2016 at 09:07:03PM -0700, Timothy Gu wrote:
> > ---
> >  libavutil/mem.h | 198
> 
> >  1 file changed, 99 insertions(+), 99 deletions(-)
>
> LGTM if that order is preferred
>

Thanks, pushed.

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


Re: [FFmpeg-devel] [PATCH 1/2] mem: Order function prototypes semantically

2016-08-02 Thread Michael Niedermayer
On Sun, Jul 31, 2016 at 09:07:03PM -0700, Timothy Gu wrote:
> ---
>  libavutil/mem.h | 198 
> 
>  1 file changed, 99 insertions(+), 99 deletions(-)

LGTM if that order is preferred

thx

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

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


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


Re: [FFmpeg-devel] snapshots differ from git clone

2016-08-02 Thread Nicolas George
Le sextidi 16 thermidor, an CCXXIV, Jan Ehrhardt a écrit :
> Because it is faster to download a snapshot and extract it than
> doing a git clone

I suggest you consider doing a shallow clone (--depth 1). It should take
roughly the same time as getting and unpacking a snapshot. IIRC, one of the
minor perks of doing that is that the version script will give a more useful
version tag.

And of course, if you do frequent updates, using a full clone and pulling to
it incrementally will be even faster since it only downloads the changes.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [Libav-user] [PATCH]Fix a crash in vaapi_encode if "." is not the decimal separator

2016-08-02 Thread Nicolas George
Le sextidi 16 thermidor, an CCXXIV, Mark Thompson a écrit :
> However, I'm not sure about the backward compatibility - with the current
> behaviour users can have scripts containing "1,2" in any numeric argument
> to ffmpeg (meaning 6/5 as here) and have it parsed correctly because of
> their locale settings.

This was never a documented behaviour, and therefore IMHO we do not have to
support it, especially not if it breaks the documented behaviour.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] jni, mediacodec: Return ENOSYS on unsupported platforms

2016-08-02 Thread Michael Niedermayer
On Tue, Aug 02, 2016 at 01:38:40PM -0700, Timothy Gu wrote:
> ---
>  libavcodec/jni.c| 2 +-
>  libavcodec/mediacodec.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/jni.c b/libavcodec/jni.c
> index 32456f5..e08a185 100644
> --- a/libavcodec/jni.c
> +++ b/libavcodec/jni.c
> @@ -69,7 +69,7 @@ void *av_jni_get_java_vm(void *log_ctx)
>  
>  int av_jni_set_java_vm(void *vm, void *log_ctx)
>  {
> -return 0;
> +return AVERROR(ENOSYS);
>  }

libavcodec/jni.c: In function ‘av_jni_set_java_vm’:
libavcodec/jni.c:72:5: error: implicit declaration of function ‘AVERROR’ 
[-Werror=implicit-function-declaration]
libavcodec/jni.c:72:20: error: ‘ENOSYS’ undeclared (first use in this function)
libavcodec/jni.c:72:20: note: each undeclared identifier is reported only once 
for each function it appears in
libavcodec/jni.c:73:1: error: control reaches end of non-void function 
[-Werror=return-type]


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

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


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


Re: [FFmpeg-devel] [PATCH 10/11] avformat/fifo: Add AVFMT_FLAG_NONBLOCK support

2016-08-02 Thread Michael Niedermayer
On Tue, Aug 02, 2016 at 03:24:21PM +0200, sebechlebsky...@gmail.com wrote:
> From: Jan Sebechlebsky 
> 
> Add support for nonblocking calls.
> 
> Signed-off-by: Jan Sebechlebsky 
> ---
>  libavformat/fifo.c | 70 
> +-
>  1 file changed, 59 insertions(+), 11 deletions(-)

breaks on x86-32 linux

src/libavformat/fifo.c: In function ‘fifo_write_trailer’:
src/libavformat/fifo.c:626:9: error: implicit declaration of function 
‘pthread_tryjoin_np’ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make: *** [libavformat/fifo.o] Error 1

[...]
-- 
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] snapshots differ from git clone

2016-08-02 Thread Michael Niedermayer
On Tue, Aug 02, 2016 at 10:54:15PM +0200, Jan Ehrhardt wrote:
> I have a script that cross-compiles ffmpeg on Ubuntu for Windows.
> Because it is faster to download a snapshot and extract it than
> doing a git clone the script uses
> http://ffmpeg.org/releases/ffmpeg-snapshot-git.tar.bz2
> 
> Recently I ran into unresolved externals in x86/dirac_dwt_init.c/o.
> Details below. A clumsy workaround:
> 
> $ rm -f libavcodec/x86/dirac*
> $ git stash
> 
> The problem seems to be that the snapshots differ from a git clone
> and for instance contain >50 untracked files, amongst which:
> 
> libavcodec/x86/dirac_dwt.c
> libavcodec/x86/dirac_dwt.h
> libavcodec/x86/diracdsp_mmx.c
> libavcodec/x86/diracdsp_mmx.h
> libavcodec/x86/diracdsp_yasm.asm
> libavcodec/x86/dwt_yasm.asm
> libavcodec/x86/vc1dsp.asm
> 
> A git clone has only these files:
> 
> libavcodec/x86/diracdsp.asm
> libavcodec/x86/diracdsp_init.c
> libavcodec/x86/dirac_dwt.asm
> libavcodec/x86/dirac_dwt_init.c
> 
> Question: why are the snapshots different from a git clone?

some stale files in the directory used to build the snapshot
ive fixed it earlier today
this should not reoccur

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

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad


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


Re: [FFmpeg-devel] snapshots differ from git clone

2016-08-02 Thread Timothy Gu
On Tue, Aug 2, 2016 at 1:54 PM Jan Ehrhardt  wrote:

> I have a script that cross-compiles ffmpeg on Ubuntu for Windows.
> Because it is faster to download a snapshot and extract it than
> doing a git clone the script uses
> http://ffmpeg.org/releases/ffmpeg-snapshot-git.tar.bz2


This sounds like a bug on the snapshot server. The files you mentioned were
removed from Git in e3461197b and 9fd6ea933fa.

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


Re: [FFmpeg-devel] [PATCH] [RFC] libavfilter HRTF/room acoustics filter [1/2]

2016-08-02 Thread Yue Shi Lai
On 08/02/2016 08:40 AM, Paul B Mahol wrote:
> On 8/2/16, Yue Shi Lai  wrote:
>> - integrated matrix decoder (probably better suited as a separate filter)
> 
> This one does what?

This is an implementation of the steering or active matrix surround
decoder (e.g. Quadraphonic or Dolby Surround). Implemented are 2-to-4, 5
and 6 channels (the last one is to decode 5.1 into 7.1, either
consumer-type 4 rear/surround or SDDS downmix with 5 front channels).
Active matrix means that there is an active feed-back system suppressing
cross talk for point sources (e.g. Tate DES and ProLogic). I take the
statement from the users list
(https://ffmpeg.org/pipermail/ffmpeg-user/2013-May/015091.html) still
correct, there is no (even passive) matrix decoder in FFmpeg?

On a somewhat related matter: I was browsing through the matrix encoder
in libavresample/audio_mix_matrix.c, and possibly rediscovered the bug
in https://trac.ffmpeg.org/ticket/4175 . Also, the 5-channel coefficient
seems to disagrees with Dolby (see the notes I wrote at some point while
editing the Wikipedia section in
https://en.wikipedia.org/wiki/Talk:Dolby_Pro_Logic#Source_of_the_DPLII_encoding_matrix.3F).
I have a properly implemented encoder with a FIR Hilbert transformer
around, and since there is FFT now in FFmpeg, may investigate later if
#4175 can be addressed.

> There is already function that does accumulated multiplication IIRC no
> need to use intrinsic,
> i think is called fdsp->vector_fmac_scalar so use that instead of your
> scale_accumulate.
> See how its called in sofalizer filter: libavfilter/af_sofalizer.c
> 
> Similar to pthread usage there is internal wrapper which should be used.

I will include these together with other comments you may have.

> Can't filter be made so it load kemar data from file instead hardcoded
> into lavfi?

It is possible and I will try a modification in that regard.

Best wishes,

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


[FFmpeg-devel] snapshots differ from git clone

2016-08-02 Thread Jan Ehrhardt
I have a script that cross-compiles ffmpeg on Ubuntu for Windows.
Because it is faster to download a snapshot and extract it than
doing a git clone the script uses
http://ffmpeg.org/releases/ffmpeg-snapshot-git.tar.bz2

Recently I ran into unresolved externals in x86/dirac_dwt_init.c/o.
Details below. A clumsy workaround:

$ rm -f libavcodec/x86/dirac*
$ git stash

The problem seems to be that the snapshots differ from a git clone
and for instance contain >50 untracked files, amongst which:

libavcodec/x86/dirac_dwt.c
libavcodec/x86/dirac_dwt.h
libavcodec/x86/diracdsp_mmx.c
libavcodec/x86/diracdsp_mmx.h
libavcodec/x86/diracdsp_yasm.asm
libavcodec/x86/dwt_yasm.asm
libavcodec/x86/vc1dsp.asm

A git clone has only these files:

libavcodec/x86/diracdsp.asm
libavcodec/x86/diracdsp_init.c
libavcodec/x86/dirac_dwt.asm
libavcodec/x86/dirac_dwt_init.c

Question: why are the snapshots different from a git clone?
-- 
Jan

Details of the builds below

(more undefined references)
/sandbox/win32/ffmpeg/libavcodec/x86/dirac_dwt_init.c:138: undefined reference 
to `ff_vertical_compose_dd137iL0_mmx'
libavcodec/libavcodec.a(dirac_dwt_init.o): In function 
`vertical_compose_dirac53iH0_mmx':
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/dirac_dwt_init.c:138: undefined 
reference to `ff_vertical_compose_dirac53iH0_mmx'
libavcodec/libavcodec.a(dirac_dwt_init.o): In function 
`vertical_compose_dd97iH0_mmx':
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/dirac_dwt_init.c:138: undefined 
reference to `ff_vertical_compose_dd97iH0_mmx'
libavcodec/libavcodec.a(dirac_dwt_init.o): In function 
`vertical_compose53iL0_mmx':
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/dirac_dwt_init.c:138: undefined 
reference to `ff_vertical_compose53iL0_mmx'
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
make: *** [ffmpeg_g.exe] Error 1
make: *** Waiting for unfinished jobs
make: *** [ffplay_g.exe] Error 1
jan@box:~/sandbox/win32/ffmpeg$ ls -la 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/dirac*
-rw-rw-r-- 1 jan jan  8500 Jul 22 18:20 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/diracdsp.asm
-rw-rw-r-- 1 jan jan   122 Aug  2 01:09 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/diracdsp.d
-rw-rw-r-- 1 jan jan  8883 Jul 22 18:20 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/diracdsp_init.c
-rw-rw-r-- 1 jan jan   225 Aug  2 01:09 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/diracdsp_init.d
-rw-rw-r-- 1 jan jan 17146 Aug  2 01:09 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/diracdsp_init.o
-rw-r--r-- 1 jan jan  6752 Jul 21  2014 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/diracdsp_mmx.c
-rw-r--r-- 1 jan jan  2176 Nov  1  2012 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/diracdsp_mmx.h
-rw-rw-r-- 1 jan jan  4262 Aug  2 01:09 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/diracdsp.o
-rw-rw-r-- 1 jan jan  6687 Jul 26  2015 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/diracdsp_yasm.asm
-rw-rw-r-- 1 jan jan  7514 Feb  6 19:20 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/dirac_dwt.asm
-rw-r--r-- 1 jan jan  6946 Jul 21  2014 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/dirac_dwt.c
-rw-rw-r-- 1 jan jan   243 Aug  2 01:09 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/dirac_dwt.d
-rw-r--r-- 1 jan jan  1190 May 25  2013 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/dirac_dwt.h
-rw-rw-r-- 1 jan jan  7800 Feb  6 19:20 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/dirac_dwt_init.c
-rw-rw-r-- 1 jan jan   226 Aug  2 01:09 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/dirac_dwt_init.d
-rw-rw-r-- 1 jan jan 18426 Aug  2 01:09 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/dirac_dwt_init.o
-rw-rw-r-- 1 jan jan 15806 Aug  2 01:09 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/dirac_dwt.o
jan@box:~/sandbox/win32/ffmpeg$ rm -f 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/dirac*
jan@box:~/sandbox/win32/ffmpeg$ git stash
Saved working directory and index state WIP on master: d9b0b1a applied
HEAD is now at d9b0b1a applied
jan@box:~/sandbox/win32/ffmpeg$ ls -la 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/dirac*
-rw-rw-r-- 1 jan jan 8500 Aug  2 01:16 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/diracdsp.asm
-rw-rw-r-- 1 jan jan 8883 Aug  2 01:16 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/diracdsp_init.c
-rw-rw-r-- 1 jan jan 7514 Aug  2 01:16 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/dirac_dwt.asm
-rw-rw-r-- 1 jan jan 7800 Aug  2 01:16 
/home/jan/sandbox/win32/ffmpeg/libavcodec/x86/dirac_dwt_init.c
jan@box:~/sandbox/win32/ffmpeg$ git status
Untracked files:
  (use "git add ..." to include in what will be committed)

libavcodec/aac_tablegen.c
libavcodec/aac_tablegen.h
libavcodec/aac_tablegen_decl.h
libavcodec/aacsbr_fixed_tablegen.c
libavcodec/aacsbr_tablegen.c
libavcodec/arm/dcadsp_init_arm.c
libavcodec/arm/dcadsp_neon.S
libavcodec/arm/dcadsp_vfp.S
libavcodec/arm/dct-test.c
libavcodec/dct-test.c

[FFmpeg-devel] [PATCH] jni, mediacodec: Return ENOSYS on unsupported platforms

2016-08-02 Thread Timothy Gu
---
 libavcodec/jni.c| 2 +-
 libavcodec/mediacodec.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/jni.c b/libavcodec/jni.c
index 32456f5..e08a185 100644
--- a/libavcodec/jni.c
+++ b/libavcodec/jni.c
@@ -69,7 +69,7 @@ void *av_jni_get_java_vm(void *log_ctx)
 
 int av_jni_set_java_vm(void *vm, void *log_ctx)
 {
-return 0;
+return AVERROR(ENOSYS);
 }
 
 void *av_jni_get_java_vm(void *log_ctx)
diff --git a/libavcodec/mediacodec.c b/libavcodec/mediacodec.c
index cd8766f..25b3dd0 100644
--- a/libavcodec/mediacodec.c
+++ b/libavcodec/mediacodec.c
@@ -108,7 +108,7 @@ AVMediaCodecContext *av_mediacodec_alloc_context(void)
 
 int av_mediacodec_default_init(AVCodecContext *avctx, AVMediaCodecContext 
*ctx, void *surface)
 {
-return 0;
+return AVERROR(ENOSYS);
 }
 
 void av_mediacodec_default_free(AVCodecContext *avctx)
@@ -117,7 +117,7 @@ void av_mediacodec_default_free(AVCodecContext *avctx)
 
 int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render)
 {
-return 0;
+return AVERROR(ENOSYS);
 }
 
 #endif
-- 
2.1.4

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


[FFmpeg-devel] [PATCH] avformat/matroskadec: retain error codes in matroska_resync() and matroska_read_packet()

2016-08-02 Thread Sophia Wang
Signed-off-by: Sophia Wang 
---
 libavformat/matroskadec.c | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index d07a092..f9693ca 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -738,13 +738,16 @@ static int matroska_read_close(AVFormatContext *s);
 static int matroska_resync(MatroskaDemuxContext *matroska, int64_t last_pos)
 {
 AVIOContext *pb = matroska->ctx->pb;
+int64_t ret;
 uint32_t id;
 matroska->current_id = 0;
 matroska->num_levels = 0;
 
 /* seek to next position to resync from */
-if (avio_seek(pb, last_pos + 1, SEEK_SET) < 0)
-goto eof;
+if ((ret = avio_seek(pb, last_pos + 1, SEEK_SET)) < 0) {
+matroska->done = 1;
+return ret;
+}
 
 id = avio_rb32(pb);
 
@@ -760,7 +763,6 @@ static int matroska_resync(MatroskaDemuxContext *matroska, 
int64_t last_pos)
 id = (id << 8) | avio_r8(pb);
 }
 
-eof:
 matroska->done = 1;
 return AVERROR_EOF;
 }
@@ -3322,13 +3324,14 @@ static int matroska_parse_cluster(MatroskaDemuxContext 
*matroska)
 static int matroska_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
 MatroskaDemuxContext *matroska = s->priv_data;
+int ret;
 
 while (matroska_deliver_packet(matroska, pkt)) {
 int64_t pos = avio_tell(matroska->ctx->pb);
-if (matroska->done)
-return AVERROR_EOF;
-if (matroska_parse_cluster(matroska) < 0)
-matroska_resync(matroska, pos);
+if (matroska_parse_cluster(matroska) < 0) {
+if ((ret = matroska_resync(matroska, pos)) < 0)
+return ret;
+}
 }
 
 return 0;
-- 
2.8.0.rc3.226.g39d4020

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


Re: [FFmpeg-devel] [Libav-user] [PATCH]Fix a crash in vaapi_encode if "." is not the decimal separator

2016-08-02 Thread Mark Thompson
On 02/08/16 18:39, Nicolas George wrote:
> Le sextidi 16 thermidor, an CCXXIV, Carl Eugen Hoyos a écrit :
>> -{ "i_qfactor",  "1.0" },
>> -{ "i_qoffset",  "0.0" },
>> -{ "b_qfactor",  "1.2" },
>> -{ "b_qoffset",  "0.0" },
>> +{ "i_qfactor",  "1"   },
>> +{ "i_qoffset",  "0"   },
>> +{ "b_qfactor",  "6/5" },
>> +{ "b_qoffset",  "0"   },

Urgh :(  I did not consider this problem at all when writing the code.

I tested the patch and it works as intended.

> I think this is not correct at all.
> 
> First, the code should not crash with incorrect parameters, it should either
> return a proper error code or accept the values with a sane meaning.
> 
> Second, this is not fixing the issue, it is just working around it. These
> options can also be set by applications or users, and the point is supposed
> to work.
> 
> The correct fix for the parsing side of the issue would be either to
> document that the FFmpeg libraries cannot be used with LC_NUMERIC set to
> anything else than C/POSIX (and possibly add a check at init time) or change
> the code to use an unlocalized version of strtod().
> 
> I am rather in favour of the first solution, as anybody who
> setlocale(LC_NUMERIC) in their are idiots and will break much more than
> FFmpeg libraries.

I agree that this would be the best answer.  However, I'm not sure about the 
backward compatibility - with the current behaviour users can have scripts 
containing "1,2" in any numeric argument to ffmpeg (meaning 6/5 as here) and 
have it parsed correctly because of their locale settings.

Therefore, I'm inclined to go for the proposed workaround (or something 
similar*) for now, including backporting it to 3.1 for distributions such as 
Debian which are encountering it, and consider the underlying locale problem 
separately.

Thanks,

- Mark


* The default values here don't really matter: setting them to 1, 0, 1, 0 
(respectively) might be cleaner as a way to duck the problem.  (I only defined 
them like this so that it does something vaguely reasonable when testing with 
ffmpeg with no options, the values themselves don't matter because any real use 
will set them manually.)

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


Re: [FFmpeg-devel] [PATCH 03/11] avformat/fifo: Add fate test

2016-08-02 Thread Michael Niedermayer
On Tue, Aug 02, 2016 at 03:24:14PM +0200, sebechlebsky...@gmail.com wrote:
> From: Jan Sebechlebsky 
> 
> Signed-off-by: Jan Sebechlebsky 
> ---
>  This adds two tests checking that the output of muxers is the same
>  as when fifo is used and stand-alone test program which covers
>  behaviour in failure scenarios.
> 
>  libavformat/Makefile   |   1 +
>  libavformat/tests/fifo_muxer.c | 447 
> +
>  tests/Makefile |   1 +
>  tests/fate/fifo-muxer.mak  |  20 ++
>  tests/ref/fate/fifo-muxer-tst  |  11 +
>  5 files changed, 480 insertions(+)
>  create mode 100644 libavformat/tests/fifo_muxer.c
>  create mode 100644 tests/fate/fifo-muxer.mak
>  create mode 100644 tests/ref/fate/fifo-muxer-tst

segfaults  on x86-32

Program received signal SIGSEGV, Segmentation fault.
0xf7dfb265 in ?? () from /lib/i386-linux-gnu/libc.so.6
(gdb) bt
Python Exception  No module named gdb.frames:
#0  0xf7dfb265 in ?? () from /lib/i386-linux-gnu/libc.so.6
#1  0xf7dfc33f in ?? () from /lib/i386-linux-gnu/libc.so.6
#2  0xf7dfd528 in ?? () from /lib/i386-linux-gnu/libc.so.6
#3  0xf7dff7fd in memalign () from /lib/i386-linux-gnu/libc.so.6
#4  0xf7e00934 in posix_memalign () from /lib/i386-linux-gnu/libc.so.6
#5  0x08ad06c0 in av_malloc (size=688) at src/libavutil/mem.c:97
#6  av_mallocz (size=688) at src/libavutil/mem.c:254
#7  0x081f757b in avformat_new_stream (s=0x95b7020, c=0x0) at 
src/libavformat/utils.c:4144
#8  0x080a89fd in initialize_fifo_tst_muxer_chain (oc=0xd368) at 
src/libavformat/tests/fifo_muxer.c:174
#9  run_test (test=0x8af5b60 ) at src/libavformat/tests/fifo_muxer.c:361
#10 0x080a81fd in main (argc=1, argv=0xd5c4) at 
src/libavformat/tests/fifo_muxer.c:437


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

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus


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


Re: [FFmpeg-devel] [PATCH] - cosmetic: the decklink_dec* files are used for input from the decklink cards. update the header to reflect that

2016-08-02 Thread Timothy Gu
On Tue, Aug 2, 2016 at 12:51 PM Felt, Patrick 
wrote:

> That’s really odd.  Has to be something stupid from my MUA.  Let me attach
> it as a file and it should go.  (I wrote this off a brand new fresh clone).
>

Pushed, thanks.

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


Re: [FFmpeg-devel] [PATCH] - cosmetic: the decklink_dec* files are used for input from the decklink cards. update the header to reflect that

2016-08-02 Thread Felt, Patrick
That’s really odd.  Has to be something stupid from my MUA.  Let me attach it 
as a file and it should go.  (I wrote this off a brand new fresh clone).


From: ffmpeg-devel  on behalf of Michael 
Niedermayer 
Reply-To: FFmpeg development discussions and patches 
Date: Tuesday, August 2, 2016 at 1:08 PM
To: FFmpeg development discussions and patches 
Subject: Re: [FFmpeg-devel] [PATCH] - cosmetic: the decklink_dec* files are 
used for input from the decklink cards. update the header to reflect that

On Tue, Aug 02, 2016 at 06:44:14PM +, Felt, Patrick wrote:
This is a cosmetic patch only to update the header of decklink files to be 
indicative of data flow direction.
---
libavdevice/decklink_dec.cpp | 4 ++--
libavdevice/decklink_dec.h   | 2 +-
libavdevice/decklink_dec_c.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)

Applying: - cosmetic: the decklink_dec* files are used for input from the 
decklink cards. update the header to reflect that
fatal: corrupt patch at line 12
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 - cosmetic: the decklink_dec* files are used for input 
from the decklink cards. update the header to reflect that
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".


diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index fcb024e..fc81d4d 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -1,5 +1,5 @@
/*
- * Blackmagic DeckLink output

patch is oddly corrupted here

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

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





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


Re: [FFmpeg-devel] [PATCH] x86/ttadsp: add ff_ttafilter_process_enc_{ssse3, sse4}

2016-08-02 Thread James Almer
On 7/31/2016 10:27 PM, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libavcodec/Makefile  |  2 +-
>  libavcodec/ttadsp.c  | 41 -
>  libavcodec/ttadsp.h  |  3 +++
>  libavcodec/ttaenc.c  | 38 ++
>  libavcodec/x86/Makefile  |  2 ++
>  libavcodec/x86/ttadsp.asm| 24 
>  libavcodec/x86/ttadsp_init.c | 25 +++--
>  7 files changed, 83 insertions(+), 52 deletions(-)

Split into its own context instead and pushed.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] - cosmetic: the decklink_dec* files are used for input from the decklink cards. update the header to reflect that

2016-08-02 Thread Michael Niedermayer
On Tue, Aug 02, 2016 at 06:44:14PM +, Felt, Patrick wrote:
> This is a cosmetic patch only to update the header of decklink files to be 
> indicative of data flow direction.
> 
> 
> ---
> libavdevice/decklink_dec.cpp | 4 ++--
> libavdevice/decklink_dec.h   | 2 +-
> libavdevice/decklink_dec_c.c | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)

Applying: - cosmetic: the decklink_dec* files are used for input from the 
decklink cards. update the header to reflect that
fatal: corrupt patch at line 12
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 - cosmetic: the decklink_dec* files are used for input 
from the decklink cards. update the header to reflect that
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".


> 
> diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
> index fcb024e..fc81d4d 100644
> --- a/libavdevice/decklink_dec.cpp
> +++ b/libavdevice/decklink_dec.cpp
> @@ -1,5 +1,5 @@
> /*
> - * Blackmagic DeckLink output

patch is oddly corrupted here

[...]
-- 
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


[FFmpeg-devel] [PATCH] - cosmetic: the decklink_dec* files are used for input from the decklink cards. update the header to reflect that

2016-08-02 Thread Felt, Patrick
This is a cosmetic patch only to update the header of decklink files to be 
indicative of data flow direction.


---
libavdevice/decklink_dec.cpp | 4 ++--
libavdevice/decklink_dec.h   | 2 +-
libavdevice/decklink_dec_c.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index fcb024e..fc81d4d 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -1,5 +1,5 @@
/*
- * Blackmagic DeckLink output
+ * Blackmagic DeckLink input
  * Copyright (c) 2013-2014 Luca Barbato, Deti Fliegl
  *
  * This file is part of FFmpeg.
@@ -524,7 +524,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)

 /* Get input device. */
 if (ctx->dl->QueryInterface(IID_IDeckLinkInput, (void **) >dli) != 
S_OK) {
-av_log(avctx, AV_LOG_ERROR, "Could not open output device from '%s'\n",
+av_log(avctx, AV_LOG_ERROR, "Could not open input device from '%s'\n",
avctx->filename);
 ret = AVERROR(EIO);
 goto error;
diff --git a/libavdevice/decklink_dec.h b/libavdevice/decklink_dec.h
index c02344e..9b71870 100644
--- a/libavdevice/decklink_dec.h
+++ b/libavdevice/decklink_dec.h
@@ -1,5 +1,5 @@
/*
- * Blackmagic DeckLink output
+ * Blackmagic DeckLink input
  * Copyright (c) 2013-2014 Ramiro Polla
  *
  * This file is part of FFmpeg.
diff --git a/libavdevice/decklink_dec_c.c b/libavdevice/decklink_dec_c.c
index 523be66..56bc439 100644
--- a/libavdevice/decklink_dec_c.c
+++ b/libavdevice/decklink_dec_c.c
@@ -1,5 +1,5 @@
/*
- * Blackmagic DeckLink output
+ * Blackmagic DeckLink input
  * Copyright (c) 2014 Deti Fliegl
  *
  * This file is part of FFmpeg.
--
1.8.3.1
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] avformat/tee: Factor parse_slave_options() out

2016-08-02 Thread Michael Niedermayer
On Tue, Aug 02, 2016 at 04:42:56PM +0200, Nicolas George wrote:
> Le quintidi 15 thermidor, an CCXXIV, Michael Niedermayer a écrit :
> > Signed-off-by: Michael Niedermayer 
[...]
> > +int ff_tee_parse_slave_options(void *log, char *slave,
> > +   AVDictionary **options, char **filename)
> > +{
> > +const char *p;
> > +char *key, *val;
> > +int ret;
> > +
> > +if (!strspn(slave, slave_opt_open)) {
> > +*filename = slave;
> > +return 0;
> > +}
> > +p = slave + 1;
> > +if (strspn(p, slave_opt_close)) {
> > +*filename = (char *)p + 1;
> > +return 0;
> > +}
> > +while (1) {
> > +ret = av_opt_get_key_value(, "=", slave_opt_delim, 0, , 
> > );
> > +if (ret < 0) {
> > +av_log(log, AV_LOG_ERROR, "No option found near \"%s\"\n", p);
> > +goto fail;
> > +}
> > +ret = av_dict_set(options, key, val,
> > +  AV_DICT_DONT_STRDUP_KEY | 
> > AV_DICT_DONT_STRDUP_VAL);
> > +if (ret < 0)
> > +goto fail;
> > +if (strspn(p, slave_opt_close))
> > +break;
> > +p++;
> > +}
> > +*filename = (char *)p + 1;
> > +return 0;
> > +
> > +fail:
> > +av_dict_free(options);
> > +return ret;
> > +}
> 
> > \ No newline at end of file
> 
> Better fix that. It happened several times recently, maybe check the config
> of your editor?

i dont think my editor supports that, but it really shouldnt matter,
theres a git hook that prevents this from being checked in, so it
will get fixed before i push it


> 
> > diff --git a/libavformat/tee_common.h b/libavformat/tee_common.h
> > new file mode 100644
> > index 000..78ef1b8
> > --- /dev/null
> > +++ b/libavformat/tee_common.h
> > @@ -0,0 +1,31 @@
> > +/*
> > + * Tee common code
> 
> > + * Copyright (c) 2012 Nicolas George
> 
> I do not think this specific file warrants any copyright from me. Either
> yourself or "the FFmpeg developers" would be better I think.

fixed


> 
> > + *
> > + * 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
> > + */
> > +
> > +#ifndef AVFORMAT_TEE_COMMON_H
> > +#define AVFORMAT_TEE_COMMON_H
> > +
> > +#include "libavutil/dict.h"
> > +
> > +int ff_tee_parse_slave_options(void *log, char *slave,
> > +   AVDictionary **options, char **filename);
> > +
> > +#endif
> 
> > +
> 
> Stray empty line.

fixed


> 
> LGTM apart from that, but maybe ask Jan if it will not interfere with his
> work.

applied as jan is ok with it too

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [Libav-user] [PATCH]Fix a crash in vaapi_encode if "." is not the decimal separator

2016-08-02 Thread Carl Eugen Hoyos
Hi!

2016-08-02 19:39 GMT+02:00 Nicolas George :
> Le sextidi 16 thermidor, an CCXXIV, Carl Eugen Hoyos a écrit :
>> To: "This list is about using libavcodec, libavformat, libavutil,
>> libavdevice and libavfilter." 
>
> Why did you post to this list?

I made a mistake, sorry.

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


Re: [FFmpeg-devel] [PATCH 3/5] avcodec/bsf: Add list BSF API

2016-08-02 Thread Timothy Gu
Sorry, I seem to have lost the original mail, and as Gmane is dead I had to
review using Nicolas's mail.

On Tue, Aug 2, 2016 at 8:14 AM Nicolas George  wrote:

> Le primidi 11 thermidor, an CCXXIV, sebechlebsky...@gmail.com a écrit :
> > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > index 36f7935..39106ee 100644
> > --- a/libavcodec/avcodec.h
> > +++ b/libavcodec/avcodec.h
> > @@ -5949,6 +5949,80 @@ void av_bsf_free(AVBSFContext **ctx);
> >   */
> >  const AVClass *av_bsf_get_class(void);
> >
> > +/**
> > + * Structure for chain/list of bitstream filters.
> > + * Empty list can be allocated by av_bsf_list_alloc().
> > + */
> > +typedef struct AVBSFList AVBSFList;
> > +
> > +/**
> > + * Allocate empty list of bitstream filters.
> > + * The list must be later freed by av_bsf_list_free()
> > + * or finalized by av_bsf_list_finalize().
> > + *
> > + * @return pointer to AVBSFList on success, NULL in case of failure
>

For  Doxygen documentation, capitalize the first letter of the descriptions
in @return's and @param's, and @ref-erence types, structs, and enums. (For
functions, an empty set of parentheses is enough.)

The same rules apply to all the new functions you've added.

@return Pointer to @ref AVBSFList on success, NULL in case of failure.


> > + */
> > +AVBSFList *av_bsf_list_alloc(void);
> > +
> > +/**
> > + * Free list of bitstream filters.
> > + *
> > + * @param lst pointer to pointer returned by av_bsf_list_alloc()
>

@param lst Pointer to pointer returned by av_bsf_list_alloc()

> + */
> > +void av_bsf_list_free(AVBSFList **lst);
> > +
> > +/**
> > + * Append bitstream filter to the list of bitstream filters.
> > + *
>


> > + * @param lst list to append to
>

List


> > + * @param bsf AVBSFContext to be appended
>

@ref AVBSFContext


> > + *
> > + * @return >=0 on success, negative AVERROR in case of failure
> > + */
> > +int av_bsf_list_append(AVBSFList *lst, AVBSFContext *bsf);
> > +
> > +/**
> > + * Finalize list of bitstream filters.
> > + *
> > + * This function will transform AVBSFList to single AVBSFContext,
>

@ref's


> > + * so the whole chain of bitstream filters can be treated as single
> filter
> > + * freshly allocated by av_bsf_alloc().
>


> > + * The AVBSFList structure is destroyed after this call and must not
>

Ditto


> > + * be accessed.
> > + *
> > + * @param lst  AVBSFList structure to be transformed
>


> > + * @param bsf[out] pointer to be set to newly created AVBSFContext
> structure
>

@param[out] bsf

Same applies to rest of the file.


> > + * representing the chain of bitstream filters
> > + *
> > + * @return >=0 on success, negative AVERROR in case of failure
> > + */
> > +int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf);
> > +
> > +/**
> > + * Parse string describing list of bitstream filters and create single
> > + * AVBSFContext describing the whole chain of bitstream filters.
> > + * Resulting AVBSFContext can be treated as any other AVBSFContext
> freshly
> > + * allocated by av_bsf_alloc().
> > + *
> > + * @param str  string describing chain of bitstream filters in
> format
>


> > + * bsf1[=opt1=val1:opt2=val2][,bsf2]
>

Use Markdown backtick syntax to make it display in monospace font

`bsf[=opt1=val1:opt2=val2][,bsf2]`


> > + * @param bsf[out] pointer to be set to newly created AVBSFContext
> structure
> > + * representing the chain of bitstream filters
> > + *
> > + * @return >=0 on success, negative AVERROR in case of failure
> > + */
> > +int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf);
> > +
> > +/**
> > + * Get null/pass-through bitstream filter.
> > + *

> + * @param bsf[out] pointer to be set to new instance of pass-through
> > + * bitstream filter

> + *
> > + * @return
> > + */
> > +int av_bsf_get_null_filter(AVBSFContext **bsf);
> > +
> >  /* memory */
> >
> >  /**
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [Libav-user] [PATCH]Fix a crash in vaapi_encode if "." is not the decimal separator

2016-08-02 Thread Nicolas George
Le sextidi 16 thermidor, an CCXXIV, Carl Eugen Hoyos a écrit :
> To: "This list is about using libavcodec, libavformat, libavutil,
> libavdevice and libavfilter." 

Why did you post to this list?

> Subject: [PATCH] lavc/vaapi_encode_h26x: Fix a crash if "." is not the
>  decimal separator.

> -{ "i_qfactor",  "1.0" },
> -{ "i_qoffset",  "0.0" },
> -{ "b_qfactor",  "1.2" },
> -{ "b_qoffset",  "0.0" },
> +{ "i_qfactor",  "1"   },
> +{ "i_qoffset",  "0"   },
> +{ "b_qfactor",  "6/5" },
> +{ "b_qoffset",  "0"   },

I think this is not correct at all.

First, the code should not crash with incorrect parameters, it should either
return a proper error code or accept the values with a sane meaning.

Second, this is not fixing the issue, it is just working around it. These
options can also be set by applications or users, and the point is supposed
to work.

The correct fix for the parsing side of the issue would be either to
document that the FFmpeg libraries cannot be used with LC_NUMERIC set to
anything else than C/POSIX (and possibly add a check at init time) or change
the code to use an unlocalized version of strtod().

I am rather in favour of the first solution, as anybody who
setlocale(LC_NUMERIC) in their are idiots and will break much more than
FFmpeg libraries.

Of course, this is on top of fixing the encoders to not crash with the
offending values.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] patchwork

2016-08-02 Thread Michael Niedermayer
On Sun, Jul 31, 2016 at 01:39:15PM +0200, Michael Niedermayer wrote:
> Hi all
> 
> raz has setup
> https://patchwork.ffmpeg.org

> feel free to register and use as you like

ill add every FFmpeg developer i spot amongth the registered users to
the maintainers of FFmpeg that way everyone can edit any patches state

If i miss someone, please ping me, also if you want to help with
patchwork state updates and arent a FFmpeg developer, ping me too
also if someone has a script to automate anything related please reply
ATM patchwork will recognize

"LGTM", "Reviewed-by:", "Tested-by:", "Acked-by:"
so it makes sense to use these keywords in replies

It will also mark patches pushed to git as accepted automatically
unless the patch was edited

iam considering to write a script to catch and mark superseeded
patches ...

Thanks

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

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.


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


[FFmpeg-devel] [PATCH] mem: Extend and edit Doxygen

2016-08-02 Thread Timothy Gu
---

A bit more editing...

---
 libavutil/mem.h | 588 +++-
 1 file changed, 451 insertions(+), 137 deletions(-)

diff --git a/libavutil/mem.h b/libavutil/mem.h
index 145ac91..4b99342 100644
--- a/libavutil/mem.h
+++ b/libavutil/mem.h
@@ -20,7 +20,8 @@
 
 /**
  * @file
- * memory handling functions
+ * @ingroup lavu_mem
+ * Memory handling functions
  */
 
 #ifndef AVUTIL_MEM_H
@@ -35,9 +36,56 @@
 
 /**
  * @addtogroup lavu_mem
+ * Utilities for manipulating memory.
+ *
+ * FFmpeg has several applications of memory that are not required of a typical
+ * program. For example, the computing-heavy components like video decoding and
+ * encoding can be sped up significantly through the use of aligned memory.
+ *
+ * However, for each of FFmpeg's applications of memory, there might not be a
+ * recognized or standardized API for that specific use. Memory alignment, for
+ * instance, varies wildly depending on operating systems, architectures, and
+ * compilers. Hence, this component of @ref libavutil is created to make
+ * dealing with memory consistently possible on all platforms.
+ *
+ * @{
+ *
+ * @defgroup lavu_mem_macros Alignment Macros
+ * Helper macros for declaring aligned variables.
  * @{
  */
 
+/**
+ * @def DECLARE_ALIGNED(n,t,v)
+ * Declare a variable that is aligned in the memory.
+ *
+ * @code{.c}
+ * DECLARE_ALIGNED(16, uint16_t, aligned_int) = 42;
+ * DECLARE_ALIGNED(32, uint8_t, aligned_array)[128];
+ *
+ * // The default-alignment equivalent would be
+ * uint16_t aligned_int = 42;
+ * uint8_t aligned_array[128];
+ * @endcode
+ *
+ * @param n Minimum alignment in bytes
+ * @param t Type of the variable (or array element)
+ * @param v Name of the variable
+ */
+
+/**
+ * @def DECLARE_ASM_CONST(n,t,v)
+ * Declare a static constant aligned variable appropriate for use in inline
+ * assembly code.
+ *
+ * @code{.c}
+ * DECLARE_ASM_CONST(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
+ * @endcode
+ *
+ * @param n Minimum alignment in bytes
+ * @param t Type of the variable (or array element)
+ * @param v Name of the variable
+ */
 
 #if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C)
 #define DECLARE_ALIGNED(n,t,v)  t __attribute__ ((aligned (n))) v
@@ -60,12 +108,47 @@
 #define DECLARE_ASM_CONST(n,t,v)static const t v
 #endif
 
+/**
+ * @}
+ */
+
+/**
+ * @defgroup lavu_mem_attrs Function Attributes
+ * Function attributes applicable to memory handling functions.
+ *
+ * These function attributes can help compilers emit more useful warnings, or
+ * generate better code.
+ * @{
+ */
+
+/**
+ * @def av_malloc_attrib
+ * Function attribute denoting a malloc-like function.
+ *
+ * @see https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-g_t_0040code_007bmalloc_007d-function-attribute-3251;>Function
 attribute `malloc` in GCC's documentation
+ */
+
 #if AV_GCC_VERSION_AT_LEAST(3,1)
 #define av_malloc_attrib __attribute__((__malloc__))
 #else
 #define av_malloc_attrib
 #endif
 
+/**
+ * @def av_alloc_size(...)
+ * Function attribute used on a function that allocates memory, whose size is
+ * given by the specified parameter(s).
+ *
+ * @code{.c}
+ * void *av_malloc(size_t size) av_alloc_size(1);
+ * void *av_calloc(size_t nmemb, size_t size) av_alloc_size(1, 2);
+ * @endcode
+ *
+ * @param ... One or two parameter indexes, separated by a comma
+ *
+ * @see https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-g_t_0040code_007balloc_005fsize_007d-function-attribute-3220;>Function
 attribute `alloc_size` in GCC's documentation
+ */
+
 #if AV_GCC_VERSION_AT_LEAST(4,3)
 #define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__)))
 #else
@@ -73,31 +156,51 @@
 #endif
 
 /**
- * Allocate a block of size bytes with alignment suitable for all
- * memory accesses (including vectors if available on the CPU).
- * @param size Size in bytes for the memory block to be allocated.
- * @return Pointer to the allocated block, NULL if the block cannot
- * be allocated.
+ * @}
+ */
+
+/**
+ * @defgroup lavu_mem_funcs Heap Management
+ * Functions responsible for allocating, freeing, and copying memory.
+ *
+ * All memory allocation functions have a built-in upper limit of `INT_MAX`
+ * bytes. This may be changed with av_max_alloc(), although exercise extreme
+ * caution when doing so.
+ *
+ * @{
+ */
+
+/**
+ * Allocate a memory block with alignment suitable for all memory accesses
+ * (including vectors if available on the CPU).
+ *
+ * @param size Size in bytes for the memory block to be allocated
+ * @return Pointer to the allocated block, or `NULL` if the block cannot
+ * be allocated
  * @see av_mallocz()
  */
 void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
 
 /**
- * Allocate a block of size bytes with alignment suitable for all
- * memory accesses (including vectors if available on the CPU) and
- * zero all the bytes of the block.
- 

Re: [FFmpeg-devel] [PATCH] doc: add Libav merge document

2016-08-02 Thread Timothy Gu
I've put this document onto the wiki so that it's easier to edit:
https://trac.ffmpeg.org/wiki/LibavMerge

Timothy

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


Re: [FFmpeg-devel] [PATCH 3/5] avcodec/bsf: Add list BSF API

2016-08-02 Thread James Almer
On 8/2/2016 12:14 PM, Nicolas George wrote:
>> +AVBSFList *av_bsf_list_alloc(void);
> This is personal, but for new APIs, I like "int foo_alloc(Foo **rfoo)"
> better than "Foo *foo_alloc(void)": that way, the caller can forward the
> error code instead of guessing it is ENOMEM.

There is no other error this could generate. It's literally an
av_mallocz wrapper.
Every other similar alloc() function in avcodec.h (with no extra
parameters that could generate EINVAL errors and such) also have
this signature, so lets keep try to keep it consistent.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] avformat/tee: Factor parse_slave_options() out

2016-08-02 Thread Jan Sebechlebsky

On 08/02/2016 04:42 PM, Nicolas George wrote:


LGTM apart from that, but maybe ask Jan if it will not interfere with his
work.
It will interfere with patch "avformat/tee: Use BSF list API" I've send 
to ML, but it's not a problem at all, I'll just regenerate and resend 
the patch after this is applied.

I am ok with the patch.

Regards,
Jan

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


Re: [FFmpeg-devel] [PATCH 3/5] avcodec/bsf: Add list BSF API

2016-08-02 Thread Nicolas George
Le primidi 11 thermidor, an CCXXIV, sebechlebsky...@gmail.com a écrit :
> From: Jan Sebechlebsky 
> 
> ---
>  libavcodec/avcodec.h |  74 ++
>  libavcodec/bsf.c | 284 
> +++
>  2 files changed, 358 insertions(+)

Looks rather nice. Comments below.

> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 36f7935..39106ee 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -5949,6 +5949,80 @@ void av_bsf_free(AVBSFContext **ctx);
>   */
>  const AVClass *av_bsf_get_class(void);
>  
> +/**
> + * Structure for chain/list of bitstream filters.
> + * Empty list can be allocated by av_bsf_list_alloc().
> + */
> +typedef struct AVBSFList AVBSFList;
> +
> +/**
> + * Allocate empty list of bitstream filters.
> + * The list must be later freed by av_bsf_list_free()
> + * or finalized by av_bsf_list_finalize().
> + *
> + * @return pointer to AVBSFList on success, NULL in case of failure
> + */

> +AVBSFList *av_bsf_list_alloc(void);

This is personal, but for new APIs, I like "int foo_alloc(Foo **rfoo)"
better than "Foo *foo_alloc(void)": that way, the caller can forward the
error code instead of guessing it is ENOMEM.

> +
> +/**
> + * Free list of bitstream filters.
> + *
> + * @param lst pointer to pointer returned by av_bsf_list_alloc()
> + */
> +void av_bsf_list_free(AVBSFList **lst);
> +

> +/**
> + * Append bitstream filter to the list of bitstream filters.
> + *
> + * @param lst list to append to
> + * @param bsf AVBSFContext to be appended
> + *
> + * @return >=0 on success, negative AVERROR in case of failure
> + */
> +int av_bsf_list_append(AVBSFList *lst, AVBSFContext *bsf);

An utility function that combines av_bsf_get_by_name(), av_bsf_alloc() and
this av_bsf_list_append() may be nice to have too.

> +
> +/**
> + * Finalize list of bitstream filters.
> + *
> + * This function will transform AVBSFList to single AVBSFContext,
> + * so the whole chain of bitstream filters can be treated as single filter
> + * freshly allocated by av_bsf_alloc().
> + * The AVBSFList structure is destroyed after this call and must not
> + * be accessed.
> + *

> + * @param lst  AVBSFList structure to be transformed
> + * @param bsf[out] pointer to be set to newly created AVBSFContext structure
> + * representing the chain of bitstream filters

Maybe document that lst no longer belongs to the caller if the call succeeds
and what happens to it if it fails.

> + *
> + * @return >=0 on success, negative AVERROR in case of failure
> + */
> +int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf);
> +
> +/**
> + * Parse string describing list of bitstream filters and create single
> + * AVBSFContext describing the whole chain of bitstream filters.
> + * Resulting AVBSFContext can be treated as any other AVBSFContext freshly
> + * allocated by av_bsf_alloc().
> + *
> + * @param str  string describing chain of bitstream filters in format
> + * bsf1[=opt1=val1:opt2=val2][,bsf2]
> + * @param bsf[out] pointer to be set to newly created AVBSFContext structure
> + * representing the chain of bitstream filters
> + *
> + * @return >=0 on success, negative AVERROR in case of failure
> + */
> +int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf);
> +
> +/**
> + * Get null/pass-through bitstream filter.
> + *
> + * @param bsf[out] pointer to be set to new instance of pass-through
> + * bitstream filter
> + *
> + * @return
> + */
> +int av_bsf_get_null_filter(AVBSFContext **bsf);
> +
>  /* memory */
>  
>  /**
> diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
> index 40fc925..3ae0a2b 100644
> --- a/libavcodec/bsf.c
> +++ b/libavcodec/bsf.c
> @@ -22,6 +22,7 @@
>  #include "libavutil/mem.h"
>  #include "libavutil/opt.h"
>  #include "libavutil/avassert.h"
> +#include "libavutil/avstring.h"
>  
>  #include "avcodec.h"
>  #include "bsf.h"
> @@ -236,3 +237,286 @@ int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket 
> *pkt)
>  
>  return 0;
>  }
> +
> +typedef struct BSFListContext {
> +const AVClass *class;
> +

> +AVBSFContext **bsf_lst;
> +int ctx_nr;

The existing code uses "foo" and "nb_foo", or sometimes "foo" and
"foo_count" in this kind of case.

> +
> +int idx;   // index of currently processed BSF
> +int flushed_idx;   // index of BSF being flushed

Also, probably better make these unsigned.

> +
> +} BSFListContext;
> +
> +
> +static int bsf_list_init(AVBSFContext *bsf)
> +{
> +BSFListContext *lst = bsf->priv_data;
> +int ret, i;
> +const AVCodecParameters *cod_par = bsf->par_in;
> +AVRational tb = bsf->time_base_in;
> +
> +for (i = 0; i < lst->ctx_nr; ++i) {
> +ret = avcodec_parameters_copy(lst->bsf_lst[i]->par_in, cod_par);
> +if (ret < 0)
> +goto fail;
> +
> +lst->bsf_lst[i]->time_base_in = tb;
> +
> +ret = 

Re: [FFmpeg-devel] [PATCH 1/2] build: Make API documentation depend on config.mak

2016-08-02 Thread Timothy Gu
On Sun, Jul 31, 2016 at 7:06 AM Michael Niedermayer 
wrote:

> On Fri, Jul 29, 2016 at 10:30:37PM -0700, Timothy Gu wrote:
> > The Doxygen command is generated from the list of installed headers,
> > which may change per configuration (e.g. `--enable-gpl` results in
> > libpostproc to be built and installed).
> > ---
> >  doc/Makefile | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
>
> LGTM but please wait with applying so others who know the build
> system better have a chance to look at this
>
> thx
>

Pushed.

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


Re: [FFmpeg-devel] [PATCH 1/2] avformat/tee: Factor parse_slave_options() out

2016-08-02 Thread Nicolas George
Le quintidi 15 thermidor, an CCXXIV, Michael Niedermayer a écrit :
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/Makefile |2 +-
>  libavformat/tee.c|   44 ++
>  libavformat/tee_common.c |   68 
> ++
>  libavformat/tee_common.h |   31 +
>  4 files changed, 102 insertions(+), 43 deletions(-)
>  create mode 100644 libavformat/tee_common.c
>  create mode 100644 libavformat/tee_common.h
> 
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index 4966347..783b96a 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -463,7 +463,7 @@ OBJS-$(CONFIG_SWF_DEMUXER)   += swfdec.o swf.o
>  OBJS-$(CONFIG_SWF_MUXER) += swfenc.o swf.o
>  OBJS-$(CONFIG_TAK_DEMUXER)   += takdec.o apetag.o img2.o rawdec.o
>  OBJS-$(CONFIG_TEDCAPTIONS_DEMUXER)   += tedcaptionsdec.o subtitles.o
> -OBJS-$(CONFIG_TEE_MUXER) += tee.o
> +OBJS-$(CONFIG_TEE_MUXER) += tee.o tee_common.o
>  OBJS-$(CONFIG_THP_DEMUXER)   += thp.o
>  OBJS-$(CONFIG_THREEDOSTR_DEMUXER)+= 3dostr.o
>  OBJS-$(CONFIG_TIERTEXSEQ_DEMUXER)+= tiertexseq.o
> diff --git a/libavformat/tee.c b/libavformat/tee.c
> index b4158e1..5689ca3 100644
> --- a/libavformat/tee.c
> +++ b/libavformat/tee.c
> @@ -26,6 +26,7 @@
>  #include "internal.h"
>  #include "avformat.h"
>  #include "avio_internal.h"
> +#include "tee_common.h"
>  
>  typedef enum {
>  ON_SLAVE_FAILURE_ABORT  = 1,
> @@ -54,9 +55,6 @@ typedef struct TeeContext {
>  } TeeContext;
>  
>  static const char *const slave_delim = "|";
> -static const char *const slave_opt_open  = "[";
> -static const char *const slave_opt_close = "]";
> -static const char *const slave_opt_delim = ":]"; /* must have the close too 
> */
>  static const char *const slave_bsfs_spec_sep = "/";
>  static const char *const slave_select_sep = ",";
>  
> @@ -66,44 +64,6 @@ static const AVClass tee_muxer_class = {
>  .version= LIBAVUTIL_VERSION_INT,
>  };
>  
> -static int parse_slave_options(void *log, char *slave,
> -   AVDictionary **options, char **filename)
> -{
> -const char *p;
> -char *key, *val;
> -int ret;
> -
> -if (!strspn(slave, slave_opt_open)) {
> -*filename = slave;
> -return 0;
> -}
> -p = slave + 1;
> -if (strspn(p, slave_opt_close)) {
> -*filename = (char *)p + 1;
> -return 0;
> -}
> -while (1) {
> -ret = av_opt_get_key_value(, "=", slave_opt_delim, 0, , );
> -if (ret < 0) {
> -av_log(log, AV_LOG_ERROR, "No option found near \"%s\"\n", p);
> -goto fail;
> -}
> -ret = av_dict_set(options, key, val,
> -  AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
> -if (ret < 0)
> -goto fail;
> -if (strspn(p, slave_opt_close))
> -break;
> -p++;
> -}
> -*filename = (char *)p + 1;
> -return 0;
> -
> -fail:
> -av_dict_free(options);
> -return ret;
> -}
> -
>  /**
>   * Parse list of bitstream filters and add them to the list of filters
>   * pointed to by bsfs.
> @@ -217,7 +177,7 @@ static int open_slave(AVFormatContext *avf, char *slave, 
> TeeSlave *tee_slave)
>  int fullret;
>  char *subselect = NULL, *next_subselect = NULL, *first_subselect = NULL, 
> *tmp_select = NULL;
>  
> -if ((ret = parse_slave_options(avf, slave, , )) < 0)
> +if ((ret = ff_tee_parse_slave_options(avf, slave, , )) 
> < 0)
>  return ret;
>  
>  #define STEAL_OPTION(option, field) do {\
> diff --git a/libavformat/tee_common.c b/libavformat/tee_common.c
> new file mode 100644
> index 000..70c06d2
> --- /dev/null
> +++ b/libavformat/tee_common.c
> @@ -0,0 +1,68 @@
> +/*
> + * Tee common code
> + * Copyright (c) 2012 Nicolas George
> + *
> + * 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/avutil.h"
> +#include "libavutil/avstring.h"
> +#include "libavutil/opt.h"
> +
> +#include "tee_common.h"
> +
> +static const char *const 

Re: [FFmpeg-devel] [PATCH] avformat/matroskadec: return AVERROR(EIO) rather than AVERROR_EOF on parse error

2016-08-02 Thread Nicolas George
Le quintidi 15 thermidor, an CCXXIV, Sophia Wang a écrit :
> Thanks for the quick response. matroska_resync() is currently written to
> only return AVERROR_EOF, so using that error code directly wouldn't be any
> more informative. But your suggestion would work if matroska_resync() kept
> the error code returned by avio_seek(). Would such a change warrant
> splitting into a separate patch?

It is all the same issue of callers discarding the return code of called
functions and then inventing a new one. It happens all over the place in
this demuxer, and a recent commit by Carl Eugen shows it also happens in the
rm demuxer. I think is is a remnant of the time before the AVERROR codes.

You are of course not required to fix all the instances of the issue,
especially when testing is not convenient, but I think fixing any number of
them can belong in the same patch, especially if they all serve to fix a
particular visible instance.

Note that I am not maintainer of the Matroska code, though.

Regards,

-- 
  Nicolas George


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


[FFmpeg-devel] [PATCH 11/11] avformat/fifo: Add test for nonblocking mode

2016-08-02 Thread sebechlebskyjan
From: Jan Sebechlebsky 

Signed-off-by: Jan Sebechlebsky 
---
 libavformat/tests/fifo_muxer.c | 139 +
 tests/ref/fate/fifo-muxer-tst  |   5 ++
 2 files changed, 144 insertions(+)

diff --git a/libavformat/tests/fifo_muxer.c b/libavformat/tests/fifo_muxer.c
index 0b5a95e..0a90f36 100644
--- a/libavformat/tests/fifo_muxer.c
+++ b/libavformat/tests/fifo_muxer.c
@@ -336,6 +336,137 @@ fail:
 return ret;
 }
 
+static int retry_write_frame(AVFormatContext *oc, AVPacket *pkt, int 
max_retries)
+{
+int ret = 0, retry_count = 0;
+do {
+ret = av_write_frame(oc, pkt);
+if (ret == AVERROR(EAGAIN)) {
+av_usleep(SLEEPTIME_10_MS);
+retry_count++;
+}
+} while ( ret == AVERROR(EAGAIN) && retry_count < max_retries);
+return ret;
+}
+
+static int retry_write_trailer(AVFormatContext *oc, int max_retries)
+{
+int ret = 0, retry_count = 0;
+do {
+ret = av_write_trailer(oc);
+if (ret == AVERROR(EAGAIN)) {
+av_usleep(SLEEPTIME_10_MS);
+retry_count++;
+}
+} while (ret == AVERROR(EAGAIN) && retry_count < max_retries);
+return ret;
+}
+
+static int fifo_nonblock_test(AVFormatContext *oc, AVDictionary **opts,
+  const FailingMuxerPacketData *pkt_data)
+{
+int ret = 0, i;
+AVPacket pkt;
+
+av_init_packet();
+
+oc->flags |= AVFMT_FLAG_NONBLOCK;
+
+ret = avformat_write_header(oc, opts);
+if (ret) {
+fprintf(stderr, "Unexpected write_header failure: %s\n",
+av_err2str(ret));
+return ret;
+}
+
+for (i = 0; i < 16; i++ ) {
+ret = prepare_packet(, pkt_data, i);
+if (ret < 0) {
+fprintf(stderr, "Failed to prepare test packet: %s\n",
+av_err2str(ret));
+goto fail;
+}
+ret = retry_write_frame(oc, , 100);
+av_packet_unref();
+if (ret < 0)
+break;
+}
+
+if (ret) {
+fprintf(stderr, "Unexpected write_packet error: %s\n", 
av_err2str(ret));
+goto fail;
+}
+
+ret = retry_write_trailer(oc, 100);
+if (ret == AVERROR(EAGAIN)) {
+fprintf(stderr, "write_trailer() operation timeout\n");
+goto fail;
+} else if (ret < 0)
+fprintf(stderr, "Unexpected write_trailer error: %s\n", 
av_err2str(ret));
+
+return ret;
+fail:
+av_abort_output(oc);
+return ret;
+}
+
+static int fifo_nonblock_abort_test(AVFormatContext *oc, AVDictionary **opts,
+const FailingMuxerPacketData *pkt_data)
+{
+int ret = 0, i;
+AVPacket pkt;
+int64_t start_time, end_time, duration;
+
+av_init_packet();
+
+oc->flags |= AVFMT_FLAG_NONBLOCK;
+
+ret = avformat_write_header(oc, opts);
+if (ret) {
+fprintf(stderr, "Unexpected write header failure: %s\n",
+av_err2str(ret));
+goto fail;
+}
+
+av_assert0(pkt_data->sleep_time > 0);
+
+start_time = av_gettime_relative();
+for (i = 0; i < 16; i++ ) {
+ret = prepare_packet(, pkt_data, i);
+if (ret < 0) {
+fprintf(stderr, "Failed to prepare test packet: %s\n",
+av_err2str(ret));
+goto fail;
+}
+ret = retry_write_frame(oc, , 100);
+av_packet_unref();
+if (ret < 0)
+break;
+}
+
+if (ret) {
+fprintf(stderr, "Unexpected write_packet error: %s\n", 
av_err2str(ret));
+goto fail;
+}
+
+av_abort_output(oc);
+
+end_time = av_gettime_relative();
+duration = end_time - start_time;
+
+if (duration > (16*pkt_data->sleep_time)/2 ) {
+fprintf(stderr, "Aborting output took too much time: %u us,"
+" expected time if not aborted %u us\n",
+(unsigned) duration, 16*pkt_data->sleep_time);
+ret = AVERROR(ETIMEDOUT);
+}
+
+return ret;
+fail:
+av_abort_output(oc);
+return ret;
+}
+
 typedef struct TestCase {
 int (*test_func)(AVFormatContext *, AVDictionary **,const 
FailingMuxerPacketData *pkt_data);
 const char *test_name;
@@ -423,6 +554,14 @@ const TestCase tests[] = {
 {fifo_overflow_drop_test, "overflow with packet dropping", 
"queue_size=3:drop_pkts_on_overflow=1",
  0, 0, 0, {0, 0, SLEEPTIME_50_MS}},
 
+/* Simple test of nonblocking mode, the consumer should receive all 
the packets. */
+{fifo_nonblock_test, "nonblocking mode test", "queue_size=3",
+ 1, 0, 0, {0, 0, SLEEPTIME_10_MS}},
+
+/* Test of terminating fifo muxer with av_abort_format() */
+{fifo_nonblock_abort_test, "abort in nonblocking mode", 
"queue_size=16",
+ 0, 0, 0, {0, 0, SLEEPTIME_50_MS}},
+
 {NULL}
 };
 
diff --git a/tests/ref/fate/fifo-muxer-tst b/tests/ref/fate/fifo-muxer-tst
index ca7e294..1c18887 100644
--- 

[FFmpeg-devel] [GSoC] fifo muxer

2016-08-02 Thread sebechlebskyjan
From: Jan Sebechlebsky 

Hello,
I am resending fifo muxer related patchset, now 
also with patches adding support for nonblocking 
calls (AVFMT_FLAG_NONBLOCK) and fate tests.

Regards,
Jan

Jan Sebechlebsky (11):
  avformat: Add fifo pseudo-muxer
  MAINTAINERS: Add myself as maintainer of fifo muxer
  avformat/fifo: Add fate test
  avformat/muxers: Add non-blocking mode support for av_write_trailer
  avformat/mux: Refactor muxer deinit from av_write_trailer
  avformat: add av_abort_output() function
  avformat/avformat.h: Add comments regarding AVFMT_FLAG_NONBLOCK.
  avformat/mux: Restore original ts in write_packet on error
  avformat/mux: Restore stream ts in av_write_packet on EAGAIN
  avformat/fifo: Add AVFMT_FLAG_NONBLOCK support
  avformat/fifo: Add test for nonblocking mode

 Changelog  |   1 +
 MAINTAINERS|   1 +
 configure  |   1 +
 doc/muxers.texi|  90 +
 libavformat/Makefile   |   2 +
 libavformat/allformats.c   |   1 +
 libavformat/avformat.h |  29 +-
 libavformat/fifo.c | 722 +
 libavformat/mux.c  |  69 +++-
 libavformat/tests/fifo_muxer.c | 586 +
 libavformat/version.h  |   2 +-
 tests/Makefile |   1 +
 tests/fate/fifo-muxer.mak  |  20 ++
 tests/ref/fate/fifo-muxer-tst  |  16 +
 14 files changed, 1528 insertions(+), 13 deletions(-)
 create mode 100644 libavformat/fifo.c
 create mode 100644 libavformat/tests/fifo_muxer.c
 create mode 100644 tests/fate/fifo-muxer.mak
 create mode 100644 tests/ref/fate/fifo-muxer-tst

-- 
1.9.1

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


[FFmpeg-devel] [PATCH 08/11] avformat/mux: Restore original ts in write_packet on error

2016-08-02 Thread sebechlebskyjan
From: Jan Sebechlebsky 

Restore original timestamps in write_packet() if the
actual write operation was not successfull. This allows
to pass the same packet to nonblocking muxer repeatedly
without corrupting the timestamps.

Signed-off-by: Jan Sebechlebsky 
---
 libavformat/mux.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 888a9f1..ef4720a 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -657,6 +657,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
 static int write_packet(AVFormatContext *s, AVPacket *pkt)
 {
 int ret, did_split;
+int64_t pts_backup, dts_backup;
+
+pts_backup = pkt->pts;
+dts_backup = pkt->dts;
 
 if (s->output_ts_offset) {
 AVStream *st = s->streams[pkt->stream_index];
@@ -743,6 +747,11 @@ fail:
 if (did_split)
 av_packet_merge_side_data(pkt);
 
+if (ret < 0) {
+pkt->pts = pts_backup;
+pkt->dts = dts_backup;
+}
+
 return ret;
 }
 
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 05/11] avformat/mux: Refactor muxer deinit from av_write_trailer

2016-08-02 Thread sebechlebskyjan
From: Jan Sebechlebsky 

Move muxer deinitialization and private resources freeing
in a separate static function free_muxer(AVFormatContext*).

Signed-off-by: Jan Sebechlebsky 
---
 libavformat/mux.c | 31 ---
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index b58e4c1..bc9c98f 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -1197,9 +1197,27 @@ fail:
 return ret;
 }
 
+static void deinit_muxer(AVFormatContext *s)
+{
+int i;
+
+if (s->oformat->deinit)
+s->oformat->deinit(s);
+
+for (i = 0; i < s->nb_streams; i++) {
+av_freep(>streams[i]->priv_data);
+av_freep(>streams[i]->index_entries);
+}
+
+if (s->oformat->priv_class)
+av_opt_free(s->priv_data);
+
+av_freep(>priv_data);
+}
+
 int av_write_trailer(AVFormatContext *s)
 {
-int ret, i;
+int ret;
 
 for (;; ) {
 AVPacket pkt;
@@ -1241,20 +1259,11 @@ fail:
 if (ret == AVERROR(EAGAIN))
 return ret;
 
-if (s->oformat->deinit)
-s->oformat->deinit(s);
-
 if (s->pb)
avio_flush(s->pb);
 if (ret == 0)
ret = s->pb ? s->pb->error : 0;
-for (i = 0; i < s->nb_streams; i++) {
-av_freep(>streams[i]->priv_data);
-av_freep(>streams[i]->index_entries);
-}
-if (s->oformat->priv_class)
-av_opt_free(s->priv_data);
-av_freep(>priv_data);
+deinit_muxer(s);
 return ret;
 }
 
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 02/11] MAINTAINERS: Add myself as maintainer of fifo muxer

2016-08-02 Thread sebechlebskyjan
From: Jan Sebechlebsky 

Signed-off-by: Jan Sebechlebsky 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 932e6fb..9fab34d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -164,6 +164,7 @@ Codecs:
   exif.c, exif.hThilo Borgmann
   ffv1* Michael Niedermayer
   ffwavesynth.c Nicolas George
+  fifo.cJan Sebechlebsky
   flicvideo.c   Mike Melanson
   g722.cMartin Storsjo
   g726.cRoman Shaposhnik
-- 
1.9.1

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


[FFmpeg-devel] [PATCH v4 01/11] avformat: Add fifo pseudo-muxer

2016-08-02 Thread sebechlebskyjan
From: Jan Sebechlebsky 

Signed-off-by: Jan Sebechlebsky 
---
 Changes from the last version of patch:
   - I got rid of write header message, and pulled initial write_header
 call out of the while loop as Nicolas originaly suggested.

 Changelog|   1 +
 configure|   1 +
 doc/muxers.texi  |  90 +++
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/fifo.c   | 674 +++
 libavformat/version.h|   2 +-
 7 files changed, 769 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/fifo.c

diff --git a/Changelog b/Changelog
index 0f9b4cf..3f858f1 100644
--- a/Changelog
+++ b/Changelog
@@ -12,6 +12,7 @@ version :
 - 16-bit support in selectivecolor filter
 - OpenH264 decoder wrapper
 - MediaCodec hwaccel
+- fifo muxer
 
 
 version 3.1:
diff --git a/configure b/configure
index 9f5b31f..4651f5f 100755
--- a/configure
+++ b/configure
@@ -2834,6 +2834,7 @@ dv_muxer_select="dvprofile"
 dxa_demuxer_select="riffdec"
 eac3_demuxer_select="ac3_parser"
 f4v_muxer_select="mov_muxer"
+fifo_muxer_deps="pthreads"
 flac_demuxer_select="flac_parser"
 hds_muxer_select="flv_muxer"
 hls_muxer_select="mpegts_muxer"
diff --git a/doc/muxers.texi b/doc/muxers.texi
index 5873269..e2bc290 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1436,6 +1436,96 @@ Specify whether to remove all fragments when finished. 
Default 0 (do not remove)
 
 @end table
 
+@section fifo
+
+The fifo pseudo-muxer allows to separate encoding from any other muxer by using
+first-in-first-out queue and running the actual muxer in a separate thread. 
This
+is especially useful in combination with the @ref{tee} muxer and output to
+several destinations with different reliability/writing speed/latency.
+
+The behavior of fifo muxer in case of failure can be configured:
+@itemize @bullet
+
+@item
+output can be transparently restarted with configurable delay between retries
+based on real time or time of the processed stream.
+
+@item
+encoding can be blocked during temporary failure, or continue transparently
+dropping packets in case fifo queue fills up.
+
+@end itemize
+
+@table @option
+
+@item fifo_format
+Specify the format name. Useful if it cannot be guessed from the
+output name suffix.
+
+@item queue_size
+Specify size of the queue (number of packets). Default value is 60.
+
+@item format_opts
+Specify format options for the underlying muxer. Muxer options can be specified
+as a list of @var{key}=@var{value} pairs separated by ':'.
+
+@item drop_pkts_on_overflow @var{bool}
+If set to 1 (true), in case the fifo queue fills up, packets will be dropped
+rather than blocking the encoder. This allows to continue streaming without
+delaying the output, at the cost of ommiting part of the stream. By default
+this option is set to 0 (false), so in such cases the encoder will be blocked
+until the muxer processes some of the packets and none of them is lost.
+
+@item attempt_recovery @var{bool}
+If failure occurs, attempt to recover the output. This is especially useful
+when used with network output, allows to restart streaming transparently.
+By default this option set to 0 (false).
+
+@item max_recovery_attempts
+Sets maximum number of successive unsucessful recovery attempts after which
+the output fails permanently. Unlimited if set to zero. Default value is 16.
+
+@item recovery_wait_time @var{duration}
+Waiting time before the next recovery attempt after previous unsuccessfull
+recovery attempt. Default value is 5 seconds.
+
+s@item recovery_wait_streamtime @var{bool}
+If set to 0 (false), the real time is used when waiting for the recovery
+attempt (i.e. the recovery will be attempted after at least
+recovery_wait_time seconds).
+If set to 1 (true), the time of the processed stream is taken into account
+instead (i.e. the recovery will be attempted after at least recovery_wait_time
+seconds of the stream is omitted).
+By default, this option is set to 0 (false).
+
+@item recover_any_error @var{bool}
+If set to 1 (true), recovery will be attempted regardless of type of the error
+causing the failure. By default this option is set to 0 (false) and in case of
+certain errors the recovery is not attempted even when @ref{attempt_recovery}
+is set to 1.
+
+@item restart_with_keyframe @var{bool}
+Specify whether to wait for the keyframe after recovering from
+queue overflow or failure. This option is set to 0 (false) by default.
+
+@end table
+
+@subsection Examples
+
+@itemize
+
+@item
+Stream something to rtmp server, continue processing the stream at real-time
+rate even in case of temporary failure (network outage) and attempt to recover
+streaming every second indefinitely.
+@example
+ffmpeg -re -i ... -c:v libx264 -c:a mp2 -f fifo -fifo_format flv -map 0:v -map 
0:a
+  -block_on_overflow 0 -attempt_recovery 1 -recovery_wait_time 1
+  -max_recovery_attempts 0 

[FFmpeg-devel] [PATCH 04/11] avformat/muxers: Add non-blocking mode support for av_write_trailer

2016-08-02 Thread sebechlebskyjan
From: Jan Sebechlebsky 

This makes av_write_trailer not to free the resources if write_trailer
call returns AVERROR(EAGAIN) allowing repeated calls of write_trailer of
non-blocking muxer.

Signed-off-by: Jan Sebechlebsky 
---
 libavformat/avformat.h | 6 +-
 libavformat/mux.c  | 3 +++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 818184e..9191c69 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2508,8 +2508,12 @@ int av_write_uncoded_frame_query(AVFormatContext *s, int 
stream_index);
  *
  * May only be called after a successful call to avformat_write_header.
  *
+ * If AVFMT_FLAG_NONBLOCK is set, this call may return AVERROR(EAGAIN)
+ * meaning the operation is pending and the call should be repeated.
+ *
  * @param s media file handle
- * @return 0 if OK, AVERROR_xxx on error
+ * @return 0 if OK, AVERROR(EAGAIN) in case call should be repeated,
+ * other AVERROR on error
  */
 int av_write_trailer(AVFormatContext *s);
 
diff --git a/libavformat/mux.c b/libavformat/mux.c
index e9973ed..b58e4c1 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -1238,6 +1238,9 @@ fail:
 }
 }
 
+if (ret == AVERROR(EAGAIN))
+return ret;
+
 if (s->oformat->deinit)
 s->oformat->deinit(s);
 
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 06/11] avformat: add av_abort_output() function

2016-08-02 Thread sebechlebskyjan
From: Jan Sebechlebsky 

Signed-off-by: Jan Sebechlebsky 
---
 libavformat/avformat.h | 14 ++
 libavformat/mux.c  | 16 
 2 files changed, 30 insertions(+)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 9191c69..9173908 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2510,6 +2510,8 @@ int av_write_uncoded_frame_query(AVFormatContext *s, int 
stream_index);
  *
  * If AVFMT_FLAG_NONBLOCK is set, this call may return AVERROR(EAGAIN)
  * meaning the operation is pending and the call should be repeated.
+ * If caller decides to abort operation (after too many calls have returned
+ * AVERROR(EAGAIN)), it can be done by calling @ref av_abort_output().
  *
  * @param s media file handle
  * @return 0 if OK, AVERROR(EAGAIN) in case call should be repeated,
@@ -2518,6 +2520,18 @@ int av_write_uncoded_frame_query(AVFormatContext *s, int 
stream_index);
 int av_write_trailer(AVFormatContext *s);
 
 /**
+ * Abort non-blocking muxer operation and free private data.
+ *
+ * May only be called after a successful call to avformat_write_header,
+ * and used only with muxer operating in non-blocking mode 
(AVFMT_FLAG_NONBLOCK)
+ * must be set.
+ *
+ * @param s media file handle
+ * return >= 0 on success, negative AVERROR on error
+ */
+int av_abort_output(AVFormatContext *s);
+
+/**
  * Return the output format in the list of registered output formats
  * which best matches the provided parameters, or return NULL if
  * there is no match.
diff --git a/libavformat/mux.c b/libavformat/mux.c
index bc9c98f..888a9f1 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -1267,6 +1267,22 @@ fail:
 return ret;
 }
 
+int av_abort_output(AVFormatContext *s)
+{
+int ret;
+
+if (!(s->flags & AVFMT_FLAG_NONBLOCK))
+return AVERROR(EINVAL);
+
+ret = av_write_trailer(s);
+if (ret == AVERROR(EAGAIN)) {
+deinit_muxer(s);
+ret = 0;
+}
+
+return ret;
+}
+
 int av_get_output_timestamp(struct AVFormatContext *s, int stream,
 int64_t *dts, int64_t *wall)
 {
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 07/11] avformat/avformat.h: Add comments regarding AVFMT_FLAG_NONBLOCK.

2016-08-02 Thread sebechlebskyjan
From: Jan Sebechlebsky 

Add comments regarding AVFMG_FLAG_NONBLOCK usage with muxers.

Signed-off-by: Jan Sebechlebsky 
---
 libavformat/avformat.h | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 9173908..6898c8c 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1426,7 +1426,7 @@ typedef struct AVFormatContext {
 int flags;
 #define AVFMT_FLAG_GENPTS   0x0001 ///< Generate missing pts even if it 
requires parsing future frames.
 #define AVFMT_FLAG_IGNIDX   0x0002 ///< Ignore index.
-#define AVFMT_FLAG_NONBLOCK 0x0004 ///< Do not block when reading packets 
from input.
+#define AVFMT_FLAG_NONBLOCK 0x0004 ///< Do not block when reading packets 
from input / writing packets to output.
 #define AVFMT_FLAG_IGNDTS   0x0008 ///< Ignore DTS on frames that contain 
both DTS & PTS
 #define AVFMT_FLAG_NOFILLIN 0x0010 ///< Do not infer any values from other 
values, just return what is stored in the container
 #define AVFMT_FLAG_NOPARSE  0x0020 ///< Do not use AVParsers, you also 
must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing 
-> no frames. Also seeking to frames can not work if parsing to find frame 
boundaries has been disabled
@@ -2389,6 +2389,10 @@ int avformat_write_header(AVFormatContext *s, 
AVDictionary **options);
  * the interleaving should call av_interleaved_write_frame() instead of this
  * function.
  *
+ * In case the muxer is operating in non-blocking mode (AVFMT_FLAG_NONBLOCK
+ * is set), this function can return AVERROR(EAGAIN) meaning the call should
+ * be repeated.
+ *
  * @param s media file handle
  * @param pkt The packet containing the data to be written. Note that unlike
  *av_interleaved_write_frame(), this function does not take
@@ -2431,6 +2435,9 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt);
  * knowledge of future packets, improving e.g. the behaviour of the mp4
  * muxer for VFR content in fragmenting mode.
  *
+ * This call is not supported and must not be called if muxer is operating
+ * in non-blocking mode (AVFMT_FLAG_NONBLOCK is set).
+ *
  * @param s media file handle
  * @param pkt The packet containing the data to be written.
  *
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 03/11] avformat/fifo: Add fate test

2016-08-02 Thread sebechlebskyjan
From: Jan Sebechlebsky 

Signed-off-by: Jan Sebechlebsky 
---
 This adds two tests checking that the output of muxers is the same
 as when fifo is used and stand-alone test program which covers
 behaviour in failure scenarios.

 libavformat/Makefile   |   1 +
 libavformat/tests/fifo_muxer.c | 447 +
 tests/Makefile |   1 +
 tests/fate/fifo-muxer.mak  |  20 ++
 tests/ref/fate/fifo-muxer-tst  |  11 +
 5 files changed, 480 insertions(+)
 create mode 100644 libavformat/tests/fifo_muxer.c
 create mode 100644 tests/fate/fifo-muxer.mak
 create mode 100644 tests/ref/fate/fifo-muxer-tst

diff --git a/libavformat/Makefile b/libavformat/Makefile
index da94ef8..d2a1a27 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -590,6 +590,7 @@ TESTPROGS = seek
\
 url \
 #   async   \
 
+TESTPROGS-$(CONFIG_FIFO_MUXER)  += fifo_muxer
 TESTPROGS-$(CONFIG_FFRTMPCRYPT_PROTOCOL) += rtmpdh
 TESTPROGS-$(CONFIG_MOV_MUXER)+= movenc
 TESTPROGS-$(CONFIG_NETWORK)  += noproxy
diff --git a/libavformat/tests/fifo_muxer.c b/libavformat/tests/fifo_muxer.c
new file mode 100644
index 000..0b5a95e
--- /dev/null
+++ b/libavformat/tests/fifo_muxer.c
@@ -0,0 +1,447 @@
+/*
+ * FIFO pseudo-muxer
+ * Copyright (c) 2016 Jan Sebechlebsky
+ *
+ * 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 
+#include "libavutil/opt.h"
+#include "libavutil/time.h"
+#include "libavutil/avassert.h"
+#include "libavformat/avformat.h"
+#include "libavformat/url.h"
+
+#define MAX_TST_PACKETS 128
+#define SLEEPTIME_50_MS 5
+#define SLEEPTIME_10_MS 1
+
+/* Implementation of mock muxer to simulate real muxer failures */
+
+/* This is structure of data sent in packets to
+ * failing muxer */
+typedef struct FailingMuxerPacketData {
+int ret; /* return value of write_packet call*/
+int recover_after;   /* set ret to zero after this number of recovery 
attempts */
+unsigned sleep_time; /* sleep for this long in write_packet to simulate 
long I/O operation */
+} FailingMuxerPacketData;
+
+
+typedef struct FailingMuxerContext {
+AVClass *class;
+int write_header_ret;
+int write_trailer_ret;
+/* If non-zero, summary of processed packets will be printed in deinit */
+uint8_t print_deinit_summary;
+
+int flush_count;
+int pts_written[MAX_TST_PACKETS];
+int pts_written_nr;
+} FailingMuxerContext;
+
+static int failing_write_header(AVFormatContext *avf)
+{
+FailingMuxerContext *ctx = avf->priv_data;
+return ctx->write_header_ret;
+}
+
+static int failing_write_packet(AVFormatContext *avf, AVPacket *pkt)
+{
+FailingMuxerContext *ctx = avf->priv_data;
+int ret = 0;
+if (!pkt) {
+ctx->flush_count++;
+} else {
+FailingMuxerPacketData *data = (FailingMuxerPacketData*) pkt->data;
+
+if (!data->recover_after) {
+data->ret = 0;
+} else {
+data->recover_after--;
+}
+
+ret = data->ret;
+
+if (data->sleep_time) {
+int64_t slept = 0;
+while (slept < data->sleep_time) {
+if (ff_check_interrupt(>interrupt_callback))
+return AVERROR_EXIT;
+av_usleep(SLEEPTIME_10_MS);
+slept += SLEEPTIME_10_MS;
+}
+}
+
+if (!ret) {
+ctx->pts_written[ctx->pts_written_nr++] = pkt->pts;
+av_packet_unref(pkt);
+}
+}
+return ret;
+}
+
+static int failing_write_trailer(AVFormatContext *avf)
+{
+FailingMuxerContext *ctx = avf->priv_data;
+return ctx->write_trailer_ret;
+}
+
+static void failing_deinit(AVFormatContext *avf)
+{
+int i;
+FailingMuxerContext *ctx = avf->priv_data;
+
+if (!ctx->print_deinit_summary)
+return;
+
+printf("flush count: %d\n", ctx->flush_count);
+printf("pts seen nr: %d\n", ctx->pts_written_nr);
+printf("pts seen: ");
+for (i = 0; i < ctx->pts_written_nr; ++i ) {
+  

[FFmpeg-devel] [PATCH 10/11] avformat/fifo: Add AVFMT_FLAG_NONBLOCK support

2016-08-02 Thread sebechlebskyjan
From: Jan Sebechlebsky 

Add support for nonblocking calls.

Signed-off-by: Jan Sebechlebsky 
---
 libavformat/fifo.c | 70 +-
 1 file changed, 59 insertions(+), 11 deletions(-)

diff --git a/libavformat/fifo.c b/libavformat/fifo.c
index bc8c973..efd91e3 100644
--- a/libavformat/fifo.c
+++ b/libavformat/fifo.c
@@ -25,6 +25,7 @@
 #include "avformat.h"
 #include "internal.h"
 #include "pthread.h"
+#include "url.h"
 
 #define FIFO_DEFAULT_QUEUE_SIZE  60
 #define FIFO_DEFAULT_MAX_RECOVERY_ATTEMPTS   16
@@ -77,6 +78,13 @@ typedef struct FifoContext {
  * from failure or queue overflow */
 uint8_t restart_with_keyframe;
 
+/* Whether termination was requested by invoking deinit
+ * before the thread was finished. Used only in non-blocking
+ * mode - when AVFMT_FLAG_NONBLOCK is set. */
+volatile uint8_t termination_requested;
+
+/* Original interrupt callback of the underlying muxer. */
+AVIOInterruptCB orig_interrupt_callback;
 } FifoContext;
 
 typedef struct FifoThreadContext {
@@ -110,6 +118,16 @@ typedef struct FifoMessage {
 AVPacket pkt;
 } FifoMessage;
 
+static int fifo_interrupt_callback_wrapper(void *arg)
+{
+FifoContext *ctx = arg;
+
+if (ctx->termination_requested)
+return 1;
+
+return ff_check_interrupt(>orig_interrupt_callback);
+}
+
 static int fifo_thread_write_header(FifoThreadContext *ctx)
 {
 AVFormatContext *avf = ctx->avf;
@@ -448,6 +466,8 @@ static void *fifo_consumer_thread(void *data)
 static int fifo_mux_init(AVFormatContext *avf)
 {
 FifoContext *fifo = avf->priv_data;
+AVIOInterruptCB interrupt_cb = {.callback = 
fifo_interrupt_callback_wrapper,
+.opaque = fifo};
 AVFormatContext *avf2;
 int ret = 0, i;
 
@@ -458,7 +478,8 @@ static int fifo_mux_init(AVFormatContext *avf)
 
 fifo->avf = avf2;
 
-avf2->interrupt_callback = avf->interrupt_callback;
+fifo->orig_interrupt_callback = avf->interrupt_callback;
+avf2->interrupt_callback = interrupt_cb;
 avf2->max_delay = avf->max_delay;
 ret = av_dict_copy(>metadata, avf->metadata, 0);
 if (ret < 0)
@@ -543,7 +564,7 @@ static int fifo_write_packet(AVFormatContext *avf, AVPacket 
*pkt)
 {
 FifoContext *fifo = avf->priv_data;
 FifoMessage msg = {.type = pkt ? FIFO_WRITE_PACKET : FIFO_FLUSH_OUTPUT};
-int ret;
+int ret, queue_flags = 0;
 
 if (pkt) {
 av_init_packet();
@@ -552,15 +573,21 @@ static int fifo_write_packet(AVFormatContext *avf, 
AVPacket *pkt)
 return ret;
 }
 
-ret = av_thread_message_queue_send(fifo->queue, ,
-   fifo->drop_pkts_on_overflow ?
-   AV_THREAD_MESSAGE_NONBLOCK : 0);
+if (fifo->drop_pkts_on_overflow || (avf->flags & AVFMT_FLAG_NONBLOCK))
+queue_flags |= AVFMT_FLAG_NONBLOCK;
+
+ret = av_thread_message_queue_send(fifo->queue, , queue_flags);
+
 if (ret == AVERROR(EAGAIN)) {
-uint8_t overflow_set = 0;
+uint8_t overflow_set;
+
+if (avf->flags & AVFMT_FLAG_NONBLOCK)
+return ret;
 
 /* Queue is full, set fifo->overflow_flag to 1
  * to let consumer thread know the queue should
  * be flushed. */
+overflow_set = 0;
 pthread_mutex_lock(>overflow_flag_lock);
 if (!fifo->overflow_flag)
 fifo->overflow_flag = overflow_set = 1;
@@ -588,11 +615,22 @@ static int fifo_write_trailer(AVFormatContext *avf)
 
 av_thread_message_queue_set_err_recv(fifo->queue, AVERROR_EOF);
 
-ret = pthread_join( fifo->writer_thread, NULL);
-if (ret < 0) {
-av_log(avf, AV_LOG_ERROR, "pthread join error: %s\n",
-   av_err2str(AVERROR(ret)));
-return AVERROR(ret);
+if (!(avf->flags & AVFMT_FLAG_NONBLOCK)) {
+ret = pthread_join( fifo->writer_thread, NULL);
+if (ret < 0) {
+av_log(avf, AV_LOG_ERROR, "pthread join error: %s\n",
+av_err2str(AVERROR(ret)));
+return AVERROR(ret);
+}
+} else {
+ret = pthread_tryjoin_np( fifo->writer_thread, NULL);
+if (ret == EBUSY)
+return AVERROR(EAGAIN);
+if (ret) {
+av_log(avf, AV_LOG_ERROR, "pthread_tryjoin_np error: %s\n",
+   av_err2str(AVERROR(ret)));
+return AVERROR(ret);
+}
 }
 
 ret = fifo->write_trailer_ret;
@@ -603,6 +641,16 @@ static void fifo_deinit(AVFormatContext *avf)
 {
 FifoContext *fifo = avf->priv_data;
 
+if (avf->flags & AVFMT_FLAG_NONBLOCK) {
+int ret;
+fifo->termination_requested = 1;
+ret = pthread_join( fifo->writer_thread, NULL);
+if (ret < 0) {
+av_log(avf, AV_LOG_ERROR, "pthread join error: %s\n",
+   av_err2str(AVERROR(ret)));
+}
+}
+
 

[FFmpeg-devel] [PATCH 09/11] avformat/mux: Restore stream ts in av_write_packet on EAGAIN

2016-08-02 Thread sebechlebskyjan
From: Jan Sebechlebsky 

compute_muxer_pkt_fields() stores the last seen timestamps in stream
and produces error if the same timestamp is presented again.
This is a problem if muxer works in non-blocking mode and calls
av_write_packet repeatedly with the same packet.
This patch saves stream fields affected by compute_muxer_pkt_fields
and restores them in case AVERROR(EAGAIN) is returned from
write_packet, and muxer has AVFMT_FLAG_NONBLOCK flag set.

Signed-off-by: Jan Sebechlebsky 
---
 libavformat/mux.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index ef4720a..fdf3fd1 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -880,6 +880,9 @@ static int do_packet_auto_bsf(AVFormatContext *s, AVPacket 
*pkt) {
 int av_write_frame(AVFormatContext *s, AVPacket *pkt)
 {
 int ret;
+#if FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX
+int64_t st_cur_dts_backup, st_priv_pts_val_backup;
+#endif
 
 ret = prepare_input_packet(s, pkt);
 if (ret < 0)
@@ -907,6 +910,9 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
 return ret;
 
 #if FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX
+st_cur_dts_backup = s->streams[pkt->stream_index]->cur_dts;
+st_priv_pts_val_backup = s->streams[pkt->stream_index]->priv_pts->val;
+
 ret = compute_muxer_pkt_fields(s, s->streams[pkt->stream_index], pkt);
 
 if (ret < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
@@ -914,7 +920,13 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
 #endif
 
 ret = write_packet(s, pkt);
-if (ret >= 0 && s->pb && s->pb->error < 0)
+if (s->flags & AVFMT_FLAG_NONBLOCK && ret == AVERROR(EAGAIN)) {
+#if FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX
+s->streams[pkt->stream_index]->cur_dts = st_cur_dts_backup;
+s->streams[pkt->stream_index]->priv_pts->val = st_priv_pts_val_backup;
+#endif
+return ret;
+} else if (ret >= 0 && s->pb && s->pb->error < 0)
 ret = s->pb->error;
 
 if (ret >= 0)
-- 
1.9.1

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


Re: [FFmpeg-devel] libavcodec : add psd image file decoder

2016-08-02 Thread Michael Niedermayer
On Tue, Jul 26, 2016 at 03:07:37PM +0200, Martin Vignali wrote:
> Sorry, forgot one out of array issue in the previous patch
> 
> Correct patch in attach
> 
> Martin

>  Makefile |1 +
>  allformats.c |1 +
>  img2dec.c|   33 +
>  3 files changed, 35 insertions(+)
> 2fe2603c097f52ade37e93ab20e7d7c7c9cf3920  
> 0001-libavformat-add-Photoshop-PSD-file.patch
> From 99c60ace42f29b681fc8e5729f4b0081a204cfe5 Mon Sep 17 00:00:00 2001
> From: Martin Vignali 
> Date: Tue, 26 Jul 2016 15:05:57 +0200
> Subject: [PATCH 1/2] libavformat : add Photoshop PSD file.
> 
> ---
>  libavformat/Makefile |  1 +
>  libavformat/allformats.c |  1 +
>  libavformat/img2dec.c| 33 +
>  3 files changed, 35 insertions(+)
> 
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index c49f9de..a79ca8f 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -234,6 +234,7 @@ OBJS-$(CONFIG_IMAGE_PGM_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_PSD_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 d490cc4..3d631e1 100644
> --- a/libavformat/allformats.c
> +++ b/libavformat/allformats.c
> @@ -364,6 +364,7 @@ void av_register_all(void)
>  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_PSD_PIPE,image_psd_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 9d6796f..c23f379 100644
> --- a/libavformat/img2dec.c
> +++ b/libavformat/img2dec.c
> @@ -821,6 +821,38 @@ static int png_probe(AVProbeData *p)
>  return 0;
>  }
>  
> +static int psd_probe(AVProbeData *p)
> +{
> +const uint8_t *b = p->buf;
> +int ret = 0;
> +uint16_t color_mode;
> +
> +if (AV_RL32(b) == MKTAG('8','B','P','S')) {
> +ret += 1;
> +} else {
> +return 0;
> +}
> +
> +if ((b[4] == 0) && (b[5] == 1)) {/* version 1 is PSD, version 2 is PSB */
> +ret += 1;
> +} else {
> +return 0;
> +}
> +
> +if ((AV_RL32(b+6) == 0) && (AV_RL16(b+10) == 0))/* reserved must be 0 */
> +ret += 1;

> +if (p->buf_size >= 26) {

I think you should fail probe with less than 26 bytes
or are there smaller files that can be valid ?


[...]

>  Changelog  |1 
>  doc/general.texi   |2 
>  libavcodec/Makefile|1 
>  libavcodec/allcodecs.c |1 
>  libavcodec/avcodec.h   |1 
>  libavcodec/psd.c   |  402 
> +
>  6 files changed, 408 insertions(+)
> a29c64726b8c030e370c552fc6535d8a48fca550  
> 0002-libavcodec-add-decoder-for-Photoshop-PSD-image-file.patch
> From df3cfa66fa71e512125526c226c1629f00949409 Mon Sep 17 00:00:00 2001
> From: Martin Vignali 
> Date: Tue, 26 Jul 2016 15:06:10 +0200
> Subject: [PATCH 2/2] libavcodec : add decoder for Photoshop PSD image file.
> 
> Decode the Image Data Section (who contain merge picture).
> Support RGB/A and Grayscale/A in 8bits and 16 bits by channel.
> Support uncompress and rle compression in Image Data Section.
> ---
>  Changelog  |   1 +
>  doc/general.texi   |   2 +
>  libavcodec/Makefile|   1 +
>  libavcodec/allcodecs.c |   1 +
>  libavcodec/avcodec.h   |   1 +
>  libavcodec/psd.c   | 402 
> +
>  6 files changed, 408 insertions(+)
>  create mode 100644 libavcodec/psd.c
> 

> diff --git a/Changelog b/Changelog
> index 99cdb80..f41d2b6 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -3,6 +3,7 @@ releases are sorted from youngest to oldest.
>  
>  version :
>  
> +- PSD Decoder

this is not based on git master


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data


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


Re: [FFmpeg-devel] [PATCH] Add stats_version documentation to PSNR filter

2016-08-02 Thread Michael Niedermayer
On Mon, Aug 01, 2016 at 09:50:59AM -0700, Lucas Cooper wrote:
> ---
>  doc/filters.texi | 20 +++-
>  1 file changed, 19 insertions(+), 1 deletion(-)

applied

thx

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

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


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


Re: [FFmpeg-devel] [PATCH] fate: add test for tremolo filter

2016-08-02 Thread Michael Niedermayer
On Tue, Aug 02, 2016 at 07:59:43AM +, Petru Rares Sincraian wrote:
> 
> Hi there,
> 
> Here is a test for tremolo filter.
> 
> 
> Regards,
> Petru Rares :)

>  fate/filter-audio.mak   |5 +
>  ref/fate/filter-tremolo |   25 +
>  2 files changed, 30 insertions(+)
> e9a7d7a1b0fffa6abd5bdc938bbcc66f98131243  
> 0001-fate-add-test-for-tremolo-filter.patch
> From c83f7fadf860c9612dfa545703ba596f3c729cbf Mon Sep 17 00:00:00 2001
> From: Petru Rares Sincraian 
> Date: Tue, 2 Aug 2016 09:38:17 +0200
> Subject: [PATCH] fate: add test for tremolo filter

applied

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates


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


Re: [FFmpeg-devel] [PATCH] fate: add test for vibrato filter

2016-08-02 Thread Michael Niedermayer
On Tue, Aug 02, 2016 at 08:07:28AM +, Petru Rares Sincraian wrote:
> 
> Hi there,
> 
> Here is a patch for vibrato filter.

fails on mingw32
(i686-w64-mingw32-gcc (GCC) 4.6.3)

--- tests/ref/fate/filter-vibrato   2016-08-02 11:07:22.211252689 +0200
+++ tests/data/fate/filter-vibrato  2016-08-02 12:26:01.999352124 +0200
@@ -3,7 +3,7 @@
 #codec_id 0: pcm_s16le
 #sample_rate 0: 44100
 #channel_layout 0: 3
-0,  0,  0, 1024, 4096, 0x4fdd3c22
+0,  0,  0, 1024, 4096, 0xf30a44a2
 0,   1024,   1024, 1024, 4096, 0xf5480016
 0,   2048,   2048, 1024, 4096, 0x5369e961
 0,   3072,   3072, 1024, 4096, 0xf6c6dd4d
Test filter-vibrato failed. Look at tests/data/fate/filter-vibrato.err for 
details.
make: *** [fate-filter-vibrato] Error 1

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato


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


[FFmpeg-devel] [PATCH] fate: add test for vibrato filter

2016-08-02 Thread Petru Rares Sincraian

Hi there,

Here is a patch for vibrato filter.


Regards,
Petru Rares.From 9969766d490e5106964c9f3e263df2679b0bac56 Mon Sep 17 00:00:00 2001
From: Petru Rares Sincraian 
Date: Tue, 2 Aug 2016 10:03:45 +0200
Subject: [PATCH] fate: add test for vibrato filter

---
 tests/fate/filter-audio.mak   |  5 +
 tests/ref/fate/filter-vibrato | 25 +
 2 files changed, 30 insertions(+)
 create mode 100644 tests/ref/fate/filter-vibrato

diff --git a/tests/fate/filter-audio.mak b/tests/fate/filter-audio.mak
index ac4c3f4..9e30f60 100644
--- a/tests/fate/filter-audio.mak
+++ b/tests/fate/filter-audio.mak
@@ -122,6 +122,11 @@ FATE_AFILTER_SAMPLES-$(call FILTERDEMDECENCMUX, STEREOTOOLS, WAV, PCM_S16LE, PCM
 fate-filter-stereotools: SRC = $(TARGET_SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
 fate-filter-stereotools: CMD = framecrc -i $(SRC) -aframes 20 -af stereotools=mlev=0.015625
 
+FATE_AFILTER-$(call FILTERDEMDECENCMUX, VIBRATO, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-filter-vibrato
+fate-filter-vibrato: tests/data/asynth-44100-2.wav
+fate-filter-vibrato: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
+fate-filter-vibrato: CMD = framecrc -i $(SRC) -aframes 20 -af vibrato
+
 tests/data/hls-list.m3u8: TAG = GEN
 tests/data/hls-list.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
 	$(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
diff --git a/tests/ref/fate/filter-vibrato b/tests/ref/fate/filter-vibrato
new file mode 100644
index 000..b88848c
--- /dev/null
+++ b/tests/ref/fate/filter-vibrato
@@ -0,0 +1,25 @@
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: pcm_s16le
+#sample_rate 0: 44100
+#channel_layout 0: 3
+0,  0,  0, 1024, 4096, 0x4fdd3c22
+0,   1024,   1024, 1024, 4096, 0xf5480016
+0,   2048,   2048, 1024, 4096, 0x5369e961
+0,   3072,   3072, 1024, 4096, 0xf6c6dd4d
+0,   4096,   4096, 1024, 4096, 0xdf1cf565
+0,   5120,   5120, 1024, 4096, 0x07160438
+0,   6144,   6144, 1024, 4096, 0xa7f0fdc3
+0,   7168,   7168, 1024, 4096, 0xd4cb00ee
+0,   8192,   8192, 1024, 4096, 0x8db30b00
+0,   9216,   9216, 1024, 4096, 0x2a17f385
+0,  10240,  10240, 1024, 4096, 0xc3b1d4c9
+0,  11264,  11264, 1024, 4096, 0x493ed68b
+0,  12288,  12288, 1024, 4096, 0xd45af35f
+0,  13312,  13312, 1024, 4096, 0x3739f52f
+0,  14336,  14336, 1024, 4096, 0x3e6a09f0
+0,  15360,  15360, 1024, 4096, 0x104d3776
+0,  16384,  16384, 1024, 4096, 0x879af3e3
+0,  17408,  17408, 1024, 4096, 0xf57ce73b
+0,  18432,  18432, 1024, 4096, 0xa4a7ed07
+0,  19456,  19456, 1024, 4096, 0xc585d339
-- 
1.9.1

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


[FFmpeg-devel] [PATCH] fate: add test for tremolo filter

2016-08-02 Thread Petru Rares Sincraian

Hi there,

Here is a test for tremolo filter.


Regards,
Petru Rares :)From c83f7fadf860c9612dfa545703ba596f3c729cbf Mon Sep 17 00:00:00 2001
From: Petru Rares Sincraian 
Date: Tue, 2 Aug 2016 09:38:17 +0200
Subject: [PATCH] fate: add test for tremolo filter

---
 tests/fate/filter-audio.mak   |  5 +
 tests/ref/fate/filter-tremolo | 25 +
 2 files changed, 30 insertions(+)
 create mode 100644 tests/ref/fate/filter-tremolo

diff --git a/tests/fate/filter-audio.mak b/tests/fate/filter-audio.mak
index ac4c3f4..d9db494 100644
--- a/tests/fate/filter-audio.mak
+++ b/tests/fate/filter-audio.mak
@@ -122,6 +122,11 @@ FATE_AFILTER_SAMPLES-$(call FILTERDEMDECENCMUX, STEREOTOOLS, WAV, PCM_S16LE, PCM
 fate-filter-stereotools: SRC = $(TARGET_SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
 fate-filter-stereotools: CMD = framecrc -i $(SRC) -aframes 20 -af stereotools=mlev=0.015625
 
+FATE_AFILTER-$(call FILTERDEMDECENCMUX, TREMOLO, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-filter-tremolo
+fate-filter-tremolo: tests/data/asynth-44100-2.wav
+fate-filter-tremolo: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
+fate-filter-tremolo: CMD = framecrc -i $(SRC) -aframes 20 -af tremolo
+
 tests/data/hls-list.m3u8: TAG = GEN
 tests/data/hls-list.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
 	$(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
diff --git a/tests/ref/fate/filter-tremolo b/tests/ref/fate/filter-tremolo
new file mode 100644
index 000..ed0e662
--- /dev/null
+++ b/tests/ref/fate/filter-tremolo
@@ -0,0 +1,25 @@
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: pcm_s16le
+#sample_rate 0: 44100
+#channel_layout 0: 3
+0,  0,  0, 1024, 4096, 0x5d3be907
+0,   1024,   1024, 1024, 4096, 0xea151fbe
+0,   2048,   2048, 1024, 4096, 0xa5bc19f4
+0,   3072,   3072, 1024, 4096, 0x8706ec6d
+0,   4096,   4096, 1024, 4096, 0x334ff275
+0,   5120,   5120, 1024, 4096, 0xcd0ff7ad
+0,   6144,   6144, 1024, 4096, 0x29a1e9c9
+0,   7168,   7168, 1024, 4096, 0x1d41e77f
+0,   8192,   8192, 1024, 4096, 0x99e7fe07
+0,   9216,   9216, 1024, 4096, 0x4bbf09ce
+0,  10240,  10240, 1024, 4096, 0x94600236
+0,  11264,  11264, 1024, 4096, 0xc8af0c9e
+0,  12288,  12288, 1024, 4096, 0x70eef88f
+0,  13312,  13312, 1024, 4096, 0xb222ec47
+0,  14336,  14336, 1024, 4096, 0x1071ee27
+0,  15360,  15360, 1024, 4096, 0x7c390bd2
+0,  16384,  16384, 1024, 4096, 0x68bdf655
+0,  17408,  17408, 1024, 4096, 0x810cfacb
+0,  18432,  18432, 1024, 4096, 0x9639e41f
+0,  19456,  19456, 1024, 4096, 0xa30be70f
-- 
1.9.1

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


[FFmpeg-devel] [PATCH] libavcodec/dnxhd: Enable 12-bit DNxHR support.

2016-08-02 Thread Steven Robertson
10- and 12-bit DNxHR use the same DC coefficient decoding process and
VLC table, just with a different shift value. From SMPTE 2019-1:2016,
8.2.4 DC Coefficient Decoding:

"For 8-bit video sampling, the maximum value of η=11 and for
10-/12-bit video sampling, the maximum value of η=13."

A sample file will be uploaded to show that with this patch, things
decode correctly:
dnxhr_hqx_12bit_1080p_smpte_colorbars_davinci_resolve.mov

Signed-off-by: Steven Robertson 
---
 libavcodec/dnxhddec.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 4d3a4a6..4d1b006 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -119,11 +119,6 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, 
int bitdepth)
 av_log(ctx->avctx, AV_LOG_ERROR, "bit depth mismatches %d %d\n", 
ff_dnxhd_cid_table[index].bit_depth, bitdepth);
 return AVERROR_INVALIDDATA;
 }
-if (bitdepth > 10) {
-avpriv_request_sample(ctx->avctx, "DNXHR 12-bit");
-if (ctx->avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL)
-return AVERROR_PATCHWELCOME;
-}
 ctx->cid_table = _dnxhd_cid_table[index];
 av_log(ctx->avctx, AV_LOG_VERBOSE, "Profile cid %d.\n", cid);
 
@@ -134,7 +129,7 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, 
int bitdepth)
 init_vlc(>ac_vlc, DNXHD_VLC_BITS, 257,
  ctx->cid_table->ac_bits, 1, 1,
  ctx->cid_table->ac_codes, 2, 2, 0);
-init_vlc(>dc_vlc, DNXHD_DC_VLC_BITS, bitdepth + 4,
+init_vlc(>dc_vlc, DNXHD_DC_VLC_BITS, bitdepth > 8 ? 14 : 12,
  ctx->cid_table->dc_bits, 1, 1,
  ctx->cid_table->dc_codes, 1, 1, 0);
 init_vlc(>run_vlc, DNXHD_VLC_BITS, 62,
-- 
2.8.0.rc2

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


[FFmpeg-devel] [PATCH] libavcodec/dnxhd: Enable 12-bit DNxHR support.

2016-08-02 Thread Steven Robertson
Apologies for the double-mail, Gmail didn't use the correct attachment
type. Resending using git, hopefully. From the original message:

DNxHR support for 12 bits wasn't waiting on a VLC table after all - there was
just an improper dependence on the value of bitdepth. I've attached a patch and
will upload a reference file (Google Drive no-sign-in-required link below) as
soon as the upload server's back up.

https://drive.google.com/folderview?id=0B1w4_XzCPf1jRWhzU1lINl96d2s=sharing

Thanks,
Steve

Steven Robertson (1):
  libavcodec/dnxhd: Enable 12-bit DNxHR support.

 libavcodec/dnxhddec.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

--
2.8.0.rc2

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