[FFmpeg-cvslog] doc/filter_design: Remove reference to the deprecated and unused cur_buf_copy

2015-08-16 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
Aug 16 04:00:26 2015 +0200| [31d6f8de53bfda9e6e4b80fefffd899372a2d401] | 
committer: Michael Niedermayer

doc/filter_design: Remove reference to the deprecated and unused cur_buf_copy

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=31d6f8de53bfda9e6e4b80fefffd899372a2d401
---

 doc/filter_design.txt |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/filter_design.txt b/doc/filter_design.txt
index fca24a9..d784d84 100644
--- a/doc/filter_design.txt
+++ b/doc/filter_design.txt
@@ -98,7 +98,7 @@ Buffer references ownership and permissions
 The AVFilterLink structure has a few AVFilterBufferRef fields. The
 cur_buf and out_buf were used with the deprecated
 start_frame/draw_slice/end_frame API and should no longer be used.
-src_buf, cur_buf_copy and partial_buf are used by libavfilter internally
+src_buf and partial_buf are used by libavfilter internally
 and must not be accessed by filters.
 
   Reference permissions

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


[FFmpeg-cvslog] lavf/matroskadec: Fully parse and repack MP3 packets

2015-08-16 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs  | Sun Aug 16 
03:06:04 2015 -0500| [b4b2717ffe89940999eeca7317190f729b27f472] | committer: 
Michael Niedermayer

lavf/matroskadec: Fully parse and repack MP3 packets

Fixes https://trac.ffmpeg.org/ticket/4776

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b4b2717ffe89940999eeca7317190f729b27f472
---

 libavformat/matroskadec.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 1807cae..43ad9af 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2065,7 +2065,9 @@ static int matroska_parse_tracks(AVFormatContext *s)
 st->codec->channels= track->audio.channels;
 if (!st->codec->bits_per_coded_sample)
 st->codec->bits_per_coded_sample = track->audio.bitdepth;
-if (st->codec->codec_id != AV_CODEC_ID_AAC)
+if (st->codec->codec_id == AV_CODEC_ID_MP3)
+st->need_parsing = AVSTREAM_PARSE_FULL;
+else if (st->codec->codec_id != AV_CODEC_ID_AAC)
 st->need_parsing = AVSTREAM_PARSE_HEADERS;
 if (track->codec_delay > 0) {
 st->codec->delay = av_rescale_q(track->codec_delay,

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


[FFmpeg-cvslog] avfilter/avfiltergraph: Implement and use find_best_sample_fmt_of_2()

2015-08-16 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
Aug 16 14:59:18 2015 +0200| [0cb87cd7d4cf253ae7299b9fae4176b9bd8ef058] | 
committer: Michael Niedermayer

avfilter/avfiltergraph: Implement and use find_best_sample_fmt_of_2()

Similar to the pixel format code

Fixes Ticket3847

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0cb87cd7d4cf253ae7299b9fae4176b9bd8ef058
---

 libavfilter/avfiltergraph.c |   47 +++
 1 file changed, 47 insertions(+)

diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index bac0da1..bd3853f 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -631,6 +631,40 @@ static int query_formats(AVFilterGraph *graph, AVClass 
*log_ctx)
 return 0;
 }
 
+static int get_fmt_score(enum AVSampleFormat dst_fmt, enum AVSampleFormat 
src_fmt)
+{
+int score = 0;
+
+if (av_sample_fmt_is_planar(dst_fmt) != av_sample_fmt_is_planar(src_fmt))
+score ++;
+
+if (av_get_bytes_per_sample(dst_fmt) < av_get_bytes_per_sample(src_fmt)) {
+score += 100 * (av_get_bytes_per_sample(src_fmt) - 
av_get_bytes_per_sample(dst_fmt));
+}else
+score += 10  * (av_get_bytes_per_sample(dst_fmt) - 
av_get_bytes_per_sample(src_fmt));
+
+if (av_get_packed_sample_fmt(dst_fmt) == AV_SAMPLE_FMT_S32 &&
+av_get_packed_sample_fmt(src_fmt) == AV_SAMPLE_FMT_FLT)
+score += 20;
+
+if (av_get_packed_sample_fmt(dst_fmt) == AV_SAMPLE_FMT_FLT &&
+av_get_packed_sample_fmt(src_fmt) == AV_SAMPLE_FMT_S32)
+score += 2;
+
+return score;
+}
+
+static enum AVSampleFormat find_best_sample_fmt_of_2(enum AVSampleFormat 
dst_fmt1, enum AVSampleFormat dst_fmt2,
+ enum AVSampleFormat 
src_fmt)
+{
+int score1, score2;
+
+score1 = get_fmt_score(dst_fmt1, src_fmt);
+score2 = get_fmt_score(dst_fmt2, src_fmt);
+
+return score1 < score2 ? dst_fmt1 : dst_fmt2;
+}
+
 static int pick_format(AVFilterLink *link, AVFilterLink *ref)
 {
 if (!link || !link->in_formats)
@@ -650,6 +684,19 @@ static int pick_format(AVFilterLink *link, AVFilterLink 
*ref)
av_get_pix_fmt_name(ref->format), has_alpha);
 link->in_formats->formats[0] = best;
 }
+} else if (link->type == AVMEDIA_TYPE_AUDIO) {
+if(ref && ref->type == AVMEDIA_TYPE_AUDIO){
+enum AVSampleFormat best= AV_SAMPLE_FMT_NONE;
+int i;
+for (i=0; iin_formats->nb_formats; i++) {
+enum AVSampleFormat p = link->in_formats->formats[i];
+best = find_best_sample_fmt_of_2(best, p, ref->format);
+}
+av_log(link->src,AV_LOG_DEBUG, "picking %s out of %d ref:%s\n",
+   av_get_sample_fmt_name(best), link->in_formats->nb_formats,
+   av_get_sample_fmt_name(ref->format));
+link->in_formats->formats[0] = best;
+}
 }
 
 link->in_formats->nb_formats = 1;

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


[FFmpeg-cvslog] ffmpeg: use av_buffersrc_add_frame instead of av_buffersrc_add_ref

2015-08-16 Thread Andreas Cadhalpun
ffmpeg | branch: master | Andreas Cadhalpun  
| Sat Aug  8 10:41:32 2015 +0200| [fbc8eb68578469f8b4d91bf5290d5439ff7398cb] | 
committer: Andreas Cadhalpun

ffmpeg: use av_buffersrc_add_frame instead of av_buffersrc_add_ref

Reviewed-by: Michael Niedermayer 
Signed-off-by: Andreas Cadhalpun 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fbc8eb68578469f8b4d91bf5290d5439ff7398cb
---

 ffmpeg.c |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index d20f56b..07ce4af 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -295,7 +295,7 @@ static void sub2video_flush(InputStream *ist)
 if (ist->sub2video.end_pts < INT64_MAX)
 sub2video_update(ist, NULL);
 for (i = 0; i < ist->nb_filters; i++)
-av_buffersrc_add_ref(ist->filters[i]->filter, NULL, 0);
+av_buffersrc_add_frame(ist->filters[i]->filter, NULL);
 }
 
 /* end of sub2video hack */
@@ -2246,11 +2246,7 @@ static int send_filter_eof(InputStream *ist)
 {
 int i, ret;
 for (i = 0; i < ist->nb_filters; i++) {
-#if 1
-ret = av_buffersrc_add_ref(ist->filters[i]->filter, NULL, 0);
-#else
 ret = av_buffersrc_add_frame(ist->filters[i]->filter, NULL);
-#endif
 if (ret < 0)
 return ret;
 }

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


[FFmpeg-cvslog] buffersink: introduce FIFO_INIT_ELEMENT_SIZE to complement FIFO_INIT_SIZE

2015-08-16 Thread Andreas Cadhalpun
ffmpeg | branch: master | Andreas Cadhalpun  
| Sun Aug 16 17:57:36 2015 +0200| [d90fbde06a800d151c420ca32e4e0a015b9076f9] | 
committer: Andreas Cadhalpun

buffersink: introduce FIFO_INIT_ELEMENT_SIZE to complement FIFO_INIT_SIZE

Use sizeof(void *) as its value, because AVFilterBufferRef is deprecated.

Reviewed-by: Michael Niedermayer 
Signed-off-by: Andreas Cadhalpun 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d90fbde06a800d151c420ca32e4e0a015b9076f9
---

 libavfilter/buffersink.c |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
index b145e35..36b9e42 100644
--- a/libavfilter/buffersink.c
+++ b/libavfilter/buffersink.c
@@ -62,6 +62,8 @@ typedef struct BufferSinkContext {
 } BufferSinkContext;
 
 #define NB_ITEMS(list) (list ## _size / sizeof(*list))
+#define FIFO_INIT_SIZE 8
+#define FIFO_INIT_ELEMENT_SIZE sizeof(void *)
 
 static av_cold void uninit(AVFilterContext *ctx)
 {
@@ -72,7 +74,7 @@ static av_cold void uninit(AVFilterContext *ctx)
 av_audio_fifo_free(sink->audio_fifo);
 
 if (sink->fifo) {
-while (av_fifo_size(sink->fifo) >= sizeof(AVFilterBufferRef *)) {
+while (av_fifo_size(sink->fifo) >= FIFO_INIT_ELEMENT_SIZE) {
 av_fifo_generic_read(sink->fifo, &frame, sizeof(frame), NULL);
 av_frame_free(&frame);
 }
@@ -84,7 +86,7 @@ static int add_buffer_ref(AVFilterContext *ctx, AVFrame *ref)
 {
 BufferSinkContext *buf = ctx->priv;
 
-if (av_fifo_space(buf->fifo) < sizeof(AVFilterBufferRef *)) {
+if (av_fifo_space(buf->fifo) < FIFO_INIT_ELEMENT_SIZE) {
 /* realloc fifo size */
 if (av_fifo_realloc2(buf->fifo, av_fifo_size(buf->fifo) * 2) < 0) {
 av_log(ctx, AV_LOG_ERROR,
@@ -95,7 +97,7 @@ static int add_buffer_ref(AVFilterContext *ctx, AVFrame *ref)
 }
 
 /* cache frame */
-av_fifo_generic_write(buf->fifo, &ref, sizeof(AVFilterBufferRef *), NULL);
+av_fifo_generic_write(buf->fifo, &ref, FIFO_INIT_ELEMENT_SIZE, NULL);
 return 0;
 }
 
@@ -108,7 +110,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
 if ((ret = add_buffer_ref(ctx, frame)) < 0)
 return ret;
 if (buf->warning_limit &&
-av_fifo_size(buf->fifo) / sizeof(AVFilterBufferRef *) >= 
buf->warning_limit) {
+av_fifo_size(buf->fifo) / FIFO_INIT_ELEMENT_SIZE >= 
buf->warning_limit) {
 av_log(ctx, AV_LOG_WARNING,
"%d buffers queued in %s, something may be wrong.\n",
buf->warning_limit,
@@ -242,13 +244,11 @@ AVABufferSinkParams *av_abuffersink_params_alloc(void)
 return params;
 }
 
-#define FIFO_INIT_SIZE 8
-
 static av_cold int common_init(AVFilterContext *ctx)
 {
 BufferSinkContext *buf = ctx->priv;
 
-buf->fifo = av_fifo_alloc_array(FIFO_INIT_SIZE, sizeof(AVFilterBufferRef 
*));
+buf->fifo = av_fifo_alloc_array(FIFO_INIT_SIZE, FIFO_INIT_ELEMENT_SIZE);
 if (!buf->fifo) {
 av_log(ctx, AV_LOG_ERROR, "Failed to allocate fifo\n");
 return AVERROR(ENOMEM);
@@ -373,7 +373,7 @@ int attribute_align_arg 
av_buffersink_poll_frame(AVFilterContext *ctx)
|| !strcmp(ctx->filter->name, "ffbuffersink")
|| !strcmp(ctx->filter->name, "ffabuffersink"));
 
-return av_fifo_size(buf->fifo)/sizeof(AVFilterBufferRef *) + 
ff_poll_frame(inlink);
+return av_fifo_size(buf->fifo)/FIFO_INIT_ELEMENT_SIZE + 
ff_poll_frame(inlink);
 }
 
 static av_cold int vsink_init(AVFilterContext *ctx, void *opaque)

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


[FFmpeg-cvslog] ffmpeg_vdpau: Ignore decoder's max supported level

2015-08-16 Thread Philip Langdale
ffmpeg | branch: master | Philip Langdale  | Tue Jun 23 
20:37:08 2015 -0700| [d3eb317b862c3f5653f0ae8dfcb22edf1713ab5b] | committer: 
Philip Langdale

ffmpeg_vdpau: Ignore decoder's max supported level

The h264 decoder reports 4.1 as its maximum level, but it will decode
5.1 4K video just fine. In practice, the published level limits in
vdpau do not communicate anything that's actually useful.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d3eb317b862c3f5653f0ae8dfcb22edf1713ab5b
---

 ffmpeg_vdpau.c   |3 ++-
 libavcodec/avcodec.h |3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ffmpeg_vdpau.c b/ffmpeg_vdpau.c
index b05e557..92a98ea 100644
--- a/ffmpeg_vdpau.c
+++ b/ffmpeg_vdpau.c
@@ -289,7 +289,8 @@ do {
 
 s->hwaccel_context = vdpau_ctx;
 } else
-if (av_vdpau_bind_context(s, ctx->device, ctx->get_proc_address, 0))
+if (av_vdpau_bind_context(s, ctx->device, ctx->get_proc_address,
+  AV_HWACCEL_FLAG_IGNORE_LEVEL))
 goto fail;
 
 ctx->get_information_string(&vendor);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 4222db6..f09d8f4 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3715,6 +3715,9 @@ typedef struct AVHWAccel {
  * Hardware acceleration should be used for decoding even if the codec level
  * used is unknown or higher than the maximum supported level reported by the
  * hardware driver.
+ *
+ * It's generally a good idea to pass this flag unless you have a specific
+ * reason not to, as hardware tends to under-report supported levels.
  */
 #define AV_HWACCEL_FLAG_IGNORE_LEVEL (1 << 0)
 

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


[FFmpeg-cvslog] avcodec/rv30: fix switching back to the original resolution

2015-08-16 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Mon 
Aug 17 01:50:20 2015 +0200| [7f769ae41e0dca0f538ad6bdad5f9471fd5ee87f] | 
committer: Michael Niedermayer

avcodec/rv30: fix switching back to the original resolution

Fixes part of Ticket1388

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7f769ae41e0dca0f538ad6bdad5f9471fd5ee87f
---

 libavcodec/rv30.c |6 ++
 libavcodec/rv34.h |2 ++
 2 files changed, 8 insertions(+)

diff --git a/libavcodec/rv30.c b/libavcodec/rv30.c
index f8c7ed4..3b9868c 100644
--- a/libavcodec/rv30.c
+++ b/libavcodec/rv30.c
@@ -67,6 +67,9 @@ static int rv30_parse_slice_header(RV34DecContext *r, 
GetBitContext *gb, SliceIn
 
 w = r->s.avctx->extradata[6 + rpr*2] << 2;
 h = r->s.avctx->extradata[7 + rpr*2] << 2;
+} else {
+w = r->orig_width;
+h = r->orig_height;
 }
 si->width  = w;
 si->height = h;
@@ -259,6 +262,9 @@ static av_cold int rv30_decode_init(AVCodecContext *avctx)
 RV34DecContext *r = avctx->priv_data;
 int ret;
 
+r->orig_width  = avctx->coded_width;
+r->orig_height = avctx->coded_height;
+
 if (avctx->extradata_size < 2) {
 av_log(avctx, AV_LOG_ERROR, "Extradata is too small.\n");
 return AVERROR(EINVAL);
diff --git a/libavcodec/rv34.h b/libavcodec/rv34.h
index 870164c..e2f40c8 100644
--- a/libavcodec/rv34.h
+++ b/libavcodec/rv34.h
@@ -109,6 +109,8 @@ typedef struct RV34DecContext{
 int weight1, weight2;///< B frame distance fractions (0.14) used in 
motion compensation
 int mv_weight1, mv_weight2;
 
+int orig_width, orig_height;
+
 uint16_t *cbp_luma;  ///< CBP values for luma subblocks
 uint8_t  *cbp_chroma;///< CBP values for chroma subblocks
 uint16_t *deblock_coefs; ///< deblock coefficients for each macroblock

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


[FFmpeg-cvslog] swscale/swscale-test: Fix slice height in random reference data creation.

2015-08-16 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Mon 
Aug 17 03:08:10 2015 +0200| [3afca32561d94f2774adcd82a6a45d78d45f42f3] | 
committer: Michael Niedermayer

swscale/swscale-test: Fix slice height in random reference data creation.

Found-by: Pedro Arthur 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3afca32561d94f2774adcd82a6a45d78d45f42f3
---

 libswscale/swscale-test.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libswscale/swscale-test.c b/libswscale/swscale-test.c
index 661ff5b..b79bb23 100644
--- a/libswscale/swscale-test.c
+++ b/libswscale/swscale-test.c
@@ -399,7 +399,7 @@ bad_option:
 for (y = 0; y < H; y++)
 for (x = 0; x < W * 4; x++)
 rgb_data[ x + y * 4 * W] = av_lfg_get(&rand);
-sws_scale(sws, rgb_src, rgb_stride, 0, H, src, stride);
+sws_scale(sws, rgb_src, rgb_stride, 0, H / 12, src, stride);
 sws_freeContext(sws);
 av_free(rgb_data);
 

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