lists.zerezo.com
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
***BOGO*** Re: [MPlayer-dev-eng] [PATCH] wid support with vo_sdl
- Date: Wed, 25 Jun 2008 09:35:26 -0300
- From: "Ricardo Salveti" <ricardo.salveti@xxxxxxxxxxxxx>
- Subject: ***BOGO*** Re: [MPlayer-dev-eng] [PATCH] wid support with vo_sdl
On Wed, Jun 25, 2008 at 8:20 AM, Aurelien Jacobs <aurel@xxxxxxxxxx> wrote:
>> diff -Naur mplayer-trunk-old/libvo/vo_sdl.c mplayer-trunk-new/libvo/vo_sdl.c
>> --- mplayer-trunk-old/libvo/vo_sdl.c 2008-06-25 01:20:51.000000000 -0300
>> +++ mplayer-trunk-new/libvo/vo_sdl.c 2008-06-25 02:36:20.000000000 -0300
>> @@ -793,12 +793,22 @@
>> return -1;
>>
>> /* Set output window title */
>> - SDL_WM_SetCaption (".: MPlayer : F = Fullscreen/Windowed : C = Cycle Fullscreen Resolutions :.", title);
>> + if (WinID < 0)
>> + SDL_WM_SetCaption (".: MPlayer : F = Fullscreen/Windowed : C = Cycle Fullscreen Resolutions :.", title);
>
> Cosmetics.
> (you shouldn't mix cosmetics and functionnal changes, which means, don't
> reindent lines that you don't touch otherwise)
Fixed.
>> - aspect_save_screenres(priv->XWidth,priv->XHeight);
>> - aspect(&priv->dstwidth,&priv->dstheight,A_NOZOOM);
>> + aspect_save_screenres(priv->XWidth,priv->XHeight);
>> [...]
>> + aspect(&priv->dstwidth,&priv->dstheight,A_NOZOOM);
>
> Cosmetics.
Fixed.
Here's the third version of the patch, without these cosmetics changes.
Thanks for reviewing the patch.
Regards,
--
Ricardo Salveti de Araujo
diff -Naur mplayer-trunk-old/libvo/vo_sdl.c mplayer-trunk-new/libvo/vo_sdl.c
--- mplayer-trunk-old/libvo/vo_sdl.c 2008-06-25 01:20:51.000000000 -0300
+++ mplayer-trunk-new/libvo/vo_sdl.c 2008-06-25 09:30:28.000000000 -0300
@@ -793,12 +793,22 @@
return -1;
/* Set output window title */
+ if (WinID < 0)
SDL_WM_SetCaption (".: MPlayer : F = Fullscreen/Windowed : C = Cycle Fullscreen Resolutions :.", title);
//SDL_WM_SetCaption (title, title);
if(priv->X) {
aspect_save_screenres(priv->XWidth,priv->XHeight);
+#ifdef HAVE_X11
+ if (WinID > 0) {
+ if (vo_dwidth > 0) priv->dstwidth = vo_dwidth;
+ if (vo_dheight > 0) priv->dstheight = vo_dheight;
+ }
+ else
+ aspect(&priv->dstwidth,&priv->dstheight,A_NOZOOM);
+#else
aspect(&priv->dstwidth,&priv->dstheight,A_NOZOOM);
+#endif
}
priv->windowsize.w = priv->dstwidth;
@@ -816,6 +826,14 @@
mp_msg(MSGT_VO,MSGL_V, "SDL: using flipped video (only with RGB/BGR/packed YUV)\n"); }
priv->flip = 1;
}
+#ifdef HAVE_X11
+ /* Ignore the other flags when showing inside another window (-wid) */
+ if (WinID > 0) {
+ set_video_mode(priv->dstwidth, priv->dstheight, priv->bpp, priv->sdlflags);
+ if( mp_msg_test(MSGT_VO,MSGL_V) ) {
+ mp_msg(MSGT_VO,MSGL_V, "SDL: setting windowed mode attached to another window\n"); }
+ } else
+#endif
if(flags&VOFLAG_FULLSCREEN) {
if( mp_msg_test(MSGT_VO,MSGL_V) ) {
mp_msg(MSGT_VO,MSGL_V, "SDL: setting zoomed fullscreen without modeswitching\n");}
@@ -1122,6 +1140,18 @@
SDL_Event event;
SDLKey keypressed = 0;
+#ifdef HAVE_X11
+ if (WinID > 0) {
+ int ret = 0;
+ ret = vo_x11_check_events(mDisplay);
+
+ if (ret & VO_EVENT_RESIZE) {
+ set_video_mode(vo_dwidth, vo_dheight, priv->bpp, priv->sdlflags);
+ if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) {
+ mp_msg(MSGT_VO,MSGL_DBG3, "SDL: Window resize\n"); }
+ }
+ }
+#endif
/* Poll the waiting SDL Events */
while ( SDL_PollEvent(&event) ) {
switch (event.type) {
@@ -1586,15 +1616,6 @@
priv->fullmodes = NULL;
priv->bpp = 0;
- /* initialize the SDL Video system */
- if (!SDL_WasInit(SDL_INIT_VIDEO)) {
- if (SDL_Init (SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE)) {
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SDL_InitializationFailed, SDL_GetError());
-
- return -1;
- }
- }
-
SDL_VideoDriverName(priv->driver, 8);
mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SDL_UsingDriver, priv->driver);
@@ -1609,8 +1630,37 @@
if( mp_msg_test(MSGT_VO,MSGL_V) ) {
mp_msg(MSGT_VO,MSGL_V, "SDL: X11 Resolution %ix%i\n", priv->XWidth, priv->XHeight); }
}
+ /* if user want to display at another window, set sdl windowid */
+ if (WinID > 0) {
+ char winid[32];
+ int border, depth;
+
+ vo_window = WinID ? ((Window) WinID) : mRootWin;
+ XUnmapWindow(mDisplay, vo_window);
+ vo_x11_selectinput_witherr(mDisplay, vo_window,
+ StructureNotifyMask |
+ ExposureMask |
+ VisibilityChangeMask |
+ FocusChangeMask);
+ XMapWindow(mDisplay, vo_window);
+ XGetGeometry(mDisplay, vo_window, &mRootWin, &vo_dx, &vo_dy,
+ &vo_dwidth, &vo_dheight, &border, &depth);
+
+ /* set sdl windowid env */
+ snprintf(winid, 32, "%d", WinID);
+ setenv("SDL_WINDOWID", winid, 1);
+ }
#endif
+ /* initialize the SDL Video system */
+ if (!SDL_WasInit(SDL_INIT_VIDEO)) {
+ if (SDL_Init (SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE)) {
+ mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SDL_InitializationFailed, SDL_GetError());
+
+ return -1;
+ }
+ }
+
return 0;
}
_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng@xxxxxxxxxxxx
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng