diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-10-12 15:16:53 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-10-12 15:34:49 +0200 |
commit | a33ed6bc74b6b8ada925c76c4084afcf8870a048 (patch) | |
tree | 605fa1fc8e55698f892837e7d0191da5e5c34c1c /libavutil/pixdesc.c | |
parent | f391e405dfde35bfb3fea9ccc09bd67b5cc0a8f2 (diff) | |
parent | b7f1010c8fce09096057528f7cd29589ea1ae7df (diff) | |
download | ffmpeg-a33ed6bc74b6b8ada925c76c4084afcf8870a048.tar.gz |
Merge commit 'b7f1010c8fce09096057528f7cd29589ea1ae7df'
* commit 'b7f1010c8fce09096057528f7cd29589ea1ae7df':
tools: do not use av_pix_fmt_descriptors directly.
pixdesc: add functions for accessing pixel format descriptors.
build: add support for Tru64 (OSF/1)
md5: Allocate a normal private context for the opaque md5 context pointer
Conflicts:
cmdutils.c
doc/APIchanges
ffprobe.c
libavformat/md5enc.c
libavutil/version.h
tools/graph2dot.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/pixdesc.c')
-rw-r--r-- | libavutil/pixdesc.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 0958718b50..3b5f2643c2 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -21,6 +21,8 @@ #include <stdio.h> #include <string.h> + +#include "common.h" #include "pixfmt.h" #include "pixdesc.h" @@ -122,6 +124,9 @@ void av_write_image_line(const uint16_t *src, } } +#if !FF_API_PIX_FMT_DESC +static +#endif const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { [AV_PIX_FMT_YUV420P] = { .name = "yuv420p", @@ -1485,3 +1490,28 @@ char *av_get_pix_fmt_string (char *buf, int buf_size, enum AVPixelFormat pix_fmt return buf; } + +const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) +{ + if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) + return NULL; + return &av_pix_fmt_descriptors[pix_fmt]; +} + +const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) +{ + if (!prev) + return &av_pix_fmt_descriptors[0]; + if (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) + return prev + 1; + return NULL; +} + +enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc) +{ + if (desc < av_pix_fmt_descriptors || + desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors)) + return AV_PIX_FMT_NONE; + + return desc - av_pix_fmt_descriptors; +} |