Mercurial > mplayer.hg
annotate Gui/mplayer/mplayer.c @ 3172:bb38b6b072f8
support for FLI image decoding
author | melanson |
---|---|
date | Wed, 28 Nov 2001 01:35:55 +0000 |
parents | 182163807172 |
children | 3e1378354c2e |
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" |
2970 | 21 #include "../../libmpdemux/stream.h" |
1693 | 22 |
1697 | 23 #define mplMouseTimerConst 10 |
24 #define mplRedrawTimerConst 5 | |
1693 | 25 |
26 int mplMouseTimer = mplMouseTimerConst; | |
27 int mplRedrawTimer = mplRedrawTimerConst; | |
28 int mplGeneralTimer = -1; | |
29 int mplTimer = 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" | |
1801 | 38 #include "widgets.h" |
1693 | 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 { |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1860
diff
changeset
|
53 int i; |
2854 | 54 |
55 // allocates shmem to mplShMem | |
56 // init fields of this struct to default values | |
57 mplMPlayerInit( argc,argv,envp ); | |
58 | |
1697 | 59 // allocates shmem to gtkShMem |
1742 | 60 // fork() a process which runs gtkThreadProc() [gtkPID] |
1693 | 61 gtkInit( argc,argv,envp ); |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1860
diff
changeset
|
62 strcpy( gtkShMem->sb.name,skinName ); |
1697 | 63 |
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, | |
3080 | 77 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsHideWindow,"ViDEO" ); |
1693 | 78 |
3080 | 79 wsDestroyImage( &appMPlayer.subWindow ); |
80 wsCreateImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); | |
81 | |
82 vo_setwindow( appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC ); | |
1742 | 83 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
|
84 |
2970 | 85 i=wsHideFrame|wsMaxSize|wsHideWindow; |
86 if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow; | |
1693 | 87 wsCreateWindow( &appMPlayer.mainWindow, |
88 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
|
89 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); //wsMinSize| |
1693 | 90 |
91 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); | |
2970 | 92 |
1693 | 93 mplMenuInit(); |
94 | |
95 #ifdef DEBUG | |
96 dbprintf( 1,"[main] Depth on screen: %d\n",wsDepthOnScreen ); | |
97 dbprintf( 1,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID ); | |
98 dbprintf( 1,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID ); | |
99 #endif | |
100 | |
101 appMPlayer.mainWindow.ReDraw=mplMainDraw; | |
102 appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle; | |
103 appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle; | |
104 | |
105 appMPlayer.subWindow.ReDraw=mplSubDraw; | |
106 appMPlayer.subWindow.MouseHandler=mplSubMouseHandle; | |
107 appMPlayer.subWindow.KeyHandler=mplMainKeyHandle; | |
108 appMPlayer.subWindow.ReSize=mplResize; | |
109 | |
2029 | 110 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); |
3080 | 111 wsClearWindow( appMPlayer.subWindow ); |
2025
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1884
diff
changeset
|
112 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
|
113 |
1693 | 114 wsPostRedisplay( &appMPlayer.mainWindow ); |
115 wsPostRedisplay( &appMPlayer.subWindow ); | |
116 | |
117 btnModify( evSetVolume,mplShMem->Volume ); | |
118 btnModify( evSetBalance,mplShMem->Balance ); | |
119 btnModify( evSetMoviePosition,mplShMem->Position ); | |
120 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
121 mplShMem->Playing=0; |
1693 | 122 |
3080 | 123 wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow ); |
124 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); | |
1709 | 125 } |
126 | |
127 void mplDone(){ | |
1693 | 128 |
129 dbprintf( 1,"[mplayer] exit.\n" ); | |
130 | |
131 mplStop(); | |
1697 | 132 // timerDone(); |
133 gtkDone(); // kills the gtkThreadProc() process | |
1693 | 134 wsXDone(); |
1709 | 135 |
1693 | 136 } |
1709 | 137 |