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