summaryrefslogtreecommitdiff
path: root/libavcodec/avcodec.h
diff options
context:
space:
mode:
authorJanne Grunau <janne-libav@jannau.net>2012-07-02 11:15:06 +0200
committerJanne Grunau <janne-libav@jannau.net>2012-07-13 19:22:46 +0200
commitac29054fda1fab73c443b7d6f9dd72a9f25f7aae (patch)
treee18167f622e3c3771499582c2fff0589a818bef3 /libavcodec/avcodec.h
parent39bb27bf79bc4c2d8beaed637a14176264cb1916 (diff)
imgconvert: add avcodec_find_best_pix_fmt2()
The number of pixel formats outgrew the number of available bits in the bitmask used in avcodec_find_best_pix_fmt(). avcodec_find_best_pix_fmt2() uses a PIX_FMT_NONE terminated list of pixel formats instead.
Diffstat (limited to 'libavcodec/avcodec.h')
-rw-r--r--libavcodec/avcodec.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index e397bbca83..9e1aa1c927 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -4227,6 +4227,27 @@ int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_
enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt,
int has_alpha, int *loss_ptr);
+/**
+ * Find the best pixel format to convert to given a certain source pixel
+ * 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
+ * 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.
+ *
+ *
+ * @param[in] pix_fmt_list PIX_FMT_NONE terminated array of pixel formats to choose from
+ * @param[in] src_pix_fmt source pixel format
+ * @param[in] has_alpha Whether the source pixel format alpha channel is used.
+ * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
+ * @return The best pixel format to convert to or -1 if none was found.
+ */
+enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat *pix_fmt_list,
+ enum PixelFormat src_pix_fmt,
+ int has_alpha, int *loss_ptr);
+
enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt);
/**