Mercurial > mplayer.hg
annotate Gui/mplayer/mplayer.c @ 1754:3e2a7150cf11
largefile printf fix
author | arpi |
---|---|
date | Wed, 29 Aug 2001 17:39:10 +0000 |
parents | 0880718750d5 |
children | 48e6351f5714 |
rev | line source |
---|---|
1693 | 1 |
2 #include <stdlib.h> | |
3 #include <stdio.h> | |
4 #include <string.h> | |
5 | |
6 #include "./mplayer.h" | |
7 #include "../events.h" | |
8 #include "../app.h" | |
9 #include "../skin/skin.h" | |
10 #include "../skin/font.h" | |
11 #include "../wm/ws.h" | |
12 #include "../wm/wskeys.h" | |
13 #include "../wm/widget.h" | |
14 #include "../bitmap/bitmap.h" | |
15 #include "../timer.h" | |
16 #include "../language.h" | |
17 #include "../error.h" | |
18 | |
19 #include "../../config.h" | |
20 | |
1697 | 21 #define mplMouseTimerConst 10 |
22 #define mplRedrawTimerConst 5 | |
1693 | 23 |
24 int mplMouseTimer = mplMouseTimerConst; | |
25 int mplRedrawTimer = mplRedrawTimerConst; | |
26 int mplGeneralTimer = -1; | |
27 int mplTimer = 0; | |
28 | |
29 int mplSkinChanged = 0; | |
30 | |
31 void mplMsgHandle( int msg,float param ); | |
32 | |
33 #include "widgets.h" | |
34 #include "play.h" | |
35 #include "menu.h" | |
36 #include "mw.h" | |
37 #include "sw.h" | |
38 #include "widget.h" | |
39 | |
40 void mplTimerHandler( int signum ) | |
41 { | |
42 mplTimer++; | |
43 mplMouseTimer--; | |
44 mplRedrawTimer--; | |
45 mplGeneralTimer--; | |
46 if ( mplMouseTimer == 0 ) mplMsgHandle( evHideMouseCursor,0 ); | |
47 if ( mplRedrawTimer == 0 ) mplMsgHandle( evRedraw,0 ); | |
48 if ( mplGeneralTimer == 0 ) mplMsgHandle( evGeneralTimer,0 ); | |
49 } | |
50 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
51 void mplInit( int argc,char* argv[], char *envp[], void* disp ) |
1693 | 52 { |
53 // parse_cfgfiles( argc,argv,envp ); | |
1697 | 54 |
55 // allocates shmem to gtkShMem | |
1742 | 56 // fork() a process which runs gtkThreadProc() [gtkPID] |
1693 | 57 gtkInit( argc,argv,envp ); |
1697 | 58 |
59 // allocates shmem to mplShMem | |
60 // init fields of this struct to default values | |
1693 | 61 mplMPlayerInit( argc,argv,envp ); |
62 | |
1697 | 63 message=mplErrorHandler; // error messagebox drawing function |
1693 | 64 |
1697 | 65 // 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
|
66 wsXInit(disp); |
1693 | 67 |
68 if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) | |
69 { | |
70 fprintf( stderr,langNEMDB ); | |
71 exit( 0 ); | |
72 } | |
73 | |
74 wsCreateWindow( &appMPlayer.subWindow, | |
75 appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height, | |
76 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsShowWindow,"ViDEO" ); | |
77 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
78 vo_setwindow(appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC); |
1742 | 79 vo_setwindowsize( appMPlayer.sub.width,appMPlayer.sub.height ); |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
80 mplSubRender=0; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
81 |
1693 | 82 wsCreateWindow( &appMPlayer.mainWindow, |
83 appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height, | |
84 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsHideFrame|wsMaxSize|wsMinSize|wsShowWindow,"MPlayer" ); | |
85 | |
86 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); | |
87 | |
88 mplMenuInit(); | |
89 | |
90 #ifdef DEBUG | |
91 dbprintf( 1,"[main] Depth on screen: %d\n",wsDepthOnScreen ); | |
92 dbprintf( 1,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID ); | |
93 dbprintf( 1,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID ); | |
94 #endif | |
95 | |
96 appMPlayer.mainWindow.ReDraw=mplMainDraw; | |
97 appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle; | |
98 appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle; | |
99 | |
100 appMPlayer.subWindow.ReDraw=mplSubDraw; | |
101 appMPlayer.subWindow.MouseHandler=mplSubMouseHandle; | |
102 appMPlayer.subWindow.KeyHandler=mplMainKeyHandle; | |
103 appMPlayer.subWindow.ReSize=mplResize; | |
104 | |
105 wsPostRedisplay( &appMPlayer.mainWindow ); | |
106 wsPostRedisplay( &appMPlayer.subWindow ); | |
107 | |
108 btnModify( evSetVolume,mplShMem->Volume ); | |
109 btnModify( evSetBalance,mplShMem->Balance ); | |
110 btnModify( evSetMoviePosition,mplShMem->Position ); | |
111 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
112 mplShMem->Playing=0; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
113 |
1697 | 114 // timerSetHandler( mplTimerHandler ); // various timer hacks |
115 // timerInit(); | |
1693 | 116 |
1709 | 117 // wsMainLoop(); // X event handler (calls mplTimerHandler periodically!) |
118 | |
119 } | |
120 | |
121 void mplDone(){ | |
1693 | 122 |
123 dbprintf( 1,"[mplayer] exit.\n" ); | |
124 | |
125 mplStop(); | |
1697 | 126 // timerDone(); |
127 gtkDone(); // kills the gtkThreadProc() process | |
1693 | 128 wsXDone(); |
1709 | 129 |
1693 | 130 } |
1709 | 131 |