Mercurial > mplayer.hg
annotate gui/app.c @ 33259:04dc3e55cd90
Increase the maximum value of the DVB timeout to 240 seconds.
Some devices may need more time for the initial tune (e.g. firmware loading).
Let the user specify higher timeout value if there is need to.
The default remains 30 seconds.
author | iive |
---|---|
date | Sun, 01 May 2011 18:07:59 +0000 |
parents | f0c2a62e3e89 |
children | de4f5f183ddb |
rev | line source |
---|---|
26458 | 1 /* |
2 * This file is part of MPlayer. | |
3 * | |
4 * MPlayer is free software; you can redistribute it and/or modify | |
5 * it under the terms of the GNU General Public License as published by | |
6 * the Free Software Foundation; either version 2 of the License, or | |
7 * (at your option) any later version. | |
8 * | |
9 * MPlayer is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License along | |
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
17 */ | |
23077 | 18 |
19 #include "app.h" | |
32897 | 20 |
32921 | 21 #include "interface.h" |
32983 | 22 #include "skin/font.h" |
32921 | 23 |
32944 | 24 #include "libavutil/common.h" |
25 | |
32937 | 26 guiItems appMPlayer; |
32897 | 27 |
28 static const evName evNames[] = { | |
29 { evNone, "evNone" }, | |
30 { evPlay, "evPlay" }, | |
31 { evStop, "evStop" }, | |
32 { evPause, "evPause" }, | |
33 { evPrev, "evPrev" }, | |
34 { evNext, "evNext" }, | |
35 { evLoad, "evLoad" }, | |
36 { evEqualizer, "evEqualizer" }, | |
37 { evPlayList, "evPlaylist" }, | |
38 { evExit, "evExit" }, | |
39 { evIconify, "evIconify" }, | |
40 { evIncBalance, "evIncBalance" }, // NOTE TO MYSELF: not all of these events | |
41 { evDecBalance, "evDecBalance" }, // are actually implemented, and update doc | |
42 { evFullScreen, "evFullScreen" }, | |
43 { evFName, "evFName" }, | |
44 { evMovieTime, "evMovieTime" }, | |
45 { evAbout, "evAbout" }, | |
46 { evLoadPlay, "evLoadPlay" }, | |
47 { evPreferences, "evPreferences" }, | |
48 { evSkinBrowser, "evSkinBrowser" }, | |
49 { evBackward10sec, "evBackward10sec" }, | |
50 { evForward10sec, "evForward10sec" }, | |
51 { evBackward1min, "evBackward1min" }, | |
52 { evForward1min, "evForward1min" }, | |
53 { evBackward10min, "evBackward10min" }, | |
54 { evForward10min, "evForward10min" }, | |
55 { evIncVolume, "evIncVolume" }, | |
56 { evDecVolume, "evDecVolume" }, | |
57 { evMute, "evMute" }, | |
58 { evIncAudioBufDelay, "evIncAudioBufDelay" }, | |
59 { evDecAudioBufDelay, "evDecAudioBufDelay" }, | |
60 { evPlaySwitchToPause, "evPlaySwitchToPause" }, | |
61 { evPauseSwitchToPlay, "evPauseSwitchToPlay" }, | |
62 { evNormalSize, "evHalfSize" }, | |
63 { evNormalSize, "evNormalSize" }, | |
64 { evDoubleSize, "evDoubleSize" }, | |
65 { evSetMoviePosition, "evSetMoviePosition" }, | |
66 { evSetVolume, "evSetVolume" }, | |
67 { evSetBalance, "evSetBalance" }, | |
68 { evHelp, "evHelp" }, | |
69 { evLoadSubtitle, "evLoadSubtitle" }, | |
70 { evPlayDVD, "evPlayDVD" }, | |
71 { evPlayVCD, "evPlayVCD" }, | |
72 { evSetURL, "evSetURL" }, | |
73 { evLoadAudioFile, "evLoadAudioFile" }, | |
74 { evDropSubtitle, "evDropSubtitle" }, | |
75 { evSetAspect, "evSetAspect" } | |
76 }; | |
23077 | 77 |
32898 | 78 static void appClearItem(wItem *item) |
23077 | 79 { |
32917
9949f3a123cf
Add new function bpFree() to free txSamples (bitmaps).
ib
parents:
32912
diff
changeset
|
80 bpFree(&item->Bitmap); |
32921 | 81 bpFree(&item->Mask); |
32947 | 82 free(item->label); |
83 free(item->text); | |
32946 | 84 memset(item, 0, sizeof(*item)); |
23077 | 85 } |
86 | |
32945 | 87 void appInitStruct(void) |
32927 | 88 { |
32931
03b1051bed5c
Rename the 'NumberOf' members of the listItems structure.
ib
parents:
32930
diff
changeset
|
89 appMPlayer.IndexOfMainItems = -1; |
03b1051bed5c
Rename the 'NumberOf' members of the listItems structure.
ib
parents:
32930
diff
changeset
|
90 appMPlayer.IndexOfBarItems = -1; |
03b1051bed5c
Rename the 'NumberOf' members of the listItems structure.
ib
parents:
32930
diff
changeset
|
91 appMPlayer.IndexOfMenuItems = -1; |
32927 | 92 } |
93 | |
32932 | 94 void appFreeStruct(void) |
23077 | 95 { |
32897 | 96 int i; |
97 | |
32929 | 98 appClearItem(&appMPlayer.main); |
99 appMPlayer.mainDecoration = 0; | |
100 | |
101 appClearItem(&appMPlayer.sub); | |
102 | |
103 appClearItem(&appMPlayer.bar); | |
104 appMPlayer.barIsPresent = 0; | |
105 | |
33084 | 106 appClearItem(&appMPlayer.menu); |
32929 | 107 appClearItem(&appMPlayer.menuSelected); |
108 appMPlayer.menuIsPresent = 0; | |
109 | |
32931
03b1051bed5c
Rename the 'NumberOf' members of the listItems structure.
ib
parents:
32930
diff
changeset
|
110 for (i = 0; i <= appMPlayer.IndexOfMainItems; i++) |
32926 | 111 appClearItem(&appMPlayer.mainItems[i]); |
32931
03b1051bed5c
Rename the 'NumberOf' members of the listItems structure.
ib
parents:
32930
diff
changeset
|
112 for (i = 0; i <= appMPlayer.IndexOfBarItems; i++) |
32926 | 113 appClearItem(&appMPlayer.barItems[i]); |
32931
03b1051bed5c
Rename the 'NumberOf' members of the listItems structure.
ib
parents:
32930
diff
changeset
|
114 for (i = 0; i <= appMPlayer.IndexOfMenuItems; i++) |
32926 | 115 appClearItem(&appMPlayer.menuItems[i]); |
32897 | 116 |
32945 | 117 appInitStruct(); |
32933 | 118 fntFreeFont(); |
23077 | 119 } |
120 | |
32897 | 121 int appFindMessage(unsigned char *str) |
23077 | 122 { |
32944 | 123 unsigned int i; |
32897 | 124 |
32944 | 125 for (i = 0; i < FF_ARRAY_ELEMS(evNames); i++) |
32897 | 126 if (!strcmp(evNames[i].name, str)) |
32911 | 127 return evNames[i].message; |
32897 | 128 |
129 return -1; | |
23077 | 130 } |
131 | |
32897 | 132 void btnModify(int event, float state) |
23077 | 133 { |
32897 | 134 int i; |
135 | |
32931
03b1051bed5c
Rename the 'NumberOf' members of the listItems structure.
ib
parents:
32930
diff
changeset
|
136 for (i = 0; i <= appMPlayer.IndexOfMainItems; i++) { |
32912 | 137 if (appMPlayer.mainItems[i].message == event) { |
138 switch (appMPlayer.mainItems[i].type) { | |
32897 | 139 case itButton: |
32912 | 140 appMPlayer.mainItems[i].pressed = (int)state; |
32897 | 141 break; |
23077 | 142 |
32897 | 143 case itPotmeter: |
144 case itVPotmeter: | |
145 case itHPotmeter: | |
32960 | 146 if (state < 0.0f) |
147 state = 0.0f; | |
148 if (state > 100.0f) | |
149 state = 100.0f; | |
32912 | 150 appMPlayer.mainItems[i].value = state; |
32897 | 151 break; |
152 } | |
153 } | |
154 } | |
155 | |
32931
03b1051bed5c
Rename the 'NumberOf' members of the listItems structure.
ib
parents:
32930
diff
changeset
|
156 for (i = 0; i <= appMPlayer.IndexOfBarItems; i++) { |
32911 | 157 if (appMPlayer.barItems[i].message == event) { |
32897 | 158 switch (appMPlayer.barItems[i].type) { |
159 case itButton: | |
160 appMPlayer.barItems[i].pressed = (int)state; | |
161 break; | |
162 | |
163 case itPotmeter: | |
164 case itVPotmeter: | |
165 case itHPotmeter: | |
32960 | 166 if (state < 0.0f) |
167 state = 0.0f; | |
168 if (state > 100.0f) | |
169 state = 100.0f; | |
32897 | 170 appMPlayer.barItems[i].value = state; |
171 break; | |
172 } | |
173 } | |
174 } | |
23077 | 175 } |
176 | |
32897 | 177 void btnSet(int event, int set) |
23077 | 178 { |
32897 | 179 int i; |
180 | |
33103 | 181 for (i = 0; i <= appMPlayer.IndexOfMainItems; i++) |
182 if (appMPlayer.mainItems[i].message == event) | |
32912 | 183 appMPlayer.mainItems[i].pressed = set; |
32897 | 184 |
33103 | 185 for (i = 0; i <= appMPlayer.IndexOfBarItems; i++) |
186 if (appMPlayer.barItems[i].message == event) | |
32897 | 187 appMPlayer.barItems[i].pressed = set; |
23077 | 188 } |