Mercurial > mplayer.hg
annotate gui/mplayer/gui_common.c @ 32959:b17dd13b3cce
Remove unreasonable inline definition from TranslateFilename().
author | ib |
---|---|
date | Tue, 08 Mar 2011 10:25:28 +0000 |
parents | cde5d1cbb4bc |
children | 59f89e650306 |
rev | line source |
---|---|
26458 | 1 /* |
2 * main window | |
3 * | |
4 * This file is part of MPlayer. | |
5 * | |
6 * MPlayer is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * MPlayer is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License along | |
17 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
19 */ | |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
20 |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
21 #include <stdlib.h> |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
22 #include <stdio.h> |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
23 #include <inttypes.h> |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
24 #include <string.h> |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
25 |
32952 | 26 #include "gui_common.h" |
27 #include "gui/interface.h" | |
26365
10dfbc523184
Add gui/ prefix to some #include paths so that compilation from the
diego
parents:
25603
diff
changeset
|
28 #include "gui/skin/font.h" |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
29 |
26382
b2f4abcf20ed
Make include paths consistent; do not use ../ in them.
diego
parents:
26365
diff
changeset
|
30 #include "config.h" |
b2f4abcf20ed
Make include paths consistent; do not use ../ in them.
diego
parents:
26365
diff
changeset
|
31 #include "help_mp.h" |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
32 |
26382
b2f4abcf20ed
Make include paths consistent; do not use ../ in them.
diego
parents:
26365
diff
changeset
|
33 #include "stream/stream.h" |
b2f4abcf20ed
Make include paths consistent; do not use ../ in them.
diego
parents:
26365
diff
changeset
|
34 #include "mixer.h" |
32954 | 35 #include "osdep/timer.h" |
26382
b2f4abcf20ed
Make include paths consistent; do not use ../ in them.
diego
parents:
26365
diff
changeset
|
36 #include "libmpdemux/stheader.h" |
b2f4abcf20ed
Make include paths consistent; do not use ../ in them.
diego
parents:
26365
diff
changeset
|
37 #include "codec-cfg.h" |
b2f4abcf20ed
Make include paths consistent; do not use ../ in them.
diego
parents:
26365
diff
changeset
|
38 #include "access_mpcontext.h" |
b2f4abcf20ed
Make include paths consistent; do not use ../ in them.
diego
parents:
26365
diff
changeset
|
39 #include "libavutil/avstring.h" |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
40 |
32956 | 41 static char * image_buffer; |
42 static int image_width; | |
43 | |
32959
b17dd13b3cce
Remove unreasonable inline definition from TranslateFilename().
ib
parents:
32956
diff
changeset
|
44 static void TranslateFilename( int c,char * tmp,size_t tmplen ) |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
45 { |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
46 int i; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
47 char * p; |
32709
f1b29f413940
Correct translation of filenames and prevent out-of-bounds array access
ib
parents:
32467
diff
changeset
|
48 size_t len; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28051
diff
changeset
|
49 |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
50 switch ( guiIntfStruct.StreamType ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
51 { |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
52 case STREAMTYPE_STREAM: |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
53 av_strlcpy(tmp, guiIntfStruct.Filename, tmplen); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
54 break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
55 case STREAMTYPE_FILE: |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
56 if ( ( guiIntfStruct.Filename )&&( guiIntfStruct.Filename[0] ) ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
57 { |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
58 if ( (p = strrchr(guiIntfStruct.Filename, '/')) ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
59 av_strlcpy(tmp, p + 1, tmplen); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
60 else |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
61 av_strlcpy(tmp, guiIntfStruct.Filename, tmplen); |
32709
f1b29f413940
Correct translation of filenames and prevent out-of-bounds array access
ib
parents:
32467
diff
changeset
|
62 len=strlen( tmp ); |
f1b29f413940
Correct translation of filenames and prevent out-of-bounds array access
ib
parents:
32467
diff
changeset
|
63 if ( ( len > 3 )&&( tmp[len - 3] == '.' ) ) tmp[len - 3]=0; |
f1b29f413940
Correct translation of filenames and prevent out-of-bounds array access
ib
parents:
32467
diff
changeset
|
64 else if ( ( len > 4 )&&( tmp[len - 4] == '.' ) ) tmp[len - 4]=0; |
f1b29f413940
Correct translation of filenames and prevent out-of-bounds array access
ib
parents:
32467
diff
changeset
|
65 else if ( ( len > 5 )&&( tmp[len - 5] == '.' ) ) tmp[len - 5]=0; |
32733
e922613845cc
Revert "Translate messages shown in the GUI window(s) from UTF-8"
ib
parents:
32715
diff
changeset
|
66 } else av_strlcpy( tmp,MSGTR_NoFileLoaded,tmplen ); |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
67 break; |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
27207
diff
changeset
|
68 #ifdef CONFIG_DVDREAD |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
69 case STREAMTYPE_DVD: |
32733
e922613845cc
Revert "Translate messages shown in the GUI window(s) from UTF-8"
ib
parents:
32715
diff
changeset
|
70 if ( guiIntfStruct.DVD.current_chapter ) snprintf(tmp,tmplen,MSGTR_Chapter,guiIntfStruct.DVD.current_chapter ); |
e922613845cc
Revert "Translate messages shown in the GUI window(s) from UTF-8"
ib
parents:
32715
diff
changeset
|
71 else av_strlcat( tmp,MSGTR_NoChapter,tmplen ); |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
72 break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
73 #endif |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27341
diff
changeset
|
74 #ifdef CONFIG_VCD |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
75 case STREAMTYPE_VCD: |
32733
e922613845cc
Revert "Translate messages shown in the GUI window(s) from UTF-8"
ib
parents:
32715
diff
changeset
|
76 snprintf( tmp,tmplen,MSGTR_VCDTrack,guiIntfStruct.Track ); |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
77 break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
78 #endif |
32733
e922613845cc
Revert "Translate messages shown in the GUI window(s) from UTF-8"
ib
parents:
32715
diff
changeset
|
79 default: av_strlcpy( tmp,MSGTR_NoMediaOpened,tmplen ); |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
80 } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
81 if ( c ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
82 { |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
83 for ( i=0;i < (int)strlen( tmp );i++ ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
84 { |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
85 int t=0; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
86 if ( c == 1 ) { if ( ( tmp[i] >= 'A' )&&( tmp[i] <= 'Z' ) ) t=32; } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
87 if ( c == 2 ) { if ( ( tmp[i] >= 'a' )&&( tmp[i] <= 'z' ) ) t=-32; } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
88 tmp[i]=(char)( tmp[i] + t ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
89 } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
90 } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
91 } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
92 |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
93 /* Unsafe! Pass only null-terminated strings as (char *)str. */ |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
94 char * Translate( char * str ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
95 { |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
96 mixer_t *mixer = mpctx_get_mixer(guiIntfStruct.mpcontext); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
97 static char trbuf[512]; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
98 char tmp[512]; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
99 int i,c; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
100 int t; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
101 int strsize = 0; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
102 memset( trbuf,0,512 ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
103 memset( tmp,0,128 ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
104 strsize = strlen(str); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
105 for ( c=0,i=0;i < strsize;i++ ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
106 { |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
107 if ( str[i] != '$' ) { trbuf[c++]=str[i]; trbuf[c]=0; } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
108 else |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
109 { |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
110 switch ( str[++i] ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
111 { |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
112 case 't': snprintf( tmp,sizeof( tmp ),"%02d",guiIntfStruct.Track ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
113 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
114 case 'o': TranslateFilename( 0,tmp,sizeof( tmp ) ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
115 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
116 case 'f': TranslateFilename( 1,tmp,sizeof( tmp ) ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
117 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
118 case 'F': TranslateFilename( 2,tmp,sizeof( tmp ) ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
119 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
120 case '6': t=guiIntfStruct.LengthInSec; goto calclengthhhmmss; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
121 case '1': t=guiIntfStruct.TimeSec; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
122 calclengthhhmmss: |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
123 snprintf( tmp,sizeof( tmp ),"%02d:%02d:%02d",t/3600,t/60%60,t%60 ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
124 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
125 break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
126 case '7': t=guiIntfStruct.LengthInSec; goto calclengthmmmmss; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
127 case '2': t=guiIntfStruct.TimeSec; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
128 calclengthmmmmss: |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
129 snprintf( tmp,sizeof( tmp ),"%04d:%02d",t/60,t%60 ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
130 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
131 break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
132 case '3': snprintf( tmp,sizeof( tmp ),"%02d",guiIntfStruct.TimeSec / 3600 ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
133 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
134 case '4': snprintf( tmp,sizeof( tmp ),"%02d",( ( guiIntfStruct.TimeSec / 60 ) % 60 ) ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
135 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
136 case '5': snprintf( tmp,sizeof( tmp ),"%02d",guiIntfStruct.TimeSec % 60 ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
137 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
138 case '8': snprintf( tmp,sizeof( tmp ),"%01d:%02d:%02d",guiIntfStruct.TimeSec / 3600,( guiIntfStruct.TimeSec / 60 ) % 60,guiIntfStruct.TimeSec % 60 ); av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
139 case 'v': snprintf( tmp,sizeof( tmp ),"%3.2f%%",guiIntfStruct.Volume ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
140 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
141 case 'V': snprintf( tmp,sizeof( tmp ),"%3.1f",guiIntfStruct.Volume ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
142 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
143 case 'b': snprintf( tmp,sizeof( tmp ),"%3.2f%%",guiIntfStruct.Balance ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
144 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
145 case 'B': snprintf( tmp,sizeof( tmp ),"%3.1f",guiIntfStruct.Balance ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
146 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
147 case 'd': snprintf( tmp,sizeof( tmp ),"%d",guiIntfStruct.FrameDrop ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
148 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
149 case 'x': snprintf( tmp,sizeof( tmp ),"%d",guiIntfStruct.MovieWidth ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
150 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
151 case 'y': snprintf( tmp,sizeof( tmp ),"%d",guiIntfStruct.MovieHeight ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
152 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
153 case 'C': snprintf( tmp,sizeof( tmp ),"%s", guiIntfStruct.sh_video? ((sh_video_t *)guiIntfStruct.sh_video)->codec->name : ""); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
154 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
155 case 's': if ( guiIntfStruct.Playing == 0 ) av_strlcat( trbuf,"s",sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
156 case 'l': if ( guiIntfStruct.Playing == 1 ) av_strlcat( trbuf,"p",sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
157 case 'e': if ( guiIntfStruct.Playing == 2 ) av_strlcat( trbuf,"e",sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
158 case 'a': |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
159 if ( mixer->muted ) { av_strlcat( trbuf,"n",sizeof( trbuf ) ); break; } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
160 switch ( guiIntfStruct.AudioType ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
161 { |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
162 case 0: av_strlcat( trbuf,"n",sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
163 case 1: av_strlcat( trbuf,"m",sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
164 case 2: av_strlcat( trbuf,"t",sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
165 } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
166 break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
167 case 'T': |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
168 switch ( guiIntfStruct.StreamType ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
169 { |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
170 case STREAMTYPE_FILE: av_strlcat( trbuf,"f",sizeof( trbuf ) ); break; |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27341
diff
changeset
|
171 #ifdef CONFIG_VCD |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
172 case STREAMTYPE_VCD: av_strlcat( trbuf,"v",sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
173 #endif |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
174 case STREAMTYPE_STREAM: av_strlcat( trbuf,"u",sizeof( trbuf ) ); break; |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
27207
diff
changeset
|
175 #ifdef CONFIG_DVDREAD |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
176 case STREAMTYPE_DVD: av_strlcat( trbuf,"d",sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
177 #endif |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
178 default: av_strlcat( trbuf," ",sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
179 } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
180 break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
181 case '$': av_strlcat( trbuf,"$",sizeof( trbuf ) ); break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
182 default: continue; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
183 } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
184 c=strlen( trbuf ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
185 } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
186 } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
187 return trbuf; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
188 } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
189 |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
190 void PutImage( txSample * bf,int x,int y,int max,int ofs ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
191 { |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
192 int i=0,ix,iy; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
193 uint32_t * buf = NULL; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
194 uint32_t * drw = NULL; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
195 register uint32_t tmp; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
196 /* register uint32_t yc; */ |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
197 |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
198 if ( ( !bf )||( bf->Image == NULL ) ) return; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
199 |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
200 i=( bf->Width * ( bf->Height / max ) ) * ofs; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
201 buf=(uint32_t *)image_buffer; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
202 drw=(uint32_t *)bf->Image; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
203 |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
204 #if 1 |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
205 for ( iy=y;iy < (int)(y+bf->Height / max);iy++ ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
206 for ( ix=x;ix < (int)(x+bf->Width);ix++ ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
207 { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28051
diff
changeset
|
208 tmp=drw[i++]; |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
209 if ( tmp != 0x00ff00ff ) buf[iy * image_width + ix]=tmp; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
210 } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
211 #else |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28051
diff
changeset
|
212 yc=y * image_width; |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
213 for ( iy=y;iy < (int)(y+bf->Height / max);iy++ ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
214 { |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
215 for ( ix=x;ix < (int)(x+bf->Width);ix++ ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
216 { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28051
diff
changeset
|
217 tmp=drw[i++]; |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
218 if ( tmp != 0x00ff00ff ) buf[yc + ix]=tmp; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
219 } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
220 yc+=image_width; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
221 } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
222 #endif |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
223 } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
224 |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
225 void SimplePotmeterPutImage( txSample * bf,int x,int y,float frac ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
226 { |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
227 int i=0,w,r,ix,iy; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
228 uint32_t * buf = NULL; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
229 uint32_t * drw = NULL; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
230 register uint32_t tmp; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
231 |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
232 if ( ( !bf )||( bf->Image == NULL ) ) return; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
233 |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
234 buf=(uint32_t *)image_buffer; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
235 drw=(uint32_t *)bf->Image; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
236 w=bf->Width*frac; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
237 r=bf->Width-w; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
238 for ( iy=y;iy < (int)(y+bf->Height);iy++ ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
239 { |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
240 for ( ix=x;ix < (int)(x+w);ix++ ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
241 { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28051
diff
changeset
|
242 tmp=drw[i++]; |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
243 if ( tmp != 0x00ff00ff ) buf[iy * image_width + ix]=tmp; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
244 } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
245 i+=r; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
246 } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
247 } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
248 |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
249 void Render( wsTWindow * window,wItem * Items,int nrItems,char * db,int size ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
250 { |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
251 wItem * item; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
252 txSample * image = NULL; |
32920 | 253 int i, ofs; |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
254 |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
255 image_buffer=db; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
256 image_width=window->Width; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
257 |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
258 for( i=0;i < nrItems + 1;i++ ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
259 { |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
260 item=&Items[i]; |
32920 | 261 ofs = (item->pressed == btnPressed ? 0 : (item->pressed == btnReleased ? 1 : 2)); |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
262 switch( item->type ) |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
263 { |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
264 case itButton: |
32920 | 265 PutImage( &item->Bitmap,item->x,item->y,3,ofs ); |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
266 break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
267 case itPotmeter: |
32911 | 268 if (item->numphases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f ); |
269 else PutImage( &item->Bitmap,item->x,item->y,item->numphases,( item->numphases - 1 ) * ( item->value / 100.0f ) ); | |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
270 break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
271 case itHPotmeter: |
32911 | 272 if (item->numphases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f ); |
273 else PutImage( &item->Bitmap,item->x,item->y,item->numphases,( item->numphases - 1 ) * ( item->value / 100.0f ) ); | |
32920 | 274 PutImage( &item->Mask,item->x + (int)( ( item->width - item->pwidth ) * item->value / 100.0f ),item->y,3,ofs ); |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
275 break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
276 case itVPotmeter: |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
277 PutImage( &item->Bitmap, |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
278 item->x,item->y, |
32911 | 279 item->numphases, |
280 item->numphases * ( 1. - item->value / 100.0f ) ); | |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
281 PutImage( &item->Mask, |
32911 | 282 item->x,item->y + (int)( ( item->height - item->pheight ) * ( 1. - item->value / 100.0f ) ), |
32920 | 283 3,ofs ); |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
284 break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
285 case itSLabel: |
32759 | 286 image=fntRender( item,0,item->label ); |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
287 if ( image ) PutImage( image,item->x,item->y,1,0 ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
288 case itDLabel: |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
289 { |
32761
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
290 int x; |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
291 unsigned int d; |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
292 char * t = Translate( item->label ); |
32955 | 293 if ( !item->text || ( strcmp( item->text, t ) != 0 ) ) |
32761
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
294 { |
32955 | 295 free( item->text ); |
296 item->text = strdup( t ); | |
32761
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
297 item->textwidth = fntTextWidth( item->fontid, t ); |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
298 item->starttime = GetTimerMS(); |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
299 item->last_x = 0; |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
300 } |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
301 d = GetTimerMS() - item->starttime; |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
302 if ( d < DELAYTIME ) x = item->last_x; // don't scroll yet |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
303 else |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
304 { |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
305 int l; |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
306 char c[2]; |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
307 l = (item->textwidth ? item->textwidth : item->width); |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
308 x = l - ((d - DELAYTIME) / 20) % l - 1; |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
309 c[0] = *item->text; |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
310 c[1] = '\0'; |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
311 if ( x < (fntTextWidth( item->fontid, c ) + 1) >> 1) |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
312 { |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
313 item->starttime = GetTimerMS(); // stop again |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
314 item->last_x = x; // at current x pos |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
315 } |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
316 } |
3ceeb62a1125
Improve the readability of dynamic labels which scroll.
ib
parents:
32759
diff
changeset
|
317 image = fntRender( item, x, t ); |
25603
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
318 } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
319 if ( image ) PutImage( image,item->x,item->y,1,0 ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
320 break; |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
321 } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
322 } |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
323 wsConvert( window,db,size ); |
01754b23193e
Rename common.[ch], there are too many files by that name.
diego
parents:
diff
changeset
|
324 } |