Mercurial > mplayer.hg
annotate Gui/mplayer/mplayer.c @ 2129:83cfcec275c4
authors
author | gabucino |
---|---|
date | Sun, 07 Oct 2001 22:06:30 +0000 |
parents | 41ed89701ece |
children | 9582af160d04 |
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 "../error.h" | |
17 | |
18 #include "../../config.h" | |
1884 | 19 #include "../../help_mp.h" |
1776 | 20 #include "../../libvo/x11_common.h" |
1693 | 21 |
1697 | 22 #define mplMouseTimerConst 10 |
23 #define mplRedrawTimerConst 5 | |
1693 | 24 |
25 int mplMouseTimer = mplMouseTimerConst; | |
26 int mplRedrawTimer = mplRedrawTimerConst; | |
27 int mplGeneralTimer = -1; | |
28 int mplTimer = 0; | |
29 | |
30 int mplSkinChanged = 0; | |
31 | |
32 void mplMsgHandle( int msg,float param ); | |
33 | |
34 #include "widgets.h" | |
35 #include "play.h" | |
36 #include "menu.h" | |
37 #include "mw.h" | |
38 #include "sw.h" | |
1801 | 39 #include "widgets.h" |
1693 | 40 |
41 void mplTimerHandler( int signum ) | |
42 { | |
43 mplTimer++; | |
44 mplMouseTimer--; | |
45 mplRedrawTimer--; | |
46 mplGeneralTimer--; | |
47 if ( mplMouseTimer == 0 ) mplMsgHandle( evHideMouseCursor,0 ); | |
48 if ( mplRedrawTimer == 0 ) mplMsgHandle( evRedraw,0 ); | |
49 if ( mplGeneralTimer == 0 ) mplMsgHandle( evGeneralTimer,0 ); | |
50 } | |
51 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
52 void mplInit( int argc,char* argv[], char *envp[], void* disp ) |
1693 | 53 { |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1860
diff
changeset
|
54 int i; |
1697 | 55 // allocates shmem to gtkShMem |
1742 | 56 // fork() a process which runs gtkThreadProc() [gtkPID] |
1693 | 57 gtkInit( argc,argv,envp ); |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1860
diff
changeset
|
58 strcpy( gtkShMem->sb.name,skinName ); |
1697 | 59 |
60 // allocates shmem to mplShMem | |
61 // init fields of this struct to default values | |
1693 | 62 mplMPlayerInit( argc,argv,envp ); |
63 | |
1697 | 64 message=mplErrorHandler; // error messagebox drawing function |
1693 | 65 |
1697 | 66 // 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
|
67 wsXInit(disp); |
1693 | 68 |
69 if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) | |
70 { | |
1884 | 71 fprintf( stderr,MSGTR_NEMDB ); |
1693 | 72 exit( 0 ); |
73 } | |
74 | |
75 wsCreateWindow( &appMPlayer.subWindow, | |
76 appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height, | |
77 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsShowWindow,"ViDEO" ); | |
78 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
79 vo_setwindow(appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC); |
1742 | 80 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
|
81 |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1860
diff
changeset
|
82 i=wsHideFrame|wsMaxSize|wsShowWindow; |
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1860
diff
changeset
|
83 if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsShowWindow; |
1693 | 84 wsCreateWindow( &appMPlayer.mainWindow, |
85 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
|
86 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); //wsMinSize| |
1693 | 87 |
88 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); | |
89 | |
90 mplMenuInit(); | |
91 | |
92 #ifdef DEBUG | |
93 dbprintf( 1,"[main] Depth on screen: %d\n",wsDepthOnScreen ); | |
94 dbprintf( 1,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID ); | |
95 dbprintf( 1,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID ); | |
96 #endif | |
97 | |
98 appMPlayer.mainWindow.ReDraw=mplMainDraw; | |
99 appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle; | |
100 appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle; | |
101 | |
102 appMPlayer.subWindow.ReDraw=mplSubDraw; | |
103 appMPlayer.subWindow.MouseHandler=mplSubMouseHandle; | |
104 appMPlayer.subWindow.KeyHandler=mplMainKeyHandle; | |
105 appMPlayer.subWindow.ReSize=mplResize; | |
106 | |
2029 | 107 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); |
2025
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1884
diff
changeset
|
108 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
|
109 |
1693 | 110 wsPostRedisplay( &appMPlayer.mainWindow ); |
111 wsPostRedisplay( &appMPlayer.subWindow ); | |
112 | |
113 btnModify( evSetVolume,mplShMem->Volume ); | |
114 btnModify( evSetBalance,mplShMem->Balance ); | |
115 btnModify( evSetMoviePosition,mplShMem->Position ); | |
116 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
117 mplShMem->Playing=0; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
118 |
1697 | 119 // timerSetHandler( mplTimerHandler ); // various timer hacks |
120 // timerInit(); | |
1693 | 121 |
1709 | 122 // wsMainLoop(); // X event handler (calls mplTimerHandler periodically!) |
123 | |
124 } | |
125 | |
126 void mplDone(){ | |
1693 | 127 |
128 dbprintf( 1,"[mplayer] exit.\n" ); | |
129 | |
130 mplStop(); | |
1697 | 131 // timerDone(); |
132 gtkDone(); // kills the gtkThreadProc() process | |
1693 | 133 wsXDone(); |
1709 | 134 |
1693 | 135 } |
1709 | 136 |