comparison mplayer.c @ 7559:b645204ea527

some cleanup - made private vars/funcs static, removed obsolete externs
author arpi
date Sun, 29 Sep 2002 19:26:40 +0000
parents c276bfb414fb
children 92188b57a062
comparison
equal deleted inserted replaced
7558:f89b4a70dbda 7559:b645204ea527
1 // AVI & MPEG Player v0.18 (C) 2000-2001. by A'rpi/ESP-team 1 // Movie Player v0.90 (C) 2000-2002. by A'rpi/ESP-team & `cat AUTHORS`
2 2
3 #include <stdio.h> 3 #include <stdio.h>
4 #include <stdlib.h> 4 #include <stdlib.h>
5 #include <string.h> 5 #include <string.h>
6 #include <unistd.h> 6 #include <unistd.h>
32 #ifdef USE_SUB 32 #ifdef USE_SUB
33 #include "subreader.h" 33 #include "subreader.h"
34 #endif 34 #endif
35 35
36 #include "libvo/video_out.h" 36 #include "libvo/video_out.h"
37 extern void* mDisplay; // Display* mDisplay; 37 //extern void* mDisplay; // Display* mDisplay;
38 38
39 #include "libvo/font_load.h" 39 #include "libvo/font_load.h"
40 #include "libvo/sub.h" 40 #include "libvo/sub.h"
41 41
42 #include "libao2/audio_out.h" 42 #include "libao2/audio_out.h"
45 #include "libmpeg2/mpeg2.h" 45 #include "libmpeg2/mpeg2.h"
46 #include "libmpeg2/mpeg2_internal.h" 46 #include "libmpeg2/mpeg2_internal.h"
47 47
48 #include "codec-cfg.h" 48 #include "codec-cfg.h"
49 49
50 #include "dvdauth.h" 50 #ifdef HAVE_LIBCSS
51 #include "libmpdemux/dvdauth.h"
52 #endif
53
51 #ifdef USE_DVDNAV 54 #ifdef USE_DVDNAV
52 #include <dvdnav.h> 55 #include <dvdnav.h>
53 #endif 56 #endif
54 57
55 #include "spudec.h" 58 #include "spudec.h"
56 #include "vobsub.h" 59 #include "vobsub.h"
57 60
58 #include "linux/getch2.h" 61 #include "linux/getch2.h"
59 #include "linux/keycodes.h" 62 //#include "linux/keycodes.h"
60 #include "linux/timer.h" 63 #include "linux/timer.h"
61 #include "linux/shmem.h" 64 //#include "linux/shmem.h"
62 65
63 #include "cpudetect.h" 66 #include "cpudetect.h"
64 67
65 #ifdef HAVE_NEW_GUI 68 #ifdef HAVE_NEW_GUI
66 #include "Gui/interface.h" 69 #include "Gui/interface.h"
80 83
81 #ifdef USE_TV 84 #ifdef USE_TV
82 #include "libmpdemux/tv.h" 85 #include "libmpdemux/tv.h"
83 86
84 extern int tv_param_on; 87 extern int tv_param_on;
85 //extern tvi_handle_t *tv_handler;
86 #endif 88 #endif
87 89
88 //**************************************************************************// 90 //**************************************************************************//
89 // Playtree 91 // Playtree
90 //**************************************************************************// 92 //**************************************************************************//
122 // Input media streaming & demultiplexer: 124 // Input media streaming & demultiplexer:
123 //**************************************************************************// 125 //**************************************************************************//
124 126
125 static int max_framesize=0; 127 static int max_framesize=0;
126 128
127 #include "stream.h" 129 #include "libmpdemux/stream.h"
128 #include "demuxer.h" 130 #include "libmpdemux/demuxer.h"
129 #include "stheader.h" 131 #include "libmpdemux/stheader.h"
130 #include "parse_es.h" 132 //#include "parse_es.h"
131 133
132 #include "libmpcodecs/dec_audio.h" 134 #include "libmpcodecs/dec_audio.h"
133 #include "libmpcodecs/dec_video.h" 135 #include "libmpcodecs/dec_video.h"
134 //#include "libmpcodecs/vf.h" 136 //#include "libmpcodecs/vf.h"
135 137
151 static int total_time_usage_start=0; 153 static int total_time_usage_start=0;
152 static int total_frame_cnt=0; 154 static int total_frame_cnt=0;
153 static int drop_frame_cnt=0; // total number of dropped frames 155 static int drop_frame_cnt=0; // total number of dropped frames
154 int benchmark=0; 156 int benchmark=0;
155 157
156 // static int play_in_bg=0;
157
158 // options: 158 // options:
159 int auto_quality=0; 159 int auto_quality=0;
160 static int output_quality=0; 160 static int output_quality=0;
161 161
162 int use_gui=0; 162 int use_gui=0;
164 int osd_level=1; 164 int osd_level=1;
165 int osd_level_saved=-1; 165 int osd_level_saved=-1;
166 int osd_visible=100; 166 int osd_visible=100;
167 167
168 // seek: 168 // seek:
169 char *seek_to_sec=NULL; 169 static char *seek_to_sec=NULL;
170 off_t seek_to_byte=0; 170 static off_t seek_to_byte=0;
171 off_t step_sec=0; 171 static off_t step_sec=0;
172 int loop_times=-1; 172 static int loop_times=-1;
173
174 // may be changed by GUI: (FIXME!)
173 float rel_seek_secs=0; 175 float rel_seek_secs=0;
174 int abs_seek_pos=0; 176 int abs_seek_pos=0;
175 177
176 // codecs: 178 // codecs:
177 char **audio_codec_list=NULL; // override audio codec 179 char **audio_codec_list=NULL; // override audio codec
182 // streaming: 184 // streaming:
183 int audio_id=-1; 185 int audio_id=-1;
184 int video_id=-1; 186 int video_id=-1;
185 int dvdsub_id=-1; 187 int dvdsub_id=-1;
186 int vobsub_id=-1; 188 int vobsub_id=-1;
187 char* audio_lang=NULL; 189 static char* audio_lang=NULL;
188 char* dvdsub_lang=NULL; 190 static char* dvdsub_lang=NULL;
189 static char* spudec_ifo=NULL; 191 static char* spudec_ifo=NULL;
190 int vcd_track=0; 192 int vcd_track=0;
191 char* filename=NULL; //"MI2-Trailer.avi"; 193 char* filename=NULL; //"MI2-Trailer.avi";
192 194
193 // cache2: 195 // cache2:
217 static int play_n_frames_mf=-1; 219 static int play_n_frames_mf=-1;
218 220
219 // screen info: 221 // screen info:
220 char* video_driver=NULL; //"mga"; // default 222 char* video_driver=NULL; //"mga"; // default
221 char* audio_driver=NULL; 223 char* audio_driver=NULL;
224
225 extern char *vo_subdevice;
226 extern char *ao_subdevice;
222 227
223 // codec outfmt flags (defined in libmpcodecs/vd.c) 228 // codec outfmt flags (defined in libmpcodecs/vd.c)
224 extern int vo_flags; 229 extern int vo_flags;
225 230
226 // sub: 231 // sub:
236 #ifdef USE_SUB 241 #ifdef USE_SUB
237 subtitle* subtitles=NULL; 242 subtitle* subtitles=NULL;
238 float sub_last_pts = -303; 243 float sub_last_pts = -303;
239 #endif 244 #endif
240 245
241 extern char *vo_subdevice;
242 extern char *ao_subdevice;
243
244 static stream_t* stream=NULL; 246 static stream_t* stream=NULL;
245
246 static demuxer_t *demuxer=NULL; 247 static demuxer_t *demuxer=NULL;
247 248
248 char* current_module=NULL; // for debugging 249 char* current_module=NULL; // for debugging
249 250
251 // also modified by Gui/mplayer/gtk/eq.c:
250 int vo_gamma_gamma = 1000; 252 int vo_gamma_gamma = 1000;
251 int vo_gamma_brightness = 1000; 253 int vo_gamma_brightness = 1000;
252 int vo_gamma_contrast = 1000; 254 int vo_gamma_contrast = 1000;
253 int vo_gamma_saturation = 1000; 255 int vo_gamma_saturation = 1000;
254 int vo_gamma_hue = 1000; 256 int vo_gamma_hue = 1000;
255 257
256 // --- 258 // ---
257 259
258 #ifdef HAVE_RTC 260 #ifdef HAVE_RTC
259 int nortc; 261 static int nortc;
260 #endif 262 #endif
261 263
262 static unsigned int inited_flags=0; 264 static unsigned int inited_flags=0;
263 #define INITED_VO 1 265 #define INITED_VO 1
264 #define INITED_AO 2 266 #define INITED_AO 2
270 #define INITED_INPUT 128 272 #define INITED_INPUT 128
271 #define INITED_VOBSUB 256 273 #define INITED_VOBSUB 256
272 #define INITED_DEMUXER 512 274 #define INITED_DEMUXER 512
273 #define INITED_ALL 0xFFFF 275 #define INITED_ALL 0xFFFF
274 276
275 void uninit_player(unsigned int mask){ 277 static void uninit_player(unsigned int mask){
276 mask=inited_flags&mask; 278 mask=inited_flags&mask;
277 279
278 mp_msg(MSGT_CPLAYER,MSGL_DBG2,"\n*** uninit(0x%X)\n",mask); 280 mp_msg(MSGT_CPLAYER,MSGL_DBG2,"\n*** uninit(0x%X)\n",mask);
279 281
280 // kill the cache process: 282 // kill the cache process:
360 mp_msg(MSGT_CPLAYER,MSGL_DBG2,"max framesize was %d bytes\n",max_framesize); 362 mp_msg(MSGT_CPLAYER,MSGL_DBG2,"max framesize was %d bytes\n",max_framesize);
361 363
362 exit(1); 364 exit(1);
363 } 365 }
364 366
365 void exit_sighandler(int x){ 367 static void exit_sighandler(int x){
366 static int sig_count=0; 368 static int sig_count=0;
367 ++sig_count; 369 ++sig_count;
368 if(sig_count==5 || (inited_flags==0 && sig_count>1)) exit(1); 370 if(sig_count==5 || (inited_flags==0 && sig_count>1)) exit(1);
369 if(sig_count>5){ 371 if(sig_count>5){
370 // can't stop :( 372 // can't stop :(
1232 sh_video->video_out=video_out; 1234 sh_video->video_out=video_out;
1233 inited_flags|=INITED_VO; 1235 inited_flags|=INITED_VO;
1234 1236
1235 current_module="init_video_filters"; 1237 current_module="init_video_filters";
1236 1238
1237 sh_video->vfilter=vf_open_filter(NULL,"vo",video_out); 1239 sh_video->vfilter=(void*)vf_open_filter(NULL,"vo",video_out);
1238 sh_video->vfilter=append_filters(sh_video->vfilter); 1240 sh_video->vfilter=(void*)append_filters(sh_video->vfilter);
1239 1241
1240 current_module="init_video_codec"; 1242 current_module="init_video_codec";
1241 1243
1242 mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n"); 1244 mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n");
1243 init_best_video_codec(sh_video,video_codec_list,video_fm_list); 1245 init_best_video_codec(sh_video,video_codec_list,video_fm_list);