mirror of https://github.com/mpv-player/mpv
vo_sdl: fix pixel formats.
There were two mistakes: - SDL's RGB565 is always equivalent to ffmpeg's RGB565 (both are packed 16bit native-endian integers in RGB=565 form) - this was wrongly reversed on big endian platforms. - SDL's RGB888 doesn't actually mean RGB24, but XRGB8888 (i.e. 32bit packed integer, top 8 bits unused). - Use RGB0 not RGBA when there is no alpha.
This commit is contained in:
parent
bea2e39721
commit
9cc5507079
|
@ -58,30 +58,27 @@ const struct formatmap_entry formats[] = {
|
|||
{SDL_PIXELFORMAT_UYVY, IMGFMT_UYVY, 0},
|
||||
//{SDL_PIXELFORMAT_YVYU, IMGFMT_YVYU, 0},
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
{SDL_PIXELFORMAT_RGBX8888, IMGFMT_RGBA, 0}, // has no alpha -> bad for OSD
|
||||
{SDL_PIXELFORMAT_BGRX8888, IMGFMT_BGRA, 0}, // has no alpha -> bad for OSD
|
||||
{SDL_PIXELFORMAT_RGB888, IMGFMT_0RGB, 0}, // RGB888 means XRGB8888
|
||||
{SDL_PIXELFORMAT_RGBX8888, IMGFMT_RGB0, 0}, // has no alpha -> bad for OSD
|
||||
{SDL_PIXELFORMAT_BGR888, IMGFMT_0BGR, 0}, // BGR888 means XBGR8888
|
||||
{SDL_PIXELFORMAT_BGRX8888, IMGFMT_BGR0, 0}, // has no alpha -> bad for OSD
|
||||
{SDL_PIXELFORMAT_ARGB8888, IMGFMT_ARGB, 1}, // matches SUBBITMAP_RGBA
|
||||
{SDL_PIXELFORMAT_RGBA8888, IMGFMT_RGBA, 1},
|
||||
{SDL_PIXELFORMAT_ABGR8888, IMGFMT_ABGR, 1},
|
||||
{SDL_PIXELFORMAT_BGRA8888, IMGFMT_BGRA, 1},
|
||||
{SDL_PIXELFORMAT_RGB24, IMGFMT_RGB24, 0},
|
||||
{SDL_PIXELFORMAT_BGR24, IMGFMT_BGR24, 0},
|
||||
{SDL_PIXELFORMAT_RGB888, IMGFMT_RGB24, 0},
|
||||
{SDL_PIXELFORMAT_BGR888, IMGFMT_BGR24, 0},
|
||||
{SDL_PIXELFORMAT_BGR565, IMGFMT_RGB565, 0},
|
||||
#else
|
||||
{SDL_PIXELFORMAT_RGBX8888, IMGFMT_ABGR, 0}, // has no alpha -> bad for OSD
|
||||
{SDL_PIXELFORMAT_BGRX8888, IMGFMT_ARGB, 0}, // has no alpha -> bad for OSD
|
||||
{SDL_PIXELFORMAT_RGB888, IMGFMT_BGR0, 0}, // RGB888 means XRGB8888
|
||||
{SDL_PIXELFORMAT_RGBX8888, IMGFMT_0BGR, 0}, // has no alpha -> bad for OSD
|
||||
{SDL_PIXELFORMAT_BGR888, IMGFMT_RGB0, 0}, // BGR888 means XBGR8888
|
||||
{SDL_PIXELFORMAT_BGRX8888, IMGFMT_0RGB, 0}, // has no alpha -> bad for OSD
|
||||
{SDL_PIXELFORMAT_ARGB8888, IMGFMT_BGRA, 1}, // matches SUBBITMAP_RGBA
|
||||
{SDL_PIXELFORMAT_RGBA8888, IMGFMT_ABGR, 1},
|
||||
{SDL_PIXELFORMAT_ABGR8888, IMGFMT_RGBA, 1},
|
||||
{SDL_PIXELFORMAT_BGRA8888, IMGFMT_ARGB, 1},
|
||||
#endif
|
||||
{SDL_PIXELFORMAT_RGB24, IMGFMT_RGB24, 0},
|
||||
{SDL_PIXELFORMAT_BGR24, IMGFMT_BGR24, 0},
|
||||
{SDL_PIXELFORMAT_RGB888, IMGFMT_BGR24, 0},
|
||||
{SDL_PIXELFORMAT_BGR888, IMGFMT_RGB24, 0},
|
||||
{SDL_PIXELFORMAT_RGB565, IMGFMT_RGB565, 0},
|
||||
#endif
|
||||
};
|
||||
|
||||
struct keymap_entry {
|
||||
|
|
Loading…
Reference in New Issue