Mercurial > mplayer.hg
annotate Gui/mplayer/mplayer.c @ 5270:870e932096ff
Support for cropping in mencoder. New options:
-x0, -y0: upper-left corner of rectangle to be cut out
-xsize, -ysize: Size of rectangle to cut out
Cropping is done before scaling.
author | ksorim |
---|---|
date | Sat, 23 Mar 2002 13:13:12 +0000 |
parents | b3bd4b29a03b |
children | b8d8d72776f2 |
rev | line source |
---|---|
1693 | 1 |
2 #include <stdlib.h> | |
3 #include <stdio.h> | |
4 #include <string.h> | |
4428 | 5 #include <inttypes.h> |
1693 | 6 |
7 #include "./mplayer.h" | |
8 #include "../events.h" | |
9 #include "../app.h" | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
10 #include "../interface.h" |
1693 | 11 #include "../skin/skin.h" |
12 #include "../skin/font.h" | |
13 #include "../wm/ws.h" | |
14 #include "../wm/wskeys.h" | |
15 #include "../wm/widget.h" | |
16 #include "../bitmap/bitmap.h" | |
17 | |
18 #include "../../config.h" | |
1884 | 19 #include "../../help_mp.h" |
1776 | 20 #include "../../libvo/x11_common.h" |
2970 | 21 #include "../../libmpdemux/stream.h" |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
22 #include "../../mp_msg.h" |
1693 | 23 |
1697 | 24 #define mplMouseTimerConst 10 |
25 #define mplRedrawTimerConst 5 | |
1693 | 26 |
27 int mplMouseTimer = mplMouseTimerConst; | |
28 int mplRedrawTimer = mplRedrawTimerConst; | |
29 int mplTimer = 0; | |
30 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
31 void mplEventHandling( int msg,float param ); |
1693 | 32 |
33 #include "widgets.h" | |
34 #include "play.h" | |
35 #include "menu.h" | |
36 #include "mw.h" | |
37 #include "sw.h" | |
1801 | 38 #include "widgets.h" |
1693 | 39 |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
40 void mplTimerHandler( void ) |
1693 | 41 { |
42 mplTimer++; | |
43 mplMouseTimer--; | |
44 mplRedrawTimer--; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
45 if ( mplMouseTimer == 0 ) mplEventHandling( evHideMouseCursor,0 ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
46 if ( mplRedrawTimer == 0 ) mplEventHandling( evRedraw,0 ); |
1693 | 47 } |
48 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
49 void mplInit( int argc,char* argv[], char *envp[], void* disp ) |
1693 | 50 { |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1860
diff
changeset
|
51 int i; |
2854 | 52 |
53 // init fields of this struct to default values | |
54 mplMPlayerInit( argc,argv,envp ); | |
55 | |
1742 | 56 // fork() a process which runs gtkThreadProc() [gtkPID] |
1693 | 57 gtkInit( argc,argv,envp ); |
58 | |
1697 | 59 // opens X display, checks for extensions (XShape, DGA etc) |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
60 wsXInit(disp); |
1693 | 61 |
62 if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) | |
63 { | |
1884 | 64 fprintf( stderr,MSGTR_NEMDB ); |
1693 | 65 exit( 0 ); |
66 } | |
67 | |
68 wsCreateWindow( &appMPlayer.subWindow, | |
69 appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height, | |
3080 | 70 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsHideWindow,"ViDEO" ); |
1693 | 71 |
3080 | 72 wsDestroyImage( &appMPlayer.subWindow ); |
73 wsCreateImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); | |
74 | |
75 vo_setwindow( appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC ); | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
76 |
2970 | 77 i=wsHideFrame|wsMaxSize|wsHideWindow; |
78 if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow; | |
1693 | 79 wsCreateWindow( &appMPlayer.mainWindow, |
80 appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height, | |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1860
diff
changeset
|
81 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); //wsMinSize| |
1693 | 82 |
83 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
84 |
1693 | 85 mplMenuInit(); |
86 | |
87 #ifdef DEBUG | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
88 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] Depth on screen: %d\n",wsDepthOnScreen ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
89 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
90 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID ); |
1693 | 91 #endif |
92 | |
93 appMPlayer.mainWindow.ReDraw=mplMainDraw; | |
94 appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle; | |
95 appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle; | |
96 | |
97 appMPlayer.subWindow.ReDraw=mplSubDraw; | |
98 appMPlayer.subWindow.MouseHandler=mplSubMouseHandle; | |
99 appMPlayer.subWindow.KeyHandler=mplMainKeyHandle; | |
100 | |
2029 | 101 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); |
3080 | 102 wsClearWindow( appMPlayer.subWindow ); |
2025
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1884
diff
changeset
|
103 if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); |
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1884
diff
changeset
|
104 |
1693 | 105 wsPostRedisplay( &appMPlayer.mainWindow ); |
106 wsPostRedisplay( &appMPlayer.subWindow ); | |
107 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
108 btnModify( evSetVolume,guiIntfStruct.Volume ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
109 btnModify( evSetBalance,guiIntfStruct.Balance ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
110 btnModify( evSetMoviePosition,guiIntfStruct.Position ); |
5046 | 111 |
112 if ( fullscreen ) | |
113 { | |
114 btnModify( evFullScreen,btnPressed ); | |
115 mplFullScreen(); | |
116 } | |
1693 | 117 |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4797
diff
changeset
|
118 guiIntfStruct.Playing=0; |
1693 | 119 |
3080 | 120 wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow ); |
121 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); | |
1709 | 122 } |
123 |