Re: [FFmpeg-devel] [PATCH] mpegaudiodec_template: fix leaking fdsp for mp3on4float

2017-02-15 Thread Michael Niedermayer
On Thu, Feb 16, 2017 at 12:39:17AM +0100, Andreas Cadhalpun wrote:
> Signed-off-by: Andreas Cadhalpun 
> ---
>  libavcodec/mpegaudiodec_template.c | 3 +++
>  1 file changed, 3 insertions(+)

should be ok

why was this not detected by fate ?
are we lacking a test for this ?

[...]

-- 
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] wmaprodec: fix leaking fdsp on init failure

2017-02-15 Thread Michael Niedermayer
On Thu, Feb 16, 2017 at 12:56:38AM +0100, Andreas Cadhalpun wrote:
> Signed-off-by: Andreas Cadhalpun 
> ---
>  libavcodec/wmaprodec.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)

should be ok

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] AVFMT_FLAG_NOBUFFER not working on ffmpeg2.8 branch

2017-02-15 Thread Shi Qiu
the structure is different, it doesn't appear in ffmpeg3

On Wed, Feb 15, 2017 at 10:00 AM, Michael Niedermayer <
mich...@niedermayer.cc> wrote:

> On Wed, Feb 15, 2017 at 08:24:24AM +0800, Shi Qiu wrote:
> > no, it's different in ffmpeg3
>
> which commit fixed it ?
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Asymptotically faster algorithms should always be preferred if you have
> asymptotical amounts of data
>
> ___
> 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] avformat/hlsenc: set default http method to PUT when method is null

2017-02-15 Thread Steven Liu
2017-02-16 4:19 GMT+08:00 Michael Niedermayer :

> On Wed, Feb 15, 2017 at 11:45:49PM +0800, Steven Liu wrote:
> > When the http method is not set, the method will use POST for ts,
> > PUT for m3u8, it is not unify, now set it unify.
> > This ticket id: 5315
> >
> > Signed-off-by: Steven Liu 
> > ---
> >  libavformat/hlsenc.c | 14 +++---
> >  1 file changed, 11 insertions(+), 3 deletions(-)
>
> this breaks fate-filter-hls-append
>
> heres a backtrace, sorry for the missing line numbers i can rebuild
> with debug stuff if you cannot reproduce
>
> ==19211== Process terminating with default action of signal 11 (SIGSEGV)
> ==19211==  Access not within mapped region at address 0x0
> ==19211==at 0x4C2FC89: strspn (mc_replace_strmem.c:1491)
> ==19211==by 0x62FAEC: url_find_protocol (in ffmpeg_g)
> ==19211==by 0x630938: avio_find_protocol_name (in ffmpeg_g)
> ==19211==by 0x664595: hls_window (in ffmpeg_g)
> ==19211==by 0x666A20: hls_write_trailer (in ffmpeg_g)
> ==19211==by 0x6C5BAC: av_write_trailer (in ffmpeg_g)
> ==19211==by 0x4C3951: transcode (in ffmpeg_g)
> ==19211==by 0x4A5257: main (in ffmpeg_g)
>

 localhost:test StevenLiu$ lldb -c /cores/core.83014 ./ffmpeg_g
(lldb) target create "./ffmpeg_g" --core "/cores/core.83014"
warning: (x86_64) /cores/core.83014 load command 94 LC_SEGMENT_64 has a
fileoff + filesize (0x2e918000) that extends beyond the end of the file
(0x2e917000), the segment will be truncated to match
warning: (x86_64) /cores/core.83014 load command 95 LC_SEGMENT_64 has a
fileoff (0x2e918000) that extends beyond the end of the file (0x2e917000),
ignoring this section
Core file '/cores/core.83014' (x86_64) was loaded.
(lldb) bt
* thread #1: tid = 0x, 0x7fffa1c12f68 libsystem_c.dylib`strspn +
22, stop reason = signal SIGSTOP
  * frame #0: 0x7fffa1c12f68 libsystem_c.dylib`strspn + 22
frame #1: 0x0001027fea23
ffmpeg_g`url_find_protocol(filename=0x) + 51 at avio.c:255
[opt]
frame #2: 0x0001027ff286
ffmpeg_g`avio_find_protocol_name(url=) + 6 at avio.c:475 [opt]
frame #3: 0x000102837f54 ffmpeg_g`hls_window [inlined]
set_http_options(c=0x7ff48181cc00) + 12 at hlsenc.c:669 [opt]
frame #4: 0x000102837f48 ffmpeg_g`hls_window(s=0x7ff48181c600,
last=) + 264 at hlsenc.c:720 [opt]
frame #5: 0x0001028368e2
ffmpeg_g`hls_write_trailer(s=0x7ff48181c600) + 562 at hlsenc.c:1431
[opt]
frame #6: 0x000102899736 ffmpeg_g`av_write_trailer(s=)
+ 278 at mux.c:1329 [opt]
frame #7: 0x0001026a4a8c ffmpeg_g`transcode + 19740 at
ffmpeg.c:4430 [opt]
frame #8: 0x00010269f5e1 ffmpeg_g`main(argc=,
argv=) + 337 at ffmpeg.c:4598 [opt]
frame #9: 0x7fffa1b81255 libdyld.dylib`start + 1
frame #10: 0x7fffa1b81255 libdyld.dylib`start + 1


I have reproduced and fixed it.

>
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Complexity theory is the science of finding the exact solution to an
> approximation. Benchmarking OTOH is finding an approximation of the exact
>
> ___
> 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 v2] avformat/hlsenc: set default http method to PUT when method is null

2017-02-15 Thread Steven Liu
When the http method is not set, the method will use POST for ts,
PUT for m3u8, it is not unify, now set it unify.
This ticket id: 5315

Reviewed-by: Moritz Barsnick 
Signed-off-by: Steven Liu 
---
 libavformat/hlsenc.c | 27 ++-
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 930e94b..c8401ec 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -242,7 +242,7 @@ fail:
 return -1;
 }
 
