[MPlayer-cvslog] r36358 - in trunk/gui: interface.c interface.h ui/actions.c win32/gui.c win32/interface.c
ib
subversion at mplayerhq.hu
Sat Jul 13 21:45:12 CEST 2013
Author: ib
Date: Sat Jul 13 21:45:12 2013
New Revision: 36358
Log:
Enable the change of the movie aspect ratio on the fly.
The change of the ratio won't restart the movie any longer now.
Based on a patch by Stephen Sheldon, sfsheldo gmail com.
Modified:
trunk/gui/interface.c
trunk/gui/interface.h
trunk/gui/ui/actions.c
trunk/gui/win32/gui.c
trunk/gui/win32/interface.c
Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c Sat Jul 13 21:42:44 2013 (r36357)
+++ trunk/gui/interface.c Sat Jul 13 21:45:12 2013 (r36358)
@@ -640,6 +640,7 @@ int gui(int what, void *data)
/* video */
guiInfo.sh_video = data;
+ guiInfo.VideoAspect = 0;
nfree(guiInfo.CodecName);
Modified: trunk/gui/interface.h
==============================================================================
--- trunk/gui/interface.h Sat Jul 13 21:42:44 2013 (r36357)
+++ trunk/gui/interface.h Sat Jul 13 21:45:12 2013 (r36358)
@@ -104,6 +104,7 @@ typedef struct {
int VideoWindow;
int VideoWidth;
int VideoHeight;
+ float VideoAspect;
char *CodecName;
Modified: trunk/gui/ui/actions.c
==============================================================================
--- trunk/gui/ui/actions.c Sat Jul 13 21:42:44 2013 (r36357)
+++ trunk/gui/ui/actions.c Sat Jul 13 21:45:12 2013 (r36358)
@@ -48,7 +48,6 @@
#include "mpcommon.h"
#include "mplayer.h"
#include "input/input.h"
-#include "libmpcodecs/vd.h"
#include "libmpdemux/demuxer.h"
#include "libvo/video_out.h"
#include "libvo/wskeys.h"
@@ -93,6 +92,8 @@ void uiEvent(int ev, float param)
{
int iparam = (int)param, osd;
mixer_t *mixer = mpctx_get_mixer(guiInfo.mpcontext);
+ float aspect;
+ char cmd[32];
switch (ev) {
/* user events */
@@ -424,30 +425,29 @@ play:
case evSetAspect:
+ if (guiInfo.VideoAspect == 0)
+ guiInfo.VideoAspect = guiInfo.sh_video->aspect;
+
switch (iparam) {
case 2:
- movie_aspect = 16.0f / 9.0f;
+ aspect = 16.0f / 9.0f;
break;
case 3:
- movie_aspect = 4.0f / 3.0f;
+ aspect = 4.0f / 3.0f;
break;
case 4:
- movie_aspect = 2.35;
+ aspect = 2.35;
break;
case 1:
default:
- movie_aspect = -1;
+ aspect = guiInfo.VideoAspect;
}
- if (guiInfo.StreamType == STREAMTYPE_VCD)
- uiEvent(evPlayVCD, 0);
- else if (guiInfo.StreamType == STREAMTYPE_DVD)
- uiEvent(ivPlayDVD, 0);
- else
- guiInfo.NewPlay = GUI_FILE_NEW;
+ snprintf(cmd, sizeof(cmd), "switch_ratio %f", aspect);
+ mp_input_queue_cmd(mp_input_parse_cmd(cmd));
break;
Modified: trunk/gui/win32/gui.c
==============================================================================
--- trunk/gui/win32/gui.c Sat Jul 13 21:42:44 2013 (r36357)
+++ trunk/gui/win32/gui.c Sat Jul 13 21:45:12 2013 (r36358)
@@ -353,6 +353,8 @@ static void updatedisplay(gui_t *gui, HW
static LRESULT CALLBACK VideoProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
+ float aspect;
+ char cmd[32];
gui_t *gui = (gui_t *) GetWindowLongPtr(hWnd, GWLP_USERDATA);
if (gui && (gui->videowindow != hWnd)) return FALSE;
@@ -468,16 +470,27 @@ static LRESULT CALLBACK VideoProc(HWND h
mp_input_queue_cmd(mp_input_parse_cmd("mute"));
break;
case ID_ASPECT1:
- mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 1.777777"));
+ case ID_ASPECT2:
+ case ID_ASPECT3:
+ case ID_ASPECT4:
+ if (guiInfo.VideoAspect == 0) guiInfo.VideoAspect = guiInfo.sh_video->aspect;
+ switch (LOWORD(wParam))
+ {
+ case ID_ASPECT1:
+ aspect = 16.0f / 9.0f;
break;
case ID_ASPECT2:
- mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 1.333333"));
+ aspect = 4.0f / 3.0f;
break;
case ID_ASPECT3:
- mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 2.35"));
+ aspect = 2.35;
break;
- case ID_ASPECT4:
- mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 0"));
+ default:
+ aspect = guiInfo.VideoAspect;
+ break;
+ }
+ snprintf(cmd, sizeof(cmd), "switch_ratio %f", aspect);
+ mp_input_queue_cmd(mp_input_parse_cmd(cmd));
break;
case IDSUB_TOGGLE:
mp_input_queue_cmd(mp_input_parse_cmd("sub_visibility"));
Modified: trunk/gui/win32/interface.c
==============================================================================
--- trunk/gui/win32/interface.c Sat Jul 13 21:42:44 2013 (r36357)
+++ trunk/gui/win32/interface.c Sat Jul 13 21:45:12 2013 (r36358)
@@ -628,6 +628,7 @@ int gui(int what, void *data)
case GUI_SET_VIDEO:
{
guiInfo.sh_video = data;
+ guiInfo.VideoAspect = 0;
if (data)
{
sh_video_t *sh = data;
More information about the MPlayer-cvslog
mailing list