Re: [FFmpeg-devel] compile error caused by configure script's change

2017-03-22 Thread Dzung Hoang
I banged my head against this and finally figured out that opencv 3.2.0 does 
not support C language binding. You need to get opencv 2.4.13.


  From: Masaru Nomiya 
 To: ffmpeg-devel@ffmpeg.org 
 Sent: Wednesday, March 22, 2017 9:38 PM
 Subject: [FFmpeg-devel] compile error caused by configure script's change
   
Hello,

I got the very latest git head, and tried to compile.
But, with ./configure's run, I got an error message as follows;

[...]
gcc -L/usr/local/cuda/lib64 -Wl,--as-needed -Wl,-z,noexecstack -o 
/tmp/ffconf.G0t8P470 /tmp/ffconf.3kiEFzc2.o -lopencv_core -lopencv_imgproc 
-lopencore-amrwb -lopencore-amrnb -lnut -lmp3lame -L/usr/local/lib64 -lmodplug 
-lilbc -lgsm -lfreetype -lfontconfig -lfreetype -lflite_cmu_time_awb 
-lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms 
-lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite -L/usr/local/lib64 
-lfdk-aac -lcaca -lcelt0 -lcelt0 -lbs2b -L/usr/local/lib64 -lbluray 
-L/usr/local/lib64 -lass -lraw1394 -lavc1394 -lrom1394 -liec61883 -lgnutls 
-lgmp -lcrystalhd -lm -llzma -lbz2 -lz -pthread
/tmp/ffconf.3kiEFzc2.o: In function `cvPointFrom32f':
ffconf.ZvXFCPIK.c:(.text+0x5fe): undefined reference to `cvRound'
ffconf.ZvXFCPIK.c:(.text+0x618): undefined reference to `cvRound'
/tmp/ffconf.3kiEFzc2.o: In function `cvReadInt':
ffconf.ZvXFCPIK.c:(.text+0xf40): undefined reference to `cvRound'
collect2: error: ld returned 1 exit status
ERROR: opencv not found

I installed opencv 3.2.0 last December. So, I suspected the configure
script.
With the configure script of 21th Mar, the compilation ended without
any problem.

I checked the difference of 2 configure scripts, but I can't find the
change which cause the problem.

Thanks,

---
┏━━┓彡 Masaru Nomiya            mail-to: nomiya @ galaxy.dti.ne.jp
┃\/彡
┗━━┛ "Bill! You married with Computers.
          Not with Me!"
        "No..., with money."
___
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 0/7] convert most of the remaining files to stdatomic

2017-03-22 Thread James Almer
On 3/22/2017 11:01 PM, James Almer wrote:
> On 3/22/2017 10:01 PM, Michael Niedermayer wrote:
>> On Wed, Mar 22, 2017 at 08:34:05PM -0300, James Almer wrote:
>>> This set deals with most of the remaining cases of libavutil/atomic.h usage.
>>> "make fate THREADS=4" passes here on mingw-w64, but I'm not 100% sure fate
>>> has proper coverage of some of these functions.
>>>
>>> Only ones remaining are Decklink (It's C++98 and I'm not sure how wise would
>>> it be to include a C11 header in there, so i'm leaving that to someone 
>>> else),
>>> and error_resilience.
>>>
>>> James Almer (7):
>>>   avcodec/mediacodec: convert to stdatomic
>>>   avcodec/utils: convert to stdatomic
>>>   avcodec/parser: convert to stdatomic
>>>   avformat/format: convert to stdatomic
>>>   avfilter/avfilter: convert to stdatomic
>>>   avutil/opencl: convert to stdatomic
>>>   avcodec/videotoolboxenc: remove unused atomic header
>>>
>>>  libavcodec/mediacodec.c   |  5 ++---
>>>  libavcodec/mediacodecdec.c|  1 -
>>>  libavcodec/mediacodecdec_common.c | 14 ++
>>>  libavcodec/mediacodecdec_common.h |  5 +++--
>>>  libavcodec/parser.c   | 14 ++
>>>  libavcodec/utils.c| 19 +++
>>>  libavcodec/videotoolboxenc.c  |  1 -
>>>  libavfilter/avfilter.c|  6 --
>>>  libavformat/format.c  |  9 ++---
>>>  libavutil/opencl.c|  5 +++--
>>>  10 files changed, 45 insertions(+), 34 deletions(-)
>>
>> This breaks building with clang
>>
>> CC  libavfilter/avfilter.o
>> CC  libavformat/format.o
>> CC  libavcodec/parser.o
>> CC  libavcodec/utils.o
>> src/libavformat/format.c:68:51: error: address argument to atomic operation 
>> must be a pointer to _Atomic type ('AVInputFormat **' (aka 'struct 
>> AVInputFormat **') invalid)
>> while(p != >next && !format->next && 
>> !__c11_atomic_compare_exchange_strong(p, , format, 5, 5))
>>   ^  
>>   ~
>> src/libavformat/format.c:81:51: error: address argument to atomic operation 
>> must be a pointer to _Atomic type ('AVOutputFormat **' (aka 'struct 
>> AVOutputFormat **') invalid)
>> while(p != >next && !format->next && 
>> !__c11_atomic_compare_exchange_strong(p, , format, 5, 5))
>>   ^  
>>   ~
>> 2 errors generated.
>> make: *** [libavformat/format.o] Error 1
> 
> Casting the first argument to (atomic_intptr_t *) on GCC 6 gives me a warning
> about making integer from pointer, but still works nonetheless.
> 
> I'm not sure how to fix this. Got any idea?

Does the attached patch compile with Clang? GCC 6 seems happy with it.
It's getting kind of ugly in any case.

>From 3bf230d5f611ae5d1511e4629f742fc96b379b7f Mon Sep 17 00:00:00 2001
From: James Almer 
Date: Wed, 22 Mar 2017 23:43:54 -0300
Subject: [PATCH] avformat/format: convert to stdatomic

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

diff --git a/libavformat/format.c b/libavformat/format.c
index 38ca2a3465..781f341936 100644
--- a/libavformat/format.c
+++ b/libavformat/format.c
@@ -19,7 +19,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavutil/atomic.h"
+#include 
+
 #include "libavutil/avstring.h"
 #include "libavutil/bprint.h"
 #include "libavutil/opt.h"
@@ -61,9 +62,10 @@ AVOutputFormat *av_oformat_next(const AVOutputFormat *f)
 void av_register_input_format(AVInputFormat *format)
 {
 AVInputFormat **p = last_iformat;
+const AVInputFormat *cmp = NULL;
 
 // Note, format could be added after the first 2 checks but that implies that *p is no longer NULL
-while(p != >next && !format->next && avpriv_atomic_ptr_cas((void * volatile *)p, NULL, format))
+while(p != >next && !format->next && !atomic_compare_exchange_strong((atomic_intptr_t *)p, (intptr_t *), (intptr_t)format))
 p = &(*p)->next;
 
 if (!format->next)
@@ -73,9 +75,10 @@ void av_register_input_format(AVInputFormat *format)
 void av_register_output_format(AVOutputFormat *format)
 {
 AVOutputFormat **p = last_oformat;
+const AVOutputFormat *cmp = NULL;
 
 // Note, format could be added after the first 2 checks but that implies that *p is no longer NULL
-while(p != >next && !format->next && avpriv_atomic_ptr_cas((void * volatile *)p, NULL, format))
+while(p != >next && !format->next && !atomic_compare_exchange_strong((atomic_intptr_t *)p, (intptr_t *), (intptr_t)format))
 p = &(*p)->next;
 
 if (!format->next)
-- 
2.12.0

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


[FFmpeg-devel] compile error caused by configure script's change

2017-03-22 Thread Masaru Nomiya
Hello,

I got the very latest git head, and tried to compile.
But, with ./configure's run, I got an error message as follows;

[...]
gcc -L/usr/local/cuda/lib64 -Wl,--as-needed -Wl,-z,noexecstack -o 
/tmp/ffconf.G0t8P470 /tmp/ffconf.3kiEFzc2.o -lopencv_core -lopencv_imgproc 
-lopencore-amrwb -lopencore-amrnb -lnut -lmp3lame -L/usr/local/lib64 -lmodplug 
-lilbc -lgsm -lfreetype -lfontconfig -lfreetype -lflite_cmu_time_awb 
-lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms 
-lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite -L/usr/local/lib64 
-lfdk-aac -lcaca -lcelt0 -lcelt0 -lbs2b -L/usr/local/lib64 -lbluray 
-L/usr/local/lib64 -lass -lraw1394 -lavc1394 -lrom1394 -liec61883 -lgnutls 
-lgmp -lcrystalhd -lm -llzma -lbz2 -lz -pthread
/tmp/ffconf.3kiEFzc2.o: In function `cvPointFrom32f':
ffconf.ZvXFCPIK.c:(.text+0x5fe): undefined reference to `cvRound'
ffconf.ZvXFCPIK.c:(.text+0x618): undefined reference to `cvRound'
/tmp/ffconf.3kiEFzc2.o: In function `cvReadInt':
ffconf.ZvXFCPIK.c:(.text+0xf40): undefined reference to `cvRound'
collect2: error: ld returned 1 exit status
ERROR: opencv not found

I installed opencv 3.2.0 last December. So, I suspected the configure
script.
With the configure script of 21th Mar, the compilation ended without
any problem.

I checked the difference of 2 configure scripts, but I can't find the
change which cause the problem.

Thanks,

---
┏━━┓彡 Masaru Nomiya mail-to: nomiya @ galaxy.dti.ne.jp
┃\/彡
┗━━┛ "Bill! You married with Computers.
  Not with Me!"
 "No..., with money."
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 0/7] convert most of the remaining files to stdatomic

2017-03-22 Thread James Almer
On 3/22/2017 10:01 PM, Michael Niedermayer wrote:
> On Wed, Mar 22, 2017 at 08:34:05PM -0300, James Almer wrote:
>> This set deals with most of the remaining cases of libavutil/atomic.h usage.
>> "make fate THREADS=4" passes here on mingw-w64, but I'm not 100% sure fate
>> has proper coverage of some of these functions.
>>
>> Only ones remaining are Decklink (It's C++98 and I'm not sure how wise would
>> it be to include a C11 header in there, so i'm leaving that to someone else),
>> and error_resilience.
>>
>> James Almer (7):
>>   avcodec/mediacodec: convert to stdatomic
>>   avcodec/utils: convert to stdatomic
>>   avcodec/parser: convert to stdatomic
>>   avformat/format: convert to stdatomic
>>   avfilter/avfilter: convert to stdatomic
>>   avutil/opencl: convert to stdatomic
>>   avcodec/videotoolboxenc: remove unused atomic header
>>
>>  libavcodec/mediacodec.c   |  5 ++---
>>  libavcodec/mediacodecdec.c|  1 -
>>  libavcodec/mediacodecdec_common.c | 14 ++
>>  libavcodec/mediacodecdec_common.h |  5 +++--
>>  libavcodec/parser.c   | 14 ++
>>  libavcodec/utils.c| 19 +++
>>  libavcodec/videotoolboxenc.c  |  1 -
>>  libavfilter/avfilter.c|  6 --
>>  libavformat/format.c  |  9 ++---
>>  libavutil/opencl.c|  5 +++--
>>  10 files changed, 45 insertions(+), 34 deletions(-)
> 
> This breaks building with clang
> 
> CC  libavfilter/avfilter.o
> CC  libavformat/format.o
> CC  libavcodec/parser.o
> CC  libavcodec/utils.o
> src/libavformat/format.c:68:51: error: address argument to atomic operation 
> must be a pointer to _Atomic type ('AVInputFormat **' (aka 'struct 
> AVInputFormat **') invalid)
> while(p != >next && !format->next && 
> !__c11_atomic_compare_exchange_strong(p, , format, 5, 5))
>   ^   
>  ~
> src/libavformat/format.c:81:51: error: address argument to atomic operation 
> must be a pointer to _Atomic type ('AVOutputFormat **' (aka 'struct 
> AVOutputFormat **') invalid)
> while(p != >next && !format->next && 
> !__c11_atomic_compare_exchange_strong(p, , format, 5, 5))
>   ^   
>  ~
> 2 errors generated.
> make: *** [libavformat/format.o] Error 1

Casting the first argument to (atomic_intptr_t *) on GCC 6 gives me a warning
about making integer from pointer, but still works nonetheless.

I'm not sure how to fix this. Got any idea?

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


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/ac3dsp: add special-case handling for the C downmix_fixed function

2017-03-22 Thread Michael Niedermayer
On Wed, Mar 22, 2017 at 12:41:26PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libavcodec/ac3dsp.c | 61 
> +
>  1 file changed, 61 insertions(+)

LGTM

thx

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

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates


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


Re: [FFmpeg-devel] [PATCH 1/2] fate: add tests for ac3_fixed 5.1 downmix

2017-03-22 Thread Michael Niedermayer
On Wed, Mar 22, 2017 at 12:41:25PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  tests/fate/ac3.mak | 8 
>  1 file changed, 8 insertions(+)

LGTM

thx

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

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


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


[FFmpeg-devel] [PATCH v8] avformat/dashdec: add dash demuxer base version

2017-03-22 Thread Steven Liu
resend, remove unnecessary file modify

v2 fixed:
1. from autodetect to disabled
2. from camelCase code style to ffmpeg code style
3. from RepType to AVMediaType
4. fix variable typo
5. change time value from uint32_t to uint64_t
6. removed be used once API
7. change 'time(NULL)`, except it is not 2038-safe.' to av_gettime and
av_timegm
8. merge complex free operation to free_fragment
9. use API from snprintf to av_asprintf

v3 fixed:
1. fix typo from --enabled-xml2 to --enable-xml2

v4 fixed:
1. from --enable-xml2 to --enable-libxml2
2. move system includes to top
3. remove nouse includes
4. rename enum name
5. add a trailing comma for the last entry enum
6. fix comment typo
7. add const to DASHContext class front
8. check sscanf if return arguments and give warning message when error
9. check validity before free seg->url and seg
10. check if the val is null, before use atoll

v5 fixed:
1. fix typo from mainifest to manifest

v6 fixed:
1. from realloc to av_realloc
2. from free to av_free

v7 fixed:
1. remove the -lxml2 from configure when require_pkg_config

v8 fixed:
1. fix replace filename template by av_asprintf secure problem

Reviewed-by: Clément Bœsch 
Reviewed-by: Michael Niedermayer 
Reviewed-by: Carl Eugen Hoyos 
Reviewed-by: Rodger Combs 
Reviewed-by: Moritz Barsnick 
Reviewed-by: Nicolas George 
Reviewed-by: Ricardo Constantino 
Signed-off-by: Steven Liu 
---
 configure|4 +
 libavformat/Makefile |1 +
 libavformat/allformats.c |2 +-
 libavformat/dashdec.c| 1849 ++
 4 files changed, 1855 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/dashdec.c

diff --git a/configure b/configure
index 4eb116b..db40105 100755
--- a/configure
+++ b/configure
@@ -273,6 +273,7 @@ External library support:
   --enable-libxcb-shapeenable X11 grabbing shape rendering [autodetect]
   --enable-libxvid enable Xvid encoding via xvidcore,
native MPEG-4/Xvid encoder exists [no]
+  --enable-libxml2enable XML parsing using the C library libxml2 
[no]
   --enable-libzimg enable z.lib, needed for zscale filter [no]
   --enable-libzmq  enable message passing via libzmq [no]
   --enable-libzvbi enable teletext support via libzvbi [no]
@@ -1590,6 +1591,7 @@ EXTERNAL_LIBRARY_LIST="
 libvpx
 libwavpack
 libwebp
+libxml2
 libzimg
 libzmq
 libzvbi
@@ -2920,6 +2922,7 @@ avi_muxer_select="riffenc"
 caf_demuxer_select="iso_media riffdec"
 caf_muxer_select="iso_media"
 dash_muxer_select="mp4_muxer"
+dash_demuxer_deps="libxml2"
 dirac_demuxer_select="dirac_parser"
 dts_demuxer_select="dca_parser"
 dtshd_demuxer_select="dca_parser"
@@ -5920,6 +5923,7 @@ enabled openssl   && { use_pkg_config openssl 
openssl/ssl.h OPENSSL_init
check_lib openssl/ssl.h SSL_library_init -lssl 
-lcrypto -lws2_32 -lgdi32 ||
die "ERROR: openssl not found"; }
 enabled qtkit_indev  && { check_header_objcc QTKit/QTKit.h || disable 
qtkit_indev; }
+enabled libxml2 && require_pkg_config libxml-2.0 
libxml2/libxml/xmlversion.h xmlCheckVersion
 
 # libdc1394 check
 if enabled libdc1394; then
diff --git a/libavformat/Makefile b/libavformat/Makefile
index f56ef16..d77ffaa 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -134,6 +134,7 @@ OBJS-$(CONFIG_CRC_MUXER) += crcenc.o
 OBJS-$(CONFIG_DATA_DEMUXER)  += rawdec.o
 OBJS-$(CONFIG_DATA_MUXER)+= rawenc.o
 OBJS-$(CONFIG_DASH_MUXER)+= dashenc.o
+OBJS-$(CONFIG_DASH_DEMUXER)  += dashdec.o
 OBJS-$(CONFIG_DAUD_DEMUXER)  += dauddec.o
 OBJS-$(CONFIG_DAUD_MUXER)+= daudenc.o
 OBJS-$(CONFIG_DCSTR_DEMUXER) += dcstr.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 09e62c3..d57314b 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -96,7 +96,7 @@ static void register_all(void)
 REGISTER_DEMUXER (CINE, cine);
 REGISTER_DEMUXER (CONCAT,   concat);
 REGISTER_MUXER   (CRC,  crc);
-REGISTER_MUXER   (DASH, dash);
+REGISTER_MUXDEMUX(DASH, dash);
 REGISTER_MUXDEMUX(DATA, data);
 REGISTER_MUXDEMUX(DAUD, daud);
 REGISTER_DEMUXER (DCSTR,dcstr);
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
new file mode 100644
index 000..8cf328a
--- /dev/null
+++ b/libavformat/dashdec.c
@@ -0,0 +1,1849 @@
+/*
+ * Dynamic Adaptive Streaming over HTTP demux
+ * Copyright (c) 2017 samsam...@o2.pl based on HLS demux
+ * Copyright (c) 2017 Steven Liu
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can 

[FFmpeg-devel] [PATCH v8] avformat/dashdec: add dash demuxer base version

2017-03-22 Thread Steven Liu
v2 fixed:
1. from autodetect to disabled
2. from camelCase code style to ffmpeg code style
3. from RepType to AVMediaType
4. fix variable typo
5. change time value from uint32_t to uint64_t
6. removed be used once API
7. change 'time(NULL)`, except it is not 2038-safe.' to av_gettime and
av_timegm
8. merge complex free operation to free_fragment
9. use API from snprintf to av_asprintf

v3 fixed:
1. fix typo from --enabled-xml2 to --enable-xml2

v4 fixed:
1. from --enable-xml2 to --enable-libxml2
2. move system includes to top
3. remove nouse includes
4. rename enum name
5. add a trailing comma for the last entry enum
6. fix comment typo
7. add const to DASHContext class front
8. check sscanf if return arguments and give warning message when error
9. check validity before free seg->url and seg
10. check if the val is null, before use atoll

v5 fixed:
1. fix typo from mainifest to manifest

v6 fixed:
1. from realloc to av_realloc
2. from free to av_free

v7 fixed:
1. remove the -lxml2 from configure when require_pkg_config

v8 fixed:
1. fix replace filename template by av_asprintf secure problem

Reviewed-by: Clément Bœsch 
Reviewed-by: Michael Niedermayer 
Reviewed-by: Carl Eugen Hoyos 
Reviewed-by: Rodger Combs 
Reviewed-by: Moritz Barsnick 
Reviewed-by: Nicolas George 
Reviewed-by: Ricardo Constantino 
Signed-off-by: Steven Liu 
---
 configure|4 +
 libavformat/Makefile |1 +
 libavformat/allformats.c |2 +-
 libavformat/dashdec.c| 1849 ++
 libavformat/segment.c|1 +
 5 files changed, 1856 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/dashdec.c

diff --git a/configure b/configure
index 4eb116b..db40105 100755
--- a/configure
+++ b/configure
@@ -273,6 +273,7 @@ External library support:
   --enable-libxcb-shapeenable X11 grabbing shape rendering [autodetect]
   --enable-libxvid enable Xvid encoding via xvidcore,
native MPEG-4/Xvid encoder exists [no]
+  --enable-libxml2enable XML parsing using the C library libxml2 
[no]
   --enable-libzimg enable z.lib, needed for zscale filter [no]
   --enable-libzmq  enable message passing via libzmq [no]
   --enable-libzvbi enable teletext support via libzvbi [no]
@@ -1590,6 +1591,7 @@ EXTERNAL_LIBRARY_LIST="
 libvpx
 libwavpack
 libwebp
+libxml2
 libzimg
 libzmq
 libzvbi
@@ -2920,6 +2922,7 @@ avi_muxer_select="riffenc"
 caf_demuxer_select="iso_media riffdec"
 caf_muxer_select="iso_media"
 dash_muxer_select="mp4_muxer"
+dash_demuxer_deps="libxml2"
 dirac_demuxer_select="dirac_parser"
 dts_demuxer_select="dca_parser"
 dtshd_demuxer_select="dca_parser"
@@ -5920,6 +5923,7 @@ enabled openssl   && { use_pkg_config openssl 
openssl/ssl.h OPENSSL_init
check_lib openssl/ssl.h SSL_library_init -lssl 
-lcrypto -lws2_32 -lgdi32 ||
die "ERROR: openssl not found"; }
 enabled qtkit_indev  && { check_header_objcc QTKit/QTKit.h || disable 
qtkit_indev; }
+enabled libxml2 && require_pkg_config libxml-2.0 
libxml2/libxml/xmlversion.h xmlCheckVersion
 
 # libdc1394 check
 if enabled libdc1394; then
diff --git a/libavformat/Makefile b/libavformat/Makefile
index f56ef16..d77ffaa 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -134,6 +134,7 @@ OBJS-$(CONFIG_CRC_MUXER) += crcenc.o
 OBJS-$(CONFIG_DATA_DEMUXER)  += rawdec.o
 OBJS-$(CONFIG_DATA_MUXER)+= rawenc.o
 OBJS-$(CONFIG_DASH_MUXER)+= dashenc.o
+OBJS-$(CONFIG_DASH_DEMUXER)  += dashdec.o
 OBJS-$(CONFIG_DAUD_DEMUXER)  += dauddec.o
 OBJS-$(CONFIG_DAUD_MUXER)+= daudenc.o
 OBJS-$(CONFIG_DCSTR_DEMUXER) += dcstr.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 09e62c3..d57314b 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -96,7 +96,7 @@ static void register_all(void)
 REGISTER_DEMUXER (CINE, cine);
 REGISTER_DEMUXER (CONCAT,   concat);
 REGISTER_MUXER   (CRC,  crc);
-REGISTER_MUXER   (DASH, dash);
+REGISTER_MUXDEMUX(DASH, dash);
 REGISTER_MUXDEMUX(DATA, data);
 REGISTER_MUXDEMUX(DAUD, daud);
 REGISTER_DEMUXER (DCSTR,dcstr);
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
new file mode 100644
index 000..8cf328a
--- /dev/null
+++ b/libavformat/dashdec.c
@@ -0,0 +1,1849 @@
+/*
+ * Dynamic Adaptive Streaming over HTTP demux
+ * Copyright (c) 2017 samsam...@o2.pl based on HLS demux
+ * Copyright (c) 2017 Steven Liu
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can 

Re: [FFmpeg-devel] [PATCH 0/7] convert most of the remaining files to stdatomic

2017-03-22 Thread Michael Niedermayer
On Wed, Mar 22, 2017 at 08:34:05PM -0300, James Almer wrote:
> This set deals with most of the remaining cases of libavutil/atomic.h usage.
> "make fate THREADS=4" passes here on mingw-w64, but I'm not 100% sure fate
> has proper coverage of some of these functions.
> 
> Only ones remaining are Decklink (It's C++98 and I'm not sure how wise would
> it be to include a C11 header in there, so i'm leaving that to someone else),
> and error_resilience.
> 
> James Almer (7):
>   avcodec/mediacodec: convert to stdatomic
>   avcodec/utils: convert to stdatomic
>   avcodec/parser: convert to stdatomic
>   avformat/format: convert to stdatomic
>   avfilter/avfilter: convert to stdatomic
>   avutil/opencl: convert to stdatomic
>   avcodec/videotoolboxenc: remove unused atomic header
> 
>  libavcodec/mediacodec.c   |  5 ++---
>  libavcodec/mediacodecdec.c|  1 -
>  libavcodec/mediacodecdec_common.c | 14 ++
>  libavcodec/mediacodecdec_common.h |  5 +++--
>  libavcodec/parser.c   | 14 ++
>  libavcodec/utils.c| 19 +++
>  libavcodec/videotoolboxenc.c  |  1 -
>  libavfilter/avfilter.c|  6 --
>  libavformat/format.c  |  9 ++---
>  libavutil/opencl.c|  5 +++--
>  10 files changed, 45 insertions(+), 34 deletions(-)

This breaks building with clang

CC  libavfilter/avfilter.o
CC  libavformat/format.o
CC  libavcodec/parser.o
CC  libavcodec/utils.o
src/libavformat/format.c:68:51: error: address argument to atomic operation 
must be a pointer to _Atomic type ('AVInputFormat **' (aka 'struct 
AVInputFormat **') invalid)
while(p != >next && !format->next && 
!__c11_atomic_compare_exchange_strong(p, , format, 5, 5))
  ^ 
   ~
src/libavformat/format.c:81:51: error: address argument to atomic operation 
must be a pointer to _Atomic type ('AVOutputFormat **' (aka 'struct 
AVOutputFormat **') invalid)
while(p != >next && !format->next && 
!__c11_atomic_compare_exchange_strong(p, , format, 5, 5))
  ^ 
   ~
2 errors generated.
make: *** [libavformat/format.o] Error 1
src/libavfilter/avfilter.c:591:18: error: address argument to atomic operation 
must be a pointer to _Atomic type ('AVFilter **' (aka 'struct AVFilter **') 
invalid)
while(*f || !__c11_atomic_compare_exchange_strong(f, , filter, 5, 5))
 ^~
src/libavfilter/avfilter.c:984:2410: warning: array index 3 is past the end of 
the array (which contains 3 elements) [-Warray-bounds]
   !__extension__ ({ size_t __s1_len, __s2_len; 
(__builtin_constant_p (filter->filter->name) && __builtin_constant_p ("pp") && 
(__s1_len = __builtin_strlen (filter->filter->name), __s2_len = 
__builtin_strlen ("pp"), (!((size_t)(const void *)((filter->filter->name) + 1) 
- (size_t)(const void *)(filter->filter->name) == 1) || __s1_len >= 4) && 
(!((size_t)(const void *)(("pp") + 1) - (size_t)(const void *)("pp") == 1) || 
__s2_len >= 4)) ? __builtin_strcmp (filter->filter->name, "pp") : 
(__builtin_constant_p (filter->filter->name) && ((size_t)(const void 
*)((filter->filter->name) + 1) - (size_t)(const void *)(filter->filter->name) 
== 1) && (__s1_len = __builtin_strlen (filter->filter->name), __s1_len < 4) ? 
(__builtin_constant_p ("pp") && ((size_t)(const void *)(("pp") + 1) - 
(size_t)(const void *)("pp") == 1) ? __builtin_strcmp (filter->filter->name, 
"pp") : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char 
*) (__const char *) ("pp"); register int __result = (((__const unsigned char *) 
(__const char *) (filter->filter->name))[0] - __s2[0]); if (__s1_len > 0 && 
__result == 0) { __result = (((__const unsigned char *) (__const char *) 
(filter->filter->name))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { 
__result = (((__const unsigned char *) (__const char *) 
(filter->filter->name))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) 
__result = (((__const unsigned char *) (__const char *) 
(filter->filter->name))[3] - __s2[3]); } } __result; }))) : 
(__builtin_constant_p ("pp") && ((size_t)(const void *)(("pp") + 1) - 
(size_t)(const void *)("pp") == 1) && (__s2_len = __builtin_strlen ("pp"), 
__s2_len < 4) ? (__builtin_constant_p (filter->filter->name) && ((size_t)(const 
void *)((filter->filter->name) + 1) - (size_t)(const void 
*)(filter->filter->name) == 1) ? __builtin_strcmp (filter->filter->name, "pp") 
: (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) 
(__const char *) (filter->filter->name); register int __result = __s1[0] - 
((__const unsigned char *) (__const char *) ("pp"))[0]; if (__s2_len > 0 && 
__result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char 
*) ("pp"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] 

Re: [FFmpeg-devel] [PATCH 0/7] convert most of the remaining files to stdatomic

2017-03-22 Thread Marton Balint

On Wed, 22 Mar 2017, James Almer wrote:


This set deals with most of the remaining cases of libavutil/atomic.h usage.
"make fate THREADS=4" passes here on mingw-w64, but I'm not 100% sure fate
has proper coverage of some of these functions.

Only ones remaining are Decklink (It's C++98 and I'm not sure how wise would
it be to include a C11 header in there, so i'm leaving that to someone else),


Well, I did some testing with DeckLink and it indeed is a mess to include 
stdatomic.h in C++ code. For some compiler/platform combinations it works, 
for others it does not. Maybe the cleanest solution is to simply use the 
C++11 std::atomic.


Actually there was a thread about this:
https://ffmpeg.org/pipermail/ffmpeg-devel/2016-June/195902.html

And there is also a GCC bugzilla entry:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932

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


[FFmpeg-devel] [PATCH 7/7] avcodec/videotoolboxenc: remove unused atomic header

2017-03-22 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/videotoolboxenc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 4b8718c9aa..f1c1670dd1 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -26,7 +26,6 @@
 #include "avcodec.h"
 #include "libavutil/opt.h"
 #include "libavutil/avassert.h"
-#include "libavutil/atomic.h"
 #include "libavutil/avstring.h"
 #include "libavcodec/avcodec.h"
 #include "libavutil/pixdesc.h"
-- 
2.12.0

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


[FFmpeg-devel] [PATCH 0/7] convert most of the remaining files to stdatomic

2017-03-22 Thread James Almer
This set deals with most of the remaining cases of libavutil/atomic.h usage.
"make fate THREADS=4" passes here on mingw-w64, but I'm not 100% sure fate
has proper coverage of some of these functions.

Only ones remaining are Decklink (It's C++98 and I'm not sure how wise would
it be to include a C11 header in there, so i'm leaving that to someone else),
and error_resilience.

James Almer (7):
  avcodec/mediacodec: convert to stdatomic
  avcodec/utils: convert to stdatomic
  avcodec/parser: convert to stdatomic
  avformat/format: convert to stdatomic
  avfilter/avfilter: convert to stdatomic
  avutil/opencl: convert to stdatomic
  avcodec/videotoolboxenc: remove unused atomic header

 libavcodec/mediacodec.c   |  5 ++---
 libavcodec/mediacodecdec.c|  1 -
 libavcodec/mediacodecdec_common.c | 14 ++
 libavcodec/mediacodecdec_common.h |  5 +++--
 libavcodec/parser.c   | 14 ++
 libavcodec/utils.c| 19 +++
 libavcodec/videotoolboxenc.c  |  1 -
 libavfilter/avfilter.c|  6 --
 libavformat/format.c  |  9 ++---
 libavutil/opencl.c|  5 +++--
 10 files changed, 45 insertions(+), 34 deletions(-)

-- 
2.12.0

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


[FFmpeg-devel] [PATCH 1/7] avcodec/mediacodec: convert to stdatomic

2017-03-22 Thread James Almer
Signed-off-by: James Almer 
---
Untested.

 libavcodec/mediacodec.c   |  5 ++---
 libavcodec/mediacodecdec.c|  1 -
 libavcodec/mediacodecdec_common.c | 14 ++
 libavcodec/mediacodecdec_common.h |  5 +++--
 4 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/libavcodec/mediacodec.c b/libavcodec/mediacodec.c
index 4ad5921bc2..91f725621d 100644
--- a/libavcodec/mediacodec.c
+++ b/libavcodec/mediacodec.c
@@ -31,7 +31,6 @@
 #include 
 
 #include "libavcodec/avcodec.h"
-#include "libavutil/atomic.h"
 #include "libavutil/mem.h"
 
 #include "ffjni.h"
@@ -90,9 +89,9 @@ void av_mediacodec_default_free(AVCodecContext *avctx)
 int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render)
 {
 MediaCodecDecContext *ctx = buffer->ctx;
-int released = avpriv_atomic_int_add_and_fetch(>released, 1);
+atomic_int released = atomic_fetch_add(>released, 1);
 
-if (released == 1) {
+if (!released) {
 return ff_AMediaCodec_releaseOutputBuffer(ctx->codec, buffer->index, 
render);
 }
 
diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index 2e645caafd..3ada3fa698 100644
--- a/libavcodec/mediacodecdec.c
+++ b/libavcodec/mediacodecdec.c
@@ -29,7 +29,6 @@
 #include "libavutil/opt.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/pixfmt.h"
-#include "libavutil/atomic.h"
 
 #include "avcodec.h"
 #include "h264_parse.h"
diff --git a/libavcodec/mediacodecdec_common.c 
b/libavcodec/mediacodecdec_common.c
index dfc7f5514a..87f032876d 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -23,7 +23,6 @@
 #include 
 #include 
 
-#include "libavutil/atomic.h"
 #include "libavutil/common.h"
 #include "libavutil/mem.h"
 #include "libavutil/log.h"
@@ -143,7 +142,7 @@ static enum AVPixelFormat 
mcdec_map_color_format(AVCodecContext *avctx,
 
 static void ff_mediacodec_dec_ref(MediaCodecDecContext *s)
 {
-avpriv_atomic_int_add_and_fetch(>refcount, 1);
+atomic_fetch_add(>refcount, 1);
 }
 
 static void ff_mediacodec_dec_unref(MediaCodecDecContext *s)
@@ -151,7 +150,7 @@ static void ff_mediacodec_dec_unref(MediaCodecDecContext *s)
 if (!s)
 return;
 
-if (!avpriv_atomic_int_add_and_fetch(>refcount, -1)) {
+if (atomic_fetch_sub(>refcount, 1) == 1) {
 if (s->codec) {
 ff_AMediaCodec_delete(s->codec);
 s->codec = NULL;
@@ -176,9 +175,8 @@ static void mediacodec_buffer_release(void *opaque, uint8_t 
*data)
 {
 AVMediaCodecBuffer *buffer = opaque;
 MediaCodecDecContext *ctx = buffer->ctx;
-int released = avpriv_atomic_int_get(>released);
 
-if (!released) {
+if (!atomic_load(>released)) {
 ff_AMediaCodec_releaseOutputBuffer(ctx->codec, buffer->index, 0);
 }
 
@@ -221,7 +219,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 goto fail;
 }
 
-buffer->released = 0;
+atomic_init(>released, 0);
 
 frame->buf[0] = av_buffer_create(NULL,
  0,
@@ -465,7 +463,7 @@ int ff_mediacodec_dec_init(AVCodecContext *avctx, 
MediaCodecDecContext *s,
 AV_PIX_FMT_NONE,
 };
 
-s->refcount = 1;
+atomic_init(>refcount, 1);
 
 pix_fmt = ff_get_format(avctx, pix_fmts);
 if (pix_fmt == AV_PIX_FMT_MEDIACODEC) {
@@ -725,7 +723,7 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, 
MediaCodecDecContext *s,
 
 int ff_mediacodec_dec_flush(AVCodecContext *avctx, MediaCodecDecContext *s)
 {
-if (!s->surface || avpriv_atomic_int_get(>refcount) == 1) {
+if (!s->surface || atomic_load(>refcount) == 1) {
 int ret;
 
 /* No frames (holding a reference to the codec) are retained by the
diff --git a/libavcodec/mediacodecdec_common.h 
b/libavcodec/mediacodecdec_common.h
index c00c2e89f3..10f38277b5 100644
--- a/libavcodec/mediacodecdec_common.h
+++ b/libavcodec/mediacodecdec_common.h
@@ -24,6 +24,7 @@
 #define AVCODEC_MEDIACODECDEC_COMMON_H
 
 #include 
+#include 
 #include 
 
 #include "libavutil/frame.h"
@@ -34,7 +35,7 @@
 
 typedef struct MediaCodecDecContext {
 
-volatile int refcount;
+atomic_int refcount;
 
 char *codec_name;
 
@@ -88,7 +89,7 @@ typedef struct MediaCodecBuffer {
 MediaCodecDecContext *ctx;
 ssize_t index;
 int64_t pts;
-volatile int released;
+atomic_int released;
 
 } MediaCodecBuffer;
 
-- 
2.12.0

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


Re: [FFmpeg-devel] [PATCH] clear s->error in avio_read

2017-03-22 Thread Fredrik Hubinette
ping?


On Mon, Mar 20, 2017 at 2:49 PM, Fredrik Hubinette  wrote:

> Hopefully valid patch attached.
>
>
> On Mon, Mar 20, 2017 at 2:39 PM, Fredrik Hubinette 
> wrote:
>
>> It looks like the value in s->error also comes from an earlier call to
>> avio_read().
>> ogg_read_page tries to read 4439 bytes from the file. It has 524 bytes
>> already buffered.
>> fill_buffer() fails with an EIO, but because of the buffered bytes,
>> avio_read()
>> returns 524 and leaves the EIO in s->error.
>>
>>   /Fredrik "Hubbe" Hubinette
>>
>>
>> On Mon, Mar 20, 2017 at 1:53 PM, Fredrik Hubinette 
>> wrote:
>>
>>>
>>> On Mon, Mar 20, 2017 at 1:35 PM, Michael Niedermayer <
>>> mich...@niedermayer.cc> wrote:
>>>
 On Mon, Mar 20, 2017 at 10:21:08AM -0700, Fredrik Hubinette wrote:
 > In some cases (when parsing OGG) non-fatal errors can happen, which
 > will cause s->error to be set. In most cases, this is not a problem
 beucase
 > s->error is not checked unless an actual error has occurred.  However,
 > when avio_read() fails to read more bytes, it checks s->error to
 decide if
 > it just reached the end of the file, or an error occurred. Since
 s->error is
 > not modified if no error occurred, this is not reliable unless we
 first
 > clear
 > s->error before reading.
 >
 > ---
 >  libavformat/aviobuf.c   | 2 ++
 >
 >  2 files changed, 7 insertions(+)

 how can the issue you describe be reproduced


>>> I don't currently have a simple repro. I discovered it while trying to
>>> add some buffering
>>> between the demuxer and decoder in chrome. One of our tests fails, and
>>> when
>>> looked into it, I discovered that s->error was already 5 (EIO) when
>>> entering
>>> avio_read. I have not yet tracked down where the EIO came from
>>> originally.
>>>
>>> also thats not a valid git patc

>>>
>>> Ops, I had a chrome patch and I removed the chrome-specific parts, but
>>> I must have messed it up. I will make a better patch.
>>>
>>>
 [...]
 --
 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] [PATCHv2 2/3] ffplay: convert to new decode API

2017-03-22 Thread Philip Langdale
On Tue, 21 Mar 2017 07:34:32 -0700
Philip Langdale  wrote:

> On Mon, 20 Mar 2017 21:51:49 +0100
> Marton Balint  wrote:
> 
> > Since subtitles are not yet supported with the new API,
> > CODEC_CAP_DELAY subtitle codecs (only libzvbi so far) may loose the
> > last few buffered frames in the end of the stream.
> > 
> > The impact of this is so limited, it seemded better to accept it
> > than losing the simplification benefits of the new API.  
> 
> Tried this v2 patch out and it's still stalling on the crystalhd
> input. I also learned, disturbingly, that mpv will fail if I turn on
> debug messages, so clearly there's serious timing sensitivity even
> there. I can look into blocking on the output side, but I've been
> very scared of doing this before, because I've had cases where it
> deadlocks; "sure I submitted 250 frames to the hardware - but I'm
> sure as hell not getting anything back...". I'd much rather yield to
> the application to decide when to give up, but if the API doesn't
> support that, then so be it.

Marton,

Although there's an existence proof with mpv that the crystalhd decoder
can be used through the API, it's clearly more fragile than it should
be, so I'm fine with you pushing as is, and I'll see what I can do to
make the decoder do some kind of blocking to smooth this over.

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


[FFmpeg-devel] [PATCH] ffmpeg: Remove hw_device_ctx output filter reinit hack

2017-03-22 Thread Mark Thompson
This was skipped in c17563c5d3c974a69709ebae0171534763b3051c because
it depended on the filter setup merge, but was forgotten after that
actually happened.

Fixes hwaccel fate for stream size change tests.
---
 ffmpeg_filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
index 5cc640d75d..219e473f69 100644
--- a/ffmpeg_filter.c
+++ b/ffmpeg_filter.c
@@ -460,7 +460,7 @@ static int configure_output_video_filter(FilterGraph *fg, 
OutputFilter *ofilter,
 if (ret < 0)
 return ret;
 
-if (!hw_device_ctx && (ofilter->width || ofilter->height)) {
+if (ofilter->width || ofilter->height) {
 char args[255];
 AVFilterContext *filter;
 AVDictionaryEntry *e = NULL;
-- 
2.11.0

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


Re: [FFmpeg-devel] [PATCH 2/2] lavc: vdpau: add support for new hw_frames_ctx and hw_device_ctx API

2017-03-22 Thread Mark Thompson
On 22/03/17 06:47, wm4 wrote:
> This supports retrieving the device from a provided hw_frames_ctx, and
> automatically creating a hw_frames_ctx if hw_device_ctx is set.
> 
> The old API is not deprecated yet. The user can still use
> av_vdpau_bind_context() (with or without setting hw_frames_ctx), or use
> the API before that by allocating and setting hwaccel_context manually.
> 
> (Adds missing APIchanges entry to the Libav version.)
> ---
> Libav merge.
> ---
>  doc/APIchanges  |  5 +++
>  libavcodec/vdpau.c  | 95 
> +
>  libavcodec/vdpau_internal.h |  2 +
>  libavcodec/version.h|  2 +-
>  4 files changed, 78 insertions(+), 26 deletions(-)

Tested both new modes with Mesa / AMD, all working as expected.  Set LGTM.

Thanks,

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


[FFmpeg-devel] [PATCH] avcodec/qdrw: support 16bpp files with bppcnt == 2 && bpp == 8

2017-03-22 Thread Piotr Bandurski
fixes ticket #6254


0001-avcodec-qdrw-support-16bpp-files-with-bppcnt-2-bpp-8.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat, ffmpeg: deprecate old rotation API

2017-03-22 Thread Michael Niedermayer
On Tue, Mar 21, 2017 at 08:42:58AM +0100, wm4 wrote:
> The old "API" that signaled rotation as a metadata value has been
> replaced by DISPLAYMATRIX side data quite a while ago.
> 
> There is no reason to make muxers/demuxers/API users support both. In
> addition, the metadata API is dangerous, as user tags could "leak" into
> it, creating unintended features or bugs.
> 
> Unfortunately, hacks have been added, that allow the user to override
> rotation by setting metadata explicitly, e.g. via
> 
>   -metadata:s:v:0 rotate=0
> 
> See references to trac #4560. fate-filter-meta-4560-rotate0 tests this.
> It's easier to adjust the hack for supporting it than arguing for its
> removal, so ffmpeg CLI now explicitly catches this case, and essentially
> replaces the "rotate" value with a display matrix side data. (It would
> be easier for both user and implementation to create an explicit option
> for rotation.)
> 
> When the code under FF_API_OLD_ROTATE_API is disabled, one FATE
> reference file has to be updated (because "rotate" is not exported
> anymore).
> ---
>  cmdutils.c|  4 
>  ffmpeg.c  | 11 ---
>  ffmpeg.h  |  1 +
>  ffmpeg_opt.c  | 12 
>  libavformat/mov.c |  2 ++
>  libavformat/movenc.c  |  4 
>  libavformat/version.h |  3 +++
>  7 files changed, 30 insertions(+), 7 deletions(-)

this breaks rotate handling

for example:
./ffmpeg -i ~/tickets/4012/IMG_4596.MOV  -t 0.5  test.mov
./ffplay test.mov
is upside down

https://s.natalian.org/2014-10-07/IMG_4596.MOV

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_fps: fix duration

2017-03-22 Thread Thomas Mundt
>>Michael Niedermayer  schrieb am Mi, 22.3.2017:
>>>On Tue, Mar 21, 2017 at 11:25:21PM +, Thomas Mundt wrote:
>> Hi,
>> 
>> attached patch will fix ticket #2674.
>> It makes the fps filter duplicate or drop the last frame depending on the 
>> input and output frame rates.
>> Tested with examples from ticket 2674 and other files at various frame rates.
>> 
>> Regards,
>> Thomas
>
>>  vf_fps.c |   23 ++-
>>  1 file changed, 18 insertions(+), 5 deletions(-)
>> 01d220968700e58b1bd772fbf63dee55d29955f6  
>> 0001-avfilter-vf_fps-fix-duration.patch
>> From 6724eb3dae7b491d5bac3903cf4b7dc4ff037e6c Mon Sep 17 00:00:00 2001
>> From: Thomas Mundt 
>> Date: Wed, 22 Mar 2017 00:14:53 +0100
>> Subject: [PATCH] avfilter/vf_fps: fix duration
>> 
>> Fix Ticket #2674
>> This makes the fps filter duplicate or drop the last frame depending on the 
>> input and output frame rates. Tested with examples from ticket 2674 and 
>> other files at various frame rates.
>> 
>> Signed-off-by: Thomas Mundt 
>> ---
>>  libavfilter/vf_fps.c | 23 ++-
>>  1 file changed, 18 insertions(+), 5 deletions(-)
>
> breaks fate
> --- ./tests/ref/fate/m4v-cfr2017-03-20 19:25:54.157895388 +0100
> +++ tests/data/fate/m4v-cfr 2017-03-22 04:06:23.690852041 +0100
> @@ -44,4 +44,3 @@
>  0, 38, 38,1,   115200, 0xf30825d5
>  0, 39, 39,1,   115200, 0xe3c944a1
>  0, 40, 40,1,   115200, 0x8fec4420
> -0, 41, 41,1,   115200, 0x9381fdab
> Test m4v-cfr failed. Look at tests/data/fate/m4v-cfr.err for details.
> make: *** [fate-m4v-cfr] Error 1
> make: *** Waiting for unfinished jobs
> 

New Patch attached...


0001-avfilter-vf_fps-fix-duration.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/h264: Check weight values to be within the specs limits.

2017-03-22 Thread Michael Niedermayer
On Wed, Mar 22, 2017 at 09:06:09AM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On Tue, Mar 21, 2017 at 9:59 PM, Michael Niedermayer  > wrote:
> 
> > @@ -59,6 +59,9 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const
> > SPS *sps,
> >  if (luma_weight_flag) {
> >  pwt->luma_weight[i][list][0] = get_se_golomb(gb);
> >  pwt->luma_weight[i][list][1] = get_se_golomb(gb);
> > +if (   (int8_t)pwt->luma_weight[i][list][0] !=
> > pwt->luma_weight[i][list][0]
> > +|| (int8_t)pwt->luma_weight[i][list][1] !=
> > pwt->luma_weight[i][list][1])
> > +goto error;
> >
> 
> Can we please put || on the line before? h264* and a very limited subset of
> other files in our codebase have always been an exception to the large
> majority of the codebase and it's about time we fix that [1].

i find putting the operators in the first column more readable
but if its preferred in the last, iam happy to change it.


> 
> It's interesting (I mean that in a positive way) how you use casting to
> check for the range. It's a little obscure, but it's OK.

yes, it caused me to pause to but it was the simplest way i saw to do
the check


> 
> +error:
> > +avpriv_request_sample(logctx, "Out of range weight\n");
> > +return AVERROR_INVALIDDATA;
> 
> 
> Same comment as previously in other, but related, threads: unless there is
> real, demonstrable evidence that this happens in real-world files, this is
> fuzz/corruption only and shouldn't be accompanied by an explicit log
> message. Just return AVERROR_INVALIDDATA directly and remove the goto/error
> message.

If there is "real, demonstrable evidence that this happens in real-world
files" then we would likely have a sample and not ask for one with
avpriv_request_sample()

I think its very plausible that a encoder would use a weight that is
outside the range. Printing something does make sense.


off topic, but i saw some spurious errors in h264s output that were
new, maybe i can reduce these.

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

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


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


[FFmpeg-devel] [PATCH 2/2] avcodec/ac3dsp: add special-case handling for the C downmix_fixed function

2017-03-22 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/ac3dsp.c | 61 +
 1 file changed, 61 insertions(+)

diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c
index 74f9e3caae..43438da131 100644
--- a/libavcodec/ac3dsp.c
+++ b/libavcodec/ac3dsp.c
@@ -279,6 +279,49 @@ static void ac3_downmix_c(float **samples, float **matrix,
 }
 }
 
+static void ac3_downmix_5_to_2_symmetric_c_fixed(int32_t **samples, int16_t 
**matrix,
+   int len)
+{
+int i;
+int64_t v0, v1;
+int16_t front_mix= matrix[0][0];
+int16_t center_mix   = matrix[0][1];
+int16_t surround_mix = matrix[0][3];
+
+for (i = 0; i < len; i++) {
+v0 = (int64_t)samples[0][i] * front_mix  +
+ (int64_t)samples[1][i] * center_mix +
+ (int64_t)samples[3][i] * surround_mix;
+
+v1 = (int64_t)samples[1][i] * center_mix +
+ (int64_t)samples[2][i] * front_mix  +
+ (int64_t)samples[4][i] * surround_mix;
+
+samples[0][i] = (v0+2048)>>12;
+samples[1][i] = (v1+2048)>>12;
+}
+}
+
+static void ac3_downmix_5_to_1_symmetric_c_fixed(int32_t **samples, int16_t 
**matrix,
+ int len)
+{
+int i;
+int64_t v0;
+int16_t front_mix= matrix[0][0];
+int16_t center_mix   = matrix[0][1];
+int16_t surround_mix = matrix[0][3];
+
+for (i = 0; i < len; i++) {
+v0 = (int64_t)samples[0][i] * front_mix+
+ (int64_t)samples[1][i] * center_mix   +
+ (int64_t)samples[2][i] * front_mix+
+ (int64_t)samples[3][i] * surround_mix +
+ (int64_t)samples[4][i] * surround_mix;
+
+samples[0][i] = (v0+2048)>>12;
+}
+}
+
 static void ac3_downmix_c_fixed(int32_t **samples, int16_t **matrix,
 int out_ch, int in_ch, int len)
 {
@@ -307,6 +350,24 @@ static void ac3_downmix_c_fixed(int32_t **samples, int16_t 
**matrix,
 void ff_ac3dsp_downmix_fixed(AC3DSPContext *c, int32_t **samples, int16_t 
**matrix,
  int out_ch, int in_ch, int len)
 {
+if (c->in_channels != in_ch || c->out_channels != out_ch) {
+c->in_channels  = in_ch;
+c->out_channels = out_ch;
+c->downmix_fixed = NULL;
+
+if (in_ch == 5 && out_ch == 2 &&
+!(matrix[1][0] | matrix[0][2]  |
+  matrix[1][3] | matrix[0][4]  |
+ (matrix[0][1] ^ matrix[1][1]) |
+ (matrix[0][0] ^ matrix[1][2]))) {
+c->downmix_fixed = ac3_downmix_5_to_2_symmetric_c_fixed;
+} else if (in_ch == 5 && out_ch == 1 &&
+   matrix[0][0] == matrix[0][2] &&
+   matrix[0][3] == matrix[0][4]) {
+c->downmix_fixed = ac3_downmix_5_to_1_symmetric_c_fixed;
+}
+}
+
 if (c->downmix_fixed)
 c->downmix_fixed(samples, matrix, len);
 else
-- 
2.12.0

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


[FFmpeg-devel] [PATCH 1/2] fate: add tests for ac3_fixed 5.1 downmix

2017-03-22 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/ac3.mak | 8 
 1 file changed, 8 insertions(+)

diff --git a/tests/fate/ac3.mak b/tests/fate/ac3.mak
index e6362718ea..76be2e869a 100644
--- a/tests/fate/ac3.mak
+++ b/tests/fate/ac3.mak
@@ -36,6 +36,14 @@ FATE_AC3 += fate-ac3-fixed-4.0-downmix-mono
 fate-ac3-fixed-4.0-downmix-mono: CMD = pcm -c ac3_fixed 
-request_channel_layout 4 -i $(TARGET_SAMPLES)/ac3/millers_crossing_4.0.ac3
 fate-ac3-fixed-4.0-downmix-mono: REF = 
$(SAMPLES)/ac3/millers_crossing_4.0_mono_v2.pcm
 
+FATE_AC3 += fate-ac3-fixed-5.1-downmix-mono
+fate-ac3-fixed-5.1-downmix-mono: CMD = pcm -c ac3_fixed 
-request_channel_layout 4 -i 
$(TARGET_SAMPLES)/ac3/monsters_inc_5.1_448_small.ac3
+fate-ac3-fixed-5.1-downmix-mono: REF = 
$(SAMPLES)/ac3/monsters_inc_5.1_448_small_mono_v2.pcm
+
+FATE_AC3 += fate-ac3-fixed-5.1-downmix-stereo
+fate-ac3-fixed-5.1-downmix-stereo: CMD = pcm -c ac3_fixed 
-request_channel_layout 3 -i 
$(TARGET_SAMPLES)/ac3/monsters_inc_5.1_448_small.ac3
+fate-ac3-fixed-5.1-downmix-stereo: REF = 
$(SAMPLES)/ac3/monsters_inc_5.1_448_small_stereo_v2.pcm
+
 FATE_EAC3 += fate-eac3-1
 fate-eac3-1: CMD = pcm -i 
$(TARGET_SAMPLES)/eac3/csi_miami_5.1_256_spx_small.eac3
 fate-eac3-1: REF = $(SAMPLES)/eac3/csi_miami_5.1_256_spx_small_v2.pcm
-- 
2.12.0

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


Re: [FFmpeg-devel] [PATCH v6] avformat/dashdec: add dash demuxer base version

2017-03-22 Thread Steven Liu
2017-03-22 22:36 GMT+08:00 Rodger Combs :

>
> > On Mar 22, 2017, at 09:31, Steven Liu  wrote:
> >
> > 2017-03-22 22:01 GMT+08:00 Rodger Combs >:
> >
> >>
> >>> On Mar 21, 2017, at 08:16, Steven Liu  wrote:
> >>>
> >>> v2 fixed:
> >>> 1. from autodetect to disabled
> >>> 2. from camelCase code style to ffmpeg code style
> >>> 3. from RepType to AVMediaType
> >>> 4. fix variable typo
> >>> 5. change time value from uint32_t to uint64_t
> >>> 6. removed be used once API
> >>> 7. change 'time(NULL)`, except it is not 2038-safe.' to av_gettime and
> >> av_timegm
> >>> 8. merge complex free operation to free_fragment
> >>> 9. use API from snprintf to av_asprintf
> >>>
> >>> v3 fixed:
> >>> 1. fix typo from --enabled-xml2 to --enable-xml2
> >>>
> >>> v4 fixed:
> >>> 1. from --enable-xml2 to --enable-libxml2
> >>> 2. move system includes to top
> >>> 3. remove nouse includes
> >>> 4. rename enum name
> >>> 5. add a trailing comma for the last entry enum
> >>> 6. fix comment typo
> >>> 7. add const to DASHContext class front
> >>> 8. check sscanf if return arguments and give warning message when error
> >>> 9. check validity before free seg->url and seg
> >>> 10. check if the val is null, before use atoll
> >>>
> >>> v5 fixed:
> >>> 1. fix typo from mainifest to manifest
> >>>
> >>> v6 fixed:
> >>> 1. from realloc to av_realloc
> >>> 2. from free to av_free
> >>>
> >>> Reviewed-by: Clément Bœsch 
> >>> Reviewed-by: Michael Niedermayer 
> >>> Reviewed-by: Carl Eugen Hoyos 
> >>> Reviewed-by: Rodger Combs 
> >>> Reviewed-by: Moritz Barsnick 
> >>> Reviewed-by: Nicolas George 
> >>> Reviewed-by: Ricardo Constantino 
> >>> Signed-off-by: Steven Liu 
> >>> ---
> >>> configure|4 +
> >>> libavformat/Makefile |1 +
> >>> libavformat/allformats.c |2 +-
> >>> libavformat/dashdec.c| 1841 ++
> >> 
> >>> 4 files changed, 1847 insertions(+), 1 deletion(-)
> >>> create mode 100644 libavformat/dashdec.c
> >>>
> >>> diff --git a/configure b/configure
> >>> index 4eb116b..86d16a8 100755
> >>> --- a/configure
> >>> +++ b/configure
> >>> @@ -273,6 +273,7 @@ External library support:
> >>>  --enable-libxcb-shapeenable X11 grabbing shape rendering
> >> [autodetect]
> >>>  --enable-libxvid enable Xvid encoding via xvidcore,
> >>>   native MPEG-4/Xvid encoder exists [no]
> >>> +  --enable-libxml2enable XML parsing using the C library
> >> libxml2 [no]
> >>>  --enable-libzimg enable z.lib, needed for zscale filter [no]
> >>>  --enable-libzmq  enable message passing via libzmq [no]
> >>>  --enable-libzvbi enable teletext support via libzvbi [no]
> >>> @@ -1590,6 +1591,7 @@ EXTERNAL_LIBRARY_LIST="
> >>>libvpx
> >>>libwavpack
> >>>libwebp
> >>> +libxml2
> >>>libzimg
> >>>libzmq
> >>>libzvbi
> >>> @@ -2920,6 +2922,7 @@ avi_muxer_select="riffenc"
> >>> caf_demuxer_select="iso_media riffdec"
> >>> caf_muxer_select="iso_media"
> >>> dash_muxer_select="mp4_muxer"
> >>> +dash_demuxer_deps="libxml2"
> >>> dirac_demuxer_select="dirac_parser"
> >>> dts_demuxer_select="dca_parser"
> >>> dtshd_demuxer_select="dca_parser"
> >>> @@ -5920,6 +5923,7 @@ enabled openssl   && { use_pkg_config
> >> openssl openssl/ssl.h OPENSSL_init
> >>>   check_lib openssl/ssl.h SSL_library_init
> >> -lssl -lcrypto -lws2_32 -lgdi32 ||
> >>>   die "ERROR: openssl not found"; }
> >>> enabled qtkit_indev  && { check_header_objcc QTKit/QTKit.h ||
> >> disable qtkit_indev; }
> >>> +enabled libxml2 && require_pkg_config libxml-2.0
> >> libxml2/libxml/xmlversion.h xmlCheckVersion -lxml2
> >>>
> >>> # libdc1394 check
> >>> if enabled libdc1394; then
> >>> diff --git a/libavformat/Makefile b/libavformat/Makefile
> >>> index f56ef16..d77ffaa 100644
> >>> --- a/libavformat/Makefile
> >>> +++ b/libavformat/Makefile
> >>> @@ -134,6 +134,7 @@ OBJS-$(CONFIG_CRC_MUXER) +=
> crcenc.o
> >>> OBJS-$(CONFIG_DATA_DEMUXER)  += rawdec.o
> >>> OBJS-$(CONFIG_DATA_MUXER)+= rawenc.o
> >>> OBJS-$(CONFIG_DASH_MUXER)+= dashenc.o
> >>> +OBJS-$(CONFIG_DASH_DEMUXER)  += dashdec.o
> >>> OBJS-$(CONFIG_DAUD_DEMUXER)  += dauddec.o
> >>> OBJS-$(CONFIG_DAUD_MUXER)+= daudenc.o
> >>> OBJS-$(CONFIG_DCSTR_DEMUXER) += dcstr.o
> >>> diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> >>> index 09e62c3..d57314b 100644
> >>> --- a/libavformat/allformats.c
> >>> +++ b/libavformat/allformats.c
> >>> @@ -96,7 +96,7 @@ static void register_all(void)
> >>>REGISTER_DEMUXER 

Re: [FFmpeg-devel] [PATCH v6] avformat/dashdec: add dash demuxer base version

2017-03-22 Thread Rodger Combs

> On Mar 22, 2017, at 09:31, Steven Liu  wrote:
> 
> 2017-03-22 22:01 GMT+08:00 Rodger Combs  >:
> 
>> 
>>> On Mar 21, 2017, at 08:16, Steven Liu  wrote:
>>> 
>>> v2 fixed:
>>> 1. from autodetect to disabled
>>> 2. from camelCase code style to ffmpeg code style
>>> 3. from RepType to AVMediaType
>>> 4. fix variable typo
>>> 5. change time value from uint32_t to uint64_t
>>> 6. removed be used once API
>>> 7. change 'time(NULL)`, except it is not 2038-safe.' to av_gettime and
>> av_timegm
>>> 8. merge complex free operation to free_fragment
>>> 9. use API from snprintf to av_asprintf
>>> 
>>> v3 fixed:
>>> 1. fix typo from --enabled-xml2 to --enable-xml2
>>> 
>>> v4 fixed:
>>> 1. from --enable-xml2 to --enable-libxml2
>>> 2. move system includes to top
>>> 3. remove nouse includes
>>> 4. rename enum name
>>> 5. add a trailing comma for the last entry enum
>>> 6. fix comment typo
>>> 7. add const to DASHContext class front
>>> 8. check sscanf if return arguments and give warning message when error
>>> 9. check validity before free seg->url and seg
>>> 10. check if the val is null, before use atoll
>>> 
>>> v5 fixed:
>>> 1. fix typo from mainifest to manifest
>>> 
>>> v6 fixed:
>>> 1. from realloc to av_realloc
>>> 2. from free to av_free
>>> 
>>> Reviewed-by: Clément Bœsch 
>>> Reviewed-by: Michael Niedermayer 
>>> Reviewed-by: Carl Eugen Hoyos 
>>> Reviewed-by: Rodger Combs 
>>> Reviewed-by: Moritz Barsnick 
>>> Reviewed-by: Nicolas George 
>>> Reviewed-by: Ricardo Constantino 
>>> Signed-off-by: Steven Liu 
>>> ---
>>> configure|4 +
>>> libavformat/Makefile |1 +
>>> libavformat/allformats.c |2 +-
>>> libavformat/dashdec.c| 1841 ++
>> 
>>> 4 files changed, 1847 insertions(+), 1 deletion(-)
>>> create mode 100644 libavformat/dashdec.c
>>> 
>>> diff --git a/configure b/configure
>>> index 4eb116b..86d16a8 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -273,6 +273,7 @@ External library support:
>>>  --enable-libxcb-shapeenable X11 grabbing shape rendering
>> [autodetect]
>>>  --enable-libxvid enable Xvid encoding via xvidcore,
>>>   native MPEG-4/Xvid encoder exists [no]
>>> +  --enable-libxml2enable XML parsing using the C library
>> libxml2 [no]
>>>  --enable-libzimg enable z.lib, needed for zscale filter [no]
>>>  --enable-libzmq  enable message passing via libzmq [no]
>>>  --enable-libzvbi enable teletext support via libzvbi [no]
>>> @@ -1590,6 +1591,7 @@ EXTERNAL_LIBRARY_LIST="
>>>libvpx
>>>libwavpack
>>>libwebp
>>> +libxml2
>>>libzimg
>>>libzmq
>>>libzvbi
>>> @@ -2920,6 +2922,7 @@ avi_muxer_select="riffenc"
>>> caf_demuxer_select="iso_media riffdec"
>>> caf_muxer_select="iso_media"
>>> dash_muxer_select="mp4_muxer"
>>> +dash_demuxer_deps="libxml2"
>>> dirac_demuxer_select="dirac_parser"
>>> dts_demuxer_select="dca_parser"
>>> dtshd_demuxer_select="dca_parser"
>>> @@ -5920,6 +5923,7 @@ enabled openssl   && { use_pkg_config
>> openssl openssl/ssl.h OPENSSL_init
>>>   check_lib openssl/ssl.h SSL_library_init
>> -lssl -lcrypto -lws2_32 -lgdi32 ||
>>>   die "ERROR: openssl not found"; }
>>> enabled qtkit_indev  && { check_header_objcc QTKit/QTKit.h ||
>> disable qtkit_indev; }
>>> +enabled libxml2 && require_pkg_config libxml-2.0
>> libxml2/libxml/xmlversion.h xmlCheckVersion -lxml2
>>> 
>>> # libdc1394 check
>>> if enabled libdc1394; then
>>> diff --git a/libavformat/Makefile b/libavformat/Makefile
>>> index f56ef16..d77ffaa 100644
>>> --- a/libavformat/Makefile
>>> +++ b/libavformat/Makefile
>>> @@ -134,6 +134,7 @@ OBJS-$(CONFIG_CRC_MUXER) += crcenc.o
>>> OBJS-$(CONFIG_DATA_DEMUXER)  += rawdec.o
>>> OBJS-$(CONFIG_DATA_MUXER)+= rawenc.o
>>> OBJS-$(CONFIG_DASH_MUXER)+= dashenc.o
>>> +OBJS-$(CONFIG_DASH_DEMUXER)  += dashdec.o
>>> OBJS-$(CONFIG_DAUD_DEMUXER)  += dauddec.o
>>> OBJS-$(CONFIG_DAUD_MUXER)+= daudenc.o
>>> OBJS-$(CONFIG_DCSTR_DEMUXER) += dcstr.o
>>> diff --git a/libavformat/allformats.c b/libavformat/allformats.c
>>> index 09e62c3..d57314b 100644
>>> --- a/libavformat/allformats.c
>>> +++ b/libavformat/allformats.c
>>> @@ -96,7 +96,7 @@ static void register_all(void)
>>>REGISTER_DEMUXER (CINE, cine);
>>>REGISTER_DEMUXER (CONCAT,   concat);
>>>REGISTER_MUXER   (CRC,  crc);
>>> -REGISTER_MUXER   (DASH, dash);
>>> +REGISTER_MUXDEMUX(DASH, dash);
>>>REGISTER_MUXDEMUX(DATA, data);
>>>

Re: [FFmpeg-devel] [PATCH v6] avformat/dashdec: add dash demuxer base version

2017-03-22 Thread Steven Liu
2017-03-22 22:01 GMT+08:00 Rodger Combs :

>
> > On Mar 21, 2017, at 08:16, Steven Liu  wrote:
> >
> > v2 fixed:
> > 1. from autodetect to disabled
> > 2. from camelCase code style to ffmpeg code style
> > 3. from RepType to AVMediaType
> > 4. fix variable typo
> > 5. change time value from uint32_t to uint64_t
> > 6. removed be used once API
> > 7. change 'time(NULL)`, except it is not 2038-safe.' to av_gettime and
> av_timegm
> > 8. merge complex free operation to free_fragment
> > 9. use API from snprintf to av_asprintf
> >
> > v3 fixed:
> > 1. fix typo from --enabled-xml2 to --enable-xml2
> >
> > v4 fixed:
> > 1. from --enable-xml2 to --enable-libxml2
> > 2. move system includes to top
> > 3. remove nouse includes
> > 4. rename enum name
> > 5. add a trailing comma for the last entry enum
> > 6. fix comment typo
> > 7. add const to DASHContext class front
> > 8. check sscanf if return arguments and give warning message when error
> > 9. check validity before free seg->url and seg
> > 10. check if the val is null, before use atoll
> >
> > v5 fixed:
> > 1. fix typo from mainifest to manifest
> >
> > v6 fixed:
> > 1. from realloc to av_realloc
> > 2. from free to av_free
> >
> > Reviewed-by: Clément Bœsch 
> > Reviewed-by: Michael Niedermayer 
> > Reviewed-by: Carl Eugen Hoyos 
> > Reviewed-by: Rodger Combs 
> > Reviewed-by: Moritz Barsnick 
> > Reviewed-by: Nicolas George 
> > Reviewed-by: Ricardo Constantino 
> > Signed-off-by: Steven Liu 
> > ---
> > configure|4 +
> > libavformat/Makefile |1 +
> > libavformat/allformats.c |2 +-
> > libavformat/dashdec.c| 1841 ++
> 
> > 4 files changed, 1847 insertions(+), 1 deletion(-)
> > create mode 100644 libavformat/dashdec.c
> >
> > diff --git a/configure b/configure
> > index 4eb116b..86d16a8 100755
> > --- a/configure
> > +++ b/configure
> > @@ -273,6 +273,7 @@ External library support:
> >   --enable-libxcb-shapeenable X11 grabbing shape rendering
> [autodetect]
> >   --enable-libxvid enable Xvid encoding via xvidcore,
> >native MPEG-4/Xvid encoder exists [no]
> > +  --enable-libxml2enable XML parsing using the C library
> libxml2 [no]
> >   --enable-libzimg enable z.lib, needed for zscale filter [no]
> >   --enable-libzmq  enable message passing via libzmq [no]
> >   --enable-libzvbi enable teletext support via libzvbi [no]
> > @@ -1590,6 +1591,7 @@ EXTERNAL_LIBRARY_LIST="
> > libvpx
> > libwavpack
> > libwebp
> > +libxml2
> > libzimg
> > libzmq
> > libzvbi
> > @@ -2920,6 +2922,7 @@ avi_muxer_select="riffenc"
> > caf_demuxer_select="iso_media riffdec"
> > caf_muxer_select="iso_media"
> > dash_muxer_select="mp4_muxer"
> > +dash_demuxer_deps="libxml2"
> > dirac_demuxer_select="dirac_parser"
> > dts_demuxer_select="dca_parser"
> > dtshd_demuxer_select="dca_parser"
> > @@ -5920,6 +5923,7 @@ enabled openssl   && { use_pkg_config
> openssl openssl/ssl.h OPENSSL_init
> >check_lib openssl/ssl.h SSL_library_init
> -lssl -lcrypto -lws2_32 -lgdi32 ||
> >die "ERROR: openssl not found"; }
> > enabled qtkit_indev  && { check_header_objcc QTKit/QTKit.h ||
> disable qtkit_indev; }
> > +enabled libxml2 && require_pkg_config libxml-2.0
> libxml2/libxml/xmlversion.h xmlCheckVersion -lxml2
> >
> > # libdc1394 check
> > if enabled libdc1394; then
> > diff --git a/libavformat/Makefile b/libavformat/Makefile
> > index f56ef16..d77ffaa 100644
> > --- a/libavformat/Makefile
> > +++ b/libavformat/Makefile
> > @@ -134,6 +134,7 @@ OBJS-$(CONFIG_CRC_MUXER) += crcenc.o
> > OBJS-$(CONFIG_DATA_DEMUXER)  += rawdec.o
> > OBJS-$(CONFIG_DATA_MUXER)+= rawenc.o
> > OBJS-$(CONFIG_DASH_MUXER)+= dashenc.o
> > +OBJS-$(CONFIG_DASH_DEMUXER)  += dashdec.o
> > OBJS-$(CONFIG_DAUD_DEMUXER)  += dauddec.o
> > OBJS-$(CONFIG_DAUD_MUXER)+= daudenc.o
> > OBJS-$(CONFIG_DCSTR_DEMUXER) += dcstr.o
> > diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> > index 09e62c3..d57314b 100644
> > --- a/libavformat/allformats.c
> > +++ b/libavformat/allformats.c
> > @@ -96,7 +96,7 @@ static void register_all(void)
> > REGISTER_DEMUXER (CINE, cine);
> > REGISTER_DEMUXER (CONCAT,   concat);
> > REGISTER_MUXER   (CRC,  crc);
> > -REGISTER_MUXER   (DASH, dash);
> > +REGISTER_MUXDEMUX(DASH, dash);
> > REGISTER_MUXDEMUX(DATA, data);
> > REGISTER_MUXDEMUX(DAUD, daud);
> > REGISTER_DEMUXER (DCSTR,dcstr);
> > diff --git 

Re: [FFmpeg-devel] [PATCH v6] avformat/dashdec: add dash demuxer base version

2017-03-22 Thread Rodger Combs

> On Mar 21, 2017, at 08:16, Steven Liu  wrote:
> 
> v2 fixed:
> 1. from autodetect to disabled
> 2. from camelCase code style to ffmpeg code style
> 3. from RepType to AVMediaType
> 4. fix variable typo
> 5. change time value from uint32_t to uint64_t
> 6. removed be used once API
> 7. change 'time(NULL)`, except it is not 2038-safe.' to av_gettime and 
> av_timegm
> 8. merge complex free operation to free_fragment
> 9. use API from snprintf to av_asprintf
> 
> v3 fixed:
> 1. fix typo from --enabled-xml2 to --enable-xml2
> 
> v4 fixed:
> 1. from --enable-xml2 to --enable-libxml2
> 2. move system includes to top
> 3. remove nouse includes
> 4. rename enum name
> 5. add a trailing comma for the last entry enum
> 6. fix comment typo
> 7. add const to DASHContext class front
> 8. check sscanf if return arguments and give warning message when error
> 9. check validity before free seg->url and seg
> 10. check if the val is null, before use atoll
> 
> v5 fixed:
> 1. fix typo from mainifest to manifest
> 
> v6 fixed:
> 1. from realloc to av_realloc
> 2. from free to av_free
> 
> Reviewed-by: Clément Bœsch 
> Reviewed-by: Michael Niedermayer 
> Reviewed-by: Carl Eugen Hoyos 
> Reviewed-by: Rodger Combs 
> Reviewed-by: Moritz Barsnick 
> Reviewed-by: Nicolas George 
> Reviewed-by: Ricardo Constantino 
> Signed-off-by: Steven Liu 
> ---
> configure|4 +
> libavformat/Makefile |1 +
> libavformat/allformats.c |2 +-
> libavformat/dashdec.c| 1841 ++
> 4 files changed, 1847 insertions(+), 1 deletion(-)
> create mode 100644 libavformat/dashdec.c
> 
> diff --git a/configure b/configure
> index 4eb116b..86d16a8 100755
> --- a/configure
> +++ b/configure
> @@ -273,6 +273,7 @@ External library support:
>   --enable-libxcb-shapeenable X11 grabbing shape rendering [autodetect]
>   --enable-libxvid enable Xvid encoding via xvidcore,
>native MPEG-4/Xvid encoder exists [no]
> +  --enable-libxml2enable XML parsing using the C library libxml2 
> [no]
>   --enable-libzimg enable z.lib, needed for zscale filter [no]
>   --enable-libzmq  enable message passing via libzmq [no]
>   --enable-libzvbi enable teletext support via libzvbi [no]
> @@ -1590,6 +1591,7 @@ EXTERNAL_LIBRARY_LIST="
> libvpx
> libwavpack
> libwebp
> +libxml2
> libzimg
> libzmq
> libzvbi
> @@ -2920,6 +2922,7 @@ avi_muxer_select="riffenc"
> caf_demuxer_select="iso_media riffdec"
> caf_muxer_select="iso_media"
> dash_muxer_select="mp4_muxer"
> +dash_demuxer_deps="libxml2"
> dirac_demuxer_select="dirac_parser"
> dts_demuxer_select="dca_parser"
> dtshd_demuxer_select="dca_parser"
> @@ -5920,6 +5923,7 @@ enabled openssl   && { use_pkg_config openssl 
> openssl/ssl.h OPENSSL_init
>check_lib openssl/ssl.h SSL_library_init -lssl 
> -lcrypto -lws2_32 -lgdi32 ||
>die "ERROR: openssl not found"; }
> enabled qtkit_indev  && { check_header_objcc QTKit/QTKit.h || disable 
> qtkit_indev; }
> +enabled libxml2 && require_pkg_config libxml-2.0 
> libxml2/libxml/xmlversion.h xmlCheckVersion -lxml2
> 
> # libdc1394 check
> if enabled libdc1394; then
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index f56ef16..d77ffaa 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -134,6 +134,7 @@ OBJS-$(CONFIG_CRC_MUXER) += crcenc.o
> OBJS-$(CONFIG_DATA_DEMUXER)  += rawdec.o
> OBJS-$(CONFIG_DATA_MUXER)+= rawenc.o
> OBJS-$(CONFIG_DASH_MUXER)+= dashenc.o
> +OBJS-$(CONFIG_DASH_DEMUXER)  += dashdec.o
> OBJS-$(CONFIG_DAUD_DEMUXER)  += dauddec.o
> OBJS-$(CONFIG_DAUD_MUXER)+= daudenc.o
> OBJS-$(CONFIG_DCSTR_DEMUXER) += dcstr.o
> diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> index 09e62c3..d57314b 100644
> --- a/libavformat/allformats.c
> +++ b/libavformat/allformats.c
> @@ -96,7 +96,7 @@ static void register_all(void)
> REGISTER_DEMUXER (CINE, cine);
> REGISTER_DEMUXER (CONCAT,   concat);
> REGISTER_MUXER   (CRC,  crc);
> -REGISTER_MUXER   (DASH, dash);
> +REGISTER_MUXDEMUX(DASH, dash);
> REGISTER_MUXDEMUX(DATA, data);
> REGISTER_MUXDEMUX(DAUD, daud);
> REGISTER_DEMUXER (DCSTR,dcstr);
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> new file mode 100644
> index 000..e0be85e
> --- /dev/null
> +++ b/libavformat/dashdec.c
> @@ -0,0 +1,1841 @@
> +/*
> + * Dynamic Adaptive Streaming over HTTP demux
> + * Copyright (c) 2017 samsam...@o2.pl based on HLS demux
> + * 

Re: [FFmpeg-devel] [PATCH 4/4] vaapi_vp9: Mark as async-safe

2017-03-22 Thread Ronald S. Bultje
Hi,

On Tue, Mar 21, 2017 at 6:43 PM, Mark Thompson  wrote:

> ---
> This was missed in e0cd598bc4684654d63942e9ff4872c0b48a7dc2 because it
> isn't in libav.
>
>
>  libavcodec/vaapi_vp9.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libavcodec/vaapi_vp9.c b/libavcodec/vaapi_vp9.c
> index a656ffb13c..7374465d49 100644
> --- a/libavcodec/vaapi_vp9.c
> +++ b/libavcodec/vaapi_vp9.c
> @@ -21,6 +21,8 @@
>   */
>
>  #include "libavutil/pixdesc.h"
> +
> +#include "hwaccel.h"
>  #include "vaapi_decode.h"
>  #include "vp9.h"
>
> @@ -178,4 +180,5 @@ AVHWAccel ff_vp9_vaapi_hwaccel = {
>  .init = ff_vaapi_decode_init,
>  .uninit   = ff_vaapi_decode_uninit,
>  .priv_data_size   = sizeof(VAAPIDecodeContext),
> +.caps_internal= HWACCEL_CAP_ASYNC_SAFE,
>  };
> --
> 2.11.0


LGTM.

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


Re: [FFmpeg-devel] [PATCH 3/4] vaapi_hevc: Mark as async-safe

2017-03-22 Thread Ronald S. Bultje
Hi,

On Tue, Mar 21, 2017 at 6:43 PM, Mark Thompson  wrote:

> ---
> This was missed in e0cd598bc4684654d63942e9ff4872c0b48a7dc2 because it
> wasn't in libav at the time.
>
>
>  libavcodec/vaapi_hevc.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
> index 2b0e8ff326..34d32795b7 100644
> --- a/libavcodec/vaapi_hevc.c
> +++ b/libavcodec/vaapi_hevc.c
> @@ -25,6 +25,7 @@
>
>  #include "avcodec.h"
>  #include "hevc.h"
> +#include "hwaccel.h"
>  #include "vaapi_decode.h"
>
>  typedef struct VAAPIDecodePictureHEVC {
> @@ -434,4 +435,5 @@ AVHWAccel ff_hevc_vaapi_hwaccel = {
>  .init = ff_vaapi_decode_init,
>  .uninit   = ff_vaapi_decode_uninit,
>  .priv_data_size   = sizeof(VAAPIDecodeContext),
> +.caps_internal= HWACCEL_CAP_ASYNC_SAFE,
>  };
> --
> 2.11.0


LGTM.

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


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/h264: Check weight values to be within the specs limits.

2017-03-22 Thread Ronald S. Bultje
Hi,

On Tue, Mar 21, 2017 at 9:59 PM, Michael Niedermayer  wrote:

> @@ -59,6 +59,9 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const
> SPS *sps,
>  if (luma_weight_flag) {
>  pwt->luma_weight[i][list][0] = get_se_golomb(gb);
>  pwt->luma_weight[i][list][1] = get_se_golomb(gb);
> +if (   (int8_t)pwt->luma_weight[i][list][0] !=
> pwt->luma_weight[i][list][0]
> +|| (int8_t)pwt->luma_weight[i][list][1] !=
> pwt->luma_weight[i][list][1])
> +goto error;
>

Can we please put || on the line before? h264* and a very limited subset of
other files in our codebase have always been an exception to the large
majority of the codebase and it's about time we fix that [1].

It's interesting (I mean that in a positive way) how you use casting to
check for the range. It's a little obscure, but it's OK.

+error:
> +avpriv_request_sample(logctx, "Out of range weight\n");
> +return AVERROR_INVALIDDATA;


Same comment as previously in other, but related, threads: unless there is
real, demonstrable evidence that this happens in real-world files, this is
fuzz/corruption only and shouldn't be accompanied by an explicit log
message. Just return AVERROR_INVALIDDATA directly and remove the goto/error
message.

(Secondary comment here, which is negated by the first, but just in case
other people want to argue over this some more: using a generic label
"error" and accompanying it by a specific error that can only possibly
apply to a small subset of potential errors returned from this function is
a Bad Design. Either the label should be specific (weight_range_error:), or
the log message should be generic ("Error parsing pred weight table").
However, you can obviously ignore this since I don't believe the string
should be there at all, so in that case this comment doesn't apply.)

Ronald

[1] a grep for multi-line if statements placing ||/&& on top line in
libavcodec/:
yop, xxan, xwdenc, xan, wmv2, wmavoice, wmaprodec, wmalosslessdec, wma,
wavpackenc, wavpack, vp9, vp8, vp6, vp56, vp5, vp3dsp, vp3, vorbisdec,
vmdvideo, videotoolboxenc [ I stopped here]
a grep for multi-line if statements placing ||/&& on bottom line in
libavcodec/ in that same alphabetic range:
only one single line (inconsistency) in vp6
Therefore, || on previous line is more prevalent than on next line.

On Tue, Mar 21, 2017 at 9:59 PM, Michael Niedermayer  wrote:

> Fixes: integer overflows
> Fixes: 911/clusterfuzz-testcase-5415105606975488
>
> Found-by: continuous fuzzing process https://github.com/google/oss-
> fuzz/tree/master/targets/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/h264_parse.c | 9 +
>  libavcodec/h264_slice.c | 7 +--
>  2 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c
> index 0c873196dc..2b7aad087a 100644
> --- a/libavcodec/h264_parse.c
> +++ b/libavcodec/h264_parse.c
> @@ -59,6 +59,9 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const
> SPS *sps,
>  if (luma_weight_flag) {
>  pwt->luma_weight[i][list][0] = get_se_golomb(gb);
>  pwt->luma_weight[i][list][1] = get_se_golomb(gb);
> +if (   (int8_t)pwt->luma_weight[i][list][0] !=
> pwt->luma_weight[i][list][0]
> +|| (int8_t)pwt->luma_weight[i][list][1] !=
> pwt->luma_weight[i][list][1])
> +goto error;
>  if (pwt->luma_weight[i][list][0] != luma_def ||
>  pwt->luma_weight[i][list][1] != 0) {
>  pwt->use_weight = 1;
> @@ -76,6 +79,9 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const
> SPS *sps,
>  for (j = 0; j < 2; j++) {
>  pwt->chroma_weight[i][list][j][0] =
> get_se_golomb(gb);
>  pwt->chroma_weight[i][list][j][1] =
> get_se_golomb(gb);
> +if (   (int8_t)pwt->chroma_weight[i][list][j][0]
> != pwt->chroma_weight[i][list][j][0]
> +|| (int8_t)pwt->chroma_weight[i][list][j][1]
> != pwt->chroma_weight[i][list][j][1])
> +goto error;
>  if (pwt->chroma_weight[i][list][j][0] !=
> chroma_def ||
>  pwt->chroma_weight[i][list][j][1] != 0) {
>  pwt->use_weight_chroma= 1;
> @@ -104,6 +110,9 @@ int ff_h264_pred_weight_table(GetBitContext *gb,
> const SPS *sps,
>  }
>  pwt->use_weight = pwt->use_weight || pwt->use_weight_chroma;
>  return 0;
> +error:
> +avpriv_request_sample(logctx, "Out of range weight\n");
> +return AVERROR_INVALIDDATA;
>  }
>
>  /**
> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
> index a703853872..c86ad1c3a6 100644
> --- a/libavcodec/h264_slice.c
> +++ 

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/h264_ps: Fix runtime error: signed integer overflow: 2147483647 + 26 cannot be represented in type 'int'

2017-03-22 Thread Ronald S. Bultje
Hi,

On Tue, Mar 21, 2017 at 9:59 PM, Michael Niedermayer  wrote:

> Fixes: 902/clusterfuzz-testcase-4561155144024064
>
> Found-by: continuous fuzzing process https://github.com/google/oss-
> fuzz/tree/master/targets/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/h264_ps.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
> index 65d164d81c..b78ad251f5 100644
> --- a/libavcodec/h264_ps.c
> +++ b/libavcodec/h264_ps.c
> @@ -800,8 +800,8 @@ int ff_h264_decode_picture_parameter_set(GetBitContext
> *gb, AVCodecContext *avct
>
>  pps->weighted_pred= get_bits1(gb);
>  pps->weighted_bipred_idc  = get_bits(gb, 2);
> -pps->init_qp  = get_se_golomb(gb) + 26 +
> qp_bd_offset;
> -pps->init_qs  = get_se_golomb(gb) + 26 +
> qp_bd_offset;
> +pps->init_qp  = get_se_golomb(gb) + 26U +
> qp_bd_offset;
> +pps->init_qs  = get_se_golomb(gb) + 26U +
> qp_bd_offset;
>  pps->chroma_qp_index_offset[0]= get_se_golomb(gb);
>  if (pps->chroma_qp_index_offset[0] < -12 ||
> pps->chroma_qp_index_offset[0] > 12) {
>  ret = AVERROR_INVALIDDATA;
> --
> 2.11.0


OK.

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


Re: [FFmpeg-devel] [PATCH 2/2] avformat/apng: set max_fps to no limit by default

2017-03-22 Thread Benoit Fouet
Hi,


On 21/03/2017 14:03, James Almer wrote:
> On 3/21/2017 9:52 AM, Michael Niedermayer wrote:
>> On Mon, Mar 20, 2017 at 11:03:23PM -0300, James Almer wrote:
>>> Should fix ticket #6252
>>>
>>> Signed-off-by: James Almer 
>>> ---
>>>  libavformat/apngdec.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/libavformat/apngdec.c b/libavformat/apngdec.c
>>> index 7a284e32c2..75dcf74a0c 100644
>>> --- a/libavformat/apngdec.c
>>> +++ b/libavformat/apngdec.c
>>> @@ -421,7 +421,7 @@ static const AVOption options[] = {
>>>  { "ignore_loop", "ignore loop setting" , 
>>> offsetof(APNGDemuxContext, ignore_loop),
>>>AV_OPT_TYPE_BOOL, { .i64 = 1 }  , 0, 1  , 
>>> AV_OPT_FLAG_DECODING_PARAM },
>>>  { "max_fps", "maximum framerate (0 is no limit)"   , 
>>> offsetof(APNGDemuxContext, max_fps),
>>> -  AV_OPT_TYPE_INT, { .i64 = DEFAULT_APNG_FPS }, 0, INT_MAX, 
>>> AV_OPT_FLAG_DECODING_PARAM },
>>> +  AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, 
>>> AV_OPT_FLAG_DECODING_PARAM },
>>>  { "default_fps", "default framerate (0 is as fast as possible)", 
>>> offsetof(APNGDemuxContext, default_fps),
>>>AV_OPT_TYPE_INT, { .i64 = DEFAULT_APNG_FPS }, 0, INT_MAX, 
>>> AV_OPT_FLAG_DECODING_PARAM },
>>>  { NULL },
>> why was there a max fps set ?
>> are there files which have huge and incorrect fps ?
> I have no idea. The author of the decoder may know.
>

A bit late, but honestly, I don't remember why I did it that way, though
both patches look fine as they are.
It's easy enough to come back to that code when/if needed.

Thanks,
-- 
Ben

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


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/hevc: add the dimension constraints when attempting to use DXVA

2017-03-22 Thread Hendrik Leppkes
On Wed, Mar 22, 2017 at 10:41 AM, Steve Lhomme  wrote:
> ---
>  libavcodec/hevc.c | 12 
>  1 file changed, 12 insertions(+)
>

Just to mention it on this ML as well so it doesn't get applied due to
lack of comments - we're still discussing better alternatives for a
generic API to export hardware surface requirements, instead of
littering the actual decoder with this.

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


Re: [FFmpeg-devel] [PATCH v3] avformat/rtmpproto: change rtmp_open from url_open to url_open2

2017-03-22 Thread Steven Liu
2017-03-17 11:53 GMT+08:00 Steven Liu :

> use the option set by user
>
> Reported-by: Lancelot Lai 
> Signed-off-by: Steven Liu 
> ---
>  libavformat/rtmpproto.c | 13 ++---
>  1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
> index 5d7ad79..7b2bd81 100644
> --- a/libavformat/rtmpproto.c
> +++ b/libavformat/rtmpproto.c
> @@ -2604,14 +2604,13 @@ static int inject_fake_duration_metadata(RTMPContext
> *rt)
>   * and 'playpath' is a file name (the rest of the path,
>   * may be prefixed with "mp4:")
>   */
> -static int rtmp_open(URLContext *s, const char *uri, int flags)
> +static int rtmp_open(URLContext *s, const char *uri, int flags,
> AVDictionary **opts)
>  {
>  RTMPContext *rt = s->priv_data;
>  char proto[8], hostname[256], path[1024], auth[100], *fname;
>  char *old_app, *qmark, *n, fname_buffer[1024];
>  uint8_t buf[2048];
>  int port;
> -AVDictionary *opts = NULL;
>  int ret;
>
>  if (rt->listen_timeout > 0)
> @@ -2648,7 +2647,7 @@ static int rtmp_open(URLContext *s, const char *uri,
> int flags)
>  }
>  if (!strcmp(proto, "rtmpt") || !strcmp(proto, "rtmpts")) {
>  if (!strcmp(proto, "rtmpts"))
> -av_dict_set(, "ffrtmphttp_tls", "1", 1);
> +av_dict_set(opts, "ffrtmphttp_tls", "1", 1);
>
>  /* open the http tunneling connection */
>  ff_url_join(buf, sizeof(buf), "ffrtmphttp", NULL, hostname, port,
> NULL);
> @@ -2659,7 +2658,7 @@ static int rtmp_open(URLContext *s, const char *uri,
> int flags)
>  ff_url_join(buf, sizeof(buf), "tls", NULL, hostname, port, NULL);
>  } else if (!strcmp(proto, "rtmpe") || (!strcmp(proto, "rtmpte"))) {
>  if (!strcmp(proto, "rtmpte"))
> -av_dict_set(, "ffrtmpcrypt_tunneling", "1", 1);
> +av_dict_set(opts, "ffrtmpcrypt_tunneling", "1", 1);
>
>  /* open the encrypted connection */
>  ff_url_join(buf, sizeof(buf), "ffrtmpcrypt", NULL, hostname,
> port, NULL);
> @@ -2678,7 +2677,7 @@ static int rtmp_open(URLContext *s, const char *uri,
> int flags)
>
>  reconnect:
>  if ((ret = ffurl_open_whitelist(>stream, buf,
> AVIO_FLAG_READ_WRITE,
> ->interrupt_callback, ,
> +>interrupt_callback, opts,
>  s->protocol_whitelist,
> s->protocol_blacklist, s)) < 0) {
>  av_log(s , AV_LOG_ERROR, "Cannot open connection %s\n", buf);
>  goto fail;
> @@ -2896,7 +2895,7 @@ reconnect:
>  return 0;
>
>  fail:
> -av_dict_free();
> +av_dict_free(opts);
>  rtmp_close(s);
>  return ret;
>  }
> @@ -3141,7 +3140,7 @@ static const AVClass flavor##_class = {  \
>   \
>  const URLProtocol ff_##flavor##_protocol = { \
>  .name   = #flavor,   \
> -.url_open   = rtmp_open, \
> +.url_open2  = rtmp_open, \
>  .url_read   = rtmp_read, \
>  .url_read_seek  = rtmp_seek, \
>  .url_read_pause = rtmp_pause,\
> --
> 2.10.1 (Apple Git-78)
>
>
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


Applied


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


[FFmpeg-devel] [PATCH 2/2] avcodec/hevc: add the dimension constraints when attempting to use DXVA

2017-03-22 Thread Steve Lhomme
---
 libavcodec/hevc.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 505249e6b5..35e9a273fa 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -328,6 +328,14 @@ static void export_stream_params(AVCodecContext *avctx, 
const HEVCParamSets *ps,
   num, den, 1 << 30);
 }
 
+#if CONFIG_HEVC_DXVA2_HWACCEL || CONFIG_HEVC_D3D11VA_HWACCEL
+static void add_dxva_constraints(AVCodecContext *avctx)
+{
+avctx->coded_width  = FFALIGN(avctx->coded_width,  128);
+avctx->coded_height = FFALIGN(avctx->coded_height, 128);
+}
+#endif
+
 static int set_sps(HEVCContext *s, const HEVCSPS *sps, enum AVPixelFormat 
pix_fmt)
 {
 #define HWACCEL_MAX (CONFIG_HEVC_DXVA2_HWACCEL + 
CONFIG_HEVC_D3D11VA_HWACCEL + CONFIG_HEVC_VAAPI_HWACCEL + 
CONFIG_HEVC_VDPAU_HWACCEL)
@@ -352,9 +360,11 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps, 
enum AVPixelFormat pix_fm
 case AV_PIX_FMT_YUVJ420P:
 #if CONFIG_HEVC_DXVA2_HWACCEL
 *fmt++ = AV_PIX_FMT_DXVA2_VLD;
+add_dxva_constraints(s->avctx);
 #endif
 #if CONFIG_HEVC_D3D11VA_HWACCEL
 *fmt++ = AV_PIX_FMT_D3D11VA_VLD;
+add_dxva_constraints(s->avctx);
 #endif
 #if CONFIG_HEVC_VAAPI_HWACCEL
 *fmt++ = AV_PIX_FMT_VAAPI;
@@ -366,9 +376,11 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps, 
enum AVPixelFormat pix_fm
 case AV_PIX_FMT_YUV420P10:
 #if CONFIG_HEVC_DXVA2_HWACCEL
 *fmt++ = AV_PIX_FMT_DXVA2_VLD;
+add_dxva_constraints(s->avctx);
 #endif
 #if CONFIG_HEVC_D3D11VA_HWACCEL
 *fmt++ = AV_PIX_FMT_D3D11VA_VLD;
+add_dxva_constraints(s->avctx);
 #endif
 #if CONFIG_HEVC_VAAPI_HWACCEL
 *fmt++ = AV_PIX_FMT_VAAPI;
-- 
2.11.1

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


[FFmpeg-devel] [PATCH 1/2] avcodec/mpeg12dec: set the coded dimensions with proper alignement

2017-03-22 Thread Steve Lhomme
---
 libavcodec/mpeg12dec.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index e49167f89e..55fcac0cb2 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1291,12 +1291,11 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
 }
 
 if ((s1->mpeg_enc_ctx_allocated == 0)   ||
-avctx->coded_width   != s->width||
-avctx->coded_height  != s->height   ||
+avctx->coded_width   != FFALIGN(s->width, 16)   ||
+avctx->coded_height  != FFALIGN(s->height, s->progressive_sequence 
? 16 : 32)  ||
 s1->save_width   != s->width||
 s1->save_height  != s->height   ||
 av_cmp_q(s1->save_aspect, s->avctx->sample_aspect_ratio) ||
-(s1->save_progressive_seq != s->progressive_sequence && 
FFALIGN(s->height, 16) != FFALIGN(s->height, 32)) ||
 0) {
 if (s1->mpeg_enc_ctx_allocated) {
 ParseContext pc = s->parse_context;
@@ -1310,6 +1309,9 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
 if (ret < 0)
 return ret;
 
+avctx->coded_width  = FFALIGN(avctx->coded_width, 16);
+avctx->coded_height = FFALIGN(avctx->coded_height, 
s->progressive_sequence ? 16: 32);
+
 if (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO && s->bit_rate) {
 avctx->rc_max_rate = s->bit_rate;
 } else if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO && s->bit_rate &&
-- 
2.11.1

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


[FFmpeg-devel] [PATCH 2/2] lavc: vdpau: add support for new hw_frames_ctx and hw_device_ctx API

2017-03-22 Thread wm4
This supports retrieving the device from a provided hw_frames_ctx, and
automatically creating a hw_frames_ctx if hw_device_ctx is set.

The old API is not deprecated yet. The user can still use
av_vdpau_bind_context() (with or without setting hw_frames_ctx), or use
the API before that by allocating and setting hwaccel_context manually.

(Adds missing APIchanges entry to the Libav version.)
---
Libav merge.
---
 doc/APIchanges  |  5 +++
 libavcodec/vdpau.c  | 95 +
 libavcodec/vdpau_internal.h |  2 +
 libavcodec/version.h|  2 +-
 4 files changed, 78 insertions(+), 26 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index bd0ad30a04..95b04b0933 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,11 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2017-03-xx - xxx - lavc 57.84.101 - avcodec.h
+  vdpau hardware accelerated decoding now supports the new hwaccel API, which
+  can create the decoder context and allocate hardware frame automatically.
+  See AVCodecContext.hw_device_ctx and AVCodecContext.hw_frames_ctx.
+
 2017-03-xx - xxx - lavc 57.84.100 - avcodec.h
   Add AVCodecContext.hwaccel_flags field. This will control some hwaccels at
   a later point.
diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c
index bbb9913f8b..a232603c60 100644
--- a/libavcodec/vdpau.c
+++ b/libavcodec/vdpau.c
@@ -138,34 +138,75 @@ int ff_vdpau_common_init(AVCodecContext *avctx, 
VdpDecoderProfile profile,
 vdctx->width= UINT32_MAX;
 vdctx->height   = UINT32_MAX;
 
-if (!hwctx) {
-vdctx->device  = VDP_INVALID_HANDLE;
-av_log(avctx, AV_LOG_WARNING, "hwaccel_context has not been setup by 
the user application, cannot initialize\n");
-return 0;
-}
+if (av_vdpau_get_surface_parameters(avctx, , , ))
+return AVERROR(ENOSYS);
 
-if (hwctx->context.decoder != VDP_INVALID_HANDLE) {
-vdctx->decoder = hwctx->context.decoder;
-vdctx->render  = hwctx->context.render;
-vdctx->device  = VDP_INVALID_HANDLE;
-return 0; /* Decoder created by user */
-}
-hwctx->reset= 0;
+if (hwctx) {
+hwctx->reset= 0;
 
-vdctx->device   = hwctx->device;
-vdctx->get_proc_address = hwctx->get_proc_address;
+if (hwctx->context.decoder != VDP_INVALID_HANDLE) {
+vdctx->decoder = hwctx->context.decoder;
+vdctx->render  = hwctx->context.render;
+vdctx->device  = VDP_INVALID_HANDLE;
+return 0; /* Decoder created by user */
+}
 
-if (hwctx->flags & AV_HWACCEL_FLAG_IGNORE_LEVEL)
-level = 0;
-else if (level < 0)
-return AVERROR(ENOTSUP);
+vdctx->device   = hwctx->device;
+vdctx->get_proc_address = hwctx->get_proc_address;
+
+if (hwctx->flags & AV_HWACCEL_FLAG_IGNORE_LEVEL)
+level = 0;
+
+if (!(hwctx->flags & AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH) &&
+type != VDP_CHROMA_TYPE_420)
+return AVERROR(ENOSYS);
+} else {
+AVHWFramesContext *frames_ctx = NULL;
+AVVDPAUDeviceContext *dev_ctx;
+
+// We assume the hw_frames_ctx always survives until 
ff_vdpau_common_uninit
+// is called. This holds true as the user is not allowed to touch
+// hw_device_ctx, or hw_frames_ctx after get_format (and ff_get_format
+// itself also uninits before unreffing hw_frames_ctx).
+if (avctx->hw_frames_ctx) {
+frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
+} else if (avctx->hw_device_ctx) {
+int ret;
+
+avctx->hw_frames_ctx = av_hwframe_ctx_alloc(avctx->hw_device_ctx);
+if (!avctx->hw_frames_ctx)
+return AVERROR(ENOMEM);
+
+frames_ctx= 
(AVHWFramesContext*)avctx->hw_frames_ctx->data;
+frames_ctx->format= AV_PIX_FMT_VDPAU;
+frames_ctx->sw_format = avctx->sw_pix_fmt;
+frames_ctx->width = avctx->coded_width;
+frames_ctx->height= avctx->coded_height;
+
+ret = av_hwframe_ctx_init(avctx->hw_frames_ctx);
+if (ret < 0) {
+av_buffer_unref(>hw_frames_ctx);
+return ret;
+}
+}
 
-if (av_vdpau_get_surface_parameters(avctx, , , ))
-return AVERROR(ENOSYS);
+if (!frames_ctx) {
+av_log(avctx, AV_LOG_ERROR, "A hardware frames context is "
+   "required for VDPAU decoding.\n");
+return AVERROR(EINVAL);
+}
 
-if (!(hwctx->flags & AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH) &&
-type != VDP_CHROMA_TYPE_420)
-return AVERROR(ENOSYS);
+dev_ctx = frames_ctx->device_ctx->hwctx;
+
+vdctx->device   = dev_ctx->device;
+vdctx->get_proc_address = dev_ctx->get_proc_address;
+
+

[FFmpeg-devel] [PATCH 1/2] lavc: Add hwaccel_flags field to AVCodecContext

2017-03-22 Thread wm4
This "reuses" the flags introduced for the av_vdpau_bind_context() API
function, and makes them available to all hwaccels. This does not affect
the current vdpau API, as av_vdpau_bind_context() should obviously
override the AVCodecContext.hwaccel_flags flags for the sake of
compatibility.
---
Libav merge.
---
 doc/APIchanges | 8 
 libavcodec/avcodec.h   | 9 +
 libavcodec/pthread_frame.c | 2 ++
 libavcodec/version.h   | 4 ++--
 4 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index eccfb70899..bd0ad30a04 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2017-03-xx - xxx - lavc 57.84.100 - avcodec.h
+  Add AVCodecContext.hwaccel_flags field. This will control some hwaccels at
+  a later point.
+
 2017-03-21 - xxx - lavf 57.67.100 / 57.08.0 - avio.h
   Add AVIO_SEEKABLE_TIME flag.
 
@@ -27,6 +31,10 @@ API changes, most recent first:
   Add av_image_copy_uc_from(), a version of av_image_copy() for copying
   from GPU mapped memory.
 
+2017-03-xx - xxx - lavu 55.35.0 - hwcontext.h
+  Add AV_HWDEVICE_TYPE_NONE, av_hwdevice_find_type_by_name(),
+  av_hwdevice_get_type_name() and av_hwdevice_iterate_types().
+
 2017-03-20 - 9c2436e - lavu 55.49.100 - pixdesc.h
   Add AV_PIX_FMT_FLAG_BAYER pixel format flag.
 
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 3e3c37278a..b3479a7223 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3620,6 +3620,15 @@ typedef struct AVCodecContext {
  * contexts used must be created on the same device.
  */
 AVBufferRef *hw_device_ctx;
+
+/**
+ * Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated
+ * decoding (if active).
+ * - encoding: unused
+ * - decoding: Set by user (either before avcodec_open2(), or in the
+ * AVCodecContext.get_format callback)
+ */
+int hwaccel_flags;
 } AVCodecContext;
 
 AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx);
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index a52160145e..6768402ed8 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -275,6 +275,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
 return AVERROR(ENOMEM);
 }
 }
+
+dst->hwaccel_flags = src->hwaccel_flags;
 }
 
 if (for_user) {
diff --git a/libavcodec/version.h b/libavcodec/version.h
index ec8651f086..97cccef000 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,8 +28,8 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  57
-#define LIBAVCODEC_VERSION_MINOR  83
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MINOR  84
+#define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
-- 
2.11.0

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