-static int hls_delete_old_segments(HLSContext *hls) {
+static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls) {
 
 HLSSegment *segment, *previous_segment = NULL;
 float playlist_duration = 0.0f;
@@ -251,6 +251,7 @@ static int hls_delete_old_segments(HLSContext *hls) {
 char *path = NULL;
 AVDictionary *options = NULL;
 AVIOContext *out = NULL;
+const char *proto = NULL;
 
 segment = hls->segments;
 while (segment) {
@@ -300,7 +301,8 @@ static int hls_delete_old_segments(HLSContext *hls) {
 av_strlcat(path, segment->filename, path_size);
 }
 
-if (hls->method) {
+proto = avio_find_protocol_name(s->filename);
+if (hls->method || (proto && !av_strcasecmp(proto, "http"))) {
 av_dict_set(, "method", "DELETE", 0);
 if ((ret = hls->avf->io_open(hls->avf, , path, 
AVIO_FLAG_WRITE, )) < 0)
 goto fail;
@@ -321,7 +323,7 @@ static int hls_delete_old_segments(HLSContext *hls) {
 av_strlcpy(sub_path, dirname, sub_path_size);
 av_strlcat(sub_path, segment->sub_filename, sub_path_size);
 
-if (hls->method) {
+if (hls->method || (proto && !av_strcasecmp(proto, "http"))) {
 av_dict_set(, "method", "DELETE", 0);
 if ((ret = hls->avf->io_open(hls->avf, , sub_path, 
AVIO_FLAG_WRITE, )) < 0) {
 av_free(sub_path);
@@ -576,7 +578,7 @@ static int hls_append_segment(struct AVFormatContext *s, 
HLSContext *hls, double
 #endif
 en->next = hls->old_segments;
 hls->old_segments = en;
-if ((ret = hls_delete_old_segments(hls)) < 0)
+if ((ret = hls_delete_old_segments(s, hls)) < 0)
 return ret;
 } else
 av_free(en);
@@ -663,10 +665,17 @@ static void hls_free_segments(HLSSegment *p)
 }
 }
 
-static void set_http_options(AVDictionary **options, HLSContext *c)
+static void set_http_options(AVFormatContext *s, AVDictionary **options, 
HLSContext *c)
 {
-if (c->method)
+const char *proto = avio_find_protocol_name(s->filename);
+int http_base_proto = !av_strcasecmp(proto, "http") || 
!av_strcasecmp(proto, "https");
+
+if (c->method) {
 av_dict_set(options, "method", c->method, 0);
+} else if (proto && http_base_proto) {
+av_log(c, AV_LOG_WARNING, "No HTTP method set, hls muxer defaulting to 
method PUT.\n");
+av_dict_set(options, "method", "PUT", 0);
+}
 }
 
 static void write_m3u8_head_block(HLSContext *hls, AVIOContext *out, int 
version,
@@ -710,7 +719,7 @@ static int hls_window(AVFormatContext *s, int last)
 if (!use_rename && !warned_non_file++)
 av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this 
may lead to races and temporary partial files\n");
 
-set_http_options(, hls);
+set_http_options(s, , hls);
 snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : 
"%s", s->filename);
 if ((ret = s->io_open(s, , temp_filename, AVIO_FLAG_WRITE, )) 
< 0)
 goto fail;
@@ -947,7 +956,7 @@ static int hls_start(AVFormatContext *s)
 }
 c->number++;
 
-set_http_options(, c);
+set_http_options(s, , c);
 
 if (c->flags & HLS_TEMP_FILE) {
 av_strlcat(oc->filename, ".tmp", sizeof(oc->filename));
@@ -979,7 +988,7 @@ static int hls_start(AVFormatContext *s)
 if ((err = s->io_open(s, >pb, oc->filename, AVIO_FLAG_WRITE, 
)) < 0)
 goto fail;
 if (c->vtt_basename) {
-set_http_options(, c);
+set_http_options(s, , c);
 if ((err = s->io_open(s, _oc->pb, vtt_oc->filename, 
AVIO_FLAG_WRITE, )) < 0)
 goto fail;
 }
-- 
2.10.1.382.ga23ca1b.dirty



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


[FFmpeg-devel] [PATCH] bink: fix leaking last frame on error

2017-02-15 Thread Andreas Cadhalpun
Signed-off-by: Andreas Cadhalpun 
---
 libavcodec/bink.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/bink.c b/libavcodec/bink.c
index cc55870114..91004a6ae5 100644
--- a/libavcodec/bink.c
+++ b/libavcodec/bink.c
@@ -1299,10 +1299,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
 }
 c->avctx = avctx;
 
-c->last = av_frame_alloc();
-if (!c->last)
-return AVERROR(ENOMEM);
-
 if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0)
 return ret;
 
@@ -1317,6 +1313,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
 return ret;
 }
 
+c->last = av_frame_alloc();
+if (!c->last)
+return AVERROR(ENOMEM);
+
 if (c->version == 'b') {
 if (!binkb_initialised) {
 binkb_calc_quant();
-- 
2.11.0
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCHv2 3/4] mkv: Export bounds and padding from spherical metadata

2017-02-15 Thread James Almer
On 2/15/2017 1:29 PM, Vittorio Giovara wrote:
> ---
> Updated according to James' review.
> Please CC.
> Vittorio
> 
>  libavformat/matroskadec.c  | 69 
> --
>  tests/ref/fate/matroska-spherical-mono |  6 ++-
>  2 files changed, 71 insertions(+), 4 deletions(-)
> 
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index 7223e94..6fa961e 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -1913,16 +1913,65 @@ static int mkv_parse_video_projection(AVStream *st, 
> const MatroskaTrack *track)
>  AVSphericalMapping *spherical;
>  enum AVSphericalProjection projection;
>  size_t spherical_size;
> +size_t l, t, r, b;
> +size_t padding = 0;
>  int ret;
> +GetByteContext gb;
> +
> +bytestream2_init(, track->video.projection.private.data,
> + track->video.projection.private.size);
> +
> +if (bytestream2_get_byte() != 0) {
> +av_log(NULL, AV_LOG_WARNING, "Unknown spherical metadata\n");
> +return 0;
> +}
> +
> +bytestream2_skip(, 3); // flags
>  
>  switch (track->video.projection.type) {
>  case MATROSKA_VIDEO_PROJECTION_TYPE_EQUIRECTANGULAR:
> -projection = AV_SPHERICAL_EQUIRECTANGULAR;
> +if (track->video.projection.private.size == 0)
> +projection = AV_SPHERICAL_EQUIRECTANGULAR;
> +else if (track->video.projection.private.size == 20) {
> +t = bytestream2_get_be32();
> +b = bytestream2_get_be32();
> +l = bytestream2_get_be32();
> +r = bytestream2_get_be32();
> +
> +if (b >= UINT_MAX - t || r >= UINT_MAX - l) {
> +av_log(NULL, AV_LOG_ERROR,
> +   "Invalid bounding rectangle coordinates "
> +   "%zu,%zu,%zu,%zu\n", l, t, r, b);
> +return AVERROR_INVALIDDATA;
> +}
> +
> +if (l || t || r || b)
> +projection = AV_SPHERICAL_EQUIRECTANGULAR_TILE;
> +else
> +projection = AV_SPHERICAL_EQUIRECTANGULAR;
> +} else {
> +av_log(NULL, AV_LOG_ERROR, "Unknown spherical metadata\n");
> +return AVERROR_INVALIDDATA;
> +}

I think this'll look better as


case MATROSKA_VIDEO_PROJECTION_TYPE_EQUIRECTANGULAR:
projection = AV_SPHERICAL_EQUIRECTANGULAR;

if (track->video.projection.private.size == 20) {
[...]
if (l || t || r || b)
projection = AV_SPHERICAL_EQUIRECTANGULAR_TILE;
} else if (track->video.projection.private.size != 0) {
// return error
}
break;

But it's cosmetic. If you change it then don't sent a new patch just for it.

>  break;
>  case MATROSKA_VIDEO_PROJECTION_TYPE_CUBEMAP:
> -if (track->video.projection.private.size < 4)
> +if (track->video.projection.private.size < 4) {
> +av_log(NULL, AV_LOG_ERROR, "Missing projection private 
> properties\n");
> +return AVERROR_INVALIDDATA;
> +} else if (track->video.projection.private.size == 12) {
> +uint32_t layout = bytestream2_get_be32();
> +if (layout == 0) {
> +projection = AV_SPHERICAL_CUBEMAP;
> +} else {
> +av_log(NULL, AV_LOG_WARNING,
> +   "Unknown spherical cubemap layout %"PRIu32"\n", 
> layout);
> +return 0;
> +}
> +padding = bytestream2_get_be32();
> +} else {
> +av_log(NULL, AV_LOG_ERROR, "Unknown spherical metadata\n");
>  return AVERROR_INVALIDDATA;
> -projection = AV_SPHERICAL_CUBEMAP;
> +}
>  break;
>  default:
>  return 0;
> @@ -1937,6 +1986,20 @@ static int mkv_parse_video_projection(AVStream *st, 
> const MatroskaTrack *track)
>  spherical->pitch = (int32_t)(track->video.projection.pitch * (1 << 16));
>  spherical->roll  = (int32_t)(track->video.projection.roll  * (1 << 16));
>  
> +spherical->padding = padding;
> +
> +if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
> +/* conversion from 0.32 coordinates to pixels */
> +size_t orig_width  = (size_t) track->video.pixel_width  * UINT32_MAX 
> / (UINT32_MAX - r - l);
> +size_t orig_height = (size_t) track->video.pixel_height * UINT32_MAX 
> / (UINT32_MAX - b - t);
> +
> +/* add a (UINT32_MAX - 1) to round up integer division */
> +spherical->bound_left   = (orig_width  * l + UINT32_MAX - 1) / 
> UINT32_MAX;
> +spherical->bound_top= (orig_height * t + UINT32_MAX - 1) / 
> UINT32_MAX;
> +spherical->bound_right  = orig_width  - track->video.pixel_width  - 
> spherical->bound_left;
> +spherical->bound_bottom = orig_height - track->video.pixel_height - 
> spherical->bound_top;
> +}
> +
>  ret = 

[FFmpeg-devel] [PATCH] mpegaudiodec_template: fix leaking fdsp for mp3on4float

2017-02-15 Thread Andreas Cadhalpun
Signed-off-by: Andreas Cadhalpun 
---
 libavcodec/mpegaudiodec_template.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/mpegaudiodec_template.c 
b/libavcodec/mpegaudiodec_template.c
index 1114428f33..53c09edced 100644
--- a/libavcodec/mpegaudiodec_template.c
+++ b/libavcodec/mpegaudiodec_template.c
@@ -1828,6 +1828,9 @@ static av_cold int decode_close_mp3on4(AVCodecContext * 
avctx)
 MP3On4DecodeContext *s = avctx->priv_data;
 int i;
 
+if (s->mp3decctx[0])
+av_freep(>mp3decctx[0]->fdsp);
+
 for (i = 0; i < s->frames; i++)
 av_freep(>mp3decctx[i]);
 
-- 
2.11.0
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] tiff: fix leaking yuv_line

2017-02-15 Thread Andreas Cadhalpun
Signed-off-by: Andreas Cadhalpun 
---
 libavcodec/tiff.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index efbd9791a5..474ea90015 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1386,6 +1386,7 @@ static av_cold int tiff_end(AVCodecContext *avctx)
 
 ff_lzw_decode_close(>lzw);
 av_freep(>deinvert_buf);
+av_freep(>yuv_line);
 return 0;
 }
 
-- 
2.11.0
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: implement halve filter

2017-02-15 Thread Michael Niedermayer
On Tue, Feb 14, 2017 at 08:44:54PM +0100, Daniel Oberhoff wrote:
> filter strictly “halves” the image efficiently, which is often exactly what 
> is needed
> likely much faster than using scale
> fully slice parallelized
> 
> Signed-off-by: Daniel Oberhoff 
> ---
>  libavfilter/Makefile |   1 +
>  libavfilter/allfilters.c |   1 +
>  libavfilter/vf_halve.c   | 367 
> +++
>  3 files changed, 369 insertions(+)
>  create mode 100644 libavfilter/vf_halve.c

if you want to improve scaling by a specific factor, be that with
a specialized implementation, threads, SIMD or other that belongs
into libswscale.
libswscale is the component in FFmpeg and avfilter that does that

having many special cases added into libavfilter filters that could be
done equally fast in libswscale is not a good idea.
Also this filter would not be used when scaling by that factor unless
its manually used, which means it would have very few users in practice
while in swscale it would be used automatically if the case and
quality settings match ...

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

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


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


Re: [FFmpeg-devel] [PATCH] lavc: consider an error during decoder draining as EOF

2017-02-15 Thread Michael Niedermayer
On Wed, Feb 15, 2017 at 08:53:18AM +0100, wm4 wrote:
> There is no reason that draining couldn't return an error or two. But
> some decoders don't handle this very well, and might always return an
> error. This can lead to API users getting into an infinite loop and
> burning CPU, because no progress is made and EOF is never returned.
> 
> In fact, ffmpeg.c contains a hack against such a case. It is removed
> with this patch. This particular error case seems to have been fixed
> since the hack was added, though.
> 
> This might lose frames if decoding returns errors during draining.
> ---
>  ffmpeg.c   | 6 --
>  libavcodec/utils.c | 6 +++---
>  2 files changed, 3 insertions(+), 9 deletions(-)

should be 2 patches, libavcodec one should bump minor version
"new" ffmpeg depends on the change (new version) otherwise it could get
stuck

thx

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

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch


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


Re: [FFmpeg-devel] [PATCH] avfilter: implement halve filter

2017-02-15 Thread James Darnley
On 2017-02-14 22:25, Mark Thompson wrote:
> On 14/02/17 19:44, Daniel Oberhoff wrote:
>> filter strictly “halves” the image efficiently, which is often exactly what 
>> is needed
>> likely much faster than using scale
> 
> Did you benchmark this?  How?
> 
> $ time ./ffmpeg -f lavfi -i allyuv -vf 'scale=iw/2:ih/2' -vframes 400 -f null 
> -
> ...
> frame=  400 fps= 26 q=-0.0 Lsize=N/A time=00:00:16.00 bitrate=N/A speed=1.05x
> ...
> real0m15.365s
> user0m11.092s
> sys 0m4.272s
> 
> $ time ./ffmpeg -f lavfi -i allyuv -vf 'halve' -vframes 400 -f null -
> ...
> frame=  400 fps= 22 q=-0.0 Lsize=N/A time=00:00:16.00 bitrate=N/A speed=0.873x
> ...
> real0m18.392s
> user0m46.280s
> sys 0m3.656s
> 
> So it uses four times as much CPU as swscale to be marginally slower?

I would be tempted to blame the lack of SIMD for the poor performance.




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


Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: set default http method to PUT when method is null

2017-02-15 Thread Moritz Barsnick
On Wed, Feb 15, 2017 at 23:45:49 +0800, Steven Liu wrote:
> +proto = avio_find_protocol_name(hls->basename);
> +if (hls->method || (proto && !av_strcasecmp(proto, "http"))) {

Would this also need to apply to https? (I'm not sure whether those
protocols are distinguished.)

> +av_log(c, AV_LOG_WARNING, "You forget set http method, hls muxer 
> auto set default method to PUT\n");

"No HTTP method set, hls muxer defaulting to method PUT.\n"

(If you actually want to keep the original sentence: "You forget to set
http method, hls muxer automatically set default method to PUT\n". I
would avoid the use of "you"...)

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


Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: set default http method to PUT when method is null

2017-02-15 Thread Michael Niedermayer
On Wed, Feb 15, 2017 at 11:45:49PM +0800, Steven Liu wrote:
> When the http method is not set, the method will use POST for ts,
> PUT for m3u8, it is not unify, now set it unify.
> This ticket id: 5315
> 
> Signed-off-by: Steven Liu 
> ---
>  libavformat/hlsenc.c | 14 +++---
>  1 file changed, 11 insertions(+), 3 deletions(-)

this breaks fate-filter-hls-append

heres a backtrace, sorry for the missing line numbers i can rebuild
with debug stuff if you cannot reproduce

==19211== Process terminating with default action of signal 11 (SIGSEGV)
==19211==  Access not within mapped region at address 0x0
==19211==at 0x4C2FC89: strspn (mc_replace_strmem.c:1491)
==19211==by 0x62FAEC: url_find_protocol (in ffmpeg_g)
==19211==by 0x630938: avio_find_protocol_name (in ffmpeg_g)
==19211==by 0x664595: hls_window (in ffmpeg_g)
==19211==by 0x666A20: hls_write_trailer (in ffmpeg_g)
==19211==by 0x6C5BAC: av_write_trailer (in ffmpeg_g)
==19211==by 0x4C3951: transcode (in ffmpeg_g)
==19211==by 0x4A5257: main (in ffmpeg_g)


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

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact


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


[FFmpeg-devel] [PATCH] lavf/mov.c: Correct keyframe search in edit list to return the very first keyframe/frame with matching timestamp. Fixes ticket#5904

2017-02-15 Thread Sasi Inguva
Signed-off-by: Sasi Inguva 
---
 libavformat/mov.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index b5181775e7..2a7cbfe142 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2847,11 +2847,23 @@ static int64_t find_prev_closest_index(AVStream *st,
 AVIndexEntry *e_keep = st->index_entries;
 int nb_keep = st->nb_index_entries;
 int64_t found = -1;
+int64_t i = 0;
 
 st->index_entries = e_old;
 st->nb_index_entries = nb_old;
 found = av_index_search_timestamp(st, timestamp, flag | 
AVSEEK_FLAG_BACKWARD);
 
+// Keep going backwards in the index entries until the timestamp is the 
same.
+if (found >= 0) {
+for (i = found; i > 0 && e_old[i].timestamp == e_old[i - 1].timestamp;
+ i--) {
+if ((flag & AVSEEK_FLAG_ANY) ||
+(e_old[i - 1].flags & AVINDEX_KEYFRAME)) {
+found = i - 1;
+}
+}
+}
+
 /* restore AVStream state*/
 st->index_entries = e_keep;
 st->nb_index_entries = nb_keep;
-- 
2.11.0.483.g087da7b7c-goog

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


Re: [FFmpeg-devel] [PATCH] doc: correct-table-end-for-metadata-filter

2017-02-15 Thread Paul B Mahol
On 2/15/17, Mulvya V  wrote:
> Hi,
>
> At present, the 'file' option is shown as a possible choice of value for
> the 'expr' option in the metadata filter, due to a misplaced 'end table'
> directive. Corrected in patch.
>
> Regards,
> Mulvya
>

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


Re: [FFmpeg-devel] [PATCH v2 0/8] Merge lazy filter initialization in ffmpeg CLI

2017-02-15 Thread Mark Thompson
On 15/02/17 18:15, Carl Eugen Hoyos wrote:
> 2017-02-15 17:47 GMT+01:00 wm4 :
> 
>> What I don't want is that you post a new failing case approximately
>> every 24 hours, with no end in sight, and with the implication that
>> it's supposed to be fixed before merge. At this rate it could take
>> weeks, with every day following the same pattern.
> 
> Aren't you simply describing a general development and review
> process here?

No.  Normally one reviews whole patches rather than stopping after the first 
comment or two and waiting for another iteration before noting further issues 
later in the patch.

(Regular use of FATE is a special case here, since all developers should be 
able to run it and find any issues themselves.  If someone were running it on 
some special target that others would not have access to then I would expect 
them to supply output with -k if the issue wasn't obviously the same thing 
throughout to avoid that same unhelpful iteration.)

I assume Micheal is finding these cases by some automated process.  If it would 
be possible to either replicate that process or to have the results of a whole 
run rather than just the next one or two cases at a time then I think this 
exercise would be somewhat less frustrating for those involved.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] doc: correct-table-end-for-metadata-filter

2017-02-15 Thread Mulvya V
Hi,

At present, the 'file' option is shown as a possible choice of value for
the 'expr' option in the metadata filter, due to a misplaced 'end table'
directive. Corrected in patch.

Regards,
Mulvya


0001-doc-correct-table-end-for-metadata-filter.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 0/8] Merge lazy filter initialization in ffmpeg CLI

2017-02-15 Thread Carl Eugen Hoyos
2017-02-15 17:47 GMT+01:00 wm4 :

> What I don't want is that you post a new failing case approximately
> every 24 hours, with no end in sight, and with the implication that
> it's supposed to be fixed before merge. At this rate it could take
> weeks, with every day following the same pattern.

Aren't you simply describing a general development and review
process here?

> Maybe you could at least maybe analyze breakages yourself before
> pointing them out. That would be helpful.

(Given that Michael had already answered this, mentioning it
again seems quite offensive to me.)

> Besides even regular patches can have regressions. For example, with
> the edit list patches, entire files didn't decode. (Now I don't want to
> single out those patches specifically - they're simply in my recent
> memory.)

Not sure what you are implying here or how the commits are related
but these patches were among the most important changes in FFmpeg
in a long time and they were on the mailing list for some time waiting
for reviews.

That's apart from the fact that the author is happy to look into issues
as soon as he knows about them (he said so and has shown this).

>> In projects based on fork & merge the people doing the merge would not
>> fix regressions, the authors or person making a pull request would fix
>> the regressions either before merge or after through a subsequent pull
>> request or patch.
>
> I have no idea what you're talking about.
>
> This is not a typical merge.

> We're dependent on merging Libav

What does that mean?

> from a "non cooperating" foreign project. It wasn't my idea either. We're
> behind by over 500 commits, and there are Libav features which people
> need/want to have in FFmpeg.
>
>> In projects based on send patch and apply, the authors or patch
>> submitter fixes regressions and resubmit patches or submit new patches
>> if an issue is found after push.
>
> See above. If you want to stop merges, please say so.

> If not, you should probably try not to prevent them.

Just to clarify:
Michael has repeatedly written that he wants the merges to happen.

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


Re: [FFmpeg-devel] [PATCH 1/3] spherical: Add tiled equirectangular type and projection-specific properties

2017-02-15 Thread Aaron Colwell
On Wed, Feb 15, 2017 at 5:52 AM James Almer  wrote:

> On 2/14/2017 11:20 PM, Vittorio Giovara wrote:
> > On Tue, Feb 14, 2017 at 6:54 PM, James Almer  wrote:
> >> On 2/14/2017 5:52 PM, Vittorio Giovara wrote:
> >>> On Fri, Feb 10, 2017 at 6:25 PM, Michael Niedermayer
> >>>  wrote:
>  On Fri, Feb 10, 2017 at 04:11:43PM -0500, Vittorio Giovara wrote:
> > Signed-off-by: Vittorio Giovara 
> > ---
> > This should help not losing details over muxing and allows
> > callers to get additional information in a clean manner.
> >
> > Please keep me in CC.
> > Vittorio
> >
> >  doc/APIchanges|  5 +
> >  ffprobe.c | 11 --
> >  libavformat/dump.c| 10 +
> >  libavutil/spherical.h | 56
> +++
> >  libavutil/version.h   |  2 +-
> >  5 files changed, 81 insertions(+), 3 deletions(-)
> 
>  breaks fate
> 
>  --- ./tests/ref/fate/matroska-spherical-mono2017-02-10
> 23:43:51.993432371 +0100
>  +++ tests/data/fate/matroska-spherical-mono 2017-02-11
> 00:24:10.297483318 +0100
>  @@ -7,7 +7,7 @@
>   [/SIDE_DATA]
>   [SIDE_DATA]
>   side_data_type=Spherical Mapping
>  -side_data_size=16
>  +side_data_size=56
>   projection=equirectangular
>   yaw=45
>   pitch=30
>  Test matroska-spherical-mono failed. Look at
> tests/data/fate/matroska-spherical-mono.err for details.
>  make: *** [fate-matroska-spherical-mono] Error 1
> >>>
> >>> Ah I didn't notice, it is fixed in the next commit, but I'll amend
> this one too.
> >>>
> >>>
> >>> I didn't see any comment/discussion, should I assume it is ok?
> >>> Please CC, thank you.
> >>
> >> These are a lot of projection specific fields. It worries me as the
> >> spec may change in the future with new fields added or existing
> >> fields changing purpose. Not to mention the Mesh projection, which
> >> has like fifty specific fields of its own.
> >
> > Even if the spec change (which at this point would be a terrible
> > terrible thing to do) there are now files in the wild and software
> > that have adopted this draft, so we would have to support this anyway.
>
> If the spec changes, it will be the contents of the equi/cbmp/mesh.
> By exporting them raw as extradata, said changes in the spec would
> require no changes to our implementation.
>

This is one of the main reasons I was suggesting this path. I think of
these extradata fields much like the extra data that codecs have. It really
is only important to the code that needs to render a specific projection.
For transcoding, you mainly just need to convey the information in a
lossless manner from demuxer to muxer.

I anticipate the spec will change in the future. My plan is that no change
will break what is currently specified in the spec right now, but I
anticipate some changes will be made. Having a solution that can gracefully
handle this would be nice.



> >
> >> Wouldn't it be a better idea to export the binary data of the
> >> equi/cbmp/mesh boxes into an extradata-like field in the
> >> AVSphericalMapping struct, and let the downstream application parse
> >> it instead?
> >
> > No I don't think so, lavf is an abstraction layer and one of its tasks
> > is to provide a (simple?) unified entry layer. and letting the user
> > parse binary data is IMO bad design and very fragile. Also it's not
> > impossible that another standard for tagging spherical metadata
> > emerges in the future: the current API could very easily wrap it,
> > while exporting the binary entry would be too specification-specific
> > and it would be tied too heavily on the google draft.
>
>
I agree with Vittorio that having some form of abstraction is a good thing
and having binary data in places can be problematic. It feels like we could
find some middle ground here by providing helper functions that parse the
binary data into projection specific structs and back just like codecs code
tends to do. I feel like this provides a reasonable balance between having
a common set of fields where things actually have common semantics like
projection_type, yaw/pitch/roll, & extra_data while also providing a way to
get access to projection specific information in a simple way.

At the end of the day players really just need to care about a rendering
mesh so in some sense it would be nice to have that be the abstraction for
the player use case. That is basically what we have done in our internal
player implementations. That could easily be handled by helper functions,
but would be a bad representation for AVSphericalMapping because it would
make transcoding/transmuxing painful.


> AVSphericalMapping is already pretty tied to the google draft, but
> i guess you're right, it's at least generic enough for now.
>
>
I too feel like this path is tying the API pretty closely to 

Re: [FFmpeg-devel] [PATCH v2 0/8] Merge lazy filter initialization in ffmpeg CLI

2017-02-15 Thread wm4
On Wed, 15 Feb 2017 17:17:03 +0100
Michael Niedermayer  wrote:

> On Wed, Feb 15, 2017 at 03:22:33PM +0100, Michael Niedermayer wrote:
> > On Wed, Feb 15, 2017 at 10:24:15AM +0100, wm4 wrote:  
> > > These patches merge the previously skipped Libav commits, which made
> > > avconv lazily initialize libavfilter graphs. This means the filters
> > > are initialized with the actual output format, instead of whatever
> > > libavformat reports.
> > > 
> > > It's a prerequisite to making hardware decoding support saner, as
> > > hardware decoders will output a different pixfmt than the software
> > > format reported by libavformat. This can be seen on ffmpeg_qsv.c
> > > and ffmpeg_cuvid.c, which don't lose any functionality, even though
> > > half of the code is removed.
> > > 
> > > There are some differences in how ffmpeg.c and avconv.c filter-flow
> > > works. Also, avconv.c doesn't have sub2video. Relatively intrusive
> > > changes were required.
> > > 
> > > I plan to push this tomorrow, except if critical errors are found.
> > > 
> > > Anton Khirnov (4):
> > >   ffmpeg: do packet ts rescaling in write_packet()
> > >   ffmpeg: init filtergraphs only after we have a frame on each input
> > >   ffmpeg: move flushing the queued frames to configure_filtergraph()
> > >   ffmpeg: restructure sending EOF to filters
> > > 
> > > Timo Rothenpieler (2):
> > >   ffmpeg_cuvid: adapt for recent filter graph initialization changes
> > >   avcodec/cuvid: update hw_frames_ctx reference after get_format call
> > > 
> > > wm4 (2):
> > >   ffmpeg: make sure packets put into the muxing FIFO are refcounted
> > >   ffmpeg: fix printing of filter input/output names  
> > 
> > breaks: (Application provided invalid, non monotonically increasing dts to 
> > muxer in stream 1: 1824120 >= 70020)
> > 
> > ./ffmpeg -skip_frame nokey -ss 20  -i ~/tickets/2024/dvbsubtest.ts -qscale 
> > 2  -scodec dvbsub -t 6   -an file.ts
> >   
> 
> wm4 had a quite good comment, iam replying here as i belive its a
> important matter and shouldnt disappear in a IRC log
> 
>  I don't understand why we got to fix every< obscure
>  oops
>  ...every obscure regression, but something like mp4 edit lists makes it 
> in just fine
>  michaelni: if you don't like the merges, do it yourself
>  I'm not going to delay this because you come up with a regression every 
> other day
>  I'm only merging, not fixing every regression this will ever cause
> 
> I understand your point very well, ive done enough merges in the past ...
> but
> who will fix the regressions ?

You're welcome to. Some merges have been group efforts, why not this
one?

What I don't want is that you post a new failing case approximately
every 24 hours, with no end in sight, and with the implication that
it's supposed to be fixed before merge. At this rate it could take
weeks, with every day following the same pattern.

Maybe you could at least maybe analyze breakages yourself before
pointing them out. That would be helpful.

Besides even regular patches can have regressions. For example, with
the edit list patches, entire files didn't decode. (Now I don't want to
single out those patches specifically - they're simply in my recent
memory.)

> In projects based on fork & merge the people doing the merge would not
> fix regressions, the authors or person making a pull request would fix
> the regressions either before merge or after through a subsequent pull
> request or patch.

I have no idea what you're talking about.

This is not a typical merge. We're dependent on merging Libav from a
"non cooperating" foreign project. It wasn't my idea either. We're
behind by over 500 commits, and there are Libav features which people
need/want to have in FFmpeg.

> In projects based on send patch and apply, the authors or patch
> submitter fixes regressions and resubmit patches or submit new patches
> if an issue is found after push.

See above. If you want to stop merges, please say so. If not, you
should probably try not to prevent them. I'm not even saying you do,
but from my perspective the way and timing you point out the regressions
is a bit unhelpful. I've seen the same happening to others when they
merged Libav commits.

It's entirely possible that I interpret your behavior as hostile, even
though it isn't. Please correct me if I'm wrong.

> Please someone correct me if iam wrong but some of these patches
> dont have an author interrested in fixing issues in FFmpeg.
> I think for such changes whoever wants that code in has to
> accept the obligations the author normally has. This is my oppinion
> not an objection or demand.

Doesn't stop you from merging regular patches from contributors who run
away later (i.e. become unresponsive).

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


[FFmpeg-devel] [PATCHv2 1/4] spherical: Add tiled equirectangular type and projection-specific properties

2017-02-15 Thread Vittorio Giovara
Signed-off-by: Vittorio Giovara 
---
Updated with fate changes and more consistent names.
Please CC.
Vittorio

 doc/APIchanges |  5 +++
 ffprobe.c  | 11 +--
 libavformat/dump.c | 10 ++
 libavutil/spherical.h  | 56 ++
 libavutil/version.h|  2 +-
 tests/ref/fate/matroska-spherical-mono |  2 +-
 tests/ref/fate/mov-spherical-mono  |  2 +-
 7 files changed, 83 insertions(+), 5 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index d739895..663bab1 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,11 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2017-02-10 - xxx - lavu 55.48.100 / 55.33.0 - spherical.h
+  Add AV_SPHERICAL_EQUIRECTANGULAR_TILE, and projection-specific properties
+  (bound_left, bound_top, bound_right, bound_bottom, padding) to
+  AVSphericalMapping.
+
 2017-02-13 - xxx - lavc 57.80.100 - avcodec.h
   Add AVCodecContext.hw_device_ctx.
 
diff --git a/ffprobe.c b/ffprobe.c
index 046f080..acda9bc 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -1788,9 +1788,16 @@ static void print_pkt_side_data(WriterContext *w,
 const AVSphericalMapping *spherical = (AVSphericalMapping 
*)sd->data;
 if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR)
 print_str("projection", "equirectangular");
-else if (spherical->projection == AV_SPHERICAL_CUBEMAP)
+else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
 print_str("projection", "cubemap");
-else
+print_int("padding", spherical->padding);
+} else if (spherical->projection == 
AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+print_str("projection", "tiled equirectangular");
+print_int("bound_left", spherical->bound_left);
+print_int("bound_top", spherical->bound_top);
+print_int("bound_right", spherical->bound_right);
+print_int("bound_bottom", spherical->bound_bottom);
+} else
 print_str("projection", "unknown");
 
 print_int("yaw", (double) spherical->yaw / (1 << 16));
diff --git a/libavformat/dump.c b/libavformat/dump.c
index d9aa3af..ae93c7a 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -357,6 +357,8 @@ static void dump_spherical(void *ctx, AVPacketSideData *sd)
 av_log(ctx, AV_LOG_INFO, "equirectangular ");
 else if (spherical->projection == AV_SPHERICAL_CUBEMAP)
 av_log(ctx, AV_LOG_INFO, "cubemap ");
+else if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE)
+av_log(ctx, AV_LOG_INFO, "tiled equirectangular ");
 else {
 av_log(ctx, AV_LOG_WARNING, "unknown");
 return;
@@ -366,6 +368,14 @@ static void dump_spherical(void *ctx, AVPacketSideData *sd)
 pitch = ((double)spherical->pitch) / (1 << 16);
 roll = ((double)spherical->roll) / (1 << 16);
 av_log(ctx, AV_LOG_INFO, "(%f/%f/%f) ", yaw, pitch, roll);
+
+if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+av_log(ctx, AV_LOG_INFO, "[%zu, %zu, %zu, %zu] ",
+   spherical->bound_left, spherical->bound_top,
+   spherical->bound_right, spherical->bound_bottom);
+} else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
+av_log(ctx, AV_LOG_INFO, "[pad %zu] ", spherical->padding);
+}
 }
 
 static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
diff --git a/libavutil/spherical.h b/libavutil/spherical.h
index eeda625..3c9f3a5 100644
--- a/libavutil/spherical.h
+++ b/libavutil/spherical.h
@@ -63,6 +63,13 @@ enum AVSphericalProjection {
  * to the back.
  */
 AV_SPHERICAL_CUBEMAP,
+
+/**
+ * Video represents a portion of a sphere mapped on a flat surface
+ * using equirectangular projection. The @ref bounding fields indicate
+ * the position of the current video in a larger surface.
+ */
+AV_SPHERICAL_EQUIRECTANGULAR_TILE,
 };
 
 /**
@@ -122,6 +129,55 @@ typedef struct AVSphericalMapping {
 /**
  * @}
  */
+
+/**
+ * @name Bounding rectangle
+ * @anchor bounding
+ * @{
+ * These fields indicate the location of the current tile, and where
+ * it should be mapped relative to the original surface.
+ *
+ * @code{.unparsed}
+ *  ++--+
+ *  ||bound_top |
+ *  |++ |
+ *  | bound_left |tile| |
+ *  +<-->||<--->+bound_right
+ *  |++ |
+ *  ||  |
+ *  |bound_bottom|  |
+ *  ++--+
+ * @endcode
+ *
+ * If needed, the original video surface dimensions can be derived
+ * by 

[FFmpeg-devel] [PATCHv2 3/4] mkv: Export bounds and padding from spherical metadata

2017-02-15 Thread Vittorio Giovara
---
Updated according to James' review.
Please CC.
Vittorio

 libavformat/matroskadec.c  | 69 --
 tests/ref/fate/matroska-spherical-mono |  6 ++-
 2 files changed, 71 insertions(+), 4 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 7223e94..6fa961e 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1913,16 +1913,65 @@ static int mkv_parse_video_projection(AVStream *st, 
const MatroskaTrack *track)
 AVSphericalMapping *spherical;
 enum AVSphericalProjection projection;
 size_t spherical_size;
+size_t l, t, r, b;
+size_t padding = 0;
 int ret;
+GetByteContext gb;
+
+bytestream2_init(, track->video.projection.private.data,
+ track->video.projection.private.size);
+
+if (bytestream2_get_byte() != 0) {
+av_log(NULL, AV_LOG_WARNING, "Unknown spherical metadata\n");
+return 0;
+}
+
+bytestream2_skip(, 3); // flags
 
 switch (track->video.projection.type) {
 case MATROSKA_VIDEO_PROJECTION_TYPE_EQUIRECTANGULAR:
-projection = AV_SPHERICAL_EQUIRECTANGULAR;
+if (track->video.projection.private.size == 0)
+projection = AV_SPHERICAL_EQUIRECTANGULAR;
+else if (track->video.projection.private.size == 20) {
+t = bytestream2_get_be32();
+b = bytestream2_get_be32();
+l = bytestream2_get_be32();
+r = bytestream2_get_be32();
+
+if (b >= UINT_MAX - t || r >= UINT_MAX - l) {
+av_log(NULL, AV_LOG_ERROR,
+   "Invalid bounding rectangle coordinates "
+   "%zu,%zu,%zu,%zu\n", l, t, r, b);
+return AVERROR_INVALIDDATA;
+}
+
+if (l || t || r || b)
+projection = AV_SPHERICAL_EQUIRECTANGULAR_TILE;
+else
+projection = AV_SPHERICAL_EQUIRECTANGULAR;
+} else {
+av_log(NULL, AV_LOG_ERROR, "Unknown spherical metadata\n");
+return AVERROR_INVALIDDATA;
+}
 break;
 case MATROSKA_VIDEO_PROJECTION_TYPE_CUBEMAP:
-if (track->video.projection.private.size < 4)
+if (track->video.projection.private.size < 4) {
+av_log(NULL, AV_LOG_ERROR, "Missing projection private 
properties\n");
+return AVERROR_INVALIDDATA;
+} else if (track->video.projection.private.size == 12) {
+uint32_t layout = bytestream2_get_be32();
+if (layout == 0) {
+projection = AV_SPHERICAL_CUBEMAP;
+} else {
+av_log(NULL, AV_LOG_WARNING,
+   "Unknown spherical cubemap layout %"PRIu32"\n", layout);
+return 0;
+}
+padding = bytestream2_get_be32();
+} else {
+av_log(NULL, AV_LOG_ERROR, "Unknown spherical metadata\n");
 return AVERROR_INVALIDDATA;
-projection = AV_SPHERICAL_CUBEMAP;
+}
 break;
 default:
 return 0;
@@ -1937,6 +1986,20 @@ static int mkv_parse_video_projection(AVStream *st, 
const MatroskaTrack *track)
 spherical->pitch = (int32_t)(track->video.projection.pitch * (1 << 16));
 spherical->roll  = (int32_t)(track->video.projection.roll  * (1 << 16));
 
+spherical->padding = padding;
+
+if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+/* conversion from 0.32 coordinates to pixels */
+size_t orig_width  = (size_t) track->video.pixel_width  * UINT32_MAX / 
(UINT32_MAX - r - l);
+size_t orig_height = (size_t) track->video.pixel_height * UINT32_MAX / 
(UINT32_MAX - b - t);
+
+/* add a (UINT32_MAX - 1) to round up integer division */
+spherical->bound_left   = (orig_width  * l + UINT32_MAX - 1) / 
UINT32_MAX;
+spherical->bound_top= (orig_height * t + UINT32_MAX - 1) / 
UINT32_MAX;
+spherical->bound_right  = orig_width  - track->video.pixel_width  - 
spherical->bound_left;
+spherical->bound_bottom = orig_height - track->video.pixel_height - 
spherical->bound_top;
+}
+
 ret = av_stream_add_side_data(st, AV_PKT_DATA_SPHERICAL, (uint8_t 
*)spherical,
   spherical_size);
 if (ret < 0) {
diff --git a/tests/ref/fate/matroska-spherical-mono 
b/tests/ref/fate/matroska-spherical-mono
index 8048aff..a70d879 100644
--- a/tests/ref/fate/matroska-spherical-mono
+++ b/tests/ref/fate/matroska-spherical-mono
@@ -8,7 +8,11 @@ inverted=0
 [SIDE_DATA]
 side_data_type=Spherical Mapping
 side_data_size=56
-projection=equirectangular
+projection=tiled equirectangular
+bound_left=148
+bound_top=73
+bound_right=147
+bound_bottom=72
 yaw=45
 pitch=30
 roll=15
-- 
2.10.0

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


[FFmpeg-devel] [PATCHv2 2/4] mov: Export bounds and padding from spherical metadata

2017-02-15 Thread Vittorio Giovara
Update the fate test as needed.
---
V2 bounds are validated and UINT32_MAX is used.
Please CC.
Vittorio

 libavformat/mov.c | 53 ++-
 tests/ref/fate/mov-spherical-mono |  6 -
 2 files changed, 57 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index b518177..a1774b3 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4625,6 +4625,8 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 MOVStreamContext *sc;
 int size;
 int32_t yaw, pitch, roll;
+size_t l, t, r, b;
+size_t padding = 0;
 uint32_t tag;
 enum AVSphericalProjection projection;
 
@@ -4686,9 +4688,25 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 switch (tag) {
 case MKTAG('c','b','m','p'):
 projection = AV_SPHERICAL_CUBEMAP;
+padding = avio_rb32(pb);
 break;
 case MKTAG('e','q','u','i'):
-projection = AV_SPHERICAL_EQUIRECTANGULAR;
+t = avio_rb32(pb);
+b = avio_rb32(pb);
+l = avio_rb32(pb);
+r = avio_rb32(pb);
+
+if (b >= UINT_MAX - t || r >= UINT_MAX - l) {
+av_log(c->fc, AV_LOG_ERROR,
+   "Invalid bounding rectangle coordinates "
+   "%zu,%zu,%zu,%zu\n", l, t, r, b);
+return AVERROR_INVALIDDATA;
+}
+
+if (l || t || r || b)
+projection = AV_SPHERICAL_EQUIRECTANGULAR_TILE;
+else
+projection = AV_SPHERICAL_EQUIRECTANGULAR;
 break;
 default:
 av_log(c->fc, AV_LOG_ERROR, "Unknown projection type\n");
@@ -4705,6 +4723,19 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 sc->spherical->pitch = pitch;
 sc->spherical->roll  = roll;
 
+sc->spherical->padding = padding;
+
+if (projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+/* conversion from 0.32 coordinates to pixels */
+size_t orig_width  = (size_t) sc->width  * UINT32_MAX / (UINT32_MAX - 
r - l);
+size_t orig_height = (size_t) sc->height * UINT32_MAX / (UINT32_MAX - 
b - t);
+
+/* add a (UINT32_MAX - 1) to round up integer division */
+sc->spherical->bound_left   = (orig_width  * l + UINT32_MAX - 1) / 
UINT32_MAX;
+sc->spherical->bound_top= (orig_height * t + UINT32_MAX - 1) / 
UINT32_MAX;
+sc->spherical->bound_right  = orig_width  - sc->width  - 
sc->spherical->bound_left;
+sc->spherical->bound_bottom = orig_height - sc->height - 
sc->spherical->bound_top;
+}
 return 0;
 }
 
@@ -4763,6 +4794,26 @@ static int mov_parse_uuid_spherical(MOVStreamContext 
*sc, AVIOContext *pb, size_
 val = av_stristr(buffer, "");
 if (val)
 sc->spherical->roll = strtol(val, NULL, 10) * (1 << 16);
+
+/* tiling */
+val = av_stristr(buffer, "");
+if (val)
+sc->spherical->bound_left = strtol(val, NULL, 10);
+val = av_stristr(buffer, "");
+if (val)
+sc->spherical->bound_top = strtol(val, NULL, 10);
+val = av_stristr(buffer, "");
+if (val)
+sc->spherical->bound_right =
+sc->width - sc->spherical->bound_left - strtol(val, NULL, 10);
+val = av_stristr(buffer, "");
+if (val)
+sc->spherical->bound_bottom =
+sc->height - sc->spherical->bound_top - strtol(val, NULL, 10);
+
+if (sc->spherical->bound_left || sc->spherical->bound_top ||
+sc->spherical->bound_right || sc->spherical->bound_bottom)
+sc->spherical->projection = AV_SPHERICAL_EQUIRECTANGULAR_TILE;
 }
 
 out:
diff --git a/tests/ref/fate/mov-spherical-mono 
b/tests/ref/fate/mov-spherical-mono
index 8048aff..a70d879 100644
--- a/tests/ref/fate/mov-spherical-mono
+++ b/tests/ref/fate/mov-spherical-mono
@@ -8,7 +8,11 @@ inverted=0
 [SIDE_DATA]
 side_data_type=Spherical Mapping
 side_data_size=56
-projection=equirectangular
+projection=tiled equirectangular
+bound_left=148
+bound_top=73
+bound_right=147
+bound_bottom=72
 yaw=45
 pitch=30
 roll=15
-- 
2.10.0

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


Re: [FFmpeg-devel] [PATCH 3/4] x86util: import MOVHL macro

2017-02-15 Thread James Darnley
On 2017-02-14 17:21, Henrik Gramner wrote:
> On Mon, Feb 13, 2017 at 1:44 PM, James Darnley  wrote:
>> Originally committed to x264 in 1637239a by Henrik Gramner who has
>> agreed to re-license it as LGPL.  Original commit message follows.
>>
>> x86: Avoid some bypass delays and false dependencies
>>
>> A bypass delay of 1-3 clock cycles may occur on some CPUs when 
>> transitioning
>> between int and float domains, so try to avoid that if possible.
> 
> Not sure if I see the point in copying the original commit message in
> this case, but the patch itself is OK.

It provides a nice "why" for the patch/macro is useful.

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


[FFmpeg-devel] [PATCH] avformat/hlsenc: set default http method to PUT when method is null

2017-02-15 Thread Steven Liu
When the http method is not set, the method will use POST for ts,
PUT for m3u8, it is not unify, now set it unify.
This ticket id: 5315

Signed-off-by: Steven Liu 
---
 libavformat/hlsenc.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 930e94b..c2c47c3 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -251,6 +251,7 @@ static int hls_delete_old_segments(HLSContext *hls) {
 char *path = NULL;
 AVDictionary *options = NULL;
 AVIOContext *out = NULL;
+const char *proto = NULL;
 
 segment = hls->segments;
 while (segment) {
@@ -300,7 +301,8 @@ static int hls_delete_old_segments(HLSContext *hls) {
 av_strlcat(path, segment->filename, path_size);
 }
 
-if (hls->method) {
+proto = avio_find_protocol_name(hls->basename);
+if (hls->method || (proto && !av_strcasecmp(proto, "http"))) {
 av_dict_set(, "method", "DELETE", 0);
 if ((ret = hls->avf->io_open(hls->avf, , path, 
AVIO_FLAG_WRITE, )) < 0)
 goto fail;
@@ -321,7 +323,7 @@ static int hls_delete_old_segments(HLSContext *hls) {
 av_strlcpy(sub_path, dirname, sub_path_size);
 av_strlcat(sub_path, segment->sub_filename, sub_path_size);
 
-if (hls->method) {
+if (hls->method || (proto && !av_strcasecmp(proto, "http"))) {
 av_dict_set(, "method", "DELETE", 0);
 if ((ret = hls->avf->io_open(hls->avf, , sub_path, 
AVIO_FLAG_WRITE, )) < 0) {
 av_free(sub_path);
@@ -665,8 +667,14 @@ static void hls_free_segments(HLSSegment *p)
 
 static void set_http_options(AVDictionary **options, HLSContext *c)
 {
-if (c->method)
+const char *proto = avio_find_protocol_name(c->basename);
+
+if (c->method) {
 av_dict_set(options, "method", c->method, 0);
+} else if (proto && !av_strcasecmp(proto, "http")) {
+av_log(c, AV_LOG_WARNING, "You forget set http method, hls muxer auto 
set default method to PUT\n");
+av_dict_set(options, "method", "PUT", 0);
+}
 }
 
 static void write_m3u8_head_block(HLSContext *hls, AVIOContext *out, int 
version,
-- 
2.10.1.382.ga23ca1b.dirty



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


Re: [FFmpeg-devel] [PATCH 1/3] spherical: Add tiled equirectangular type and projection-specific properties

2017-02-15 Thread Nicolas George
Le septidi 27 pluviôse, an CCXXV, James Almer a écrit :
> If the spec changes, it will be the contents of the equi/cbmp/mesh.
> By exporting them raw as extradata, said changes in the spec would
> require no changes to our implementation.

By this reasoning, we could as well replace libavformat by open() and
close() and leave to applications the task of dealing with the binary
data.

Now, I realize this has the feel of a slippery-slope fallacy but I
really think it is valid.

The gist of it is that the first question should be: is it (abstracting
the projection properties) within the scope of this library?

If the answer is yes, then we do it, whatever it requires. And the API
will be as complicated as it needs to be.

And of course, if it is not trivial, we will probably get it wrong the
first time. Hopefully, we will get it more or less right eventually.

This process may look a bit unprofessional, but it is really the only
one that work. The cost of working with Libre software in a Bazaar
development model is that we can not hide our mistakes behind NDAs. But
the benefit of not having corporate executive breathing down our necks
is that we do not need to hide our mistakes.

Fortunately, the feature we are discussing here is rather peripheral to
the functionalities of our libraries (it was central, we would not be
having this discussion), so if we get it wrong, the only people who will
get hurt are the people using it, i.e. the people who should be helping
getting it right.

That is all I have to say; I do not know the specifics of the projection
properties to judge the merits of the current proposed API.

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] h264: Correctly initialize interlaced_frame if tff is set

2017-02-15 Thread Vittorio Giovara
On Tue, Feb 14, 2017 at 6:21 PM, Michael Niedermayer
 wrote:
> On Sat, Feb 11, 2017 at 02:56:32AM +0100, Michael Niedermayer wrote:
>> On Fri, Feb 10, 2017 at 05:21:00PM -0500, Vittorio Giovara wrote:
>> > In particular cases, it is possible to initialize top_field_first
>> > but not interlaced_frame. Make sure to correctly tag a frame
>> > as interlaced when this happens.
>> >
>> > Signed-off-by: Vittorio Giovara 
>> > ---
>> > Please CC.
>> > Vittorio
>> >
>> >  libavcodec/h264_slice.c | 13 -
>> >  1 file changed, 8 insertions(+), 5 deletions(-)
>> >
>> > diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
>> > index 91a3b25..eeb5202 100644
>> > --- a/libavcodec/h264_slice.c
>> > +++ b/libavcodec/h264_slice.c
>> > @@ -1174,20 +1174,23 @@ static int h264_export_frame_props(H264Context *h)
>> >
>> >  if (cur->field_poc[0] != cur->field_poc[1]) {
>> >  /* Derive top_field_first from field pocs. */
>> > -cur->f->top_field_first = cur->field_poc[0] < cur->field_poc[1];
>> > +cur->f->interlaced_frame =
>> > +cur->f->top_field_first  = cur->field_poc[0] < cur->field_poc[1];
>>
>> this looks like it would set interlaced_frame = 0 if
>> cur->field_poc[0] > cur->field_poc[1];
>>
>> also, do you have a sample that is affected by this ?
>
> thx for the sample, ive pushed a different fix
> does that fix this completely or is some issue remaining ?

Looks good, thanks for the fix.
-- 
Vittorio
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 0/8] Merge lazy filter initialization in ffmpeg CLI

2017-02-15 Thread Michael Niedermayer
On Wed, Feb 15, 2017 at 10:24:15AM +0100, wm4 wrote:
> These patches merge the previously skipped Libav commits, which made
> avconv lazily initialize libavfilter graphs. This means the filters
> are initialized with the actual output format, instead of whatever
> libavformat reports.
> 
> It's a prerequisite to making hardware decoding support saner, as
> hardware decoders will output a different pixfmt than the software
> format reported by libavformat. This can be seen on ffmpeg_qsv.c
> and ffmpeg_cuvid.c, which don't lose any functionality, even though
> half of the code is removed.
> 
> There are some differences in how ffmpeg.c and avconv.c filter-flow
> works. Also, avconv.c doesn't have sub2video. Relatively intrusive
> changes were required.
> 
> I plan to push this tomorrow, except if critical errors are found.
> 
> Anton Khirnov (4):
>   ffmpeg: do packet ts rescaling in write_packet()
>   ffmpeg: init filtergraphs only after we have a frame on each input
>   ffmpeg: move flushing the queued frames to configure_filtergraph()
>   ffmpeg: restructure sending EOF to filters
> 
> Timo Rothenpieler (2):
>   ffmpeg_cuvid: adapt for recent filter graph initialization changes
>   avcodec/cuvid: update hw_frames_ctx reference after get_format call
> 
> wm4 (2):
>   ffmpeg: make sure packets put into the muxing FIFO are refcounted
>   ffmpeg: fix printing of filter input/output names

breaks: (Application provided invalid, non monotonically increasing dts to 
muxer in stream 1: 1824120 >= 70020)

./ffmpeg -skip_frame nokey -ss 20  -i ~/tickets/2024/dvbsubtest.ts -qscale 2  
-scodec dvbsub -t 6   -an file.ts

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

Dictatorship: All citizens are under surveillance, all their steps and
actions recorded, for the politicians to enforce control.
Democracy: All politicians are under surveillance, all their steps and
actions recorded, for the citizens to enforce control.


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


Re: [FFmpeg-devel] [PATCH 1/3] spherical: Add tiled equirectangular type and projection-specific properties

2017-02-15 Thread Vittorio Giovara
On Wed, Feb 15, 2017 at 8:52 AM, James Almer  wrote:
> On 2/14/2017 11:20 PM, Vittorio Giovara wrote:
>> On Tue, Feb 14, 2017 at 6:54 PM, James Almer  wrote:
>>> On 2/14/2017 5:52 PM, Vittorio Giovara wrote:
 On Fri, Feb 10, 2017 at 6:25 PM, Michael Niedermayer
  wrote:
> On Fri, Feb 10, 2017 at 04:11:43PM -0500, Vittorio Giovara wrote:
>> Signed-off-by: Vittorio Giovara 
>> ---
>> This should help not losing details over muxing and allows
>> callers to get additional information in a clean manner.
>>
>> Please keep me in CC.
>> Vittorio
>>
>>  doc/APIchanges|  5 +
>>  ffprobe.c | 11 --
>>  libavformat/dump.c| 10 +
>>  libavutil/spherical.h | 56 
>> +++
>>  libavutil/version.h   |  2 +-
>>  5 files changed, 81 insertions(+), 3 deletions(-)
>
> breaks fate
>
> --- ./tests/ref/fate/matroska-spherical-mono2017-02-10 
> 23:43:51.993432371 +0100
> +++ tests/data/fate/matroska-spherical-mono 2017-02-11 
> 00:24:10.297483318 +0100
> @@ -7,7 +7,7 @@
>  [/SIDE_DATA]
>  [SIDE_DATA]
>  side_data_type=Spherical Mapping
> -side_data_size=16
> +side_data_size=56
>  projection=equirectangular
>  yaw=45
>  pitch=30
> Test matroska-spherical-mono failed. Look at 
> tests/data/fate/matroska-spherical-mono.err for details.
> make: *** [fate-matroska-spherical-mono] Error 1

 Ah I didn't notice, it is fixed in the next commit, but I'll amend this 
 one too.


 I didn't see any comment/discussion, should I assume it is ok?
 Please CC, thank you.
>>>
>>> These are a lot of projection specific fields. It worries me as the
>>> spec may change in the future with new fields added or existing
>>> fields changing purpose. Not to mention the Mesh projection, which
>>> has like fifty specific fields of its own.
>>
>> Even if the spec change (which at this point would be a terrible
>> terrible thing to do) there are now files in the wild and software
>> that have adopted this draft, so we would have to support this anyway.
>
> If the spec changes, it will be the contents of the equi/cbmp/mesh.
> By exporting them raw as extradata, said changes in the spec would
> require no changes to our implementation.

If the spec changes in a non-backward compatible way, the API is the
least of our problems :-)
-- 
Vittorio
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] spherical: Add tiled equirectangular type and projection-specific properties

2017-02-15 Thread James Almer
On 2/14/2017 11:20 PM, Vittorio Giovara wrote:
> On Tue, Feb 14, 2017 at 6:54 PM, James Almer  wrote:
>> On 2/14/2017 5:52 PM, Vittorio Giovara wrote:
>>> On Fri, Feb 10, 2017 at 6:25 PM, Michael Niedermayer
>>>  wrote:
 On Fri, Feb 10, 2017 at 04:11:43PM -0500, Vittorio Giovara wrote:
> Signed-off-by: Vittorio Giovara 
> ---
> This should help not losing details over muxing and allows
> callers to get additional information in a clean manner.
>
> Please keep me in CC.
> Vittorio
>
>  doc/APIchanges|  5 +
>  ffprobe.c | 11 --
>  libavformat/dump.c| 10 +
>  libavutil/spherical.h | 56 
> +++
>  libavutil/version.h   |  2 +-
>  5 files changed, 81 insertions(+), 3 deletions(-)

 breaks fate

 --- ./tests/ref/fate/matroska-spherical-mono2017-02-10 
 23:43:51.993432371 +0100
 +++ tests/data/fate/matroska-spherical-mono 2017-02-11 
 00:24:10.297483318 +0100
 @@ -7,7 +7,7 @@
  [/SIDE_DATA]
  [SIDE_DATA]
  side_data_type=Spherical Mapping
 -side_data_size=16
 +side_data_size=56
  projection=equirectangular
  yaw=45
  pitch=30
 Test matroska-spherical-mono failed. Look at 
 tests/data/fate/matroska-spherical-mono.err for details.
 make: *** [fate-matroska-spherical-mono] Error 1
>>>
>>> Ah I didn't notice, it is fixed in the next commit, but I'll amend this one 
>>> too.
>>>
>>>
>>> I didn't see any comment/discussion, should I assume it is ok?
>>> Please CC, thank you.
>>
>> These are a lot of projection specific fields. It worries me as the
>> spec may change in the future with new fields added or existing
>> fields changing purpose. Not to mention the Mesh projection, which
>> has like fifty specific fields of its own.
> 
> Even if the spec change (which at this point would be a terrible
> terrible thing to do) there are now files in the wild and software
> that have adopted this draft, so we would have to support this anyway.

If the spec changes, it will be the contents of the equi/cbmp/mesh.
By exporting them raw as extradata, said changes in the spec would
require no changes to our implementation.

> 
>> Wouldn't it be a better idea to export the binary data of the
>> equi/cbmp/mesh boxes into an extradata-like field in the
>> AVSphericalMapping struct, and let the downstream application parse
>> it instead?
> 
> No I don't think so, lavf is an abstraction layer and one of its tasks
> is to provide a (simple?) unified entry layer. and letting the user
> parse binary data is IMO bad design and very fragile. Also it's not
> impossible that another standard for tagging spherical metadata
> emerges in the future: the current API could very easily wrap it,
> while exporting the binary entry would be too specification-specific
> and it would be tied too heavily on the google draft.

AVSphericalMapping is already pretty tied to the google draft, but
i guess you're right, it's at least generic enough for now.

Wait for Aaron's opinion before addressing reviews and pushing. He
sent a different patchset himself and it wouldn't be nice to push
yours without at least giving him a chance to comment.

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


Re: [FFmpeg-devel] [PATCH 2/9] ffmpeg: do packet ts rescaling in write_packet()

2017-02-15 Thread Carl Eugen Hoyos
2017-02-15 12:00 GMT+01:00 wm4 :
> On Wed, 15 Feb 2017 11:48:36 +0100
> Carl Eugen Hoyos  wrote:
>
>> 2017-02-14 14:08 GMT+01:00 Michael Niedermayer :
>> > My concern are the growing number of regressions
>>
>> > (which implies more get added than fixed).
>>
>> From a purely quantitative pov this is correct.
>
> Do you propose we should reject all the hardware transcoding work?

I didn't propose anything, I just had the feeling Michael was writing
about a suggestion, so I wanted to clarify that he is correct.
Although now that you ask, I propose trying hard to fix a few
regressions before adding new ones.

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


Re: [FFmpeg-devel] [PATCH] avfilter: implement halve filter

2017-02-15 Thread Carl Eugen Hoyos
2017-02-14 20:44 GMT+01:00 Daniel Oberhoff :
> filter strictly “halves” the image efficiently, which is often exactly what 
> is needed

> likely much faster than using scale

I am not a native speaker but this seems to imply
you never tested the performance of the new filter:
Does it have another advantage over using scale?

> fully slice parallelized

(Not necessarily related)
libswscale support slices, I believe only the scale
filter never added support for it.

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


Re: [FFmpeg-devel] deduplicated [PATCH] Cinepak: speed up decoding several-fold, depending on the scenario, by supporting multiple output pixel formats.

2017-02-15 Thread u-9iep
Hi Ronald,

On Tue, Feb 14, 2017 at 09:46:55AM -0500, Ronald S. Bultje wrote:
> > The huge difference in the amount of the data to be processed; in other
> > words the very essence of the vector quantization technology where frame
> > data is represented by a codebook, by design meant to be much smaller.
> 
> 
> We acknowledge that. We understand this. Nobody disputes this.

Just several lines below you assume (why?) that using this specific advantage
in Cinepak would create any ground for a "corresponding change" in h264.
As far as I know h264 does not use vector quantization on the final
output data, or what do you mean by the following:

> But we still don't think breaking the modularization is the right way
> forward. I'm sorry. We're thinking about this in terms of maintainability
> as well as speed. The problem is that once we allow this, people will ask
> for 16bit output in h264 for all native bitdepths, or even packed formats
> (Kieran already asked).

Unfortunately I do not see this as having any real relevance.
If there indeed is a gain to be collected for h264, it should be weighed
against the cost to be caused by a change _there_.

As a matter of fact, I do not suggest "breaking modularity in ffmpeg".

Modularity, a very useful concept, like any other concept has its area
of usefulness. An approach very reasonable in most situations should
not be mistaken for "the best one in all cases".

Here we have a case where enforced application of this generally useful
concept is remarkably far from optimal.

> We know it's faster. We also know it's unreasonable from a maintenance

You do not know the latter.
Your guess possibly reflects the feeling of a fundamental concept
being neglected, but this in not a case of neglection/ignorance.

> perspective. We have to draw a line somewhere. It's an imperfect line but
> there's a reason for it. I'm sorry. That's life.

You do not have to be sorry, just be substantial.

I have checked the changes done to Cinepak decoder during the 4 years
since it began to decode correctly.

If the change being discussed now would have been applied back then,
one of the later commits would have had about 15 extra lines to change
(btw, in a very regular fashion: "frame." => "frame->" nothing else).

Another commit would have to change 5 lines instead of 1.

The latter indicated indeed an unnecessary duplication in variable
declarations, sorry for that. I now change the patch to avoid this.

That's all. Tell me if I missed something.

The decoder is used rarely but it is indispensable when maximal speed
is needed. There is no substitute.

Is a 3-fold improvement in the decoding speed worth 15 extra lines
to change once in 4 years?

Regards,
Rune

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


Re: [FFmpeg-devel] [PATCH 2/9] ffmpeg: do packet ts rescaling in write_packet()

2017-02-15 Thread wm4
On Wed, 15 Feb 2017 11:48:36 +0100
Carl Eugen Hoyos  wrote:

> 2017-02-14 14:08 GMT+01:00 Michael Niedermayer :
> > My concern are the growing number of regressions  
> 
> > (which implies more get added than fixed).  
> 
> From a purely quantitative pov this is correct.

Do you propose we should reject all the hardware transcoding work?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/9] ffmpeg: do packet ts rescaling in write_packet()

2017-02-15 Thread Carl Eugen Hoyos
2017-02-14 14:08 GMT+01:00 Michael Niedermayer :
> My concern are the growing number of regressions

> (which implies more get added than fixed).

From a purely quantitative pov this is correct.

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


[FFmpeg-devel] [PATCH] avformat/mpl2dec: skip BOM when probing

2017-02-15 Thread Paul B Mahol
Fixes #5442.

Signed-off-by: Paul B Mahol 
---
 libavformat/mpl2dec.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavformat/mpl2dec.c b/libavformat/mpl2dec.c
index 59589d5..dfcdf5a 100644
--- a/libavformat/mpl2dec.c
+++ b/libavformat/mpl2dec.c
@@ -23,6 +23,8 @@
  * MPL2 subtitles format demuxer
  */
 
+#include "libavutil/intreadwrite.h"
+
 #include "avformat.h"
 #include "internal.h"
 #include "subtitles.h"
@@ -39,6 +41,9 @@ static int mpl2_probe(AVProbeData *p)
 const unsigned char *ptr = p->buf;
 const unsigned char *ptr_end = ptr + p->buf_size;
 
+if (AV_RB24(ptr) == 0xefbbbf)
+ptr += 3;
+
 for (i = 0; i < 2; i++) {
 if (sscanf(ptr, "[%"SCNd64"][%"SCNd64"]%c", , , ) != 3 &&
 sscanf(ptr, "[%"SCNd64"][]%c",  ,   ) != 2)
@@ -83,6 +88,9 @@ static int mpl2_read_header(AVFormatContext *s)
 st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
 st->codecpar->codec_id   = AV_CODEC_ID_MPL2;
 
+if (avio_rb24(s->pb) != 0xefbbbf)
+avio_seek(s->pb, -3, SEEK_CUR);
+
 while (!avio_feof(s->pb)) {
 char line[4096];
 char *p = line;
-- 
2.9.3

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


Re: [FFmpeg-devel] [PATCH v2 8/8] avcodec/cuvid: update hw_frames_ctx reference after get_format call

2017-02-15 Thread wm4
On Wed, 15 Feb 2017 10:24:23 +0100
wm4  wrote:

> From: Timo Rothenpieler 
> 
> ---
>  libavcodec/cuvid.c | 13 +
>  1 file changed, 13 insertions(+)
> 
> diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c
> index f5a49ce86f..a0682e3cdc 100644
> --- a/libavcodec/cuvid.c
> +++ b/libavcodec/cuvid.c
> @@ -140,6 +140,19 @@ static int CUDAAPI cuvid_handle_video_sequence(void 
> *opaque, CUVIDEOFORMAT* form
>  return 0;
>  }
>  
> +// Update our hwframe ctx, as the get_format callback might have 
> refreshed it!
> +if (avctx->hw_frames_ctx) {
> +av_buffer_unref(>hwframe);
> +
> +ctx->hwframe = av_buffer_ref(avctx->hw_frames_ctx);
> +if (!ctx->hwframe) {
> +ctx->internal_error = AVERROR(ENOMEM);
> +return 0;
> +}
> +
> +hwframe_ctx = (AVHWFramesContext*)ctx->hwframe->data;
> +}
> +
>  av_log(avctx, AV_LOG_VERBOSE, "Formats: Original: %s | HW: %s | SW: 
> %s\n",
> av_get_pix_fmt_name(avctx->pix_fmt),
> av_get_pix_fmt_name(surface_fmt),

Dropping this patch - it's already in master.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/mpl2dec: skip BOM when probing

2017-02-15 Thread wm4
On Wed, 15 Feb 2017 10:07:48 +0100
Paul B Mahol  wrote:

> On 2/15/17, wm4  wrote:
> > On Sat, 11 Feb 2017 11:56:07 +0100
> > Paul B Mahol  wrote:
> >  
> >> Signed-off-by: Paul B Mahol 
> >> ---
> >>  libavformat/mpl2dec.c | 8 
> >>  1 file changed, 8 insertions(+)
> >>
> >> diff --git a/libavformat/mpl2dec.c b/libavformat/mpl2dec.c
> >> index 59589d5..0e30cb0 100644
> >> --- a/libavformat/mpl2dec.c
> >> +++ b/libavformat/mpl2dec.c
> >> @@ -23,6 +23,8 @@
> >>   * MPL2 subtitles format demuxer
> >>   */
> >>
> >> +#include "libavutil/intreadwrite.h"
> >> +
> >>  #include "avformat.h"
> >>  #include "internal.h"
> >>  #include "subtitles.h"
> >> @@ -39,6 +41,9 @@ static int mpl2_probe(AVProbeData *p)
> >>  const unsigned char *ptr = p->buf;
> >>  const unsigned char *ptr_end = ptr + p->buf_size;
> >>
> >> +if (AV_RB24(ptr) == 0xefbbbf)
> >> +ptr += 3;
> >> +
> >>  for (i = 0; i < 2; i++) {
> >>  if (sscanf(ptr, "[%"SCNd64"][%"SCNd64"]%c", , , ) !=
> >> 3 &&
> >>  sscanf(ptr, "[%"SCNd64"][]%c",  ,   ) !=
> >> 2)
> >> @@ -94,6 +99,9 @@ static int mpl2_read_header(AVFormatContext *s)
> >>  if (!len)
> >>  break;
> >>
> >> +if (AV_RB24(p) == 0xefbbbf)
> >> +p += 3;
> >> +
> >>  line[strcspn(line, "\r\n")] = 0;
> >>
> >>  if (!read_ts(, _start, )) {  
> >
> > What happened to the equivalent patch I sent almost a year ago? My
> > patch skipped it only in the probe function, because the subtitle line
> > reader skips BOM already.  
> 
> It doesn't appear that is true.

Right, seems like it's not using FFTextReader.

> >
> > It referenced the same trac ticket.  
> 
> You needd to resend/ping patch more often.
> ___
> 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 v2 7/8] ffmpeg_cuvid: adapt for recent filter graph initialization changes

2017-02-15 Thread wm4
From: Timo Rothenpieler 

---
 ffmpeg.c   |  13 --
 ffmpeg.h   |   1 -
 ffmpeg_cuvid.c | 141 -
 3 files changed, 30 insertions(+), 125 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index e9ef04a542..1d4d572d9a 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3536,19 +3536,6 @@ static int transcode_init(void)
 input_streams[j + ifile->ist_index]->start = 
av_gettime_relative();
 }
 
-/* hwaccel transcoding */
-for (i = 0; i < nb_output_streams; i++) {
-ost = output_streams[i];
-
-if (!ost->stream_copy) {
-
-#if CONFIG_CUVID
-if (cuvid_transcode_init(ost))
-exit_program(1);
-#endif
-}
-}
-
 /* init input streams */
 for (i = 0; i < nb_input_streams; i++)
 if ((ret = init_input_stream(i, error, sizeof(error))) < 0) {
diff --git a/ffmpeg.h b/ffmpeg.h
index 5d20d453eb..59f6cb3659 100644
--- a/ffmpeg.h
+++ b/ffmpeg.h
@@ -648,6 +648,5 @@ int qsv_init(AVCodecContext *s);
 int vaapi_decode_init(AVCodecContext *avctx);
 int vaapi_device_init(const char *device);
 int cuvid_init(AVCodecContext *s);
-int cuvid_transcode_init(OutputStream *ost);
 
 #endif /* FFMPEG_H */
diff --git a/ffmpeg_cuvid.c b/ffmpeg_cuvid.c
index 46540795d4..3ff3b40f17 100644
--- a/ffmpeg_cuvid.c
+++ b/ffmpeg_cuvid.c
@@ -17,138 +17,57 @@
  */
 
 #include "libavutil/hwcontext.h"
+#include "libavutil/pixdesc.h"
 
 #include "ffmpeg.h"
 
-typedef struct CUVIDContext {
-AVBufferRef *hw_frames_ctx;
-} CUVIDContext;
-
 static void cuvid_uninit(AVCodecContext *avctx)
 {
-InputStream  *ist = avctx->opaque;
-CUVIDContext *ctx = ist->hwaccel_ctx;
-
-if (ctx) {
-av_buffer_unref(>hw_frames_ctx);
-av_freep();
-}
-
+InputStream *ist = avctx->opaque;
 av_buffer_unref(>hw_frames_ctx);
-
-ist->hwaccel_ctx = 0;
-ist->hwaccel_uninit = 0;
 }
 
 int cuvid_init(AVCodecContext *avctx)
 {
-InputStream  *ist = avctx->opaque;
-CUVIDContext *ctx = ist->hwaccel_ctx;
-
-av_log(NULL, AV_LOG_TRACE, "Initializing cuvid hwaccel\n");
-
-if (!ctx) {
-av_log(NULL, AV_LOG_ERROR, "CUVID transcoding is not initialized. "
-   "-hwaccel cuvid should only be used for one-to-one CUVID 
transcoding "
-   "with no (software) filters.\n");
-return AVERROR(EINVAL);
-}
-
-return 0;
-}
-
-int cuvid_transcode_init(OutputStream *ost)
-{
-InputStream *ist;
-const enum AVPixelFormat *pix_fmt;
-AVHWFramesContext *hwframe_ctx;
-AVBufferRef *device_ref = NULL;
-CUVIDContext *ctx = NULL;
-int ret = 0;
-
-av_log(NULL, AV_LOG_TRACE, "Initializing cuvid transcoding\n");
+InputStream *ist = avctx->opaque;
+AVHWFramesContext *frames_ctx;
+int ret;
 
-if (ost->source_index < 0)
-return 0;
+av_log(avctx, AV_LOG_VERBOSE, "Initializing cuvid hwaccel\n");
 
-ist = input_streams[ost->source_index];
-
-/* check if the encoder supports CUVID */
-if (!ost->enc->pix_fmts)
-goto cancel;
-for (pix_fmt = ost->enc->pix_fmts; *pix_fmt != AV_PIX_FMT_NONE; pix_fmt++)
-if (*pix_fmt == AV_PIX_FMT_CUDA)
-break;
-if (*pix_fmt == AV_PIX_FMT_NONE)
-goto cancel;
-
-/* check if the decoder supports CUVID */
-if (ist->hwaccel_id != HWACCEL_CUVID || !ist->dec || !ist->dec->pix_fmts)
-goto cancel;
-for (pix_fmt = ist->dec->pix_fmts; *pix_fmt != AV_PIX_FMT_NONE; pix_fmt++)
-if (*pix_fmt == AV_PIX_FMT_CUDA)
-break;
-if (*pix_fmt == AV_PIX_FMT_NONE)
-goto cancel;
-
-av_log(NULL, AV_LOG_VERBOSE, "Setting up CUVID transcoding\n");
-
-if (ist->hwaccel_ctx) {
-ctx = ist->hwaccel_ctx;
-} else {
-ctx = av_mallocz(sizeof(*ctx));
-if (!ctx) {
-ret = AVERROR(ENOMEM);
-goto error;
+if (!hw_device_ctx) {
+ret = av_hwdevice_ctx_create(_device_ctx, AV_HWDEVICE_TYPE_CUDA,
+ ist->hwaccel_device, NULL, 0);
+if (ret < 0) {
+av_log(avctx, AV_LOG_ERROR, "Error creating a CUDA device\n");
+return ret;
 }
 }
 
-if (!ctx->hw_frames_ctx) {
-ret = av_hwdevice_ctx_create(_ref, AV_HWDEVICE_TYPE_CUDA,
- ist->hwaccel_device, NULL, 0);
-if (ret < 0)
-goto error;
+av_buffer_unref(>hw_frames_ctx);
+ist->hw_frames_ctx = av_hwframe_ctx_alloc(hw_device_ctx);
+if (!ist->hw_frames_ctx) {
+av_log(avctx, AV_LOG_ERROR, "Error creating a CUDA frames context\n");
+return AVERROR(ENOMEM);
+}
 
-ctx->hw_frames_ctx = av_hwframe_ctx_alloc(device_ref);
-if (!ctx->hw_frames_ctx) {
-av_log(NULL, AV_LOG_ERROR, "av_hwframe_ctx_alloc failed\n");
-ret = AVERROR(ENOMEM);
-goto error;
-}
-av_buffer_unref(_ref);
+

[FFmpeg-devel] [PATCH v2 8/8] avcodec/cuvid: update hw_frames_ctx reference after get_format call

2017-02-15 Thread wm4
From: Timo Rothenpieler 

---
 libavcodec/cuvid.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c
index f5a49ce86f..a0682e3cdc 100644
--- a/libavcodec/cuvid.c
+++ b/libavcodec/cuvid.c
@@ -140,6 +140,19 @@ static int CUDAAPI cuvid_handle_video_sequence(void 
*opaque, CUVIDEOFORMAT* form
 return 0;
 }
 
+// Update our hwframe ctx, as the get_format callback might have refreshed 
it!
+if (avctx->hw_frames_ctx) {
+av_buffer_unref(>hwframe);
+
+ctx->hwframe = av_buffer_ref(avctx->hw_frames_ctx);
+if (!ctx->hwframe) {
+ctx->internal_error = AVERROR(ENOMEM);
+return 0;
+}
+
+hwframe_ctx = (AVHWFramesContext*)ctx->hwframe->data;
+}
+
 av_log(avctx, AV_LOG_VERBOSE, "Formats: Original: %s | HW: %s | SW: %s\n",
av_get_pix_fmt_name(avctx->pix_fmt),
av_get_pix_fmt_name(surface_fmt),
-- 
2.11.0

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


[FFmpeg-devel] [PATCH v2 5/8] ffmpeg: move flushing the queued frames to configure_filtergraph()

2017-02-15 Thread wm4
From: Anton Khirnov 

This is a more appropriate place for it, and will also be useful in the
following commit.

This merges Libav commit d2e56cf. It was previously skipped.

Signed-off-by: wm4 
---
 ffmpeg.c| 11 ---
 ffmpeg_filter.c | 11 +++
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 5ef4eee7ad..83088e5195 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2182,17 +2182,6 @@ static int ifilter_send_frame(InputFilter *ifilter, 
AVFrame *frame)
 av_log(NULL, AV_LOG_ERROR, "Error reinitializing filters!\n");
 return ret;
 }
-
-for (i = 0; i < fg->nb_inputs; i++) {
-while (av_fifo_size(fg->inputs[i]->frame_queue)) {
-AVFrame *tmp;
-av_fifo_generic_read(fg->inputs[i]->frame_queue, , 
sizeof(tmp), NULL);
-ret = av_buffersrc_add_frame(fg->inputs[i]->filter, tmp);
-av_frame_free();
-if (ret < 0)
-return ret;
-}
-}
 }
 
 ret = av_buffersrc_add_frame_flags(ifilter->filter, frame, 
AV_BUFFERSRC_FLAG_PUSH);
diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
index f21a8c85f8..4d9a4e2eb8 100644
--- a/ffmpeg_filter.c
+++ b/ffmpeg_filter.c
@@ -1117,6 +1117,17 @@ int configure_filtergraph(FilterGraph *fg)
  ost->enc_ctx->frame_size);
 }
 
+for (i = 0; i < fg->nb_inputs; i++) {
+while (av_fifo_size(fg->inputs[i]->frame_queue)) {
+AVFrame *tmp;
+av_fifo_generic_read(fg->inputs[i]->frame_queue, , 
sizeof(tmp), NULL);
+ret = av_buffersrc_add_frame(fg->inputs[i]->filter, tmp);
+av_frame_free();
+if (ret < 0)
+return ret;
+}
+}
+
 return 0;
 }
 
-- 
2.11.0

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


[FFmpeg-devel] [PATCH v2 6/8] ffmpeg: restructure sending EOF to filters

2017-02-15 Thread wm4
From: Anton Khirnov 

Be more careful when an input stream encounters EOF when its filtergraph
has not been configured yet. The current code would immediately mark the
corresponding output streams as finished, while there may still be
buffered frames waiting for frames to appear on other filtergraph
inputs.

This should fix the random FATE failures for complex filtergraph tests
after a3a0230a9870b9018dc7415ae5872784d524cfe5

This merges Libav commit 94ebf55. It was previously skipped.

This is the last filter init related Libav commit that was skipped, so
this also removes the commits from doc/libav-merge.txt.

Signed-off-by: wm4 
---
 doc/libav-merge.txt |  1 -
 ffmpeg.c| 43 ---
 ffmpeg.h|  2 ++
 ffmpeg_filter.c |  9 +
 4 files changed, 43 insertions(+), 12 deletions(-)

diff --git a/doc/libav-merge.txt b/doc/libav-merge.txt
index 23b48d1e2b..39d846f8fc 100644
--- a/doc/libav-merge.txt
+++ b/doc/libav-merge.txt
@@ -95,7 +95,6 @@ Stuff that didn't reach the codebase:
   - 0cef06df0 checkasm: add HEVC MC tests
   - e7078e842 hevcdsp: add x86 SIMD for MC
 - QSV scaling filter (62c58c5)
-- ffmpeg.c filter init decoupling (3e265ca,a3a0230,d2e56cf,94ebf55)
 
 Collateral damage that needs work locally:
 --
diff --git a/ffmpeg.c b/ffmpeg.c
index 83088e5195..e9ef04a542 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2193,6 +2193,34 @@ static int ifilter_send_frame(InputFilter *ifilter, 
AVFrame *frame)
 return 0;
 }
 
+static int ifilter_send_eof(InputFilter *ifilter)
+{
+int i, j, ret;
+
+ifilter->eof = 1;
+
+if (ifilter->filter) {
+ret = av_buffersrc_add_frame_flags(ifilter->filter, NULL, 
AV_BUFFERSRC_FLAG_PUSH);
+if (ret < 0)
+return ret;
+} else {
+// the filtergraph was never configured
+FilterGraph *fg = ifilter->graph;
+for (i = 0; i < fg->nb_inputs; i++)
+if (!fg->inputs[i]->eof)
+break;
+if (i == fg->nb_inputs) {
+// All the input streams have finished without the filtergraph
+// ever being configured.
+// Mark the output streams as finished.
+for (j = 0; j < fg->nb_outputs; j++)
+finish_output_stream(fg->outputs[j]->ost);
+}
+}
+
+return 0;
+}
+
 // This does not quite work like avcodec_decode_audio4/avcodec_decode_video2.
 // There is the following difference: if you got a frame, you must call
 // it again with pkt=NULL. pkt==NULL is treated differently from pkt.size==0
@@ -2494,18 +2522,11 @@ out:
 
 static int send_filter_eof(InputStream *ist)
 {
-int i, j, ret;
+int i, ret;
 for (i = 0; i < ist->nb_filters; i++) {
-if (ist->filters[i]->filter) {
-ret = av_buffersrc_add_frame(ist->filters[i]->filter, NULL);
-if (ret < 0)
-return ret;
-} else {
-// the filtergraph was never configured
-FilterGraph *fg = ist->filters[i]->graph;
-for (j = 0; j < fg->nb_outputs; j++)
-finish_output_stream(fg->outputs[j]->ost);
-}
+ret = ifilter_send_eof(ist->filters[i]);
+if (ret < 0)
+return ret;
 }
 return 0;
 }
diff --git a/ffmpeg.h b/ffmpeg.h
index 56e35ebb9c..5d20d453eb 100644
--- a/ffmpeg.h
+++ b/ffmpeg.h
@@ -248,6 +248,8 @@ typedef struct InputFilter {
 uint64_t channel_layout;
 
 AVBufferRef *hw_frames_ctx;
+
+int eof;
 } InputFilter;
 
 typedef struct OutputFilter {
diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
index 4d9a4e2eb8..816c906c7e 100644
--- a/ffmpeg_filter.c
+++ b/ffmpeg_filter.c
@@ -1128,6 +1128,15 @@ int configure_filtergraph(FilterGraph *fg)
 }
 }
 
+/* send the EOFs for the finished inputs */
+for (i = 0; i < fg->nb_inputs; i++) {
+if (fg->inputs[i]->eof) {
+ret = av_buffersrc_add_frame(fg->inputs[i]->filter, NULL);
+if (ret < 0)
+return ret;
+}
+}
+
 return 0;
 }
 
-- 
2.11.0

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


[FFmpeg-devel] [PATCH v2 0/8] Merge lazy filter initialization in ffmpeg CLI

2017-02-15 Thread wm4
These patches merge the previously skipped Libav commits, which made
avconv lazily initialize libavfilter graphs. This means the filters
are initialized with the actual output format, instead of whatever
libavformat reports.

It's a prerequisite to making hardware decoding support saner, as
hardware decoders will output a different pixfmt than the software
format reported by libavformat. This can be seen on ffmpeg_qsv.c
and ffmpeg_cuvid.c, which don't lose any functionality, even though
half of the code is removed.

There are some differences in how ffmpeg.c and avconv.c filter-flow
works. Also, avconv.c doesn't have sub2video. Relatively intrusive
changes were required.

I plan to push this tomorrow, except if critical errors are found.

Anton Khirnov (4):
  ffmpeg: do packet ts rescaling in write_packet()
  ffmpeg: init filtergraphs only after we have a frame on each input
  ffmpeg: move flushing the queued frames to configure_filtergraph()
  ffmpeg: restructure sending EOF to filters

Timo Rothenpieler (2):
  ffmpeg_cuvid: adapt for recent filter graph initialization changes
  avcodec/cuvid: update hw_frames_ctx reference after get_format call

wm4 (2):
  ffmpeg: make sure packets put into the muxing FIFO are refcounted
  ffmpeg: fix printing of filter input/output names

 doc/libav-merge.txt|   1 -
 ffmpeg.c   | 397 +
 ffmpeg.h   |  22 +-
 ffmpeg_cuvid.c | 142 ++--
 ffmpeg_filter.c| 112 +++---
 ffmpeg_opt.c   |  44 ---
 ffmpeg_qsv.c   |  82 -
 libavcodec/cuvid.c |  13 +
 .../fate/exr-rgb-scanline-pxr24-half-uint32-13x9   |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44-12x8-l1  |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44-12x8-l2  |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44-13x9-l1  |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44-13x9-l2  |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44a-12x8-l1 |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44a-12x8-l2 |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44a-13x9-l1 |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44a-13x9-l2 |   2 +-
 tests/ref/fate/vp8-size-change |  62 ++--
 tests/ref/lavf/ffm |   2 +-
 tests/ref/lavf/mxf |   6 +-
 20 files changed, 399 insertions(+), 502 deletions(-)

-- 
2.11.0

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


[FFmpeg-devel] [PATCH v2 4/8] ffmpeg: fix printing of filter input/output names

2017-02-15 Thread wm4
Broken by the previous Libav commit (even in Libav, thus a separate
commit).

Signed-off-by: wm4 
---
 ffmpeg_filter.c | 44 +---
 1 file changed, 21 insertions(+), 23 deletions(-)

diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
index 8490f4a455..f21a8c85f8 100644
--- a/ffmpeg_filter.c
+++ b/ffmpeg_filter.c
@@ -230,6 +230,25 @@ int init_simple_filtergraph(InputStream *ist, OutputStream 
*ost)
 return 0;
 }
 
+static char *describe_filter_link(FilterGraph *fg, AVFilterInOut *inout, int 
in)
+{
+AVFilterContext *ctx = inout->filter_ctx;
+AVFilterPad *pads = in ? ctx->input_pads  : ctx->output_pads;
+int   nb_pads = in ? ctx->nb_inputs   : ctx->nb_outputs;
+AVIOContext *pb;
+uint8_t *res = NULL;
+
+if (avio_open_dyn_buf() < 0)
+exit_program(1);
+
+avio_printf(pb, "%s", ctx->filter->name);
+if (nb_pads > 1)
+avio_printf(pb, ":%s", avfilter_pad_get_name(pads, inout->pad_idx));
+avio_w8(pb, 0);
+avio_close_dyn_buf(pb, );
+return res;
+}
+
 static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
 {
 InputStream *ist = NULL;
@@ -300,6 +319,7 @@ static void init_input_filter(FilterGraph *fg, 
AVFilterInOut *in)
 fg->inputs[fg->nb_inputs - 1]->graph = fg;
 fg->inputs[fg->nb_inputs - 1]->format = -1;
 fg->inputs[fg->nb_inputs - 1]->type = ist->st->codecpar->codec_type;
+fg->inputs[fg->nb_inputs - 1]->name = describe_filter_link(fg, in, 1);
 
 fg->inputs[fg->nb_inputs - 1]->frame_queue = av_fifo_alloc(8 * 
sizeof(AVFrame*));
 if (!fg->inputs[fg->nb_inputs - 1]->frame_queue)
@@ -338,6 +358,7 @@ int init_complex_filtergraph(FilterGraph *fg)
 fg->outputs[fg->nb_outputs - 1]->out_tmp = cur;
 fg->outputs[fg->nb_outputs - 1]->type= 
avfilter_pad_get_type(cur->filter_ctx->output_pads,
  
cur->pad_idx);
+fg->outputs[fg->nb_outputs - 1]->name = describe_filter_link(fg, cur, 
0);
 cur = cur->next;
 fg->outputs[fg->nb_outputs - 1]->out_tmp->next = NULL;
 }
@@ -643,28 +664,8 @@ static int configure_output_audio_filter(FilterGraph *fg, 
OutputFilter *ofilter,
 return 0;
 }
 
-#define DESCRIBE_FILTER_LINK(f, inout, in) \
-{  \
-AVFilterContext *ctx = inout->filter_ctx;  \
-AVFilterPad *pads = in ? ctx->input_pads  : ctx->output_pads;  \
-int   nb_pads = in ? ctx->nb_inputs   : ctx->nb_outputs;   \
-AVIOContext *pb;   \
-   \
-if (avio_open_dyn_buf() < 0)\
-exit_program(1);   \
-   \
-avio_printf(pb, "%s", ctx->filter->name);  \
-if (nb_pads > 1)   \
-avio_printf(pb, ":%s", avfilter_pad_get_name(pads, inout->pad_idx));\
-avio_w8(pb, 0);\
-avio_close_dyn_buf(pb, >name);  \
-}
-
 int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, 
AVFilterInOut *out)
 {
-av_freep(>name);
-DESCRIBE_FILTER_LINK(ofilter, out, 0);
-
 if (!ofilter->ost) {
 av_log(NULL, AV_LOG_FATAL, "Filter %s has an unconnected output\n", 
ofilter->name);
 exit_program(1);
@@ -970,9 +971,6 @@ static int configure_input_audio_filter(FilterGraph *fg, 
InputFilter *ifilter,
 static int configure_input_filter(FilterGraph *fg, InputFilter *ifilter,
   AVFilterInOut *in)
 {
-av_freep(>name);
-DESCRIBE_FILTER_LINK(ifilter, in, 1);
-
 if (!ifilter->ist->dec) {
 av_log(NULL, AV_LOG_ERROR,
"No decoder for stream #%d:%d, filtering impossible\n",
-- 
2.11.0

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


[FFmpeg-devel] [PATCH v2 3/8] ffmpeg: init filtergraphs only after we have a frame on each input

2017-02-15 Thread wm4
From: Anton Khirnov 

This makes sure the actual stream parameters are used, which is
important mainly for hardware decoding+filtering cases, which would
previously require various weird workarounds to handle the fact that a
fake software graph has to be constructed, but never used.
This should also improve behaviour in rare cases where
avformat_find_stream_info() does not provide accurate information.

This merges Libav commit a3a0230. It was previously skipped.

The vp8-size-change gives different result, because now the size of
the first frame is used. libavformat reported the size of the largest
frame for some reason.

The exr tests now use the sample aspect ratio of the first frame. For
some reason libavformat determines 0/1 as aspect ratio, while the
decoder returns the correct one.

The ffm and mxf tests change the field_order values. I'm assuming
another libavformat/decoding mismatch.

Signed-off-by: wm4 
---
 ffmpeg.c   | 334 +
 ffmpeg.h   |  17 +-
 ffmpeg_cuvid.c |   1 -
 ffmpeg_filter.c|  48 +--
 ffmpeg_opt.c   |  44 ---
 ffmpeg_qsv.c   |  82 -
 .../fate/exr-rgb-scanline-pxr24-half-uint32-13x9   |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44-12x8-l1  |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44-12x8-l2  |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44-13x9-l1  |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44-13x9-l2  |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44a-12x8-l1 |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44a-12x8-l2 |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44a-13x9-l1 |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44a-13x9-l2 |   2 +-
 tests/ref/fate/vp8-size-change |  62 ++--
 tests/ref/lavf/ffm |   2 +-
 tests/ref/lavf/mxf |   6 +-
 18 files changed, 277 insertions(+), 337 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 2876e43b32..5ef4eee7ad 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -123,6 +123,7 @@ const char *const forced_keyframes_const_names[] = {
 static void do_video_stats(OutputStream *ost, int frame_size);
 static int64_t getutime(void);
 static int64_t getmaxrss(void);
+static int ifilter_has_all_input_formats(FilterGraph *fg);
 
 static int run_as_daemon  = 0;
 static int nb_frames_dup = 0;
@@ -472,6 +473,13 @@ static void ffmpeg_cleanup(int ret)
 FilterGraph *fg = filtergraphs[i];
 avfilter_graph_free(>graph);
 for (j = 0; j < fg->nb_inputs; j++) {
+while (av_fifo_size(fg->inputs[j]->frame_queue)) {
+AVFrame *frame;
+av_fifo_generic_read(fg->inputs[j]->frame_queue, ,
+ sizeof(frame), NULL);
+av_frame_free();
+}
+av_fifo_free(fg->inputs[j]->frame_queue);
 av_buffer_unref(>inputs[j]->hw_frames_ctx);
 av_freep(>inputs[j]->name);
 av_freep(>inputs[j]);
@@ -1377,6 +1385,8 @@ static void do_video_stats(OutputStream *ost, int 
frame_size)
 }
 }
 
+static int init_output_stream(OutputStream *ost, char *error, int error_len);
+
 static void finish_output_stream(OutputStream *ost)
 {
 OutputFile *of = output_files[ost->file_index];
@@ -1409,10 +1419,20 @@ static int reap_filters(int flush)
 AVCodecContext *enc = ost->enc_ctx;
 int ret = 0;
 
-if (!ost->filter)
+if (!ost->filter || !ost->filter->graph->graph)
 continue;
 filter = ost->filter->filter;
 
+if (!ost->initialized) {
+char error[1024];
+ret = init_output_stream(ost, error, sizeof(error));
+if (ret < 0) {
+av_log(NULL, AV_LOG_ERROR, "Error initializing output stream 
%d:%d -- %s\n",
+   ost->file_index, ost->index, error);
+exit_program(1);
+}
+}
+
 if (!ost->filtered_frame && !(ost->filtered_frame = av_frame_alloc())) 
{
 return AVERROR(ENOMEM);
 }
@@ -1813,6 +1833,50 @@ static void flush_encoders(void)
 if (!ost->encoding_needed)
 continue;
 
+// Try to enable encoding with no input frames.
+// Maybe we should just let encoding fail instead.
+if (!ost->initialized) {
+FilterGraph *fg = ost->filter->graph;
+char error[1024];
+
+if (ost->filter && !fg->graph) {
+int x;
+for (x = 0; x < fg->nb_inputs; x++) {
+InputFilter *ifilter = fg->inputs[x];
+if (ifilter->format < 0) {
+AVCodecParameters *par = ifilter->ist->st->codecpar;
+// We never 

[FFmpeg-devel] [PATCH v2 1/8] ffmpeg: make sure packets put into the muxing FIFO are refcounted

2017-02-15 Thread wm4
Some callers (like do_subtitle_out()) call this with an AVPacket that is
not refcounted. This can cause undefined behavior.

Calling av_packet_move_ref() does not make a packet refcounted if it
isn't yet. (And it can't be made to, because it always succeeds,
and can't return ENOMEM.)

Call av_packet_ref() instead to make sure it's refcounted.

I couldn't find a case that is fixed by this with the current code. But
it will fix the fate-pva-demux test with the later patches applied.

Signed-off-by: wm4 
---
 ffmpeg.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 06570c0dd0..913c18d92b 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -654,7 +654,7 @@ static void write_packet(OutputFile *of, AVPacket *pkt, 
OutputStream *ost)
 int ret;
 
 if (!of->header_written) {
-AVPacket tmp_pkt;
+AVPacket tmp_pkt = {0};
 /* the muxer is not initialized yet, buffer the packet */
 if (!av_fifo_space(ost->muxing_queue)) {
 int new_size = FFMIN(2 * av_fifo_size(ost->muxing_queue),
@@ -669,8 +669,11 @@ static void write_packet(OutputFile *of, AVPacket *pkt, 
OutputStream *ost)
 if (ret < 0)
 exit_program(1);
 }
-av_packet_move_ref(_pkt, pkt);
+ret = av_packet_ref(_pkt, pkt);
+if (ret < 0)
+exit_program(1);
 av_fifo_generic_write(ost->muxing_queue, _pkt, sizeof(tmp_pkt), 
NULL);
+av_packet_unref(pkt);
 return;
 }
 
-- 
2.11.0

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


[FFmpeg-devel] [PATCH v2 2/8] ffmpeg: do packet ts rescaling in write_packet()

2017-02-15 Thread wm4
From: Anton Khirnov 

This will be useful in the following commit, after which the muxer
timebase is not always available when encoding.

This merges Libav commit 3e265ca. It was previously skipped.

There is a minor change with setting the mux_timebase field only after
the muxer's write_header function has been called, because it can
readjust the timebase.

Includes a minor merge fix by Mark Thompson, and

avconv: Move rescale to stream timebase before monotonisation

also by Mark Thompson .

Signed-off-by: wm4 
---
 ffmpeg.c | 39 ++-
 ffmpeg.h |  2 ++
 2 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 913c18d92b..2876e43b32 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -713,10 +713,12 @@ static void write_packet(OutputFile *of, AVPacket *pkt, 
OutputStream *ost)
 if (pkt->duration > 0)
 av_log(NULL, AV_LOG_WARNING, "Overriding packet duration by 
frame rate, this should not happen\n");
 pkt->duration = av_rescale_q(1, av_inv_q(ost->frame_rate),
- ost->st->time_base);
+ ost->mux_timebase);
 }
 }
 
+av_packet_rescale_ts(pkt, ost->mux_timebase, ost->st->time_base);
+
 if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
 if (pkt->dts != AV_NOPTS_VALUE &&
 pkt->pts != AV_NOPTS_VALUE &&
@@ -907,13 +909,13 @@ static void do_audio_out(OutputFile *of, OutputStream 
*ost,
 
 update_benchmark("encode_audio %d.%d", ost->file_index, ost->index);
 
-av_packet_rescale_ts(, enc->time_base, ost->st->time_base);
+av_packet_rescale_ts(, enc->time_base, ost->mux_timebase);
 
 if (debug_ts) {
 av_log(NULL, AV_LOG_INFO, "encoder -> type:audio "
"pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n",
-   av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, 
>st->time_base),
-   av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, 
>st->time_base));
+   av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, >time_base),
+   av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, 
>time_base));
 }
 
 output_packet(of, , ost);
@@ -993,8 +995,8 @@ static void do_subtitle_out(OutputFile *of,
 av_init_packet();
 pkt.data = subtitle_out;
 pkt.size = subtitle_out_size;
-pkt.pts  = av_rescale_q(sub->pts, AV_TIME_BASE_Q, ost->st->time_base);
-pkt.duration = av_rescale_q(sub->end_display_time, (AVRational){ 1, 
1000 }, ost->st->time_base);
+pkt.pts  = av_rescale_q(sub->pts, AV_TIME_BASE_Q, ost->mux_timebase);
+pkt.duration = av_rescale_q(sub->end_display_time, (AVRational){ 1, 
1000 }, ost->mux_timebase);
 if (enc->codec_id == AV_CODEC_ID_DVB_SUBTITLE) {
 /* XXX: the pts correction is handled here. Maybe handling
it in the codec would be better */
@@ -1187,7 +1189,7 @@ static void do_video_out(OutputFile *of,
 mux_par->field_order = AV_FIELD_PROGRESSIVE;
 pkt.data   = (uint8_t *)in_picture;
 pkt.size   =  sizeof(AVPicture);
-pkt.pts= av_rescale_q(in_picture->pts, enc->time_base, 
ost->st->time_base);
+pkt.pts= av_rescale_q(in_picture->pts, enc->time_base, 
ost->mux_timebase);
 pkt.flags |= AV_PKT_FLAG_KEY;
 
 output_packet(of, , ost);
@@ -1283,13 +1285,13 @@ static void do_video_out(OutputFile *of,
 if (pkt.pts == AV_NOPTS_VALUE && !(enc->codec->capabilities & 
AV_CODEC_CAP_DELAY))
 pkt.pts = ost->sync_opts;
 
-av_packet_rescale_ts(, enc->time_base, ost->st->time_base);
+av_packet_rescale_ts(, enc->time_base, ost->mux_timebase);
 
 if (debug_ts) {
 av_log(NULL, AV_LOG_INFO, "encoder -> type:video "
 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n",
-av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, 
>st->time_base),
-av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, 
>st->time_base));
+av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, 
>mux_timebase),
+av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, 
>mux_timebase));
 }
 
 frame_size = pkt.size;
@@ -1862,8 +1864,8 @@ static void flush_encoders(void)
 av_packet_unref();
 continue;
 }
-av_packet_rescale_ts(, enc->time_base, ost->st->time_base);
 pkt_size = pkt.size;
+av_packet_rescale_ts(, enc->time_base, ost->mux_timebase);
 output_packet(of, , ost);
 if (ost->enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO && 
vstats_filename) {
 do_video_stats(ost, pkt_size);
@@ -1897,7 +1899,7 @@ static void 

Re: [FFmpeg-devel] [PATCH 0/9] Merge lazy filter initialization in ffmpeg CLI

2017-02-15 Thread wm4
On Tue, 14 Feb 2017 18:43:30 +0100
Michael Niedermayer  wrote:

> On Tue, Feb 14, 2017 at 06:11:22PM +0100, Michael Niedermayer wrote:
> > On Mon, Feb 13, 2017 at 12:57:30PM +0100, Michael Niedermayer wrote:  
> > > On Mon, Feb 13, 2017 at 10:31:19AM +0100, wm4 wrote:  
> > > > On Fri, 10 Feb 2017 15:25:13 +0100
> > > > Michael Niedermayer  wrote:
> > > >   
> > > > > On Fri, Feb 10, 2017 at 03:22:28PM +0100, Michael Niedermayer wrote:  
> > > > > > On Fri, Feb 10, 2017 at 03:15:29PM +0100, Michael Niedermayer 
> > > > > > wrote:
> > > > > > > On Fri, Feb 10, 2017 at 01:35:32PM +0100, wm4 wrote:
> > > > > > > > These patches merge the previously skipped Libav commits, which 
> > > > > > > > made
> > > > > > > > avconv lazily initialize libavfilter graphs. This means the 
> > > > > > > > filters
> > > > > > > > are initialized with the actual output format, instead of 
> > > > > > > > whatever
> > > > > > > > libavformat reports.
> > > > > > > > 
> > > > > > > > It's a prerequisite to making hardware decoding support saner, 
> > > > > > > > as
> > > > > > > > hardware decoders will output a different pixfmt than the 
> > > > > > > > software
> > > > > > > > format reported by libavformat. This can be seen on 
> > > > > > > > ffmpeg_qsv.c,
> > > > > > > > which doesn't lose any functionality, even though half of the 
> > > > > > > > code
> > > > > > > > is removed.
> > > > > > > > 
> > > > > > > > There are some differences in how ffmpeg.c and avconv.c 
> > > > > > > > filter-flow
> > > > > > > > works. Also, avconv.c doesn't have sub2video. Relatively 
> > > > > > > > intrusive
> > > > > > > > changes were required.
> > > > > > > > 
> > > > > > > > The status of cuvid is unknown, but work in progress.
> > > > > > > > 
> > > > > > > > Anton Khirnov (4):
> > > > > > > >   ffmpeg: do packet ts rescaling in write_packet()
> > > > > > > >   ffmpeg: init filtergraphs only after we have a frame on each 
> > > > > > > > input
> > > > > > > >   ffmpeg: move flushing the queued frames to 
> > > > > > > > configure_filtergraph()
> > > > > > > >   ffmpeg: restructure sending EOF to filters
> > > > > > > > 
> > > > > > > > Timo Rothenpieler (3):
> > > > > > > >   ffmpeg_cuvid: adapt for recent filter graph initialization 
> > > > > > > > changes
> > > > > > > >   avcodec/cuvid: add format mismatch debug logs
> > > > > > > >   avcodec/cuvid: update hw_frames_ctx reference after 
> > > > > > > > get_format call
> > > > > > > > 
> > > > > > > > wm4 (2):
> > > > > > > >   ffmpeg: make sure packets put into the muxing FIFO are 
> > > > > > > > refcounted
> > > > > > > >   ffmpeg: fix printing of filter input/output names
> > > > > > > 
> > > > > > > This patchset breaks
> > > > > > > ./ffmpeg -i Voting_Machine.wmv test.avi
> > > > > > > 
> > > > > > > http://data.onas.ru/fun-clips/Voting_Machine.wmv
> > > > > > > 
> > > > > > > didnt bisect which patch causes it
> > > > > > 
> > > > > > heres another example:
> > > > > > 
> > > > > > ./ffmpeg -i ~/tickets/4329/bogus_video.mp4 -vframes 5  -vf 
> > > > > > crop=720:404  out.mov
> > > > > > ./ffplay out.mov
> > > > > > before this patchset out.mov had an audio stream
> > > > > 
> > > > > sample seems to be here:
> > > > > http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket4329/
> > > > > 
> > > > > [...]
> > > > > 
> > > > >   
> > > > 
> > > > Most of these should be fixed, new patches:
> > > > https://github.com/wm4/FFmpeg/commits/filter-merge  
> > > 
> > > already reported on IRC:
> > > this breaks:
> > > ./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -vf scale=80x60  small.mpg && 
> > > ./ffmpeg -i small.mpg  -vframes 3 -metadata compilation="1"  blah.m4a
> > > 
> > > 
> > > Also please repost the patchset or changed patches to the ML
> > > I think this needs more testing, its a large patchset  
> > 
> > a new one
> > 
> > ./ffmpeg -i tickets//3080/flossless_cut.avi -f null -
> > (with 2c7a77304a7c4f8f7670866db319613771fcde13)
> > 
> > seems to never exit on its own  

Fixed in the next patch set.

> 
> heres another failure:
> i found 3 files failing this way, sadly 1 is marked as private and one
> i cant figure out were i got it from so its possibly private too
> the 3rd is public but a fuzzed file, the other 2 are a undamaged file
> and one which has actual real world (unintended) damage
> 
> ./ffmpeg -i tickets//4931/ffv1_fuzz1.avi out.avi
> 
> this fails were previously there was some output

Appears to "work" with -max_muxing_queue_size 1000

> [...]
> 

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


Re: [FFmpeg-devel] [PATCH] avformat/mpl2dec: skip BOM when probing

2017-02-15 Thread Paul B Mahol
On 2/15/17, wm4  wrote:
> On Sat, 11 Feb 2017 11:56:07 +0100
> Paul B Mahol  wrote:
>
>> Signed-off-by: Paul B Mahol 
>> ---
>>  libavformat/mpl2dec.c | 8 
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/libavformat/mpl2dec.c b/libavformat/mpl2dec.c
>> index 59589d5..0e30cb0 100644
>> --- a/libavformat/mpl2dec.c
>> +++ b/libavformat/mpl2dec.c
>> @@ -23,6 +23,8 @@
>>   * MPL2 subtitles format demuxer
>>   */
>>
>> +#include "libavutil/intreadwrite.h"
>> +
>>  #include "avformat.h"
>>  #include "internal.h"
>>  #include "subtitles.h"
>> @@ -39,6 +41,9 @@ static int mpl2_probe(AVProbeData *p)
>>  const unsigned char *ptr = p->buf;
>>  const unsigned char *ptr_end = ptr + p->buf_size;
>>
>> +if (AV_RB24(ptr) == 0xefbbbf)
>> +ptr += 3;
>> +
>>  for (i = 0; i < 2; i++) {
>>  if (sscanf(ptr, "[%"SCNd64"][%"SCNd64"]%c", , , ) !=
>> 3 &&
>>  sscanf(ptr, "[%"SCNd64"][]%c",  ,   ) !=
>> 2)
>> @@ -94,6 +99,9 @@ static int mpl2_read_header(AVFormatContext *s)
>>  if (!len)
>>  break;
>>
>> +if (AV_RB24(p) == 0xefbbbf)
>> +p += 3;
>> +
>>  line[strcspn(line, "\r\n")] = 0;
>>
>>  if (!read_ts(, _start, )) {
>
> What happened to the equivalent patch I sent almost a year ago? My
> patch skipped it only in the probe function, because the subtitle line
> reader skips BOM already.

It doesn't appear that is true.

>
> It referenced the same trac ticket.

You needd to resend/ping patch more often.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel