Re: [FFmpeg-devel] [PATCH] add append_list flag into hlsenc

2016-08-14 Thread Steven Liu
2016-08-11 23:04 GMT+08:00 Steven Liu :

> When ffmpeg exit by exception, start a new ffmpeg will cover the old
> segment list, add this flag can continue append the new segments into old
> hls segment list
>
> Signed-off-by: LiuQi 
> ---
>  doc/muxers.texi  |  4 
>  libavformat/hlsenc.c | 63 ++
> ++
>  2 files changed, 67 insertions(+)
>
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index 5873269..2e95c6f 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -495,6 +495,10 @@ Will produce the playlist, @file{out.m3u8}, and a
> single segment file,
>  Segment files removed from the playlist are deleted after a period of time
>  equal to the duration of the segment plus the duration of the playlist.
>
> +@item hls_flags append_list
> +Append new segments into the end of old segment list,
> +and remove the @code{#EXT-X-ENDLIST} from the old segment list.
> +
>  @item hls_flags round_durations
>  Round the duration info in the playlist file segment info to integer
>  values, instead of using floating point.
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 9f076ba..a570db4 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -63,6 +63,7 @@ typedef enum HLSFlags {
>  HLS_DISCONT_START = (1 << 3),
>  HLS_OMIT_ENDLIST = (1 << 4),
>  HLS_SPLIT_BY_TIME = (1 << 5),
> +HLS_APPEND_LIST = (1 << 6),
>  } HLSFlags;
>
>  typedef enum {
> @@ -265,6 +266,14 @@ static int hls_encryption_start(AVFormatContext *s)
>  return 0;
>  }
>
> +static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
> +{
> +int len = ff_get_line(s, buf, maxlen);
> +while (len > 0 && av_isspace(buf[len - 1]))
> +buf[--len] = '\0';
> +return len;
> +}
> +
>  static int hls_mux_init(AVFormatContext *s)
>  {
>  HLSContext *hls = s->priv_data;
> @@ -389,6 +398,55 @@ static int hls_append_segment(struct AVFormatContext
> *s, HLSContext *hls, double
>  return 0;
>  }
>
> +static int parse_playlist(AVFormatContext *s, const char *url)
> +{
> +HLSContext *hls = s->priv_data;
> +AVIOContext *in;
> +int ret = 0, is_segment = 0;
> +int64_t new_start_pos;
> +int64_t duration = 0;
> +char line[1024];
> +const char *ptr;
> +
> +if ((ret = ffio_open_whitelist(, url, AVIO_FLAG_READ,
> +   >interrupt_callback, NULL,
> +   s->protocol_whitelist,
> s->protocol_blacklist)) < 0)
> +return ret;
> +
> +read_chomp_line(in, line, sizeof(line));
> +if (strcmp(line, "#EXTM3U")) {
> +ret = AVERROR_INVALIDDATA;
> +goto fail;
> +}
> +
> +while (!avio_feof(in)) {
> +read_chomp_line(in, line, sizeof(line));
> +if (av_strstart(line, "#EXT-X-TARGETDURATION:", )) {
> +duration = atoi(ptr);
> +} else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", )) {
> +hls->sequence = atoi(ptr);
> +} else if (av_strstart(line, "#EXT-X-ENDLIST", )) {
> +} else if (av_strstart(line, "#EXTINF:", )) {
> +is_segment = 1;
> +hls->duration = atof(ptr);
> +} else if (av_strstart(line, "#", NULL)) {
> +continue;
> +} else if (line[0]) {
> +if (is_segment) {
> +new_start_pos = avio_tell(hls->avf->pb);
> +hls->size = new_start_pos - hls->start_pos;
> +av_strlcpy(hls->avf->filename, line, sizeof(line));
> +hls_append_segment(s, hls, hls->duration, hls->start_pos,
> hls->size);
> +is_segment = 0;
> +}
> +}
> +}
> +
> +fail:
> +avio_close(in);
> +return ret;
> +}
> +
>  static void hls_free_segments(HLSSegment *p)
>  {
>  HLSSegment *en;
> @@ -752,6 +810,10 @@ static int hls_write_header(AVFormatContext *s)
>  if ((ret = hls_mux_init(s)) < 0)
>  goto fail;
>
> +if (hls->flags & HLS_APPEND_LIST) {
> +parse_playlist(s, s->filename);
> +}
> +
>  if ((ret = hls_start(s)) < 0)
>  goto fail;
>
> @@ -927,6 +989,7 @@ static const AVOption options[] = {
>  {"discont_start", "start the playlist with a discontinuity tag", 0,
> AV_OPT_TYPE_CONST, {.i64 = HLS_DISCONT_START }, 0, UINT_MAX,   E, "flags"},
>  {"omit_endlist", "Do not append an endlist when ending stream", 0,
> AV_OPT_TYPE_CONST, {.i64 = HLS_OMIT_ENDLIST }, 0, UINT_MAX,   E, "flags"},
>  {"split_by_time", "split the hls segment by time which user set by
> hls_time", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_SPLIT_BY_TIME }, 0, UINT_MAX,
>   E, "flags"},
> +{"append_list", "append the new segments into old hls segment list",
> 0, AV_OPT_TYPE_CONST, {.i64 = HLS_APPEND_LIST }, 0, UINT_MAX,   E, "flags"},
>  {"use_localtime", "set filename expansion with strftime at segment
> creation", OFFSET(use_localtime), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, 

Re: [FFmpeg-devel] [PATCH] add append_list flag into hlsenc

2016-08-14 Thread Steven Liu
2016-08-11 23:04 GMT+08:00 Steven Liu :

> When ffmpeg exit by exception, start a new ffmpeg will cover the old
> segment list, add this flag can continue append the new segments into old
> hls segment list
>
> Signed-off-by: LiuQi 
> ---
>  doc/muxers.texi  |  4 
>  libavformat/hlsenc.c | 63 ++
> ++
>  2 files changed, 67 insertions(+)
>
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index 5873269..2e95c6f 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -495,6 +495,10 @@ Will produce the playlist, @file{out.m3u8}, and a
> single segment file,
>  Segment files removed from the playlist are deleted after a period of time
>  equal to the duration of the segment plus the duration of the playlist.
>
> +@item hls_flags append_list
> +Append new segments into the end of old segment list,
> +and remove the @code{#EXT-X-ENDLIST} from the old segment list.
> +
>  @item hls_flags round_durations
>  Round the duration info in the playlist file segment info to integer
>  values, instead of using floating point.
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 9f076ba..a570db4 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -63,6 +63,7 @@ typedef enum HLSFlags {
>  HLS_DISCONT_START = (1 << 3),
>  HLS_OMIT_ENDLIST = (1 << 4),
>  HLS_SPLIT_BY_TIME = (1 << 5),
> +HLS_APPEND_LIST = (1 << 6),
>  } HLSFlags;
>
>  typedef enum {
> @@ -265,6 +266,14 @@ static int hls_encryption_start(AVFormatContext *s)
>  return 0;
>  }
>
> +static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
> +{
> +int len = ff_get_line(s, buf, maxlen);
> +while (len > 0 && av_isspace(buf[len - 1]))
> +buf[--len] = '\0';
> +return len;
> +}
> +
>  static int hls_mux_init(AVFormatContext *s)
>  {
>  HLSContext *hls = s->priv_data;
> @@ -389,6 +398,55 @@ static int hls_append_segment(struct AVFormatContext
> *s, HLSContext *hls, double
>  return 0;
>  }
>
> +static int parse_playlist(AVFormatContext *s, const char *url)
> +{
> +HLSContext *hls = s->priv_data;
> +AVIOContext *in;
> +int ret = 0, is_segment = 0;
> +int64_t new_start_pos;
> +int64_t duration = 0;
> +char line[1024];
> +const char *ptr;
> +
> +if ((ret = ffio_open_whitelist(, url, AVIO_FLAG_READ,
> +   >interrupt_callback, NULL,
> +   s->protocol_whitelist,
> s->protocol_blacklist)) < 0)
> +return ret;
> +
> +read_chomp_line(in, line, sizeof(line));
> +if (strcmp(line, "#EXTM3U")) {
> +ret = AVERROR_INVALIDDATA;
> +goto fail;
> +}
> +
> +while (!avio_feof(in)) {
> +read_chomp_line(in, line, sizeof(line));
> +if (av_strstart(line, "#EXT-X-TARGETDURATION:", )) {
> +duration = atoi(ptr);
> +} else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", )) {
> +hls->sequence = atoi(ptr);
> +} else if (av_strstart(line, "#EXT-X-ENDLIST", )) {
> +} else if (av_strstart(line, "#EXTINF:", )) {
> +is_segment = 1;
> +hls->duration = atof(ptr);
> +} else if (av_strstart(line, "#", NULL)) {
> +continue;
> +} else if (line[0]) {
> +if (is_segment) {
> +new_start_pos = avio_tell(hls->avf->pb);
> +hls->size = new_start_pos - hls->start_pos;
> +av_strlcpy(hls->avf->filename, line, sizeof(line));
> +hls_append_segment(s, hls, hls->duration, hls->start_pos,
> hls->size);
> +is_segment = 0;
> +}
> +}
> +}
> +
> +fail:
> +avio_close(in);
> +return ret;
> +}
> +
>  static void hls_free_segments(HLSSegment *p)
>  {
>  HLSSegment *en;
> @@ -752,6 +810,10 @@ static int hls_write_header(AVFormatContext *s)
>  if ((ret = hls_mux_init(s)) < 0)
>  goto fail;
>
> +if (hls->flags & HLS_APPEND_LIST) {
> +parse_playlist(s, s->filename);
> +}
> +
>  if ((ret = hls_start(s)) < 0)
>  goto fail;
>
> @@ -927,6 +989,7 @@ static const AVOption options[] = {
>  {"discont_start", "start the playlist with a discontinuity tag", 0,
> AV_OPT_TYPE_CONST, {.i64 = HLS_DISCONT_START }, 0, UINT_MAX,   E, "flags"},
>  {"omit_endlist", "Do not append an endlist when ending stream", 0,
> AV_OPT_TYPE_CONST, {.i64 = HLS_OMIT_ENDLIST }, 0, UINT_MAX,   E, "flags"},
>  {"split_by_time", "split the hls segment by time which user set by
> hls_time", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_SPLIT_BY_TIME }, 0, UINT_MAX,
>   E, "flags"},
> +{"append_list", "append the new segments into old hls segment list",
> 0, AV_OPT_TYPE_CONST, {.i64 = HLS_APPEND_LIST }, 0, UINT_MAX,   E, "flags"},
>  {"use_localtime", "set filename expansion with strftime at segment
> creation", OFFSET(use_localtime), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, 

Re: [FFmpeg-devel] [PATCH] ffmpeg/qsv: fix QSV-accelerated transcode performance drop issue

2016-08-14 Thread Michael Niedermayer
On Mon, Aug 15, 2016 at 09:24:42AM +0800, Jun Zhao wrote:
> ping?

ccing maintainer, so he doesnt miss that ping


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

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


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


Re: [FFmpeg-devel] [PATCH v2 3/5] avcodec/bsf: Add list BSF API

2016-08-14 Thread Michael Niedermayer
On Fri, Aug 05, 2016 at 02:00:25PM +0200, sebechlebsky...@gmail.com wrote:
> From: Jan Sebechlebsky 
> 
> ---
>  Changes from last version:
>  - fixed doxygen comments
>  - added av_bsf_list_append2() function
>  - changed names of array and length fields to follow naming convention
>  - idx and flushed_idx is now unsigned
>  - merged bsf_list_flush to bsf_list_filter to reduce code duplication
>  - aligned structure fields initialization
>  - added check for NULL to av_bsf_free()
>  - fixed memleak in av_bsf_finalize in case there is only 1 filter
> 
>  libavcodec/avcodec.h |  85 
>  libavcodec/bsf.c | 279 
> +++
>  2 files changed, 364 insertions(+)

seems to break build or i did something silly

CC  libavcodec/bsf.o
libavcodec/bsf.c: In function ‘bsf_list_close’:
libavcodec/bsf.c:348:18: error: ‘BSFListContext’ has no member named ‘item_name’
make: *** [libavcodec/bsf.o] Error 1

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

No snowflake in an avalanche ever feels responsible. -- Voltaire


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


Re: [FFmpeg-devel] [PATCH] ffmpeg/qsv: fix QSV-accelerated transcode performance drop issue

2016-08-14 Thread Jun Zhao
ping?

On 2016/8/11 15:59, Jun Zhao wrote:
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Subject: [PATCH] libavcodec/qsvdec_h2645.c: switch to the new BSF API

2016-08-14 Thread Michael Niedermayer
On Sun, Aug 14, 2016 at 07:17:56PM +0300, Ivan Uskov wrote:
> 
> Hello Michael,
> 
> Sunday, August 7, 2016, 8:18:54 PM, you wrote:
> 
> > On Sun, Jul 24, 2016 at 10:05:27PM +0300, Ivan Uskov wrote:
> >> Hello All,
> >> 
> >> This patch applies same changes as commit 
> >> e3dfef8e3c85a64dbe6388117303f5819fa3c6a2
> >> of libav: instead obsolete AVBitStreamFilterContext now new AVBSFContext
> >> filter uses to restore annex-B prefixes. 
> >> 
> >> Please review.
> >>   
> >> 
> >> -- 
> >> Best regards,
> >>  Ivan  mailto:ivan.us...@nablet.com
> 
> >>  qsvdec_h2645.c |  138 
> >> -
> >>  1 file changed, 107 insertions(+), 31 deletions(-)
> >> db4e17da2ddf056018cd049164c77f0073fde1bc  
> >> 0001-libavcodec-qsvdec_h2645.c-switch-to-the-new-BSF-API.patch
> >> From 70b9f600ffbdc67010aca757dd4cf401f3377078 Mon Sep 17 00:00:00 2001
> >> From: Ivan Uskov 
> >> Date: Sun, 24 Jul 2016 14:04:36 -0400
> >> Subject: [PATCH] libavcodec/qsvdec_h2645.c: switch to the new BSF API This
> >>  patch applies same changes as commit 
> >> e3dfef8e3c85a64dbe6388117303f5819fa3c6a2
> >>  of libav: instead obsolete AVBitStreamFilterContext now new AVBSFContext
> >>  filter uses to restore annex-B prefixes.
> 
> > Is it correct to say that this commit is
> > "Based-on: e3dfef8e3c85a64dbe6388117303f5819fa3c6a2 by Anton Khirnov" ?
> Yes, in general it based on this commit, only minor adaptations (ffmpeg use
> different function names into the qsvdec.c)

patch applied

thanks

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

No snowflake in an avalanche ever feels responsible. -- Voltaire


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


Re: [FFmpeg-devel] [PATCH 1/1] All sun4 machines are SPARCs, not just sun4u

2016-08-14 Thread Michael Niedermayer
On Sun, Aug 14, 2016 at 06:23:40PM +, Maya Rashish wrote:
> Allow building on sun4v
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied

btw i assume you have access to such a machine ?
if so, would it be possible to set up a fate client on such a machine
so ffmpegs regression tests are regularly run on it and results
get submitted to
http://fate.ffmpeg.org/

?

Thanks

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

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin


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


[FFmpeg-devel] [PATCH v5 10/11] avformat/fifo: Add AVFMT_FLAG_NONBLOCK support

2016-08-14 Thread sebechlebskyjan
From: Jan Sebechlebsky 

Add support for nonblocking calls.

Signed-off-by: Jan Sebechlebsky 
---
 No changes since the last version of the patch, just rebased because
 of changes in previous patch.

 libavformat/fifo.c | 61 --
 1 file changed, 55 insertions(+), 6 deletions(-)

diff --git a/libavformat/fifo.c b/libavformat/fifo.c
index 3748fa9..ef0fda4 100644
--- a/libavformat/fifo.c
+++ b/libavformat/fifo.c
@@ -19,12 +19,14 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/atomic.h"
 #include "libavutil/opt.h"
 #include "libavutil/time.h"
 #include "libavutil/thread.h"
 #include "libavutil/threadmessage.h"
 #include "avformat.h"
 #include "internal.h"
+#include "url.h"
 
 #define FIFO_DEFAULT_QUEUE_SIZE  60
 #define FIFO_DEFAULT_MAX_RECOVERY_ATTEMPTS   0
@@ -77,6 +79,17 @@ typedef struct FifoContext {
 /* Value > 0 signals queue overflow */
 volatile uint8_t overflow_flag;
 
+/* Whether termination was requested by invoking deinit
+ * before the thread was finished. Used only in non-blocking
+ * mode - when AVFMT_FLAG_NONBLOCK is set. */
+volatile int termination_requested;
+
+/* Initially 0, set to 1 immediately before thread function
+ * returns */
+volatile int thread_finished_flag;
+
+/* Original interrupt callback of the underlying muxer. */
+AVIOInterruptCB orig_interrupt_callback;
 } FifoContext;
 
 typedef struct FifoThreadContext {
@@ -111,6 +124,16 @@ typedef struct FifoMessage {
 AVPacket pkt;
 } FifoMessage;
 
+static int fifo_interrupt_callback_wrapper(void *arg)
+{
+FifoContext *ctx = arg;
+
+if (avpriv_atomic_int_get(>termination_requested))
+return 1;
+
+return ff_check_interrupt(>orig_interrupt_callback);
+}
+
 static int fifo_thread_write_header(FifoThreadContext *ctx)
 {
 AVFormatContext *avf = ctx->avf;
@@ -430,12 +453,17 @@ static void *fifo_consumer_thread(void *data)
 
 fifo->write_trailer_ret = fifo_thread_write_trailer(_thread_ctx);
 
+/* This must be only return path from fifo_consumer_thread function,
+ * so the thread_finised_flag is set. */
+avpriv_atomic_int_set(>thread_finished_flag, 1);
 return NULL;
 }
 
 static int fifo_mux_init(AVFormatContext *avf)
 {
 FifoContext *fifo = avf->priv_data;
+AVIOInterruptCB interrupt_cb = {.callback = 
fifo_interrupt_callback_wrapper,
+.opaque = fifo};
 AVFormatContext *avf2;
 int ret = 0, i;
 
@@ -446,7 +474,8 @@ static int fifo_mux_init(AVFormatContext *avf)
 
 fifo->avf = avf2;
 
-avf2->interrupt_callback = avf->interrupt_callback;
+fifo->orig_interrupt_callback = avf->interrupt_callback;
+avf2->interrupt_callback = interrupt_cb;
 avf2->max_delay = avf->max_delay;
 ret = av_dict_copy(>metadata, avf->metadata, 0);
 if (ret < 0)
@@ -533,7 +562,7 @@ static int fifo_write_packet(AVFormatContext *avf, AVPacket 
*pkt)
 {
 FifoContext *fifo = avf->priv_data;
 FifoMessage msg = {.type = pkt ? FIFO_WRITE_PACKET : FIFO_FLUSH_OUTPUT};
-int ret;
+int ret, queue_flags = 0;
 
 if (pkt) {
 av_init_packet();
@@ -542,15 +571,21 @@ static int fifo_write_packet(AVFormatContext *avf, 
AVPacket *pkt)
 return ret;
 }
 
-ret = av_thread_message_queue_send(fifo->queue, ,
-   fifo->drop_pkts_on_overflow ?
-   AV_THREAD_MESSAGE_NONBLOCK : 0);
+if (fifo->drop_pkts_on_overflow || (avf->flags & AVFMT_FLAG_NONBLOCK))
+queue_flags |= AV_THREAD_MESSAGE_NONBLOCK;
+
+ret = av_thread_message_queue_send(fifo->queue, , queue_flags);
+
 if (ret == AVERROR(EAGAIN)) {
-uint8_t overflow_set = 0;
+uint8_t overflow_set;
+
+if (avf->flags & AVFMT_FLAG_NONBLOCK)
+goto fail;
 
 /* Queue is full, set fifo->overflow_flag to 1
  * to let consumer thread know the queue should
  * be flushed. */
+overflow_set = 0;
 pthread_mutex_lock(>overflow_flag_lock);
 if (!fifo->overflow_flag)
 fifo->overflow_flag = overflow_set = 1;
@@ -578,6 +613,10 @@ static int fifo_write_trailer(AVFormatContext *avf)
 
 av_thread_message_queue_set_err_recv(fifo->queue, AVERROR_EOF);
 
+if ((avf->flags & AVFMT_FLAG_NONBLOCK) &&
+!avpriv_atomic_int_get(>thread_finished_flag))
+   return AVERROR(EAGAIN);
+
 ret = pthread_join( fifo->writer_thread, NULL);
 if (ret < 0) {
 av_log(avf, AV_LOG_ERROR, "pthread join error: %s\n",
@@ -593,6 +632,16 @@ static void fifo_deinit(AVFormatContext *avf)
 {
 FifoContext *fifo = avf->priv_data;
 
+if (avf->flags & AVFMT_FLAG_NONBLOCK) {
+int ret;
+avpriv_atomic_int_set(>termination_requested, 1);
+ret = pthread_join( fifo->writer_thread, NULL);
+   

[FFmpeg-devel] [PATCH v8 01/11] avformat: Add fifo pseudo-muxer

2016-08-14 Thread sebechlebskyjan
From: Jan Sebechlebsky 

Signed-off-by: Jan Sebechlebsky 
---
 Changes since the last version of the patch:
 - Fixed documentation (apart from the Marton's suggestions I've
   also changed example, since it used block_on_overflow option
   from the earlier version of patch)
 - Changed max_recovery_attempts default value to 0 (unlimited)
 - Removed unnecessary check for null ptr in free_message
 - Changed log level when loggin recovery attempt to AV_LOG_VERBOSE
 
 Changelog|   1 +
 configure|   1 +
 doc/muxers.texi  |  92 +++
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/fifo.c   | 662 +++
 libavformat/version.h|   2 +-
 7 files changed, 759 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/fifo.c

diff --git a/Changelog b/Changelog
index b903e31..c693d34 100644
--- a/Changelog
+++ b/Changelog
@@ -15,6 +15,7 @@ version :
 - True Audio (TTA) muxer
 - crystalizer audio filter
 - acrusher audio filter
+- fifo muxer
 
 
 version 3.1:
diff --git a/configure b/configure
index bff8159..a252354 100755
--- a/configure
+++ b/configure
@@ -2834,6 +2834,7 @@ dv_muxer_select="dvprofile"
 dxa_demuxer_select="riffdec"
 eac3_demuxer_select="ac3_parser"
 f4v_muxer_select="mov_muxer"
+fifo_muxer_deps="pthreads"
 flac_demuxer_select="flac_parser"
 hds_muxer_select="flv_muxer"
 hls_muxer_select="mpegts_muxer"
diff --git a/doc/muxers.texi b/doc/muxers.texi
index 5873269..b4c3886 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1436,6 +1436,98 @@ Specify whether to remove all fragments when finished. 
Default 0 (do not remove)
 
 @end table
 
+@section fifo
+
+The fifo pseudo-muxer allows the separation of encoding and muxing by using
+first-in-first-out queue and running the actual muxer in a separate thread. 
This
+is especially useful in combination with the @ref{tee} muxer and can be used to
+send data to several destinations with different reliability/writing 
speed/latency.
+
+The behavior of the fifo muxer if the queue fills up or if the output fails is
+selectable,
+
+@itemize @bullet
+
+@item
+output can be transparently restarted with configurable delay between retries
+based on real time or time of the processed stream.
+
+@item
+encoding can be blocked during temporary failure, or continue transparently
+dropping packets in case fifo queue fills up.
+
+@end itemize
+
+@table @option
+
+@item fifo_format
+Specify the format name. Useful if it cannot be guessed from the
+output name suffix.
+
+@item queue_size
+Specify size of the queue (number of packets). Default value is 60.
+
+@item format_opts
+Specify format options for the underlying muxer. Muxer options can be specified
+as a list of @var{key}=@var{value} pairs separated by ':'.
+
+@item drop_pkts_on_overflow @var{bool}
+If set to 1 (true), in case the fifo queue fills up, packets will be dropped
+rather than blocking the encoder. This allows to continue streaming without
+delaying the input, at the cost of ommiting part of the stream. By default
+this option is set to 0 (false), so in such cases the encoder will be blocked
+until the muxer processes some of the packets and none of them is lost.
+
+@item attempt_recovery @var{bool}
+If failure occurs, attempt to recover the output. This is especially useful
+when used with network output, allows to restart streaming transparently.
+By default this option set to 0 (false).
+
+@item max_recovery_attempts
+Sets maximum number of successive unsucessful recovery attempts after which
+the output fails permanently. By default this option is set to 0 (unlimited).
+
+@item recovery_wait_time @var{duration}
+Waiting time before the next recovery attempt after previous unsuccessfull
+recovery attempt. Default value is 5 seconds.
+
+s@item recovery_wait_streamtime @var{bool}
+If set to 0 (false), the real time is used when waiting for the recovery
+attempt (i.e. the recovery will be attempted after at least
+recovery_wait_time seconds).
+If set to 1 (true), the time of the processed stream is taken into account
+instead (i.e. the recovery will be attempted after at least 
@var{recovery_wait_time}
+seconds of the stream is omitted).
+By default, this option is set to 0 (false).
+
+@item recover_any_error @var{bool}
+If set to 1 (true), recovery will be attempted regardless of type of the error
+causing the failure. By default this option is set to 0 (false) and in case of
+certain (usually permanent) errors the recovery is not attempted even when
+@var{attempt_recovery} is set to 1.
+
+@item restart_with_keyframe @var{bool}
+Specify whether to wait for the keyframe after recovering from
+queue overflow or failure. This option is set to 0 (false) by default.
+
+@end table
+
+@subsection Examples
+
+@itemize
+
+@item
+Stream something to rtmp server, continue processing the stream at real-time
+rate even in case of temporary 

Re: [FFmpeg-devel] [PATCH v7 01/11] avformat: Add fifo pseudo-muxer

2016-08-14 Thread Jan Sebechlebsky

On 08/14/2016 08:12 PM, Marton Balint wrote:




[...]


+@item max_recovery_attempts
+Sets maximum number of successive unsucessful recovery attempts 
after which
+the output fails permanently. Unlimited if set to zero. Default 
value is 16.


Maybe it's just me, but I'd set this to unlimited by default, since 
attempt_recovery is not enabled by default anyway.



That seems reasonable, I'll change that.

[...]


[...]


[...]

Otherwise it looks good to me, I don't think there is a reason to 
delay this any longer, so if you rebase the patch against the current 
git HEAD and fix my few comments, I will apply this in a day or two.


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

I'll fix the issues you mentioned and resend the patch.

Thank you!

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


Re: [FFmpeg-devel] [PATCH v7 01/11] avformat: Add fifo pseudo-muxer

2016-08-14 Thread Jan Sebechlebsky

On 08/14/2016 08:19 PM, Timothy Gu wrote:


On Sun, Aug 14, 2016 at 11:12 AM Marton Balint  wrote:


On Thu, 11 Aug 2016, sebechlebsky...@gmail.com wrote:

+@anchor tee

I still get error when building the docs:

doc/muxers.texi:1531: @anchor expected braces
doc/muxers.texi:1443: @ref reference to nonexistent node `tee'
make: *** [doc/ffmpeg-all.html] Error 1

@anchor{tee} should work.
Timothy
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Thank you!

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


[FFmpeg-devel] [PATCH] avcodec: wrapped avframe for audio

2016-08-14 Thread Paul B Mahol
Hi,

patch attached.


0001-avcodec-wrapped-avframe-for-audio.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v7 01/11] avformat: Add fifo pseudo-muxer

2016-08-14 Thread Timothy Gu
On Sun, Aug 14, 2016 at 11:12 AM Marton Balint  wrote:

> On Thu, 11 Aug 2016, sebechlebsky...@gmail.com wrote:
> > +@anchor tee
>
> I still get error when building the docs:
>
> doc/muxers.texi:1531: @anchor expected braces
> doc/muxers.texi:1443: @ref reference to nonexistent node `tee'
> make: *** [doc/ffmpeg-all.html] Error 1

@anchor{tee} should work.
Timothy
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/3] avformat: fix decoded creation_time timestamps

2016-08-14 Thread Marton Balint


On Fri, 1 Jul 2016, Marton Balint wrote:


Use proper ISO 8601 timestamps which also signal that they are in UTC.

This changes the format of creation_time and modification_date metadata values
from 2016-06-01 22:30:00 to 2016-01-01T22:30:00.00Z

Fixes ticket #5673.



I'd like to apply this soon as well. Changing the format of creation_time 
and modification_time in the metadata might be considered a hostile 
move against library users, so I would not mind some comments that it is 
OK. Maybe an entry in API changes is enough?


Thanks,
Marton


Signed-off-by: Marton Balint 
---
libavformat/matroskadec.c |  7 +--
libavformat/mov.c |  9 +
libavformat/mxfdec.c  | 14 --
libavformat/version.h |  2 +-
4 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index f3d701f..82ff2ba 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1691,13 +1691,8 @@ static int matroska_aac_sri(int samplerate)

static void matroska_metadata_creation_time(AVDictionary **metadata, int64_t 
date_utc)
{
-char buffer[32];
/* Convert to seconds and adjust by number of seconds between 2001-01-01 
and Epoch */
-time_t creation_time = date_utc / 10 + 978307200;
-struct tm tmpbuf, *ptm = gmtime_r(_time, );
-if (!ptm) return;
-if (strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", ptm))
-av_dict_set(metadata, "creation_time", buffer, 0);
+avpriv_dict_set_timestamp(metadata, "creation_time", date_utc / 1000 + 
9783072LL);
}

static int matroska_parse_flac(AVFormatContext *s,
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 485bb0b..cb9490c 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1155,17 +1155,10 @@ static int mov_read_moof(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)

static void mov_metadata_creation_time(AVDictionary **metadata, int64_t time)
{
-char buffer[32];
if (time) {
-struct tm *ptm, tmbuf;
-time_t timet;
if(time >= 2082844800)
time -= 2082844800;  /* seconds between 1904-01-01 and Epoch */
-timet = time;
-ptm = gmtime_r(, );
-if (!ptm) return;
-if (strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", ptm))
-av_dict_set(metadata, "creation_time", buffer, 0);
+avpriv_dict_set_timestamp(metadata, "creation_time", time * 100);
}
}

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 0affca9..0b16463 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -50,6 +50,7 @@
#include "libavutil/mathematics.h"
#include "libavcodec/bytestream.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/parseutils.h"
#include "libavutil/timecode.h"
#include "avformat.h"
#include "internal.h"
@@ -2159,7 +2160,7 @@ fail_and_free:
return ret;
}

-static int mxf_timestamp_to_str(uint64_t timestamp, char **str)
+static int64_t mxf_timestamp_to_int64(uint64_t timestamp)
{
struct tm time = { 0 };
time.tm_year = (timestamp >> 48) - 1900;
@@ -2178,13 +2179,7 @@ static int mxf_timestamp_to_str(uint64_t timestamp, char 
**str)
time.tm_min  = av_clip(time.tm_min,  0, 59);
time.tm_sec  = av_clip(time.tm_sec,  0, 59);

-*str = av_mallocz(32);
-if (!*str)
-return AVERROR(ENOMEM);
-if (!strftime(*str, 32, "%Y-%m-%d %H:%M:%S", ))
-(*str)[0] = '\0';
-
-return 0;
+return (int64_t)av_timegm() * 100;
}

#define SET_STR_METADATA(pb, name, str) do { \
@@ -2202,9 +2197,8 @@ static int mxf_timestamp_to_str(uint64_t timestamp, char 
**str)

#define SET_TS_METADATA(pb, name, var, str) do { \
var = avio_rb64(pb); \
-if ((ret = mxf_timestamp_to_str(var, )) < 0) \
+if ((ret = avpriv_dict_set_timestamp(>metadata, name, 
mxf_timestamp_to_int64(var)) < 0)) \
return ret; \
-av_dict_set(>metadata, name, str, AV_DICT_DONT_STRDUP_VAL); \
} while (0)

static int mxf_read_identification_metadata(void *arg, AVIOContext *pb, int 
tag, int size, UID _uid, int64_t klv_offset)
diff --git a/libavformat/version.h b/libavformat/version.h
index 47a8afb..6e23f74 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -33,7 +33,7 @@
// Also please add any ticket numbers that you belive might be affected here
#define LIBAVFORMAT_VERSION_MAJOR  57
#define LIBAVFORMAT_VERSION_MINOR  41
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 101

#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
   LIBAVFORMAT_VERSION_MINOR, \
--
2.6.6

___
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 1/1] All sun4 machines are SPARCs, not just sun4u

2016-08-14 Thread Maya Rashish
Allow building on sun4v
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index bff8159..9b92426 100755
--- a/configure
+++ b/configure
@@ -4212,7 +4212,7 @@ case "$arch" in
 sh4|sh)
 arch="sh4"
 ;;
-sun4u|sparc*)
+sun4*|sparc*)
 arch="sparc"
 ;;
 tilegx|tile-gx)
-- 
2.9.0

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


Re: [FFmpeg-devel] [PATCHv2 2/3] avformat: factorize iso 8601 timestamp writer to a dictionary avutil function

2016-08-14 Thread Marton Balint



On Mon, 11 Jul 2016, Marton Balint wrote:



On Sat, 2 Jul 2016, James Almer wrote:


On 7/2/2016 7:10 PM, Marton Balint wrote:

Signed-off-by: Marton Balint 
---
 libavformat/internal.h |  1 +
 libavformat/utils.c| 16 ++--
 libavutil/dict.c   | 17 +
 libavutil/internal.h   | 10 ++
 4 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/libavformat/internal.h b/libavformat/internal.h
index 647ad65..3ec4b0c 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -24,6 +24,7 @@
 #include 

 #include "libavutil/bprint.h"
+#include "libavutil/internal.h"


utils.c already includes this, so no need to include it here.

Don't resend the patch just for this. Wait for a real review, or
locally fix and apply if there's no need for another patch revision.


Thanks, fixed locally. Ping for the patch and for the rest of the series.



Will apply this soon.

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


Re: [FFmpeg-devel] [PATCH 2/2] MAINTAINERS: Add myself as maintainer of fifo muxer

2016-08-14 Thread Marton Balint



On Mon, 25 Jul 2016, sebechlebsky...@gmail.com wrote:


From: Jan Sebechlebsky 

Signed-off-by: Jan Sebechlebsky 
---
MAINTAINERS | 1 +
1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 6d4c9f9..0e66170 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -164,6 +164,7 @@ Codecs:
  exif.c, exif.hThilo Borgmann
  ffv1* Michael Niedermayer
  ffwavesynth.c Nicolas George
+  fifo.cJan Sebechlebsky
  flicvideo.c   Mike Melanson
  g722.cMartin Storsjo
  g726.cRoman Shaposhnik


LGTM, will apply after the fifo patch.

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


Re: [FFmpeg-devel] [PATCH v7 01/11] avformat: Add fifo pseudo-muxer

2016-08-14 Thread Marton Balint


On Thu, 11 Aug 2016, sebechlebsky...@gmail.com wrote:


From: Jan Sebechlebsky 

Signed-off-by: Jan Sebechlebsky 
---
Changes since the last version of the patch:
- Fixed thread include (old patch included pthread.h directly)


[...]


--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1436,6 +1436,99 @@ Specify whether to remove all fragments when finished. 
Default 0 (do not remove)

@end table

+@section fifo
+
+The fifo pseudo-muxer allows the separation of encoding and muxing by using
+first-in-first-out queue and running the actual muxer in a separate thread. 
This
+is especially useful in combination with the @ref{tee} muxer and output to
+several destinations with different reliability/writing speed/latency.


... in combination with the tee muxer and can be used to send data to 
several ...


[...]


+@item max_recovery_attempts
+Sets maximum number of successive unsucessful recovery attempts after which
+the output fails permanently. Unlimited if set to zero. Default value is 16.


Maybe it's just me, but I'd set this to unlimited by default, since 
attempt_recovery is not enabled by default anyway.


[...]


+@anchor tee


I still get error when building the docs:

doc/muxers.texi:1531: @anchor expected braces
doc/muxers.texi:1443: @ref reference to nonexistent node `tee'
make: *** [doc/ffmpeg-all.html] Error 1

[...]


+static void free_message(void *msg)
+{
+FifoMessage *fifo_msg = msg;
+
+if (!fifo_msg)
+return;


This check might not be needed anymore.

[...]


+if (fifo->max_recovery_attempts) {
+av_log(avf, AV_LOG_INFO, "Recovery attempt #%d/%d\n",
+   ctx->recovery_nr, fifo->max_recovery_attempts);
+} else {
+av_log(avf, AV_LOG_INFO, "Recovery attempt #%d\n",
+   ctx->recovery_nr);
+}


AV_LOG_VERBOSE might be enough for these two messages.

[...]

Otherwise it looks good to me, I don't think there is a reason to delay 
this any longer, so if you rebase the patch against the current git HEAD 
and fix my few comments, I will apply this in a day or two.


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


Re: [FFmpeg-devel] [REMINDER] VideoLAN Dev Days 2016

2016-08-14 Thread compn
On Fri, 12 Aug 2016 12:01:58 +0200
Thilo Borgmann  wrote:

> Hi!
> 
> Am 09.08.16 um 23:01 schrieb Jean-Baptiste Kempf:
> > My fellow members of the ffmpeg development community,
> > 
> > As it is now customary, I'd like to invite you to VideoLAN Dev Days
> > 2016, on the 1st week-end of September: 2-4 September 2016, in
> > Berlin.
> 
> I'm just aware of Thomas Volkert and myself who are attending for
> sure.
> 
> Who else is planning to come?

i'm planning to go. it will be interesting for me to see this qtcon as
well :)

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


Re: [FFmpeg-devel] [PATCH] avcodec: Remove libfaac, the internal AAC encoder is better

2016-08-14 Thread Rostislav Pehlivanov
On 14 August 2016 at 16:10, Carl Eugen Hoyos  wrote:

> Hi!
>
> Needs a corresponding news entry imo.
>
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

As in the changelog or the website news? I don't think it's big enough for
website news, but certainly for the changelog.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Subject: [PATCH] libavcodec/qsvdec_h2645.c: switch to the new BSF API

2016-08-14 Thread Ivan Uskov

Hello Michael,

Sunday, August 7, 2016, 8:18:54 PM, you wrote:

> On Sun, Jul 24, 2016 at 10:05:27PM +0300, Ivan Uskov wrote:
>> Hello All,
>> 
>> This patch applies same changes as commit 
>> e3dfef8e3c85a64dbe6388117303f5819fa3c6a2
>> of libav: instead obsolete AVBitStreamFilterContext now new AVBSFContext
>> filter uses to restore annex-B prefixes. 
>> 
>> Please review.
>>   
>> 
>> -- 
>> Best regards,
>>  Ivan  mailto:ivan.us...@nablet.com

>>  qsvdec_h2645.c |  138 
>> -
>>  1 file changed, 107 insertions(+), 31 deletions(-)
>> db4e17da2ddf056018cd049164c77f0073fde1bc  
>> 0001-libavcodec-qsvdec_h2645.c-switch-to-the-new-BSF-API.patch
>> From 70b9f600ffbdc67010aca757dd4cf401f3377078 Mon Sep 17 00:00:00 2001
>> From: Ivan Uskov 
>> Date: Sun, 24 Jul 2016 14:04:36 -0400
>> Subject: [PATCH] libavcodec/qsvdec_h2645.c: switch to the new BSF API This
>>  patch applies same changes as commit 
>> e3dfef8e3c85a64dbe6388117303f5819fa3c6a2
>>  of libav: instead obsolete AVBitStreamFilterContext now new AVBSFContext
>>  filter uses to restore annex-B prefixes.

> Is it correct to say that this commit is
> "Based-on: e3dfef8e3c85a64dbe6388117303f5819fa3c6a2 by Anton Khirnov" ?
Yes, in general it based on this commit, only minor adaptations (ffmpeg use
different function names into the qsvdec.c)


> [...]




-- 
Best regards,
 Ivanmailto:ivan.us...@nablet.com

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


[FFmpeg-devel] [PATCH] avfilter: add bitplanenoise filter

2016-08-14 Thread Paul B Mahol
Hi,

patch attached.


0001-avfilter-add-bitplanenoise-filter.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec: Remove libfaac, the internal AAC encoder is better

2016-08-14 Thread Carl Eugen Hoyos
Hi!

Needs a corresponding news entry imo.

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


Re: [FFmpeg-devel] [PATCH] avcodec: Remove libfaac, the internal AAC encoder is better

2016-08-14 Thread Rostislav Pehlivanov
On 10 April 2016 at 16:38, Kieran Kunhya  wrote:

> ---
>  Changelog  |   1 +
>  configure  |   6 --
>  doc/encoders.texi  | 105 -
>  doc/ffserver.conf  |   2 +-
>  doc/general.texi   |   2 +-
>  doc/muxers.texi|   4 +-
>  doc/platform.texi  |   2 +-
>  libavcodec/Makefile|   1 -
>  libavcodec/allcodecs.c |   1 -
>  libavcodec/libfaac.c   | 248 --
> ---
>  libavcodec/version.h   |   2 +-
>  11 files changed, 7 insertions(+), 367 deletions(-)
>  delete mode 100644 libavcodec/libfaac.c
>
> diff --git a/Changelog b/Changelog
> index b4a4dd7..7bcb0c4 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -22,6 +22,7 @@ version :
>  - musx demuxer
>  - aix demuxer
>  - remap filter
> +- libfaac removed
>
>  version 3.0:
>  - Common Encryption (CENC) MP4 encoding and decoding support
> diff --git a/configure b/configure
> index 94a66d8..32d710d 100755
> --- a/configure
> +++ b/configure
> @@ -219,7 +219,6 @@ External library support:
>--enable-libcdio enable audio CD grabbing with libcdio [no]
>--enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
> and libraw1394 [no]
> -  --enable-libfaac enable AAC encoding via libfaac [no]
>--enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
>--enable-libfliteenable flite (voice synthesis) support via
> libflite [no]
>--enable-libfreetype enable libfreetype, needed for drawtext filter
> [no]
> @@ -1467,7 +1466,6 @@ EXTERNAL_LIBRARY_LIST="
>  libcdio
>  libcelt
>  libdc1394
> -libfaac
>  libfdk_aac
>  libflite
>  libfontconfig
> @@ -2673,8 +2671,6 @@ pcm_mulaw_at_encoder_select="audio_frame_queue"
>  chromaprint_muxer_deps="chromaprint"
>  h264_videotoolbox_encoder_deps="videotoolbox_encoder pthreads"
>  libcelt_decoder_deps="libcelt"
> -libfaac_encoder_deps="libfaac"
> -libfaac_encoder_select="audio_frame_queue"
>  libfdk_aac_decoder_deps="libfdk_aac"
>  libfdk_aac_encoder_deps="libfdk_aac"
>  libfdk_aac_encoder_select="audio_frame_queue"
> @@ -4946,7 +4942,6 @@ die_license_disabled gpl libxvid
>  die_license_disabled gpl x11grab
>
>  die_license_disabled nonfree cuda
> -die_license_disabled nonfree libfaac
>  die_license_disabled nonfree nvenc
>  enabled gpl && die_license_disabled_gpl nonfree libfdk_aac
>  enabled gpl && die_license_disabled_gpl nonfree openssl
> @@ -5534,7 +5529,6 @@ enabled libcelt   && require libcelt
> celt/celt.h celt_decode -lcelt0 &&
>   { check_lib celt/celt.h
> celt_decoder_create_custom -lcelt0 ||
> die "ERROR: libcelt must be installed and
> version must be >= 0.11.0."; }
>  enabled libcaca   && require_pkg_config caca caca.h
> caca_create_canvas
> -enabled libfaac   && require2 libfaac "stdint.h faac.h"
> faacEncGetVersion -lfaac
>  enabled libfdk_aac&& { use_pkg_config fdk-aac
> "fdk-aac/aacenc_lib.h" aacEncOpen ||
> { require libfdk_aac fdk-aac/aacenc_lib.h
> aacEncOpen -lfdk-aac &&
>   warn "using libfdk without pkg-config";
> } }
> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index f38cad3..5c09136 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -611,111 +611,6 @@ and slightly improves compression.
>
>  @end table
>
> -@anchor{libfaac}
> -@section libfaac
> -
> -libfaac AAC (Advanced Audio Coding) encoder wrapper.
> -
> -This encoder is of much lower quality and is more unstable than any other
> AAC
> -encoders, so it's highly recommended to instead use other encoders, like
> -@ref{aacenc,,the native FFmpeg AAC encoder}.
> -
> -This encoder also requires the presence of the libfaac headers and library
> -during configuration. You need to explicitly configure the build with
> -@code{--enable-libfaac --enable-nonfree}.
> -
> -@subsection Options
> -
> -The following shared FFmpeg codec options are recognized.
> -
> -The following options are supported by the libfaac wrapper. The
> -@command{faac}-equivalent of the options are listed in parentheses.
> -
> -@table @option
> -@item b (@emph{-b})
> -Set bit rate in bits/s for ABR (Average Bit Rate) mode. If the bit rate
> -is not explicitly specified, it is automatically set to a suitable
> -value depending on the selected profile. @command{faac} bitrate is
> -expressed in kilobits/s.
> -
> -Note that libfaac does not support CBR (Constant Bit Rate) but only
> -ABR (Average Bit Rate).
> -
> -If VBR mode is enabled this option is ignored.
> -
> -@item ar (@emph{-R})
> -Set audio sampling rate (in Hz).
> -
> -@item ac (@emph{-c})
> -Set the number of audio channels.
> -
> -@item cutoff (@emph{-C})
> -Set cutoff frequency. If not specified (or explicitly set to 0) it
> -will use a value automatically computed by the library. Default value
> -is 0.
> -
> -@item 

Re: [FFmpeg-devel] [PATCH] libavcodec/mmaldec.c: add interlaced_frame and format struct to AVFrame for deinterlacing]

2016-08-14 Thread Jens Ziller
Am Samstag, den 13.08.2016, 13:16 +0200 schrieb Jens Ziller:
> Am Freitag, den 12.08.2016, 17:12 +0200 schrieb Michael Niedermayer:
> > 
> > On Sun, Jul 31, 2016 at 07:09:26PM +0200, Jens Ziller wrote:
> > > 
> > > 
> > > Am Sonntag, den 31.07.2016, 16:33 +0100 schrieb Mark Thompson:
> > > > 
> > > > 
> > > > On 31/07/16 15:51, Jens Ziller wrote:
> > > > > 
> > > > > 
> > > > > 
> > > > > Am Samstag, den 30.07.2016, 17:30 +0100 schrieb Mark
> > > > > Thompson:
> > [...]
> > > 
> > > 
> > > > 
> > > > 
> > > > Consider this sequence, where we want to decode a single image
> > > > and
> > > > then do something with it:
> > > > 
> > > > open decoder
> > > > decode frame
> > > > close decoder
> > > > open 
> > > > give it the frame we got from the decoder
> > > > 
> > > > To me that looks like it will invoke undefined behaviour
> > > > (segfault or
> > > > read garbage) when trying to access data[2] in the second
> > > > component,
> > > > because the pointer appears to be to the MMAL_ES_FORMAT_T in
> > > > the
> > > > MMAL_PORT_T on the decoder which we just destroyed.  If not,
> > > > where is
> > > > the reference which keeps that pointer valid living?
> > > With MMAL decoder it works:
> > > 
> > > - configure decoder
> > > - send many frames (in my tests between 5 and 20+) to decoder
> > > - decoder give MMAL_ES_FORMAT_T
> > > - configure decoder output port with given struct <- here we have
> > > the
> > > pointer
> > > - decoder send the first decoded frame
> > > 
> > > The struct lives before the first frame is available. Decode a
> > > single
> > > frame is a spezial thing. The MMAL decoder is not made for this.
> > > 
> > > A
> > > local copy from format struct make no sense for me.
> > well, it makes sense to us for the code to work and not have
> > undefined
> > behavior.
> > Please correct me if iam wrong but Hendrik, Mark and me are saying
> > the same thing more or less, i think you should change the patch
> > 
> > also additionally, its nice if we can keep data[0..2] available for
> > the raw 3 YUV planes, it might one day somewhere be nice to
> > download
> > the raw data into [0..2], using up the 2nd for this struct is not
> > pretty
> For YUV planes AV_PIX_FMT_YUV420P are the better choice
> not AV_PIX_FMT_MMAL. 
> But you have me convinced that I write a new patch, test it and send
> it
> to the ml.
> 
Here are the new version. No data[2] pointer more. For this AVFrame
top_field_first and AVCodecContext->framerate is used.

regards jensFrom 66f0e12eb3e7d83113b76d8e0a71d0da328de195 Mon Sep 17 00:00:00 2001
From: Jens Ziller 
Date: Sun, 14 Aug 2016 16:44:39 +0200
Subject: [PATCH] v5 fill AVFrame->interlaced_frame and top_field_first with
 MMAL_PARAMETER_VIDEO_INTERLACE_TYPE_T and AVCodecContext->framerate from
 MMAL_ES_FORMAT_T for deinterlacer and renderer

---
 libavcodec/mmaldec.c | 20 
 1 file changed, 20 insertions(+)

diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c
index 099a8c5..56ad948 100644
--- a/libavcodec/mmaldec.c
+++ b/libavcodec/mmaldec.c
@@ -88,6 +88,8 @@ typedef struct MMALDecodeContext {
 int eos_received;
 int eos_sent;
 int extradata_sent;
+int interlaced_frame;
+int top_field_first;
 } MMALDecodeContext;
 
 // Assume decoder is guaranteed to produce output after at least this many
@@ -274,6 +276,7 @@ static int ffmal_update_format(AVCodecContext *avctx)
 int ret = 0;
 MMAL_COMPONENT_T *decoder = ctx->decoder;
 MMAL_ES_FORMAT_T *format_out = decoder->output[0]->format;
+MMAL_PARAMETER_VIDEO_INTERLACE_TYPE_T interlace_type;
 
 ffmmal_poolref_unref(ctx->pool_out);
 if (!(ctx->pool_out = av_mallocz(sizeof(*ctx->pool_out {
@@ -300,6 +303,16 @@ static int ffmal_update_format(AVCodecContext *avctx)
 if ((status = mmal_port_format_commit(decoder->output[0])))
 goto fail;
 
+interlace_type.hdr.id = MMAL_PARAMETER_VIDEO_INTERLACE_TYPE;
+interlace_type.hdr.size = sizeof(MMAL_PARAMETER_VIDEO_INTERLACE_TYPE_T);
+status = mmal_port_parameter_get(decoder->output[0], _type.hdr);
+if (status != MMAL_SUCCESS) {
+av_log(avctx, AV_LOG_ERROR, "Cannot read MMAL interlace information!\n");
+} else {
+ctx->interlaced_frame = (interlace_type.eMode != MMAL_InterlaceProgressive);
+ctx->top_field_first = (interlace_type.eMode == MMAL_InterlaceFieldsInterleavedUpperFirst);
+}
+
 if ((ret = ff_set_dimensions(avctx, format_out->es->video.crop.x + format_out->es->video.crop.width,
 format_out->es->video.crop.y + format_out->es->video.crop.height)) < 0)
 goto fail;
@@ -308,6 +321,10 @@ static int ffmal_update_format(AVCodecContext *avctx)
 avctx->sample_aspect_ratio.num = format_out->es->video.par.num;
 avctx->sample_aspect_ratio.den = format_out->es->video.par.den;
 }
+if (format_out->es->video.frame_rate.num && format_out->es->video.frame_rate.den) {
+

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

2016-08-14 Thread Clément Bœsch
On Wed, Aug 10, 2016 at 07:35:00PM -0700, Sasi Inguva wrote:
[...]
> +/**
> + * Get ith edit list entry (media time, duration).
> + */
> +static int get_edit_list_entry(MOVStreamContext *msc,

msc should be marked as const

> +   unsigned int edit_list_index,
> +   int64_t *edit_list_media_time,
> +   int64_t *edit_list_duration,
> +   int64_t global_timescale)
> +{
> +if (edit_list_index == msc->elst_count) {
> +return 0;
> +}
> +*edit_list_media_time = msc->elst_data[edit_list_index].time;
> +*edit_list_duration = msc->elst_data[edit_list_index].duration;

> +/* duration is in global timescale units;convert to msc timescale */
> +*edit_list_duration *= msc->time_scale;
> +*edit_list_duration /= global_timescale;

it looks like this may overflow; you should use one of the av_rescale*
function

> +return 1;
> +}
> +
> +/**
> + * Find the closest previous keyframe to the timestamp, in e_old index
> + * entries.
> + * Returns the index of the entry in st->index_entries if successful,
> + * else returns -1.
> + */
> +static int64_t find_prev_closest_keyframe_index(AVStream *st,
> +AVIndexEntry *e_old,
> +int nb_old,
> +int64_t timestamp,
> +int flag)
> +{
> +AVIndexEntry *e_keep = st->index_entries;
> +int nb_keep = st->nb_index_entries;
> +int64_t found = -1;
> +
> +st->index_entries = e_old;
> +st->nb_index_entries = nb_old;
> +found = av_index_search_timestamp(st, timestamp, flag | 
> AVSEEK_FLAG_BACKWARD);
> +

> +/* restore AVStream  state*/

nit: misplaced space

> +st->index_entries = e_keep;
> +st->nb_index_entries = nb_keep;
> +return found;
> +}
> +
> +/**
> + * Add index entry with the given values, to the end of st->index_entries.
> + * Returns the new size st->index_entries if successful, else returns -1.
> + */
> +static int64_t add_index_entry(AVStream *st, int64_t pos, int64_t timestamp,
> +   int size, int distance, int flags)
> +{
> +AVIndexEntry *entries, *ie;
> +int64_t index = -1;
> +const size_t min_size_needed = (st->nb_index_entries + 1) * 
> sizeof(AVIndexEntry);
> +const size_t requested_size =
> +min_size_needed > st->index_entries_allocated_size ?
> +FFMAX(min_size_needed, 2 * st->index_entries_allocated_size) :
> +min_size_needed;
> +
> +if((unsigned)st->nb_index_entries + 1 >= UINT_MAX / sizeof(AVIndexEntry))
> +return -1;
> +
> +entries = av_fast_realloc(st->index_entries,
> +  >index_entries_allocated_size,
> +  requested_size);
> +if(!entries)
> +return -1;
> +
> +st->index_entries= entries;
> +
> +index= st->nb_index_entries++;
> +ie= [index];

> +assert(!index || ie[-1].timestamp <= timestamp);

we use av_assert*

> +
> +ie->pos = pos;
> +ie->timestamp = timestamp;
> +ie->min_distance= distance;
> +ie->size= size;
> +ie->flags = flags;
> +return index;
> +}

This function somehow looks like a copy of an old version of
ff_add_index_entry() (I'm hinted by the coding style); it would be nice to
keep differences as small as possible, and maybe hint about similarity and
the reason why it differs

[...]
> diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
> new file mode 100644
> index 000..5b3a187
> --- /dev/null
> +++ b/tests/fate/mov.mak
> @@ -0,0 +1,28 @@

> +FATE_MOV = fate-mov-3elist \
> +fate-mov-3elist-1ctts \
> +fate-mov-1elist-1ctts \
> +fate-mov-1elist-noctts \
> +fate-mov-elist-starts-ctts-2ndsample \
> +fate-mov-1elist-ends-last-bframe \
> +fate-mov-2elist-elist1-ends-bframe
> +

You have tabs here that should be replaced with spaces

> +FATE_SAMPLES_AVCONV += $(FATE_MOV)
> +
> +fate-mov: $(FATE_MOV)
> +
> +# Make sure we handle edit lists correctly in normal cases.
> +fate-mov-1elist-noctts: CMD = framemd5 -i 
> $(TARGET_SAMPLES)/mov/mov-1elist-noctts.mov
> +fate-mov-1elist-1ctts: CMD = framemd5 -i 
> $(TARGET_SAMPLES)/mov/mov-1elist-1ctts.mov
> +fate-mov-3elist: CMD = framemd5 -i $(TARGET_SAMPLES)/mov/mov-3elist.mov
> +fate-mov-3elist-1ctts: CMD = framemd5 -i 
> $(TARGET_SAMPLES)/mov/mov-3elist-1ctts.mov
> +
> +# Makes sure that the CTTS is also modified when we fix avindex in mov.c 
> while parsing edit lists.
> +fate-mov-elist-starts-ctts-2ndsample: CMD = framemd5 -i 
> $(TARGET_SAMPLES)/mov/mov-elist-starts-ctts-2ndsample.mov
> +
> +# Makes sure that we handle edit lists ending on a B-frame correctly.
> +# The last frame in decoding order which is B-frame should be output, but 
> the last but-one P-frame shouldn't be
> +# output.
> 

Re: [FFmpeg-devel] [PATCH 3/4] lavc: Add a flag in AVPacket to discard packet after decoding. Discard frames after decoding based on the flag.

2016-08-14 Thread Clément Bœsch
On Tue, Aug 09, 2016 at 06:48:21PM -0700, Sasi Inguva wrote:
[...]
> +if ((frame->flags & AV_FRAME_FLAG_DISCARD) && 
> avctx->internal->skip_samples <= 0) {

skip_samples can be negative?

if so, that looks like a behaviour change we want documented

if not, you probably want to check against 0 equality and add an assert.

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH v2 01/12] lavc/videotoolboxenc: Use shared pixel buffer pool

2016-08-14 Thread crossle song
on iOS when enter background got Could not get pixel buffer pool. error
How about videotoolbox run on background?

On Wed, Apr 27, 2016 at 12:00 AM, Richard Kern  wrote:

>
> > On Apr 26, 2016, at 8:14 AM, Carl Eugen Hoyos  wrote:
> >
> > Richard Kern  gmail.com> writes:
> >
>  static const enum AVPixelFormat pix_fmts[] = {
> AV_PIX_FMT_NV12,
>  -#if !TARGET_OS_IPHONE
> AV_PIX_FMT_YUV420P,
>  -#endif
> AV_PIX_FMT_NONE
> >>>
> >>> Sorry: How is this related?
> >> Using a shared pixel buffer pool also sets up an internal
> >> color converter when needed.
> >
> > And is this generally wanted?
> > (I assume so.)
> The pool? Probably. Using it reduces memcpy calls in the media server
> process.
>
> I dug into this a little - yuv420p is supported natively (at least on some
> devices), so it shouldn’t have been excluded in the first place.
>
> >
> > 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
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel