Re: [FFmpeg-devel] [PATCH v3 1/6] lavc: add new API for iterating codecs and codec parsers

2018-02-01 Thread Josh de Kock

> On 1 Feb 2018, at 03:03, Michael Niedermayer  wrote:
> 
>> On Wed, Jan 31, 2018 at 08:25:50PM +, Josh de Kock wrote:
>> Also replace linked list with an array.
>> ---
>> configure  |   12 +-
>> doc/APIchanges |4 +
>> libavcodec/.gitignore  |2 +
>> libavcodec/allcodecs.c | 1473 
>> 
>> libavcodec/avcodec.h   |   31 +
>> libavcodec/parser.c|   84 ++-
>> libavcodec/utils.c |  112 
>> libavcodec/version.h   |3 +
>> 8 files changed, 971 insertions(+), 750 deletions(-)
> 
> breaks build
> simple example:
> cd buildhere && ../configure && make -j12
> LDffmpeg_g
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0xd8): undefined reference to 
> `ff_hap_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4b8): undefined reference to 
> `ff_libfdk_aac_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4c0): undefined reference to 
> `ff_libgsm_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4c8): undefined reference to 
> `ff_libgsm_ms_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4d0): undefined reference to 
> `ff_libilbc_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4d8): undefined reference to 
> `ff_libmp3lame_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4e0): undefined reference to 
> `ff_libopencore_amrnb_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4e8): undefined reference to 
> `ff_libopenjpeg_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4f0): undefined reference to 
> `ff_libopus_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4f8): undefined reference to 
> `ff_libspeex_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x500): undefined reference to 
> `ff_libtheora_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x508): undefined reference to 
> `ff_libtwolame_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x510): undefined reference to 
> `ff_libvo_amrwbenc_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x518): undefined reference to 
> `ff_libvorbis_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x520): undefined reference to 
> `ff_libvpx_vp8_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x528): undefined reference to 
> `ff_libvpx_vp9_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x530): undefined reference to 
> `ff_libwebp_anim_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x538): undefined reference to 
> `ff_libwebp_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x540): undefined reference to 
> `ff_libx264_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x548): undefined reference to 
> `ff_libx264rgb_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x550): undefined reference to 
> `ff_libx265_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x558): undefined reference to 
> `ff_libxavs_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x560): undefined reference to 
> `ff_libxvid_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x568): undefined reference to 
> `ff_libopenh264_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x12e8): undefined reference to 
> `ff_libfdk_aac_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x12f0): undefined reference to 
> `ff_libgsm_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x12f8): undefined reference to 
> `ff_libgsm_ms_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1300): undefined reference to 
> `ff_libilbc_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1308): undefined reference to 
> `ff_libopencore_amrnb_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1310): undefined reference to 
> `ff_libopencore_amrwb_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1318): undefined reference to 
> `ff_libopenjpeg_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1320): undefined reference to 
> `ff_libopus_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1328): undefined reference to 
> `ff_libspeex_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1330): undefined reference to 
> `ff_libvorbis_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1338): undefined reference to 
> `ff_libvpx_vp8_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1340): undefined reference to 
> `ff_libvpx_vp9_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1348): undefined reference to 
> `ff_libzvbi_teletext_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1368): undefined reference to 
> `ff_libopenh264_decoder'
> 
> [...]
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I can’t reproduce this at all, I’m going to need more info.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] hls BANDWIDTH field in master playlist

2018-02-01 Thread Amit Kale
Hi All,

When emitting a master playlist, BANDWIDTH field is computed in
libavformat/hlsenc.c by adding video and audio stream bitrates and then
adding 10% to account for container overhead. However HLS specification
(RFC8216) says that BANDWIDTH represents the peak segment bit rate.
AVERAGE-BANDWIDTH on the other hand represents the average segment bit
rate. If this is correct, I would like to send a patch to fix it.

Thanks.
-Amit

-- 
This message and its attachments are confidential (or legally privileged) 
information and are meant solely for the addressee of such message. Any 
unauthorized use of the message / its attachments is strictly prohibited.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavfilter: constify filter list

2018-02-01 Thread Nicolas George
Hi.

Muhammad Faiz (2018-01-30):
> Move REGISTER_FILTER to FILTER_TABLE in configure.
> Auto generate filter extern and filter table.
> Sort filter table, use bsearch on avfilter_get_by_name.
> Define next pointer at filter extern, no need to initialize
> next pointer at run time, so AVFilter can be set to const.
> Make avfilter_register always return error.
> Target checkasm now depends on EXTRALIBS-avformat.

Regarding registering user filters, do not bother about that. That ship
has sailed a long time ago; it is already more than half-way across and
decelerating. If somebody wants to implement plugins, they will have a
lot of work. Designing a way of registering user filters so that they
can be parsed by name would be a spoonful in the pool.

Regarding the actual implementation:

I do not like that you moved the list into configure. Not per se, but
because it is completely different from what Josh de Kock is doing with
codecs, parsers and formats. Please coordinate with Josh to have a
consistent solution for all components.

I think the fact that you need to insert a line in each filter is rather
a sign that the design is far from perfect.

Regarding the efficiency of avfilter_next(), I think we should not care.
Almost nobody uses that function outside lavfi anyway. If it proves a
concern for some application, we can deal with it when it is found.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] hls BANDWIDTH field in master playlist

2018-02-01 Thread Jeyapal, Karthick
On 2/1/18 3:12 PM, Amit Kale wrote:
> Hi All,
>
> When emitting a master playlist, BANDWIDTH field is computed in
> libavformat/hlsenc.c by adding video and audio stream bitrates and then
> adding 10% to account for container overhead. However HLS specification
> (RFC8216) says that BANDWIDTH represents the peak segment bit rate.
> AVERAGE-BANDWIDTH on the other hand represents the average segment bit
> rate. If this is correct, I would like to send a patch to fix it.
Yes, you are right. Ofcourse, you are welcome to send a patch to fix it.
But please keep the following in mind, while sending the patch
- BANDWIDTH is mandatory parameter and AVERAGE-BANDWIDTH is optional parameter.
- Master playlist gets created at the beginning of encode during which time we 
neither know the peak bitrate or the average bitrate of the stream. Right now, 
we are just using the codec’s bitrate parameter which could be way different 
from the actual bitrate of the stream.  So the master playlist should get 
created initially with BANDWIDTH as codec bitrate(to handle live encode). At 
the end of encoding, master playlist should be updated again with the true peak 
bitrate and true average bitrate(for AVERAGE-BANDWIDTH).
- The definition for BANDWIDTH changed to peak bitrate only in v7 of the HLS 
spec. Earlier BANDWIDTH was mentioned as overall bitrate. So, there should be 
an option to turn on or turn off peak bitrate calculation.
>
> Thanks.
> -Amit
>


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


[FFmpeg-devel] [PATCH] configure: fix clang-cl detection

2018-02-01 Thread Alexander Bilyak
When using clang-cl it expects parameters passed in MSVC-style, so appropriate 
toolchain should be selected.
As soon as both clang and clang-cl report themselfs as "clang" with -v option 
the only chance to detect
clang-cl is passing -? option to both which is valid for clang-cl.exe and not 
for clang.exe.
---
 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index fcfa7aa442..f8c55876e5 100755
--- a/configure
+++ b/configure
@@ -4216,7 +4216,7 @@ probe_cc(){
 _depflags='-MMD'
 _cflags_speed='-O3'
 _cflags_size='-Os'
-elif $_cc -v 2>&1 | grep -q clang; then
+elif $_cc -v 2>&1 | grep -q clang && ! $_cc -? > /dev/null 2>&1; then
 _type=clang
 _ident=$($_cc --version 2>/dev/null | head -n1)
 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
@@ -4287,7 +4287,7 @@ probe_cc(){
 _flags_filter=msvc_flags
 _ld_lib='lib%.a'
 _ld_path='-libpath:'
-elif $_cc -nologo- 2>&1 | grep -q Microsoft; then
+elif $_cc -nologo- 2>&1 | grep -q Microsoft || $_cc -v 2>&1 | grep -q 
clang && $_cc -? > /dev/null 2>&1; then
 _type=msvc
 _ident=$($_cc 2>&1 | head -n1)
 _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk 
'\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) 
print "$@:", $$0 }'\'' > $(@:.o=.d)'
-- 
2.15.0

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


Re: [FFmpeg-devel] [PATCH] vc2enc: prevent bitrate overshoots

2018-02-01 Thread James Darnley
On 2018-01-31 15:56, James Darnley wrote:
> From: Rostislav Pehlivanov 
> 
> The rounding caused by the size scaler wasn't compensated for and the
> slice sizes grew beyond what is allowed per frame.
> 
> Signed-off-by: Rostislav Pehlivanov 
> ---

I forgot to say that I pushed this patch after getting the go-ahead from
Rostislav on IRC.

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


[FFmpeg-devel] [PATCH] avcodec/ffv1: Support for RGBA64 and GBRAP16

2018-02-01 Thread Jerome Martinez
Add support for 16-bit/component RGB with Alpha encoding and decoding in 
FFV1, both RGBA64 and GBRAP16 for encoding, GBRAP16 for decoding.


Resulting bitstream was tested about lossless encoding/decoding by the 
compression from DPX to FFV1 then decompression from FFV1 to DPX, see 
commands below (resulting framemd5 hashes are all same).
Resulting bitstream is decodable by another decoder (with same resulting 
framemd5 hash).
Resulting bitstream passed through a conformance checker compared to 
current FFV1 specification IETF draft.


About the patch:
- some modified lines are not used (the ones not used when f->use32bit 
is 1), but it makes the code more coherent (especially because 
decode_rgb_frame signature is same for both 16-bit and 32-bit version) 
and prepares the support of RGBA with 10/12/14 bits/component.
- GBRAP16 was chosen for decoding because GBRP16 is already used when no 
alpha, and the code is more prepared for planar pix_fmt when bit depth 
is >8.
- "s->transparency = desc->nb_components == 4 || desc->nb_components == 
2;" is a copy of a line a bit above about the detection of transparency, 
I preferred to reuse it as is even if "YA" 16-bit/component is not (yet) 
supported.


FFmpeg commands used for tests:
./ffmpeg -i in.dpx -c:v ffv1 out.mkv
./ffmpeg -i in.dpx -pix_fmt gbrap16 -strict -2 -c:v ffv1 out2.mkv
./ffmpeg -i out.mkv out.dpx

./ffmpeg -i in.dpx -f framemd5 in.dpx.framemd5
./ffmpeg -i out.mkv -pix_fmt rgba64be -f framemd5 out.mkv.framemd5
./ffmpeg -i out2.mkv -pix_fmt rgba64be -f framemd5 out2.mkv.framemd5
./ffmpeg -i out.dpx -f framemd5 out.dpx.framemd5

Test file used (renamed to in.dpx):
https://mediaarea.net/temp/uncropped_DPX_4K_16bit_Overscan15pros.dpx

Jérôme

From 0e149afd7eadb1ec05cc79fff78337b2c543ad8e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Martinez?= 
Date: Thu, 1 Feb 2018 13:11:53 +0100
Subject: [PATCH] avcodec/ffv1: Support for RGBA64 and GBRAP16

---
 libavcodec/ffv1dec.c  | 14 ++
 libavcodec/ffv1dec_template.c |  6 +-
 libavcodec/ffv1enc.c  | 16 ++--
 libavcodec/ffv1enc_template.c | 10 +++---
 4 files changed, 36 insertions(+), 10 deletions(-)

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 5eadb6b158..923b79f3ab 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -336,14 +336,16 @@ static int decode_slice(AVCodecContext *c, void *arg)
  decode_plane(fs, p->data[0] + ps*x + y*p->linesize[0], width, 
height, p->linesize[0], 0, 2);
  decode_plane(fs, p->data[0] + ps*x + y*p->linesize[0] + 1, width, 
height, p->linesize[0], 1, 2);
 } else if (f->use32bit) {
-uint8_t *planes[3] = { p->data[0] + ps * x + y * p->linesize[0],
+uint8_t *planes[4] = { p->data[0] + ps * x + y * p->linesize[0],
p->data[1] + ps * x + y * p->linesize[1],
-   p->data[2] + ps * x + y * p->linesize[2] };
+   p->data[2] + ps * x + y * p->linesize[2],
+   p->data[3] + ps * x + y * p->linesize[3] };
 decode_rgb_frame32(fs, planes, width, height, p->linesize);
 } else {
-uint8_t *planes[3] = { p->data[0] + ps * x + y * p->linesize[0],
+uint8_t *planes[4] = { p->data[0] + ps * x + y * p->linesize[0],
p->data[1] + ps * x + y * p->linesize[1],
-   p->data[2] + ps * x + y * p->linesize[2] };
+   p->data[2] + ps * x + y * p->linesize[2],
+   p->data[3] + ps * x + y * p->linesize[3] };
 decode_rgb_frame(fs, planes, width, height, p->linesize);
 }
 if (fs->ac != AC_GOLOMB_RICE && f->version > 2) {
@@ -694,6 +696,10 @@ static int read_header(FFV1Context *f)
 f->avctx->pix_fmt = AV_PIX_FMT_GBRP16;
 f->use32bit = 1;
 }
