summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2010-12-04 12:56:21 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-12-04 12:56:21 +0000
commitbb4afa13dd3264832bc379bbfefe1db8cf4f0e40 (patch)
tree9ec62bfd5a328dda35f0d6c935aad05da3b924d2 /libavutil
parent4da12e3b13d362e0218956a78dd2b8f7a1260265 (diff)
Deprecate avcodec_pix_fmt_string() in favor of
av_get_pix_fmt_string(), added to libavutil/pixdesc.h. Originally committed as revision 25879 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/avutil.h2
-rw-r--r--libavutil/pixdesc.c14
-rw-r--r--libavutil/pixdesc.h12
3 files changed, 27 insertions, 1 deletions
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index d0234a0872..0ed4c8b776 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -40,7 +40,7 @@
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
#define LIBAVUTIL_VERSION_MAJOR 50
-#define LIBAVUTIL_VERSION_MINOR 33
+#define LIBAVUTIL_VERSION_MINOR 34
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 54f1d7444f..83aa8b01d0 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -851,3 +851,17 @@ int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
return bits >> log2_pixels;
}
+
+char *av_get_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt)
+{
+ /* print header */
+ if (pix_fmt < 0) {
+ snprintf (buf, buf_size, "name " " nb_components" " nb_bits");
+ } else {
+ const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
+ snprintf(buf, buf_size, "%-11s %7d %10d",
+ pixdesc->name, pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
+ }
+
+ return buf;
+}
diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h
index 8d131beb3a..727e47f06a 100644
--- a/libavutil/pixdesc.h
+++ b/libavutil/pixdesc.h
@@ -142,6 +142,18 @@ void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesi
enum PixelFormat av_get_pix_fmt(const char *name);
/**
+ * Print in buf the string corresponding to the pixel format with
+ * number pix_fmt, or an header if pix_fmt is negative.
+ *
+ * @param buf the buffer where to write the string
+ * @param buf_size the size of buf
+ * @param pix_fmt the number of the pixel format to print the
+ * corresponding info string, or a negative value to print the
+ * corresponding header.
+ */
+char *av_get_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt);
+
+/**
* Return the number of bits per pixel used by the pixel format
* described by pixdesc.
*