Re: [FFmpeg-devel] [PATCH 2/2] hlsenc: set target duration always exact or longer than max segment duration

2018-03-23 Thread Steven Liu
2018-03-24 6:42 GMT+08:00 Jan Ekström :
> From: Jan Ekström 
>
> Follows the RFC with floating point durations.
> F.ex., 5.005 => 6
>
> Signed-off-by: Jan Ekström 
> ---
>  libavformat/hlsenc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 07569dbff1..ecb581acb9 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -1386,7 +1386,8 @@ static int hls_window(AVFormatContext *s, int last, 
> VariantStream *vs)
>
>  for (en = vs->segments; en; en = en->next) {
>  if (target_duration <= en->duration)
> -target_duration = lrint(en->duration);
> +/* Target duration has to always be exactly or longer than any 
> segment */
> +target_duration = ceil(en->duration);
This is not correct, at the specification author said, the duration
should set to 5, not 6, reference link
:https://trac.ffmpeg.org/ticket/6915

Thanks

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


Re: [FFmpeg-devel] [PATCH 1/2] hlsenc: use stream's maximum bit rate as fall-back advertised rate

2018-03-23 Thread Steven Liu
2018-03-24 6:42 GMT+08:00 Jan Ekström :
> From: Jan Ekström 
>
> Enables having proper bit rate values being written into the master
> playlist in case of hard-constrained VBR where the maximum bit
> rate utilized is known before hand.
>
> Does the same thing as movenc.c, for example.
>
> Signed-off-by: Jan Ekström 
> ---
>  libavformat/hlsenc.c | 15 +--
>  1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index b7c6fbde6a..07569dbff1 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -1174,6 +1174,17 @@ static int get_relative_url(const char *master_url, 
> const char *media_url,
>  return 0;
>  }
>
> +static int64_t get_stream_bit_rate(AVStream *stream) {
> +AVCPBProperties *props = 
> (AVCPBProperties*)av_stream_get_side_data(stream, AV_PKT_DATA_CPB_PROPERTIES, 
> NULL);
> +
> +if (stream->codecpar->bit_rate)
> +return stream->codecpar->bit_rate;
> +else if (props)
> +return props->max_bitrate;
> +
> +return 0;
> +}
> +
>  static int create_master_playlist(AVFormatContext *s,
>VariantStream * const input_vs)
>  {
> @@ -1300,9 +1311,9 @@ static int create_master_playlist(AVFormatContext *s,
>
>  bandwidth = 0;
>  if (vid_st)
> -bandwidth += vid_st->codecpar->bit_rate;
> +bandwidth += get_stream_bit_rate(vid_st);
>  if (aud_st)
> -bandwidth += aud_st->codecpar->bit_rate;
> +bandwidth += get_stream_bit_rate(aud_st);
>  bandwidth += bandwidth / 10;
>
>  ccgroup = NULL;
> --
> 2.14.3
>


LGTM

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


Re: [FFmpeg-devel] [PATCH] avcodec/trace_headers: always unref the input packet

2018-03-23 Thread James Almer
On 3/24/2018 1:02 AM, James Almer wrote:
> ff_cbs_read_packet() does not take ownership of it.
> 
> Regression since c266049191.
> 
> Signed-off-by: James Almer 
> ---
>  libavcodec/trace_headers_bsf.c | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/trace_headers_bsf.c b/libavcodec/trace_headers_bsf.c
> index 94a3ef72a2..f197f6168e 100644
> --- a/libavcodec/trace_headers_bsf.c
> +++ b/libavcodec/trace_headers_bsf.c
> @@ -98,13 +98,16 @@ static int trace_headers(AVBSFContext *bsf, AVPacket *pkt)
>  
>  err = ff_cbs_read_packet(ctx->cbc, &au, pkt);
>  if (err < 0) {
> -av_packet_unref(pkt);
> -return err;
> +goto fail;
>  }
>  
>  ff_cbs_fragment_uninit(ctx->cbc, &au);
>  
> -return 0;
> +err = 0;
> +fail:
> +av_packet_unref(pkt);
> +
> +return err;
>  }
>  
>  const AVBitStreamFilter ff_trace_headers_bsf = {
> 

Disregard this patch. I misread what the filter was trying to do.

Sorry for the noise.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec/trace_headers: always unref the input packet

2018-03-23 Thread James Almer
ff_cbs_read_packet() does not take ownership of it.

Regression since c266049191.

Signed-off-by: James Almer 
---
 libavcodec/trace_headers_bsf.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavcodec/trace_headers_bsf.c b/libavcodec/trace_headers_bsf.c
index 94a3ef72a2..f197f6168e 100644
--- a/libavcodec/trace_headers_bsf.c
+++ b/libavcodec/trace_headers_bsf.c
@@ -98,13 +98,16 @@ static int trace_headers(AVBSFContext *bsf, AVPacket *pkt)
 
 err = ff_cbs_read_packet(ctx->cbc, &au, pkt);
 if (err < 0) {
-av_packet_unref(pkt);
-return err;
+goto fail;
 }
 
 ff_cbs_fragment_uninit(ctx->cbc, &au);
 
-return 0;
+err = 0;
+fail:
+av_packet_unref(pkt);
+
+return err;
 }
 
 const AVBitStreamFilter ff_trace_headers_bsf = {
-- 
2.16.2

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


[FFmpeg-devel] [PATCH 1/1] Add Sega FILM muxer

2018-03-23 Thread misty
From: Misty De Meo 

---
 Changelog |   1 +
 libavformat/Makefile  |   1 +
 libavformat/allformats.c  |   1 +
 libavformat/segafilmenc.c | 377 ++
 4 files changed, 380 insertions(+)
 create mode 100644 libavformat/segafilmenc.c

diff --git a/Changelog b/Changelog
index 30a8978db4..0ff62ff69d 100644
--- a/Changelog
+++ b/Changelog
@@ -48,6 +48,7 @@ version :
 - drmeter audio filter
 - hapqa_extract bitstream filter
 - filter_units bitstream filter
+- segafilm muxer
 
 
 version 3.4:
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 39ec68c28b..4abb992b14 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -462,6 +462,7 @@ OBJS-$(CONFIG_SDR2_DEMUXER)  += sdr2.o
 OBJS-$(CONFIG_SDS_DEMUXER)   += sdsdec.o
 OBJS-$(CONFIG_SDX_DEMUXER)   += sdxdec.o
 OBJS-$(CONFIG_SEGAFILM_DEMUXER)  += segafilm.o
+OBJS-$(CONFIG_SEGAFILM_MUXER)+= segafilmenc.o
 OBJS-$(CONFIG_SEGMENT_MUXER) += segment.o
 OBJS-$(CONFIG_SHORTEN_DEMUXER)   += shortendec.o rawdec.o
 OBJS-$(CONFIG_SIFF_DEMUXER)  += siff.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 9dc5ce8a76..dfd964f07a 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -364,6 +364,7 @@ extern AVInputFormat  ff_sdr2_demuxer;
 extern AVInputFormat  ff_sds_demuxer;
 extern AVInputFormat  ff_sdx_demuxer;
 extern AVInputFormat  ff_segafilm_demuxer;
+extern AVOutputFormat ff_segafilm_muxer;
 extern AVOutputFormat ff_segment_muxer;
 extern AVOutputFormat ff_stream_segment_muxer;
 extern AVInputFormat  ff_shorten_demuxer;
diff --git a/libavformat/segafilmenc.c b/libavformat/segafilmenc.c
new file mode 100644
index 00..453eb7d6ba
--- /dev/null
+++ b/libavformat/segafilmenc.c
@@ -0,0 +1,377 @@
+/*
+ * Sega FILM Format (CPK) Muxer
+ * Copyright (C) 2003 The FFmpeg project
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * Sega FILM (.cpk) file muxer
+ * @author Misty De Meo 
+ *
+ * @see For more information regarding the Sega FILM file format, visit:
+ *   http://wiki.multimedia.cx/index.php?title=Sega_FILM
+ */
+
+#include "libavutil/intreadwrite.h"
+#include "avformat.h"
+#include "internal.h"
+#include "avio_internal.h"
+
+typedef struct FILMPacket {
+int audio;
+int keyframe;
+int32_t pts;
+int32_t duration;
+int32_t size;
+int32_t index;
+struct FILMPacket *next;
+} FILMPacket;
+
+typedef struct FILMOutputContext {
+const AVClass *class;
+int audio_index;
+int video_index;
+int64_t stab_pos;
+FILMPacket *start;
+FILMPacket *last;
+int64_t packet_count;
+} FILMOutputContext;
+
+static int film_write_packet_to_header(AVFormatContext *format_context, 
FILMPacket *pkt)
+{
+AVIOContext *pb = format_context->pb;
+// The bits in these two 32-bit integers contain info about the contents 
of this sample
+int32_t info1 = 0;
+int32_t info2 = 0;
+
+if (pkt->audio) {
+// Always the same, carries no more information than "this is audio"
+info1 = 0x;
+info2 = 1;
+} else {
+info1 = pkt->pts;
+info2 = pkt->duration;
+// The top bit being set indicates a key frame
+if (pkt->keyframe)
+info1 |= (1 << 31);
+}
+
+// Write the 16-byte sample info packet to the STAB chunk in the header
+avio_wb32(pb, pkt->index);
+avio_wb32(pb, pkt->size);
+avio_wb32(pb, info1);
+avio_wb32(pb, info2);
+
+return 0;
+}
+
+static int film_write_packet(AVFormatContext *format_context, AVPacket *pkt)
+{
+FILMPacket *metadata;
+AVIOContext *pb = format_context->pb;
+FILMOutputContext *film = format_context->priv_data;
+int encoded_buf_size = 0;
+
+// Track the metadata used to write the header and add it to the linked 
list
+metadata = av_mallocz(sizeof(FILMPacket));
+if (!metadata)
+return AVERROR(ENOMEM);
+metadata->audio = pkt->stream_index == film->audio_index;
+metadata->keyframe = pkt->flags & AV_PKT_FLAG_KEY;
+metadata->pts = pkt->pts;
+metadata->duration = pkt->duration;
+metadata->size = pkt->size;
+if (film->last == NULL) 

[FFmpeg-devel] [PATCH 0/1] re: Add Sega FILM muxer

2018-03-23 Thread misty
From: Misty De Meo 

> Just move allocation after all declarations.

OK, changed.

> Do you check that this condition is set in code?
>
> I mean, if user set codec for wrong case.

Oh, good point. I thought about this, and then realized that for mono audio,
there is no difference between planar and non-planar. If the muxer only accepts
planar then it'll work in both cases and there doesn't have to be a special
check. That also matches the behaviour of the demuxer, which marks streams as
planar regardless of channel layout.

> this is set but never used

Good catch - removed. Left over from an older version of the header generation.

Misty De Meo (1):
  Add Sega FILM muxer

 Changelog |   1 +
 libavformat/Makefile  |   1 +
 libavformat/allformats.c  |   1 +
 libavformat/segafilmenc.c | 377 ++
 4 files changed, 380 insertions(+)
 create mode 100644 libavformat/segafilmenc.c

-- 
2.16.2

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


Re: [FFmpeg-devel] [PATCH] avcodec/vp9_raw_reorder: cache input packets using new references

2018-03-23 Thread James Almer
On 3/22/2018 12:05 AM, James Almer wrote:
> Input packets may not be ref counted, meaning the data described in them
> may be gone at any time.
> 
> Fixes segfaults related to the above.

Dropping this patch. Packets are now guaranteed to be ref counted, so
there's no point for the extra alloc this patch introduces anymore.

> 
> Signed-off-by: James Almer 
> ---
>  libavcodec/vp9_raw_reorder_bsf.c | 15 +--
>  1 file changed, 13 insertions(+), 2 deletions(-)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/segafilm - fix keyframe detection and set packet, flags

2018-03-23 Thread Michael Niedermayer
On Thu, Mar 22, 2018 at 11:04:21PM +0530, Gyan Doshi wrote:
> Set the packet flag using constant as well.

>  segafilm.c |3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> d9d4db403c46a179ea93aab0d85904e7b4a831d2  
> 0001-avformat-segafilm-fix-keyframe-detection-and-set-pac.patch
> From 905cc5f1146c957ae4290b44a06a22a7524a87de Mon Sep 17 00:00:00 2001
> From: Gyan Doshi 
> Date: Wed, 21 Mar 2018 18:59:33 +0530
> Subject: [PATCH] avformat/segafilm - fix keyframe detection and set packet
>  flags
> 
> Streams from a Segafilm cpk file can't be streamcopied because
> keyframe flag isn't correctly set in stream index and
> said flag is never conveyed to the packet
> 
> Fixes #7091
> ---
>  libavformat/segafilm.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

should be ok

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH] libavfilter: Add OpenCL convolution filter v0.2: add name

2018-03-23 Thread Josh de Kock

On 2018/03/23 13:22, Danil Iashchenko wrote:

Thanks, fixed!

---
  libavfilter/opencl/convolution.cl   | 2 ++
  libavfilter/vf_convolution_opencl.c | 2 ++
  2 files changed, 4 insertions(+)


When you update patches you should send the same patch again (yes the 
whole patch) with the required changes, and a version in the email 
subject (i.e. [PATCH v2] libavfilter: Add OpenCL convolution filter).


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


Re: [FFmpeg-devel] [PATCH v2] avcodec/noise_bsf: move the reference in the bsf internal buffer

2018-03-23 Thread James Almer
On 3/23/2018 10:24 PM, Michael Niedermayer wrote:
> On Wed, Mar 21, 2018 at 10:53:04PM -0300, James Almer wrote:
>> There's no need to allocate a new packet for it.
>>
>> Signed-off-by: James Almer 
>> ---
>> Now using av_packet_make_writable() to make sure the packet can be
>> written to.
>>
>>  libavcodec/noise_bsf.c | 25 +
>>  1 file changed, 9 insertions(+), 16 deletions(-)
> 
> should be ok
> 
> thx

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


[FFmpeg-devel] [PATCH v2 2/5] lavfi: add new iteration API

2018-03-23 Thread Josh de Kock
Signed-off-by: Josh de Kock 
---
 configure|  24 +-
 doc/APIchanges   |   4 +
 doc/writing_filters.txt  |   6 +-
 libavfilter/allfilters.c | 820 +--
 libavfilter/avfilter.c   |  50 +--
 libavfilter/avfilter.h   |  29 +-
 libavfilter/version.h|   3 +
 7 files changed, 481 insertions(+), 455 deletions(-)

diff --git a/configure b/configure
index cc3edeb80f..9966ae3c10 100755
--- a/configure
+++ b/configure
@@ -3561,15 +3561,6 @@ for v in "$@"; do
 FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
 done
 
-find_things(){
-thing=$1
-pattern=$2
-file=$source_path/$3
-sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" 
"$file"
-}
-
-FILTER_LIST=$(find_things   filter   FILTER   libavfilter/allfilters.c)
-
 find_things_extern(){
 thing=$1
 pattern=$2
@@ -3578,6 +3569,13 @@ find_things_extern(){
 sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$out/p" "$file"
 }
 
+find_filters_extern(){
+file=$source_path/$1
+#sed -n "s/^extern AVFilter 
ff_\([avfsinkrc]\{2,5\}\)_\(\w\+\);/\2_filter/p" $file
+sed -E -n "s/^extern AVFilter 
ff_([avfsinkrc]{2,5})_([a-zA-Z0-9_]+);/\2_filter/p" $file
+}
+
+FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c)
 OUTDEV_LIST=$(find_things_extern muxer AVOutputFormat libavdevice/alldevices.c 
outdev)
 INDEV_LIST=$(find_things_extern demuxer AVInputFormat libavdevice/alldevices.c 
indev)
 MUXER_LIST=$(find_things_extern muxer AVOutputFormat libavformat/allformats.c)
@@ -7088,6 +7086,10 @@ echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
 
 cp_if_changed $TMPH libavutil/avconfig.h
 
+full_filter_name(){
+sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_$1;/\1_$1/p" 
$source_path/libavfilter/allfilters.c
+}
+
 # generate the lists of enabled components
 print_enabled_components(){
 file=$1
@@ -7098,6 +7100,9 @@ print_enabled_components(){
 for c in $*; do
 if enabled $c; then
 case $name in
+filter_list)
+c=$(full_filter_name $(remove_suffix _filter $c))
+;;
 indev_list)
 c=$(add_suffix _demuxer $(remove_suffix _indev $c))
 ;;
@@ -7112,6 +7117,7 @@ print_enabled_components(){
 cp_if_changed $TMPH $file
 }
 
+print_enabled_components libavfilter/filter_list.c AVFilter filter_list 
$FILTER_LIST
 print_enabled_components libavcodec/codec_list.c AVCodec codec_list $CODEC_LIST
 print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list 
$PARSER_LIST
 print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter 
bitstream_filters $BSF_LIST
diff --git a/doc/APIchanges b/doc/APIchanges
index d410bcdd75..4052988f59 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
+2018-xx-xx - xxx - lavc 7.13.100 - avcodec.h
+  Deprecate use of avfilter_register(), avfilter_register_all(),
+  avfilter_next(). Add av_filter_iterate().
+
 2018-03-21 - xxx - lavc 58.15.100 - avcodec.h
   Add av_packet_make_writable().
 
diff --git a/doc/writing_filters.txt b/doc/writing_filters.txt
index 5cd4ecd6a4..98b9c6f3d2 100644
--- a/doc/writing_filters.txt
+++ b/doc/writing_filters.txt
@@ -31,10 +31,8 @@ If everything went right, you should get a foobar.png with 
Lena edge-detected.
 That's it, your new playground is ready.
 
 Some little details about what's going on:
-libavfilter/allfilters.c:avfilter_register_all() is called at runtime to create
-a list of the available filters, but it's important to know that this file is
-also parsed by the configure script, which in turn will define variables for
-the build system and the C:
+libavfilter/allfilters.c:this file is parsed by the configure script, which in 
turn
+will define variables for the build system and the C:
 
 --- after running configure ---
 
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 3f67e321bf..2c63f02a54 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -23,410 +23,452 @@
 #include "avfilter.h"
 #include "config.h"
 
+extern AVFilter ff_af_abench;
+extern AVFilter ff_af_acompressor;
+extern AVFilter ff_af_acontrast;
+extern AVFilter ff_af_acopy;
+extern AVFilter ff_af_acrossfade;
+extern AVFilter ff_af_acrusher;
+extern AVFilter ff_af_adelay;
+extern AVFilter ff_af_aecho;
+extern AVFilter ff_af_aemphasis;
+extern AVFilter ff_af_aeval;
+extern AVFilter ff_af_afade;
+extern AVFilter ff_af_afftfilt;
+extern AVFilter ff_af_afir;
+extern AVFilter ff_af_aformat;
+extern AVFilter ff_af_agate;
+extern AVFilter ff_af_aiir;
+extern AVFilter ff_af_ainterleave;
+extern AVFilter ff_af_alimiter;
+extern AVFilter ff_af_allpass;
+extern AVFilter ff_af_aloop;
+extern AVFilter ff_af_amerge;
+extern AVFilter ff_af_ametadata;
+extern AVFilter ff_af_amix;
+extern AVFilter ff_af_anequalizer;
+extern AVFilter ff_af_anull;
+extern

[FFmpeg-devel] [PATCH] Revert "avcodec/vp9_superframe_bsf: cache packets by creating new references rather than moving them"

2018-03-23 Thread James Almer
This reverts commit 7a02b364b68c0bf7f065f5c217fae458f0efdb8d.

The packet fetched by ff_bsf_get_packet() and ff_bsf_get_packet_ref()
is now guaranteed to be reference counted.
---
 libavcodec/vp9_superframe_bsf.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavcodec/vp9_superframe_bsf.c b/libavcodec/vp9_superframe_bsf.c
index 2ea49c672d..52569ab097 100644
--- a/libavcodec/vp9_superframe_bsf.c
+++ b/libavcodec/vp9_superframe_bsf.c
@@ -147,9 +147,7 @@ static int vp9_superframe_filter(AVBSFContext *ctx, 
AVPacket *out)
 goto done;
 }
 
-res = av_packet_ref(s->cache[s->n_cache++], in);
-if (res < 0)
-goto done;
+av_packet_move_ref(s->cache[s->n_cache++], in);
 
 if (invisible) {
 res = AVERROR(EAGAIN);
-- 
2.16.2

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


Re: [FFmpeg-devel] [PATCH v2] avcodec/noise_bsf: move the reference in the bsf internal buffer

2018-03-23 Thread Michael Niedermayer
On Wed, Mar 21, 2018 at 10:53:04PM -0300, James Almer wrote:
> There's no need to allocate a new packet for it.
> 
> Signed-off-by: James Almer 
> ---
> Now using av_packet_make_writable() to make sure the packet can be
> written to.
> 
>  libavcodec/noise_bsf.c | 25 +
>  1 file changed, 9 insertions(+), 16 deletions(-)

should be ok

thx

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

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus


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


Re: [FFmpeg-devel] [PATCH] avcodec/bsf: make sure the AVBSFInternal stored packet is reference counted

2018-03-23 Thread James Almer
On 3/23/2018 8:15 PM, James Almer wrote:
> On 3/23/2018 7:46 PM, wm4 wrote:
>> On Fri, 23 Mar 2018 18:38:22 -0300
>> James Almer  wrote:
>>
>>> Some bitstream filters may buffer said packet in their own contexts
>>> for latter use.
>>> The documentation for av_bsf_send_packet() doesn't forbid feeding
>>> it non-reference counted packets, which depending on the way said
>>> packets were internally buffered by the bsf it may result in the
>>> data described in them to become invalid or unavailable at any time.
>>>
>>> This was the case with vp9_superframe after commit e1bc3f4396, which
>>> was then promptly fixed in 37f4a093f7 and 7a02b364b6. It is still the
>>> case even today with vp9_reorder_raw.
>>>
>>> With this change the bitstream filters will not have to worry how to
>>> store or consume the packets fed to them.
>>>
>>> Signed-off-by: James Almer 
>>> ---
>>> Regarding vp9_raw_reorder, see "[PATCH] avcodec/vp9_raw_reorder: cache
>>> input packets using new references" for a local fix similar to what
>>> vp9_superframe got with 37f4a093f7 and 7a02b364b6.
>>>
>>> A simple reproducer if you're curious is:
>>>
>>> ffmpeg -i INPUT -c:v copy -bsf:v vp9_raw_reorder -f null -
>>>
>>> Which segfauls with current git master.
>>>
>>> "[PATCH 2/2] ffmpeg: pass reference counted packets on codec copy
>>> when possible" also works around this in most cases by doing what its
>>> subject describes, but only affects the ffmpeg CLI only and not the
>>> API itself, of course.
>>>
>>>  libavcodec/bsf.c | 10 +-
>>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
>>> index 38b423101c..25f7a20ad6 100644
>>> --- a/libavcodec/bsf.c
>>> +++ b/libavcodec/bsf.c
>>> @@ -188,7 +188,15 @@ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket 
>>> *pkt)
>>>  ctx->internal->buffer_pkt->side_data_elems)
>>>  return AVERROR(EAGAIN);
>>>  
>>> -av_packet_move_ref(ctx->internal->buffer_pkt, pkt);
>>> +if (pkt->buf)
>>> +av_packet_move_ref(ctx->internal->buffer_pkt, pkt);
>>> +else {
>>> +int ret = av_packet_ref(ctx->internal->buffer_pkt, pkt);
>>> +
>>> +if (ret < 0)
>>> +return ret;
>>> +av_packet_unref(pkt);
>>> +}
>>>  
>>>  return 0;
>>>  }
>>
>> Fine, but we should probably really provide an API function that
>> ensures that a packet is refcounted (and made refcounting if it isn't).
>> av_dup_packet() does this, but it's deprecated and has a bad name.
> 
> av_packet_ref() ensures that, and so does av_packet_make_writable(), but
> as a side effect of their main intended use. The documentation even
> states to use av_packet_ref() for that purpose.
> 
> If you want one exactly like av_dup_packet() but in a less hacky way
> that exclusively does "Make this packet's data ref counted if it's not,
> do nothing else", we could add an av_packet_make_refcounted() function
> or whatever. It should be trivial, so just tell me a name you'd like for
> it and I'll write it.

Patch pushed in the meantime.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] ffmpeg: pass reference counted packets on codec copy when possible

2018-03-23 Thread James Almer
On 3/21/2018 8:08 PM, Michael Niedermayer wrote:
> On Wed, Mar 21, 2018 at 12:03:32PM -0300, James Almer wrote:
>> Should prevent unnecessary copy of data in cases where new references
>> to the packet are created within the muxer or a bitstream filter.
>>
>> Signed-off-by: James Almer 
>> ---
>>  fftools/ffmpeg.c | 5 +
>>  1 file changed, 5 insertions(+)
> 
> should be ok
> 
> thx

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


[FFmpeg-devel] [PATCH] avcodec/get_bits: Make sure the input bitstream with padding can be addressed

2018-03-23 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavcodec/get_bits.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index f90a06c7a5..56ef5f0cbe 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -32,6 +32,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/log.h"
 #include "libavutil/avassert.h"
+#include "avcodec.h"
 #include "mathops.h"
 #include "vlc.h"
 
@@ -435,7 +436,7 @@ static inline int init_get_bits(GetBitContext *s, const 
uint8_t *buffer,
 int buffer_size;
 int ret = 0;
 
-if (bit_size >= INT_MAX - 7 || bit_size < 0 || !buffer) {
+if (bit_size >= INT_MAX - FFMAX(7, AV_INPUT_BUFFER_PADDING_SIZE*8) || 
bit_size < 0 || !buffer) {
 bit_size= 0;
 buffer  = NULL;
 ret = AVERROR_INVALIDDATA;
-- 
2.16.2

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


Re: [FFmpeg-devel] Moving enum AVFieldOrder to libavutil?

2018-03-23 Thread Hendrik Leppkes
On Sat, Mar 24, 2018 at 1:07 AM, Marton Balint  wrote:
>
>
> On Fri, 23 Mar 2018, Devin Heitmueller wrote:
>
>> Hello,
>>
>> I am in the process of reworking libavfilter to pass along the field order
>> across links.  For the moment I followed the model found in AVFrame where
>> there are two int fields: “interlaced_frame” and “top_field_first”.  However
>> it seems like it would be more appropriate to use the enum AVFieldOrder,
>> which is a single field and provides more flexibility (including being able
>> to be set to “unknown” if appropriate).
>>
>> Does anyone have an objection to moving the definition of AVFieldOrder to
>> libavutil, so it can be taken advantage of by libavfilter?  Right now it’s
>> in libavcodec, and from what I understand libavfilter does not depend on
>> libavcodec.
>
>
> AVFieldOrder is already a mess, so I would not use that directly. There was
> a discussion why it is currently inconsistent between codecs:
>
> https://patchwork.ffmpeg.org/patch/4699/
>
> Maybe cleaner to introduce a new enum which defines the semantics better.
> Also, as far as I understand, an AVFrame is always storing the fields as
> interleaved, so strictly speaking an AVFrame (AVFilter) field order and
> AVCodecParameters field order is not entirely the same thing, that is one
> more reasone for a separate (new) type.
>

AVFrame can already indicate this. Since fields are always
interleaved, all you need is the "interlaced_frame" and
"top_field_first" elements which already exists as part of AVFrame.
Not sure why we need another method to replace this.

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


Re: [FFmpeg-devel] [PATCH] Support signaling of last segment number

2018-03-23 Thread Michael Niedermayer
On Thu, Mar 22, 2018 at 10:14:36PM +0200, Jan Ekström wrote:
> On Thu, Mar 22, 2018 at 9:51 PM, sanilraut  wrote:
> > Last segment indicated by mpd is not parsed.
> > Example stream: 
> > http://dash.akamaized.net/dash264/TestCasesIOP41/LastSegmentNumber/1/manifest_last_segment_num.mpd
> >
> > This patch supports parsing of Supplemental Descriptor with @schemeIdUri 
> > set to http://dashif.org/guide-
> > lines/last-segment-number with the @value set to the last segment number.
> >
> 
> Hi,
> 
> Just seeing the commit message, 

... i realize its missing the avformat / libavformat/dashdec prefix :)
very minor issue but it seems a common mistake
maybe something could test for this automatically so new people would
notice before git send mail


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


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


Re: [FFmpeg-devel] [PATCH] lavf/utils.c: Don't compute start_time from DISCARD packets for video.

2018-03-23 Thread Michael Niedermayer
On Wed, Mar 21, 2018 at 01:36:38PM -0700, Sasi Inguva wrote:
> Signed-off-by: Sasi Inguva 
> ---
>  libavformat/utils.c   |  4 +++-
>  tests/fate/mov.mak| 10 +++-
>  tests/ref/fate/mov-neg-firstpts-discard   |  3 +++
>  .../ref/fate/mov-neg-firstpts-discard-frames  | 24 +++
>  4 files changed, 39 insertions(+), 2 deletions(-)
>  create mode 100644 tests/ref/fate/mov-neg-firstpts-discard
>  create mode 100644 tests/ref/fate/mov-neg-firstpts-discard-frames

will apply

thx

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

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein


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


Re: [FFmpeg-devel] [PATCH 1/2] ffmpeg: fallback to codecpar parameters on input filter eof

2018-03-23 Thread Marton Balint


On Mon, 19 Mar 2018, Marton Balint wrote:




On Mon, 19 Mar 2018, wm4 wrote:


On Sun, 18 Mar 2018 20:09:08 +0100
Marton Balint  wrote:


Fixes ticket #6854 and the following simpler case:

ffmpeg -f lavfi -i testsrc=d=1 -f lavfi -i testsrc=d=0 -filter_complex 

overlay -f null none




[...]


 for (i = 0; i < fg->nb_inputs; i++)
 if (!fg->inputs[i]->eof)
 break;


Does it make sense to mux audio or video without packets? And why?


Because filters may generate packets on output even if no packets are 
received on some input.




Will apply the series soon.

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


Re: [FFmpeg-devel] [RFC] avcodec/avcodec.h: Add encryption info side data

2018-03-23 Thread Michael Niedermayer
On Mon, Jan 08, 2018 at 05:03:32PM -0800, Jacob Trimble wrote:
> On Mon, Jan 8, 2018 at 11:40 AM, Jacob Trimble  wrote:
> >> I'd assume we'd wait with applying this until the mp4 patch that uses
> >> it is reviewed. I'm fine with this patch and I think it can be pushed
> >> as it is, although I just noticed an APIchanges entry and minor version
> >> bump is actually missing. You could add them when sending the final
> >> patch set.
> >
> > Added APIchanges entry and version bump.
> >
> >> The format of teh side data should be choosen so that demuxers and encoders
> >> producing it can interoperate with muxers and decoders consuming it.
> >
> >> Please correct me if iam wrong but if some containers can store more than
> >> others, then the "other" containers would not use that extra information 
> >> nor
> >> set it but it could still be using a compatible representation for 
> >> interoperability
> >
> > Well I guess I can do the same thing for this as for the
> > frame-specific encryption info.  There will be a user-friendly struct
> > for accessing it and a binary format that will be stored in the side
> > data.  This will allow different (de)muxers to use the data in a
> > generic way.
> >
> >> These should be checked against size, making sure the data is consistent
> >
> > Done.  Also added addition overflow checking.
> >
> > On Fri, Jan 5, 2018 at 2:42 PM, James Almer  wrote:
> >> This being in libavutil, the two functions using AVPacket should be
> >> changed to take and return a byte array instead, that the caller
> >> manually either got from side data, or will afterwards adds as side data.
> >
> > Done.
> 
> Noticed some bugs when integrating with my other changes.

>  doc/APIchanges  |4 
>  libavcodec/avcodec.h|   13 +
>  libavutil/Makefile  |2 
>  libavutil/encryption_info.c |  295 
> 
>  libavutil/encryption_info.h |  200 +
>  libavutil/version.h |2 
>  6 files changed, 515 insertions(+), 1 deletion(-)
> d8243c445d7bb638a1599ca9b847674a925578b8  encryption-info-v9.patch
> From 54f996fd8b8b8e44506739b58784e6038309 Mon Sep 17 00:00:00 2001
> From: Jacob Trimble 
> Date: Tue, 5 Dec 2017 14:52:22 -0800
> Subject: [PATCH] avcodec/avcodec.h: Add encryption info side data.
> 
> This new side-data will contain info on how a packet is encrypted.
> This allows the app to handle packet decryption.

will apply, as this is blocking other patches and noone seems to have
objected

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein


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


Re: [FFmpeg-devel] [PATCH] ffmpeg_filter: enable stream_loop in HWAccel transcoding.

2018-03-23 Thread Michael Niedermayer
On Wed, Mar 14, 2018 at 04:26:54PM +0800, Jun Zhao wrote:
> 

>  ffmpeg_filter.c |4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 170327a7137d3ce26124c86525566d32c523a948  
> 0001-ffmpeg_filter-enable-stream_loop-in-HWAccel-transcod.patch
> From 731b6cb1f3a13fa18cfe39c1ddba92050b999668 Mon Sep 17 00:00:00 2001
> From: Jun Zhao 
> Date: Wed, 14 Mar 2018 16:13:39 +0800
> Subject: [PATCH] ffmpeg_filter: enable stream_loop in HWAccel transcoding.
> 
> use the cmd: ffmpeg -y -stream_loop 1 -hwaccel vaapi -hwaccel_device
> /dev/dri/renderD128 -hwaccel_output_format vaapi -i
> input.mp4 -c:v h264_vaapi output.mp4 can get the error like:
> 
> Error while decoding stream #0:1: Invalid data found when processing
> input
> Impossible to convert between the formats supported by the filter
> 'Parsed_null_0' and the filter 'auto_scaler_0'
> Error reinitializing filters!
> Failed to inject frame into filter network: Function not implemented
> 
> the root cause is can't insert software scale filter in the hwaccel
> transcoding pipeline.
> 
> Signed-off-by: Jun Zhao 
> ---
>  fftools/ffmpeg_filter.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
> index 877fd670e6..c85dd7ae8d 100644
> --- a/fftools/ffmpeg_filter.c
> +++ b/fftools/ffmpeg_filter.c
> @@ -452,6 +452,7 @@ static int configure_output_video_filter(FilterGraph *fg, 
> OutputFilter *ofilter,
>  int pad_idx = out->pad_idx;
>  int ret;
>  char name[255];
> +const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(ofilter->format);
>  
>  snprintf(name, sizeof(name), "out_%d_%d", ost->file_index, ost->index);
>  ret = avfilter_graph_create_filter(&ofilter->filter,
> @@ -461,7 +462,8 @@ static int configure_output_video_filter(FilterGraph *fg, 
> OutputFilter *ofilter,
>  if (ret < 0)
>  return ret;
>  
> -if (ofilter->width || ofilter->height) {
> +if ((ofilter->width || ofilter->height) &&

> +(!desc || (desc && !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL {

this can be simplified because after "!desc ||" desc is not NULL

about the patch itself, ill leave this to the people activly working on hwaccel

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Does the universe only have a finite lifespan? No, its going to go on
forever, its just that you wont like living in it. -- Hiranya Peiri


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


Re: [FFmpeg-devel] Moving enum AVFieldOrder to libavutil?

2018-03-23 Thread Marton Balint



On Fri, 23 Mar 2018, Devin Heitmueller wrote:


Hello,

I am in the process of reworking libavfilter to pass along the field 
order across links.  For the moment I followed the model found in 
AVFrame where there are two int fields: “interlaced_frame” and 
“top_field_first”.  However it seems like it would be more appropriate 
to use the enum AVFieldOrder, which is a single field and provides more 
flexibility (including being able to be set to “unknown” if 
appropriate).


Does anyone have an objection to moving the definition of AVFieldOrder 
to libavutil, so it can be taken advantage of by libavfilter?  Right now 
it’s in libavcodec, and from what I understand libavfilter does not 
depend on libavcodec.


AVFieldOrder is already a mess, so I would not use that directly. 
There was a discussion why it is currently inconsistent between codecs:


https://patchwork.ffmpeg.org/patch/4699/

Maybe cleaner to introduce a new enum which defines the semantics better. 
Also, as far as I understand, an AVFrame is always storing the fields as 
interleaved, so strictly speaking an AVFrame (AVFilter) field order and 
AVCodecParameters field order is not entirely the same thing, that is one 
more reasone for a separate (new) type.




For what it’s worth, it looks like I’ve basically got it working - I’ve 
extended buffersrc/buffersink/AVFilterLink and ffmpeg, and I’m now able 
to propagate the interlaced state all the way from the H.264 decoder to 
the Decklink output during write_header(), and thus select the proper 
output format.  This includes it being preserved through any video 
filters that might be in the pipeline.  At this point it’s largely just 
a question of how to rework the patch to be as non-invasive as possible 
so it can be accepted upstream.


Seems reasonable.

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


Re: [FFmpeg-devel] [PATCH] avfilter: add hrtfm filter

2018-03-23 Thread Lou Logan
On Tue, Mar 20, 2018, at 1:20 AM, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  doc/filters.texi |  66 ++
>  libavfilter/Makefile |   1 +
>  libavfilter/af_hrtfm.c   | 557 
> +++
>  libavfilter/allfilters.c |   1 +
>  4 files changed, 625 insertions(+)
>  create mode 100644 libavfilter/af_hrtfm.c
> 
> diff --git a/doc/filters.texi b/doc/filters.texi
> index bd43a7ac6e..95950f7666 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
[...]
> +@item amin
> +Set minimum alfa. Default value is @code{0.05}.

"alfa" typo again (libavfilter/af_anequalizer.c also has this odd spelling).

I didn't see any replies regarding the alternative option names that I 
mentioned twice so I'll assume that means "no".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add hrtfm filter

2018-03-23 Thread Michael Niedermayer
On Fri, Mar 23, 2018 at 02:45:06PM +0100, Aurelien Jacobs wrote:
> On Fri, Mar 23, 2018 at 10:18:47AM +0100, Paul B Mahol wrote:
> > On 3/22/18, Aurelien Jacobs  wrote:
> > > On Mon, Mar 19, 2018 at 10:49:28PM -0800, Lou Logan wrote:
> > >> On Fri, Mar 16, 2018, at 11:44 AM, Paul B Mahol wrote:
> > >> > Signed-off-by: Paul B Mahol 
> > >> > ---
> > >> >  doc/filters.texi |  60 ++
> > >> >  libavfilter/Makefile |   1 +
> > >> >  libavfilter/af_hrtfm.c   | 486
> > >> >  +++>
> > >> > libavfilter/allfilters.c |   1 +
> > >> >  4 files changed, 548 insertions(+)
> > >> >  create mode 100644 libavfilter/af_hrtfm.c
> > >> >
> > >> > diff --git a/doc/filters.texi b/doc/filters.texi
> > >> > index bd43a7ac6e..c298054325 100644
> > >> > --- a/doc/filters.texi
> > >> > +++ b/doc/filters.texi
> > >> > @@ -3218,6 +3218,66 @@ Change highpass width.
> > >> >  Syntax for the command is : "@var{width}"
> > >> >  @end table
> > >> >
> > >> > +@section hrtfm
> > >> > +
> > >> > +Apply simple Head Related Transfer Function Model to audio stream.
> > >> > +
> > >> > +hrtfm filter creates virtual loudspeakers around the user for
> > >> > binaural> +listening via headphones (audio formats up to 9 channels
> > >> > supported).> +
> > >> > +This is very simple implementation which does not use any HRIRs.
> > >> > +
> > >> > +It accepts the following parameters:
> > >> > +
> > >> > +@table @option
> > >> > +@item hradius
> > >>
> > >> You didn't like the head_radius option name suggestion?
> > >>
> > >> > +Set head radius of listener. In meters. Default value is
> > >> > @code{0.0891}.
> > >> Why meters instead of cm?
> > >
> > > Because if you want to specify centimeters, you can use the option
> > > like this: -hradius 8.91c
> > 
> > Shouldn't it be 8.91cm?
> 
> Ideally it should yes.
> But currently the option system does not support units. It would be
> great to specify that this option is representing a length so that the
> parser could validate the unit and take it into account.

> But for now, options are unit-less numbers.
> You can't use "-bitrate 128kb/s", but you are instead limited to
> "-bitrate 128k" without specifying unit. Same for hradius for which
> you can use 8.91c but not 8.91cm.

AVOption does have a unit field.
Its currently used for named constants only. But i guess this could be
extended

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

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell


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


Re: [FFmpeg-devel] [PATCH 2/5] lavfi: add new iteration API

2018-03-23 Thread Michael Niedermayer
On Fri, Mar 23, 2018 at 08:48:16PM +, Josh de Kock wrote:
> ---
>  configure|  24 +-
>  doc/APIchanges   |   4 +
>  doc/writing_filters.txt  |   6 +-
>  libavfilter/allfilters.c | 820 
> +--
>  libavfilter/avfilter.c   |  45 ---
>  libavfilter/avfilter.h   |  29 +-
>  libavfilter/version.h|   3 +
>  7 files changed, 478 insertions(+), 453 deletions(-)

This breaks:

./ffmpeg -f lavfi -i 
'frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234'  
test.avi

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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


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


Re: [FFmpeg-devel] [PATCH] avcodec/bsf: make sure the AVBSFInternal stored packet is reference counted

2018-03-23 Thread James Almer
On 3/23/2018 7:46 PM, wm4 wrote:
> On Fri, 23 Mar 2018 18:38:22 -0300
> James Almer  wrote:
> 
>> Some bitstream filters may buffer said packet in their own contexts
>> for latter use.
>> The documentation for av_bsf_send_packet() doesn't forbid feeding
>> it non-reference counted packets, which depending on the way said
>> packets were internally buffered by the bsf it may result in the
>> data described in them to become invalid or unavailable at any time.
>>
>> This was the case with vp9_superframe after commit e1bc3f4396, which
>> was then promptly fixed in 37f4a093f7 and 7a02b364b6. It is still the
>> case even today with vp9_reorder_raw.
>>
>> With this change the bitstream filters will not have to worry how to
>> store or consume the packets fed to them.
>>
>> Signed-off-by: James Almer 
>> ---
>> Regarding vp9_raw_reorder, see "[PATCH] avcodec/vp9_raw_reorder: cache
>> input packets using new references" for a local fix similar to what
>> vp9_superframe got with 37f4a093f7 and 7a02b364b6.
>>
>> A simple reproducer if you're curious is:
>>
>> ffmpeg -i INPUT -c:v copy -bsf:v vp9_raw_reorder -f null -
>>
>> Which segfauls with current git master.
>>
>> "[PATCH 2/2] ffmpeg: pass reference counted packets on codec copy
>> when possible" also works around this in most cases by doing what its
>> subject describes, but only affects the ffmpeg CLI only and not the
>> API itself, of course.
>>
>>  libavcodec/bsf.c | 10 +-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
>> index 38b423101c..25f7a20ad6 100644
>> --- a/libavcodec/bsf.c
>> +++ b/libavcodec/bsf.c
>> @@ -188,7 +188,15 @@ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
>>  ctx->internal->buffer_pkt->side_data_elems)
>>  return AVERROR(EAGAIN);
>>  
>> -av_packet_move_ref(ctx->internal->buffer_pkt, pkt);
>> +if (pkt->buf)
>> +av_packet_move_ref(ctx->internal->buffer_pkt, pkt);
>> +else {
>> +int ret = av_packet_ref(ctx->internal->buffer_pkt, pkt);
>> +
>> +if (ret < 0)
>> +return ret;
>> +av_packet_unref(pkt);
>> +}
>>  
>>  return 0;
>>  }
> 
> Fine, but we should probably really provide an API function that
> ensures that a packet is refcounted (and made refcounting if it isn't).
> av_dup_packet() does this, but it's deprecated and has a bad name.

av_packet_ref() ensures that, and so does av_packet_make_writable(), but
as a side effect of their main intended use. The documentation even
states to use av_packet_ref() for that purpose.

If you want one exactly like av_dup_packet() but in a less hacky way
that exclusively does "Make this packet's data ref counted if it's not,
do nothing else", we could add an av_packet_make_refcounted() function
or whatever. It should be trivial, so just tell me a name you'd like for
it and I'll write it.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/bsf: make sure the AVBSFInternal stored packet is reference counted

2018-03-23 Thread wm4
On Fri, 23 Mar 2018 18:38:22 -0300
James Almer  wrote:

> Some bitstream filters may buffer said packet in their own contexts
> for latter use.
> The documentation for av_bsf_send_packet() doesn't forbid feeding
> it non-reference counted packets, which depending on the way said
> packets were internally buffered by the bsf it may result in the
> data described in them to become invalid or unavailable at any time.
> 
> This was the case with vp9_superframe after commit e1bc3f4396, which
> was then promptly fixed in 37f4a093f7 and 7a02b364b6. It is still the
> case even today with vp9_reorder_raw.
> 
> With this change the bitstream filters will not have to worry how to
> store or consume the packets fed to them.
> 
> Signed-off-by: James Almer 
> ---
> Regarding vp9_raw_reorder, see "[PATCH] avcodec/vp9_raw_reorder: cache
> input packets using new references" for a local fix similar to what
> vp9_superframe got with 37f4a093f7 and 7a02b364b6.
> 
> A simple reproducer if you're curious is:
> 
> ffmpeg -i INPUT -c:v copy -bsf:v vp9_raw_reorder -f null -
> 
> Which segfauls with current git master.
> 
> "[PATCH 2/2] ffmpeg: pass reference counted packets on codec copy
> when possible" also works around this in most cases by doing what its
> subject describes, but only affects the ffmpeg CLI only and not the
> API itself, of course.
> 
>  libavcodec/bsf.c | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
> index 38b423101c..25f7a20ad6 100644
> --- a/libavcodec/bsf.c
> +++ b/libavcodec/bsf.c
> @@ -188,7 +188,15 @@ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
>  ctx->internal->buffer_pkt->side_data_elems)
>  return AVERROR(EAGAIN);
>  
> -av_packet_move_ref(ctx->internal->buffer_pkt, pkt);
> +if (pkt->buf)
> +av_packet_move_ref(ctx->internal->buffer_pkt, pkt);
> +else {
> +int ret = av_packet_ref(ctx->internal->buffer_pkt, pkt);
> +
> +if (ret < 0)
> +return ret;
> +av_packet_unref(pkt);
> +}
>  
>  return 0;
>  }

Fine, but we should probably really provide an API function that
ensures that a packet is refcounted (and made refcounting if it isn't).
av_dup_packet() does this, but it's deprecated and has a bad name.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] hlsenc: set target duration always exact or longer than max segment duration

2018-03-23 Thread Jan Ekström
From: Jan Ekström 

Follows the RFC with floating point durations.
F.ex., 5.005 => 6

Signed-off-by: Jan Ekström 
---
 libavformat/hlsenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 07569dbff1..ecb581acb9 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1386,7 +1386,8 @@ static int hls_window(AVFormatContext *s, int last, 
VariantStream *vs)
 
 for (en = vs->segments; en; en = en->next) {
 if (target_duration <= en->duration)
-target_duration = lrint(en->duration);
+/* Target duration has to always be exactly or longer than any 
segment */
+target_duration = ceil(en->duration);
 }
 
 vs->discontinuity_set = 0;
-- 
2.14.3

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


[FFmpeg-devel] [PATCH 1/2] hlsenc: use stream's maximum bit rate as fall-back advertised rate

2018-03-23 Thread Jan Ekström
From: Jan Ekström 

Enables having proper bit rate values being written into the master
playlist in case of hard-constrained VBR where the maximum bit
rate utilized is known before hand.

Does the same thing as movenc.c, for example.

Signed-off-by: Jan Ekström 
---
 libavformat/hlsenc.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index b7c6fbde6a..07569dbff1 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1174,6 +1174,17 @@ static int get_relative_url(const char *master_url, 
const char *media_url,
 return 0;
 }
 
+static int64_t get_stream_bit_rate(AVStream *stream) {
+AVCPBProperties *props = (AVCPBProperties*)av_stream_get_side_data(stream, 
AV_PKT_DATA_CPB_PROPERTIES, NULL);
+
+if (stream->codecpar->bit_rate)
+return stream->codecpar->bit_rate;
+else if (props)
+return props->max_bitrate;
+
+return 0;
+}
+
 static int create_master_playlist(AVFormatContext *s,
   VariantStream * const input_vs)
 {
@@ -1300,9 +1311,9 @@ static int create_master_playlist(AVFormatContext *s,
 
 bandwidth = 0;
 if (vid_st)
-bandwidth += vid_st->codecpar->bit_rate;
+bandwidth += get_stream_bit_rate(vid_st);
 if (aud_st)
-bandwidth += aud_st->codecpar->bit_rate;
+bandwidth += get_stream_bit_rate(aud_st);
 bandwidth += bandwidth / 10;
 
 ccgroup = NULL;
-- 
2.14.3

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


Re: [FFmpeg-devel] [PATCH] avcodec/bsf: make sure the AVBSFInternal stored packet is reference counted

2018-03-23 Thread Paul B Mahol
On 3/23/18, James Almer  wrote:
> Some bitstream filters may buffer said packet in their own contexts
> for latter use.
> The documentation for av_bsf_send_packet() doesn't forbid feeding
> it non-reference counted packets, which depending on the way said
> packets were internally buffered by the bsf it may result in the
> data described in them to become invalid or unavailable at any time.
>
> This was the case with vp9_superframe after commit e1bc3f4396, which
> was then promptly fixed in 37f4a093f7 and 7a02b364b6. It is still the
> case even today with vp9_reorder_raw.
>
> With this change the bitstream filters will not have to worry how to
> store or consume the packets fed to them.
>
> Signed-off-by: James Almer 
> ---
> Regarding vp9_raw_reorder, see "[PATCH] avcodec/vp9_raw_reorder: cache
> input packets using new references" for a local fix similar to what
> vp9_superframe got with 37f4a093f7 and 7a02b364b6.
>
> A simple reproducer if you're curious is:
>
> ffmpeg -i INPUT -c:v copy -bsf:v vp9_raw_reorder -f null -
>
> Which segfauls with current git master.
>
> "[PATCH 2/2] ffmpeg: pass reference counted packets on codec copy
> when possible" also works around this in most cases by doing what its
> subject describes, but only affects the ffmpeg CLI only and not the
> API itself, of course.
>
>  libavcodec/bsf.c | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
> index 38b423101c..25f7a20ad6 100644
> --- a/libavcodec/bsf.c
> +++ b/libavcodec/bsf.c
> @@ -188,7 +188,15 @@ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket
> *pkt)
>  ctx->internal->buffer_pkt->side_data_elems)
>  return AVERROR(EAGAIN);
>
> -av_packet_move_ref(ctx->internal->buffer_pkt, pkt);
> +if (pkt->buf)

Use { } here and below.

> +av_packet_move_ref(ctx->internal->buffer_pkt, pkt);
> +else {
> +int ret = av_packet_ref(ctx->internal->buffer_pkt, pkt);
> +
> +if (ret < 0)
> +return ret;
> +av_packet_unref(pkt);
> +}
>
>  return 0;
>  }
> --
> 2.16.2
>
> ___
> 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] avcodec/bsf: make sure the AVBSFInternal stored packet is reference counted

2018-03-23 Thread James Almer
Some bitstream filters may buffer said packet in their own contexts
for latter use.
The documentation for av_bsf_send_packet() doesn't forbid feeding
it non-reference counted packets, which depending on the way said
packets were internally buffered by the bsf it may result in the
data described in them to become invalid or unavailable at any time.

This was the case with vp9_superframe after commit e1bc3f4396, which
was then promptly fixed in 37f4a093f7 and 7a02b364b6. It is still the
case even today with vp9_reorder_raw.

With this change the bitstream filters will not have to worry how to
store or consume the packets fed to them.

Signed-off-by: James Almer 
---
Regarding vp9_raw_reorder, see "[PATCH] avcodec/vp9_raw_reorder: cache
input packets using new references" for a local fix similar to what
vp9_superframe got with 37f4a093f7 and 7a02b364b6.

A simple reproducer if you're curious is:

ffmpeg -i INPUT -c:v copy -bsf:v vp9_raw_reorder -f null -

Which segfauls with current git master.

"[PATCH 2/2] ffmpeg: pass reference counted packets on codec copy
when possible" also works around this in most cases by doing what its
subject describes, but only affects the ffmpeg CLI only and not the
API itself, of course.

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

diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
index 38b423101c..25f7a20ad6 100644
--- a/libavcodec/bsf.c
+++ b/libavcodec/bsf.c
@@ -188,7 +188,15 @@ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
 ctx->internal->buffer_pkt->side_data_elems)
 return AVERROR(EAGAIN);
 
-av_packet_move_ref(ctx->internal->buffer_pkt, pkt);
+if (pkt->buf)
+av_packet_move_ref(ctx->internal->buffer_pkt, pkt);
+else {
+int ret = av_packet_ref(ctx->internal->buffer_pkt, pkt);
+
+if (ret < 0)
+return ret;
+av_packet_unref(pkt);
+}
 
 return 0;
 }
-- 
2.16.2

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


Re: [FFmpeg-devel] Reimbursement request

2018-03-23 Thread Thilo Borgmann
Am 18.03.18 um 20:57 schrieb Thilo Borgmann:
> Hi,
> 
>> As already discussed, FFmpeg was present on Chemnitzer Linux Tage, in
>> addition, Thilo and I went to Brussels for FOSDEM where we attended
>> the talks in the multimedia room kindly (co-) organized by Kieran and
>> answered some questions. I would like to request reimbursement for the
>> travel costs, that's flights-only, Thilo payed the gasoline and the
>> hotel.
> 
> from my side there are hotel & gas for Chemnitz, and flight & hotel for 
> Brussels that I'd like to ask to reimburse for. For Chemnitz it is the usual 
> drive by car Carl Eugen and me do from Berlin, which are around 290 km one 
> way as well as a shared hotel room (they did not manage to put all of us into 
> one suite this time, so we had to stick to two rooms for all four of us):
> 
>> Chemnitz: 125,85
> 
> Hotel: 194.00 EUR
> Gas:   36.62 + 21.67 + 39.51 =  97.80 EUR
> -
> Total: 291,80 EUR
> 
> 
>> Brussels: 192,41
> 
> Flight:111.81 EUR
> Hotel: 186.69 EUR
> -
> Total: 298,50 EUR
> 
> 
> BTW, on both events some of our T-Shirts have found their way to some users, 
> forgot to mention this in the CLT report. Also, we ran out of stock of our 
> stickers during CLT, so I will order new ones asap. I also forgot to mention 
> that we have met the organizers of a similar event in Prague in October 
> (LinuxDays) [1]. I'll try to have us there with a booth, too!
> 
> Also, regarding FOSDEM, I'd really like to have a booth there from next year 
> on. In contrast to Chemnitz (and possibly Prague), Brussels is an expensive 
> place in general though I could get an AirBNB near the price of an actual 
> hotel in Chemnitz. FOSDEM of course is the biggest event with a bigger 
> audience of technical knowledge in our field, so we really should consider a 
> booth at FOSDEM, IMHO. (However this is almost a year in the future)
> 
> If there are no objections, I'll send all the invoices to Stefano privately 
> (like I almost always do...;)

[1] https://www.linuxdays.cz/2018/en/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/get_bits: Document skip_bits_long()

2018-03-23 Thread Thilo Borgmann
Am 23.03.18 um 20:20 schrieb Michael Niedermayer:
> Found-by: Kieran
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/get_bits.h | 7 +++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
> index 0c7f5ff0c6..3ec45e7ab6 100644
> --- a/libavcodec/get_bits.h
> +++ b/libavcodec/get_bits.h
> @@ -201,6 +201,13 @@ static inline int get_bits_count(const GetBitContext *s)
>  return s->index;
>  }
>  
> +/**
> + * Skips the specified number of bits.
> + * @param n the number of bits to skip,
> + *  For the UNCHECKED_BITSTREAM_READER this must not cause the 
> distance
> + *  from the start to overflow int32_t. Staying within the bitstream 
> + padding
> + *  is sufficient too.
  ^^
Shouldn't this be "required" or "necessary"?
And nit: "something, too."


-Thilo

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


[FFmpeg-devel] [PATCH 4/5] lavd: remove linked lists

2018-03-23 Thread Josh de Kock
---
 configure| 23 +++--
 libavdevice/alldevices.c | 87 ++--
 libavformat/allformats.c | 78 +--
 libavformat/avformat.h   |  2 ++
 4 files changed, 120 insertions(+), 70 deletions(-)

diff --git a/configure b/configure
index 0bb789cae4..3a99f46c87 100755
--- a/configure
+++ b/configure
@@ -3561,21 +3561,12 @@ for v in "$@"; do
 FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
 done
 
-find_things(){
-thing=$1
-pattern=$2
-file=$source_path/$3
-sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" 
"$file"
-}
-
-OUTDEV_LIST=$(find_things   outdev   OUTDEV   libavdevice/alldevices.c)
-INDEV_LIST=$(find_thingsindev_IN  libavdevice/alldevices.c)
-
 find_things_extern(){
 thing=$1
 pattern=$2
 file=$source_path/$3
-sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$thing/p" "$file"
+out=${4:-$thing}
+sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$out/p" "$file"
 }
 
 find_filters_extern(){
@@ -3585,6 +3576,8 @@ find_filters_extern(){
 }
 
 FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c)
+OUTDEV_LIST=$(find_things_extern muxer AVOutputFormat libavdevice/alldevices.c 
outdev)
+INDEV_LIST=$(find_things_extern demuxer AVInputFormat libavdevice/alldevices.c 
indev)
 MUXER_LIST=$(find_things_extern muxer AVOutputFormat libavformat/allformats.c)
 DEMUXER_LIST=$(find_things_extern demuxer AVInputFormat 
libavformat/allformats.c)
 ENCODER_LIST=$(find_things_extern encoder AVCodec libavcodec/allcodecs.c)
@@ -7110,6 +7103,12 @@ print_enabled_components(){
 filter_list)
 c=$(full_filter_name $(remove_suffix _filter $c))
 ;;
+indev_list)
+c=$(add_suffix _demuxer $(remove_suffix _indev $c))
+;;
+outdev_list)
+c=$(add_suffix _muxer $(remove_suffix _outdev $c))
+;;
 esac
 printf "&ff_%s,\n" $c >> $TMPH
 fi
@@ -7124,6 +7123,8 @@ print_enabled_components libavcodec/parser_list.c 
AVCodecParser parser_list $PAR
 print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter 
bitstream_filters $BSF_LIST
 print_enabled_components libavformat/demuxer_list.c AVInputFormat demuxer_list 
$DEMUXER_LIST
 print_enabled_components libavformat/muxer_list.c AVOutputFormat muxer_list 
$MUXER_LIST
+print_enabled_components libavdevice/indev_list.c AVInputFormat indev_list 
$INDEV_LIST
+print_enabled_components libavdevice/outdev_list.c AVOutputFormat outdev_list 
$OUTDEV_LIST
 print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols 
$PROTOCOL_LIST
 
 # Settings for pkg-config files
diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c
index b767b6a718..ebf95f8a81 100644
--- a/libavdevice/alldevices.c
+++ b/libavdevice/alldevices.c
@@ -22,57 +22,48 @@
 #include "libavutil/thread.h"
 #include "avdevice.h"
 
-#define REGISTER_OUTDEV(X, x)   \
-{   \
-extern AVOutputFormat ff_##x##_muxer;   \
-if (CONFIG_##X##_OUTDEV)\
-av_register_output_format(&ff_##x##_muxer); \
-}
+/* devices */
+extern AVInputFormat  ff_alsa_demuxer;
+extern AVOutputFormat ff_alsa_muxer;
+extern AVInputFormat  ff_android_camera_demuxer;
+extern AVInputFormat  ff_avfoundation_demuxer;
+extern AVInputFormat  ff_bktr_demuxer;
+extern AVOutputFormat ff_caca_muxer;
+extern AVInputFormat  ff_decklink_demuxer;
+extern AVOutputFormat ff_decklink_muxer;
+extern AVInputFormat  ff_libndi_newtek_demuxer;
+extern AVOutputFormat ff_libndi_newtek_muxer;
+extern AVInputFormat  ff_dshow_demuxer;
+extern AVInputFormat  ff_fbdev_demuxer;
+extern AVOutputFormat ff_fbdev_muxer;
+extern AVInputFormat  ff_gdigrab_demuxer;
+extern AVInputFormat  ff_iec61883_demuxer;
+extern AVInputFormat  ff_jack_demuxer;
+extern AVInputFormat  ff_kmsgrab_demuxer;
+extern AVInputFormat  ff_lavfi_demuxer;
+extern AVInputFormat  ff_openal_demuxer;
+extern AVOutputFormat ff_opengl_muxer;
+extern AVInputFormat  ff_oss_demuxer;
+extern AVOutputFormat ff_oss_muxer;
+extern AVInputFormat  ff_pulse_demuxer;
+extern AVOutputFormat ff_pulse_muxer;
+extern AVOutputFormat ff_sdl2_muxer;
+extern AVInputFormat  ff_sndio_demuxer;
+extern AVOutputFormat ff_sndio_muxer;
+extern AVInputFormat  ff_v4l2_demuxer;
+extern AVOutputFormat ff_v4l2_muxer;
+extern AVInputFormat  ff_vfwcap_demuxer;
+extern AVInputFormat  ff_xcbgrab_demuxer;
+extern AVOutputFormat ff_xv_muxer;
 
-#define REGISTER_INDEV(X, x)\
-{   \
-extern AVInputFormat ff_##x##_demuxer; 

[FFmpeg-devel] [PATCH 3/5] Revert "lavd: add new API for iterating input and output devices"

2018-03-23 Thread Josh de Kock
This reverts commit 0fd475704e871ef3a535947596a012894bae3cbd.

Revert "lavd: fix iterating of input and output devices"

This reverts commit ce1d77a5e7cebce11074bf6f9e38ad6da37338ff.
---
 Makefile |   3 +-
 configure|  23 +++---
 doc/APIchanges   |   5 --
 libavdevice/.gitignore   |   2 -
 libavdevice/alldevices.c | 179 ---
 libavdevice/avdevice.c   |  46 
 libavdevice/avdevice.h   |  28 
 libavdevice/version.h|   4 --
 libavformat/allformats.c |  42 +--
 libavformat/format.c |   8 ---
 libavformat/internal.h   |   7 --
 11 files changed, 103 insertions(+), 244 deletions(-)
 delete mode 100644 libavdevice/.gitignore

diff --git a/Makefile b/Makefile
index bb93b69f89..0cd0a1d6f2 100644
--- a/Makefile
+++ b/Makefile
@@ -144,8 +144,7 @@ distclean:: clean
version.h libavutil/ffversion.h libavcodec/codec_names.h \
libavcodec/bsf_list.c libavformat/protocol_list.c \
libavcodec/codec_list.c libavcodec/parser_list.c \
-   libavformat/muxer_list.c libavformat/demuxer_list.c \
-   libavdevice/indev_list.c libavdevice/outdev_list.c
+   libavformat/muxer_list.c libavformat/demuxer_list.c
 ifeq ($(SRC_LINK),src)
$(RM) src
 endif
diff --git a/configure b/configure
index 2dedee79c2..0bb789cae4 100755
--- a/configure
+++ b/configure
@@ -3561,12 +3561,21 @@ for v in "$@"; do
 FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
 done
 
+find_things(){
+thing=$1
+pattern=$2
+file=$source_path/$3
+sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" 
"$file"
+}
+
+OUTDEV_LIST=$(find_things   outdev   OUTDEV   libavdevice/alldevices.c)
+INDEV_LIST=$(find_thingsindev_IN  libavdevice/alldevices.c)
+
 find_things_extern(){
 thing=$1
 pattern=$2
 file=$source_path/$3
-out=${4:-$thing}
-sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$out/p" "$file"
+sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$thing/p" "$file"
 }
 
 find_filters_extern(){
@@ -3576,8 +3585,6 @@ find_filters_extern(){
 }
 
 FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c)
-OUTDEV_LIST=$(find_things_extern muxer AVOutputFormat libavdevice/alldevices.c 
outdev)
-INDEV_LIST=$(find_things_extern demuxer AVInputFormat libavdevice/alldevices.c 
indev)
 MUXER_LIST=$(find_things_extern muxer AVOutputFormat libavformat/allformats.c)
 DEMUXER_LIST=$(find_things_extern demuxer AVInputFormat 
libavformat/allformats.c)
 ENCODER_LIST=$(find_things_extern encoder AVCodec libavcodec/allcodecs.c)
@@ -7103,12 +7110,6 @@ print_enabled_components(){
 filter_list)
 c=$(full_filter_name $(remove_suffix _filter $c))
 ;;
-indev_list)
-c=$(add_suffix _demuxer $(remove_suffix _indev $c))
-;;
-outdev_list)
-c=$(add_suffix _muxer $(remove_suffix _outdev $c))
-;;
 esac
 printf "&ff_%s,\n" $c >> $TMPH
 fi
@@ -7121,8 +7122,6 @@ print_enabled_components libavfilter/filter_list.c 
AVFilter filter_list $FILTER_
 print_enabled_components libavcodec/codec_list.c AVCodec codec_list $CODEC_LIST
 print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list 
$PARSER_LIST
 print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter 
bitstream_filters $BSF_LIST
-print_enabled_components libavdevice/indev_list.c AVInputFormat indev_list 
$INDEV_LIST
-print_enabled_components libavdevice/outdev_list.c AVOutputFormat outdev_list 
$OUTDEV_LIST
 print_enabled_components libavformat/demuxer_list.c AVInputFormat demuxer_list 
$DEMUXER_LIST
 print_enabled_components libavformat/muxer_list.c AVOutputFormat muxer_list 
$MUXER_LIST
 print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols 
$PROTOCOL_LIST
diff --git a/doc/APIchanges b/doc/APIchanges
index 4052988f59..8078f028d3 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -49,11 +49,6 @@ API changes, most recent first:
 2018-02-xx - xxx - lavc 58.11.100 - avcodec.h
   Add AVCodecContext.extra_hw_frames.
 
-2018-02-06 - 0fd475704e - lavd 58.1.100 - avdevice.h
-  Deprecate use of av_input_audio_device_next(), av_input_video_device_next(),
-  av_output_audio_device_next(), av_output_video_device_next().
-  Add av_indev_iterate(), and av_outdev_iterate().
-
 2018-xx-xx - xxx - lavf 58.9.100 - avformat.h
   Deprecate use of av_register_input_format(), av_register_output_format(),
   av_register_all(), av_iformat_next(), av_oformat_next().
diff --git a/libavdevice/.gitignore b/libavdevice/.gitignore
deleted file mode 100644
index 08ac3eb86a..00
--- a/libavdevice/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/indev_list.c
-/outdev_list.c
diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c
index 3

[FFmpeg-devel] [PATCH 5/5] cmdutils: use new APIs

2018-03-23 Thread Josh de Kock
---
 fftools/cmdutils.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index c0ddf0b287..a6cf002fd0 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -1259,8 +1259,10 @@ static int is_device(const AVClass *avclass)
 
 static int show_formats_devices(void *optctx, const char *opt, const char 
*arg, int device_only, int muxdemuxers)
 {
-AVInputFormat *ifmt  = NULL;
-AVOutputFormat *ofmt = NULL;
+void *ifmt_opaque = NULL;
+const AVInputFormat *ifmt  = NULL;
+void *ofmt_opaque = NULL;
+const AVOutputFormat *ofmt = NULL;
 const char *last_name;
 int is_dev;
 
@@ -1276,7 +1278,8 @@ static int show_formats_devices(void *optctx, const char 
*opt, const char *arg,
 const char *long_name = NULL;
 
 if (muxdemuxers !=SHOW_DEMUXERS) {
-while ((ofmt = av_oformat_next(ofmt))) {
+ifmt_opaque = NULL;
+while ((ofmt = av_muxer_iterate(&ofmt_opaque))) {
 is_dev = is_device(ofmt->priv_class);
 if (!is_dev && device_only)
 continue;
@@ -1289,7 +1292,8 @@ static int show_formats_devices(void *optctx, const char 
*opt, const char *arg,
 }
 }
 if (muxdemuxers != SHOW_MUXERS) {
-while ((ifmt = av_iformat_next(ifmt))) {
+ofmt_opaque = NULL;
+while ((ifmt = av_demuxer_iterate(&ifmt_opaque))) {
 is_dev = is_device(ifmt->priv_class);
 if (!is_dev && device_only)
 continue;
@@ -1629,6 +1633,7 @@ int show_filters(void *optctx, const char *opt, const 
char *arg)
 #if CONFIG_AVFILTER
 const AVFilter *filter = NULL;
 char descr[64], *descr_cur;
+void *opaque = NULL;
 int i, j;
 const AVFilterPad *pad;
 
@@ -1640,7 +1645,7 @@ int show_filters(void *optctx, const char *opt, const 
char *arg)
"  V = Video input/output\n"
"  N = Dynamic number and/or type of input/output\n"
"  | = Source or sink filter\n");
-while ((filter = avfilter_next(filter))) {
+while ((filter = av_filter_iterate(&opaque))) {
 descr_cur = descr;
 for (i = 0; i < 2; i++) {
 if (i) {
-- 
2.14.3 (Apple Git-98)

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


[FFmpeg-devel] [PATCH 1/5] checkasm/Makefile: add EXTRALIBS-libavformat

2018-03-23 Thread Josh de Kock
---
 tests/checkasm/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index 0520e264e2..ae7e810d25 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -61,7 +61,7 @@ tests/checkasm/checkasm.o: CFLAGS += -Umain
 CHECKASM := tests/checkasm/checkasm$(EXESUF)
 
 $(CHECKASM): $(CHECKASMOBJS) $(FF_STATIC_DEP_LIBS)
-   $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(CHECKASMOBJS) 
$(FF_STATIC_DEP_LIBS) $(EXTRALIBS-avcodec) $(EXTRALIBS-avfilter) 
$(EXTRALIBS-avutil) $(EXTRALIBS-swresample) $(EXTRALIBS)
+   $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(CHECKASMOBJS) 
$(FF_STATIC_DEP_LIBS) $(EXTRALIBS-avcodec) $(EXTRALIBS-avfilter) 
$(EXTRALIBS-avformat) $(EXTRALIBS-avutil) $(EXTRALIBS-swresample) $(EXTRALIBS)
 
 checkasm: $(CHECKASM)
 
-- 
2.14.3 (Apple Git-98)

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


[FFmpeg-devel] [PATCH 2/5] lavfi: add new iteration API

2018-03-23 Thread Josh de Kock
---
 configure|  24 +-
 doc/APIchanges   |   4 +
 doc/writing_filters.txt  |   6 +-
 libavfilter/allfilters.c | 820 +--
 libavfilter/avfilter.c   |  45 ---
 libavfilter/avfilter.h   |  29 +-
 libavfilter/version.h|   3 +
 7 files changed, 478 insertions(+), 453 deletions(-)

diff --git a/configure b/configure
index cc3edeb80f..2dedee79c2 100755
--- a/configure
+++ b/configure
@@ -3561,15 +3561,6 @@ for v in "$@"; do
 FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
 done
 
-find_things(){
-thing=$1
-pattern=$2
-file=$source_path/$3
-sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" 
"$file"
-}
-
-FILTER_LIST=$(find_things   filter   FILTER   libavfilter/allfilters.c)
-
 find_things_extern(){
 thing=$1
 pattern=$2
@@ -3578,6 +3569,13 @@ find_things_extern(){
 sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$out/p" "$file"
 }
 
+find_filters_extern(){
+file=$source_path/$1
+#sed -n "s/^extern AVFilter 
ff_\([avfsinkrc]\{2,5\}\)_\(\w\+\);/\2_filter/p" $file
+sed -E -n "s/^extern AVFilter 
ff_([avfsinkrc]{2,5})_([a-zA-Z0-9]+);/\2_filter/p" $file
+}
+
+FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c)
 OUTDEV_LIST=$(find_things_extern muxer AVOutputFormat libavdevice/alldevices.c 
outdev)
 INDEV_LIST=$(find_things_extern demuxer AVInputFormat libavdevice/alldevices.c 
indev)
 MUXER_LIST=$(find_things_extern muxer AVOutputFormat libavformat/allformats.c)
@@ -7088,6 +7086,10 @@ echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
 
 cp_if_changed $TMPH libavutil/avconfig.h
 
+full_filter_name(){
+sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_$1;/\1_$1/p" 
$source_path/libavfilter/allfilters.c
+}
+
 # generate the lists of enabled components
 print_enabled_components(){
 file=$1
@@ -7098,6 +7100,9 @@ print_enabled_components(){
 for c in $*; do
 if enabled $c; then
 case $name in
+filter_list)
+c=$(full_filter_name $(remove_suffix _filter $c))
+;;
 indev_list)
 c=$(add_suffix _demuxer $(remove_suffix _indev $c))
 ;;
@@ -7112,6 +7117,7 @@ print_enabled_components(){
 cp_if_changed $TMPH $file
 }
 
+print_enabled_components libavfilter/filter_list.c AVFilter filter_list 
$FILTER_LIST
 print_enabled_components libavcodec/codec_list.c AVCodec codec_list $CODEC_LIST
 print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list 
$PARSER_LIST
 print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter 
bitstream_filters $BSF_LIST
diff --git a/doc/APIchanges b/doc/APIchanges
index d410bcdd75..4052988f59 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
+2018-xx-xx - xxx - lavc 7.13.100 - avcodec.h
+  Deprecate use of avfilter_register(), avfilter_register_all(),
+  avfilter_next(). Add av_filter_iterate().
+
 2018-03-21 - xxx - lavc 58.15.100 - avcodec.h
   Add av_packet_make_writable().
 
diff --git a/doc/writing_filters.txt b/doc/writing_filters.txt
index 5cd4ecd6a4..98b9c6f3d2 100644
--- a/doc/writing_filters.txt
+++ b/doc/writing_filters.txt
@@ -31,10 +31,8 @@ If everything went right, you should get a foobar.png with 
Lena edge-detected.
 That's it, your new playground is ready.
 
 Some little details about what's going on:
-libavfilter/allfilters.c:avfilter_register_all() is called at runtime to create
-a list of the available filters, but it's important to know that this file is
-also parsed by the configure script, which in turn will define variables for
-the build system and the C:
+libavfilter/allfilters.c:this file is parsed by the configure script, which in 
turn
+will define variables for the build system and the C:
 
 --- after running configure ---
 
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 3f67e321bf..2c63f02a54 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -23,410 +23,452 @@
 #include "avfilter.h"
 #include "config.h"
 
+extern AVFilter ff_af_abench;
+extern AVFilter ff_af_acompressor;
+extern AVFilter ff_af_acontrast;
+extern AVFilter ff_af_acopy;
+extern AVFilter ff_af_acrossfade;
+extern AVFilter ff_af_acrusher;
+extern AVFilter ff_af_adelay;
+extern AVFilter ff_af_aecho;
+extern AVFilter ff_af_aemphasis;
+extern AVFilter ff_af_aeval;
+extern AVFilter ff_af_afade;
+extern AVFilter ff_af_afftfilt;
+extern AVFilter ff_af_afir;
+extern AVFilter ff_af_aformat;
+extern AVFilter ff_af_agate;
+extern AVFilter ff_af_aiir;
+extern AVFilter ff_af_ainterleave;
+extern AVFilter ff_af_alimiter;
+extern AVFilter ff_af_allpass;
+extern AVFilter ff_af_aloop;
+extern AVFilter ff_af_amerge;
+extern AVFilter ff_af_ametadata;
+extern AVFilter ff_af_amix;
+extern AVFilter ff_af_anequalizer;
+extern AVFilter ff_af_anull;
+extern AVFilter ff_af_apad;
+extern 

[FFmpeg-devel] [PATCH 0/5] Add lavfi api & remove device iteration

2018-03-23 Thread Josh de Kock
This set is an alternative to the previous set I posted, it makes
it so that the current behaviour is kept (devices are returned in
by the iteration functions but must be loaded in manually). It
is a compromise between what Nicolas George suggested and a full
rewrite.

I personally would like to just 'get this done', and I feel other
than completely rewriting the API from scratch (and the previous
set I posted), merging lavf and lavd is the only other option.

-- 
Josh

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


Re: [FFmpeg-devel] [PATCH] lavf/utils.c: Don't compute start_time from DISCARD packets for video.

2018-03-23 Thread Sasi Inguva
friendly ping

On Wed, Mar 21, 2018 at 2:55 PM, Michael Niedermayer 
wrote:

> On Wed, Mar 21, 2018 at 01:35:05PM -0700, Sasi Inguva wrote:
> > Attaching fate sample.
>
> sample uploded
>
> thx
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Take away the freedom of one citizen and you will be jailed, take away
> the freedom of all citizens and you will be congratulated by your peers
> in Parliament.
>
> ___
> 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 1/1] Add Sega FILM muxer

2018-03-23 Thread Michael Niedermayer
On Wed, Mar 21, 2018 at 10:46:31PM -0700, mi...@brew.sh wrote:
> From: Misty De Meo 
[...]

> +static int film_write_header(AVFormatContext *format_context)
> +{
> +int ret = 0;
> +int64_t stabstart_pos, sample_table_size, stabsize, headersize;
> +int8_t audio_codec;
> +AVIOContext *pb = format_context->pb;
> +FILMOutputContext *film = format_context->priv_data;
> +FILMPacket *prev, *packet;
> +AVStream *audio = NULL;
> +AVStream *video = NULL;
> +
> +/* Calculate how much we need to reserve for the header;
> + * this is the amount the rest of the data will be shifted up by. */
> +sample_table_size = film->packet_count * 16;
> +stabsize = 16 + sample_table_size;
> +headersize = 16 + // FILM header base
> + 32 + // FDSC chunk
> + stabsize;
> +
> +ret = shift_data(format_context, headersize);
> +if (ret < 0)
> +return ret;
> +// Seek back to the beginning to start writing the header now
> +avio_seek(pb, 0, SEEK_SET);
> +
> +if (film->audio_index > -1)
> +audio = format_context->streams[film->audio_index];
> +if (film->video_index > -1)
> +video = format_context->streams[film->video_index];
> +
> +if (audio != NULL) {
> +audio_codec = get_audio_codec_id(audio->codecpar->codec_id);
> +if (audio_codec < 0) {
> +av_log(format_context, AV_LOG_ERROR, "Incompatible audio stream 
> format.\n");
> +return AVERROR(EINVAL);
> +}
> +}
> +
> +// First, write the FILM header; this is very simple
> +
> +ffio_wfourcc(pb, "FILM");
> +avio_wb32(pb, 48 + stabsize);
> +/* This seems to be okay to hardcode, since this muxer targets 1.09 
> features;
> + * videos produced by this muxer are readable by 1.08 and lower players. 
> */
> +ffio_wfourcc(pb, "1.09");
> +// I have no idea what this field does, might be reserved
> +avio_wb32(pb, 0);
> +
> +// Next write the FDSC (file description) chunk
> +ffio_wfourcc(pb, "FDSC");
> +avio_wb32(pb, 0x20); // Size of FDSC chunk
> +// TODO stop hardcoding this if support for another codec is added
> +ffio_wfourcc(pb, "cvid");
> +avio_wb32(pb, video->codecpar->height);
> +avio_wb32(pb, video->codecpar->width);
> +avio_w8(pb, 24); // Bits per pixel - observed to always be 24
> +
> +if (audio != NULL) {
> +avio_w8(pb, audio->codecpar->channels); // Audio channels
> +avio_w8(pb, audio->codecpar->bits_per_coded_sample); // Audio bit 
> depth
> +avio_w8(pb, audio_codec); // Compression - 0 is PCM, 2 is ADX
> +avio_wb16(pb, audio->codecpar->sample_rate); // Audio sampling rate
> +} else {
> +// Set all these fields to 0 if there's no audio
> +avio_w8(pb, 0);
> +avio_w8(pb, 0);
> +avio_w8(pb, 0);
> +avio_wb16(pb, 0);
> +}
> +
> +// I have no idea what this pair of fields does either, might be reserved
> +avio_wb32(pb, 0);
> +avio_wb16(pb, 0);
> +

> +// Finally, write the STAB (sample table) chunk
> +stabstart_pos = avio_tell(pb);

this is set but never used


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

Take away the freedom of one citizen and you will be jailed, take away
the freedom of all citizens and you will be congratulated by your peers
in Parliament.


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


[FFmpeg-devel] [PATCH] avcodec/get_bits: Document skip_bits_long()

2018-03-23 Thread Michael Niedermayer
Found-by: Kieran
Signed-off-by: Michael Niedermayer 
---
 libavcodec/get_bits.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index 0c7f5ff0c6..3ec45e7ab6 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -201,6 +201,13 @@ static inline int get_bits_count(const GetBitContext *s)
 return s->index;
 }
 
+/**
+ * Skips the specified number of bits.
+ * @param n the number of bits to skip,
+ *  For the UNCHECKED_BITSTREAM_READER this must not cause the distance
+ *  from the start to overflow int32_t. Staying within the bitstream + 
padding
+ *  is sufficient too.
+ */
 static inline void skip_bits_long(GetBitContext *s, int n)
 {
 #if UNCHECKED_BITSTREAM_READER
-- 
2.16.2

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


Re: [FFmpeg-devel] [PATCH][GSoC] srcnn - an image super resolution filter using CNN

2018-03-23 Thread Pedro Arthur
Hi,

It seems git refuses to apply your patch.
Also as I already explained, you should multiply your bias by 255 as
the weights expect the input in the range [0,1].
Please, before sending the patch make sure it works as expected for all inputs.


2018-03-22 15:42 GMT-03:00 Mina :
> Hi,
>   This patch is introduced as a qualification task required by Super
> Resolution project for GSoC. It passes patchcheck and make fate and doesn't
> introduce new warnings. It's implemented by the help of the mentor: Pedro
> Arthur. It's been tested over 7 images of which 6 got expected results while
> 1 didn't.
> Used command for testing:
> ffmpeg -i input_image -vf "scale=2*iw:2*ih,format=yuv420p,srcnn"
> output_image.
If your output is a lossy format (like jpg) you should add the option
"-q:v 1" so that compression does not affect much image quality (for
comparison purpose).
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] Moving enum AVFieldOrder to libavutil?

2018-03-23 Thread Devin Heitmueller
Hello,

I am in the process of reworking libavfilter to pass along the field order 
across links.  For the moment I followed the model found in AVFrame where there 
are two int fields: “interlaced_frame” and “top_field_first”.  However it seems 
like it would be more appropriate to use the enum AVFieldOrder, which is a 
single field and provides more flexibility (including being able to be set to 
“unknown” if appropriate).

Does anyone have an objection to moving the definition of AVFieldOrder to 
libavutil, so it can be taken advantage of by libavfilter?  Right now it’s in 
libavcodec, and from what I understand libavfilter does not depend on 
libavcodec.

For what it’s worth, it looks like I’ve basically got it working - I’ve 
extended buffersrc/buffersink/AVFilterLink and ffmpeg, and I’m now able to 
propagate the interlaced state all the way from the H.264 decoder to the 
Decklink output during write_header(), and thus select the proper output 
format.  This includes it being preserved through any video filters that might 
be in the pipeline.  At this point it’s largely just a question of how to 
rework the patch to be as non-invasive as possible so it can be accepted 
upstream.

This approach could also be useful in the longer term for better automatic 
construction of pipelines - for example to be able to automatically insert a 
deinterlace filter if a downstream filter or encoder requires progressive video 
as input (similar to the way we automatically add the scaler for format 
conversion as needed).

Devin

---
Devin Heitmueller - LTN Global Communications
dheitmuel...@ltnglobal.com




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


Re: [FFmpeg-devel] [DISCUSSION] New iteration APIs, lavf and lavd

2018-03-23 Thread Nicolas George
Nicolas F. (2018-03-23):
> Thankfully, you are always involved in every long and drawn-out
> discussion, which is a very handy coincidence, so if someone has
> questions about the summary of the API changes, I believe it could be
> incredibly helpful if you already just went ahead and filled in
> everyone on those.

> I guess FFmpeg can never ever change the API again then. Pack it up
> folks.

> It has been months. This wasn't rushed. You either disagree with the
> design or with having the patch author contribute to FFmpeg, but
> either way, postponing this further isn't going to solve whatever
> issue you have with it.

The purely sarcastic contents of this message is not conductive of a
productive discussion. Was your intent to make progress or to poison
things further?

-- 
  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] libavfilter: Add OpenCL convolution filter v0.2

2018-03-23 Thread Mark Thompson
On 22/03/18 22:52, Danil Iashchenko wrote:
> Hi there!
> Thank you for advices, I have fixed the problem when per plane matrices
> application was incorrect. Now it works as expected and behaves like the 
> existing vf_convolution filter.
> 
> Tested for yuv and nv12 formats.
> The following filters from ffmpeg documentation
> (https://ffmpeg.org/ffmpeg-filters.html#Examples-43) work correctly:
> 
>  * sharpen
>  * blur
>  * edge enchance
>  * edge detect
>  * laplacian edge detector which includes diagonals
>  * emboss
>  * custom tests
> 
> I have two questions:
> 
> 1. Looks like existing convolution filter implementaion ignores
> 0rdiv and 0bias parameters for 0m='0 0 0 0 1 0 0 0 0' matrix,
> so results will be the same for following sample filter runs:
> 
> -vf convolution='0m=0 0 0 0 1 0 0 0 0:0rdiv=1:0bias=20'
> -vf convolution='0m=0 0 0 0 1 0 0 0 0:0rdiv=1/3:0bias=0'
> -vf convolution='0m=0 0 0 0 1 0 0 0 0:0rdiv=1/2:0bias=100'
> -vf convolution='0m=0 0 0 0 1 0 0 0 0:0rdiv=1/5:0bias=50'
> 
> and will not differ from
> 
> -vf convolution='0m=0 0 0 0 1 0 0 0 0:0rdiv=1:0bias=0'
> 
> My implementation does not ignore 0rdiv and 0bias parameters in case of m0='0 
> 0 0 0 1 0 0 0 0',
> and results will differ from the existing implementation so I do not know
> which one is correct: mine or exisiting.

Good question, I don't know.  I feel like your answer makes more sense, but 
it's a pretty degenerate use of the filter so maybe it doesn't matter?  Would 
anyone more familiar with this (Paul?) like to offer an opinion?

> 2. I have a local kernel (not included in this patch), but there is no
> significant speed difference comparing to global kernel. Shall I include
> it in the next patch?

Even with 7x7 matrices, which load every value many more times than 3x3?

How about making a two patch series, one without it and then a second patch on 
top of it adding the local kernel?  It would be useful to see it and I may be 
able to test on more devices, if it's not useful then we can just not apply the 
second patch.

Some more review comments below.

Thanks,

- Mark


> ---
>  configure   |   1 +
>  libavfilter/Makefile|   1 +
>  libavfilter/allfilters.c|   1 +
>  libavfilter/opencl/convolution.cl   |  40 
>  libavfilter/opencl_source.h |   1 +
>  libavfilter/vf_convolution_opencl.c | 365 
> 
>  6 files changed, 409 insertions(+)
>  create mode 100644 libavfilter/opencl/convolution.cl
>  create mode 100644 libavfilter/vf_convolution_opencl.c
> 
> diff --git a/configure b/configure
> index 6916b45..bf5c312 100755
> --- a/configure
> +++ b/configure
> @@ -3210,6 +3210,7 @@ blackframe_filter_deps="gpl"
>  boxblur_filter_deps="gpl"
>  bs2b_filter_deps="libbs2b"
>  colormatrix_filter_deps="gpl"
> +convolution_opencl_filter_deps="opencl"
>  convolve_filter_deps="avcodec"
>  convolve_filter_select="fft"
>  coreimage_filter_deps="coreimage appkit"
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 6a60836..d005934 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -156,6 +156,7 @@ OBJS-$(CONFIG_COLORLEVELS_FILTER)+= 
> vf_colorlevels.o
>  OBJS-$(CONFIG_COLORMATRIX_FILTER)+= vf_colormatrix.o
>  OBJS-$(CONFIG_COLORSPACE_FILTER) += vf_colorspace.o 
> colorspacedsp.o
>  OBJS-$(CONFIG_CONVOLUTION_FILTER)+= vf_convolution.o
> +OBJS-$(CONFIG_CONVOLUTION_OPENCL_FILTER) += vf_convolution_opencl.o 
> opencl.o opencl/convolution.o
>  OBJS-$(CONFIG_CONVOLVE_FILTER)   += vf_convolve.o framesync.o
>  OBJS-$(CONFIG_COPY_FILTER)   += vf_copy.o
>  OBJS-$(CONFIG_COREIMAGE_FILTER)  += vf_coreimage.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index 9adb109..f2dc55e 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -166,6 +166,7 @@ static void register_all(void)
>  REGISTER_FILTER(COLORMATRIX,colormatrix,vf);
>  REGISTER_FILTER(COLORSPACE, colorspace, vf);
>  REGISTER_FILTER(CONVOLUTION,convolution,vf);
> +REGISTER_FILTER(CONVOLUTION_OPENCL, convolution_opencl, vf);
>  REGISTER_FILTER(CONVOLVE,   convolve,   vf);
>  REGISTER_FILTER(COPY,   copy,   vf);
>  REGISTER_FILTER(COREIMAGE,  coreimage,  vf);
> diff --git a/libavfilter/opencl/convolution.cl 
> b/libavfilter/opencl/convolution.cl
> new file mode 100644
> index 000..aa1db97
> --- /dev/null
> +++ b/libavfilter/opencl/convolution.cl
> @@ -0,0 +1,40 @@
> +/*
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be usefu

Re: [FFmpeg-devel] [PATCH 01/11] avformat/dashenc: renamed 'min_seg_duration' to 'seg_duration'

2018-03-23 Thread Aurelien Jacobs
On Fri, Mar 23, 2018 at 02:32:30PM +0800, Steven Liu wrote:
> 
> 
> > On 23 Mar 2018, at 13:20, vdi...@akamai.com wrote:
> > 
> > From: Vishwanath Dixit 
> > 
> > ---
> > doc/muxers.texi   |  2 +-
> > libavformat/dashenc.c | 10 +-
> > 2 files changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/doc/muxers.texi b/doc/muxers.texi
> > index cb75c26..65eec92 100644
> > --- a/doc/muxers.texi
> > +++ b/doc/muxers.texi
> > @@ -225,7 +225,7 @@ ffmpeg -re -i  -map 0 -map 0 -c:a libfdk_aac 
> > -c:v libx264
> > @end example
> > 
> > @table @option
> > -@item -min_seg_duration @var{microseconds}
> > +@item -seg_duration @var{microseconds}
> > Set the segment length in microseconds.
> > @item -window_size @var{size}
> > Set the maximum number of segments kept in the manifest.
> > diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> > index bdf8c8d..bdd5b56 100644
> > --- a/libavformat/dashenc.c
> > +++ b/libavformat/dashenc.c
> > @@ -94,7 +94,7 @@ typedef struct DASHContext {
> > int nb_as;
> > int window_size;
> > int extra_window_size;
> > -int min_seg_duration;
> > +int seg_duration;
> > int remove_at_exit;
> > int use_template;
> > int use_timeline;
> > @@ -974,7 +974,7 @@ static int dash_init(AVFormatContext *s)
> > else
> > av_dict_set(&opts, "movflags", 
> > "frag_custom+dash+delay_moov", 0);
> > } else {
> > -av_dict_set_int(&opts, "cluster_time_limit", 
> > c->min_seg_duration / 1000, 0);
> > +av_dict_set_int(&opts, "cluster_time_limit", c->seg_duration / 
> > 1000, 0);
> > av_dict_set_int(&opts, "cluster_size_limit", 5 * 1024 * 1024, 
> > 0); // set a large cluster size limit
> > av_dict_set_int(&opts, "dash", 1, 0);
> > av_dict_set_int(&opts, "dash_track_number", i + 1, 0);
> > @@ -1020,7 +1020,7 @@ static int dash_init(AVFormatContext *s)
> > os->segment_index = 1;
> > }
> > 
> > -if (!c->has_video && c->min_seg_duration <= 0) {
> > +if (!c->has_video && c->seg_duration <= 0) {
> > av_log(s, AV_LOG_WARNING, "no video stream and no min seg duration 
> > set\n");
> > return AVERROR(EINVAL);
> > }
> > @@ -1287,7 +1287,7 @@ static int dash_write_packet(AVFormatContext *s, 
> > AVPacket *pkt)
> > if ((!c->has_video || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) &&
> > pkt->flags & AV_PKT_FLAG_KEY && os->packets_written &&
> > av_compare_ts(pkt->pts - os->start_pts, st->time_base,
> > -  c->min_seg_duration, AV_TIME_BASE_Q) >= 0) {
> > +  c->seg_duration, AV_TIME_BASE_Q) >= 0) {
> > int64_t prev_duration = c->last_duration;
> > 
> > c->last_duration = av_rescale_q(pkt->pts - os->start_pts,
> > @@ -1427,7 +1427,7 @@ static const AVOption options[] = {
> > { "adaptation_sets", "Adaptation sets. Syntax: id=0,streams=0,1,2 
> > id=1,streams=3,4 and so on", OFFSET(adaptation_sets), AV_OPT_TYPE_STRING, { 
> > 0 }, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
> > { "window_size", "number of segments kept in the manifest", 
> > OFFSET(window_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, E },
> > { "extra_window_size", "number of segments kept outside of the manifest 
> > before removing from disk", OFFSET(extra_window_size), AV_OPT_TYPE_INT, { 
> > .i64 = 5 }, 0, INT_MAX, E },
> > -{ "min_seg_duration", "minimum segment duration (in microseconds)", 
> > OFFSET(min_seg_duration), AV_OPT_TYPE_INT, { .i64 = 500 }, 0, INT_MAX, 
> > E },
> > +{ "seg_duration", "minimum segment duration (in microseconds)", 
> > OFFSET(seg_duration), AV_OPT_TYPE_INT, { .i64 = 500 }, 0, INT_MAX, E },
> 
> No, you can make the min_seg_duration deprecated, leave a warning message, 
> update the info into the document, and add set_duration here, bump the 
> version.
> So that can give the user some time to change the options from 
> min_seg_duration to seg_duration.

This is probably also a good oportunity to change seg_duration to
AV_OPT_TYPE_DURATION.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add hrtfm filter

2018-03-23 Thread Aurelien Jacobs
On Fri, Mar 23, 2018 at 10:18:47AM +0100, Paul B Mahol wrote:
> On 3/22/18, Aurelien Jacobs  wrote:
> > On Mon, Mar 19, 2018 at 10:49:28PM -0800, Lou Logan wrote:
> >> On Fri, Mar 16, 2018, at 11:44 AM, Paul B Mahol wrote:
> >> > Signed-off-by: Paul B Mahol 
> >> > ---
> >> >  doc/filters.texi |  60 ++
> >> >  libavfilter/Makefile |   1 +
> >> >  libavfilter/af_hrtfm.c   | 486
> >> >  +++>
> >> > libavfilter/allfilters.c |   1 +
> >> >  4 files changed, 548 insertions(+)
> >> >  create mode 100644 libavfilter/af_hrtfm.c
> >> >
> >> > diff --git a/doc/filters.texi b/doc/filters.texi
> >> > index bd43a7ac6e..c298054325 100644
> >> > --- a/doc/filters.texi
> >> > +++ b/doc/filters.texi
> >> > @@ -3218,6 +3218,66 @@ Change highpass width.
> >> >  Syntax for the command is : "@var{width}"
> >> >  @end table
> >> >
> >> > +@section hrtfm
> >> > +
> >> > +Apply simple Head Related Transfer Function Model to audio stream.
> >> > +
> >> > +hrtfm filter creates virtual loudspeakers around the user for
> >> > binaural> +listening via headphones (audio formats up to 9 channels
> >> > supported).> +
> >> > +This is very simple implementation which does not use any HRIRs.
> >> > +
> >> > +It accepts the following parameters:
> >> > +
> >> > +@table @option
> >> > +@item hradius
> >>
> >> You didn't like the head_radius option name suggestion?
> >>
> >> > +Set head radius of listener. In meters. Default value is
> >> > @code{0.0891}.
> >> Why meters instead of cm?
> >
> > Because if you want to specify centimeters, you can use the option
> > like this: -hradius 8.91c
> 
> Shouldn't it be 8.91cm?

Ideally it should yes.
But currently the option system does not support units. It would be
great to specify that this option is representing a length so that the
parser could validate the unit and take it into account.
But for now, options are unit-less numbers.
You can't use "-bitrate 128kb/s", but you are instead limited to
"-bitrate 128k" without specifying unit. Same for hradius for which
you can use 8.91c but not 8.91cm.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] libavfilter: Add OpenCL convolution filter v0.2: add name

2018-03-23 Thread Danil Iashchenko
Thanks, fixed!

---
 libavfilter/opencl/convolution.cl   | 2 ++
 libavfilter/vf_convolution_opencl.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/libavfilter/opencl/convolution.cl 
b/libavfilter/opencl/convolution.cl
index aa1db97..c0748cc 100644
--- a/libavfilter/opencl/convolution.cl
+++ b/libavfilter/opencl/convolution.cl
@@ -1,4 +1,6 @@
 /*
+ * Copyright (c) 2018 Danil Iashchenko
+ *
  * This file is part of FFmpeg.
  *
  * FFmpeg is free software; you can redistribute it and/or
diff --git a/libavfilter/vf_convolution_opencl.c 
b/libavfilter/vf_convolution_opencl.c
index b788033..e6b5438 100644
--- a/libavfilter/vf_convolution_opencl.c
+++ b/libavfilter/vf_convolution_opencl.c
@@ -1,4 +1,6 @@
 /*
+ * Copyright (c) 2018 Danil Iashchenko
+ *
  * This file is part of FFmpeg.
  *
  * FFmpeg is free software; you can redistribute it and/or
-- 
2.7.4

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


Re: [FFmpeg-devel] [DISCUSSION] New iteration APIs, lavf and lavd

2018-03-23 Thread Nicolas F.
Nicolas George
>Your summary of the API changes is not detailed enough for somebody who
>was not involved in the previous discussions. Please be more detailed
>and start from scratch.

Thankfully, you are always involved in every long and drawn-out discussion, 
which is a very handy coincidence, so if someone has questions about the 
summary of the API changes, I believe it could be incredibly helpful if you 
already just went ahead and filled in everyone on those.

>If your proposal breaks that, if your proposal requires changes to
>applications in order to allow them to uses devices in place of
>(de)muxers, then it is not acceptable.

I guess FFmpeg can never ever change the API again then. Pack it up folks.

>Option 5: revert the new API as is for now, design it better, not
>rushing things and learning from the mistakes made on this one.

It has been months. This wasn't rushed. You either disagree with the design or 
with having the patch author contribute to FFmpeg, but either way, postponing 
this further isn't going to solve whatever issue you have with it.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Type mismatch in ADPCM

2018-03-23 Thread Carl Eugen Hoyos
2018-03-23 12:35 GMT+01:00, Carlo Bramini :
> Hello everyone,
>
>> Il 11 marzo 2018 alle 11.42 Carl Eugen Hoyos  ha
>> scritto:
>>
>> 2018-03-11 11:27 GMT+01:00 Carlo Bramini :
>>
>> > Hello,
>> > I see. I expected that adding that could be considered out of the coding
>> > guidelines.
>>
>> You misunderstand:
>> The issue is not (afaict) the coding guidelines but the fact that the
>> change would mean we claim a compatibility that we cannot guarantee.
>>
>> > However, what about the patch attached for fixing the declaration
>> > of ff_adpcm_afc_coeffs[2][16]?
>>
>> This would revert 10542491, a relatively recent change: Maybe Paul,
>> the author, wants to comment.

>> Do you think the code gets more readable?
>>
>
> Excuse me... I was just wondering what to do

You could answer above question.

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


Re: [FFmpeg-devel] [PATCH 0/1] Add Sega FILM muxer

2018-03-23 Thread Paul B Mahol
On 3/23/18, Paul B Mahol  wrote:
> On 3/23/18, wm4  wrote:
>> On Thu, 22 Mar 2018 08:11:03 -0700
>> Misty De Meo  wrote:
>>
>>> On Thu, Mar 22, 2018 at 3:43 AM, wm4  wrote:
>>> > Why?
>>>
>>> Mainly to modify existing videos or encode new videos for Saturn
>>> games. It's particularly useful for fan translation - to mux in new
>>> audio, or encode new video for things like credits sequences.
>>
>> I have my doubt such single use case for single users things have their
>> place in a library that requires keeping all components in-tree.
>
> Relax, it is small demuxer.
>

And now muxer too.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 0/1] Add Sega FILM muxer

2018-03-23 Thread Paul B Mahol
On 3/23/18, wm4  wrote:
> On Thu, 22 Mar 2018 08:11:03 -0700
> Misty De Meo  wrote:
>
>> On Thu, Mar 22, 2018 at 3:43 AM, wm4  wrote:
>> > Why?
>>
>> Mainly to modify existing videos or encode new videos for Saturn
>> games. It's particularly useful for fan translation - to mux in new
>> audio, or encode new video for things like credits sequences.
>
> I have my doubt such single use case for single users things have their
> place in a library that requires keeping all components in-tree.

Relax, it is small demuxer.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 0/1] Add Sega FILM muxer

2018-03-23 Thread wm4
On Thu, 22 Mar 2018 08:11:03 -0700
Misty De Meo  wrote:

> On Thu, Mar 22, 2018 at 3:43 AM, wm4  wrote:
> > Why?  
> 
> Mainly to modify existing videos or encode new videos for Saturn
> games. It's particularly useful for fan translation - to mux in new
> audio, or encode new video for things like credits sequences.

I have my doubt such single use case for single users things have their
place in a library that requires keeping all components in-tree.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Type mismatch in ADPCM

2018-03-23 Thread Carlo Bramini
Hello everyone,

> Il 11 marzo 2018 alle 11.42 Carl Eugen Hoyos  ha scritto:
> 
> 2018-03-11 11:27 GMT+01:00 Carlo Bramini :
> 
> > Hello,
> > I see. I expected that adding that could be considered out of the coding 
> > guidelines.
> 
> You misunderstand:
> The issue is not (afaict) the coding guidelines but the fact that the
> change would mean we claim a compatibility that we cannot guarantee.
> 
> > However, what about the patch attached for fixing the declaration
> > of ff_adpcm_afc_coeffs[2][16]?
> 
> This would revert 10542491, a relatively recent change: Maybe Paul,
> the author, wants to comment. Do you think the code gets more
> readable?
> 

Excuse me... I was just wondering what to do, because I had not received any 
more replies about that patch. Thank you very much for your time.

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


[FFmpeg-devel] [PATCH] lavc/amfenc: Reference to input AVFrame (hwaccel) is retained during the encoding process

2018-03-23 Thread Kravchenko, Alexander
An additional reference to input AVFrame (hwaccel) is retained during the 
encoding process.
This postpone reusing frames by decoder while they are used by encoder and 
prevents frame corruption
Issue with frame corruption  was reproduced using:
ffmpeg.exe -y -hwaccel d3d11va -hwaccel_output_format d3d11 -i input.h264  -an 
-c:v h264_amf output.mkv


From: Alexander Kravchenko 
---
 libavcodec/amfenc.c | 64 ++---
 1 file changed, 61 insertions(+), 3 deletions(-)

diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c
index 89a10ff253..9ffc52b0b0 100644
--- a/libavcodec/amfenc.c
+++ b/libavcodec/amfenc.c
@@ -443,6 +443,41 @@ int ff_amf_encode_init(AVCodecContext *avctx)
 return ret;
 }

+#define AV_AMF_QUERY_INTERFACE(res, from, InterfaceType, to ) \
+{ \
+AMFGuid guid_##InterfaceType = IID_##InterfaceType(); \
+res = from->pVtbl->QueryInterface(from, &guid_##InterfaceType, 
(void**)&to); \
+}
+
+#define AV_AMF_ASSIGN_PROPERTY_INTERFACE(res, pThis, name, val ) \
+{ \
+AMFInterface *amf_interface; \
+AV_AMF_QUERY_INTERFACE(res, val, AMFInterface, amf_interface)\
+if(res == AMF_OK) { \
+AMFVariantStruct var; \
+AMFVariantInit(&var); \
+AMFVariantAssignInterface(&var, amf_interface); \
+amf_interface->pVtbl->Release(amf_interface); \
+res = pThis->pVtbl->SetProperty(pThis, name, var); \
+AMFVariantClear(&var); \
+} \
+}
+
+#define AV_AMF_GET_PROPERTY_INTERFACE(res, pThis, name, target_type, val) \
+{ \
+AMFVariantStruct var; \
+AMFVariantInit(&var); \
+res = pThis->pVtbl->GetProperty(pThis, name, &var); \
+if(res == AMF_OK) { \
+if(var.type == AMF_VARIANT_INTERFACE && var.pInterface) { \
+AMFGuid guid = IID_##target_type(); \
+res = var.pInterface->pVtbl->QueryInterface(var.pInterface, 
&guid, (void**)&val); \
+} else { \
+res = AMF_INVALID_DATA_TYPE; \
+} \
+AMFVariantClear(&var); \
+} \
+}

 int ff_amf_send_frame(AVCodecContext *avctx, const AVFrame *frame)
 {
@@ -484,6 +519,8 @@ int ff_amf_send_frame(AVCodecContext *avctx, const AVFrame 
*frame)
 (ctx->hw_device_ctx && 
((AVHWFramesContext*)frame->hw_frames_ctx->data)->device_ctx ==
 (AVHWDeviceContext*)ctx->hw_device_ctx->data)
 )) {
+AVFrame* frame_ref = av_frame_clone(frame);
+AMFBuffer* frame_ref_storage_buffer;
 #if CONFIG_D3D11VA
 static const GUID AMFTextureArrayIndexGUID = { 0x28115527, 0xe7c3, 
0x4b66, { 0x99, 0xd3, 0x4f, 0x2a, 0xe6, 0xb4, 0x7f, 0xaf } };
 ID3D11Texture2D *texture = (ID3D11Texture2D*)frame->data[0]; // 
actual texture
@@ -496,6 +533,12 @@ int ff_amf_send_frame(AVCodecContext *avctx, const AVFrame 
*frame)
 // input HW surfaces can be vertically aligned by 16; tell AMF the 
real size
 surface->pVtbl->SetCrop(surface, 0, 0, frame->width, 
frame->height);
 #endif
+res = ctx->context->pVtbl->AllocBuffer(ctx->context, 
AMF_MEMORY_HOST, sizeof(frame_ref), &frame_ref_storage_buffer);
+AMF_RETURN_IF_FALSE(ctx, res == AMF_OK, AVERROR(ENOMEM), 
"AllocBuffer() failed  with error %d\n", res);
+
memcpy(frame_ref_storage_buffer->pVtbl->GetNative(frame_ref_storage_buffer), 
&frame_ref, sizeof(frame_ref));
+
+AV_AMF_ASSIGN_PROPERTY_INTERFACE(res, surface, L"av_frame_ref", 
frame_ref_storage_buffer);
+frame_ref_storage_buffer->pVtbl->Release(frame_ref_storage_buffer);
 } else {
 res = ctx->context->pVtbl->AllocSurface(ctx->context, 
AMF_MEMORY_HOST, ctx->format, avctx->width, avctx->height, &surface);
 AMF_RETURN_IF_FALSE(ctx, res == AMF_OK, AVERROR(ENOMEM), 
"AllocSurface() failed  with error %d\n", res);
@@ -555,11 +598,26 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket 
*avpkt)
 if (data) {
 // copy data to packet
 AMFBuffer* buffer;
-AMFGuid guid = IID_AMFBuffer();
-data->pVtbl->QueryInterface(data, &guid, (void**)&buffer); // 
query for buffer interface
+AV_AMF_QUERY_INTERFACE(res, data, AMFBuffer, buffer);
+AMF_RETURN_IF_FALSE(ctx, res == AMF_OK, AVERROR_UNKNOWN, "Invalid 
data type from encoder->QueryOutput, should be AMFBuffer, error %d\n", res);
 ret = amf_copy_buffer(avctx, avpkt, buffer);
-
 buffer->pVtbl->Release(buffer);
+
+//try to get attached av_frame_ref and unref
+if(data->pVtbl->HasProperty(data, L"av_frame_ref")) {
+AMFBuffer *frame_ref_storage_buffer = NULL;
+AVFrame *av_frame_ref;
+
+AV_AMF_GET_PROPERTY_INTERFACE(res, data, L"av_frame_ref", 
AMFBuffer, frame_ref_storage_buffer);
+if(res == AMF_OK) {
+   

Re: [FFmpeg-devel] [PATCH] libavfilter: Add OpenCL convolution filter v0.2

2018-03-23 Thread Carl Eugen Hoyos
2018-03-22 23:52 GMT+01:00, Danil Iashchenko :

> --- /dev/null
> +++ b/libavfilter/opencl/convolution.cl
> @@ -0,0 +1,40 @@
> +/*
> + * This file is part of FFmpeg.

Any reason why you don't put your name here?

To state the obvious: There are now two probably qualified
students that are interested in the OpenCL task...

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


Re: [FFmpeg-devel] [PATCH v4 3/7] cmdutils: use new iteration APIs

2018-03-23 Thread Josh de Kock

On 2018/03/23 10:05, Nicolas George wrote:

Josh de Kock (2018-03-22):

move lavd avinputformats and avoutputformats into lavf

delete lavd


Possibly ok in principle for me, but see below.



I personally think this will fix a lot of the weird interactions between 
the two libraries, and should be considered a serious option independent 
of the new API.



write new lavd aimed at actual devices


There are already such libraries, we do not need another. The basic
devices with a (de)muxer API are quite right to give many extra features
with little extra cost.


After thinking about this for a while, I actually agree somewhat.


But why are we discussing this? It seems to me that the discussion went
approximately like this:

"Darn, the faucet I just bought to fix the leaky one does not fit the
pipes. Well, I guess I will have to redo the whole plumbing to make it
fit."


Sure, I guess but I still think it's more involved than just 'one faucet 
not fitting'. There's still an entire pipe which doesn't fit but was 
still installed with duct tape.



The correct way of addressing the problem is to buy a new faucet with
the correct size. And cut the losses if the first one cannot be
refunded. I feel like the discussion is largely fueled by the cognitive
bias known as "sunk cost fallacy": due to efforts invested in a
solution, become attached emotionally to it and fail to see when it
proves to cause more costs than benefits.


I mean it's so far gone that I don't think it matters how long it takes 
anymore as long as it gets done, and gets done 'right'. This is a 
release blocker, and yes that's my bad but I do think that some earlier 
help (when I asked even before starting the new API) from others would 
have maybe avoided the current situation.



Can we at least REALLY CONSIDER this:

1. Acknowledge that this issue about lavd, on top of Michael's early
concerns about registering external components, has proven that the
all-static approach, while elegant in many ways, is not practical.

2. Agree to revert the API as it is and discuss a better solution.


If you submit a set to revert it (my git skills suck), I won't block it, 
provided there will actually be discussion--from what I've seen, 
discussion only occurs after things happen, which isn't very helpful for 
larger more impactful changes.



3. As for the better solution, I really propose to register the
components (with av_register_something calls, like now) into an array
rather than a linked list (like your proposal) that is stored in a
user-provided structure that can exist in several instances (new),
with a global instance of that structure for temporary compatibility.


So the reason I liked having an iteration-style function was that it 
allowed an API user to get an array of all the components *but it didn't 
force them*.


Your suggestion here is interesting, from what I understand it seems to 
be a thread-local, user-managed state of the loaded components in each 
library? Coupled with a new and proper registration API (the previous 
one wasn't ideal for registering external components. The downside of 
this approach is then you go in completely the opposite direction: the 
library requires even more 'bootstrap'. The reason for the new API 
wasn't just to use arrays internally, but to have no initialisation 
required.



Note that with this proposal, your efforts are not wasted: most of the
code can be reused, and they have taught us a valuable lesson on top of
that.


I hope that in the future it will be less of a 'send a patch and we'll 
ACK/NACK', because some things really benefit from discussion.


--
Josh

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


Re: [FFmpeg-devel] [PATCH] AMF Encoder: fix issue with frame corruption if encoder connected directly to decoder

2018-03-23 Thread Carl Eugen Hoyos
2018-03-23 11:20 GMT+01:00, Kravchenko, Alexander :

> Subject: [PATCH] AMF Encoder: fix issue with frame corruption if encoder
>  connected directly to decoder. Solution: storing frame reference while it
> is used during encoding

The commit message should start with something similar to "lavc/amfenc: "
and should have a first line ~70 characters followed by two CR/LFs
followed by more information if useful.

[...]

> This e-mail and any attachment(s) are intended only for the recipient(s)
> named above and others who have been specifically authorized to receive
> them. They may contain confidential information.

Please remove this from mails sent to the public mailing list of an
open-source project.

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


[FFmpeg-devel] [PATCH] AMF Encoder: fix issue with frame corruption if encoder connected directly to decoder

2018-03-23 Thread Kravchenko, Alexander
Hello,
I am collaborating with AMD to integrate and support AMF integration FFmpeg

This patch solves issue with frame corruption if encoder connected directly to 
decoder
Solution: storing frame reference while it is used during encoding

From 0fae3679bae8e121ed7b997d7eabd533deb113fb Mon Sep 17 00:00:00 2001
From: Alexander Kravchenko 
Date: Fri, 23 Mar 2018 12:50:21 +0300
Subject: [PATCH] AMF Encoder: fix issue with frame corruption if encoder
 connected directly to decoder. Solution: storing frame reference while it is 
used during encoding

---
 libavcodec/amfenc.c | 64 ++---
 1 file changed, 61 insertions(+), 3 deletions(-)

diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c
index 89a10ff253..9ffc52b0b0 100644
--- a/libavcodec/amfenc.c
+++ b/libavcodec/amfenc.c
@@ -443,6 +443,41 @@ int ff_amf_encode_init(AVCodecContext *avctx)
 return ret;
 }

+#define AV_AMF_QUERY_INTERFACE(res, from, InterfaceType, to ) \
+{ \
+AMFGuid guid_##InterfaceType = IID_##InterfaceType(); \
+res = from->pVtbl->QueryInterface(from, &guid_##InterfaceType, 
(void**)&to); \
+}
+
+#define AV_AMF_ASSIGN_PROPERTY_INTERFACE(res, pThis, name, val ) \
+{ \
+AMFInterface *amf_interface; \
+AV_AMF_QUERY_INTERFACE(res, val, AMFInterface, amf_interface)\
+if(res == AMF_OK) { \
+AMFVariantStruct var; \
+AMFVariantInit(&var); \
+AMFVariantAssignInterface(&var, amf_interface); \
+amf_interface->pVtbl->Release(amf_interface); \
+res = pThis->pVtbl->SetProperty(pThis, name, var); \
+AMFVariantClear(&var); \
+} \
+}
+
+#define AV_AMF_GET_PROPERTY_INTERFACE(res, pThis, name, target_type, val) \
+{ \
+AMFVariantStruct var; \
+AMFVariantInit(&var); \
+res = pThis->pVtbl->GetProperty(pThis, name, &var); \
+if(res == AMF_OK) { \
+if(var.type == AMF_VARIANT_INTERFACE && var.pInterface) { \
+AMFGuid guid = IID_##target_type(); \
+res = var.pInterface->pVtbl->QueryInterface(var.pInterface, 
&guid, (void**)&val); \
+} else { \
+res = AMF_INVALID_DATA_TYPE; \
+} \
+AMFVariantClear(&var); \
+} \
+}

 int ff_amf_send_frame(AVCodecContext *avctx, const AVFrame *frame)
 {
@@ -484,6 +519,8 @@ int ff_amf_send_frame(AVCodecContext *avctx, const AVFrame 
*frame)
 (ctx->hw_device_ctx && 
((AVHWFramesContext*)frame->hw_frames_ctx->data)->device_ctx ==
 (AVHWDeviceContext*)ctx->hw_device_ctx->data)
 )) {
+AVFrame* frame_ref = av_frame_clone(frame);
+AMFBuffer* frame_ref_storage_buffer;
 #if CONFIG_D3D11VA
 static const GUID AMFTextureArrayIndexGUID = { 0x28115527, 0xe7c3, 
0x4b66, { 0x99, 0xd3, 0x4f, 0x2a, 0xe6, 0xb4, 0x7f, 0xaf } };
 ID3D11Texture2D *texture = (ID3D11Texture2D*)frame->data[0]; // 
actual texture
@@ -496,6 +533,12 @@ int ff_amf_send_frame(AVCodecContext *avctx, const AVFrame 
*frame)
 // input HW surfaces can be vertically aligned by 16; tell AMF the 
real size
 surface->pVtbl->SetCrop(surface, 0, 0, frame->width, 
frame->height);
 #endif
+res = ctx->context->pVtbl->AllocBuffer(ctx->context, 
AMF_MEMORY_HOST, sizeof(frame_ref), &frame_ref_storage_buffer);
+AMF_RETURN_IF_FALSE(ctx, res == AMF_OK, AVERROR(ENOMEM), 
"AllocBuffer() failed  with error %d\n", res);
+
memcpy(frame_ref_storage_buffer->pVtbl->GetNative(frame_ref_storage_buffer), 
&frame_ref, sizeof(frame_ref));
+
+AV_AMF_ASSIGN_PROPERTY_INTERFACE(res, surface, L"av_frame_ref", 
frame_ref_storage_buffer);
+frame_ref_storage_buffer->pVtbl->Release(frame_ref_storage_buffer);
 } else {
 res = ctx->context->pVtbl->AllocSurface(ctx->context, 
AMF_MEMORY_HOST, ctx->format, avctx->width, avctx->height, &surface);
 AMF_RETURN_IF_FALSE(ctx, res == AMF_OK, AVERROR(ENOMEM), 
"AllocSurface() failed  with error %d\n", res);
@@ -555,11 +598,26 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket 
*avpkt)
 if (data) {
 // copy data to packet
 AMFBuffer* buffer;
-AMFGuid guid = IID_AMFBuffer();
-data->pVtbl->QueryInterface(data, &guid, (void**)&buffer); // 
query for buffer interface
+AV_AMF_QUERY_INTERFACE(res, data, AMFBuffer, buffer);
+AMF_RETURN_IF_FALSE(ctx, res == AMF_OK, AVERROR_UNKNOWN, "Invalid 
data type from encoder->QueryOutput, should be AMFBuffer, error %d\n", res);
 ret = amf_copy_buffer(avctx, avpkt, buffer);
-
 buffer->pVtbl->Release(buffer);
+
+//try to get attached av_frame_ref and unref
+if(data->pVtbl->HasProperty(data, L"av_frame_ref")) {
+AMFBuffer *frame_ref_storage_buffer = NULL;
+AVFrame *av_fr

Re: [FFmpeg-devel] [PATCH] lavfi: Add OpenCL avgblur filter

2018-03-23 Thread Carl Eugen Hoyos
2018-03-21 14:09 GMT+01:00, Dylan Fernando :

> What information should I put in my GSoC application? How should I
> structure it? Should I give a rough timeline detailing exactly which color
> conversion and scaling algorithms I’ll be implementing? If so, which files
> should I look at to see the current colour conversion code?

Two blogposts that are meant to help you:
https://medium.com/@owtf/google-summer-of-code-writing-a-good-proposal-141b1376f076
http://mirca.fun/gsoc-application/

But please remember that in this project, the qualification task
is more important than the form of the application.
You of course absolutely have to finish an application, without
it you cannot be chosen as student.

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


Re: [FFmpeg-devel] [PATCH v4 3/7] cmdutils: use new iteration APIs

2018-03-23 Thread Nicolas George
Josh de Kock (2018-03-22):
> move lavd avinputformats and avoutputformats into lavf
> 
> delete lavd

Possibly ok in principle for me, but see below.

> write new lavd aimed at actual devices

There are already such libraries, we do not need another. The basic
devices with a (de)muxer API are quite right to give many extra features
with little extra cost.

But why are we discussing this? It seems to me that the discussion went
approximately like this:

"Darn, the faucet I just bought to fix the leaky one does not fit the
pipes. Well, I guess I will have to redo the whole plumbing to make it
fit."

The correct way of addressing the problem is to buy a new faucet with
the correct size. And cut the losses if the first one cannot be
refunded. I feel like the discussion is largely fueled by the cognitive
bias known as "sunk cost fallacy": due to efforts invested in a
solution, become attached emotionally to it and fail to see when it
proves to cause more costs than benefits.

Can we at least REALLY CONSIDER this:

1. Acknowledge that this issue about lavd, on top of Michael's early
   concerns about registering external components, has proven that the
   all-static approach, while elegant in many ways, is not practical.

2. Agree to revert the API as it is and discuss a better solution.

3. As for the better solution, I really propose to register the
   components (with av_register_something calls, like now) into an array
   rather than a linked list (like your proposal) that is stored in a
   user-provided structure that can exist in several instances (new),
   with a global instance of that structure for temporary compatibility.

Note that with this proposal, your efforts are not wasted: most of the
code can be reused, and they have taught us a valuable lesson on top of
that.

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] avfilter: add hrtfm filter

2018-03-23 Thread Paul B Mahol
On 3/22/18, Aurelien Jacobs  wrote:
> On Mon, Mar 19, 2018 at 10:49:28PM -0800, Lou Logan wrote:
>> On Fri, Mar 16, 2018, at 11:44 AM, Paul B Mahol wrote:
>> > Signed-off-by: Paul B Mahol 
>> > ---
>> >  doc/filters.texi |  60 ++
>> >  libavfilter/Makefile |   1 +
>> >  libavfilter/af_hrtfm.c   | 486
>> >  +++>
>> > libavfilter/allfilters.c |   1 +
>> >  4 files changed, 548 insertions(+)
>> >  create mode 100644 libavfilter/af_hrtfm.c
>> >
>> > diff --git a/doc/filters.texi b/doc/filters.texi
>> > index bd43a7ac6e..c298054325 100644
>> > --- a/doc/filters.texi
>> > +++ b/doc/filters.texi
>> > @@ -3218,6 +3218,66 @@ Change highpass width.
>> >  Syntax for the command is : "@var{width}"
>> >  @end table
>> >
>> > +@section hrtfm
>> > +
>> > +Apply simple Head Related Transfer Function Model to audio stream.
>> > +
>> > +hrtfm filter creates virtual loudspeakers around the user for
>> > binaural> +listening via headphones (audio formats up to 9 channels
>> > supported).> +
>> > +This is very simple implementation which does not use any HRIRs.
>> > +
>> > +It accepts the following parameters:
>> > +
>> > +@table @option
>> > +@item hradius
>>
>> You didn't like the head_radius option name suggestion?
>>
>> > +Set head radius of listener. In meters. Default value is
>> > @code{0.0891}.
>> Why meters instead of cm?
>
> Because if you want to specify centimeters, you can use the option
> like this: -hradius 8.91c

Shouldn't it be 8.91cm?

> The only way for SI prefix to make sense is to have the options
> expressed in the base unit.
> So I think hradius should be expressed in meters and every new options
> should always be expressed in their base unit.
> ___
> 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 1/1] Add Sega FILM muxer

2018-03-23 Thread Paul B Mahol
On 3/22/18, mi...@brew.sh  wrote:
> From: Misty De Meo 
>
> ---
>  Changelog |   1 +
>  libavformat/Makefile  |   1 +
>  libavformat/allformats.c  |   1 +
>  libavformat/segafilmenc.c | 380
> ++
>  4 files changed, 383 insertions(+)
>  create mode 100644 libavformat/segafilmenc.c
>
> diff --git a/Changelog b/Changelog
> index 30a8978db4..0ff62ff69d 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -48,6 +48,7 @@ version :
>  - drmeter audio filter
>  - hapqa_extract bitstream filter
>  - filter_units bitstream filter
> +- segafilm muxer
>
>
>  version 3.4:
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index 39ec68c28b..4abb992b14 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -462,6 +462,7 @@ OBJS-$(CONFIG_SDR2_DEMUXER)  += sdr2.o
>  OBJS-$(CONFIG_SDS_DEMUXER)   += sdsdec.o
>  OBJS-$(CONFIG_SDX_DEMUXER)   += sdxdec.o
>  OBJS-$(CONFIG_SEGAFILM_DEMUXER)  += segafilm.o
> +OBJS-$(CONFIG_SEGAFILM_MUXER)+= segafilmenc.o
>  OBJS-$(CONFIG_SEGMENT_MUXER) += segment.o
>  OBJS-$(CONFIG_SHORTEN_DEMUXER)   += shortendec.o rawdec.o
>  OBJS-$(CONFIG_SIFF_DEMUXER)  += siff.o
> diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> index 9dc5ce8a76..dfd964f07a 100644
> --- a/libavformat/allformats.c
> +++ b/libavformat/allformats.c
> @@ -364,6 +364,7 @@ extern AVInputFormat  ff_sdr2_demuxer;
>  extern AVInputFormat  ff_sds_demuxer;
>  extern AVInputFormat  ff_sdx_demuxer;
>  extern AVInputFormat  ff_segafilm_demuxer;
> +extern AVOutputFormat ff_segafilm_muxer;
>  extern AVOutputFormat ff_segment_muxer;
>  extern AVOutputFormat ff_stream_segment_muxer;
>  extern AVInputFormat  ff_shorten_demuxer;
> diff --git a/libavformat/segafilmenc.c b/libavformat/segafilmenc.c
> new file mode 100644
> index 00..cc0e21d4d3
> --- /dev/null
> +++ b/libavformat/segafilmenc.c
> @@ -0,0 +1,380 @@
> +/*
> + * Cinepak Video Decoder
> + * Copyright (C) 2003 The FFmpeg project
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
> USA
> + */
> +
> +/**
> + * @file
> + * Sega FILM (.cpk) file muxer
> + * @author Misty De Meo 
> + *
> + * @see For more information regarding the Sega FILM file format, visit:
> + *   http://wiki.multimedia.cx/index.php?title=Sega_FILM
> + */
> +
> +#include "libavutil/intreadwrite.h"
> +#include "avformat.h"
> +#include "internal.h"
> +#include "avio_internal.h"
> +
> +typedef struct FILMPacket {
> +int audio;
> +int keyframe;
> +int32_t pts;
> +int32_t duration;
> +int32_t size;
> +int32_t index;
> +struct FILMPacket *next;
> +} FILMPacket;
> +
> +typedef struct FILMOutputContext {
> +const AVClass *class;
> +int audio_index;
> +int video_index;
> +int64_t stab_pos;
> +FILMPacket *start;
> +FILMPacket *last;
> +int64_t packet_count;
> +} FILMOutputContext;
> +
> +static int film_write_packet_to_header(AVFormatContext *format_context,
> FILMPacket *pkt)
> +{
> +AVIOContext *pb = format_context->pb;
> +// The bits in these two 32-bit integers contain info about the
> contents of this sample
> +int32_t info1 = 0;
> +int32_t info2 = 0;
> +
> +if (pkt->audio) {
> +// Always the same, carries no more information than "this is
> audio"
> +info1 = 0x;
> +info2 = 1;
> +} else {
> +info1 = pkt->pts;
> +info2 = pkt->duration;
> +// The top bit being set indicates a key frame
> +if (pkt->keyframe)
> +info1 |= (1 << 31);
> +}
> +
> +// Write the 16-byte sample info packet to the STAB chunk in the header
> +avio_wb32(pb, pkt->index);
> +avio_wb32(pb, pkt->size);
> +avio_wb32(pb, info1);
> +avio_wb32(pb, info2);
> +
> +return 0;
> +}
> +
> +static int film_write_packet(AVFormatContext *format_context, AVPacket
> *pkt)
> +{
> +FILMPacket *metadata = av_mallocz(sizeof(FILMPacket));
> +if (!metadata)
> +return AVERROR(ENOMEM);

Do not mix initializations and calling other functions. Here and in
others places.

> +AVIOContext *pb = format_context->pb;
> +FILMOutputContext *film = format_cont

Re: [FFmpeg-devel] [PATCH] Support signaling of last segment number

2018-03-23 Thread M M
Thanks. I have re-submitted the patch with changes.


On Wed, Mar 21, 2018 at 1:24 PM, Carl Eugen Hoyos 
wrote:

> 2018-03-21 16:33 GMT+01:00, sanilraut :
>
> > +if(pls->last_seq_no == 0){
>
> Please add a space to avoid mixing styles: "if ("
> We usually use "if (!pls->last_seq_no)", same above.
>
> > +pls->last_seq_no = calc_max_seg_no(pls, s->priv_data);
> > +}
>
> Carl Eugen
> ___
> 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