Mercurial > mplayer.hg
comparison libvo/vo_sdl.c @ 5058:33c01c795987
sdl dr support
author | atmos4 |
---|---|
date | Tue, 12 Mar 2002 23:34:52 +0000 |
parents | 6719d1a3be53 |
children | 182fc3f585e8 |
comparison
equal
deleted
inserted
replaced
5057:70878c8927bd | 5058:33c01c795987 |
---|---|
112 #include "video_out_internal.h" | 112 #include "video_out_internal.h" |
113 | 113 |
114 #include "fastmemcpy.h" | 114 #include "fastmemcpy.h" |
115 #include "sub.h" | 115 #include "sub.h" |
116 #include "aspect.h" | 116 #include "aspect.h" |
117 #include "../mp_image.h" | |
117 | 118 |
118 #ifdef HAVE_X11 | 119 #ifdef HAVE_X11 |
119 #include <X11/Xlib.h> | 120 #include <X11/Xlib.h> |
120 #include "x11_common.h" | 121 #include "x11_common.h" |
121 #endif | 122 #endif |
261 | 262 |
262 /* 1 if the OSD has changed otherwise 0 */ | 263 /* 1 if the OSD has changed otherwise 0 */ |
263 int osd_has_changed; | 264 int osd_has_changed; |
264 | 265 |
265 /* source image format (YUV/RGB/...) */ | 266 /* source image format (YUV/RGB/...) */ |
266 int format; | 267 uint32_t format; |
267 | 268 |
268 /* dirty_off_frame[0] contains a bounding box around the osd contents drawn above the image | 269 /* dirty_off_frame[0] contains a bounding box around the osd contents drawn above the image |
269 dirty_off_frame[1] is the corresponding thing for OSD contents drawn below the image | 270 dirty_off_frame[1] is the corresponding thing for OSD contents drawn below the image |
270 */ | 271 */ |
271 SDL_Rect dirty_off_frame[2]; | 272 SDL_Rect dirty_off_frame[2]; |
1653 static uint32_t preinit(const char *arg) | 1654 static uint32_t preinit(const char *arg) |
1654 { | 1655 { |
1655 return 0; | 1656 return 0; |
1656 } | 1657 } |
1657 | 1658 |
1659 static uint32_t get_image(mp_image_t *mpi) | |
1660 { | |
1661 struct sdl_priv_s *priv = &sdl_priv; | |
1662 | |
1663 if(priv->format != mpi->imgfmt) return VO_FALSE; | |
1664 if(mpi->type == MP_IMGTYPE_STATIC || mpi->type == MP_IMGTYPE_TEMP) { | |
1665 if(priv->format == IMGFMT_YV12 || priv->format == SDL_IYUV_OVERLAY) { | |
1666 mpi->planes[0] = priv->overlay->pixels[0] + priv->y*priv->overlay->pitches[0]; | |
1667 mpi->planes[1] = priv->overlay->pixels[1] + priv->y*priv->overlay->pitches[1]/2; | |
1668 mpi->planes[2] = priv->overlay->pixels[2] + priv->y*priv->overlay->pitches[2]/2; | |
1669 mpi->stride[0] = priv->overlay->pitches[0]; | |
1670 mpi->stride[1] = priv->overlay->pitches[1]; | |
1671 mpi->stride[2] = priv->overlay->pitches[2]; | |
1672 } | |
1673 else if(IMGFMT_IS_RGB(priv->format) || IMGFMT_IS_BGR(priv->format)) { | |
1674 if(priv->dblit) { | |
1675 if(mpi->type == MP_IMGTYPE_STATIC && (priv->surface->flags & SDL_DOUBLEBUF)) | |
1676 return VO_FALSE; | |
1677 | |
1678 mpi->planes[0] = priv->surface->pixels + priv->y*priv->surface->pitch; | |
1679 mpi->stride[0] = priv->surface->pitch; | |
1680 } | |
1681 else { | |
1682 mpi->planes[0] = priv->rgbsurface->pixels + priv->y*priv->rgbsurface->pitch; | |
1683 mpi->stride[0] = priv->rgbsurface->pitch; | |
1684 } | |
1685 } | |
1686 else { | |
1687 mpi->planes[0] = priv->overlay->pixels[0] + priv->y*priv->overlay->pitches[0]; | |
1688 mpi->stride[0] = priv->overlay->pitches[0]; | |
1689 } | |
1690 | |
1691 mpi->flags|=MP_IMGFLAG_DIRECT; | |
1692 return VO_TRUE; | |
1693 } | |
1694 | |
1695 return VO_FALSE; | |
1696 } | |
1697 | |
1658 static uint32_t control(uint32_t request, void *data, ...) | 1698 static uint32_t control(uint32_t request, void *data, ...) |
1659 { | 1699 { |
1660 struct sdl_priv_s *priv = &sdl_priv; | 1700 struct sdl_priv_s *priv = &sdl_priv; |
1661 switch (request) { | 1701 switch (request) { |
1702 case VOCTRL_GET_IMAGE: | |
1703 return get_image(data); | |
1662 case VOCTRL_QUERY_FORMAT: | 1704 case VOCTRL_QUERY_FORMAT: |
1663 return query_format(*((uint32_t*)data)); | 1705 return query_format(*((uint32_t*)data)); |
1664 case VOCTRL_FULLSCREEN: | 1706 case VOCTRL_FULLSCREEN: |
1665 if (priv->surface->flags & SDL_FULLSCREEN) { | 1707 if (priv->surface->flags & SDL_FULLSCREEN) { |
1666 set_video_mode(priv->windowsize.w, priv->windowsize.h, priv->bpp, priv->sdlflags); | 1708 set_video_mode(priv->windowsize.w, priv->windowsize.h, priv->bpp, priv->sdlflags); |