aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/pixdesc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-03-20 11:24:11 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-03-20 11:24:11 +0100
commit17ebef2fc8094a235c0f30ce247c77659ea86539 (patch)
treee5e435fe4269c33888e1f55fc09b32e787e3479e /libavutil/pixdesc.c
parentdb8403d04afc025278f611d43a91429bbfa44026 (diff)
parent2c328a907978b61949fd20f7c991803174337855 (diff)
downloadffmpeg-17ebef2fc8094a235c0f30ce247c77659ea86539.tar.gz
Merge commit '2c328a907978b61949fd20f7c991803174337855'
* commit '2c328a907978b61949fd20f7c991803174337855': pixdesc: add a function for counting planes in a pixel format. avplay: remove the -debug option. Revert "asfenc: return error on negative timestamp" Conflicts: doc/APIchanges doc/ffplay.texi ffplay.c libavutil/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/pixdesc.c')
-rw-r--r--libavutil/pixdesc.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 1016dbaecb..31363cfb61 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -1791,3 +1791,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;
+}