diff options
author | Stephan Hilb <stephan@ecshi.net> | 2012-09-01 10:16:56 +0200 |
---|---|---|
committer | Stephan Hilb <stephan@ecshi.net> | 2012-09-01 10:16:56 +0200 |
commit | e30967710028950426c1c02f86a3bdaf463e5dce (patch) | |
tree | b56cc553bd111d35b70f5044c4dcfa914c64816c | |
parent | 296140ebfb7242211852f7736f72dc7f05f0c458 (diff) | |
parent | d55252c33156a53dae8e1beba73b163724dec8cf (diff) | |
download | ffmpeg-e30967710028950426c1c02f86a3bdaf463e5dce.tar.gz |
Merge branch 'master' of git://source.ffmpeg.org/ffmpeg
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | doc/examples/filtering_audio.c | 2 | ||||
-rw-r--r-- | doc/examples/filtering_video.c | 2 | ||||
-rw-r--r-- | doc/filters.texi | 1 | ||||
-rw-r--r-- | ffmpeg_filter.c | 6 | ||||
-rw-r--r-- | ffplay.c | 2 | ||||
-rw-r--r-- | libavcodec/avcodec.h | 21 | ||||
-rw-r--r-- | libavcodec/dvbsubdec.c | 4 | ||||
-rw-r--r-- | libavcodec/imgconvert.c | 20 | ||||
-rw-r--r-- | libavdevice/lavfi.c | 4 | ||||
-rw-r--r-- | libavfilter/Makefile | 1 | ||||
-rw-r--r-- | libavfilter/allfilters.c | 6 | ||||
-rw-r--r-- | libavfilter/avfiltergraph.c | 4 | ||||
-rw-r--r-- | libavfilter/buffersink.c | 8 | ||||
-rw-r--r-- | libavfilter/libmpcodecs/vf_decimate.c | 198 | ||||
-rw-r--r-- | libavfilter/sink_buffer.c | 46 | ||||
-rw-r--r-- | libavfilter/version.h | 2 | ||||
-rw-r--r-- | libavfilter/vf_mp.c | 2 | ||||
-rw-r--r-- | libavformat/filmstripdec.c | 2 | ||||
-rw-r--r-- | libavformat/flic.c | 2 | ||||
-rw-r--r-- | libavformat/matroskadec.c | 23 | ||||
-rw-r--r-- | libavformat/matroskaenc.c | 5 | ||||
-rw-r--r-- | libavformat/srtenc.c | 1 | ||||
-rw-r--r-- | libavformat/wtvdec.c | 2 | ||||
-rw-r--r-- | libswresample/resample.c | 4 | ||||
-rw-r--r-- | tests/fate/utvideo.mak | 2 |
26 files changed, 139 insertions, 233 deletions
@@ -1114,6 +1114,7 @@ CONFIG_LIST=" gpl gray hardcoded_tables + incompatible_fork_abi libaacplus libass libbluray @@ -1248,6 +1249,7 @@ ARCH_EXT_LIST=" HAVE_LIST_PUB=' bigendian fast_unaligned + incompatible_fork_abi ' HAVE_LIST=" diff --git a/doc/examples/filtering_audio.c b/doc/examples/filtering_audio.c index 4d96438b09..39f4450862 100644 --- a/doc/examples/filtering_audio.c +++ b/doc/examples/filtering_audio.c @@ -84,7 +84,7 @@ static int init_filters(const char *filters_descr) char args[512]; int ret; AVFilter *abuffersrc = avfilter_get_by_name("abuffer"); - AVFilter *abuffersink = avfilter_get_by_name("abuffersink"); + AVFilter *abuffersink = avfilter_get_by_name("ffabuffersink"); AVFilterInOut *outputs = avfilter_inout_alloc(); AVFilterInOut *inputs = avfilter_inout_alloc(); const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, -1 }; diff --git a/doc/examples/filtering_video.c b/doc/examples/filtering_video.c index 4bede05a61..ee5073a1ba 100644 --- a/doc/examples/filtering_video.c +++ b/doc/examples/filtering_video.c @@ -84,7 +84,7 @@ static int init_filters(const char *filters_descr) char args[512]; int ret; AVFilter *buffersrc = avfilter_get_by_name("buffer"); - AVFilter *buffersink = avfilter_get_by_name("buffersink"); + AVFilter *buffersink = avfilter_get_by_name("ffbuffersink"); AVFilterInOut *outputs = avfilter_inout_alloc(); AVFilterInOut *inputs = avfilter_inout_alloc(); enum PixelFormat pix_fmts[] = { PIX_FMT_GRAY8, PIX_FMT_NONE }; diff --git a/doc/filters.texi b/doc/filters.texi index 2312d77517..712936d3f6 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -2508,7 +2508,6 @@ the named filter. The list of the currently supported filters follows: @table @var -@item decimate @item denoise3d @item detc @item dint diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c index cae82292aa..b7f20cc218 100644 --- a/ffmpeg_filter.c +++ b/ffmpeg_filter.c @@ -48,7 +48,7 @@ enum PixelFormat choose_pixel_fmt(AVStream *st, AVCodec *codec, enum PixelFormat } } for (; *p != PIX_FMT_NONE; p++) { - best= avcodec_find_best_pix_fmt2(best, *p, target, has_alpha, NULL); + best= avcodec_find_best_pix_fmt_of_2(best, *p, target, has_alpha, NULL); if (*p == target) break; } @@ -294,7 +294,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index); ret = avfilter_graph_create_filter(&ofilter->filter, - avfilter_get_by_name("buffersink"), + avfilter_get_by_name("ffbuffersink"), name, NULL, NULL/*buffersink_params*/, fg->graph); av_freep(&buffersink_params); @@ -377,7 +377,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index); ret = avfilter_graph_create_filter(&ofilter->filter, - avfilter_get_by_name("abuffersink"), + avfilter_get_by_name("ffabuffersink"), name, NULL, NULL, fg->graph); if (ret < 0) return ret; @@ -1606,7 +1606,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c buffersink_params->pixel_fmts = pix_fmts; ret = avfilter_graph_create_filter(&filt_out, - avfilter_get_by_name("buffersink"), + avfilter_get_by_name("ffbuffersink"), "ffplay_buffersink", NULL, buffersink_params, graph); av_freep(&buffersink_params); if (ret < 0) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 7ae6717e5e..199dd3ba5f 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -4512,7 +4512,7 @@ int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_ #if FF_API_FIND_BEST_PIX_FMT /** - * @deprecated use avcodec_find_best_pix_fmt2() instead. + * @deprecated use avcodec_find_best_pix_fmt_of_2() instead. * * Find the best pixel format to convert to given a certain source pixel * format. When converting from one pixel format to another, information loss @@ -4547,7 +4547,7 @@ enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelForma * format. When converting from one pixel format to another, information loss * may occur. For example, when converting from RGB24 to GRAY, the color * information will be lost. Similarly, other losses occur when converting from - * some formats to other formats. avcodec_find_best_pix_fmt2() searches which of + * some formats to other formats. avcodec_find_best_pix_fmt_of_2() searches which of * the given pixel formats should be used to suffer the least amount of loss. * The pixel formats from which it chooses one, are determined by the * pix_fmt_list parameter. @@ -4568,7 +4568,7 @@ enum PixelFormat avcodec_find_best_pix_fmt_of_list(enum PixelFormat *pix_fmt_lis * format and a selection of two destination pixel formats. When converting from * one pixel format to another, information loss may occur. For example, when converting * from RGB24 to GRAY, the color information will be lost. Similarly, other losses occur when - * converting from some formats to other formats. avcodec_find_best_pix_fmt2() selects which of + * converting from some formats to other formats. avcodec_find_best_pix_fmt_of_2() selects which of * the given pixel formats should be used to suffer the least amount of loss. * * If one of the destination formats is PIX_FMT_NONE the other pixel format (if valid) will be @@ -4580,8 +4580,8 @@ enum PixelFormat avcodec_find_best_pix_fmt_of_list(enum PixelFormat *pix_fmt_lis * dst_pix_fmt2= PIX_FMT_GRAY8; * dst_pix_fmt3= PIX_FMT_RGB8; * loss= FF_LOSS_CHROMA; // don't care about chroma loss, so chroma loss will be ignored. - * dst_pix_fmt = avcodec_find_best_pix_fmt2(dst_pix_fmt1, dst_pix_fmt2, src_pix_fmt, alpha, &loss); - * dst_pix_fmt = avcodec_find_best_pix_fmt2(dst_pix_fmt, dst_pix_fmt3, src_pix_fmt, alpha, &loss); + * dst_pix_fmt = avcodec_find_best_pix_fmt_of_2(dst_pix_fmt1, dst_pix_fmt2, src_pix_fmt, alpha, &loss); + * dst_pix_fmt = avcodec_find_best_pix_fmt_of_2(dst_pix_fmt, dst_pix_fmt3, src_pix_fmt, alpha, &loss); * @endcode * * @param[in] dst_pix_fmt1 One of the two destination pixel formats to choose from @@ -4593,8 +4593,19 @@ enum PixelFormat avcodec_find_best_pix_fmt_of_list(enum PixelFormat *pix_fmt_lis * that occurs when converting from src to selected dst pixel format. * @return The best pixel format to convert to or -1 if none was found. */ +enum PixelFormat avcodec_find_best_pix_fmt_of_2(enum PixelFormat dst_pix_fmt1, enum PixelFormat dst_pix_fmt2, + enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); + +attribute_deprecated +#if AV_HAVE_INCOMPATIBLE_FORK_ABI +enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat *pix_fmt_list, + enum PixelFormat src_pix_fmt, + int has_alpha, int *loss_ptr); +#else enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum PixelFormat dst_pix_fmt2, enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); +#endif + enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt); diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index ef90f73c1a..955925a619 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -1343,6 +1343,10 @@ static void dvbsub_parse_display_definition_segment(AVCodecContext *avctx, display_def->y = 0; display_def->width = bytestream_get_be16(&buf) + 1; display_def->height = bytestream_get_be16(&buf) + 1; + if (!avctx->width || !avctx->height) { + avctx->width = display_def->width; + avctx->height = display_def->height; + } if (buf_size < 13) return; diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 9d867354b7..82da64b775 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -529,13 +529,13 @@ enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelForma dst_pix_fmt = PIX_FMT_NONE; /* so first iteration doesn't have to be treated special */ for(i = 0; i< FFMIN(PIX_FMT_NB, 64); i++){ if (pix_fmt_mask & (1ULL << i)) - dst_pix_fmt = avcodec_find_best_pix_fmt2(dst_pix_fmt, i, src_pix_fmt, has_alpha, loss_ptr); + dst_pix_fmt = avcodec_find_best_pix_fmt_of_2(dst_pix_fmt, i, src_pix_fmt, has_alpha, loss_ptr); } return dst_pix_fmt; } #endif /* FF_API_FIND_BEST_PIX_FMT */ -enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum PixelFormat dst_pix_fmt2, +enum PixelFormat avcodec_find_best_pix_fmt_of_2(enum PixelFormat dst_pix_fmt1, enum PixelFormat dst_pix_fmt2, enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr) { enum PixelFormat dst_pix_fmt; @@ -577,6 +577,20 @@ enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum return dst_pix_fmt; } +#if AV_HAVE_INCOMPATIBLE_FORK_ABI +enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat *pix_fmt_list, + enum PixelFormat src_pix_fmt, + int has_alpha, int *loss_ptr){ + return avcodec_find_best_pix_fmt_of_list(pix_fmt_list, src_pix_fmt, has_alpha, loss_ptr); +} +#else +enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum PixelFormat dst_pix_fmt2, + enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr) +{ + return avcodec_find_best_pix_fmt_of_2(dst_pix_fmt1, dst_pix_fmt2, src_pix_fmt, has_alpha, loss_ptr); +} +#endif + enum PixelFormat avcodec_find_best_pix_fmt_of_list(enum PixelFormat *pix_fmt_list, enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr){ @@ -585,7 +599,7 @@ enum PixelFormat avcodec_find_best_pix_fmt_of_list(enum PixelFormat *pix_fmt_lis enum PixelFormat best = PIX_FMT_NONE; for(i=0; pix_fmt_list[i] != PIX_FMT_NONE; i++) - best = avcodec_find_best_pix_fmt2(best, pix_fmt_list[i], src_pix_fmt, has_alpha, loss_ptr); + best = avcodec_find_best_pix_fmt_of_2(best, pix_fmt_list[i], src_pix_fmt, has_alpha, loss_ptr); return best; } diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c index 20fa3e69b2..780d9a3ad3 100644 --- a/libavdevice/lavfi.c +++ b/libavdevice/lavfi.c @@ -95,8 +95,8 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx) avfilter_register_all(); - buffersink = avfilter_get_by_name("buffersink"); - abuffersink = avfilter_get_by_name("abuffersink"); + buffersink = avfilter_get_by_name("ffbuffersink"); + abuffersink = avfilter_get_by_name("ffabuffersink"); if (!lavfi->graph_str) lavfi->graph_str = av_strdup(avctx->filename); diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 047d418529..29b5f0e8cd 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -156,7 +156,6 @@ OBJS-$(CONFIG_NULLSINK_FILTER) += vsink_nullsink.o OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/mp_image.o OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/img_format.o -OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_decimate.o OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_denoise3d.o OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_detc.o OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_dint.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 9e68d4c6dd..6842ec95d5 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -64,8 +64,11 @@ void avfilter_register_all(void) REGISTER_FILTER (ANULLSRC, anullsrc, asrc); REGISTER_FILTER (FLITE, flite, asrc); +#if !AV_HAVE_INCOMPATIBLE_FORK_ABI REGISTER_FILTER (ABUFFERSINK, abuffersink, asink); +#endif REGISTER_FILTER (ANULLSINK, anullsink, asink); + REGISTER_FILTER (FFABUFFERSINK, ffabuffersink, asink); REGISTER_FILTER (ALPHAEXTRACT, alphaextract, vf); REGISTER_FILTER (ALPHAMERGE, alphamerge, vf); @@ -140,7 +143,10 @@ void avfilter_register_all(void) REGISTER_FILTER (SMPTEBARS, smptebars, vsrc); REGISTER_FILTER (TESTSRC, testsrc, vsrc); +#if !AV_HAVE_INCOMPATIBLE_FORK_ABI REGISTER_FILTER (BUFFERSINK, buffersink, vsink); +#endif + REGISTER_FILTER (FFBUFFERSINK,ffbuffersink,vsink); REGISTER_FILTER (NULLSINK, nullsink, vsink); /* multimedia filters */ diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 7ab1124f29..f98e0e40f3 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -26,7 +26,7 @@ #include "libavutil/audioconvert.h" #include "libavutil/avassert.h" #include "libavutil/pixdesc.h" -#include "libavcodec/avcodec.h" // avcodec_find_best_pix_fmt2() +#include "libavcodec/avcodec.h" // avcodec_find_best_pix_fmt_of_2() #include "avfilter.h" #include "avfiltergraph.h" #include "formats.h" @@ -429,7 +429,7 @@ static int pick_format(AVFilterLink *link, AVFilterLink *ref) int i; for (i=0; i<link->in_formats->format_count; i++) { enum PixelFormat p = link->in_formats->formats[i]; - best= avcodec_find_best_pix_fmt2(best, p, ref->format, has_alpha, NULL); + best= avcodec_find_best_pix_fmt_of_2(best, p, ref->format, has_alpha, NULL); } av_log(link->src,AV_LOG_DEBUG, "picking %s out of %d ref:%s alpha:%d\n", av_get_pix_fmt_name(best), link->in_formats->format_count, diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c index e66a099c14..50cd6d4e96 100644 --- a/libavfilter/buffersink.c +++ b/libavfilter/buffersink.c @@ -141,7 +141,11 @@ int av_buffersink_read_samples(AVFilterContext *ctx, AVFilterBufferRef **pbuf, } AVFilter avfilter_vsink_buffer = { +#if AV_HAVE_INCOMPATIBLE_FORK_ABI + .name = "buffersink", +#else .name = "buffersink_old", +#endif .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."), .priv_size = sizeof(BufferSinkContext), .uninit = uninit, @@ -156,7 +160,11 @@ AVFilter avfilter_vsink_buffer = { }; AVFilter avfilter_asink_abuffer = { +#if AV_HAVE_INCOMPATIBLE_FORK_ABI + .name = "abuffersink", +#else .name = "abuffersink_old", +#endif .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."), .priv_size = sizeof(BufferSinkContext), .uninit = uninit, diff --git a/libavfilter/libmpcodecs/vf_decimate.c b/libavfilter/libmpcodecs/vf_decimate.c deleted file mode 100644 index 2d2aaf0abd..0000000000 --- a/libavfilter/libmpcodecs/vf_decimate.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "config.h" -#include "mp_msg.h" -#include "cpudetect.h" - -#include "img_format.h" -#include "mp_image.h" -#include "vf.h" - -#include "libvo/fastmemcpy.h" - - -struct vf_priv_s { - int hi, lo; - float frac; - int max, last, cnt; -}; - -#if HAVE_MMX && HAVE_EBX_AVAILABLE -static int diff_MMX(unsigned char *old, unsigned char *new, int os, int ns) -{ - volatile short out[4]; - __asm__ ( - "movl $8, %%ecx \n\t" - "pxor %%mm4, %%mm4 \n\t" - "pxor %%mm7, %%mm7 \n\t" - - ASMALIGN(4) - "1: \n\t" - - "movq (%%"REG_S"), %%mm0 \n\t" - "movq (%%"REG_S"), %%mm2 \n\t" - "add %%"REG_a", %%"REG_S" \n\t" - "movq (%%"REG_D"), %%mm1 \n\t" - "add %%"REG_b", %%"REG_D" \n\t" - "psubusb %%mm1, %%mm2 \n\t" - "psubusb %%mm0, %%mm1 \n\t" - "movq %%mm2, %%mm0 \n\t" - "movq %%mm1, %%mm3 \n\t" - "punpcklbw %%mm7, %%mm0 \n\t" - "punpcklbw %%mm7, %%mm1 \n\t" - "punpckhbw %%mm7, %%mm2 \n\t" - "punpckhbw %%mm7, %%mm3 \n\t" - "paddw %%mm0, %%mm4 \n\t" - "paddw %%mm1, %%mm4 \n\t" - "paddw %%mm2, %%mm4 \n\t" - "paddw %%mm3, %%mm4 \n\t" - - "decl %%ecx \n\t" - "jnz 1b \n\t" - "movq %%mm4, (%%"REG_d") \n\t" - "emms \n\t" - : - : "S" (old), "D" (new), "a" ((long)os), "b" ((long)ns), "d" (out) - : "%ecx", "memory" - ); - return out[0]+out[1]+out[2]+out[3]; -} -#endif - -static int diff_C(unsigned char *old, unsigned char *new, int os, int ns) -{ - int x, y, d=0; - for (y = 0; y < 8; y++) { - for (x = 0; x < 8; x++) { - d += abs(new[x] - old[x]); - } - new += ns; - old += os; - } - return d; -} - -static int (*diff)(unsigned char *, unsigned char *, int, int); - -static int diff_to_drop_plane(int hi, int lo, float frac, unsigned char *old, unsigned char *new, int w, int h, int os, int ns) -{ - int x, y; - int d, c=0; - int t = (w/16)*(h/16)*frac; - for (y = 0; y < h-7; y += 4) { - for (x = 8; x < w-7; x += 4) { - d = diff(old+x+y*os, new+x+y*ns, os, ns); - if (d > hi) return 0; - if (d > lo) { - c++; - if (c > t) return 0; - } - } - } - return 1; -} - -static int diff_to_drop(int hi, int lo, float frac, mp_image_t *old, mp_image_t *new) -{ - if (new->flags & MP_IMGFLAG_PLANAR) { - return diff_to_drop_plane(hi,lo,frac, old->planes[0], new->planes[0], - new->w, new->h, old->stride[0], new->stride[0]) - && diff_to_drop_plane(hi,lo,frac, old->planes[1], new->planes[1], - new->chroma_width, new->chroma_height, - old->stride[1], new->stride[1]) - && diff_to_drop_plane(hi,lo,frac, old->planes[2], new->planes[2], - new->chroma_width, new->chroma_height, - old->stride[2], new->stride[2]); - } - return diff_to_drop_plane(hi,lo,frac, old->planes[0], new->planes[0], - new->w*(new->bpp/8), new->h, old->stride[0], new->stride[0]); -} - -static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) -{ - mp_image_t *dmpi; - - dmpi = vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | - MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE, - mpi->width, mpi->height); - dmpi->qscale = mpi->qscale; - dmpi->qstride = mpi->qstride; - dmpi->qscale_type = mpi->qscale_type; - - if (diff_to_drop(vf->priv->hi, vf->priv->lo, vf->priv->frac, dmpi, mpi)) { - if (vf->priv->max == 0) - return 0; - else if ((vf->priv->max > 0) && (vf->priv->cnt++ < vf->priv->max)) - return 0; - else if ((vf->priv->max < 0) && (vf->priv->last+1 >= -vf->priv->max)) - return vf->priv->last=0; - } - vf->priv->last++; - vf->priv->cnt=0; - - memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, - dmpi->stride[0], mpi->stride[0]); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - memcpy_pic(dmpi->planes[1], mpi->planes[1], - mpi->chroma_width, mpi->chroma_height, - dmpi->stride[1], mpi->stride[1]); - memcpy_pic(dmpi->planes[2], mpi->planes[2], - mpi->chroma_width, mpi->chroma_height, - dmpi->stride[2], mpi->stride[2]); - } - return vf_next_put_image(vf, dmpi, pts); -} - -static void uninit(struct vf_instance *vf) -{ - free(vf->priv); -} - -static int vf_open(vf_instance_t *vf, char *args) -{ - struct vf_priv_s *p; - vf->put_image = put_image; - vf->uninit = uninit; - vf->default_reqs = VFCAP_ACCEPT_STRIDE; - vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); - p->max = 0; - p->hi = 64*12; - p->lo = 64*5; - p->frac = 0.33; - if (args) sscanf(args, "%d:%d:%d:%f", &p->max, &p->hi, &p->lo, &p->frac); - diff = diff_C; -#if HAVE_MMX && HAVE_EBX_AVAILABLE - if(gCpuCaps.hasMMX) diff = diff_MMX; -#endif - return 1; -} - -const vf_info_t vf_info_decimate = { - "near-duplicate frame remover", - "decimate", - "Rich Felker", - "", - vf_open, - NULL -}; diff --git a/libavfilter/sink_buffer.c b/libavfilter/sink_buffer.c index 95ba590d4a..0b685e3d31 100644 --- a/libavfilter/sink_buffer.c +++ b/libavfilter/sink_buffer.c @@ -143,7 +143,10 @@ int av_buffersink_get_buffer_ref(AVFilterContext *ctx, int ret; *bufref = NULL; - av_assert0(!strcmp(ctx->filter->name, "buffersink") || !strcmp(ctx->filter->name, "abuffersink")); + av_assert0( !strcmp(ctx->filter->name, "buffersink") + || !strcmp(ctx->filter->name, "abuffersink") + || !strcmp(ctx->filter->name, "ffbuffersink") + || !strcmp(ctx->filter->name, "ffabuffersink")); /* no picref available, fetch it from the filterchain */ if (!av_fifo_size(buf->fifo)) { @@ -166,7 +169,8 @@ int av_buffersink_get_buffer_ref(AVFilterContext *ctx, AVRational av_buffersink_get_frame_rate(AVFilterContext *ctx) { - av_assert0(!strcmp(ctx->filter->name, "buffersink")); + av_assert0( !strcmp(ctx->filter->name, "buffersink") + || !strcmp(ctx->filter->name, "ffbuffersink")); return ctx->inputs[0]->frame_rate; } @@ -176,7 +180,10 @@ int av_buffersink_poll_frame(AVFilterContext *ctx) BufferSinkContext *buf = ctx->priv; AVFilterLink *inlink = ctx->inputs[0]; - av_assert0(!strcmp(ctx->filter->name, "buffersink") || !strcmp(ctx->filter->name, "abuffersink")); + av_assert0( !strcmp(ctx->filter->name, "buffersink") + || !strcmp(ctx->filter->name, "abuffersink") + || !strcmp(ctx->filter->name, "ffbuffersink") + || !strcmp(ctx->filter->name, "ffabuffersink")); return av_fifo_size(buf->fifo)/sizeof(AVFilterBufferRef *) + ff_poll_frame(inlink); } @@ -218,6 +225,23 @@ static int vsink_query_formats(AVFilterContext *ctx) return 0; } +AVFilter avfilter_vsink_ffbuffersink = { + .name = "ffbuffersink", + .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."), + .priv_size = sizeof(BufferSinkContext), + .init_opaque = vsink_init, + .uninit = vsink_uninit, + + .query_formats = vsink_query_formats, + + .inputs = (const AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .end_frame = end_frame, + .min_perms = AV_PERM_READ | AV_PERM_PRESERVE, }, + { .name = NULL }}, + .outputs = (const AVFilterPad[]) {{ .name = NULL }}, +}; + AVFilter avfilter_vsink_buffersink = { .name = "buffersink", .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."), @@ -299,6 +323,22 @@ static int asink_query_formats(AVFilterContext *ctx) return 0; } +AVFilter avfilter_asink_ffabuffersink = { + .name = "ffabuffersink", + .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."), + .init_opaque = asink_init, + .uninit = asink_uninit, + .priv_size = sizeof(BufferSinkContext), + .query_formats = asink_query_formats, + + .inputs = (const AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_AUDIO, + .filter_samples = filter_samples, + .min_perms = AV_PERM_READ | AV_PERM_PRESERVE, }, + { .name = NULL }}, + .outputs = (const AVFilterPad[]) {{ .name = NULL }}, +}; + AVFilter avfilter_asink_abuffersink = { .name = "abuffersink", .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."), diff --git a/libavfilter/version.h b/libavfilter/version.h index 6a25d820dc..c37976ac60 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -30,7 +30,7 @@ #define LIBAVFILTER_VERSION_MAJOR 3 #define LIBAVFILTER_VERSION_MINOR 15 -#define LIBAVFILTER_VERSION_MICRO 101 +#define LIBAVFILTER_VERSION_MICRO 102 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ LIBAVFILTER_VERSION_MINOR, \ diff --git a/libavfilter/vf_mp.c b/libavfilter/vf_mp.c index 7a4211f2ce..e0e62d6488 100644 --- a/libavfilter/vf_mp.c +++ b/libavfilter/vf_mp.c @@ -127,7 +127,6 @@ extern const vf_info_t vf_info_1bpp; extern const vf_info_t vf_info_ass; extern const vf_info_t vf_info_bmovl; extern const vf_info_t vf_info_crop; -extern const vf_info_t vf_info_decimate; extern const vf_info_t vf_info_denoise3d; extern const vf_info_t vf_info_detc; extern const vf_info_t vf_info_dint; @@ -189,7 +188,6 @@ extern const vf_info_t vf_info_zrmjpeg; static const vf_info_t* const filters[]={ - &vf_info_decimate, &vf_info_denoise3d, &vf_info_detc, &vf_info_dint, diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c index 2f3aa6c6d1..0d02818fbf 100644 --- a/libavformat/filmstripdec.c +++ b/libavformat/filmstripdec.c @@ -45,7 +45,7 @@ static int read_header(AVFormatContext *s) avio_seek(pb, avio_size(pb) - 36, SEEK_SET); if (avio_rb32(pb) != RAND_TAG) { - av_log(s, AV_LOG_ERROR, "magic number not found"); + av_log(s, AV_LOG_ERROR, "magic number not found\n"); return AVERROR_INVALIDDATA; } diff --git a/libavformat/flic.c b/libavformat/flic.c index f6aa3b0e2e..db3f5d8dfa 100644 --- a/libavformat/flic.c +++ b/libavformat/flic.c @@ -187,7 +187,7 @@ static int flic_read_header(AVFormatContext *s) (magic_number == FLIC_FILE_MAGIC_3)) { avpriv_set_pts_info(st, 64, speed, 1000); } else { - av_log(s, AV_LOG_INFO, "Invalid or unsupported magic chunk in file\n"); + av_log(s, AV_LOG_ERROR, "Invalid or unsupported magic chunk in file\n"); return AVERROR_INVALIDDATA; } diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 1d0dbb3296..c4e0438c1d 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2105,10 +2105,29 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, else pkt->pts = timecode; pkt->pos = pos; - if (st->codec->codec_id == AV_CODEC_ID_SUBRIP) + if (st->codec->codec_id == AV_CODEC_ID_SUBRIP) { + /* + * For backward compatibility. + * Historically, we have put subtitle duration + * in convergence_duration, on the off chance + * that the time_scale is less than 1us, which + * could result in a 32bit overflow on the + * normal duration field. + */ pkt->convergence_duration = lace_duration; - else if (track->type != MATROSKA_TRACK_TYPE_SUBTITLE) + } + + if (track->type != MATROSKA_TRACK_TYPE_SUBTITLE || + lace_duration <= INT_MAX) { + /* + * For non subtitle tracks, just store the duration + * as normal. + * + * If it's a subtitle track and duration value does + * not overflow a uint32, then also store it normally. + */ pkt->duration = lace_duration; + } if (st->codec->codec_id == AV_CODEC_ID_SSA) matroska_fix_ass_packet(matroska, pkt, lace_duration); diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 397793119e..79ce9f5cae 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1168,7 +1168,10 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt) duration = mkv_write_srt_blocks(s, pb, pkt); } else { ebml_master blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, mkv_blockgroup_size(pkt->size)); - duration = pkt->convergence_duration; + /* For backward compatibility, prefer convergence_duration. */ + if (pkt->convergence_duration > 0) { + duration = pkt->convergence_duration; + } mkv_write_block(s, pb, MATROSKA_ID_BLOCK, pkt, 0); put_ebml_uint(pb, MATROSKA_ID_BLOCKDURATION, duration); end_ebml_master(pb, blockgroup); diff --git a/libavformat/srtenc.c b/libavformat/srtenc.c index 6b8278fa80..0b094b00bf 100644 --- a/libavformat/srtenc.c +++ b/libavformat/srtenc.c @@ -65,6 +65,7 @@ static int srt_write_packet(AVFormatContext *avf, AVPacket *pkt) int len; if (d <= 0) + /* For backward compatibility, fallback to convergence_duration. */ d = pkt->convergence_duration; if (s == AV_NOPTS_VALUE || d <= 0) { av_log(avf, AV_LOG_ERROR, "Insufficient timestamps.\n"); diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c index 2999382ee4..28de7873e1 100644 --- a/libavformat/wtvdec.c +++ b/libavformat/wtvdec.c @@ -695,7 +695,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, if (ff_guidcmp(formattype, ff_format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"FF_PRI_GUID"\n", FF_ARG_GUID(formattype)); avio_skip(pb, size); - st->codec->codec_id = AV_CODEC_ID_DVB_TELETEXT; + st->codec->codec_id = !ff_guidcmp(subtype, mediasubtype_teletext) ? AV_CODEC_ID_DVB_TELETEXT : AV_CODEC_ID_EIA_608; return st; } else if (!ff_guidcmp(mediatype, mediatype_mpeg2_sections) && !ff_guidcmp(subtype, mediasubtype_mpeg2_sections)) { diff --git a/libswresample/resample.c b/libswresample/resample.c index 7a5c7d73b3..ae08d10981 100644 --- a/libswresample/resample.c +++ b/libswresample/resample.c @@ -401,7 +401,7 @@ int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensatio #undef FELEM_MAX #undef FILTER_SHIFT -#if HAVE_SSSE3 +#if HAVE_SSSE3_INLINE #define COMMON_CORE COMMON_CORE_INT16_SSSE3 #define RENAME(N) N ## _int16_ssse3 #define FILTER_SHIFT 15 @@ -424,7 +424,7 @@ int swri_multiple_resample(ResampleContext *c, AudioData *dst, int dst_size, Aud for(i=0; i<dst->ch_count; i++){ #if ARCH_X86 -#if HAVE_SSSE3 +#if HAVE_SSSE3_INLINE if(c->format == AV_SAMPLE_FMT_S16P && (mm_flags&AV_CPU_FLAG_SSSE3)) ret= swri_resample_int16_ssse3(c, (int16_t*)dst->ch[i], (const int16_t*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); else #endif diff --git a/tests/fate/utvideo.mak b/tests/fate/utvideo.mak index 7042163d93..184a3bea98 100644 --- a/tests/fate/utvideo.mak +++ b/tests/fate/utvideo.mak @@ -28,7 +28,7 @@ fate-utvideo_yuv422_median: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_yuv422_ FATE_SAMPLES_AVCONV += $(FATE_UTVIDEO) fate-utvideo: $(FATE_UTVIDEO) -fate-utvideoenc%: CMD = framemd5 -f image2 -vcodec pgmyuv -i $(TARGET_PATH)/tests/vsynth1/%02d.pgm -vcodec utvideo -f avi -sws_flags +accurate_rnd+bitexact ${OPTS} +fate-utvideoenc%: CMD = framemd5 -f image2 -vcodec pgmyuv -i $(TARGET_PATH)/tests/vsynth1/%02d.pgm -vcodec utvideo -sws_flags +accurate_rnd+bitexact ${OPTS} FATE_UTVIDEOENC += fate-utvideoenc_rgba_none fate-utvideoenc_rgba_none: OPTS = -pix_fmt rgba -pred 3 |