aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar lucabe <lucabe@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-07-31 12:35:04 +0000
committerGravatar lucabe <lucabe@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-07-31 12:35:04 +0000
commitd3b998da64927403879ad588287c178f86b7c849 (patch)
tree6c7c19e6e1ec353cc66511b4842083cfe66346b8
parent63ccd4d06a461b029c0bf2402cabcd8ade1200f9 (diff)
Add support for ffmpeg's pixel format names in libswscale
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19276 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--libswscale/swscale.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 3666ed225d..3291f8f82d 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -210,6 +210,22 @@ extern const uint8_t dither_8x8_32[8][8];
extern const uint8_t dither_8x8_73[8][8];
extern const uint8_t dither_8x8_220[8][8];
+/* Used for ffmpeg --> MPlayer format name conversion */
+static const int fmt_name[PIX_FMT_NB] = {
+ [PIX_FMT_YUV420P] = IMGFMT_I420, ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples)
+ [PIX_FMT_YUV422] = IMGFMT_Y422,
+ [PIX_FMT_RGB24] = IMGFMT_RGB24, ///< Packed pixel, 3 bytes per pixel, RGBRGB...
+ [PIX_FMT_BGR24] = IMGFMT_BGR24, ///< Packed pixel, 3 bytes per pixel, BGRBGR...
+ [PIX_FMT_YUV422P] = IMGFMT_422P, ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
+ [PIX_FMT_YUV444P] = IMGFMT_444P, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
+ [PIX_FMT_RGBA32] = IMGFMT_RGB32, ///< Packed pixel, 4 bytes per pixel, BGRABGRA..., stored in cpu endianness
+ [PIX_FMT_YUV410P] = IMGFMT_YVU9, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
+ [PIX_FMT_YUV411P] = IMGFMT_411P, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
+ [PIX_FMT_RGB565] = IMGFMT_RGB16, ///< always stored in cpu endianness
+ [PIX_FMT_RGB555] = IMGFMT_RGB15, ///< always stored in cpu endianness, most significant bit to 1
+ [PIX_FMT_UYVY422] = IMGFMT_UYVY, ///< Packed pixel, Cb Y0 Cr Y1
+};
+
char *sws_format_name(int format)
{
static char fmt_name[64];
@@ -1873,6 +1889,12 @@ SwsContext *sws_getContext(int srcW, int srcH, int origSrcFormat, int dstW, int
if(rgb15to16 == NULL) sws_rgb2rgb_init(flags);
/* avoid duplicate Formats, so we don't need to check to much */
+ if (origSrcFormat < PIX_FMT_NB) {
+ origSrcFormat = fmt_name[origSrcFormat];
+ }
+ if (origDstFormat < PIX_FMT_NB) {
+ origDstFormat = fmt_name[origDstFormat];
+ }
srcFormat = remove_dup_fourcc(origSrcFormat);
dstFormat = remove_dup_fourcc(origDstFormat);