+else if (f->avctx->bits_per_raw_sample == 16 && f->transparency) {
+f->avctx->pix_fmt = AV_PIX_FMT_GBRAP16;
+f->use32bit = 1;
+}
 } else {
 av_log(f->avctx, AV_LOG_ERROR, "colorspace not supported\n");
 return AVERROR(ENOSYS);
diff --git a/libavcodec/ffv1dec_template.c b/libavcodec/ffv1dec_template.c
index 37df766773..2904a44112 100644
--- a/libavcodec/ffv1dec_template.c
+++ b/libavcodec/ffv1dec_template.c
@@ -107,7 +107,7 @@ static av_always_inline int RENAME(decode_line)(FFV1Context 
*s, int w,
 return 0;
 }
 
-static void RENAME(decode_rgb_frame)(FFV1Context *s, uint8_t *src[3], int w, 
int h, int stride[3])
+static void RENAME(decode_rgb_frame)(FFV1Context *s, uint8_t *src[4], int w, 
int h, int stride[4])
 {
 int x, y, p;
 TYPE *sample[4][2];
@@ -158,10 +158,14 @@ static void RENAME(decode_rgb_frame)(FFV1Context *s, 
uint8_t *src[3], int w, int
 *((uint16_t*)(src[0] + x*2 + stride[0]*y)) = g;
 *((uint16_t*)(src[1] + x*2 + stride[1]*y)) = b;
 

Re: [FFmpeg-devel] [PATCH] libavfilter: constify filter list

2018-02-01 Thread Michael Niedermayer
On Thu, Feb 01, 2018 at 02:43:56AM +0100, wm4 wrote:
> On Thu, 1 Feb 2018 02:06:52 +0100
> Michael Niedermayer  wrote:
> 
> > On Wed, Jan 31, 2018 at 12:24:43PM +0100, wm4 wrote:
> > > On Wed, 31 Jan 2018 12:11:25 +0100
> > > Michael Niedermayer  wrote:
> > >   
> > > > On Wed, Jan 31, 2018 at 10:03:58AM +0100, wm4 wrote:  
> > > > > On Wed, 31 Jan 2018 09:08:23 +0100
> > > > > Tobias Rapp  wrote:
> > > > > 
> > > > > > On 30.01.2018 20:37, Michael Niedermayer wrote:
> > > > > > > On Tue, Jan 30, 2018 at 08:27:27PM +0700, Muhammad Faiz wrote:
> > > > > > >   
> > > > > > >> On Tue, Jan 30, 2018 at 7:50 PM, Michael Niedermayer
> > > > > > >>  wrote:  
> > > > > > >>> Its also a step away from supporting plugins.
> > > > > > >>> Why plugins matter ? Because having plugin
> > > > > > >>> support is a big advantage, it allows a much wider
> > > > > > >>> community to work on, write and maintain filters.
> > > > > > >>>
> > > > > > >>> With plugins, people can write filters that are
> > > > > > >>> written in languages other than C. Or filters which
> > > > > > >>> some developer in FFmpeg doesnt want. Or they can be
> > > > > > >>> maintained externally by people who just do not like us.
> > > > > > >>> Or by people who perfer a FOSS license different from
> > > > > > >>> LGPL/GPL/BSD. Iam sure others can come up with more
> > > > > > >>> reasons ...
> > > > > > >>>
> > > > > > >>> Of course avfilter_register() isnt enough for plugins
> > > > > > >>> but it or something equivalent is needed for plugins.
> > > > > > >>>
> > > > > > >>> So i would prefer if avfilter_register() stays supported
> > > > > > >>> indefinitly or in case a different system is written for
> > > > > > >>> plugins then until that system is in place.  
> > > > > > >>
> > > > > > >> It just returns error and logs error message that currently 
> > > > > > >> external
> > > > > > >> filter is unsupported. If someone wants to implement support for
> > > > > > >> external filter, it can be easily added later using separate
> > > > > > >> list/table.  
> > > > > > > 
> > > > > > > Iam not sure "easily" is true
> > > > > > > 
> > > > > > > We started out with a fully public API that allowed external 
> > > > > > > filters.
> > > > > > > and little by little its removed or made private.
> > > > > > > each individual change may be easy to undo but as a whole moving
> > > > > > > libavfilter back to having a public API is not that easy anymore
> > > > > > > 
> > > > > > > IIRC the arguments to make things private where that people 
> > > > > > > wanted to
> > > > > > > improve the API. But from the idea and impression of a plan like:
> > > > > > > 1. make it private
> > > > > > > 2. design and implement better API
> > > > > > > 3. make it public again
> > > > > > > 
> > > > > > > Somehow now people lost sight and interrest in 3. and even 2. is 
> > > > > > > becoming
> > > > > > > less interresting. But the problem is really without 2 + 3 
> > > > > > > actually happening
> > > > > > > doing 1 seems like not a good idea at all.
> > > > > > > 
> > > > > > > To me it seems even mentioning external filters and public API 
> > > > > > > makes some
> > > > > > > people angry.
> > > > > > > But really that has to be the goal at some point. To again have a 
> > > > > > > public API  
> > > > > > 
> > > > > > I agree that having (again) a public filter API would be good. This 
> > > > > > would give users the freedom to implement their own special-purpose 
> > > > > > filters (see the "dumpwave" discussion).
> > > > > 
> > > > > Someone needs to design and write it.
> > > > > 
> > > > > Whether we have external filters is completely orthogonal to this
> > > > > change. 
> > > >   
> > > > > They were not possible before, because not enough API for
> > > > > implementing them is public. 
> > > > 
> > > > This is correct if by "before" you mean today before this is applied.
> > > > But longer ago, as in years, it was possible
> > > > 
> > > >   
> > > > > They can be possible in the future, but
> > > > > then registering them would need a different API anyway (one that
> > > > > doesn't use global mutable state, but uses some sort of context
> > > > > instead).
> > > > 
> > > > i understand that you arent a native english speaker nor am i but
> > > > what you write here is not true.
> > > > 
> > > > Several people desire to eliminate all "global mutable state"
> > > > and thats fine, iam happy if that is achieved. But its not
> > > > that its neccessary for a fully functional API register or otherwise.
> > > > The registering code with "global mutable state" and some form
> > > > of thread synchronization would work perfectly fine.
> > > > 
> > > > What exactly is in relation to registering the problem with 
> > > > "global mutable state" ?
> > > > 
> > > > One application registering a filter with a common name and another 
> > > > application unintentionally using that ?  
> > > 
> > > Yes. It's not library-safe.

Re: [FFmpeg-devel] [PATCH] FFV1: make RGB48 support as non-experimental

2018-02-01 Thread Jerome Martinez

On 05/01/2018 11:18, Jerome Martinez wrote:
1 year without RGB48 related patches, tested by a couple of users, 
tested with a FFV1 conformance checker, I suggest that FFV1 RGB48 
support in FFmpeg does not mandate anymore the user to add " -strict 
experimental" on the command line during encoding.


Sorry, I missed the GBRP16 part.
I tested the encoding through GBRP16 pix_fmt (instead of RGB48 pix_fmt), 
and it works fine too.
Additional patch for removing the need of " -strict experimental" for 
GBRP16 too.
From 511e036499f716b14fed7ec07d2d8ccf18936444 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Martinez?= 
Date: Thu, 1 Feb 2018 13:15:54 +0100
Subject: [PATCH] avcodec/ffv1enc: mark RGB48 support as non-experimental

Remove the 2nd mark, 1st mark was removed in 58e16a4
---
 libavcodec/ffv1enc.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index c0c1558ffe..0778f84c9b 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -657,10 +657,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
 s->chroma_planes = 1;
 if (s->bits_per_raw_sample >= 16) {
 s->use32bit = 1;
-if (avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
-av_log(avctx, AV_LOG_ERROR, "16bit RGB is experimental and 
under development, only use it for experiments\n");
-return AVERROR_INVALIDDATA;
-}
 }
 s->version = FFMAX(s->version, 1);
 break;
-- 
2.13.3.windows.1

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


Re: [FFmpeg-devel] hls BANDWIDTH field in master playlist

2018-02-01 Thread Amit Kale
Thanks for this info. Will soon get back with a patch.
-Amit

On 01-Feb-2018 3:58 PM, "Jeyapal, Karthick"  wrote:

> On 2/1/18 3:12 PM, Amit Kale wrote:
> > Hi All,
> >
> > When emitting a master playlist, BANDWIDTH field is computed in
> > libavformat/hlsenc.c by adding video and audio stream bitrates and then
> > adding 10% to account for container overhead. However HLS specification
> > (RFC8216) says that BANDWIDTH represents the peak segment bit rate.
> > AVERAGE-BANDWIDTH on the other hand represents the average segment bit
> > rate. If this is correct, I would like to send a patch to fix it.
> Yes, you are right. Ofcourse, you are welcome to send a patch to fix it.
> But please keep the following in mind, while sending the patch
> - BANDWIDTH is mandatory parameter and AVERAGE-BANDWIDTH is optional
> parameter.
> - Master playlist gets created at the beginning of encode during which
> time we neither know the peak bitrate or the average bitrate of the stream.
> Right now, we are just using the codec’s bitrate parameter which could be
> way different from the actual bitrate of the stream.  So the master
> playlist should get created initially with BANDWIDTH as codec bitrate(to
> handle live encode). At the end of encoding, master playlist should be
> updated again with the true peak bitrate and true average bitrate(for
> AVERAGE-BANDWIDTH).
> - The definition for BANDWIDTH changed to peak bitrate only in v7 of the
> HLS spec. Earlier BANDWIDTH was mentioned as overall bitrate. So, there
> should be an option to turn on or turn off peak bitrate calculation.
> >
> > Thanks.
> > -Amit
> >
>
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

-- 
This message and its attachments are confidential (or legally privileged) 
information and are meant solely for the addressee of such message. Any 
unauthorized use of the message / its attachments is strictly prohibited.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/4] avformat/mpegenc - accept PCM_DVD streams

2018-02-01 Thread Gyan Doshi

On 1/29/2018 6:53 PM, Gyan Doshi wrote:


On 1/29/2018 3:47 PM, Carl Eugen Hoyos wrote:


How did you test this patch?


By remuxing with patched ffmpeg and then checking with ffprobe, but not 
ffplay!

...

Sorry, I'll rework and submit.


Revised and tested patch attached.
From 78757309bbfbc9d9e48aabd6babc9529f83d5950 Mon Sep 17 00:00:00 2001
From: Gyan Doshi 
Date: Thu, 1 Feb 2018 19:12:03 +0530
Subject: [PATCH v2] avformat/mpegenc - accept PCM_DVD streams

PCM_S16BE stream packets in MPEG-PS have a 3-byte header
and recognized as PCM_DVD by the demuxer which prevents
their proper remuxing in MPEG-1/2 PS.
---
 libavformat/mpegenc.c | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index c77c3dfe41..598df662f4 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -353,7 +353,8 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx)
 if (!s->is_mpeg2 &&
 (st->codecpar->codec_id == AV_CODEC_ID_AC3 ||
  st->codecpar->codec_id == AV_CODEC_ID_DTS ||
- st->codecpar->codec_id == AV_CODEC_ID_PCM_S16BE))
+ st->codecpar->codec_id == AV_CODEC_ID_PCM_S16BE ||
+ st->codecpar->codec_id == AV_CODEC_ID_PCM_DVD))
  av_log(ctx, AV_LOG_WARNING,
 "%s in MPEG-1 system streams is not widely supported, "
 "consider using the vob or the dvd muxer "
@@ -363,7 +364,10 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx)
 stream->id = ac3_id++;
 } else if (st->codecpar->codec_id == AV_CODEC_ID_DTS) {
 stream->id = dts_id++;
-} else if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16BE) {
+} else if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16BE ||
+   st->codecpar->codec_id == AV_CODEC_ID_PCM_DVD) {
+if (st->codecpar->codec_id == AV_CODEC_ID_PCM_DVD)
+av_log(ctx, AV_LOG_WARNING, "Only 16-bit LPCM streams are 
supported.\n");
 stream->id = lpcm_id++;
 for (j = 0; j < 4; j++) {
 if (lpcm_freq_tab[j] == st->codecpar->sample_rate)
@@ -1150,8 +1154,17 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, 
AVPacket *pkt)
 return AVERROR(ENOMEM);
 pkt_desc->pts= pts;
 pkt_desc->dts= dts;
+
+if (st->codecpar->codec_id == AV_CODEC_ID_PCM_DVD) {
+/* Skip first 3 bytes of packet data, which comprise PCM header
+   and will be written fresh by this muxer. */
+buf += 3;
+size -= 3;
+}
+
 pkt_desc->unwritten_size =
 pkt_desc->size   = size;
+
 if (!stream->predecode_packet)
 stream->predecode_packet = pkt_desc;
 stream->next_packet = &pkt_desc->next;
-- 
2.11.1.windows.1___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavfilter: constify filter list

2018-02-01 Thread Brian Matherly

On 2/1/2018 4:03 AM, Nicolas George wrote:

Regarding the efficiency of avfilter_next(), I think we should not care.
Almost nobody uses that function outside lavfi anyway. If it proves a
concern for some application, we can deal with it when it is found.


For what it's worth, I use avfilter_next() on startup in MLT to generate 
a list of valid user options:


https://github.com/mltframework/mlt/blob/master/src/modules/avformat/factory.c#L415

I would prefer some way to loop through the filters in linear time.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] librsvgdec: Fix frame clearing code

2018-02-01 Thread Rostislav Pehlivanov
On 31 January 2018 at 22:17, Calvin Walton  wrote:

> The existing code attempts to clear the frame by painting in OVER mode
> with transparent black - which is, of course, a no-op. As a result if
> you have many input frames (e.g. you're using a sequence of svg files),
> you'll start to see new frames drawn over old frames as memory gets
> re-used.
>
> Fix that by clearing the frame using the SOURCE blend mode, which
> will replace whatever is in the buffer with transparent black.
>
> Referencing the cairo FAQ,
> https://www.cairographics.org/FAQ/#clear_a_surface
> ---
>  libavcodec/librsvgdec.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> It would probably be nice to get this into 3.4 branch as well?
>
> diff --git a/libavcodec/librsvgdec.c b/libavcodec/librsvgdec.c
> index e57070f8e4..e16cb6247d 100644
> --- a/libavcodec/librsvgdec.c
> +++ b/libavcodec/librsvgdec.c
> @@ -82,8 +82,11 @@ static int librsvg_decode_frame(AVCodecContext *avctx,
> void *data, int *got_fram
>
>  crender = cairo_create(image);
>
> -cairo_set_source_rgba(crender, 0.0, 0.0, 0.0, 1.0f);
> -cairo_paint_with_alpha(crender, 0.0f);
> +cairo_save(crender);
> +cairo_set_source_rgba(crender, 0.0, 0.0, 0.0, 0.0f);
> +cairo_set_operator(crender, CAIRO_OPERATOR_SOURCE);
> +cairo_paint(crender);
> +cairo_restore(crender);
>
>  cairo_scale(crender, dimensions.width / (double)unscaled_dimensions.
> width,
>  dimensions.height / (double)unscaled_dimensions.height);
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

Could you resubmit the patch with CAIRO_OPERATOR_CLEAR and removing
cairo_set_source_rgba() like the docs say? We don't need generic clearing
to an arbitrary color and it might be faster if they optimize(d) it.

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


[FFmpeg-devel] [PATCH] avfilter: sort filter list

2018-02-01 Thread Muhammad Faiz
Move REGISTER_FILTER to FILTER_TABLE in configure.
Replace linked list with static table, and sort it.
Use bsearch() on avfilter_get_by_name().
Deprecate avfilter_register_all(), avfilter_register(), and
avfilter_next().
Add avfilter_iterate() as a replacement for avfilter_next().

Signed-off-by: Muhammad Faiz 
---
 Makefile |   5 +-
 configure| 428 -
 doc/APIchanges   |   4 +
 libavfilter/allfilters.c | 441 ++-
 libavfilter/avfilter.c   |  65 ++-
 libavfilter/avfilter.h   |  20 ++-
 libavfilter/buffersink.c |   4 +-
 libavfilter/version.h|  10 +-
 tests/checkasm/Makefile  |   2 +-
 9 files changed, 532 insertions(+), 447 deletions(-)

diff --git a/Makefile b/Makefile
index 9defddebfd..6427abafb5 100644
--- a/Makefile
+++ b/Makefile
@@ -61,7 +61,7 @@ CONFIGURABLE_COMPONENTS = 
  \
 $(SRC_PATH)/libavformat/protocols.c \
 
 config.h: ffbuild/.config
-ffbuild/.config: $(CONFIGURABLE_COMPONENTS)
+ffbuild/.config: $(CONFIGURABLE_COMPONENTS) $(SRC_PATH)/configure
@-tput bold 2>/dev/null
@-printf '\nWARNING: $(?) newer than config.h, rerun configure\n\n'
@-tput sgr0 2>/dev/null
@@ -142,7 +142,8 @@ distclean:: clean
$(RM) .version avversion.h config.asm config.h mapfile  \
ffbuild/.config ffbuild/config.* libavutil/avconfig.h \
version.h libavutil/ffversion.h libavcodec/codec_names.h \
-   libavcodec/bsf_list.c libavformat/protocol_list.c
+   libavcodec/bsf_list.c libavformat/protocol_list.c \
+   libavfilter/filter_list.c
 ifeq ($(SRC_LINK),src)
$(RM) src
 endif
diff --git a/configure b/configure
index fcfa7aa442..a11798625e 100755
--- a/configure
+++ b/configure
@@ -3177,6 +3177,381 @@ unix_protocol_deps="sys_un_h"
 unix_protocol_select="network"
 
 # filters
+FILTER_TABLE="
+abench  af
+acompressor af
+acontrast   af
+acopy   af
+acrossfade  af
+acrusheraf
+adelay  af
+aecho   af
+aemphasis   af
+aeval   af
+afade   af
+afftfiltaf
+afiraf
+aformat af
+agate   af
+aiiraf
+ainterleave af
+alimiteraf
+allpass af
+aloop   af
+amerge  af
+ametadata   af
+amixaf
+anequalizer af
+anull   af
+apadaf
+aperms  af
+aphaser af
+apulsator   af
+arealtime   af
+aresample   af
+areverseaf
+aselect af
+asendcmdaf
+asetnsamplesaf
+asetpts af
+asetrateaf
+asettb  af
+ashowinfo   af
+asidedata   af
+asplit  af
+astats  af
+astreamselect   af
+atempo  af
+atrim   af
+azmqaf
+bandpassaf
+bandreject  af
+bassaf
+biquad  af
+bs2baf
+channelmap  af
+channelsplitaf
+chorus  af
+compand af
+compensationdelay   af
+crossfeed   af
+crystalizer af
+dcshift af
+dynaudnorm  af
+earwax  af
+ebur128 af
+equalizer   af
+extrastereo af
+firequalizeraf
+flanger af
+haasaf
+hdcdaf
+headphone   af
+highpassaf
+joinaf
+ladspa  af
+loudnormaf
+lowpass af
+lv2 af
+mcompandaf
+pan af
+replaygain  af
+resampleaf
+rubberband  af
+sidechaincompress   af
+sidechaingate   af
+silencedetect   af
+silenceremove   af
+sofalizer   af
+stereotools af
+stereowiden af
+superequalizer  af
+surroundaf
+treble  af
+tremolo af
+vibrato af
+volume  af
+volumedetectaf
+aevalsrcasrc
+anoisesrc   asrc
+anullsrcasrc
+flite   asrc
+hilbert asrc
+sineasrc
+anullsink   asink
+alphaextractvf
+alphamerge  vf
+ass vf
+atadenoise  vf
+avgblur vf
+b

[FFmpeg-devel] [PATCH v2] librsvgdec: Fix frame clearing code

2018-02-01 Thread Calvin Walton
The existing code attempts to clear the frame by painting in OVER
mode with transparent black - which is a no-op. As a result if you
have many input frames (e.g. you're using a sequence of svg files),
you'll start to see new frames drawn over old frames as memory gets
re-used.

Switch the code to paint using the CLEAR compositing operator,
which fills every channel with 0 values (setting a source colour
is not required).
---
 libavcodec/librsvgdec.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

Updated based on feedback - instead of setting a transparent paint
colour, I'm just using the CLEAR operator which is hard-coded to
transparent black, and might have an optimized fast path.

diff --git a/libavcodec/librsvgdec.c b/libavcodec/librsvgdec.c
index e57070f8e4..6697785026 100644
--- a/libavcodec/librsvgdec.c
+++ b/libavcodec/librsvgdec.c
@@ -82,8 +82,10 @@ static int librsvg_decode_frame(AVCodecContext *avctx, void 
*data, int *got_fram
 
 crender = cairo_create(image);
 
-cairo_set_source_rgba(crender, 0.0, 0.0, 0.0, 1.0f);
-cairo_paint_with_alpha(crender, 0.0f);
+cairo_save(crender);
+cairo_set_operator(crender, CAIRO_OPERATOR_CLEAR);
+cairo_paint(crender);
+cairo_restore(crender);
 
 cairo_scale(crender, dimensions.width / (double)unscaled_dimensions.width,
 dimensions.height / (double)unscaled_dimensions.height);
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavfilter: constify filter list

2018-02-01 Thread Muhammad Faiz
On Thu, Feb 1, 2018 at 5:03 PM, Nicolas George  wrote:
> Hi.
>
> Muhammad Faiz (2018-01-30):
>> Move REGISTER_FILTER to FILTER_TABLE in configure.
>> Auto generate filter extern and filter table.
>> Sort filter table, use bsearch on avfilter_get_by_name.
>> Define next pointer at filter extern, no need to initialize
>> next pointer at run time, so AVFilter can be set to const.
>> Make avfilter_register always return error.
>> Target checkasm now depends on EXTRALIBS-avformat.
>
> Regarding registering user filters, do not bother about that. That ship
> has sailed a long time ago; it is already more than half-way across and
> decelerating. If somebody wants to implement plugins, they will have a
> lot of work. Designing a way of registering user filters so that they
> can be parsed by name would be a spoonful in the pool.
>
> Regarding the actual implementation:
>
> I do not like that you moved the list into configure. Not per se, but
> because it is completely different from what Josh de Kock is doing with
> codecs, parsers and formats. Please coordinate with Josh to have a
> consistent solution for all components.

Actually I have a plan to sort codecs based on name and codec_id. And
it is difficult to sort based on codec_id with only extern declaration
in allcodecs.


>
> I think the fact that you need to insert a line in each filter is rather
> a sign that the design is far from perfect.

I remove it in my new patch.

>
> Regarding the efficiency of avfilter_next(), I think we should not care.
> Almost nobody uses that function outside lavfi anyway. If it proves a
> concern for some application, we can deal with it when it is found.


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


Re: [FFmpeg-devel] [PATCH] libavfilter: constify filter list

2018-02-01 Thread Muhammad Faiz
On Wed, Jan 31, 2018 at 7:03 PM, wm4  wrote:
> On Wed, 31 Jan 2018 11:52:14 +
> Mark Thompson  wrote:
>
>> >> On the other side, you get rid of a field in AVFilter and avoid having to 
>> >> put some pointless boilerplate in a lot of places.
>> >
>> > The other solution is to initialize next pointer on
>> > avfilter_register_all() as before,  add new iterate API, and deprecate
>> > both avfilter_register_all() and avfilter_next().
>>
>> I guess having thought about this further my problem is that you appear to 
>> be writing a lot of new infrastructure for creating and updating the next 
>> links (with special generation code in configure and extra boilerplate on 
>> every filter) when the feature does not have any clear value.  Once other 
>> functions are properly updated the only place where the next link is used is 
>> in avfilter_next(), which is only slowed down a little bit and would never 
>> be called in performance-sensitive code anyway.  A new iterate API would be 
>> welcome but is mostly orthogonal - you aren't going to call that in 
>> performance-sensitive code either.
>>
>> So, can we just drop the next links completely?
>
> Just as a comment on the side: if he changes that, I'd prefer of the
> next links are lazily initialized and only when using the old API. That
> would waste less memory (since writing the next link will trigger copy
> on write and in the worst case waste 4K (a page) per filter.
>
> (Personally I found the static next links rather neat, but yeah, maybe
> it's too much configure magic.)

I've posted a new patch
https://ffmpeg.org/pipermail/ffmpeg-devel/2018-February/224787.html

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


Re: [FFmpeg-devel] [PATCH] libavfilter: constify filter list

2018-02-01 Thread Nicolas George
Muhammad Faiz (2018-02-02):
> Actually I have a plan to sort codecs based on name and codec_id. And
> it is difficult to sort based on codec_id with only extern declaration
> in allcodecs.

It seems like a good idea, although I have not given it much list. But
as it is, Josh and you are proposing patches that go in different
directions. Please coordinate with him. We do not want to go back and
forth between implementations, nor maintain subtly different
implementations. There is no rush to implement this, and therefore it
can be done properly.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH v3 1/6] lavc: add new API for iterating codecs and codec parsers

2018-02-01 Thread Muhammad Faiz
On Thu, Feb 1, 2018 at 3:25 AM, Josh de Kock  wrote:
> Also replace linked list with an array.
> ---
>  configure  |   12 +-
>  doc/APIchanges |4 +
>  libavcodec/.gitignore  |2 +
>  libavcodec/allcodecs.c | 1473 
> 
>  libavcodec/avcodec.h   |   31 +
>  libavcodec/parser.c|   84 ++-
>  libavcodec/utils.c |  112 
>  libavcodec/version.h   |3 +
>  8 files changed, 971 insertions(+), 750 deletions(-)
>

I have a plan to sort codecs based on name and codec_id (which overlap
with this patch). Is it OK if I overtake this?
If it is not OK, I will wait until this patchset pushed.

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


Re: [FFmpeg-devel] [PATCH v3] avcodec/libopus: support disabling phase inversion.

2018-02-01 Thread Michael Niedermayer
On Fri, Jan 26, 2018 at 11:30:57AM +0100, Menno de Gier wrote:
> From: Menno 
> 
> This supports disabling phase inversion in both the libopus encoder and the
> decoder.
> 
> Signed-off-by: Menno 
> ---
>  doc/encoders.texi   |  5 +
>  libavcodec/libopusdec.c | 33 +
>  libavcodec/libopusenc.c | 14 ++
>  3 files changed, 52 insertions(+)
[...]
> @@ -209,6 +223,24 @@ static void libopus_flush(AVCodecContext *avc)
>  avc->internal->skip_samples = opus->pre_skip;
>  }
>  
> +
> +#define OFFSET(x) offsetof(struct libopus_context, x)
> +#define FLAGS AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
> +static const AVOption libopusdec_options[] = {
> +#ifdef OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST
> +{ "apply_phase_inv", "Apply intensity stereo phase inversion", 
> OFFSET(apply_phase_inv), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS },
> +{ NULL },
> +#endif
> +};

This crashes as it is missing the NULL element at the end

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

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


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


Re: [FFmpeg-devel] [PATCH] delogo will fail if interp is zero.

2018-02-01 Thread Michael Niedermayer
On Wed, Jan 31, 2018 at 11:25:00AM +0800, wuxiaoyong wrote:
> With ROUNDED_DIV operation, if the first parameter is 0, it will
> overflow and return a very large number, delogo will fail.
> So, if it's zero, just set it to 1, it will not affect the result so
> much.
> 
> Signed-off-by: wuxiaoyong 
> ---
>  libavfilter/vf_delogo.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
> index 065d093..73ad6b9 100644
> --- a/libavfilter/vf_delogo.c
> +++ b/libavfilter/vf_delogo.c
> @@ -126,7 +126,7 @@ static void apply_delogo(uint8_t *dst, int dst_linesize,
>   botleft[x-logo_x1-1]  +
>   botleft[x-logo_x1+1]) * weightb;
>  weight = (weightl + weightr + weightt + weightb) * 3U;
> -interp = ROUNDED_DIV(interp, weight);
> +interp = ROUNDED_DIV(interp <= 0 ? 1 : interp, weight);
>  
>  if (y >= logo_y+band && y < logo_y+logo_h-band &&
>  x >= logo_x+band && x < logo_x+logo_w-band) {

this is definitly not correct
ROUNDED_DIV expects signed values interp and weight are uint64_t 

you can fix ROUNDED_DIV so it works with unsigned values for example

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Never trust a computer, one day, it may think you are the virus. -- Compn


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


Re: [FFmpeg-devel] Remove carriage return ('\r') in Windows CC_IDENT

2018-02-01 Thread Michael Niedermayer
On Wed, Jan 31, 2018 at 02:35:29PM -0800, Xiaohan Wang (王消寒) wrote:
> 

>  configure |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> f8dfee52e94f632ac5803332e2fe050c9a880254  
> 0001-Remove-carriage-return-r-in-Windows-CC_IDENT.patch
> From 07e33b2aa09b8b224ac35a5b56b29490a6486bdf Mon Sep 17 00:00:00 2001
> From: Xiaohan Wang 
> Date: Wed, 31 Jan 2018 14:20:02 -0800
> Subject: [PATCH] Remove carriage return ('\r') in Windows CC_IDENT
> 
> Currently the Windows CC_IDENT is ended with '\r\n'. "head -n1" will not
> remove the '\r' and this is causing building error in Chromium.
> 
> This CL adds "tr -d '\r'" to remove '\r' in the CC_IDENT string. Since in
> most cases '\r' only appears at the end of a string/line, this should
> work in most cases.
> 
> See example:
> 
> printf "hello\r\nworld\r\n" | head -n1 | hd
>   68 65 6c 6c 6f 0d 0a  |hello..|
> 
> printf "hello\r\nworld\r\n" | head -n1 | tr -d '\r' | hd
>   68 65 6c 6c 6f 0a |hello.|
> 
> Also note a similar previous change at:
> https://lists.ffmpeg.org/pipermail/ffmpeg-cvslog/2013-October/069950.html
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH 2/3] avcodec/aacsbr_fixed: Fix overflows in rounding in sbr_hf_assemble()

2018-02-01 Thread Michael Niedermayer
On Wed, Jan 31, 2018 at 07:20:09PM +0100, Michael Niedermayer wrote:
> Fixes: runtime error: signed integer overflow: 2052929346 + 204817098 cannot 
> be represented in type 'int'
> Fixes: 5275/clusterfuzz-testcase-minimized-5367635958038528
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/aacsbr_fixed.c | 9 +
>  1 file changed, 5 insertions(+), 4 deletions(-)

will apply

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

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.


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


[FFmpeg-devel] Hardware encoder ARM input as device input

2018-02-01 Thread Marcin Woźniak

Hello,
I try to implement an HiSilicon H264 encoder direct input as ffmpeg 
libavdevice source (someking like V4L linux for cameras with H264 source 
driver).
I successfully recieve H264 packets with NAL units and set correct PTS 
according to source packet.
I am stuck at the moment where timing data is not extracted from raw 
H264 paassed data and looks like this:


Input #0, armdevice, from '/dev/video':
  Duration: N/A, start: 0.00, bitrate: N/A
Stream #0:0: Video: h264 (High), yuvj420p(pc, bt709, progressive), 
1920x1080, 1000k tbr, 1000k tbn, 2000k tbc


Resolution is okay but timing data is wrong. I passed SPS and PPS of 
incomming data in "read_packet".


In shotcut:
1. Open H264 encoder using low-level API in device_open
2. Initialize encoder with fps and resolution using API in device_init
3. In read_packet i get NAL units from buffer and:
av_new_packet(pkt,total);
memcpy(pkt->data,buffer) -> stub
 pkt->pts = buffer.u64PTS;
pkt->size = size
and return packet.

Profile level is guessed okay but not the timing data.

What am i doing wrong?
 Marcin
<>___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] avcodec/exr: Fix memleaks in decode_header()

2018-02-01 Thread Michael Niedermayer
On Wed, Jan 31, 2018 at 09:04:54PM +0100, Moritz Barsnick wrote:
> On Wed, Jan 31, 2018 at 19:20:08 +0100, Michael Niedermayer wrote:
> 
> > @@ -1458,8 +1465,10 @@ static int decode_header(EXRContext *s, AVFrame 
> > *frame)
> >
> >  s->channels = av_realloc(s->channels,
> >   ++s->nb_channels * 
> > sizeof(EXRChannel));
> > -if (!s->channels)
> > -return AVERROR(ENOMEM);
> > +if (!s->channels) {
> > +ret = AVERROR(ENOMEM);;
> ^^
> Duplicate semicolon. This should have given you a new warning.

will apply with this fixed

thx

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

If you drop bombs on a foreign country and kill a hundred thousand
innocent people, expect your government to call the consequence
"unprovoked inhuman terrorist attacks" and use it to justify dropping
more bombs and killing more people. The technology changed, the idea is old.


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


[FFmpeg-devel] [PATCH v4] avcodec/libopus: support disabling phase inversion.

2018-02-01 Thread Menno de Gier
From: Menno 

Fix crash on decoder options.

Signed-off-by: Menno 
---
 doc/encoders.texi   |  5 +
 libavcodec/libopusdec.c | 33 +
 libavcodec/libopusenc.c | 14 ++
 3 files changed, 52 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 6a410a8cb6..c5dfc646d9 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -981,6 +981,11 @@ Other values include 0 for mono and stereo, 1 for surround 
sound with masking
 and LFE bandwidth optimizations, and 255 for independent streams with an
 unspecified channel layout.
 
+@item apply_phase_inv (N.A.) (requires libopus >= 1.2)
+If set to 0, disables the use of phase inversion for intensity stereo,
+improving the quality of mono downmixes, but slightly reducing normal stereo
+quality. The default is 1 (phase inversion enabled).
+
 @end table
 
 @anchor{libshine}
diff --git a/libavcodec/libopusdec.c b/libavcodec/libopusdec.c
index 4f7f4755c2..3d2ee5b61b 100644
--- a/libavcodec/libopusdec.c
+++ b/libavcodec/libopusdec.c
@@ -25,6 +25,7 @@
 #include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/ffmath.h"
+#include "libavutil/opt.h"
 
 #include "avcodec.h"
 #include "internal.h"
@@ -33,11 +34,15 @@
 #include "libopus.h"
 
 struct libopus_context {
+AVClass *class;
 OpusMSDecoder *dec;
 int pre_skip;
 #ifndef OPUS_SET_GAIN
 union { int i; double d; } gain;
 #endif
+#ifdef OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST
+int apply_phase_inv;
+#endif
 };
 
 #define OPUS_HEAD_SIZE 19
@@ -136,6 +141,15 @@ static av_cold int libopus_decode_init(AVCodecContext *avc)
 }
 #endif
 
+#ifdef OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST
+ret = opus_multistream_decoder_ctl(opus->dec,
+   
OPUS_SET_PHASE_INVERSION_DISABLED(!opus->apply_phase_inv));
+if (ret != OPUS_OK)
+av_log(avc, AV_LOG_WARNING,
+   "Unable to set phase inversion: %s\n",
+   opus_strerror(ret));
+#endif
+
 /* Decoder delay (in samples) at 48kHz */
 avc->delay = avc->internal->skip_samples = opus->pre_skip;
 
@@ -209,6 +223,24 @@ static void libopus_flush(AVCodecContext *avc)
 avc->internal->skip_samples = opus->pre_skip;
 }
 
+
+#define OFFSET(x) offsetof(struct libopus_context, x)
+#define FLAGS AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
+static const AVOption libopusdec_options[] = {
+#ifdef OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST
+{ "apply_phase_inv", "Apply intensity stereo phase inversion", 
OFFSET(apply_phase_inv), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS },
+#endif
+{ NULL },
+};
+
+static const AVClass libopusdec_class = {
+.class_name = "libopusdec",
+.item_name  = av_default_item_name,
+.option = libopusdec_options,
+.version= LIBAVUTIL_VERSION_INT,
+};
+
+
 AVCodec ff_libopus_decoder = {
 .name   = "libopus",
 .long_name  = NULL_IF_CONFIG_SMALL("libopus Opus"),
@@ -223,5 +255,6 @@ AVCodec ff_libopus_decoder = {
 .sample_fmts= (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT,
  AV_SAMPLE_FMT_S16,
  AV_SAMPLE_FMT_NONE },
+.priv_class = &libopusdec_class,
 .wrapper_name   = "libopus",
 };
diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c
index b449497d15..4ae81b0bb2 100644
--- a/libavcodec/libopusenc.c
+++ b/libavcodec/libopusenc.c
@@ -39,6 +39,9 @@ typedef struct LibopusEncOpts {
 int packet_size;
 int max_bandwidth;
 int mapping_family;
+#ifdef OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST
+int apply_phase_inv;
+#endif
 } LibopusEncOpts;
 
 typedef struct LibopusEncContext {
@@ -154,6 +157,14 @@ static int libopus_configure_encoder(AVCodecContext 
*avctx, OpusMSEncoder *enc,
"Unable to set maximum bandwidth: %s\n", 
opus_strerror(ret));
 }
 
+#ifdef OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST
+ret = opus_multistream_encoder_ctl(enc,
+   
OPUS_SET_PHASE_INVERSION_DISABLED(!opts->apply_phase_inv));
+if (ret != OPUS_OK)
+av_log(avctx, AV_LOG_WARNING,
+   "Unable to set phase inversion: %s\n",
+   opus_strerror(ret));
+#endif
 return OPUS_OK;
 }
 
@@ -530,6 +541,9 @@ static const AVOption libopus_options[] = {
 { "on", "Use variable bit rate", 0, AV_OPT_TYPE_CONST, { 
.i64 = 1 }, 0, 0, FLAGS, "vbr" },
 { "constrained","Use constrained VBR",   0, AV_OPT_TYPE_CONST, { 
.i64 = 2 }, 0, 0, FLAGS, "vbr" },
 { "mapping_family", "Channel Mapping Family",  
OFFSET(mapping_family), AV_OPT_TYPE_INT,   { .i64 = -1 },   -1,  255,  FLAGS, 
"mapping_family" },
+#ifdef OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST
+{ "apply_phase_inv", "Apply intensity stereo phase inversion", 
OFFSET(apply_phase_inv), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS },
+#endif

[FFmpeg-devel] First Post

2018-02-01 Thread param mangal
Hello
I am a student pursuing a Bachelor's degree in Computer Science and
Engineering.
I am comfortable programming in C, C++, and Java. I want to contribute to
the ffmpeg project. I am familiar with the git workflow but I have never
worked on an actual open source project.
Please tell me how to start contributing to the project.
I have gone through the Developer Documentation on the ffmpeg website.
I have downloaded the current ffmpeg repository but I don't know where to
start reading the code much less contributing to it.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] First Post

2018-02-01 Thread grady player
Probably a good place to start would be:
https://ffmpeg.org/developer.html 
especially:
https://ffmpeg.org/developer.html#Submitting-patches 


as for looking for things to fix, most people add features they are using, or 
fix/enhance functionality they rely on.
if you want to look at bugs:
https://trac.ffmpeg.org/query?status=new&status=open&status=reopened&col=id&col=summary&col=status&col=type&col=component&col=version&col=time&col=changetime&order=priority&report=1
 


and the overall wiki:
https://trac.ffmpeg.org/wiki 

Good luck

- Grady

> On Feb 1, 2018, at 3:25 PM, param mangal  wrote:
> 
> Hello
> I am a student pursuing a Bachelor's degree in Computer Science and
> Engineering.
> I am comfortable programming in C, C++, and Java. I want to contribute to
> the ffmpeg project. I am familiar with the git workflow but I have never
> worked on an actual open source project.
> Please tell me how to start contributing to the project.
> I have gone through the Developer Documentation on the ffmpeg website.
> I have downloaded the current ffmpeg repository but I don't know where to
> start reading the code much less contributing to it.
> ___
> 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 v3 1/6] lavc: add new API for iterating codecs and codec parsers

2018-02-01 Thread Michael Niedermayer
On Thu, Feb 01, 2018 at 08:57:40AM +, Josh de Kock wrote:
> 
> > On 1 Feb 2018, at 03:03, Michael Niedermayer  wrote:
> > 
> >> On Wed, Jan 31, 2018 at 08:25:50PM +, Josh de Kock wrote:
> >> Also replace linked list with an array.
> >> ---
> >> configure  |   12 +-
> >> doc/APIchanges |4 +
> >> libavcodec/.gitignore  |2 +
> >> libavcodec/allcodecs.c | 1473 
> >> 
> >> libavcodec/avcodec.h   |   31 +
> >> libavcodec/parser.c|   84 ++-
> >> libavcodec/utils.c |  112 
> >> libavcodec/version.h   |3 +
> >> 8 files changed, 971 insertions(+), 750 deletions(-)
> > 
> > breaks build
> > simple example:
> > cd buildhere && ../configure && make -j12
> > LDffmpeg_g
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0xd8): undefined reference to 
> > `ff_hap_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4b8): undefined reference 
> > to `ff_libfdk_aac_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4c0): undefined reference 
> > to `ff_libgsm_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4c8): undefined reference 
> > to `ff_libgsm_ms_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4d0): undefined reference 
> > to `ff_libilbc_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4d8): undefined reference 
> > to `ff_libmp3lame_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4e0): undefined reference 
> > to `ff_libopencore_amrnb_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4e8): undefined reference 
> > to `ff_libopenjpeg_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4f0): undefined reference 
> > to `ff_libopus_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4f8): undefined reference 
> > to `ff_libspeex_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x500): undefined reference 
> > to `ff_libtheora_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x508): undefined reference 
> > to `ff_libtwolame_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x510): undefined reference 
> > to `ff_libvo_amrwbenc_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x518): undefined reference 
> > to `ff_libvorbis_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x520): undefined reference 
> > to `ff_libvpx_vp8_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x528): undefined reference 
> > to `ff_libvpx_vp9_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x530): undefined reference 
> > to `ff_libwebp_anim_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x538): undefined reference 
> > to `ff_libwebp_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x540): undefined reference 
> > to `ff_libx264_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x548): undefined reference 
> > to `ff_libx264rgb_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x550): undefined reference 
> > to `ff_libx265_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x558): undefined reference 
> > to `ff_libxavs_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x560): undefined reference 
> > to `ff_libxvid_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x568): undefined reference 
> > to `ff_libopenh264_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x12e8): undefined reference 
> > to `ff_libfdk_aac_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x12f0): undefined reference 
> > to `ff_libgsm_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x12f8): undefined reference 
> > to `ff_libgsm_ms_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1300): undefined reference 
> > to `ff_libilbc_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1308): undefined reference 
> > to `ff_libopencore_amrnb_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1310): undefined reference 
> > to `ff_libopencore_amrwb_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1318): undefined reference 
> > to `ff_libopenjpeg_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1320): undefined reference 
> > to `ff_libopus_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1328): undefined reference 
> > to `ff_libspeex_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1330): undefined reference 
> > to `ff_libvorbis_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1338): undefined reference 
> > to `ff_libvpx_vp8_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1340): undefined reference 
> > to `ff_libvpx_vp9_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1348): undefined reference 
> > to `ff_libzvbi_teletext_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1368): undefined reference 
> > to `ff_libopenh264_decoder'
> > 
> > [...]
> > -- 
> > Michael GnuPG fingerp

[FFmpeg-devel] [V2 PATCH 0/4] Codec wrapper for librv11 and RMHD muxer/demuxer

2018-02-01 Thread Thilo Borgmann
Hi,

V2 adapts to newest SDK beta 0.5 which exports all symbols and changed some 
behavior. Patchset now requires the beta_0_5 version download from: 
http://rmhd.io

Split into four patches now, should still be unusable if applied separately.

PTS issue and linker warning fixed.

Patch 1/4: Factored out all changes to the mux/demux for RMVB (file format 
version 1).
Patch 2/4: Adds RMHD (file format version 2) to the mux/demux, one demuxer
Patch 3/4: Adds librv11 codec wrapper (updated to beta_0_5)
Patch 4/4: Docs & Changelog

Some more details in the corresponding patch mails.

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


[FFmpeg-devel] [V2 PATCH 1/4] lavformat/rm: Add decoding of MLTI chunks, prefer audio, dts for multiple streams, several muxer fixes depending on codec id

2018-02-01 Thread Thilo Borgmann
All of these should be valid for RMVB (file format version 1).

I have no .rm files to test these changes, only .rmhd ones. AAC muxing yet not 
included, requires file format version 2. However, if all muxer changes are 
applied, all existing FATE tests involving .rm muxing/demuxing pass for me.

