From 3cd93cc7b898f83cc0c7ae35804dbe2cb6586af2 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 19 Mar 2013 11:04:55 +0100 Subject: [PATCH 1/3] Revert "asfenc: return error on negative timestamp" This reverts commit d1bec33b46091546c5b2e6815210e73f87abf413, it breaks FATE. --- libavformat/asfenc.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index 6112d3f2e0..a523b3a051 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -774,14 +774,6 @@ static int asf_write_packet(AVFormatContext *s, AVPacket *pkt) flags &= ~AV_PKT_FLAG_KEY; pts = (pkt->pts != AV_NOPTS_VALUE) ? pkt->pts : pkt->dts; - - if (pts < 0) { - av_log(s, AV_LOG_ERROR, - "Negative dts not supported stream %d, dts %"PRId64"\n", - pkt->stream_index, pts); - return AVERROR(ENOSYS); - } - assert(pts != AV_NOPTS_VALUE); duration = pts * 10000; asf->duration = FFMAX(asf->duration, duration + pkt->duration * 10000); From e5c32d6da7836c7c9bb8393cb4de7e0997a4363b Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 19 Mar 2013 07:55:25 +0100 Subject: [PATCH 2/3] avplay: remove the -debug option. It just shadows the corresponding AVOption and prevents using named constants. --- avplay.c | 10 ---------- doc/avplay.texi | 2 -- 2 files changed, 12 deletions(-) diff --git a/avplay.c b/avplay.c index 754a69fe6a..3cf9c73ea8 100644 --- a/avplay.c +++ b/avplay.c @@ -243,7 +243,6 @@ static int show_status = 1; static int av_sync_type = AV_SYNC_AUDIO_MASTER; static int64_t start_time = AV_NOPTS_VALUE; static int64_t duration = AV_NOPTS_VALUE; -static int debug = 0; static int debug_mv = 0; static int step = 0; static int workaround_bugs = 1; @@ -2041,7 +2040,6 @@ static int stream_component_open(VideoState *is, int stream_index) codec = avcodec_find_decoder(avctx->codec_id); avctx->debug_mv = debug_mv; - avctx->debug = debug; avctx->workaround_bugs = workaround_bugs; avctx->idct_algo = idct; avctx->skip_frame = skip_frame; @@ -2817,13 +2815,6 @@ static int opt_duration(void *optctx, const char *opt, const char *arg) return 0; } -static int opt_debug(void *optctx, const char *opt, const char *arg) -{ - av_log_set_level(99); - debug = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX); - return 0; -} - static int opt_vismv(void *optctx, const char *opt, const char *arg) { debug_mv = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX); @@ -2848,7 +2839,6 @@ static const OptionDef options[] = { { "f", HAS_ARG, { .func_arg = opt_format }, "force format", "fmt" }, { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, { .func_arg = opt_frame_pix_fmt }, "set pixel format", "format" }, { "stats", OPT_BOOL | OPT_EXPERT, { &show_status }, "show status", "" }, - { "debug", HAS_ARG | OPT_EXPERT, { .func_arg = opt_debug }, "print specific debug info", "" }, { "bug", OPT_INT | HAS_ARG | OPT_EXPERT, { &workaround_bugs }, "workaround bugs", "" }, { "vismv", HAS_ARG | OPT_EXPERT, { .func_arg = opt_vismv }, "visualize motion vectors", "" }, { "fast", OPT_BOOL | OPT_EXPERT, { &fast }, "non spec compliant optimizations", "" }, diff --git a/doc/avplay.texi b/doc/avplay.texi index 8fc33081de..b856f9be8a 100644 --- a/doc/avplay.texi +++ b/doc/avplay.texi @@ -76,8 +76,6 @@ the option @var{pixel_format}. @item -stats Show the stream duration, the codec parameters, the current position in the stream and the audio/video synchronisation drift. -@item -debug -Print specific debug info. @item -bug Work around bugs. @item -vismv From 2c328a907978b61949fd20f7c991803174337855 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 16 Mar 2013 19:37:52 +0100 Subject: [PATCH 3/3] pixdesc: add a function for counting planes in a pixel format. --- doc/APIchanges | 3 +++ libavutil/pixdesc.c | 15 +++++++++++++++ libavutil/pixdesc.h | 6 ++++++ libavutil/version.h | 2 +- 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 2c08af44af..91bbeecfa0 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2012-10-22 API changes, most recent first: +2013-xx-xx - lavu 52.9.0 - pixdesc.h + Add av_pix_fmt_count_planes() function for counting planes in a pixel format. + 2013-xx-xx - lavfi 3.6.0 Add AVFilterGraph.nb_filters, deprecate AVFilterGraph.filter_count. diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index df906ac15a..e1fa87eee9 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -1473,3 +1473,18 @@ int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, return 0; } + +int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt) +{ + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); + int i, planes[4] = { 0 }, ret = 0; + + if (!desc) + return AVERROR(EINVAL); + + for (i = 0; i < desc->nb_components; i++) + planes[desc->comp[i].plane] = 1; + for (i = 0; i < FF_ARRAY_ELEMS(planes); i++) + ret += planes[i]; + return ret; +} diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h index 47e6bb838d..ef93bfed82 100644 --- a/libavutil/pixdesc.h +++ b/libavutil/pixdesc.h @@ -219,5 +219,11 @@ enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc); int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift); +/** + * @return number of planes in pix_fmt, a negative AVERROR if pix_fmt is not a + * valid pixel format. + */ +int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt); + #endif /* AVUTIL_PIXDESC_H */ diff --git a/libavutil/version.h b/libavutil/version.h index d519b50c78..6cbe7ef66d 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -37,7 +37,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 52 -#define LIBAVUTIL_VERSION_MINOR 8 +#define LIBAVUTIL_VERSION_MINOR 9 #define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \