Re: [FFmpeg-devel] [PATCH] lavd/opengl: use SDL2

2016-09-18 Thread Josh de Kock

On 18/09/2016 05:51, Lukasz Marek wrote:

W dniu niedziela, 18 września 2016 Lou Logan > napisał(a):


On Sat, Sep 17, 2016, at 05:21 PM, Lukasz Marek wrote:

On 18 September 2016 at 00:30, Josh de Kock  wrote:

[...]

 Would like some feedback where it doesnt work etc

[...]

I said I will patch opengl, your implemantation donsn't look good at this
point, declined,


It would be helpful to provide some details describing what exactly does
not look good.
___



opengl device depends on opengl context. this patch works on sdl renderer
which works on X. in many cases X is opengł so patch is working for many
cases, but is shity in general.



Sorry, I don't understand. Could you rephrase this?

--
Josh

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


Re: [FFmpeg-devel] [PATCH] Add CONTRIBUTING.md

2016-09-18 Thread Josh de Kock

On 18/09/2016 01:29, James Almer wrote:

On 9/17/2016 8:42 PM, Josh de Kock wrote:

TimothyGu (https://github.com/FFmpeg/FFmpeg/pull/153#issuecomment-143274708) 
suggested doing this a while ago, but it was never done. As pull requests seem 
to be still coming through, I thought I'd send a patch to add the notice.

Signed-off-by: Josh de Kock 
---
 CONTRIBUTING.md | 4 
 1 file changed, 4 insertions(+)
 create mode 100644 CONTRIBUTING.md

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 000..c2b79e4
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,4 @@
+# Note to Github users
+Patches should be submitted to the [ffmpeg-devel mailing 
list](https://ffmpeg.org/mailman/listinfo/ffmpeg-devel) using `git 
format-patch` or `git send-email`. Github pull requests should be avoided 
because they are not part of our review process and **will be ignored**.


The wording here is different to the notice in README.md, so
make it either "will be ignored" or "will likely be ignored"
in both.

This patch should be ok in any case.


+
+See 
[https://ffmpeg.org/developer.html#Contributing](https://ffmpeg.org/developer.html#Contributing)
 for more information.



Thanks, applied with updated wording to README.md.

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


Re: [FFmpeg-devel] [GSoC] [PATCH 2/2] mlpenc: Working MLP/TrueHD encoder

2016-09-18 Thread Andy Furniss

Jai Luthra wrote:

On Sat, Sep 17, 2016 at 05:07:28PM +0100, Andy Furniss wrote:

Nice work, this is just a sort of related question really from a
user who hasn't taken any notice of TrueHD for a few years.

Last I looked I couldn't find much in the way of specs for TrueHD
and noticed that the Decoder didn't have anything related to
dynamic range control.

Is there more info about now?

IIRC testing decoder - (depending on content) for downmix or 2
channel sub stream the absence of DRC was a bit of a show stopper
in that full range can be way too much. The AC3 version of course
did have DRC meta and ffmpeg would correctly fully apply it for
downmix, so for a stereo listener like me AC3 = good, TrueHD (or
DTS) = bad.


The proprietary suite for TrueHD does support dynamic range
compression, but I'm unsure if (and where) the metadata for DRC is
present in the bitstream.

The bitstream isn't fully reversed yet, just enough to get things
working. I think this is a very useful feature for downmixed
substream to sound good, so I'll try to figure it out in my spare
time.


Thanks, it would be really good if the meta could be found even just for
the the decoder. I guess it would be a lot more complex for encode anyway.

I notice we both use the term downmix, maybe that's not quite the right
thing to say WRT substreams. I mean that in the sense that THD
substreams are AIUI the base and the higher channel counts are derived.
Which means the stereo mix can be different from what a downmix would
make. I've got a 7.1 speaker check sample somewhere and the stereo
substream has all the speakers at the same level, which is a nice
feature.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avfilter/WIP: add nlmeans filter

2016-09-18 Thread Clément Bœsch
Fixes Ticket #4910

TODO (before 1st pushed version):
- add chroma paramters (for patch size and research window)
- doc
- lavfi minor bump, Changelog
- GBRP

TODO++ (after 1st version):
- SIMD for compute_safe_ssd_integral_image
- SIMD for final weighted averaging
- smart parameters for block and research size according to sigma like
  suggested by ipol?
- temporal support
---
 libavfilter/Makefile |   3 +-
 libavfilter/allfilters.c |   1 +
 libavfilter/tests/integral.c |  89 
 libavfilter/vf_nlmeans.c | 527 +++
 4 files changed, 619 insertions(+), 1 deletion(-)
 create mode 100644 libavfilter/tests/integral.c
 create mode 100644 libavfilter/vf_nlmeans.c

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 5cd10fa..57a38d3 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -220,6 +220,7 @@ OBJS-$(CONFIG_METADATA_FILTER)   += f_metadata.o
 OBJS-$(CONFIG_MINTERPOLATE_FILTER)   += vf_minterpolate.o 
motion_estimation.o
 OBJS-$(CONFIG_MPDECIMATE_FILTER) += vf_mpdecimate.o
 OBJS-$(CONFIG_NEGATE_FILTER) += vf_lut.o
+OBJS-$(CONFIG_NLMEANS_FILTER)+= vf_nlmeans.o
 OBJS-$(CONFIG_NNEDI_FILTER)  += vf_nnedi.o
 OBJS-$(CONFIG_NOFORMAT_FILTER)   += vf_format.o
 OBJS-$(CONFIG_NOISE_FILTER)  += vf_noise.o
@@ -354,7 +355,7 @@ SKIPHEADERS-$(CONFIG_OPENCL) += 
opencl_internal.h deshake_opencl
 OBJS-$(CONFIG_SHARED)+= log2_tab.o
 
 TOOLS = graph2dot
-TESTPROGS = drawutils filtfmts formats
+TESTPROGS = drawutils filtfmts formats integral
 
 TOOLS-$(CONFIG_LIBZMQ) += zmqsend
 
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 47d95f5..8f542fd 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -237,6 +237,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(MINTERPOLATE,   minterpolate,   vf);
 REGISTER_FILTER(MPDECIMATE, mpdecimate, vf);
 REGISTER_FILTER(NEGATE, negate, vf);
+REGISTER_FILTER(NLMEANS,nlmeans,vf);
 REGISTER_FILTER(NNEDI,  nnedi,  vf);
 REGISTER_FILTER(NOFORMAT,   noformat,   vf);
 REGISTER_FILTER(NOISE,  noise,  vf);
diff --git a/libavfilter/tests/integral.c b/libavfilter/tests/integral.c
new file mode 100644
index 000..7690254
--- /dev/null
+++ b/libavfilter/tests/integral.c
@@ -0,0 +1,89 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavfilter/vf_nlmeans.c"
+
+int main(void)
+{
+int ret = 0, xoff, yoff;
+
+// arbitrary test source of size 6x4 and linesize=8
+const int w = 6, h = 5, lz = 8;
+static const uint8_t src[] = {
+0xb0, 0x71, 0xfb, 0xd8, 0x01, 0xd9, /***/ 0x01, 0x02,
+0x51, 0x8e, 0x41, 0x0f, 0x84, 0x58, /***/ 0x03, 0x04,
+0xc7, 0x8d, 0x07, 0x70, 0x5c, 0x47, /***/ 0x05, 0x06,
+0x09, 0x4e, 0xfc, 0x74, 0x8f, 0x9a, /***/ 0x07, 0x08,
+0x60, 0x8e, 0x20, 0xaa, 0x95, 0x7d, /***/ 0x09, 0x0a,
+};
+
+const int r = 3;
+const int ii_w = w+r*2, ii_h = h+r*2;
+
+// align to 4 the linesize, "+1" is for the space of the left 0-column
+const int ii_lz_32 = ((ii_w + 1) + 3) & ~3;
+
+// "+1" is for the space of the top 0-line
+uint32_t *ii  = calloc(ii_h + 1, ii_lz_32 * sizeof(*ii));
+uint32_t *ii2 = calloc(ii_h + 1, ii_lz_32 * sizeof(*ii2));
+
+uint32_t *ii_start  = ii  + ii_lz_32 + 1; // skip top 0-line and left 
0-column
+uint32_t *ii_start2 = ii2 + ii_lz_32 + 1; // skip top 0-line and left 
0-column
+
+for (yoff = -r; yoff <= r; yoff++) {
+for (xoff = -r; xoff <= r; xoff++) {
+int x, y;
+
+printf("xoff=%d yoff=%d\n", xoff, yoff);
+
+compute_ssd_integral_image(ii_start, ii_lz_32,
+   src, lz, xoff, yoff, r, w, h);
+
+for (y = 0; y < ii_h; y++) {
+for (x = 0; x < ii_w; x++)
+printf(" %7x", ii_start[y*ii_lz_32 + x]);
+printf("\n");
+}
+printf("---\n");
+
+compute_unsafe_ssd_integral_image(ii_start2, ii_lz_32,
+ 

[FFmpeg-devel] [PATCH] avformat/utils: only call h264 decoder private function if h264 decoder is in use

2016-09-18 Thread Timo Rothenpieler
Fixes a crash when decoding with for example h264_cuvid, as
avpriv_h264_has_num_reorder_frames assumes the AVCodecContext->priv_data
to be a H264Context.
---
 libavformat/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index d605a96..06003dd 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -935,7 +935,7 @@ static int has_decode_delay_been_guessed(AVStream *st)
 if (!st->info) // if we have left find_stream_info then nb_decoded_frames 
won't increase anymore for stream copy
 return 1;
 #if CONFIG_H264_DECODER
-if (st->internal->avctx->has_b_frames &&
+if (st->internal->avctx->has_b_frames && 
!strcmp(st->internal->avctx->codec->name, "h264") &&
avpriv_h264_has_num_reorder_frames(st->internal->avctx) == 
st->internal->avctx->has_b_frames)
 return 1;
 #endif
-- 
2.10.0

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


Re: [FFmpeg-devel] [PATCH] avformat/utils: only call h264 decoder private function if h264 decoder is in use

2016-09-18 Thread Michael Niedermayer
On Sun, Sep 18, 2016 at 01:46:07PM +0200, Timo Rothenpieler wrote:
> Fixes a crash when decoding with for example h264_cuvid, as
> avpriv_h264_has_num_reorder_frames assumes the AVCodecContext->priv_data
> to be a H264Context.
> ---
>  libavformat/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Relevant IRC discussion:

 BtbN, JEEB why is st->internal->avctx not the libavcodec software 
decoder ?
 because it's the cuvid h264 decoder.
 I mean if this is the hw decoder you would be running the hw 
decoder twice
 once in the application and once in libavformat
 is that intended ?
 hm?
 or am i misunderstanding?
 the cuvid h264 decoder is completely inside of lavc, completely 
independend from the outside
 sure but libavformat opens a decoder to get some information about 
a stream, if thats the hw decoder then there would be 2 as the user app would 
also have a decoder independat of libavformat
 It indeed seems to open it twice
 But I don't see anything I could possibly do about that from inside of 
the cuvid decoder, and it also works just fine.
 not from the inside but the code setting up st->internal->avctx 
should maybe not open a hw decoder
 or if we want it to do that then indeed the 
avpriv_h264_has_num_reorder_frames() call is garbage
 Forcing it to use the software decoder for the initial parsing seems 
like the better solution. As it returns way more information about the stream.

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle


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


Re: [FFmpeg-devel] [PATCH] lavf: add ffprobe demuxer

2016-09-18 Thread Stefano Sabatini
On date Saturday 2016-09-17 18:42:35 +0200, Paul B Mahol encoded:
> On 9/17/16, Stefano Sabatini  wrote:
> > On date Sunday 2016-09-04 23:25:56 +0200, Michael Niedermayer encoded:
> >> On Sun, Sep 04, 2016 at 06:24:37PM +0200, Stefano Sabatini wrote:
> >> > From: Nicolas George 
> >> >
> >> > With several modifications and documentation by Stefano Sabatini
> >> > .
> >> >
> >> > Signed-off-by: Nicolas George 
> >> > ---
> >> >  doc/ffprobe-format.texi  | 130 
> >> >  libavformat/Makefile |   1 +
> >> >  libavformat/allformats.c |   2 +
> >> >  libavformat/ffprobedec.c | 397
> >> > +++
> >> >  4 files changed, 530 insertions(+)
> >> >  create mode 100644 doc/ffprobe-format.texi
> >> >  create mode 100644 libavformat/ffprobedec.c
> >>
> >> this seems not to apply cleanly
> >>
> >> can i pick this from some git repo ? (should work better than patch
> >> with unavailable ancestors)
> >
> > Updated, this should apply cleanly on master.
> 
> Why we need this hack?

My use case: I need to inject a metadata stream using the ff*
tools. Metadata must be specified in a textual format. I already
designed and implemented the fftextdata format, but that was regarded
too limited.

Example:
ffmpeg -i input.mp4 -copyts -i data.ffprobe -map 0:v -map 0:a -map 1:0 -codec:d 
copy input+data.ts

With this format we allow to cover my use case, and it provides a more
generic format for such purposes (since you can specify multiple
streams). Also, it's inspired by the ffprobe output, so it can be used
together with ffprobe (via simple text editing) to generate files
which can be edited and feed to ffmpeg.

It would be possible to use any binary format for injecting the
metadata, but this approach is not very scriptable. Alternatively a
custom program to convert a custom textual format to any binary format
we support, but this would imply an additional step I want to avoid.

That said, if someone want/can propose an alternative path to this I'm
very open to suggestions.
-- 
FFmpeg = Fascinating Fancy Magical Portentous Empowered Guru
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavd/opengl: use SDL2

2016-09-18 Thread Lukasz Marek

On 18.09.2016 10:04, Josh de Kock wrote:

On 18/09/2016 05:51, Lukasz Marek wrote:

W dniu niedziela, 18 września 2016 Lou Logan > napisał(a):


On Sat, Sep 17, 2016, at 05:21 PM, Lukasz Marek wrote:

On 18 September 2016 at 00:30, Josh de Kock  wrote:

[...]

 Would like some feedback where it doesnt work etc

[...]

I said I will patch opengl, your implemantation donsn't look good at
this
point, declined,


It would be helpful to provide some details describing what exactly does
not look good.
___



opengl device depends on opengl context. this patch works on sdl renderer
which works on X. in many cases X is opengł so patch is working for many
cases, but is shity in general.



Sorry, I don't understand. Could you rephrase this?


To make opengl work it needs a context. Could you point where you create it?

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


Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: refine EXT-X-BYTERANGE support for segments

2016-09-18 Thread Steven Liu
2016-09-18 7:28 GMT+08:00 Steven Liu :

>
>
> 2016-09-18 1:07 GMT+08:00 Michael Niedermayer :
>
>> On Sat, Sep 17, 2016 at 01:09:02PM +0800, Steven Liu wrote:
>> [...]
>> > @@ -867,6 +886,16 @@ static int hls_write_header(AVFormatContext *s)
>> >  for (i = 0; i < s->nb_streams; i++) {
>> >  AVStream *inner_st;
>> >  AVStream *outer_st = s->streams[i];
>> > +
>> > +if (hls->max_seg_size > 0) {
>> > +if ((outer_st->codecpar->codec_type ==
>> AVMEDIA_TYPE_VIDEO) &&
>> > +outer_st->codecpar->bit_rate > hls->max_seg_size) {
>> > +av_log(s, AV_LOG_WARNING, "Your video bitrate is
>> bigger than hls_segment_size, "
>> > +   "%lld > %lld ( video birate > hls_segment_size
>> ),the result maybe not you want.",
>> > +   outer_st->codecpar->bit_rate,
>> hls->max_seg_size);
>>
>> %lld is the wrong type for *int64_t
>>
>> The compiler should produce a warning for this, though probably not
>> every copiler does
>> please make sure your changes add no warnings
>>
>
>
> Hi Michael,
>
>
> Bellow is my compile history before i send the last patch mail, maybe i
> need cross complie cross any platform:
>
>
> localhost:xxx StevenLiu$ make
> CC libavformat/hlsenc.o
> src/libavformat/hlsenc.c:326:14: error: use of undeclared identifier 'st'
> if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) &&
>  ^
> src/libavformat/hlsenc.c:327:13: error: use of undeclared identifier 'st'
> st->codecpar->bit_rate > hls->max_seg_size) {
> ^
> src/libavformat/hlsenc.c:330:20: error: use of undeclared identifier 'st'
>st->codecpar->bit_rate, hls->max_seg_size);
>^
> src/libavformat/hlsenc.c:573:27: warning: absolute value function 'abs'
> given an argument of type 'long' but has parameter of type 'int' which may
> cause truncation of value [-Wabsolute-value]
> tz_min = (abs(wrongsecs - tt) + 30) / 60;
>   ^
> src/libavformat/hlsenc.c:573:27: note: use function 'labs' instead
> tz_min = (abs(wrongsecs - tt) + 30) / 60;
>   ^~~
>   labs
> 1 warning and 3 errors generated.
> make: *** [libavformat/hlsenc.o] Error 1
> localhost:xxx StevenLiu$ make
> CC libavformat/hlsenc.o
> src/libavformat/hlsenc.c:564:27: warning: absolute value function 'abs'
> given an argument of type 'long' but has parameter of type 'int' which may
> cause truncation of value [-Wabsolute-value]
> tz_min = (abs(wrongsecs - tt) + 30) / 60;
>   ^
> src/libavformat/hlsenc.c:564:27: note: use function 'labs' instead
> tz_min = (abs(wrongsecs - tt) + 30) / 60;
>   ^~~
>   labs
> src/libavformat/hlsenc.c:890:18: error: use of undeclared identifier 'st'
> if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) &&
>  ^
> src/libavformat/hlsenc.c:891:17: error: use of undeclared identifier 'st'
> st->codecpar->bit_rate > hls->max_seg_size) {
> ^
> src/libavformat/hlsenc.c:894:24: error: use of undeclared identifier 'st'
>st->codecpar->bit_rate, hls->max_seg_size);
>^
> 1 warning and 3 errors generated.
> make: *** [libavformat/hlsenc.o] Error 1
> localhost:xxx StevenLiu$
> localhost:xxx StevenLiu$
> localhost:xxx StevenLiu$ make
> CC libavformat/hlsenc.o
> src/libavformat/hlsenc.c:564:27: warning: absolute value function 'abs'
> given an argument of type 'long' but has parameter of type 'int' which may
> cause truncation of value [-Wabsolute-value]
> tz_min = (abs(wrongsecs - tt) + 30) / 60;
>   ^
> src/libavformat/hlsenc.c:564:27: note: use function 'labs' instead
> tz_min = (abs(wrongsecs - tt) + 30) / 60;
>   ^~~
>   labs
> 1 warning generated.
> AR libavformat/libavformat.a
> LD ffmpeg_g
> CP ffmpeg
> STRIP ffmpeg
> LD ffplay_g
> CP ffplay
> STRIP ffplay
> LD ffprobe_g
> CP ffprobe
> STRIP ffprobe
> LD ffserver_g
> CP ffserver
> STRIP ffserver
> localhost:xxx StevenLiu$
>
>
>
patch update,

fix warning for complie, from lld to PRId64


0001-avformat-hlsenc-refine-EXT-X-BYTERANGE-support-for-s.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: refine EXT-X-BYTERANGE support for segments

2016-09-18 Thread Moritz Barsnick
On Sun, Sep 18, 2016 at 23:40:34 +0800, Steven Liu wrote:

> +if (byterange_mode) {
> +version = 4;
> +sequence = byterange_mode ? 0 : sequence;

What does the ternary if-then-else operation do here? Two lines above,
byterange_mode was checked for !=0, how can it be anything else here?

> +av_log(oc, AV_LOG_ERROR, "Invalid segment filename template 
> '%s', you can try use -use_localtime 1 with it\n", c->basename);

"try to use"

> +if ((outer_st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) &&
> +outer_st->codecpar->bit_rate > hls->max_seg_size) {

Inconsistent use of brackets: The "==" comparison has extra brackets,
the ">" comparison doesn't. (Or am I missing something with operator
precedence?)

> +av_log(s, AV_LOG_WARNING, "Your video bitrate is bigger than 
> hls_segment_size, "
> +   "%"PRId64 " > %" PRId64" ( video birate > 
> hls_segment_size ),the result maybe not you want.",

Apart from the peculiar placement of brackets in the message, I think
the brackets and their content is not needed, duplicate.

And the sentence should end "the result may not be what you want".

> +if (hls->start_pos >= hls->max_seg_size ) {

Wrong bracket style (whitespace).

> +{"hls_segment_size", "set maximum size per segment file, (in bytes)",  
> OFFSET(max_seg_size),AV_OPT_TYPE_INT,{.i64 = 0},   0,   
> INT_MAX,   E},

You can actually drop the word "set ", as well as the comma before the
brackets.

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


Re: [FFmpeg-devel] [PATCH] avfilter/WIP: add nlmeans filter

2016-09-18 Thread Carl Eugen Hoyos
2016-09-18 13:36 GMT+02:00 Clément Bœsch :
> Fixes Ticket #4910
>
> TODO (before 1st pushed version):
> - add chroma paramters (for patch size and research window)
> - doc
> - lavfi minor bump, Changelog

> - GBRP

Is this really important for the first version?

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


Re: [FFmpeg-devel] [PATCH] lavd/opengl: use SDL2

2016-09-18 Thread Lukasz Marek

On 18.09.2016 10:04, Josh de Kock wrote:

On 18/09/2016 05:51, Lukasz Marek wrote:

W dniu niedziela, 18 września 2016 Lou Logan > napisał(a):


On Sat, Sep 17, 2016, at 05:21 PM, Lukasz Marek wrote:

On 18 September 2016 at 00:30, Josh de Kock  wrote:

[...]

 Would like some feedback where it doesnt work etc

[...]

I said I will patch opengl, your implemantation donsn't look good at
this
point, declined,


It would be helpful to provide some details describing what exactly does
not look good.
___



opengl device depends on opengl context. this patch works on sdl renderer
which works on X. in many cases X is opengł so patch is working for many
cases, but is shity in general.



Sorry, I don't understand. Could you rephrase this?


I updated my version. I wanted to submit after vote is finished, but to 
save our time you can review it and include in your sdl patchset.


>From c8988099c8535c77382b6f05d23326a0270bb2f4 Mon Sep 17 00:00:00 2001
From: Lukasz Marek 
Date: Sun, 18 Sep 2016 19:13:12 +0200
Subject: [PATCH] lavd/opengl: use SDL2

Signed-off-by: Lukasz Marek 
---
 libavdevice/opengl_enc.c | 109 +--
 1 file changed, 49 insertions(+), 60 deletions(-)

diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c
index 1dbbb80..94259a2 100644
--- a/libavdevice/opengl_enc.c
+++ b/libavdevice/opengl_enc.c
@@ -46,7 +46,7 @@
 #include 
 #endif
 
-#if HAVE_SDL
+#if HAVE_SDL2
 #include 
 #endif
 
@@ -174,8 +174,9 @@ static const GLushort g_index[6] =
 typedef struct OpenGLContext {
 AVClass *class;///< class for private options
 
-#if HAVE_SDL
-SDL_Surface *surface;
+#if HAVE_SDL2
+SDL_Window *window;
+SDL_GLContext glcontext;
 #endif
 FFOpenGLFunctions glprocs;
 
@@ -341,30 +342,14 @@ static int opengl_control_message(AVFormatContext *h, int type, void *data, size
 return AVERROR(ENOSYS);
 }
 
-#if HAVE_SDL
-static int opengl_sdl_recreate_window(OpenGLContext *opengl, int width, int height)
-{
-opengl->surface = SDL_SetVideoMode(width, height,
-   32, SDL_OPENGL | SDL_RESIZABLE);
-if (!opengl->surface) {
-av_log(opengl, AV_LOG_ERROR, "Unable to set video mode: %s\n", SDL_GetError());
-return AVERROR_EXTERNAL;
-}
-SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
-SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
-SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
-SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
-SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
-return 0;
-}
-
+#if HAVE_SDL2
 static int opengl_sdl_process_events(AVFormatContext *h)
 {
-int ret;
 OpenGLContext *opengl = h->priv_data;
+AVDeviceRect message;
 SDL_Event event;
 SDL_PumpEvents();
-while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_ALLEVENTS) > 0) {
+while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) > 0) {
 switch (event.type) {
 case SDL_QUIT:
 return AVERROR(EIO);
@@ -375,23 +360,14 @@ static int opengl_sdl_process_events(AVFormatContext *h)
 return AVERROR(EIO);
 }
 return 0;
-case SDL_VIDEORESIZE: {
-char buffer[100];
-int reinit;
-AVDeviceRect message;
-/* clean up old context because SDL_SetVideoMode may lose its state. */
-SDL_VideoDriverName(buffer, sizeof(buffer));
-reinit = !av_strncasecmp(buffer, "quartz", sizeof(buffer));
-if (reinit) {
-opengl_deinit_context(opengl);
-}
-if ((ret = opengl_sdl_recreate_window(opengl, event.resize.w, event.resize.h)) < 0)
-return ret;
-if (reinit && (ret = opengl_init_context(opengl)) < 0)
-return ret;
-message.width = opengl->surface->w;
-message.height = opengl->surface->h;
-return opengl_control_message(h, AV_APP_TO_DEV_WINDOW_SIZE, &message, sizeof(AVDeviceRect));
+case SDL_WINDOWEVENT:
+switch(event.window.event) {
+case SDL_WINDOWEVENT_RESIZED:
+case SDL_WINDOWEVENT_SIZE_CHANGED:
+SDL_GL_GetDrawableSize(opengl->window, &message.width, &message.height);
+return opengl_control_message(h, AV_APP_TO_DEV_WINDOW_SIZE, &message, sizeof(AVDeviceRect));
+default:
+break;
 }
 }
 }
@@ -400,23 +376,34 @@ static int opengl_sdl_process_events(AVFormatContext *h)
 
 static int av_cold opengl_sdl_create_window(AVFormatContext *h)
 {
-int ret;
-char buffer[100];
 OpenGLContext *opengl = h->priv_data;
 AVDeviceRect message;
 if (SDL_Init(SDL_INIT_VIDEO)) {
 av_log(opengl, AV_LOG_ERROR, "Unable to initialize SDL: %s\n", SDL_GetError());
 return AVERROR_EXTERNAL;
 }
-if ((ret = opengl_sdl_recreate_window(opengl, op

Re: [FFmpeg-devel] [PATCH] ffprobe: add -show_headers_first option

2016-09-18 Thread Stefano Sabatini
On date Saturday 2016-09-10 13:51:34 +0200, Nicolas George encoded:
> Le tridi 23 fructidor, an CCXXIV, Stefano Sabatini a écrit :
[...]
> This issue of reading packets to extract information but not clutter the
> output with them is the reason I suggested in my example
> "packets+frames=silent=1".
> 
> Still, the inconsistent syntax does not bother me either way: I think users
> can understand that a feature (doing the probe but suppressing the output)
> only works for a particular section, but they can also understand that the
> same feature works for all sections but is only useful for one. Therefore,
> we do whichever is simpler to implement and just make sure to explain it in
> the doc.
> 
> There is another, more confusing case, where "print sections in order" can
> not work: packets and frames must be probed and printed together.
> 
> I think it would help to thinks of the steps not as sections to print but as
> tasks to perform. Most tasks are just printing a section, but the task about
> packets has three optional subtasks: printing the packets, decoding the
> frames, printing the frames (of course, printing the frames without decoding
> makes no sense).
> 
> If we design things to allow tasks to have aliases ("f" for "formats") and
> allow aliases to have different defaults for options, things can work in a
> way that is both convenient and logical. Consider a single task,
> "packets_and_frames", with three options, "print_packets=[01]",
> "decode_frames=[01]", "print_frames=[01]", and aliases: "packets" causing
> the options to default to 1/0/0, "frames" to 0/1/1; any other combination
> can be achieved by setting the options explicitly.
> 
> The enabling or disabling of individual fields can also be an option to
> tasks. That allow to support the same features as -show_entries in a more
> logical way.

So I thought more about this idea of a sort -dotasks option.

The problem with sorting the output of my proposed approach fights
with -read_packets. Indeed if we enable output ordering, still we
don't know when the program is supposed to read the packets (unless
we extend the syntax with something as !packets,format).

An hypotetical -dotasks option may solve the problem as this:
-dotasks format,packets=silent,streams

What if you want only to print some specific entries?

We can use it in combination with -show_entries, for example:
-dotasks packets=silent,streams,format -show_entries format=format_name

The problem with this approach is that it will conflict with
-show_entries, for example in:
-dotasks packets=silent,format -show_entries streams,packets

Unless you're suggesting to entirely dig the -show_entries
option. Otherwise we would need to figure out how to make the two
options coexist.
-- 
FFmpeg = Funny and Free Mortal Purposeless Easy Guru
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/4] lavd: Add SDL2 output device

2016-09-18 Thread Lukasz Marek

On 15.09.2016 00:27, Josh de Kock wrote:

Acked-by: Michael Niedermayer
Signed-off-by: Josh de Kock 
---
 configure|  28 +++-
 libavdevice/Makefile |   1 +
 libavdevice/alldevices.c |   1 +
 libavdevice/sdl2.c   | 377 +++
 4 files changed, 406 insertions(+), 1 deletion(-)
 create mode 100644 libavdevice/sdl2.c



+typedef struct {
+AVClass *class;
+SDL_Window *window;
+SDL_Renderer *renderer;
+char *window_title;
+int window_width, window_height;  /**< size of the window */
+int window_fullscreen;
+int window_borderless;
+
+SDL_Texture *texture;
+int texture_fmt;
+SDL_Rect texture_rect;
+
+int inited;
+SDL_Thread *event_thread;
+SDL_mutex *mutex;
+SDL_cond *init_cond;


these 3 are unused


+int quit;


this also can be removed


+} SDLContext;
+
+
+static int sdl2_write_trailer(AVFormatContext *s)
+{
+SDLContext *sdl = s->priv_data;
+
+sdl->quit = 1;


as there is no other thread then it is redundant


+if (sdl->texture)
+SDL_DestroyTexture(sdl->texture);
+sdl->texture = NULL;
+if (sdl->event_thread)
+SDL_WaitThread(sdl->event_thread, NULL);
+sdl->event_thread = NULL;
+if (sdl->mutex)
+SDL_DestroyMutex(sdl->mutex);
+sdl->mutex = NULL;
+if (sdl->init_cond)
+SDL_DestroyCond(sdl->init_cond);
+sdl->init_cond = NULL;
+
+if (sdl->renderer)
+SDL_DestroyRenderer(sdl->renderer);
+sdl->renderer = NULL;
+
+if (sdl->window)
+SDL_DestroyWindow(sdl->window);
+sdl->window = NULL;
+
+if (!sdl->inited)
+SDL_Quit();


are you sure this is OK?


+
+return 0;
+}
+
+#define SDL_BASE_FLAGS (SDL_SWSURFACE|SDL_WINDOW_RESIZABLE)
+
+static int sdl2_write_header(AVFormatContext *s)
+{
+SDLContext *sdl = s->priv_data;
+AVStream *st = s->streams[0];
+AVCodecParameters *codecpar = st->codecpar;
+int i, ret = 0;
+
+if (!sdl->window_title)
+sdl->window_title = av_strdup(s->filename);
+
+if (SDL_WasInit(SDL_INIT_VIDEO)) {
+av_log(s, AV_LOG_WARNING,
+   "SDL video subsystem was already inited, you could have multiple SDL 
outputs. This may cause unknown behaviour.\n");
+sdl->inited = 1;
+}
+
+if (   s->nb_streams > 1
+|| codecpar->codec_type != AVMEDIA_TYPE_VIDEO
+|| codecpar->codec_id   != AV_CODEC_ID_RAWVIDEO) {
+av_log(s, AV_LOG_ERROR, "Only supports one rawvideo stream\n");
+goto fail;
+}
+
+for (i = 0; sdl_texture_format_map[i].format != AV_PIX_FMT_NONE; i++) {
+if (sdl_texture_format_map[i].format == codecpar->format) {
+sdl->texture_fmt = sdl_texture_format_map[i].texture_fmt;
+break;
+}
+}
+
+if (!sdl->texture_fmt) {
+av_log(s, AV_LOG_ERROR,
+   "Unsupported pixel format '%s', choose one of yuv420p, yuyv422, 
uyvy422, BGRA\n",


This log message is not clear. It made sense where there was only 3 
planar format. I would remove second part



+   av_get_pix_fmt_name(codecpar->format));
+goto fail;
+}
+
+/* resize texture to width and height from the codec context information */
+int flags;
+flags = SDL_BASE_FLAGS | (sdl->window_fullscreen ? SDL_WINDOW_FULLSCREEN : 
0) |
+ (sdl->window_borderless ? SDL_WINDOW_BORDERLESS : 
0);
+
+/* initialization */
+if (!sdl->inited){
+if (SDL_Init(SDL_INIT_VIDEO) != 0) {
+av_log(s, AV_LOG_ERROR, "Unable to initialize SDL: %s\n", 
SDL_GetError());
+goto fail;
+}
+}
+
+sdl->window_width = sdl->texture_rect.w = codecpar->width;
+sdl->window_height = sdl->texture_rect.h = codecpar->height;
+sdl->texture_rect.x = sdl->texture_rect.y = 0;
+
+if (SDL_CreateWindowAndRenderer(sdl->window_width, sdl->window_height,
+flags, &sdl->window, &sdl->renderer) != 0){
+av_log(sdl, AV_LOG_ERROR, "Couldn't create window and renderer: %s\n", 
SDL_GetError());
+goto fail;
+}
+
+SDL_SetWindowTitle(sdl->window, sdl->window_title);
+
+sdl->texture = SDL_CreateTexture(sdl->renderer, sdl->texture_fmt, 
SDL_TEXTUREACCESS_STREAMING,
+ sdl->window_width, sdl->window_height);
+
+if (!sdl->texture) {
+av_log(sdl, AV_LOG_ERROR, "Unable to set create mode: %s\n", 
SDL_GetError());
+goto fail;
+}
+
+av_log(s, AV_LOG_VERBOSE, "w:%d h:%d fmt:%s -> w:%d h:%d\n",
+   codecpar->width, codecpar->height, 
av_get_pix_fmt_name(codecpar->format),
+   sdl->window_width, sdl->window_height);
+
+sdl->inited = 1;
+
+return 0;
+fail:
+sdl2_write_trailer(s);
+return ret;
+}
+
+static int sdl2_write_packet(AVFormatContext *s, AVPacket *pkt)
+{
+int ret = 0;
+SDLContext *sdl = s->priv_data;
+AVCodecParameters *codecpar = s->streams[0]-

Re: [FFmpeg-devel] [PATCH] avfilter/WIP: add nlmeans filter

2016-09-18 Thread Clément Bœsch
On Sun, Sep 18, 2016 at 06:49:03PM +0200, Carl Eugen Hoyos wrote:
> 2016-09-18 13:36 GMT+02:00 Clément Bœsch :
> > Fixes Ticket #4910
> >
> > TODO (before 1st pushed version):
> > - add chroma paramters (for patch size and research window)
> > - doc
> > - lavfi minor bump, Changelog
> 
> > - GBRP
> 
> Is this really important for the first version?
> 

It's a matter of adding just one line and checking if it works, which I
just did :)

-- 
Clément B.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] crystalhd: Use up-to-date bsf API

2016-09-18 Thread Philip Langdale
Although the old API is supposed to functional, the crystalhd
decoder is currently not working for non-annex.b h.264 content.

So, let's update to the modern API and make it work again.

Signed-off-by: Philip Langdale 
---
 libavcodec/crystalhd.c | 87 +-
 1 file changed, 65 insertions(+), 22 deletions(-)

diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c
index d6ebcee..59b14b9 100644
--- a/libavcodec/crystalhd.c
+++ b/libavcodec/crystalhd.c
@@ -131,7 +131,7 @@ typedef struct {
 uint8_t *orig_extradata;
 uint32_t orig_extradata_size;
 
-AVBitStreamFilterContext *bsfc;
+AVBSFContext *bsfc;
 AVCodecParserContext *parser;
 
 uint8_t is_70012;
@@ -359,7 +359,7 @@ static av_cold int uninit(AVCodecContext *avctx)
 
 av_parser_close(priv->parser);
 if (priv->bsfc) {
-av_bitstream_filter_close(priv->bsfc);
+av_bsf_free(&priv->bsfc);
 }
 
 av_freep(&priv->sps_pps_buf);
@@ -418,30 +418,46 @@ static av_cold int init(AVCodecContext *avctx)
 switch (subtype) {
 case BC_MSUBTYPE_AVC1:
 {
-uint8_t *dummy_p;
-int dummy_int;
+const AVBitStreamFilter *bsf;
+int avret;
 
-/* Back up the extradata so it can be restored at close time. */
-priv->orig_extradata = av_malloc(avctx->extradata_size + 
AV_INPUT_BUFFER_PADDING_SIZE);
-if (!priv->orig_extradata) {
+bsf = av_bsf_get_by_name("h264_mp4toannexb");
+if (!bsf) {
 av_log(avctx, AV_LOG_ERROR,
-   "Failed to allocate copy of extradata\n");
+   "Cannot open the h264_mp4toannexb BSF!\n");
+return AVERROR_BSF_NOT_FOUND;
+}
+avret = av_bsf_alloc(bsf, &priv->bsfc);
+if (avret != 0) {
+return AVERROR(ENOMEM);
+}
+avret = avcodec_parameters_from_context(priv->bsfc->par_in, avctx);
+if (avret != 0) {
+return AVERROR(ENOMEM);
+}
+avret = av_bsf_init(priv->bsfc);
+if (avret != 0) {
 return AVERROR(ENOMEM);
 }
-priv->orig_extradata_size = avctx->extradata_size;
-memcpy(priv->orig_extradata, avctx->extradata, 
avctx->extradata_size);
 
-priv->bsfc = av_bitstream_filter_init("h264_mp4toannexb");
-if (!priv->bsfc) {
+format.metaDataSz = priv->bsfc->par_out->extradata_size;
+format.pMetaData = av_malloc(format.metaDataSz + 
AV_INPUT_BUFFER_PADDING_SIZE);
+if (!format.pMetaData) {
 av_log(avctx, AV_LOG_ERROR,
-   "Cannot open the h264_mp4toannexb BSF!\n");
-return AVERROR_BSF_NOT_FOUND;
+   "Failed to allocate copy of extradata\n");
+return AVERROR(ENOMEM);
 }
-av_bitstream_filter_filter(priv->bsfc, avctx, NULL, &dummy_p,
-   &dummy_int, NULL, 0, 0);
+memcpy(format.pMetaData, priv->bsfc->par_out->extradata, 
format.metaDataSz);
+
+/* Back up the extradata so it can be restored at close time. */
+priv->orig_extradata = avctx->extradata;
+priv->orig_extradata_size = avctx->extradata_size;
+avctx->extradata = format.pMetaData;
+avctx->extradata_size = format.metaDataSz;
 }
 subtype = BC_MSUBTYPE_H264;
-// Fall-through
+format.startCodeSz = 4;
+break;
 case BC_MSUBTYPE_H264:
 format.startCodeSz = 4;
 // Fall-through
@@ -901,14 +917,41 @@ static int decode(AVCodecContext *avctx, void *data, int 
*got_frame, AVPacket *a
 if (len) {
 int32_t tx_free = (int32_t)DtsTxFreeSize(dev);
 
-if (priv->parser) {
+if (priv->bsfc) {
 int ret = 0;
+AVPacket filter_packet = { 0 };
+AVPacket filtered_packet = { 0 };
+
+ret = av_packet_ref(&filter_packet, avpkt);
+if (ret < 0) {
+av_log(avctx, AV_LOG_ERROR, "CrystalHD: mpv4toannexb filter "
+   "failed to ref input packet\n");
+return ret;
+}
+
+  ret = av_bsf_send_packet(priv->bsfc, &filter_packet);
+  if (ret < 0) {
+av_log(avctx, AV_LOG_ERROR, "CrystalHD: mpv4toannexb filter "
+   "failed to send input packet\n");
+return ret;
+}
 
-if (priv->bsfc) {
-ret = av_bitstream_filter_filter(priv->bsfc, avctx, NULL,
- &in_data, &len,
- avpkt->data, len, 0);
+ret = av_bsf_receive_packet(priv->bsfc, &filtered_packet);
+if (ret < 0) {
+av_log(avctx, AV

Re: [FFmpeg-devel] [PATCH] lavd/opengl: use SDL2

2016-09-18 Thread Josh de Kock


From c8988099c8535c77382b6f05d23326a0270bb2f4 Mon Sep 17 00:00:00 2001
From: Lukasz Marek 
Date: Sun, 18 Sep 2016 19:13:12 +0200
Subject: [PATCH] lavd/opengl: use SDL2

Signed-off-by: Lukasz Marek 
---
 libavdevice/opengl_enc.c | 109 +--
 1 file changed, 49 insertions(+), 60 deletions(-)

diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c
index 1dbbb80..94259a2 100644
--- a/libavdevice/opengl_enc.c
+++ b/libavdevice/opengl_enc.c
@@ -46,7 +46,7 @@
 #include 
 #endif

-#if HAVE_SDL
+#if HAVE_SDL2
 #include 
 #endif

@@ -174,8 +174,9 @@ static const GLushort g_index[6] =
 typedef struct OpenGLContext {
 AVClass *class;///< class for private options

-#if HAVE_SDL
-SDL_Surface *surface;
+#if HAVE_SDL2
+SDL_Window *window;
+SDL_GLContext glcontext;
 #endif
 FFOpenGLFunctions glprocs;

@@ -341,30 +342,14 @@ static int opengl_control_message(AVFormatContext *h, int 
type, void *data, size
 return AVERROR(ENOSYS);
 }

-#if HAVE_SDL
-static int opengl_sdl_recreate_window(OpenGLContext *opengl, int width, int 
height)
-{
-opengl->surface = SDL_SetVideoMode(width, height,
-   32, SDL_OPENGL | SDL_RESIZABLE);
-if (!opengl->surface) {
-av_log(opengl, AV_LOG_ERROR, "Unable to set video mode: %s\n", 
SDL_GetError());
-return AVERROR_EXTERNAL;
-}
-SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
-SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
-SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
-SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
-SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
-return 0;
-}
-
+#if HAVE_SDL2
 static int opengl_sdl_process_events(AVFormatContext *h)
 {
-int ret;
 OpenGLContext *opengl = h->priv_data;
+AVDeviceRect message;
 SDL_Event event;
 SDL_PumpEvents();
-while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_ALLEVENTS) > 0) {
+while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) 
> 0) {

Please use SDL_PollEvent() instead.


 switch (event.type) {
 case SDL_QUIT:
 return AVERROR(EIO);
@@ -375,23 +360,14 @@ static int opengl_sdl_process_events(AVFormatContext *h)
 return AVERROR(EIO);
 }
 return 0;
-case SDL_VIDEORESIZE: {
-char buffer[100];
-int reinit;
-AVDeviceRect message;
-/* clean up old context because SDL_SetVideoMode may lose its 
state. */
-SDL_VideoDriverName(buffer, sizeof(buffer));
-reinit = !av_strncasecmp(buffer, "quartz", sizeof(buffer));
-if (reinit) {
-opengl_deinit_context(opengl);
-}
-if ((ret = opengl_sdl_recreate_window(opengl, event.resize.w, 
event.resize.h)) < 0)
-return ret;
-if (reinit && (ret = opengl_init_context(opengl)) < 0)
-return ret;
-message.width = opengl->surface->w;
-message.height = opengl->surface->h;
-return opengl_control_message(h, AV_APP_TO_DEV_WINDOW_SIZE, 
&message, sizeof(AVDeviceRect));
+case SDL_WINDOWEVENT:
+switch(event.window.event) {
+case SDL_WINDOWEVENT_RESIZED:
+case SDL_WINDOWEVENT_SIZE_CHANGED:
+SDL_GL_GetDrawableSize(opengl->window, &message.width, 
&message.height);
+return opengl_control_message(h, AV_APP_TO_DEV_WINDOW_SIZE, 
&message, sizeof(AVDeviceRect));
+default:
+break;
 }
 }
 }
@@ -400,23 +376,34 @@ static int opengl_sdl_process_events(AVFormatContext *h)

 static int av_cold opengl_sdl_create_window(AVFormatContext *h)
 {
-int ret;
-char buffer[100];
 OpenGLContext *opengl = h->priv_data;
 AVDeviceRect message;
 if (SDL_Init(SDL_INIT_VIDEO)) {
 av_log(opengl, AV_LOG_ERROR, "Unable to initialize SDL: %s\n", 
SDL_GetError());
 return AVERROR_EXTERNAL;
 }
-if ((ret = opengl_sdl_recreate_window(opengl, opengl->window_width,
-  opengl->window_height)) < 0)
-return ret;
-av_log(opengl, AV_LOG_INFO, "SDL driver: '%s'.\n", 
SDL_VideoDriverName(buffer, sizeof(buffer)));
-message.width = opengl->surface->w;
-message.height = opengl->surface->h;
-SDL_WM_SetCaption(opengl->window_title, NULL);
-opengl_control_message(h, AV_APP_TO_DEV_WINDOW_SIZE, &message, 
sizeof(AVDeviceRect));
-return 0;
+opengl->window = SDL_CreateWindow(opengl->window_title,
+  SDL_WINDOWPOS_UNDEFINED,
+  SDL_WINDOWPOS_UNDEFINED,
+  opengl->window_width, 
opengl->window_height,
+  SDL_WINDOW_RESIZABLE | 
SDL_WINDOW_OPENGL);
+if (!opengl->window) {
+av_log(opengl, AV_LOG_ERROR, "Unab

Re: [FFmpeg-devel] [PATCH 4/4] lavf/mov: Add support for edit list parsing.

2016-09-18 Thread Michael Niedermayer
On Sat, Sep 17, 2016 at 03:14:24PM -0700, Sasi Inguva wrote:
[...]
> > [...]
> > > @@ -2756,6 +2757,343 @@ static int mov_read_sbgp(MOVContext *c,
> > AVIOContext *pb, MOVAtom atom)
> > >  return pb->eof_reached ? AVERROR_EOF : 0;
> > >  }
> > >
> > > +/**
> > > + * Get ith edit list entry (media time, duration).
> > > + */
> > > +static int get_edit_list_entry(const MOVStreamContext *msc,
> > > +   unsigned int edit_list_index,
> > > +   int64_t *edit_list_media_time,
> > > +   int64_t *edit_list_duration,
> > > +   int64_t global_timescale)
> > > +{
> > > +if (edit_list_index == msc->elst_count) {
> > > +return 0;
> > > +}
> > > +*edit_list_media_time = msc->elst_data[edit_list_index].time;
> > > +*edit_list_duration = msc->elst_data[edit_list_index].duration;
> > > +/* duration is in global timescale units;convert to msc timescale */
> > > +*edit_list_duration = av_rescale(*edit_list_duration,
> > msc->time_scale,
> > > + global_timescale);
> >
> > global_timescale can be 0 here leading to division by 0
> >
> 
> Added an assert for global_timescale > 0

thats no solution, aborting on random input is not correct

simply trying
zzuf -cs1:100 ./ffmpeg -i mov_edl_kf_fix_1.mp4 -f null -

triggers the assert at
Assertion global_timescale > 0 failed at libavformat/mov.c:2777
zzuf[s=34,r=0.004]: signal 6 (SIGABRT)

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


[FFmpeg-devel] [PATCH 2/2] test/fate: add multi component mxf test

2016-09-18 Thread Mark Reid
---
 tests/fate/mxf.mak   |  3 +++
 tests/ref/fate/mxf-multiple-components-demux | 11 +++
 2 files changed, 14 insertions(+)
 create mode 100644 tests/ref/fate/mxf-multiple-components-demux

diff --git a/tests/fate/mxf.mak b/tests/fate/mxf.mak
index 6032c85..e95c0b5 100644
--- a/tests/fate/mxf.mak
+++ b/tests/fate/mxf.mak
@@ -5,6 +5,9 @@ fate-mxf-missing-index-demux: CMD = crc -i 
$(TARGET_SAMPLES)/mxf/opatom_missing_
 FATE_MXF += fate-mxf-essencegroup-demux
 fate-mxf-essencegroup-demux: CMD = framecrc -i 
$(TARGET_SAMPLES)/mxf/opatom_essencegroup_alpha_raw.mxf -vcodec copy
 
+FATE_MXF += fate-mxf-multiple-components-demux
+fate-mxf-multiple-components-demux: CMD = framecrc -i 
$(TARGET_SAMPLES)/mxf/multiple_components.mxf -vcodec copy
+
 FATE_MXF-$(CONFIG_MXF_DEMUXER) += $(FATE_MXF)
 
 FATE_SAMPLES_AVCONV += $(FATE_MXF-yes)
diff --git a/tests/ref/fate/mxf-multiple-components-demux 
b/tests/ref/fate/mxf-multiple-components-demux
new file mode 100644
index 000..9da7bc6
--- /dev/null
+++ b/tests/ref/fate/mxf-multiple-components-demux
@@ -0,0 +1,11 @@
+#tb 0: 1001/24000
+#media_type 0: video
+#codec_id 0: dnxhd
+#dimensions 0: 640x480
+#sar 0: 1/1
+0,  0,  0,1,28672, 0x7a4b0044
+0,  1,  1,1,28672, 0x75dc29a6
+0,  2,  2,1,28672, 0xecabd44b
+0,  3,  3,1,28672, 0xc917a96e
+0,  4,  4,1,28672, 0x7805cfd5
+0,  5,  5,1,28672, 0x55d26dab
-- 
2.9.2

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


[FFmpeg-devel] [PATCH 1/2] avformat/mxfdec: use first valid sourceclip found if material track has multiple components

2016-09-18 Thread Mark Reid
hi,
This patch fixes a issue with mxf footage having multiple
components on a material track.

here is a link to the sample footage for the second patches fate test
https://dl.dropboxusercontent.com/u/170952/fate/mxf/multiple_components.mxf

---
 libavformat/mxfdec.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 0b16463..1939761 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1888,7 +1888,11 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
 }
 }

-/* TODO: handle multiple source clips */
+/* TODO: handle multiple source clips, only finds first valid source 
clip */
+if(material_track->sequence->structural_components_count > 1)
+av_log(mxf->fc, AV_LOG_WARNING, "material track %d: has %d 
components\n",
+   material_track->track_id, 
material_track->sequence->structural_components_count);
+
 for (j = 0; j < material_track->sequence->structural_components_count; 
j++) {
 component = mxf_resolve_sourceclip(mxf, 
&material_track->sequence->structural_components_refs[j]);
 if (!component)
@@ -1914,6 +1918,8 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
 av_log(mxf->fc, AV_LOG_ERROR, "material track %d: no 
corresponding source track found\n", material_track->track_id);
 break;
 }
+if(source_track && component)
+break;
 }
 if (!source_track || !component || !source_package)
 continue;
--
2.9.2
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 4/4] lavf/mov: Add support for edit list parsing.

2016-09-18 Thread Sasi Inguva
Is it ok to just log an error and return 0 ?
On Sep 18, 2016 1:53 PM, "Michael Niedermayer" 
wrote:

> On Sat, Sep 17, 2016 at 03:14:24PM -0700, Sasi Inguva wrote:
> [...]
> > > [...]
> > > > @@ -2756,6 +2757,343 @@ static int mov_read_sbgp(MOVContext *c,
> > > AVIOContext *pb, MOVAtom atom)
> > > >  return pb->eof_reached ? AVERROR_EOF : 0;
> > > >  }
> > > >
> > > > +/**
> > > > + * Get ith edit list entry (media time, duration).
> > > > + */
> > > > +static int get_edit_list_entry(const MOVStreamContext *msc,
> > > > +   unsigned int edit_list_index,
> > > > +   int64_t *edit_list_media_time,
> > > > +   int64_t *edit_list_duration,
> > > > +   int64_t global_timescale)
> > > > +{
> > > > +if (edit_list_index == msc->elst_count) {
> > > > +return 0;
> > > > +}
> > > > +*edit_list_media_time = msc->elst_data[edit_list_index].time;
> > > > +*edit_list_duration = msc->elst_data[edit_list_index].duration;
> > > > +/* duration is in global timescale units;convert to msc
> timescale */
> > > > +*edit_list_duration = av_rescale(*edit_list_duration,
> > > msc->time_scale,
> > > > + global_timescale);
> > >
> > > global_timescale can be 0 here leading to division by 0
> > >
> >
> > Added an assert for global_timescale > 0
>
> thats no solution, aborting on random input is not correct
>
> simply trying
> zzuf -cs1:100 ./ffmpeg -i mov_edl_kf_fix_1.mp4 -f null -
>
> triggers the assert at
> Assertion global_timescale > 0 failed at libavformat/mov.c:2777
> zzuf[s=34,r=0.004]: signal 6 (SIGABRT)
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Avoid a single point of failure, be that a person or equipment.
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] doc/encoders: minor aac encoder formatting improvements

2016-09-18 Thread Moritz Barsnick
Minor changes for markup consistency.

That line I shifted is probably redundant.

Moritz
>From 9c4de92a603ff998d0b45cb783bd624374df6d3d Mon Sep 17 00:00:00 2001
From: Moritz Barsnick 
Date: Sun, 18 Sep 2016 23:51:48 +0200
Subject: [PATCH] doc/encoders: minor aac encoder formatting improvements

Also corrected a line's level.

Signed-off-by: Moritz Barsnick 
---
 doc/encoders.texi | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 321eb2f..73ebd9c 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -61,8 +61,9 @@ Two loop searching (TLS) method.
 
 This method first sets quantizers depending on band thresholds and then tries
 to find an optimal combination by adding or subtracting a specific value from
-all quantizers and adjusting some individual quantizer a little.
-Will tune itself based on whether aac_is/aac_ms/aac_pns are enabled.
+all quantizers and adjusting some individual quantizer a little.  Will tune
+itself based on whether @option{aac_is}, @option{aac_ms} and @option{aac_pns}
+are enabled.
 This is the default choice for a coder.
 
 @item anmr
@@ -84,7 +85,7 @@ Not recommended.
 @end table
 
 @item aac_ms
-Sets mid/side coding mode. The default value of auto will automatically use
+Sets mid/side coding mode. The default value of "auto" will automatically use
 M/S with bands which will benefit from such coding. Can be forced for all bands
 using the value "enable", which is mainly useful for debugging or disabled 
using
 "disable".
@@ -130,19 +131,19 @@ The default, AAC "Low-complexity" profile. Is the most 
compatible and produces
 decent quality.
 
 @item mpeg2_aac_low
-Equivalent to -profile:a aac_low -aac_pns 0. PNS was introduced with the MPEG4
-specifications.
+Equivalent to @code{-profile:a aac_low -aac_pns 0}. PNS was introduced with the
+MPEG4 specifications.
 
 @item aac_ltp
-Long term prediction profile, is enabled by and will enable the aac_ltp option.
-Introduced in MPEG4.
+Long term prediction profile, is enabled by and will enable the 
@option{aac_ltp}
+option. Introduced in MPEG4.
 
 @item aac_main
-Main-type prediction profile, is enabled by and will enable the aac_pred 
option.
-Introduced in MPEG2.
+Main-type prediction profile, is enabled by and will enable the 
@option{aac_pred}
+option. Introduced in MPEG2.
 
-If this option is unspecified it is set to @samp{aac_low}.
 @end table
+If this option is unspecified it is set to @samp{aac_low}.
 @end table
 
 @section ac3 and ac3_fixed
-- 
2.7.4

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


Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: refine EXT-X-BYTERANGE support for segments

2016-09-18 Thread Steven Liu
2016-09-19 0:24 GMT+08:00 Moritz Barsnick :

> On Sun, Sep 18, 2016 at 23:40:34 +0800, Steven Liu wrote:
>
> > +if (byterange_mode) {
> > +version = 4;
> > +sequence = byterange_mode ? 0 : sequence;
>
> What does the ternary if-then-else operation do here? Two lines above,
> byterange_mode was checked for !=0, how can it be anything else here?
>
> > +av_log(oc, AV_LOG_ERROR, "Invalid segment filename
> template '%s', you can try use -use_localtime 1 with it\n", c->basename);
>
> "try to use"
>
> > +if ((outer_st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
> &&
> > +outer_st->codecpar->bit_rate > hls->max_seg_size) {
>
> Inconsistent use of brackets: The "==" comparison has extra brackets,
> the ">" comparison doesn't. (Or am I missing something with operator
> precedence?)
>
> > +av_log(s, AV_LOG_WARNING, "Your video bitrate is bigger
> than hls_segment_size, "
> > +   "%"PRId64 " > %" PRId64" ( video birate >
> hls_segment_size ),the result maybe not you want.",
>
> Apart from the peculiar placement of brackets in the message, I think
> the brackets and their content is not needed, duplicate.
>
> And the sentence should end "the result may not be what you want".
>
> > +if (hls->start_pos >= hls->max_seg_size ) {
>
> Wrong bracket style (whitespace).
>
> > +{"hls_segment_size", "set maximum size per segment file, (in
> bytes)",  OFFSET(max_seg_size),AV_OPT_TYPE_INT,{.i64 = 0},
>  0,   INT_MAX,   E},
>
> You can actually drop the word "set ", as well as the comma before the
> brackets.
>
> Moritz
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


0001-avformat-hlsenc-refine-EXT-X-BYTERANGE-support-for-s.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] avformat/mxfdec: use first valid sourceclip found if material track has multiple components

2016-09-18 Thread Michael Niedermayer
On Sun, Sep 18, 2016 at 02:11:34PM -0700, Mark Reid wrote:
> hi,
> This patch fixes a issue with mxf footage having multiple
> components on a material track.
> 

> here is a link to the sample footage for the second patches fate test
> https://dl.dropboxusercontent.com/u/170952/fate/mxf/multiple_components.mxf

file uploaded

thx

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

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


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


Re: [FFmpeg-devel] [PATCH 4/4] lavf/mov: Add support for edit list parsing.

2016-09-18 Thread Michael Niedermayer
On Sun, Sep 18, 2016 at 02:45:52PM -0700, Sasi Inguva wrote:
> Is it ok to just log an error and return 0 ?

Is a global timescale of 0 allowed ?
QT does not seem to explicitly say so

can something better be done ?

If you are not sure what to do for the 0 case the best would likely be
to ask for a sample using avpriv_request_sample()

thx

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

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


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


Re: [FFmpeg-devel] [PATCH 4/4] lavf/mov: Add support for edit list parsing.

2016-09-18 Thread Sasi Inguva
On Sun, Sep 18, 2016 at 6:05 PM, Michael Niedermayer  wrote:

> On Sun, Sep 18, 2016 at 02:45:52PM -0700, Sasi Inguva wrote:
> > Is it ok to just log an error and return 0 ?
>
> Is a global timescale of 0 allowed ?
> QT does not seem to explicitly say so
>
> can something better be done ?
>
> If you are not sure what to do for the 0 case the best would likely be
> to ask for a sample using avpriv_request_sample()
>
> thx
>
> I created such a file with AtomInspector and played it in QuickTime 10. It
plays the video as "live broadcast". It shows black screen until the first
4s. - the media time of the edit list in the file.
Quicktime 7 says it is an invalid file.

So I think it is not clear how to handle such case. I have updated the code
to use avpriv_request_sample .

Thanks
​
 test_mvhd_timescale_zero_editlist.mov

​


> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Awnsering whenever a program halts or runs forever is
> On a turing machine, in general impossible (turings halting problem).
> On any real computer, always possible as a real computer has a finite
> number
> of states N, and will either halt in less than N cycles or never halt.
>
> ___
> 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