-Thilo
From c6acdc9eb68b384822345aae7e12e84c05720180 Mon Sep 17 00:00:00 2001
From: Thilo Borgmann 
Date: Fri, 2 Feb 2018 02:48:34 +0100
Subject: [PATCH 1/4] lavformat/rm: Add decoding of MLTI chunks, prefer audio
 dts for multiple streams, several muxer fixes depending on codec id

---
 libavformat/rmdec.c | 35 +++
 libavformat/rmenc.c | 30 +-
 2 files changed, 56 insertions(+), 9 deletions(-)

diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index fea71a2..cf3d545 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -330,7 +330,20 @@ int ff_rm_read_mdpr_codecdata(AVFormatContext *s, 
AVIOContext *pb,
 codec_pos = avio_tell(pb);
 v = avio_rb32(pb);
 
-if (v == MKTAG(0xfd, 'a', 'r', '.')) {
+if (v == MKBETAG('M', 'L', 'T', 'I')) {
+int number_of_streams = avio_rb16(pb);
+int number_of_mdpr;
+int i;
+for (i = 0; i < number_of_streams; i++) {
+avio_rb16(pb);
+}
+number_of_mdpr = avio_rb16(pb);
+if (number_of_mdpr != 1) {
+avpriv_request_sample(s, "MLTI with multiple MDPR");
+}
+avio_rb32(pb);
+v = avio_rb32(pb);
+} else if (v == MKTAG(0xfd, 'a', 'r', '.')) {
 /* ra type header */
 if (rm_read_audio_stream_info(s, pb, st, rst, 0))
 return -1;
@@ -1089,7 +1102,9 @@ static int64_t rm_read_dts(AVFormatContext *s, int 
stream_index,
 {
 RMDemuxContext *rm = s->priv_data;
 int64_t pos, dts;
+int64_t pos_audio, dts_audio;
 int stream_index2, flags, len, h;
+int audio_override = 0;
 
 pos = *ppos;
 
@@ -1114,20 +1129,32 @@ static int64_t rm_read_dts(AVFormatContext *s, int 
stream_index,
 if(!(h & 0x40)){
 seq = avio_r8(s->pb); len--;
 }
+if (!(flags & 2)   ||
+(seq & 0x7F)  != 1 ||
+stream_index2 != stream_index) {
+audio_override = 0;
+}
 }
 
 if((flags&2) && (seq&0x7F) == 1){
 av_log(s, AV_LOG_TRACE, "%d %d-%d %"PRId64" %d\n",
 flags, stream_index2, stream_index, dts, seq);
 av_add_index_entry(st, pos, dts, 0, 0, AVINDEX_KEYFRAME);
-if(stream_index2 == stream_index)
+if(stream_index2 == stream_index) {
+if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
+dts_audio  = dts;
+pos_audio  = pos;
+audio_override = 1;
+}
+
 break;
+}
 }
 
 avio_skip(s->pb, len);
 }
-*ppos = pos;
-return dts;
+*ppos = (audio_override ? pos_audio : pos);
+return (audio_override ? dts_audio : dts);
 }
 
 static int rm_read_seek(AVFormatContext *s, int stream_index,
diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c
index 3bff4da..83b0f3c 100644
--- a/libavformat/rmenc.c
+++ b/libavformat/rmenc.c
@@ -152,7 +152,13 @@ static int rv10_write_header(AVFormatContext *ctx,
 } else {
 desc = "The Video Stream";
 mimetype = "video/x-pn-realvideo";
-codec_data_size = 34;
+if(stream->par->codec_id == AV_CODEC_ID_RV10 ||
+   stream->par->codec_id == AV_CODEC_ID_RV20 ||
+   stream->par->codec_id == AV_CODEC_ID_RV40) {
+codec_data_size = 34;
+} else {
+codec_data_size = 26 + stream->par->extradata_size;
+}
 }
 
 ffio_wfourcc(s,"MDPR");
@@ -245,10 +251,21 @@ static int rv10_write_header(AVFormatContext *ctx,
 /* video codec info */
 avio_wb32(s,34); /* size */
 ffio_wfourcc(s, "VIDO");
-if(stream->par->codec_id == AV_CODEC_ID_RV10)
+switch (stream->par->codec_id) {
+case AV_CODEC_ID_RV10:
 ffio_wfourcc(s,"RV10");
-else
+break;
+case AV_CODEC_ID_RV20:
 ffio_wfourcc(s,"RV20");
+break;
+case AV_CODEC_ID_RV30:
+ffio_wfourcc(s,"RV30");
+break;
+case AV_CODEC_ID_RV40:
+ffio_wfourcc(s,"RV40");
+break;
+}
+
 avio_wb16(s, stream->par->width);
 avio_wb16(s, stream->par->height);
 
@@ -346,8 +363,11 @@ static int rm_write_header(AVFormatContext *s)
 break;
 case AVMEDIA_TYPE_VIDEO:
 rm->video_stream = stream;
-// TODO: should be avg_frame_rate
-stream->frame_rate = av_inv_q(st->ti

[FFmpeg-devel] [V2 PATCH 2/4] Add muxing/demuxing of RMHD

2018-02-01 Thread Thilo Borgmann
Does not add a new demuxer anymore.
For the muxer I'm not sure it should be done - would require more logic to 
check for valid codec ids for both cases I think (like for AAC audio).

-Thilo
From 1e4331416f6d3fb93215530759fe99745c4d91de Mon Sep 17 00:00:00 2001
From: Thilo Borgmann 
Date: Fri, 2 Feb 2018 02:49:22 +0100
Subject: [PATCH 2/4] Add muxing/demuxing of RMHD

---
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/rm.c |   1 +
 libavformat/rm.h |   7 +
 libavformat/rmdec.c  |  50 --
 libavformat/rmenc.c  | 397 +--
 libavformat/utils.c  |   5 +-
 7 files changed, 366 insertions(+), 96 deletions(-)

diff --git a/libavformat/Makefile b/libavformat/Makefile
index de0de92..1bbbe50 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -414,6 +414,7 @@ OBJS-$(CONFIG_REDSPARK_DEMUXER)  += redspark.o
 OBJS-$(CONFIG_RL2_DEMUXER)   += rl2.o
 OBJS-$(CONFIG_RM_DEMUXER)+= rmdec.o rm.o rmsipr.o
 OBJS-$(CONFIG_RM_MUXER)  += rmenc.o rm.o
+OBJS-$(CONFIG_RMHD_MUXER)+= rmenc.o rm.o
 OBJS-$(CONFIG_ROQ_DEMUXER)   += idroqdec.o
 OBJS-$(CONFIG_ROQ_MUXER) += idroqenc.o rawenc.o
 OBJS-$(CONFIG_RSD_DEMUXER)   += rsd.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index ec84096..589e756 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -266,6 +266,7 @@ static void register_all(void)
 REGISTER_DEMUXER (REDSPARK, redspark);
 REGISTER_DEMUXER (RL2,  rl2);
 REGISTER_MUXDEMUX(RM,   rm);
+REGISTER_MUXER   (RMHD, rmhd);
 REGISTER_MUXDEMUX(ROQ,  roq);
 REGISTER_DEMUXER (RPL,  rpl);
 REGISTER_DEMUXER (RSD,  rsd);
diff --git a/libavformat/rm.c b/libavformat/rm.c
index 52c7ccc..a66c9b6 100644
--- a/libavformat/rm.c
+++ b/libavformat/rm.c
@@ -34,6 +34,7 @@ const AVCodecTag ff_rm_codec_tags[] = {
 { AV_CODEC_ID_RV20,   MKTAG('R','V','T','R') },
 { AV_CODEC_ID_RV30,   MKTAG('R','V','3','0') },
 { AV_CODEC_ID_RV40,   MKTAG('R','V','4','0') },
+{ AV_CODEC_ID_RV60,   MKTAG('R','V','6','0') },
 { AV_CODEC_ID_AC3,MKTAG('d','n','e','t') },
 { AV_CODEC_ID_RA_144, MKTAG('l','p','c','J') },
 { AV_CODEC_ID_RA_288, MKTAG('2','8','_','8') },
diff --git a/libavformat/rm.h b/libavformat/rm.h
index 7b080e2..eeb9862 100644
--- a/libavformat/rm.h
+++ b/libavformat/rm.h
@@ -25,6 +25,13 @@
 #include "avformat.h"
 #include "internal.h"
 
+#define DEINT_ID_GENR MKTAG('g', 'e', 'n', 'r') ///< interleaving for 
Cooker/ATRAC
+#define DEINT_ID_INT0 MKTAG('I', 'n', 't', '0') ///< no interleaving needed
+#define DEINT_ID_INT4 MKTAG('I', 'n', 't', '4') ///< interleaving for 28.8
+#define DEINT_ID_SIPR MKTAG('s', 'i', 'p', 'r') ///< interleaving for Sipro
+#define DEINT_ID_VBRF MKTAG('v', 'b', 'r', 'f') ///< VBR case for AAC
+#define DEINT_ID_VBRS MKTAG('v', 'b', 'r', 's') ///< VBR case for AAC
+
 extern const char * const ff_rm_metadata[4];
 extern const AVCodecTag ff_rm_codec_tags[];
 
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index cf3d545..7004e64 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -33,13 +33,6 @@
 #include "rmsipr.h"
 #include "rm.h"
 
-#define DEINT_ID_GENR MKTAG('g', 'e', 'n', 'r') ///< interleaving for 
Cooker/ATRAC
-#define DEINT_ID_INT0 MKTAG('I', 'n', 't', '0') ///< no interleaving needed
-#define DEINT_ID_INT4 MKTAG('I', 'n', 't', '4') ///< interleaving for 28.8
-#define DEINT_ID_SIPR MKTAG('s', 'i', 'p', 'r') ///< interleaving for Sipro
-#define DEINT_ID_VBRF MKTAG('v', 'b', 'r', 'f') ///< VBR case for AAC
-#define DEINT_ID_VBRS MKTAG('v', 'b', 'r', 's') ///< VBR case for AAC
-
 struct RMStream {
 AVPacket pkt;  ///< place to store merged video frame / reordered 
audio data
 int videobufsize;  ///< current assembled frame size
@@ -437,7 +430,8 @@ skip:
 static int rm_read_index(AVFormatContext *s)
 {
 AVIOContext *pb = s->pb;
-unsigned int size, n_pkts, str_id, next_off, n, pos, pts;
+unsigned int size, n_pkts, str_id, n, pts, version;
+uint64_t next_off, pos;
 AVStream *st;
 
 do {
@@ -446,10 +440,10 @@ static int rm_read_index(AVFormatContext *s)
 size = avio_rb32(pb);
 if (size < 20)
 return -1;
-avio_skip(pb, 2);
+version  = avio_rb16(pb);
 n_pkts   = avio_rb32(pb);
 str_id   = avio_rb16(pb);
-next_off = avio_rb32(pb);
+next_off = (version == 2) ? avio_rb64(pb) : avio_rb32(pb);
 for (n = 0; n < s->nb_streams; n++)
 if (s->streams[n]->id == str_id) {
 st = s->streams[n];
@@ -472,7 +466,7 @@ static int rm_read_index(AVFormatContext *s)
 for (n = 0; n < n_pkts; n++) {
 avio_skip(pb, 2);
 pts = avio_rb32(pb);
-pos = avio_rb32(

[FFmpeg-devel] [V2 PATCH 4/4] Add docs and Changelog

2018-02-01 Thread Thilo Borgmann
...

-Thilo
From f464bb688dd966fb12a1b678f71109601d1e235a Mon Sep 17 00:00:00 2001
From: Thilo Borgmann 
Date: Fri, 2 Feb 2018 02:52:08 +0100
Subject: [PATCH 4/4] Add docs and Changelog

---
 Changelog |  2 ++
 doc/encoders.texi | 92 +++
 doc/general.texi  |  7 +
 3 files changed, 101 insertions(+)

diff --git a/Changelog b/Changelog
index 7a73447..4dfecac 100644
--- a/Changelog
+++ b/Changelog
@@ -39,6 +39,8 @@ version :
 - Removed the ffmenc and ffmdec muxer and demuxer
 - VideoToolbox HEVC encoder and hwaccel
 - VAAPI-accelerated ProcAmp (color balance), denoise and sharpness filters
+- RMHD Muxer/Demuxer
+- RealVideo 11 support via librv11
 
 
 version 3.4:
diff --git a/doc/encoders.texi b/doc/encoders.texi
index 6a410a8..ccdaba5 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1452,6 +1452,98 @@ Set maximum NAL size in bytes.
 Allow skipping frames to hit the target bitrate if set to 1.
 @end table
 
+@section librv11
+
+RealVideo 11 (RV60) codec wrapper.
+
+Requires the presence of the librv11 SDK headers and
+libraries during configuration. The library is detected using
+@command{pkg-config}.
+
+For more information about the library see
+@url{http://www.rmhd.io/}.
+
+@subsection Options
+
+The following FFmpeg global options affect the configurations of the
+librv11 encoder.
+
+@table @option
+@item b
+Set the bitrate (as a number of bits per second).
+
+@item is_lossprotect
+Enable loss protection feature
+
+@item output_width
+Video encoded frame output width
+
+@item output_height
+Video encoded frame output height
+
+@item rc_strategy
+Which ratecontrol method to be used (default: bitrate)
+
+@table @samp
+@item bitrate
+@item quality
+@end table
+
+@item complexity
+Encoding complexity (default: medium)
+
+@table @samp
+@item verylow
+@item low
+@item medium
+@item high
+@end table
+
+@item framerate
+Max frame rate value
+
+@item resize_quality
+Video encoded frame resize quality (default: 1),
+
+@table @samp
+@item high
+@item fast
+@end table
+
+@item video_mode
+Motion quality (default: 50)
+
+@table @samp
+@item normal
+@item sharp
+@item smooth
+@end table
+
+@item max_keyint
+Max keyframe interval (default: 5),
+
+@item max_latency
+Max video latency on start (default: 4.0)
+
+@item vbrquality
+Vbr quality value (default: 60)
+
+@item passlogfile
+Filename for 2 pass encoding stats (default: rv11passstats.log)
+
+@item pon
+Picture order number (default: 0)
+
+@item vbr_opt (default: false)
+Vbr enabled
+
+@table @samp
+@item true
+@item false
+@end table
+
+@end table
+
 @section libtheora
 
 libtheora Theora encoder wrapper.
diff --git a/doc/general.texi b/doc/general.texi
index 3b73e31..a5b7aa9 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -237,6 +237,12 @@ Create an @code{AMF/} directory in the system include path.
 Copy the contents of @code{AMF/amf/public/include/} into that directory.
 Then configure FFmpeg with @code{--enable-amf}.
 
+@section RealVideo11 (RV60)
+
+FFmpeg can make use of the RV11 codec libraries for encoding and decoding.
+
+Go to @url{http://www.rmhd.io/} and download the SDK installer.
+
 
 @chapter Supported File Formats, Codecs or Features
 
@@ -510,6 +516,7 @@ library:
 @item REDCODE R3D   @tab   @tab X
 @tab File format used by RED Digital cameras, contains JPEG 2000 frames 
and PCM audio.
 @item RealMedia @tab X @tab X
+@item RealMedia HD  @tab X @tab X
 @item Redirector@tab   @tab X
 @item RedSpark  @tab   @tab X
 @item Renderware TeXture Dictionary @tab   @tab X
-- 
2.9.3

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


[FFmpeg-devel] [PATCH] libavformat/aac: Parse ID3 tags between ADTS frames.

2018-02-01 Thread rshaffer
From: Richard Shaffer 

While rare, ID3 tags may be inserted between ADTS frames. This change enables
parsing them and setting the appropriate metadata updated event flag.
---
I have encountered a streaming provider that I must support which does this.
There are indications that it isn't totally off the wall, and that it does
happen in the wild:
* https://www.w3.org/TR/mse-byte-stream-format-mpeg-audio/
  (See specifically sections 3 and 4.)
* https://github.com/video-dev/hls.js/issues/508

That being said, the providers that do this are in the minority. It seems most
streaming providers will do one of the following:
 1. If using .aac segments inside of HLS, use the #EXTINF for text metadata and
use an ID3 tag at the head of the segment for things like timing metadata.
 2. If streaming raw AAC over HTTP, use Icy metadata.

Aside from comments on the code, I'd be interested in any opinion about whether
this is something that should or should not be supported in libavformat.

Thanks,

-Richard

 libavformat/aacdec.c | 45 +++--
 1 file changed, 43 insertions(+), 2 deletions(-)

diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c
index 36d558ff54..5ec706bdc7 100644
--- a/libavformat/aacdec.c
+++ b/libavformat/aacdec.c
@@ -22,8 +22,10 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "avio_internal.h"
 #include "internal.h"
 #include "id3v1.h"
+#include "id3v2.h"
 #include "apetag.h"
 
 #define ADTS_HEADER_SIZE 7
@@ -116,13 +118,52 @@ static int adts_aac_read_header(AVFormatContext *s)
 return 0;
 }
 
+static int handle_id3(AVFormatContext *s, AVPacket *pkt)
+{
+AVDictionary *metadata = NULL;
+AVIOContext ioctx;
+ID3v2ExtraMeta *id3v2_extra_meta = NULL;
+int ret;
+
+ret = av_append_packet(s->pb, pkt, ff_id3v2_tag_len(pkt->data) - 
pkt->size);
+if (ret < 0) {
+av_packet_unref(pkt);
+return ret;
+}
+
+ffio_init_context(&ioctx, pkt->data, pkt->size, 0, NULL, NULL, NULL, NULL);
+ff_id3v2_read_dict(&ioctx, &metadata, ID3v2_DEFAULT_MAGIC, 
&id3v2_extra_meta);
+if ((ret = ff_id3v2_parse_priv_dict(&metadata, &id3v2_extra_meta)) < 0)
+goto error;
+
+if (metadata) {
+if ((ret = av_dict_copy(&s->metadata, metadata, 0)) < 0)
+goto error;
+s->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
+}
+
+error:
+av_packet_unref(pkt);
+ff_id3v2_free_extra_meta(&id3v2_extra_meta);
+av_dict_free(&metadata);
+
+return ret;
+}
+
 static int adts_aac_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
 int ret, fsize;
 
-ret = av_get_packet(s->pb, pkt, ADTS_HEADER_SIZE);
+ret = av_get_packet(s->pb, pkt, FFMAX(ID3v2_HEADER_SIZE, 
ADTS_HEADER_SIZE));
+
+if (ret >= ID3v2_HEADER_SIZE && ff_id3v2_match(pkt->data, 
ID3v2_DEFAULT_MAGIC)) {
+if ((ret = handle_id3(s, pkt)) >= 0)
+ret = av_get_packet(s->pb, pkt, ADTS_HEADER_SIZE);
+}
+
 if (ret < 0)
 return ret;
+
 if (ret < ADTS_HEADER_SIZE) {
 av_packet_unref(pkt);
 return AVERROR(EIO);
@@ -139,7 +180,7 @@ static int adts_aac_read_packet(AVFormatContext *s, 
AVPacket *pkt)
 return AVERROR_INVALIDDATA;
 }
 
-ret = av_append_packet(s->pb, pkt, fsize - ADTS_HEADER_SIZE);
+ret = av_append_packet(s->pb, pkt, fsize - pkt->size);
 if (ret < 0)
 av_packet_unref(pkt);
 
-- 
2.14.3 (Apple Git-98)

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


[FFmpeg-devel] [V2 PATCH 3/4] Add codec wrapper for librv11

2018-02-01 Thread Thilo Borgmann
Moved to non-free.
Symbols handled at compile time, no more dlsym fun.
Merged into one ENCDEC.

-Thilo
From f27957382ffb729a2454914bcd3a99554d6dff0d Mon Sep 17 00:00:00 2001
From: Thilo Borgmann 
Date: Fri, 2 Feb 2018 02:51:14 +0100
Subject: [PATCH 3/4] Add codec wrapper for librv11

---
 MAINTAINERS |   1 +
 configure   |   5 +
 fftools/ffmpeg_opt.c|   2 +-
 libavcodec/Makefile |   2 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/avcodec.h|   1 +
 libavcodec/codec_desc.c |   7 +
 libavcodec/librv11.h|  55 
 libavcodec/librv11dec.c | 296 ++
 libavcodec/librv11enc.c | 649 
 libavcodec/version.h|   2 +-
 11 files changed, 1019 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/librv11.h
 create mode 100644 libavcodec/librv11dec.c
 create mode 100644 libavcodec/librv11enc.c

diff --git a/MAINTAINERS b/MAINTAINERS
index ba7a728..d07fa75 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -192,6 +192,7 @@ Codecs:
   libkvazaar.c  Arttu Ylä-Outinen
   libopenjpeg.c Jaikrishnan Menon
   libopenjpegenc.c  Michael Bradshaw
+  librv11*  Thilo Borgmann, Qiang Luo
   libtheoraenc.cDavid Conrad
   libvorbis.c   David Conrad
   libvpx*   James Zern
diff --git a/configure b/configure
index 0b01a22..9cc78da 100755
--- a/configure
+++ b/configure
@@ -250,6 +250,7 @@ External library support:
   --enable-librsvg enable SVG rasterization via librsvg [no]
   --enable-librubberband   enable rubberband needed for rubberband filter [no]
   --enable-librtmp enable RTMP[E] support via librtmp [no]
+  --enable-librv11 enable RV11 support via librv11 [no]
   --enable-libshineenable fixed-point MP3 encoding via libshine [no]
   --enable-libsmbclientenable Samba protocol via libsmbclient [no]
   --enable-libsnappy   enable Snappy compression, needed for hap encoding 
[no]
@@ -1565,6 +1566,7 @@ EXTERNAL_LIBRARY_NONFREE_LIST="
 libndi_newtek
 libfdk_aac
 openssl
+librv11
 libtls
 "
 
@@ -2959,6 +2961,8 @@ libopus_decoder_deps="libopus"
 libopus_encoder_deps="libopus"
 libopus_encoder_select="audio_frame_queue"
 librsvg_decoder_deps="librsvg"
+librv11_decoder_deps="librv11"
+librv11_encoder_deps="librv11"
 libshine_encoder_deps="libshine"
 libshine_encoder_select="audio_frame_queue"
 libspeex_decoder_deps="libspeex"
@@ -5893,6 +5897,7 @@ enabled libpulse  && require_pkg_config libpulse 
libpulse pulse/pulseaud
 enabled librsvg   && require_pkg_config librsvg librsvg-2.0 
librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
 enabled librtmp   && require_pkg_config librtmp librtmp librtmp/rtmp.h 
RTMP_Socket
 enabled librubberband && require_pkg_config librubberband "rubberband >= 
1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append 
librubberband_extralibs "-lstdc++"
+enabled librv11   && require_pkg_config librv11 librv11 librv11_sdk.h 
RV60toYUV420Init
 enabled libshine  && require_pkg_config libshine shine shine/layer3.h 
shine_encode_buffer
 enabled libsmbclient  && { check_pkg_config libsmbclient smbclient 
libsmbclient.h smbc_init ||
require libsmbclient libsmbclient.h smbc_init 
-lsmbclient; }
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 997d538..0f88786 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1747,7 +1747,7 @@ static OutputStream *new_video_stream(OptionsContext *o, 
AVFormatContext *oc, in
  ost->logfile_prefix ? ost->logfile_prefix :
DEFAULT_PASS_LOGFILENAME_PREFIX,
  i);
-if (!strcmp(ost->enc->name, "libx264")) {
+if (!strcmp(ost->enc->name, "libx264") || !strcmp(ost->enc->name, 
"librv11enc")) {
 av_dict_set(&ost->encoder_opts, "stats", logfilename, 
AV_DICT_DONT_OVERWRITE);
 } else {
 if (video_enc->flags & AV_CODEC_FLAG_PASS2) {
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 68777d9..ad7b9cd 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -948,6 +948,8 @@ OBJS-$(CONFIG_LIBOPUS_DECODER)+= libopusdec.o 
libopus.o \
  vorbis_data.o
 OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \
  vorbis_data.o
+OBJS-$(CONFIG_LIBRV11_DECODER)+= librv11dec.o
+OBJS-$(CONFIG_LIBRV11_ENCODER)+= librv11enc.o
 OBJS-$(CONFIG_LIBSHINE_ENCODER)   += libshine.o
 OBJS-$(CONFIG_LIBSPEEX_DECODER)   += libspeexdec.o
 OBJS-$(CONFIG_LIBSPEEX_ENCODER)   += libspeexenc.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c

[FFmpeg-devel] [PATCH] libavformat/hls: Support metadata updates from subdemuxers

2018-02-01 Thread rshaffer
From: Richard Shaffer 

If a subdemuxer has the updated metadata event flag set, the metadata is copied
to the corresponding stream. The flag is cleared on the subdemuxer and the
appropriate event flag is set on the stream.
---
This is semi-related to a patch I recently sent to enable parsing ID3 tags from
.aac files between ADTS headers. However, it may be generically useful for
other segment formats that support metadata updates.

-Richard

 libavformat/hls.c | 38 ++
 1 file changed, 38 insertions(+)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 9bd54c84cc..e48845de34 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1062,6 +1062,7 @@ static void handle_id3(AVIOContext *pb, struct playlist 
*pls)
 /* demuxer not yet opened, defer picture attachment */
 pls->id3_deferred_extra = extra_meta;
 
+ff_id3v2_parse_priv_dict(&metadata, &extra_meta);
 av_dict_copy(&pls->ctx->metadata, metadata, 0);
 pls->id3_initial = metadata;
 
@@ -1589,6 +1590,34 @@ static void add_metadata_from_renditions(AVFormatContext 
*s, struct playlist *pl
 }
 }
 
+/* update metadata on main streams, if necessary */
+static void update_metadata_from_subdemuxer(struct playlist *pls, int 
ignore_flags) {
+int i;
+
+if (pls->n_main_streams) {
+AVStream *st = pls->main_streams[0];
+if (ignore_flags) {
+av_dict_copy(&st->metadata, pls->ctx->metadata, 0);
+} else if (pls->ctx->event_flags & AVFMT_EVENT_FLAG_METADATA_UPDATED) {
+av_dict_copy(&st->metadata, pls->ctx->metadata, 0);
+pls->ctx->event_flags &= ~AVFMT_EVENT_FLAG_METADATA_UPDATED;
+st->event_flags |= AVSTREAM_EVENT_FLAG_METADATA_UPDATED;
+}
+}
+
+for (i = 0; i < pls->ctx->nb_streams; i++) {
+AVStream *ist = pls->ctx->streams[i];
+AVStream *st = pls->main_streams[i];
+if (ignore_flags) {
+av_dict_copy(&st->metadata, ist->metadata, 0);
+} else if (ist->event_flags & AVSTREAM_EVENT_FLAG_METADATA_UPDATED) {
+av_dict_copy(&st->metadata, ist->metadata, 0);
+ist->event_flags &= ~AVSTREAM_EVENT_FLAG_METADATA_UPDATED;
+st->event_flags |= AVSTREAM_EVENT_FLAG_METADATA_UPDATED;
+}
+}
+}
+
 /* if timestamp was in valid range: returns 1 and sets seq_no
  * if not: returns 0 and sets seq_no to closest segment */
 static int find_timestamp_in_playlist(HLSContext *c, struct playlist *pls,
@@ -1960,6 +1989,7 @@ static int hls_read_header(AVFormatContext *s)
 if (pls->id3_deferred_extra && pls->ctx->nb_streams == 1) {
 ff_id3v2_parse_apic(pls->ctx, &pls->id3_deferred_extra);
 avformat_queue_attached_pictures(pls->ctx);
+ff_id3v2_parse_priv(pls->ctx, &pls->id3_deferred_extra);
 ff_id3v2_free_extra_meta(&pls->id3_deferred_extra);
 pls->id3_deferred_extra = NULL;
 }
@@ -1986,6 +2016,12 @@ static int hls_read_header(AVFormatContext *s)
 if (ret < 0)
 goto fail;
 
+/*
+ * Copy any metadata from playlist to main streams, but do not set
+ * event flags.
+ */
+update_metadata_from_subdemuxer(pls, 1);
+
 add_metadata_from_renditions(s, pls, AVMEDIA_TYPE_AUDIO);
 add_metadata_from_renditions(s, pls, AVMEDIA_TYPE_VIDEO);
 add_metadata_from_renditions(s, pls, AVMEDIA_TYPE_SUBTITLE);
@@ -2170,6 +2206,8 @@ static int hls_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 return ret;
 }
 
+update_metadata_from_subdemuxer(pls, 0);
+
 /* check if noheader flag has been cleared by the subdemuxer */
 if (pls->has_noheader_flag && !(pls->ctx->ctx_flags & 
AVFMTCTX_NOHEADER)) {
 pls->has_noheader_flag = 0;
-- 
2.14.3 (Apple Git-98)

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


Re: [FFmpeg-devel] [PATCH] avfilter: sort filter list

2018-02-01 Thread Michael Niedermayer
On Fri, Feb 02, 2018 at 01:29:54AM +0700, Muhammad Faiz wrote:
> Move REGISTER_FILTER to FILTER_TABLE in configure.
> Replace linked list with static table, and sort it.
> Use bsearch() on avfilter_get_by_name().
> Deprecate avfilter_register_all(), avfilter_register(), and
> avfilter_next().
> Add avfilter_iterate() as a replacement for avfilter_next().
> 
> Signed-off-by: Muhammad Faiz 
> ---
>  Makefile |   5 +-
>  configure| 428 -
>  doc/APIchanges   |   4 +
>  libavfilter/allfilters.c | 441 
> ++-
>  libavfilter/avfilter.c   |  65 ++-
>  libavfilter/avfilter.h   |  20 ++-
>  libavfilter/buffersink.c |   4 +-
>  libavfilter/version.h|  10 +-
>  tests/checkasm/Makefile  |   2 +-
>  9 files changed, 532 insertions(+), 447 deletions(-)

this seems breaking make fate-checkasm

./configure --enable-libsoxr && make fate-checkasm -j12
...
LD  tests/checkasm/checkasm
libswresample/libswresample.a(soxr_resample.o): In function `get_out_samples':
libswresample/soxr_resample.c:118: undefined reference to `soxr_delay'
libswresample/libswresample.a(soxr_resample.o): In function `get_delay':
libswresample/soxr_resample.c:100: undefined reference to `soxr_delay'
libswresample/libswresample.a(soxr_resample.o): In function `flush':
libswresample/soxr_resample.c:70: undefined reference to `soxr_delay'
libswresample/soxr_resample.c:72: undefined reference to `soxr_process'
libswresample/soxr_resample.c:77: undefined reference to `soxr_process'
libswresample/soxr_resample.c:78: undefined reference to `soxr_delay'
libswresample/libswresample.a(soxr_resample.o): In function `process':
libswresample/soxr_resample.c:88: undefined reference to `soxr_set_num_channels'
libswresample/soxr_resample.c:88: undefined reference to `soxr_set_error'
libswresample/soxr_resample.c:90: undefined reference to `soxr_process'
libswresample/libswresample.a(soxr_resample.o): In function `destroy':
libswresample/soxr_resample.c:65: undefined reference to `soxr_delete'
libswresample/libswresample.a(soxr_resample.o): In function `create':
libswresample/soxr_resample.c:46: undefined reference to `soxr_io_spec'
libswresample/soxr_resample.c:48: undefined reference to `soxr_quality_spec'
libswresample/soxr_resample.c:56: undefined reference to `soxr_delete'
libswresample/soxr_resample.c:57: undefined reference to `soxr_create'
collect2: error: ld returned 1 exit status
make: *** [tests/checkasm/checkasm] Error 1

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

The worst form of inequality is to try to make unequal things equal.
-- Aristotle


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


Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to AVCodecParameters

2018-02-01 Thread Li, Zhong
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Li, Zhong
> Sent: Tuesday, January 30, 2018 10:06 AM
> To: FFmpeg development discussions and patches
> 
> Subject: Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to
> AVCodecParameters
> 
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> Behalf
> > Of Michael Niedermayer
> > Sent: Friday, January 26, 2018 11:56 PM
> > To: FFmpeg development discussions and patches
> > 
> > Subject: Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to
> > AVCodecParameters
> >
> > On Fri, Jan 19, 2018 at 01:15:13PM -0300, James Almer wrote:
> > > On 1/19/2018 7:12 AM, Hendrik Leppkes wrote:
> > > > On Fri, Jan 19, 2018 at 4:19 AM, Li, Zhong  wrote:
> > > >>> -Original Message-
> > > >>> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> > > >>> Behalf Of James Almer
> > > >>> Sent: Thursday, January 18, 2018 1:15 PM
> > > >>> To: ffmpeg-devel@ffmpeg.org
> > > >>> Subject: Re: [FFmpeg-devel] [PATCH 1/2] lavc: Add coded_w/h to
> > > >>> AVCodecParameters
> > > >>>
> > > >>> On 1/18/2018 2:03 AM, Zhong Li wrote:
> > >  coded_width/height may be different from width/height sometimes
> > > >>>
> > >  (e.g, crop or lowres cases).
> > > >>>
> > > >>> Which is why it's not a field that belongs to AVCodecParameters.
> > > >>>
> > > >>> Codec level cropping has nothing to do with containers. Same
> > > >>> with lowres, which is an internal feature, and scheduled for removal.
> > > >>
> > > >> Got it. How about fixing ticket #6958 as below?
> > > >>
> > > >> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index
> > > >> 0e7a771..233760d 100644
> > > >> --- a/fftools/ffprobe.c
> > > >> +++ b/fftools/ffprobe.c
> > > >> @@ -2512,10 +2512,12 @@ static int show_stream(WriterContext
> *w,
> > AVFormatContext *fmt_ctx, int stream_id
> > > >>  case AVMEDIA_TYPE_VIDEO:
> > > >>  print_int("width",par->width);
> > > >>  print_int("height",   par->height);
> > > >> +#if FF_API_LAVF_AVCTX
> > > >>  if (dec_ctx) {
> > > >>  print_int("coded_width",  dec_ctx->coded_width);
> > > >>  print_int("coded_height", dec_ctx->coded_height);
> > > >>  }
> > > >> +#endif
> > > >>  print_int("has_b_frames", par->video_delay);
> > > >>  sar = av_guess_sample_aspect_ratio(fmt_ctx, stream,
> > NULL);
> > > >>  if (sar.den) {
> > > >> @@ -2912,6 +2914,10 @@ static int open_input_file(InputFile
> > > >> *ifile, const char *filename)
> > > >>
> > > >>  ist->dec_ctx->pkt_timebase = stream->time_base;
> > > >>  ist->dec_ctx->framerate = stream->avg_frame_rate;
> > > >> +#if FF_API_LAVF_AVCTX
> > > >> +ist->dec_ctx->coded_width =
> > stream->codec->coded_width;
> > > >> +ist->dec_ctx->coded_height =
> > > >> +stream->codec->coded_height; #endif
> > > >>
> > > >
> > > > As mentioned in the thread for that patch already, writing new
> > > > code using deprecated API should really be avoided.
> > > >
> > > > The way I see it, if someone really needs to know coded w/h (which
> > > > is typically an internal technical detail of no relevance to
> > > > users), they should decode a frame and get it from the decoder.
> > > >
> > > > - Hendrik
> > >
> > > This specific approach is IMO acceptable. It basically recovers the
> > > pre-codecpar behavior until AVStream->codec is removed, and
> > > effectively fixes the "regression".
> > > Once that's gone, ffprobe will stop reporting coded_width/height
> > > altogether instead of doing so with a bogus value, as everything is
> > > being wrapped in the proper checks.
> >
> > +1
> >
> > [...]
> > --
> > Michael GnuPG fingerprint:
> > 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> Thanks for Hendrik/James/ Michael's review.
> Will this patch be applied? (Another thread maybe easier to apply:
> https://patchwork.ffmpeg.org/patch/7344/ )

Ping.
I see the priority of ticket #6958 has been set as "important". 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Hardware encoder ARM input as device input

2018-02-01 Thread wm4
On Thu, 1 Feb 2018 07:48:27 +0100
Marcin Woźniak  wrote:

> Hello,
> I try to implement an HiSilicon H264 encoder direct input as ffmpeg 
> libavdevice source (someking like V4L linux for cameras with H264 source 
> driver).
> I successfully recieve H264 packets with NAL units and set correct PTS 
> according to source packet.

Not sure what you're trying to do, but an encoder in libavdevice
seems to make little sense. Also there's already a v4l encoder wrapper
in libavcodec. If the ARM thing uses v4l, did you try that one?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavformat/aac: Parse ID3 tags between ADTS frames.

2018-02-01 Thread wm4
On Thu,  1 Feb 2018 18:37:45 -0800
rshaf...@tunein.com wrote:

> From: Richard Shaffer 
> 
> While rare, ID3 tags may be inserted between ADTS frames. This change enables
> parsing them and setting the appropriate metadata updated event flag.
> ---
> I have encountered a streaming provider that I must support which does this.
> There are indications that it isn't totally off the wall, and that it does
> happen in the wild:
> * https://www.w3.org/TR/mse-byte-stream-format-mpeg-audio/
>   (See specifically sections 3 and 4.)
> * https://github.com/video-dev/hls.js/issues/508
> 
> That being said, the providers that do this are in the minority. It seems most
> streaming providers will do one of the following:
>  1. If using .aac segments inside of HLS, use the #EXTINF for text metadata 
> and
> use an ID3 tag at the head of the segment for things like timing metadata.
>  2. If streaming raw AAC over HTTP, use Icy metadata.
> 
> Aside from comments on the code, I'd be interested in any opinion about 
> whether
> this is something that should or should not be supported in libavformat.
> 
> Thanks,
> 
> -Richard
> 
>  libavformat/aacdec.c | 45 +++--
>  1 file changed, 43 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c
> index 36d558ff54..5ec706bdc7 100644
> --- a/libavformat/aacdec.c
> +++ b/libavformat/aacdec.c
> @@ -22,8 +22,10 @@
>  
>  #include "libavutil/intreadwrite.h"
>  #include "avformat.h"
> +#include "avio_internal.h"
>  #include "internal.h"
>  #include "id3v1.h"
> +#include "id3v2.h"
>  #include "apetag.h"
>  
>  #define ADTS_HEADER_SIZE 7
> @@ -116,13 +118,52 @@ static int adts_aac_read_header(AVFormatContext *s)
>  return 0;
>  }
>  
> +static int handle_id3(AVFormatContext *s, AVPacket *pkt)
> +{
> +AVDictionary *metadata = NULL;
> +AVIOContext ioctx;
> +ID3v2ExtraMeta *id3v2_extra_meta = NULL;
> +int ret;
> +
> +ret = av_append_packet(s->pb, pkt, ff_id3v2_tag_len(pkt->data) - 
> pkt->size);
> +if (ret < 0) {
> +av_packet_unref(pkt);
> +return ret;
> +}
> +
> +ffio_init_context(&ioctx, pkt->data, pkt->size, 0, NULL, NULL, NULL, 
> NULL);
> +ff_id3v2_read_dict(&ioctx, &metadata, ID3v2_DEFAULT_MAGIC, 
> &id3v2_extra_meta);
> +if ((ret = ff_id3v2_parse_priv_dict(&metadata, &id3v2_extra_meta)) < 0)
> +goto error;
> +
> +if (metadata) {
> +if ((ret = av_dict_copy(&s->metadata, metadata, 0)) < 0)
> +goto error;

AFAIK that would merge the existing metadata with the new one (i.e. not
delete entries that are in the new metadata). But not sure if this is
intended, or how exactly it should work. Intuitively I'd say it should
completely replace previous ID3v2s.

> +s->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
> +}
> +
> +error:
> +av_packet_unref(pkt);
> +ff_id3v2_free_extra_meta(&id3v2_extra_meta);
> +av_dict_free(&metadata);
> +
> +return ret;
> +}
> +
>  static int adts_aac_read_packet(AVFormatContext *s, AVPacket *pkt)
>  {
>  int ret, fsize;
>  
> -ret = av_get_packet(s->pb, pkt, ADTS_HEADER_SIZE);
> +ret = av_get_packet(s->pb, pkt, FFMAX(ID3v2_HEADER_SIZE, 
> ADTS_HEADER_SIZE));
> +
> +if (ret >= ID3v2_HEADER_SIZE && ff_id3v2_match(pkt->data, 
> ID3v2_DEFAULT_MAGIC)) {
> +if ((ret = handle_id3(s, pkt)) >= 0)
> +ret = av_get_packet(s->pb, pkt, ADTS_HEADER_SIZE);
> +}
> +
>  if (ret < 0)
>  return ret;
> +
>  if (ret < ADTS_HEADER_SIZE) {
>  av_packet_unref(pkt);
>  return AVERROR(EIO);
> @@ -139,7 +180,7 @@ static int adts_aac_read_packet(AVFormatContext *s, 
> AVPacket *pkt)
>  return AVERROR_INVALIDDATA;
>  }
>  
> -ret = av_append_packet(s->pb, pkt, fsize - ADTS_HEADER_SIZE);
> +ret = av_append_packet(s->pb, pkt, fsize - pkt->size);
>  if (ret < 0)
>  av_packet_unref(pkt);
>  

I think that's the right approach. The demuxer should filter out such
tags, and exporting them to the API user is a good idea too.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavformat/hls: Support metadata updates from subdemuxers

2018-02-01 Thread wm4
On Thu,  1 Feb 2018 18:44:34 -0800
rshaf...@tunein.com wrote:

> From: Richard Shaffer 
> 
> If a subdemuxer has the updated metadata event flag set, the metadata is 
> copied
> to the corresponding stream. The flag is cleared on the subdemuxer and the
> appropriate event flag is set on the stream.
> ---
> This is semi-related to a patch I recently sent to enable parsing ID3 tags 
> from
> .aac files between ADTS headers. However, it may be generically useful for
> other segment formats that support metadata updates.
> 
> -Richard
> 
>  libavformat/hls.c | 38 ++
>  1 file changed, 38 insertions(+)
> 
> diff --git a/libavformat/hls.c b/libavformat/hls.c
> index 9bd54c84cc..e48845de34 100644
> --- a/libavformat/hls.c
> +++ b/libavformat/hls.c
> @@ -1062,6 +1062,7 @@ static void handle_id3(AVIOContext *pb, struct playlist 
> *pls)
>  /* demuxer not yet opened, defer picture attachment */
>  pls->id3_deferred_extra = extra_meta;
>  
> +ff_id3v2_parse_priv_dict(&metadata, &extra_meta);
>  av_dict_copy(&pls->ctx->metadata, metadata, 0);
>  pls->id3_initial = metadata;
>  
> @@ -1589,6 +1590,34 @@ static void 
> add_metadata_from_renditions(AVFormatContext *s, struct playlist *pl
>  }
>  }
>  
> +/* update metadata on main streams, if necessary */
> +static void update_metadata_from_subdemuxer(struct playlist *pls, int 
> ignore_flags) {

Normally we put the { on a separate line for functions.

> +int i;
> +
> +if (pls->n_main_streams) {
> +AVStream *st = pls->main_streams[0];
> +if (ignore_flags) {
> +av_dict_copy(&st->metadata, pls->ctx->metadata, 0);
> +} else if (pls->ctx->event_flags & 
> AVFMT_EVENT_FLAG_METADATA_UPDATED) {
> +av_dict_copy(&st->metadata, pls->ctx->metadata, 0);
> +pls->ctx->event_flags &= ~AVFMT_EVENT_FLAG_METADATA_UPDATED;
> +st->event_flags |= AVSTREAM_EVENT_FLAG_METADATA_UPDATED;
> +}

I don't get understand this: why only stream 0? Isn't this done below
already?

> +}
> +
> +for (i = 0; i < pls->ctx->nb_streams; i++) {
> +AVStream *ist = pls->ctx->streams[i];
> +AVStream *st = pls->main_streams[i];
> +if (ignore_flags) {
> +av_dict_copy(&st->metadata, ist->metadata, 0);
> +} else if (ist->event_flags & AVSTREAM_EVENT_FLAG_METADATA_UPDATED) {
> +av_dict_copy(&st->metadata, ist->metadata, 0);
> +ist->event_flags &= ~AVSTREAM_EVENT_FLAG_METADATA_UPDATED;
> +st->event_flags |= AVSTREAM_EVENT_FLAG_METADATA_UPDATED;
> +}
> +}
> +}

Like mentioned in the other patch, av_dict_copy not clearing the target
dict might be unintended.

> +
>  /* if timestamp was in valid range: returns 1 and sets seq_no
>   * if not: returns 0 and sets seq_no to closest segment */
>  static int find_timestamp_in_playlist(HLSContext *c, struct playlist *pls,
> @@ -1960,6 +1989,7 @@ static int hls_read_header(AVFormatContext *s)
>  if (pls->id3_deferred_extra && pls->ctx->nb_streams == 1) {
>  ff_id3v2_parse_apic(pls->ctx, &pls->id3_deferred_extra);
>  avformat_queue_attached_pictures(pls->ctx);
> +ff_id3v2_parse_priv(pls->ctx, &pls->id3_deferred_extra);
>  ff_id3v2_free_extra_meta(&pls->id3_deferred_extra);
>  pls->id3_deferred_extra = NULL;
>  }
> @@ -1986,6 +2016,12 @@ static int hls_read_header(AVFormatContext *s)
>  if (ret < 0)
>  goto fail;
>  
> +/*
> + * Copy any metadata from playlist to main streams, but do not set
> + * event flags.
> + */
> +update_metadata_from_subdemuxer(pls, 1);
> +

Possibly would be nicer to drop the ignore_flags parameter, and just
unset the event flag at the end of read_header (maybe even in generic
code).

>  add_metadata_from_renditions(s, pls, AVMEDIA_TYPE_AUDIO);
>  add_metadata_from_renditions(s, pls, AVMEDIA_TYPE_VIDEO);
>  add_metadata_from_renditions(s, pls, AVMEDIA_TYPE_SUBTITLE);
> @@ -2170,6 +2206,8 @@ static int hls_read_packet(AVFormatContext *s, AVPacket 
> *pkt)
>  return ret;
>  }
>  
> +update_metadata_from_subdemuxer(pls, 0);
> +
>  /* check if noheader flag has been cleared by the subdemuxer */
>  if (pls->has_noheader_flag && !(pls->ctx->ctx_flags & 
> AVFMTCTX_NOHEADER)) {
>  pls->has_noheader_flag = 0;

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


[FFmpeg-devel] [PATCH] qsvenc: AVBR is not supported on non-windows OS

2018-02-01 Thread Zhong Li
Encoding failed when disable look_ahead on Linux

See: ./ffmpeg -i in.h264 -vcodec h264_qsv -look_ahead 0 out.h264
(reported:"Selected ratecontrol mode is not supported by the QSV runtime".)

It is due to AVBR is supported from API 1.3 but only available for Windows

Signed-off-by: Zhong Li 
---
 libavcodec/qsvenc.c | 17 ++---
 libavcodec/qsvenc.h |  2 ++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index fee2f9f..74c273c 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -85,7 +85,9 @@ static const struct {
 { MFX_RATECONTROL_CBR, "CBR" },
 { MFX_RATECONTROL_VBR, "VBR" },
 { MFX_RATECONTROL_CQP, "CQP" },
+#if QSV_HAVE_AVBR
 { MFX_RATECONTROL_AVBR,"AVBR" },
+#endif
 #if QSV_HAVE_LA
 { MFX_RATECONTROL_LA,  "LA" },
 #endif
@@ -161,11 +163,14 @@ static void dump_video_param(AVCodecContext *avctx, 
QSVEncContext *q,
 } else if (info->RateControlMethod == MFX_RATECONTROL_CQP) {
 av_log(avctx, AV_LOG_VERBOSE, "QPI: %"PRIu16"; QPP: %"PRIu16"; QPB: 
%"PRIu16"\n",
info->QPI, info->QPP, info->QPB);
-} else if (info->RateControlMethod == MFX_RATECONTROL_AVBR) {
+}
+#if QSV_HAVE_AVBR
+else if (info->RateControlMethod == MFX_RATECONTROL_AVBR) {
 av_log(avctx, AV_LOG_VERBOSE,
"TargetKbps: %"PRIu16"; Accuracy: %"PRIu16"; Convergence: 
%"PRIu16"\n",
info->TargetKbps, info->Accuracy, info->Convergence);
 }
+#endif
 #if QSV_HAVE_LA
 else if (info->RateControlMethod == MFX_RATECONTROL_LA
 #if QSV_HAVE_LA_HRD
@@ -325,10 +330,14 @@ static int select_rc_mode(AVCodecContext *avctx, 
QSVEncContext *q)
 else if (avctx->rc_max_rate == avctx->bit_rate) {
 rc_mode = MFX_RATECONTROL_CBR;
 rc_desc = "constant bitrate (CBR)";
-} else if (!avctx->rc_max_rate) {
+}
+#if QSV_HAVE_AVBR
+else if (!avctx->rc_max_rate) {
 rc_mode = MFX_RATECONTROL_AVBR;
 rc_desc = "average variable bitrate (AVBR)";
-} else {
+}
+#endif
+else {
 rc_mode = MFX_RATECONTROL_VBR;
 rc_desc = "variable bitrate (VBR)";
 }
@@ -514,11 +523,13 @@ static int init_video_param(AVCodecContext *avctx, 
QSVEncContext *q)
 q->param.mfx.QPB = av_clip(quant * fabs(avctx->b_quant_factor) + 
avctx->b_quant_offset, 0, 51);
 
 break;
+#if QSV_HAVE_AVBR
 case MFX_RATECONTROL_AVBR:
 q->param.mfx.TargetKbps  = avctx->bit_rate / 1000;
 q->param.mfx.Convergence = q->avbr_convergence;
 q->param.mfx.Accuracy= q->avbr_accuracy;
 break;
+#endif
 #if QSV_HAVE_LA
 case MFX_RATECONTROL_LA:
 q->param.mfx.TargetKbps  = avctx->bit_rate / 1000;
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index 88e0728..fb5fd68 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -46,10 +46,12 @@
 #define QSV_HAVE_LA_HRD QSV_VERSION_ATLEAST(1, 11)
 
 #if defined(_WIN32)
+#define QSV_HAVE_AVBR   QSV_VERSION_ATLEAST(1, 3)
 #define QSV_HAVE_ICQQSV_VERSION_ATLEAST(1, 8)
 #define QSV_HAVE_VCMQSV_VERSION_ATLEAST(1, 8)
 #define QSV_HAVE_QVBR   QSV_VERSION_ATLEAST(1, 11)
 #else
+#define QSV_HAVE_AVBR   0
 #define QSV_HAVE_ICQ0
 #define QSV_HAVE_VCM0
 #define QSV_HAVE_QVBR   0
-- 
1.8.3.1

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


Re: [FFmpeg-devel] [PATCH] libavformat/hls: Support metadata updates from subdemuxers

2018-02-01 Thread Richard Shaffer
On Thu, Feb 1, 2018 at 10:18 PM, wm4  wrote:
> On Thu,  1 Feb 2018 18:44:34 -0800
> rshaf...@tunein.com wrote:
>
>> From: Richard Shaffer 
>>
>> If a subdemuxer has the updated metadata event flag set, the metadata is 
>> copied
>> to the corresponding stream. The flag is cleared on the subdemuxer and the
>> appropriate event flag is set on the stream.
>> ---
>> This is semi-related to a patch I recently sent to enable parsing ID3 tags 
>> from
>> .aac files between ADTS headers. However, it may be generically useful for
>> other segment formats that support metadata updates.
>>
>> -Richard
>>
>>  libavformat/hls.c | 38 ++
>>  1 file changed, 38 insertions(+)
>>
>> diff --git a/libavformat/hls.c b/libavformat/hls.c
>> index 9bd54c84cc..e48845de34 100644
>> --- a/libavformat/hls.c
>> +++ b/libavformat/hls.c
>> @@ -1062,6 +1062,7 @@ static void handle_id3(AVIOContext *pb, struct 
>> playlist *pls)
>>  /* demuxer not yet opened, defer picture attachment */
>>  pls->id3_deferred_extra = extra_meta;
>>
>> +ff_id3v2_parse_priv_dict(&metadata, &extra_meta);
>>  av_dict_copy(&pls->ctx->metadata, metadata, 0);
>>  pls->id3_initial = metadata;
>>
>> @@ -1589,6 +1590,34 @@ static void 
>> add_metadata_from_renditions(AVFormatContext *s, struct playlist *pl
>>  }
>>  }
>>
>> +/* update metadata on main streams, if necessary */
>> +static void update_metadata_from_subdemuxer(struct playlist *pls, int 
>> ignore_flags) {
>
> Normally we put the { on a separate line for functions.

I knew that but forgot. I'll fix it in the next iteration.

>
>> +int i;
>> +
>> +if (pls->n_main_streams) {
>> +AVStream *st = pls->main_streams[0];
>> +if (ignore_flags) {
>> +av_dict_copy(&st->metadata, pls->ctx->metadata, 0);
>> +} else if (pls->ctx->event_flags & 
>> AVFMT_EVENT_FLAG_METADATA_UPDATED) {
>> +av_dict_copy(&st->metadata, pls->ctx->metadata, 0);
>> +pls->ctx->event_flags &= ~AVFMT_EVENT_FLAG_METADATA_UPDATED;
>> +st->event_flags |= AVSTREAM_EVENT_FLAG_METADATA_UPDATED;
>> +}
>
> I don't get understand this: why only stream 0? Isn't this done below
> already?

The code above copies metadata from pls->ctx->metadata, but the code
below copies from pls->ctx->streams[i]->metadata for each stream in
the subdemuxer. I think this currently would only apply to oggvorbis
and nut demuxers. Maybe it's not a relevant use case for those, in
which case I could just remove the for loop. I could also add a
comment so that it's clear without having to look three times at the
code.

>
>> +}
>> +
>> +for (i = 0; i < pls->ctx->nb_streams; i++) {
>> +AVStream *ist = pls->ctx->streams[i];
>> +AVStream *st = pls->main_streams[i];
>> +if (ignore_flags) {
>> +av_dict_copy(&st->metadata, ist->metadata, 0);
>> +} else if (ist->event_flags & AVSTREAM_EVENT_FLAG_METADATA_UPDATED) 
>> {
>> +av_dict_copy(&st->metadata, ist->metadata, 0);
>> +ist->event_flags &= ~AVSTREAM_EVENT_FLAG_METADATA_UPDATED;
>> +st->event_flags |= AVSTREAM_EVENT_FLAG_METADATA_UPDATED;
>> +}
>> +}
>> +}
>
> Like mentioned in the other patch, av_dict_copy not clearing the target
> dict might be unintended.

The intention is to not remove existing keys in the metadata, but only
update keys that are new or changed. We do also set metadata in
add_stream_to_programs and add_metadata_from_renditions. Presumably we
don't want to delete that. This also seems to be the behavior when we
have updated data from other demuxers or Icy, so I wanted to implement
the same behavior here.

>
>> +
>>  /* if timestamp was in valid range: returns 1 and sets seq_no
>>   * if not: returns 0 and sets seq_no to closest segment */
>>  static int find_timestamp_in_playlist(HLSContext *c, struct playlist *pls,
>> @@ -1960,6 +1989,7 @@ static int hls_read_header(AVFormatContext *s)
>>  if (pls->id3_deferred_extra && pls->ctx->nb_streams == 1) {
>>  ff_id3v2_parse_apic(pls->ctx, &pls->id3_deferred_extra);
>>  avformat_queue_attached_pictures(pls->ctx);
>> +ff_id3v2_parse_priv(pls->ctx, &pls->id3_deferred_extra);
>>  ff_id3v2_free_extra_meta(&pls->id3_deferred_extra);
>>  pls->id3_deferred_extra = NULL;
>>  }
>> @@ -1986,6 +2016,12 @@ static int hls_read_header(AVFormatContext *s)
>>  if (ret < 0)
>>  goto fail;
>>
>> +/*
>> + * Copy any metadata from playlist to main streams, but do not set
>> + * event flags.
>> + */
>> +update_metadata_from_subdemuxer(pls, 1);
>> +
>
> Possibly would be nicer to drop the ignore_flags parameter, and just
> unset the event flag at the end of read_header (maybe even in generic
> code).

When we are in hls_read_header, the sub-demuxers are not going to set
the event flag, and so