Re: [FFmpeg-devel] [PATCH] hapdec: remove unused memory.h include

2016-07-28 Thread Timothy Gu
On Thu, Jul 28, 2016 at 6:11 PM Josh de Kock  wrote:

> Most systems have this, so it isn't really a problem to include it
> even if it's not used, but some do not have memory.h as it is
> non-standard. Since it's unused just remove it anyway.
> ---
>  libavcodec/hapdec.c | 1 -
>  1 file changed, 1 deletion(-)
>

Looks good to me. For what it's worth, the include was added in
commit 3ee217853a6741b829a2683f49c590618891b1ab, and looks like a stray
change.

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


[FFmpeg-devel] [PATCH] hapdec: remove unused memory.h include

2016-07-28 Thread Josh de Kock
Most systems have this, so it isn't really a problem to include it
even if it's not used, but some do not have memory.h as it is
non-standard. Since it's unused just remove it anyway.
---
 libavcodec/hapdec.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c
index 5a399dc..f1d44cd 100644
--- a/libavcodec/hapdec.c
+++ b/libavcodec/hapdec.c
@@ -37,7 +37,6 @@
 #include "bytestream.h"
 #include "hap.h"
 #include "internal.h"
-#include "memory.h"
 #include "snappy.h"
 #include "texturedsp.h"
 #include "thread.h"
-- 
2.7.4 (Apple Git-66)

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


Re: [FFmpeg-devel] [PATCH 1/2] v2 SCTE extraction from mpegts

2016-07-28 Thread Hendrik Leppkes
On Tue, Jul 26, 2016 at 9:03 PM, Carlos Fernandez Sanz
 wrote:
> On Mon, Jul 25, 2016 at 5:41 PM, Michael Niedermayer
>  wrote:
>
>> This breaks 
>> http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket1827/vc1_dts_mplayerAudioProblem_sb41_cut.m2ts
>
>
> I need some help with this. HDMV audio is not detected correctly,
> since we are giving priority to ISO based stream_type
>
> 817 mpegts_find_stream_type(st, pes->stream_type, ISO_types);
> 818 if (pes->stream_type == 4)
> 819 st->request_probe = 50;
> 820 if ((prog_reg_desc == AV_RL32("HDMV") ||
> 821  prog_reg_desc == AV_RL32("HDPR")) &&
> 822 st->codecpar->codec_id == AV_CODEC_ID_NONE) {
> 823 mpegts_find_stream_type(st, pes->stream_type, HDMV_types);
>
> In the code above we are first giving priority to ISO_types, if ffmpeg
> does not find any matching stream_type in ISO_types then it goes for
> HDMV standard.
>
> Possible solutions:
> a) Give more priority to HDMV and HDPR then ISO_type,
> b) Remove SCTE_35 codec id from ISO_type and put in MISC type
>
> a) Is correct according to the standard but there must be some reason
> for ISO_type being placed before HDMV.
> Thoughts?

I would favor any change thats the least invasive as possible.

I briefly glanced at the SCTE ANSI standard, and it says that its
supposed to have a registration descriptor, so maybe an entry in the
REGD table is more appropriate?
"CUEI" tag, apparently.

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


Re: [FFmpeg-devel] [PATCH] libavformat/matroskadec: Add test for seeking with codec delay.

2016-07-28 Thread Michael Niedermayer
On Wed, Jul 27, 2016 at 06:33:30PM -0700, chcunning...@chromium.org wrote:
> From: Chris Cunningham 
> 
> Also cleanup parens for the skip_to_timecode check.
> ---
>  libavformat/matroskadec.c  |  2 +-
>  tests/fate/seek.mak|  3 +++
>  tests/ref/seek/mkv-codec-delay | 48 
> ++
>  3 files changed, 52 insertions(+), 1 deletion(-)
>  create mode 100644 tests/ref/seek/mkv-codec-delay

LGTM
ill apply tomorrow unless i forget in which case ill apply when someone
reminds me

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

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA


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 stereotools filter

2016-07-28 Thread Michael Niedermayer
On Thu, Jul 28, 2016 at 06:03:10PM +, Petru Rares Sincraian wrote:
> 
> Hi there,
> 
> Here is a test for stereotools filter.
> 
> 
> Regards,
> Petru :D

>  fate/filter-audio.mak   |4 
>  ref/fate/filter-stereotools |   25 +
>  2 files changed, 29 insertions(+)
> 9f832e02c27f6b34d818ae104a44c535fbb929bb  
> 0001-fate-add-test-for-stereotools-filter.patch
> From fae8038c19ec162179d7606f74c698a0f6de61c2 Mon Sep 17 00:00:00 2001
> From: Petru Rares Sincraian 
> Date: Thu, 28 Jul 2016 20:01:40 +0200
> Subject: [PATCH] fate: add test for stereotools filter

applied

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH] libavformat/matroskadec: Add test for seeking with codec delay.

2016-07-28 Thread James Almer
On 7/28/2016 5:24 PM, Chris Cunningham wrote:
> Thanks Michael. Do you mean to also apply the patch to add the test? Maybe
> you're waiting for further review.

Usually samples are uploaded some hours or a day before pushing the commit
that uses them, to give the FATE clients time to sync.

Also, please don't top post.

> 
> On Thu, Jul 28, 2016 at 9:48 AM, Michael Niedermayer > wrote:
> 
>> On Wed, Jul 27, 2016 at 06:35:50PM -0700, Chris Cunningham wrote:
>>> The file to upload to fate-suite can be found here:
>>>
>> https://storage.googleapis.com/chcunningham-chrome-shared/codec_delay_opus.mkv
>>
>> uploaded
>>
>> thx
>>
>> [...]
>> --
>> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>>
>> Those who are best at talking, realize last or never when they are wrong.
>>
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 

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


Re: [FFmpeg-devel] [PATCH] libavformat/matroskadec: Add test for seeking with codec delay.

2016-07-28 Thread Chris Cunningham
Thanks Michael. Do you mean to also apply the patch to add the test? Maybe
you're waiting for further review.

On Thu, Jul 28, 2016 at 9:48 AM, Michael Niedermayer  wrote:

> On Wed, Jul 27, 2016 at 06:35:50PM -0700, Chris Cunningham wrote:
> > The file to upload to fate-suite can be found here:
> >
> https://storage.googleapis.com/chcunningham-chrome-shared/codec_delay_opus.mkv
>
> uploaded
>
> thx
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Those who are best at talking, realize last or never when they are wrong.
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/mpegtsenc: add special case for handling timed ID3 packets

2016-07-28 Thread James Almer
On 7/28/2016 3:44 PM, Timothy Gu wrote:
> On Thu, May 19, 2016 at 1:23 PM Michael Niedermayer 
> wrote:
> 
>> On Thu, May 19, 2016 at 06:45:41PM +0200, Stefano Sabatini wrote:
>>> Set the stream_id to 0xbd (private_stream_id_1). Tools seem to assume
>>> that value, and this is consistent with MPEG TS (ITU-T H.222.0) section
>>> 2.12.3.
>>> ---
>>>  libavformat/mpegtsenc.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>
>> should be ok
>>
> 
> Any reason why this was held back?
> 
> Timothy

Stefano apparently forgot to push it.

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


Re: [FFmpeg-devel] [PATCH] lavf/mpegtsenc: add special case for handling timed ID3 packets

2016-07-28 Thread Timothy Gu
On Thu, May 19, 2016 at 1:23 PM Michael Niedermayer 
wrote:

> On Thu, May 19, 2016 at 06:45:41PM +0200, Stefano Sabatini wrote:
> > Set the stream_id to 0xbd (private_stream_id_1). Tools seem to assume
> > that value, and this is consistent with MPEG TS (ITU-T H.222.0) section
> > 2.12.3.
> > ---
> >  libavformat/mpegtsenc.c | 3 +++
> >  1 file changed, 3 insertions(+)
>
> should be ok
>

Any reason why this was held back?

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


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

2016-07-28 Thread Petru Rares Sincraian

Hi there,

Here is a test for stereotools filter.


Regards,
Petru :DFrom fae8038c19ec162179d7606f74c698a0f6de61c2 Mon Sep 17 00:00:00 2001
From: Petru Rares Sincraian 
Date: Thu, 28 Jul 2016 20:01:40 +0200
Subject: [PATCH] fate: add test for stereotools filter

---
 tests/fate/filter-audio.mak   |  4 
 tests/ref/fate/filter-stereotools | 25 +
 2 files changed, 29 insertions(+)
 create mode 100644 tests/ref/fate/filter-stereotools

diff --git a/tests/fate/filter-audio.mak b/tests/fate/filter-audio.mak
index 32787a7..cb278c8 100644
--- a/tests/fate/filter-audio.mak
+++ b/tests/fate/filter-audio.mak
@@ -114,6 +114,10 @@ fate-filter-extrastereo: tests/data/asynth-44100-2.wav
 fate-filter-extrastereo: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
 fate-filter-extrastereo: CMD = framecrc -i $(SRC) -aframes 20 -af extrastereo=m=2
 
+FATE_AFILTER_SAMPLES-$(call FILTERDEMDECENCMUX, STEREOTOOLS, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-filter-stereotools
+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
+
 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-stereotools b/tests/ref/fate/filter-stereotools
new file mode 100644
index 000..89babd6
--- /dev/null
+++ b/tests/ref/fate/filter-stereotools
@@ -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, 0x48b6d241
+0,   1024,   1024, 1024, 4096, 0xe0c4ca9a
+0,   2048,   2048, 1024, 4096, 0x6dd8e26c
+0,   3072,   3072, 1024, 4096, 0x047cce1c
+0,   4096,   4096, 1024, 4096, 0x0b7bc8e4
+0,   5120,   5120, 1024, 4096, 0xf0c9d037
+0,   6144,   6144, 1024, 4096, 0x6f23c83d
+0,   7168,   7168, 1024, 4096, 0xe6d8c099
+0,   8192,   8192, 1024, 4096, 0xcca3cb25
+0,   9216,   9216, 1024, 4096, 0xefced25b
+0,  10240,  10240, 1024, 4096, 0x8614cdcb
+0,  11264,  11264, 1024, 4096, 0x06d1eb3f
+0,  12288,  12288, 1024, 4096, 0x7afbcffd
+0,  13312,  13312, 1024, 4096, 0x6371dcd8
+0,  14336,  14336, 1024, 4096, 0xdd8f90d9
+0,  15360,  15360, 1024, 4096, 0x448c08f4
+0,  16384,  16384, 1024, 4096, 0x4d9b2d26
+0,  17408,  17408, 1024, 4096, 0x735a05da
+0,  18432,  18432, 1024, 4096, 0x8651bf40
+0,  19456,  19456, 1024, 4096, 0xbf98c4e7
-- 
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 silenceremove filter

2016-07-28 Thread Petru Rares Sincraian

Hi there,

Here is a test for silenceremove filter.


Regards,
Petru :)From c91678a65751beee3959977af07f263cf879468a Mon Sep 17 00:00:00 2001
From: Petru Rares Sincraian 
Date: Thu, 28 Jul 2016 19:31:55 +0200
Subject: [PATCH] fate: add test for silenceremove filter

---
 tests/fate/filter-audio.mak |  4 
 tests/ref/fate/filter-silenceremove | 35 +++
 2 files changed, 39 insertions(+)
 create mode 100644 tests/ref/fate/filter-silenceremove

diff --git a/tests/fate/filter-audio.mak b/tests/fate/filter-audio.mak
index 32787a7..d83c3b6 100644
--- a/tests/fate/filter-audio.mak
+++ b/tests/fate/filter-audio.mak
@@ -114,6 +114,10 @@ fate-filter-extrastereo: tests/data/asynth-44100-2.wav
 fate-filter-extrastereo: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
 fate-filter-extrastereo: CMD = framecrc -i $(SRC) -aframes 20 -af extrastereo=m=2
 
+FATE_AFILTER_SAMPLES-$(call FILTERDEMDECENCMUX, SILENCEREMOVE, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-filter-silenceremove
+fate-filter-silenceremove: SRC = $(TARGET_SAMPLES)/audio-reference/divertimenti_2ch_96kHz_s24.wav
+fate-filter-silenceremove: CMD = framecrc -i $(SRC) -aframes 30 -af silenceremove=0:0:0:-1:0:-90dB
+
 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-silenceremove b/tests/ref/fate/filter-silenceremove
new file mode 100644
index 000..43360e8
--- /dev/null
+++ b/tests/ref/fate/filter-silenceremove
@@ -0,0 +1,35 @@
+#tb 0: 1/192000
+#media_type 0: audio
+#codec_id 0: pcm_s16le
+#sample_rate 0: 192000
+#channel_layout 0: 3
+0,  0,  0,1,4, 0x0028
+0,  1,  1,1,4, 0x00180006
+0,  2,  2,1,4, 0x001c0007
+0,  3,  3,1,4, 0x03250208
+0,  4,  4,1,4, 0x03290208
+0,  5,  5,1,4, 0x03230207
+0,  6,  6,1,4, 0x031f0206
+0,  7,  7,1,4, 0x03250208
+0,  8,  8,1,4, 0x00220009
+0,  9,  9,1,4, 0x0029
+0, 10, 10,1,4, 0x03250208
+0, 11, 11,1,4, 0x0335020c
+0, 12, 12,1,4, 0x034b0211
+0, 13, 13,1,4, 0x034b020f
+0, 14, 14,1,4, 0x0343020e
+0, 15, 15,1,4, 0x00440011
+0, 16, 16,1,4, 0x00400011
+0, 17, 17,1,4, 0x003a000f
+0, 18, 18,1,4, 0x0339020d
+0, 19, 19,1,4, 0x003a000f
+0, 20, 20,1,4, 0x0034000d
+0, 21, 21,1,4, 0x0034000d
+0, 22, 22,1,4, 0x0036000e
+0, 23, 23,1,4, 0x03290208
+0, 24, 24,1,4, 0x03230204
+0, 25, 25,1,4, 0x03170201
+0, 26, 26,1,4, 0x030701fd
+0, 27, 27,1,4, 0x02fd01fc
+0, 28, 28,1,4, 0x00060002
+0, 29, 29,1,4, 0x000c0004
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH] libavformat/matroskadec: Add test for seeking with codec delay.

2016-07-28 Thread Michael Niedermayer
On Wed, Jul 27, 2016 at 06:35:50PM -0700, Chris Cunningham wrote:
> The file to upload to fate-suite can be found here:
> https://storage.googleapis.com/chcunningham-chrome-shared/codec_delay_opus.mkv

uploaded

thx

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

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


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


[FFmpeg-devel] [PATCH 1/5] doc/bsfs: Fix bsf options divider in documentation

2016-07-28 Thread sebechlebskyjan
From: Jan Sebechlebsky 

The actual implementation uses ':' divider, not '/' as
documented.

Signed-off-by: Jan Sebechlebsky 
---
 doc/bitstream_filters.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi
index 6c58d02..a85327f 100644
--- a/doc/bitstream_filters.texi
+++ b/doc/bitstream_filters.texi
@@ -18,7 +18,7 @@ comma-separated list of filters, whose parameters follow the 
filter
 name after a '='.
 
 @example
-ffmpeg -i INPUT -c:v copy -bsf:v filter1[=opt1=str1/opt2=str2][,filter2] OUTPUT
+ffmpeg -i INPUT -c:v copy -bsf:v filter1[=opt1=str1:opt2=str2][,filter2] OUTPUT
 @end example
 
 Below is a description of the currently available bitstream filters,
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 4/5] avcodec/bsf: Add custom item name func for BSF list

2016-07-28 Thread sebechlebskyjan
From: Jan Sebechlebsky 

Add custom item name function for bsf list, which will
construct string description of filter chain. This is
done using lazy-initialization, so there is no overhead
if item name is never accessed.

Signed-off-by: Jan Sebechlebsky 

Conflicts:
libavcodec/bsf.c
---
 This allows to get some text representation of list BSF filter
 for logging purposes.

 libavcodec/bsf.c | 30 +-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
index 3ae0a2b..c2e13f7 100644
--- a/libavcodec/bsf.c
+++ b/libavcodec/bsf.c
@@ -23,6 +23,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
+#include "libavutil/bprint.h"
 
 #include "avcodec.h"
 #include "bsf.h"
@@ -247,6 +248,7 @@ typedef struct BSFListContext {
 int idx;   // index of currently processed BSF
 int flushed_idx;   // index of BSF being flushed
 
+char * item_name;
 } BSFListContext;
 
 
@@ -370,11 +372,37 @@ static void bsf_list_close(AVBSFContext *bsf)
 for (i = 0; i < lst->ctx_nr; ++i)
 av_bsf_free(>bsf_lst[i]);
 av_freep(>bsf_lst);
+av_freep(>item_name);
+}
+
+static const char *bsf_list_item_name(void *ctx)
+{
+static const char *null_filter_name = "null";
+AVBSFContext *bsf_ctx = ctx;
+BSFListContext *lst = bsf_ctx->priv_data;
+
+if (!lst->ctx_nr)
+return null_filter_name;
+
+if (!lst->item_name) {
+int i;
+AVBPrint bp;
+av_bprint_init(, 16, 128);
+
+av_bprintf(, "bsf_list(");
+for (i = 0; i < lst->ctx_nr; i++)
+av_bprintf(, i ? ",%s" : "%s", lst->bsf_lst[i]->filter->name);
+av_bprintf(, ")");
+
+av_bprint_finalize(, >item_name);
+}
+
+return lst->item_name;
 }
 
 static const AVClass bsf_list_class = {
 .class_name = "bsf_list",
-.item_name = av_default_item_name,
+.item_name = bsf_list_item_name,
 .version = LIBAVUTIL_VERSION_INT,
 };
 
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 5/5] avformat/tee: Use BSF list API

2016-07-28 Thread sebechlebskyjan
From: Jan Sebechlebsky 

Signed-off-by: Jan Sebechlebsky 
---
 libavformat/tee.c | 123 +-
 1 file changed, 58 insertions(+), 65 deletions(-)

diff --git a/libavformat/tee.c b/libavformat/tee.c
index b4158e1..1a055cd 100644
--- a/libavformat/tee.c
+++ b/libavformat/tee.c
@@ -36,7 +36,7 @@ typedef enum {
 
 typedef struct {
 AVFormatContext *avf;
-AVBitStreamFilterContext **bsfs; ///< bitstream filters per stream
+AVBSFContext **bsfs; ///< bitstream filters per stream
 
 SlaveFailurePolicy on_fail;
 
@@ -104,46 +104,6 @@ fail:
 return ret;
 }
 
-/**
- * Parse list of bitstream filters and add them to the list of filters
- * pointed to by bsfs.
- *
- * The list must be specified in the form:
- * BSFS ::= BSF[,BSFS]
- */
-static int parse_bsfs(void *log_ctx, const char *bsfs_spec,
-  AVBitStreamFilterContext **bsfs)
-{
-char *bsf_name, *buf, *dup, *saveptr;
-int ret = 0;
-
-if (!(dup = buf = av_strdup(bsfs_spec)))
-return AVERROR(ENOMEM);
-
-while (bsf_name = av_strtok(buf, ",", )) {
-AVBitStreamFilterContext *bsf = av_bitstream_filter_init(bsf_name);
-
-if (!bsf) {
-av_log(log_ctx, AV_LOG_ERROR,
-   "Cannot initialize bitstream filter with name '%s', "
-   "unknown filter or internal error happened\n",
-   bsf_name);
-ret = AVERROR_UNKNOWN;
-goto end;
-}
-
-/* append bsf context to the list of bsf contexts */
-*bsfs = bsf;
-bsfs = >next;
-
-buf = NULL;
-}
-
-end:
-av_free(dup);
-return ret;
-}
-
 static inline int parse_slave_failure_policy_option(const char *opt, TeeSlave 
*tee_slave)
 {
 if (!opt) {
@@ -175,14 +135,8 @@ static int close_slave(TeeSlave *tee_slave)
 ret = av_write_trailer(avf);
 
 if (tee_slave->bsfs) {
-for (i = 0; i < avf->nb_streams; ++i) {
-AVBitStreamFilterContext *bsf_next, *bsf = tee_slave->bsfs[i];
-while (bsf) {
-bsf_next = bsf->next;
-av_bitstream_filter_close(bsf);
-bsf = bsf_next;
-}
-}
+for (i = 0; i < avf->nb_streams; ++i)
+av_bsf_free(_slave->bsfs[i]);
 }
 av_freep(_slave->stream_map);
 av_freep(_slave->bsfs);
@@ -352,7 +306,7 @@ static int open_slave(AVFormatContext *avf, char *slave, 
TeeSlave *tee_slave)
"output '%s', filters will be ignored\n", i, 
filename);
 continue;
 }
-ret = parse_bsfs(avf, entry->value, _slave->bsfs[i]);
+ret = av_bsf_list_parse_str(entry->value, _slave->bsfs[i]);
 if (ret < 0) {
 av_log(avf, AV_LOG_ERROR,
"Error parsing bitstream filter sequence '%s' 
associated to "
@@ -365,6 +319,31 @@ static int open_slave(AVFormatContext *avf, char *slave, 
TeeSlave *tee_slave)
 av_dict_set(, entry->key, NULL, 0);
 }
 
+for (i = 0; i < avf2->nb_streams; i++){
+if (!tee_slave->bsfs[i]) {
+/* Add pass-through bitstream filter */
+ret = av_bsf_get_null_filter(_slave->bsfs[i]);
+if (ret < 0) {
+av_log(avf, AV_LOG_ERROR,
+   "Failed to create pass-through bitstream filter: %s\n",
+   av_err2str(ret));
+goto end;
+}
+}
+
+tee_slave->bsfs[i]->time_base_in = avf2->streams[i]->time_base;
+ret = avcodec_parameters_copy(tee_slave->bsfs[i]->par_in,
+  avf2->streams[i]->codecpar);
+
+ret = av_bsf_init(tee_slave->bsfs[i]);
+if (ret < 0) {
+av_log(avf, AV_LOG_ERROR,
+"Failed to initialize bitstream filter(s): %s\n",
+av_err2str(ret));
+goto end;
+}
+}
+
 if (options) {
 entry = NULL;
 while ((entry = av_dict_get(options, "", entry, 
AV_DICT_IGNORE_SUFFIX)))
@@ -389,20 +368,16 @@ static void log_slave(TeeSlave *slave, void *log_ctx, int 
log_level)
slave->avf->filename, slave->avf->oformat->name);
 for (i = 0; i < slave->avf->nb_streams; i++) {
 AVStream *st = slave->avf->streams[i];
-AVBitStreamFilterContext *bsf = slave->bsfs[i];
+AVBSFContext *bsf = slave->bsfs[i];
+const char * bsf_name;
 
 av_log(log_ctx, log_level, "stream:%d codec:%s type:%s",
i, avcodec_get_name(st->codecpar->codec_id),
av_get_media_type_string(st->codecpar->codec_type));
-if (bsf) {
-av_log(log_ctx, log_level, " bsfs:");
-while (bsf) {
-av_log(log_ctx, log_level, "%s%s",
-   bsf->filter->name, bsf->next ? "," : "");
-

[FFmpeg-devel] [PATCH 2/5] avcodec/bsf: Add ff_bsf_get_packet_ref() function

2016-07-28 Thread sebechlebskyjan
From: Jan Sebechlebsky 

Use of this function can save unnecessary malloc operation
in bitstream filter.

Signed-off-by: Jan Sebechlebsky 
---
 libavcodec/bsf.c | 16 
 libavcodec/bsf.h | 11 +++
 2 files changed, 27 insertions(+)

diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
index 8e36861..40fc925 100644
--- a/libavcodec/bsf.c
+++ b/libavcodec/bsf.c
@@ -220,3 +220,19 @@ int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt)
 
 return 0;
 }
+
+int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
+{
+AVBSFInternal *in = ctx->internal;
+
+if (in->eof)
+return AVERROR_EOF;
+
+if (!ctx->internal->buffer_pkt->data &&
+!ctx->internal->buffer_pkt->side_data_elems)
+return AVERROR(EAGAIN);
+
+av_packet_move_ref(pkt, ctx->internal->buffer_pkt);
+
+return 0;
+}
diff --git a/libavcodec/bsf.h b/libavcodec/bsf.h
index 3435df5..af035ee 100644
--- a/libavcodec/bsf.h
+++ b/libavcodec/bsf.h
@@ -28,6 +28,17 @@
  */
 int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt);
 
+/**
+ * Called by bitstream filters to get packet for filtering.
+ * The reference to packet is moved to provided packet structure.
+ *
+ * @param ctx pointer to AVBSFContext of filter
+ * @param pkt pointer to packet to move reference to
+ *
+ * @return 0>= on success, negative AVERROR in case of failure
+ */
+int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt);
+
 const AVClass *ff_bsf_child_class_next(const AVClass *prev);
 
 #endif /* AVCODEC_BSF_H */
-- 
1.9.1

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


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

2016-07-28 Thread sebechlebskyjan
From: Jan Sebechlebsky 

---
 libavcodec/avcodec.h |  74 ++
 libavcodec/bsf.c | 284 +++
 2 files changed, 358 insertions(+)

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);
+
+/**
+ * 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);
+
+/**
+ * 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
+ *
+ * @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;
+
+int idx;   // index of currently processed BSF
+int flushed_idx;   // index of BSF being flushed
+
+} 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 = av_bsf_init(lst->bsf_lst[i]);
+if (ret < 0)
+goto fail;
+
+cod_par = lst->bsf_lst[i]->par_out;
+tb = lst->bsf_lst[i]->time_base_out;
+}
+
+bsf->time_base_out = tb;
+ret = avcodec_parameters_copy(bsf->par_out, cod_par);
+
+fail:
+return ret;
+}
+
+static int bsf_list_flush(AVBSFContext *bsf, AVPacket *out)
+{
+BSFListContext *lst = bsf->priv_data;
+int ret;
+
+if (lst->flushed_idx == lst->ctx_nr)
+return AVERROR_EOF;
+
+while (1) {
+if (lst->idx > lst->flushed_idx) {
+ret = av_bsf_receive_packet(lst->bsf_lst[lst->idx-1], out);
+if (ret == AVERROR(EAGAIN)) {
+ret = 0;
+lst->idx--;
+continue;
+} else if (ret == AVERROR_EOF) {
+/* filter idx-1 is done, let's flush filter idx */
+lst->flushed_idx = lst->idx;
+continue;
+} else if (ret < 0) {
+/* 

Re: [FFmpeg-devel] [PATCH 1/4] lavc: add mpeg4 mediacodec decoder

2016-07-28 Thread Matthieu Bouron
On Wed, Jul 27, 2016 at 06:39:27PM +0200, Matthieu Bouron wrote:
> On Tue, Jul 26, 2016 at 05:54:58PM +0200, Thomas Volkert wrote:
> > On 26.07.2016 11:15, Matthieu Bouron wrote:
> > > On Tue, Jul 26, 2016 at 11:00:46AM +0200, Matthieu Bouron wrote:
> > >> On Sun, Jul 24, 2016 at 03:06:14PM +0200, Thomas Volkert wrote:
> > >>> From: Thomas Volkert 
> > >>>
> > >>> ---
> > >>>  Changelog|   1 +
> > >>>  configure|   1 +
> > >>>  libavcodec/Makefile  |   1 +
> > >>>  libavcodec/allcodecs.c   |   1 +
> > >>>  libavcodec/mediacodecdec_mpeg4.c | 239 
> > >>> +++
> > >>>  libavcodec/version.h |   2 +-
> > >>>  6 files changed, 244 insertions(+), 1 deletion(-)
> > >>>  create mode 100644 libavcodec/mediacodecdec_mpeg4.c
> > >>>
> > >>> diff --git a/Changelog b/Changelog
> > >>> index 2bd18ec..b8bbdb9 100644
> > >>> --- a/Changelog
> > >>> +++ b/Changelog
> > >>> @@ -7,6 +7,7 @@ version :
> > >>>  - Changed metadata print option to accept general urls
> > >>>  - Alias muxer for Ogg Video (.ogv)
> > >>>  - VP8 in Ogg muxing
> > >>> +- MediaCodec MPEG-4 decoding
> > >>>  
> > >>>  
> > >>>  version 3.1:
> > >>> diff --git a/configure b/configure
> > >>> index 1b41303..9004b06 100755
> > >>> --- a/configure
> > >>> +++ b/configure
> > >>> @@ -2621,6 +2621,7 @@ 
> > >>> mpeg2_videotoolbox_hwaccel_select="mpeg2video_decoder"
> > >>>  mpeg2_xvmc_hwaccel_deps="xvmc"
> > >>>  mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
> > >>>  mpeg4_crystalhd_decoder_select="crystalhd"
> > >>> +mpeg4_mediacodec_decoder_deps="mediacodec"
> > >>>  mpeg4_mmal_decoder_deps="mmal"
> > >>>  mpeg4_mmal_decoder_select="mmal"
> > >>>  mpeg4_mmal_hwaccel_deps="mmal"
> > >>> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> > >>> index abef19e..642cf2a 100644
> > >>> --- a/libavcodec/Makefile
> > >>> +++ b/libavcodec/Makefile
> > >>> @@ -317,6 +317,7 @@ OBJS-$(CONFIG_H264_DECODER)+= h264.o 
> > >>> h264_cabac.o h264_cavlc.o \
> > >>>h2645_parse.o
> > >>>  OBJS-$(CONFIG_H264_CUVID_DECODER)  += cuvid.o
> > >>>  OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec_h264.o
> > >>> +OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec_mpeg4.o
> > >>>  OBJS-$(CONFIG_H264_MMAL_DECODER)   += mmaldec.o
> > >>>  OBJS-$(CONFIG_H264_NVENC_ENCODER)  += nvenc_h264.o
> > >>>  OBJS-$(CONFIG_NVENC_ENCODER)   += nvenc_h264.o
> > >>> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> > >>> index 951e199..2d98694 100644
> > >>> --- a/libavcodec/allcodecs.c
> > >>> +++ b/libavcodec/allcodecs.c
> > >>> @@ -239,6 +239,7 @@ void avcodec_register_all(void)
> > >>>  REGISTER_ENCDEC (MPEG2VIDEO,mpeg2video);
> > >>>  REGISTER_ENCDEC (MPEG4, mpeg4);
> > >>>  REGISTER_DECODER(MPEG4_CRYSTALHD,   mpeg4_crystalhd);
> > >>> +REGISTER_DECODER(MPEG4_MEDIACODEC,  mpeg4_mediacodec);
> > >>>  REGISTER_DECODER(MPEG4_MMAL,mpeg4_mmal);
> > >> You should also add the relevant hwaccel entry in this file:
> > >>
> > >> +REGISTER_HWACCEL(MPEG4_MEDIACODEC,  mpeg4_mediacodec);
> > >>
> > >> and declare the hwaccel at the bottom of libavcodec/mediacodecdec.c, 
> > >> like the h264 one.
> > >>
> > >>>  #if FF_API_VDPAU
> > >>>  REGISTER_DECODER(MPEG4_VDPAU,   mpeg4_vdpau);
> > >>> diff --git a/libavcodec/mediacodecdec_mpeg4.c 
> > >>> b/libavcodec/mediacodecdec_mpeg4.c
> > >>> new file mode 100644
> > >>> index 000..7c4559b
> > >>> --- /dev/null
> > >>> +++ b/libavcodec/mediacodecdec_mpeg4.c
> > >>> @@ -0,0 +1,239 @@
> > >>> +/*
> > >>> + * Android MediaCodec MPEG 4 decoder
> > >>> + *
> > >>> + * Copyright (c) 2016 Thomas Volkert 
> > >>> + *
> > >>> + * 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/avassert.h"
> > >>> +#include "libavutil/common.h"
> > >>> +#include "libavutil/fifo.h"
> > >>> +
> > >>> +#include "avcodec.h"
> > >>> +#include "internal.h"
> > >>> +#include "mediacodecdec.h"
> > >>> 

Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding

2016-07-28 Thread Umair Khan
On Thu, Jul 28, 2016 at 2:25 PM, Thilo Borgmann  wrote:
> Am 28.07.16 um 08:28 schrieb Umair Khan:
>> On Thu, Jul 28, 2016 at 12:22 AM, Clément Bœsch  wrote:
>>> On Wed, Jul 27, 2016 at 07:48:56PM +0200, Thilo Borgmann wrote:
> @@ -1803,6 +2057,34 @@ static av_cold int decode_init(AVCodecContext 
> *avctx)
>  ctx->raw_buffer   = av_mallocz_array(avctx->channels * 
> channel_size, sizeof(*ctx->raw_buffer));
>  ctx->raw_samples  = av_malloc_array(avctx->channels, 
> sizeof(*ctx->raw_samples));
>
> +if (sconf->floating) {
> +ctx->acf   = av_malloc_array(avctx->channels, 
> sizeof(*ctx->acf));
> +ctx->shift_value   = av_malloc_array(avctx->channels, 
> sizeof(*ctx->shift_value));
> +ctx->last_shift_value  = av_malloc_array(avctx->channels, 
> sizeof(*ctx->last_shift_value));
> +ctx->last_acf_mantissa = av_malloc_array(avctx->channels, 
> sizeof(*ctx->last_acf_mantissa));
> +ctx->raw_mantissa  = av_malloc_array(avctx->channels, 
> sizeof(*ctx->raw_mantissa));
> +
> +ctx->larray = av_malloc_array(ctx->cur_frame_length * 4, 
> sizeof(*ctx->larray));
> +ctx->nbits  = av_malloc_array(ctx->cur_frame_length, 
> sizeof(*ctx->nbits));
>
> +ctx->mlz= av_malloc(sizeof(*ctx->mlz));
> +ff_mlz_init_dict(avctx, ctx->mlz);
> +ff_mlz_flush_dict(ctx->mlz);
>
> ctx->mlz is also used without allocation check. Are the _dict functions safe 
> for
> ctx->mlz == NULL?

Updated.

- Umair


0001-avcodec-alsdec-implement-floating-point-decoding.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avutil/mem: fix memleak

2016-07-28 Thread Michael Niedermayer
On Tue, Jul 19, 2016 at 12:30:54AM +0800, Zhao Zhili wrote:
> The original code assumes av_realloc() will free ptr if size is zero.
> The assumes is incorrect now.
> ---
>  libavutil/mem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH] avutil/mem: fix outdated comment

2016-07-28 Thread Michael Niedermayer
On Thu, Jul 28, 2016 at 11:50:47AM +0200, Michael Niedermayer wrote:
> On Mon, Jul 18, 2016 at 11:36:49PM +0800, Zhao Zhili wrote:
> > ---
> >  libavutil/mem.h | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/libavutil/mem.h b/libavutil/mem.h
> > index d25b322..9dd9099 100644
> > --- a/libavutil/mem.h
> > +++ b/libavutil/mem.h
> > @@ -99,14 +99,14 @@ av_alloc_size(1, 2) static inline void
> > *av_malloc_array(size_t nmemb, size_t siz
> > 
> >  /**
> >   * Allocate or reallocate a block of memory.
> > - * If ptr is NULL and size > 0, allocate a new block. If
> > - * size is zero, free the memory block pointed to by ptr.
> > + * If ptr is NULL and size > 0, allocate a new block. The memory block
> > pointed
> > + * to by ptr won't be freed even when size is zero.
> 
> av_realloc() can certainly free the source pointed to
> be ptr as it sees fit during reallocation also when the size is 0.
> 
> we could document it either as

> The behavior with size 0 may be that an allocated array of small size
> is returned instead of the null pointer and complete deallocation

this in fact also doesnt work as description, as it would leave
identifying realloc errors with size 0 impossible


> or With size 0 an allocated array of minimal size is provided, accesses
> into such size 0 array result in undefined behavior.
> 
> or similar
> 
> question is how much room for changes we want ...
> 
> 
> [...]
> 
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> Those who are too smart to engage in politics are punished by being
> governed by those who are dumber. -- Plato 



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


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH] avutil/mem: fix outdated comment

2016-07-28 Thread Michael Niedermayer
On Mon, Jul 18, 2016 at 11:36:49PM +0800, Zhao Zhili wrote:
> ---
>  libavutil/mem.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavutil/mem.h b/libavutil/mem.h
> index d25b322..9dd9099 100644
> --- a/libavutil/mem.h
> +++ b/libavutil/mem.h
> @@ -99,14 +99,14 @@ av_alloc_size(1, 2) static inline void
> *av_malloc_array(size_t nmemb, size_t siz
> 
>  /**
>   * Allocate or reallocate a block of memory.
> - * If ptr is NULL and size > 0, allocate a new block. If
> - * size is zero, free the memory block pointed to by ptr.
> + * If ptr is NULL and size > 0, allocate a new block. The memory block
> pointed
> + * to by ptr won't be freed even when size is zero.

av_realloc() can certainly free the source pointed to
be ptr as it sees fit during reallocation also when the size is 0.

we could document it either as
The behavior with size 0 may be that an allocated array of small size
is returned instead of the null pointer and complete deallocation
or With size 0 an allocated array of minimal size is provided, accesses
into such size 0 array result in undefined behavior.

or similar

question is how much room for changes we want ...


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- 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] avcodec/alsdec: implement floating point decoding

2016-07-28 Thread Thilo Borgmann
Am 28.07.16 um 08:28 schrieb Umair Khan:
> On Thu, Jul 28, 2016 at 12:22 AM, Clément Bœsch  wrote:
>> On Wed, Jul 27, 2016 at 07:48:56PM +0200, Thilo Borgmann wrote:
 @@ -1803,6 +2057,34 @@ static av_cold int decode_init(AVCodecContext 
 *avctx)
  ctx->raw_buffer   = av_mallocz_array(avctx->channels * 
 channel_size, sizeof(*ctx->raw_buffer));
  ctx->raw_samples  = av_malloc_array(avctx->channels, 
 sizeof(*ctx->raw_samples));

 +if (sconf->floating) {
 +ctx->acf   = av_malloc_array(avctx->channels, 
 sizeof(*ctx->acf));
 +ctx->shift_value   = av_malloc_array(avctx->channels, 
 sizeof(*ctx->shift_value));
 +ctx->last_shift_value  = av_malloc_array(avctx->channels, 
 sizeof(*ctx->last_shift_value));
 +ctx->last_acf_mantissa = av_malloc_array(avctx->channels, 
 sizeof(*ctx->last_acf_mantissa));
 +ctx->raw_mantissa  = av_malloc_array(avctx->channels, 
 sizeof(*ctx->raw_mantissa));
 +
 +ctx->larray = av_malloc_array(ctx->cur_frame_length * 4, 
 sizeof(*ctx->larray));
 +ctx->nbits  = av_malloc_array(ctx->cur_frame_length, 
 sizeof(*ctx->nbits));

 +ctx->mlz= av_malloc(sizeof(*ctx->mlz));
 +ff_mlz_init_dict(avctx, ctx->mlz);
 +ff_mlz_flush_dict(ctx->mlz);

ctx->mlz is also used without allocation check. Are the _dict functions safe for
ctx->mlz == NULL?

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


Re: [FFmpeg-devel] Fwd: [PATCH] avcodec: allow hardware decoding with multithread for FFmpeg

2016-07-28 Thread Hendrik Leppkes
On Thu, Jul 28, 2016 at 9:39 AM, Stève Lhomme  wrote:
> On Wed, Jul 27, 2016 at 7:58 PM, Hendrik Leppkes  wrote:
>> On Wed, Jul 27, 2016 at 6:43 PM, Stève Lhomme  wrote:
>>> Hello fellow FFmpegers,
>>>
>>> Is there still an issue with hardware decoding when combined with
>>> multithread ? It seems to work fine on our Windows build. Although we
>>> have a mutex in place in the D3D11 variant of the code that may help.
>>> It mostly protects the video context...
>>>
>>> If necessary we can have the same trick for DXVA2 if there are still
>>> known issues.
>>>
>>
>> ffmpeg.c just produces corrupt decoding when you try to use that, so
>> use at your own peril.
>
> Is it random or pretty easy to get the issue ? I'd certainly like to
> understand the issue better.

Its really simple: If you lock a frame for read-back while its being
used as a reference frame by the GPU, the decoding on the GPU fails.
You could try to protect every access with a global lock, I guess, but
thats really a rather ugly solution and doesn't really give any
benefits over just not threading (see below for why its not faster
anyway)

This can be instantly reproduced on DXVA2 at least with both Intel and
NVIDIA GPUs (do not know about AMD, don't have any handy).
I'm not sure what happens on Linux, some people said its safer there
due to different ways to copy the data off the surfaces not being a
full lock, at least in the way ffmpeg.c implements it.

>
> With D3D11 we were using the decoder context in the decoder threads
> and the vout thread. In debug builds Windows was complaining with
> various warnings about that. On some phones it was even crashing.
> After protecting the context in the libavcodec and the vout everything
> seems to work fine. Is there anything else that would explain issues ?
> Maybe Linux or Mac don't detect such cross accesses and that's how
> corruption happens ?
>
>> Not to mention that it doesn't offer any performance benefits.
>
> libavcodec can decode multiple frames in parallel why couldn't the GPU
> do it as well ? It would be odd that GPU based solutions are inferior
> to CPU based ones.

GPUs also decode multiple frames at once, which is why performance
suffers when you instantly try to lock them after getting them out of
the decoder (because it needs to sync first), however the GPU does
this silently behind the back in an async fashion, you don't need CPU
threads to feed it simultaneously.

There is a bit of misconception because threaded decoding through
ffmpeg.c *looks* faster right now on some systems, but that comes back
to the forced sync mentioned above. Threads add an inherent delay
until the frame is returned to the caller, and as such gives the GPU
more time to asynchroniously finish the frame. You can fix that
without threads by simply delaying locking the frames by about 2
frames, and get full speed then.

On top of that threading requires allocating more frame surfaces just
for the way threading works in avcodec (one per thread at least, in
extreme cases 16 per thread), so it even costs resources without
gaining anything.
Not to mention that handling threaded hwaccel in avcodec has caused a
variety of bugs in the past, which are hopefully fixed now, but its
still rather ugly due to that.

>
> Last but not least, why is it considered ok to use multiple threads in
> libav and not in FFmpeg ? The code is pretty much the same for GPU
> decoding.
>

Libav runs into the same corruption issues, they just never cared to
do anything about that.

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


Re: [FFmpeg-devel] [GSoC] MLP/TrueHD encoder

2016-07-28 Thread Jai Luthra
Hi,

Sorry for the late reply. I'll fix these issues tonight.

> more generally, is everything going acording to plan ?
> anything that you need help with ?

For now everything is going good. I ping atomnuker for updates or
whenever I'm stuck.

I've managed to encode 2-channel audio to a valid TrueHD bitstream
(decodes via ffmpeg).
I'm working on support for multiple channels for both MLP and TrueHD.
It is trivial for MLP, but doesn't look so for TrueHD; but I can
figure it out by comparing with the decoder.

I'll also need to test if the bitstream decodes on hardware and the
proprietary suite.

Cheers,
Jai Luthra
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Fwd: [PATCH] avcodec: allow hardware decoding with multithread for FFmpeg

2016-07-28 Thread Stève Lhomme
On Wed, Jul 27, 2016 at 7:58 PM, Hendrik Leppkes  wrote:
> On Wed, Jul 27, 2016 at 6:43 PM, Stève Lhomme  wrote:
>> Hello fellow FFmpegers,
>>
>> Is there still an issue with hardware decoding when combined with
>> multithread ? It seems to work fine on our Windows build. Although we
>> have a mutex in place in the D3D11 variant of the code that may help.
>> It mostly protects the video context...
>>
>> If necessary we can have the same trick for DXVA2 if there are still
>> known issues.
>>
>
> ffmpeg.c just produces corrupt decoding when you try to use that, so
> use at your own peril.

Is it random or pretty easy to get the issue ? I'd certainly like to
understand the issue better.

With D3D11 we were using the decoder context in the decoder threads
and the vout thread. In debug builds Windows was complaining with
various warnings about that. On some phones it was even crashing.
After protecting the context in the libavcodec and the vout everything
seems to work fine. Is there anything else that would explain issues ?
Maybe Linux or Mac don't detect such cross accesses and that's how
corruption happens ?

> Not to mention that it doesn't offer any performance benefits.

libavcodec can decode multiple frames in parallel why couldn't the GPU
do it as well ? It would be odd that GPU based solutions are inferior
to CPU based ones.

Last but not least, why is it considered ok to use multiple threads in
libav and not in FFmpeg ? The code is pretty much the same for GPU
decoding.

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


Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding

2016-07-28 Thread Umair Khan
On Thu, Jul 28, 2016 at 12:22 AM, Clément Bœsch  wrote:
> On Wed, Jul 27, 2016 at 07:48:56PM +0200, Thilo Borgmann wrote:
>> > @@ -1803,6 +2057,34 @@ static av_cold int decode_init(AVCodecContext 
>> > *avctx)
>> >  ctx->raw_buffer   = av_mallocz_array(avctx->channels * 
>> > channel_size, sizeof(*ctx->raw_buffer));
>> >  ctx->raw_samples  = av_malloc_array(avctx->channels, 
>> > sizeof(*ctx->raw_samples));
>> >
>> > +if (sconf->floating) {
>> > +ctx->acf   = av_malloc_array(avctx->channels, 
>> > sizeof(*ctx->acf));
>> > +ctx->shift_value   = av_malloc_array(avctx->channels, 
>> > sizeof(*ctx->shift_value));
>> > +ctx->last_shift_value  = av_malloc_array(avctx->channels, 
>> > sizeof(*ctx->last_shift_value));
>> > +ctx->last_acf_mantissa = av_malloc_array(avctx->channels, 
>> > sizeof(*ctx->last_acf_mantissa));
>> > +ctx->raw_mantissa  = av_malloc_array(avctx->channels, 
>> > sizeof(*ctx->raw_mantissa));
>> > +
>> > +ctx->larray = av_malloc_array(ctx->cur_frame_length * 4, 
>> > sizeof(*ctx->larray));
>> > +ctx->nbits  = av_malloc_array(ctx->cur_frame_length, 
>> > sizeof(*ctx->nbits));
>> > +ctx->mlz= av_malloc(sizeof(*ctx->mlz));
>> > +ff_mlz_init_dict(avctx, ctx->mlz);
>> > +ff_mlz_flush_dict(ctx->mlz);
>> > +
>> > +if (!ctx->mlz || !ctx->acf || !ctx->shift_value || 
>> > !ctx->last_shift_value
>> > +|| !ctx->last_acf_mantissa || !ctx->raw_mantissa) {
>> > +av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory 
>> > failed.\n");
>> > +ret = AVERROR(ENOMEM);
>> > +goto fail;
>> > +}
>>
>> > +for (c = 0; c < avctx->channels; ++c) {
>> > +ctx->raw_mantissa[c] = av_malloc_array(ctx->cur_frame_length, 
>> > sizeof(**ctx->raw_mantissa));
>>
>> Is there no av_malloc_arrayz() ?
>>
>
> there is av_mallocz_array()

Updated and tested.

- Umair


0001-avcodec-alsdec-implement-floating-point-decoding.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel