Mercurial > mplayer.hg
annotate mplayer.c @ 2022:125ce43b3ac1
gcc3 compile fix
author | atmos4 |
---|---|
date | Sun, 30 Sep 2001 14:47:46 +0000 |
parents | dc21c5f373c4 |
children | 2f1974590f88 |
rev | line source |
---|---|
1237 | 1 // AVI & MPEG Player v0.18 (C) 2000-2001. by A'rpi/ESP-team |
1 | 2 |
1430 | 3 #include <stdio.h> |
4 #include <stdlib.h> | |
5 #include <string.h> | |
6 #include <unistd.h> | |
1428
a90d889eb649
largefile patch by Stephen Davies <steve@daviesfam.org>
arpi
parents:
1422
diff
changeset
|
7 |
a90d889eb649
largefile patch by Stephen Davies <steve@daviesfam.org>
arpi
parents:
1422
diff
changeset
|
8 #include <sys/ioctl.h> |
a90d889eb649
largefile patch by Stephen Davies <steve@daviesfam.org>
arpi
parents:
1422
diff
changeset
|
9 #include <sys/mman.h> |
a90d889eb649
largefile patch by Stephen Davies <steve@daviesfam.org>
arpi
parents:
1422
diff
changeset
|
10 #include <sys/types.h> |
a90d889eb649
largefile patch by Stephen Davies <steve@daviesfam.org>
arpi
parents:
1422
diff
changeset
|
11 #include <sys/wait.h> |
a90d889eb649
largefile patch by Stephen Davies <steve@daviesfam.org>
arpi
parents:
1422
diff
changeset
|
12 #include <sys/time.h> |
a90d889eb649
largefile patch by Stephen Davies <steve@daviesfam.org>
arpi
parents:
1422
diff
changeset
|
13 #include <sys/stat.h> |
a90d889eb649
largefile patch by Stephen Davies <steve@daviesfam.org>
arpi
parents:
1422
diff
changeset
|
14 |
a90d889eb649
largefile patch by Stephen Davies <steve@daviesfam.org>
arpi
parents:
1422
diff
changeset
|
15 #include <signal.h> |
a90d889eb649
largefile patch by Stephen Davies <steve@daviesfam.org>
arpi
parents:
1422
diff
changeset
|
16 |
a90d889eb649
largefile patch by Stephen Davies <steve@daviesfam.org>
arpi
parents:
1422
diff
changeset
|
17 #include <time.h> |
a90d889eb649
largefile patch by Stephen Davies <steve@daviesfam.org>
arpi
parents:
1422
diff
changeset
|
18 |
a90d889eb649
largefile patch by Stephen Davies <steve@daviesfam.org>
arpi
parents:
1422
diff
changeset
|
19 #include <fcntl.h> |
a90d889eb649
largefile patch by Stephen Davies <steve@daviesfam.org>
arpi
parents:
1422
diff
changeset
|
20 |
1430 | 21 #include "version.h" |
22 #include "config.h" | |
1584 | 23 |
1564 | 24 #include "mp_msg.h" |
1 | 25 |
1584 | 26 #define HELP_MP_DEFINE_STATIC |
27 #include "help_mp.h" | |
28 | |
147 | 29 #include "cfgparser.h" |
151 | 30 #include "cfg-mplayer-def.h" |
147 | 31 |
1422 | 32 #ifdef USE_SUB |
258 | 33 #include "subreader.h" |
1422 | 34 #endif |
258 | 35 |
1422 | 36 #ifdef USE_LIBVO2 |
37 #include "libvo2/libvo2.h" | |
38 #else | |
36 | 39 #include "libvo/video_out.h" |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
40 void* mDisplay; // Display* mDisplay; |
1422 | 41 #endif |
42 | |
43 //#ifdef USE_OSD | |
220 | 44 #include "libvo/sub.h" |
1422 | 45 //#endif |
36 | 46 |
955 | 47 #include "libao2/audio_out.h" |
48 | |
1 | 49 #include "libmpeg2/mpeg2.h" |
50 #include "libmpeg2/mpeg2_internal.h" | |
51 | |
2020 | 52 //#include "loader.h" |
53 //#include "wine/avifmt.h" | |
54 | |
55 #include "wine/mmreg.h" | |
1 | 56 #include "wine/avifmt.h" |
2020 | 57 #include "wine/vfw.h" |
1 | 58 |
303 | 59 #include "codec-cfg.h" |
175 | 60 |
492 | 61 #include "dvdauth.h" |
560
28ae99036574
Separated dvdsub code to be able to work with it easier
lgb
parents:
557
diff
changeset
|
62 #include "spudec.h" |
492 | 63 |
1 | 64 #include "linux/getch2.h" |
65 #include "linux/keycodes.h" | |
66 #include "linux/timer.h" | |
67 #include "linux/shmem.h" | |
68 | |
69 #ifdef HAVE_LIRC | |
70 #include "lirc_mp.h" | |
71 #endif | |
72 | |
1729 | 73 #ifdef HAVE_NEW_GUI |
74 #include "Gui/mplayer/play.h" | |
75 #endif | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
76 |
1 | 77 #define DEBUG if(0) |
362 | 78 int verbose=0; |
1448 | 79 int quiet=0; |
1 | 80 |
398 | 81 #define ABS(x) (((x)>=0)?(x):(-(x))) |
82 | |
1422 | 83 #ifdef USE_SUB |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
578
diff
changeset
|
84 void find_sub(subtitle* subtitles,int key); |
1422 | 85 #endif |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
578
diff
changeset
|
86 |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
87 static int |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
88 usec_sleep(int usec_delay) |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
89 { |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
90 #if 1 |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
91 struct timespec ts; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
92 ts.tv_sec = usec_delay / 1000000; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
93 ts.tv_nsec = (usec_delay % 1000000) * 1000; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
94 return nanosleep(&ts, NULL); |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
95 #else |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
96 return usleep(usec_delay); |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
97 #endif |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
98 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
99 |
258 | 100 //**************************************************************************// |
101 // Config file | |
102 //**************************************************************************// | |
103 | |
153 | 104 static int cfg_inc_verbose(struct config *conf){ |
105 ++verbose; | |
106 return 0; | |
107 } | |
108 | |
162 | 109 static int cfg_include(struct config *conf, char *filename){ |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
110 return parse_config_file(conf, filename); |
162 | 111 } |
112 | |
178 | 113 char *get_path(char *filename){ |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
114 char *homedir; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
115 char *buff; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
116 static char *config_dir = "/.mplayer"; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
117 int len; |
178 | 118 |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
119 if ((homedir = getenv("HOME")) == NULL) |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
120 return NULL; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
121 len = strlen(homedir) + strlen(config_dir) + 1; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
122 if (filename == NULL) { |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
123 if ((buff = (char *) malloc(len)) == NULL) |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
124 return NULL; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
125 sprintf(buff, "%s%s", homedir, config_dir); |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
126 } else { |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
127 len += strlen(filename) + 1; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
128 if ((buff = (char *) malloc(len)) == NULL) |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
129 return NULL; |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
130 sprintf(buff, "%s%s/%s", homedir, config_dir, filename); |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
131 } |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
132 return buff; |
178 | 133 } |
134 | |
1 | 135 //**************************************************************************// |
442 | 136 //**************************************************************************// |
137 // Input media streaming & demultiplexer: | |
138 //**************************************************************************// | |
139 | |
1289 | 140 static int max_framesize=0; |
141 | |
578 | 142 #include "stream.h" |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
578
diff
changeset
|
143 #include "demuxer.h" |
442 | 144 |
145 #include "stheader.h" | |
1 | 146 |
442 | 147 char* encode_name=NULL; |
148 char* encode_index_name=NULL; | |
149 int encode_bitrate=0; | |
291 | 150 |
1429 | 151 int get_video_quality_max(sh_video_t *sh_video); |
152 void set_video_quality(sh_video_t *sh_video,int quality); | |
153 int set_video_colors(sh_video_t *sh_video,char *item,int value); | |
154 | |
1 | 155 // MPEG video stream parser: |
1375
dbcb5b5e1fae
file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents:
1369
diff
changeset
|
156 #include "parse_es.h" |
1 | 157 |
1015 | 158 extern picture_t *picture; // exported from libmpeg2/decode.c |
442 | 159 |
1375
dbcb5b5e1fae
file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents:
1369
diff
changeset
|
160 int frameratecode2framerate[16] = { |
780 | 161 0, |
162 // Official mpeg1/2 framerates: | |
163 24000*10000/1001, 24*10000,25*10000, 30000*10000/1001, 30*10000,50*10000,60000*10000/1001, 60*10000, | |
164 // libmpeg3's "Unofficial economy rates": | |
165 1*10000,5*10000,10*10000,12*10000,15*10000,0,0 | |
112 | 166 }; |
167 | |
111 | 168 //**************************************************************************// |
1 | 169 //**************************************************************************// |
170 | |
112 | 171 // Common FIFO functions, and keyboard/event FIFO code |
172 #include "fifo.c" | |
173 | |
1 | 174 //**************************************************************************// |
175 | |
1422 | 176 #ifdef USE_LIBVO2 |
177 static vo2_handle_t *video_out=NULL; | |
178 #else | |
1 | 179 static vo_functions_t *video_out=NULL; |
1422 | 180 #endif |
1289 | 181 static ao_functions_t *audio_out=NULL; |
1 | 182 |
1496 | 183 static float c_total=0; |
1400 | 184 |
1291 | 185 double video_time_usage=0; |
186 double vout_time_usage=0; | |
1289 | 187 static double audio_time_usage=0; |
188 static int total_time_usage_start=0; | |
189 static int benchmark=0; | |
1124
0e95f30ffd4c
-frames and -benchmark options to make chl & gabucino happy
arpi_esp
parents:
1059
diff
changeset
|
190 |
1 | 191 static int play_in_bg=0; |
192 | |
606 | 193 extern void avi_fixate(); |
194 | |
1014
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
195 // options: |
1439 | 196 |
1014
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
197 int divx_quality=0; |
1496 | 198 static int auto_quality=0; |
199 static int output_quality=0; | |
1439 | 200 |
1709 | 201 int use_gui=0; |
202 | |
1439 | 203 int osd_level=2; |
937 | 204 char *seek_to_sec=NULL; |
1428
a90d889eb649
largefile patch by Stephen Davies <steve@daviesfam.org>
arpi
parents:
1422
diff
changeset
|
205 off_t seek_to_byte=0; |
442 | 206 int has_audio=1; |
1496 | 207 |
1286
543a94b241a2
Replaced LGBs video codec forcing change with mine for audio and video codecs, which is IMHO more convenient cause codecs are selected by name instead of number, one unclearity is left to me, that's why audio_format is used once before codecs selection for MPEG_PS files, that's why I left -afm in for that one.
atmos4
parents:
1285
diff
changeset
|
208 char *audio_codec=NULL; // override audio codec |
543a94b241a2
Replaced LGBs video codec forcing change with mine for audio and video codecs, which is IMHO more convenient cause codecs are selected by name instead of number, one unclearity is left to me, that's why audio_format is used once before codecs selection for MPEG_PS files, that's why I left -afm in for that one.
atmos4
parents:
1285
diff
changeset
|
209 char *video_codec=NULL; // override video codec |
1299
fa50e6bc6091
As promised, -afm and -vfm to prefer audio/video driver family, -ac and -vc have higher precedence, so they can override -afm/-vfm.
atmos4
parents:
1296
diff
changeset
|
210 int audio_family=-1; // override audio codec family |
fa50e6bc6091
As promised, -afm and -vfm to prefer audio/video driver family, -ac and -vc have higher precedence, so they can override -afm/-vfm.
atmos4
parents:
1296
diff
changeset
|
211 int video_family=-1; // override video codec family |
1285
202d9e2dc202
-vcodec option (maybe some other name would be better though) to select between driver types without editing codecs.conf. mplayer will default to normal codec search loop if it does not find codec for the specified driver type. config range checking for the parameter (an integer) should be cleaned, IMHO
lgb
parents:
1255
diff
changeset
|
212 |
1299
fa50e6bc6091
As promised, -afm and -vfm to prefer audio/video driver family, -ac and -vc have higher precedence, so they can override -afm/-vfm.
atmos4
parents:
1296
diff
changeset
|
213 // IMHO this stuff is no longer of use, or is there a special |
fa50e6bc6091
As promised, -afm and -vfm to prefer audio/video driver family, -ac and -vc have higher precedence, so they can override -afm/-vfm.
atmos4
parents:
1296
diff
changeset
|
214 // reason why dshow should be completely disabled? - atmos :: |
1327
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1302
diff
changeset
|
215 // yes, people without working c++ compiler can disable it - A'rpi |
626 | 216 #ifdef USE_DIRECTSHOW |
217 int allow_dshow=1; | |
218 #else | |
219 int allow_dshow=0; | |
220 #endif | |
1014
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
221 |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
222 //#ifdef ALSA_TIMER |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
223 //int alsa=1; |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
224 //#else |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
225 //int alsa=0; |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
226 //#endif |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
227 |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
228 // streaming: |
1496 | 229 static int audio_id=-1; |
230 static int video_id=-1; | |
231 static int dvdsub_id=-1; | |
232 static int vcd_track=0; | |
1498 | 233 static char *stream_dump_name=NULL; |
234 static int stream_dump_type=0; | |
235 | |
1596 | 236 extern int dvd_title; |
237 | |
1014
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
238 int index_mode=-1; // -1=untouched 0=don't use index 1=use (geneate) index |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
239 int force_ni=0; |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
240 |
1498 | 241 static float default_max_pts_correction=-1;//0.01f; |
242 static float max_pts_correction=0;//default_max_pts_correction; | |
1 | 243 #ifdef AVI_SYNC_BPS |
244 int pts_from_bps=1; | |
245 #else | |
246 int pts_from_bps=0; | |
247 #endif | |
1014
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
248 |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
249 float force_fps=0; |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
250 int force_srate=0; |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
251 float audio_delay=0; |
798 | 252 int frame_dropping=0; // option 0=no drop 1= drop vo 2= drop decode |
1124
0e95f30ffd4c
-frames and -benchmark options to make chl & gabucino happy
arpi_esp
parents:
1059
diff
changeset
|
253 int play_n_frames=-1; |
1014
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
254 |
1 | 255 // screen info: |
256 char* video_driver=NULL; //"mga"; // default | |
956
a6cecd9a1bad
'-ao' switch (including '-ao help'), fixing Arpi's bug (short name 'null' for both of oss and null driver ;)
lgb
parents:
955
diff
changeset
|
257 char* audio_driver=NULL; |
1496 | 258 static int fullscreen=0; |
259 static int vidmode=0; | |
260 static int softzoom=0; | |
261 static int flip=-1; | |
262 static int screen_size_x=0;//SCREEN_SIZE_X; | |
263 static int screen_size_y=0;//SCREEN_SIZE_Y; | |
264 static int screen_size_xy=0; | |
1014
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
265 |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
266 // sub: |
212 | 267 char *font_name=NULL; |
215 | 268 float font_factor=0.75; |
258 | 269 char *sub_name=NULL; |
270 float sub_delay=0; | |
271 float sub_fps=0; | |
510 | 272 int sub_auto = 1; |
1255
94f2853ec6f4
-dsp option removed, displaying help text (-ao oss:dsp_path)
alex
parents:
1250
diff
changeset
|
273 /*DSP!!char *dsp=NULL;*/ |
723 | 274 |
1496 | 275 //float initial_pts_delay=0; |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
276 |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
277 float rel_seek_secs=0; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
278 int abs_seek_pos=0; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
279 |
1183 | 280 extern char *vo_subdevice; |
281 extern char *ao_subdevice; | |
1156 | 282 |
1856 | 283 static char* current_module=NULL; // for debugging |
284 | |
285 static unsigned int inited_flags=0; | |
286 #define INITED_VO 1 | |
287 #define INITED_AO 2 | |
288 #define INITED_GUI 4 | |
289 #define INITED_GETCH2 8 | |
290 #define INITED_LIRC 16 | |
291 #define INITED_ENCODE 32 | |
292 #define INITED_ALL 0xFFFF | |
293 | |
294 void uninit_player(unsigned int mask){ | |
295 mask=inited_flags&mask; | |
296 if(mask&INITED_VO){ | |
297 inited_flags&=~INITED_VO; | |
298 current_module="uninit_vo"; | |
299 #ifdef USE_LIBVO2 | |
300 vo2_close(video_out); | |
301 #else | |
302 video_out->uninit(); | |
303 #endif | |
304 } | |
305 | |
306 if(mask&INITED_AO){ | |
307 inited_flags&=~INITED_AO; | |
308 current_module="uninit_ao"; | |
309 audio_out->uninit(); | |
310 } | |
311 | |
312 if(mask&INITED_GETCH2){ | |
313 inited_flags&=~INITED_GETCH2; | |
314 current_module="uninit_getch2"; | |
315 // restore terminal: | |
316 getch2_disable(); | |
317 } | |
318 | |
319 #ifdef HAVE_NEW_GUI | |
320 if(mask&INITED_GUI){ | |
321 inited_flags&=~INITED_GUI; | |
322 current_module="uninit_gui"; | |
323 mplDone(); | |
324 } | |
325 #endif | |
326 | |
327 if(mask&INITED_ENCODE){ | |
328 inited_flags&=~INITED_ENCODE; | |
329 current_module="uninit_encode"; | |
330 avi_fixate(); | |
331 } | |
332 | |
333 #ifdef HAVE_LIRC | |
334 if(mask&INITED_LIRC){ | |
335 inited_flags&=~INITED_LIRC; | |
336 current_module="uninit_lirc"; | |
337 lirc_mp_cleanup(); | |
338 } | |
339 #endif | |
340 | |
1863 | 341 current_module=NULL; |
342 | |
1856 | 343 } |
344 | |
1156 | 345 void exit_player(char* how){ |
346 total_time_usage_start=GetTimer()-total_time_usage_start; | |
347 | |
1856 | 348 uninit_player(INITED_ALL); |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
349 |
1856 | 350 current_module="exit_player"; |
1156 | 351 |
1583 | 352 if(how) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_Exiting,how); |
1567 | 353 mp_msg(MSGT_CPLAYER,MSGL_V,"max framesize was %d bytes\n",max_framesize); |
1156 | 354 if(benchmark){ |
355 double tot=video_time_usage+vout_time_usage+audio_time_usage; | |
356 double total_time_usage=(float)total_time_usage_start*0.000001; | |
1567 | 357 mp_msg(MSGT_CPLAYER,MSGL_INFO,"BENCHMARKs: V:%8.3fs VO:%8.3fs A:%8.3fs Sys:%8.3fs = %8.3fs\n", |
1156 | 358 video_time_usage,vout_time_usage,audio_time_usage, |
359 total_time_usage-tot,total_time_usage); | |
360 if(total_time_usage>0.0) | |
1567 | 361 mp_msg(MSGT_CPLAYER,MSGL_INFO,"BENCHMARK%%: V:%8.4f%% VO:%8.4f%% A:%8.4f%% Sys:%8.4f%% = %8.4f%%\n", |
1156 | 362 100.0*video_time_usage/total_time_usage, |
363 100.0*vout_time_usage/total_time_usage, | |
364 100.0*audio_time_usage/total_time_usage, | |
365 100.0*(total_time_usage-tot)/total_time_usage, | |
366 100.0); | |
367 } | |
1639 | 368 |
1156 | 369 exit(1); |
370 } | |
371 | |
372 void exit_sighandler(int x){ | |
373 static int sig_count=0; | |
374 ++sig_count; | |
375 if(sig_count==2) exit(1); | |
376 if(sig_count>2){ | |
377 // can't stop :( | |
378 kill(getpid(),SIGKILL); | |
379 } | |
1583 | 380 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_IntBySignal,x, |
1156 | 381 current_module?current_module:"unknown" |
382 ); | |
383 exit_player(NULL); | |
384 } | |
385 | |
1467 | 386 extern stream_t* open_stream(char* filename,int vcd_track,int* file_format); |
387 | |
1156 | 388 extern void write_avi_header_1(FILE *f,int fcc,float fps,int width,int height); |
1327
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1302
diff
changeset
|
389 |
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1302
diff
changeset
|
390 // dec_audio.c: |
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1302
diff
changeset
|
391 extern int init_audio(sh_audio_t *sh_audio); |
1156 | 392 extern int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen); |
1327
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1302
diff
changeset
|
393 extern void resync_audio_stream(sh_audio_t *sh_audio); |
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1302
diff
changeset
|
394 extern void skip_audio_frame(sh_audio_t *sh_audio); |
1156 | 395 |
1327
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1302
diff
changeset
|
396 // dec_video.c: |
1496 | 397 extern int video_read_properties(sh_video_t *sh_video); |
1327
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1302
diff
changeset
|
398 extern int init_video(sh_video_t *sh_video); |
1422 | 399 #ifdef USE_LIBVO2 |
400 extern int decode_video(vo2_handle_t *video_out,sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame); | |
401 #else | |
1327
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1302
diff
changeset
|
402 extern int decode_video(vo_functions_t *video_out,sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame); |
1422 | 403 #endif |
1156 | 404 |
1439 | 405 extern int get_video_quality_max(sh_video_t *sh_video); |
406 extern void set_video_quality(sh_video_t *sh_video,int quality); | |
407 | |
459 | 408 #include "mixer.h" |
147 | 409 #include "cfg-mplayer.h" |
1 | 410 |
723 | 411 void parse_cfgfiles( void ) |
412 { | |
1014
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
413 char *conffile; |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
414 int conffile_fd; |
147 | 415 if (parse_config_file(conf, "/etc/mplayer.conf") < 0) |
416 exit(1); | |
178 | 417 if ((conffile = get_path("")) == NULL) { |
1583 | 418 mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_NoHomeDir); |
147 | 419 } else { |
178 | 420 mkdir(conffile, 0777); |
421 free(conffile); | |
422 if ((conffile = get_path("config")) == NULL) { | |
1583 | 423 mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_GetpathProblem); |
178 | 424 } else { |
425 if ((conffile_fd = open(conffile, O_CREAT | O_EXCL | O_WRONLY, 0666)) != -1) { | |
1582 | 426 mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_CreatingCfgFile, conffile); |
178 | 427 write(conffile_fd, default_config, strlen(default_config)); |
428 close(conffile_fd); | |
429 } | |
430 if (parse_config_file(conf, conffile) < 0) | |
431 exit(1); | |
432 free(conffile); | |
151 | 433 } |
1 | 434 } |
435 } | |
436 | |
1983 | 437 int main(int argc,char* argv[], char *envp[]){ |
723 | 438 |
1422 | 439 #ifdef USE_SUB |
1289 | 440 static subtitle* subtitles=NULL; |
1422 | 441 #endif |
1289 | 442 |
443 static demuxer_t *demuxer=NULL; | |
444 | |
445 static demux_stream_t *d_audio=NULL; | |
446 static demux_stream_t *d_video=NULL; | |
447 static demux_stream_t *d_dvdsub=NULL; | |
448 | |
449 static sh_audio_t *sh_audio=NULL; | |
450 static sh_video_t *sh_video=NULL; | |
451 | |
1629 | 452 // for multifile support: |
453 char **filenames=NULL; | |
454 int num_filenames=0; | |
455 int curr_filename=0; | |
456 | |
1014
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
457 char* filename=NULL; //"MI2-Trailer.avi"; |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
458 stream_t* stream=NULL; |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
459 int file_format=DEMUXER_TYPE_UNKNOWN; |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
460 // |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
461 int delay_corrected=1; |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
462 char* title="MPlayer"; |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
463 |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
464 // movie info: |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
465 int out_fmt=0; |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
466 |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
467 int osd_visible=100; |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
468 int osd_function=OSD_PLAY; |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
469 int osd_last_pts=-303; |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
470 |
1429 | 471 int v_bright=50; |
472 int v_cont=50; | |
473 int v_hue=50; | |
474 int v_saturation=50; | |
475 | |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
476 //float a_frame=0; // Audio |
1014
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
477 |
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
478 int i; |
1467 | 479 int use_stdin=0; //int f; // filedes |
1014
e01dc1a88edf
fixed punkso's mess... local variables moved back to main()
arpi_esp
parents:
1009
diff
changeset
|
480 |
1787
de6a0987a08d
stop fixed, fileselector supp. maybe not work, couldn't test
arpi
parents:
1772
diff
changeset
|
481 int gui_no_filename=0; |
de6a0987a08d
stop fixed, fileselector supp. maybe not work, couldn't test
arpi
parents:
1772
diff
changeset
|
482 |
1567 | 483 mp_msg_init(MSGL_STATUS); |
484 | |
485 mp_msg(MSGT_CPLAYER,MSGL_INFO,"%s",banner_text); | |
723 | 486 |
1694 | 487 // this one segfaults if running 'mplayer' (without path containing '/') |
488 // if ( !strcmp( strrchr( argv[0],'/' ),"/gmplayer" ) ) appInit( argc,argv,envp ); | |
1709 | 489 if ( argv[0] ) |
490 if(!strcmp(argv[0],"gmplayer") || | |
491 (strrchr(argv[0],'/') && !strcmp(strrchr(argv[0],'/'),"/gmplayer") ) ) | |
492 use_gui=1; | |
1639 | 493 |
751 | 494 parse_cfgfiles(); |
1639 | 495 num_filenames=parse_command_line(conf, argc, argv, envp, &filenames); |
496 if(num_filenames<0) exit(1); // error parsing cmdline | |
723 | 497 |
1709 | 498 #ifndef HAVE_NEW_GUI |
499 if(use_gui){ | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1962
diff
changeset
|
500 mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_NoGui); |
1709 | 501 use_gui=0; |
502 } | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
503 #else |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
504 if(use_gui && !vo_init()){ |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1962
diff
changeset
|
505 mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_GuiNeedsX); |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
506 use_gui=0; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
507 } |
1709 | 508 #endif |
509 | |
1422 | 510 #ifndef USE_LIBVO2 |
723 | 511 if(video_driver && strcmp(video_driver,"help")==0){ |
512 printf("Available video output drivers:\n"); | |
513 i=0; | |
514 while (video_out_drivers[i]) { | |
515 const vo_info_t *info = video_out_drivers[i++]->get_info (); | |
516 printf("\t%s\t%s\n", info->short_name, info->name); | |
517 } | |
518 printf("\n"); | |
519 exit(0); | |
956
a6cecd9a1bad
'-ao' switch (including '-ao help'), fixing Arpi's bug (short name 'null' for both of oss and null driver ;)
lgb
parents:
955
diff
changeset
|
520 } |
1422 | 521 #endif |
956
a6cecd9a1bad
'-ao' switch (including '-ao help'), fixing Arpi's bug (short name 'null' for both of oss and null driver ;)
lgb
parents:
955
diff
changeset
|
522 if(audio_driver && strcmp(audio_driver,"help")==0){ |
a6cecd9a1bad
'-ao' switch (including '-ao help'), fixing Arpi's bug (short name 'null' for both of oss and null driver ;)
lgb
parents:
955
diff
changeset
|
523 printf("Available audio output drivers:\n"); |
a6cecd9a1bad
'-ao' switch (including '-ao help'), fixing Arpi's bug (short name 'null' for both of oss and null driver ;)
lgb
parents:
955
diff
changeset
|
524 i=0; |
a6cecd9a1bad
'-ao' switch (including '-ao help'), fixing Arpi's bug (short name 'null' for both of oss and null driver ;)
lgb
parents:
955
diff
changeset
|
525 while (audio_out_drivers[i]) { |
a6cecd9a1bad
'-ao' switch (including '-ao help'), fixing Arpi's bug (short name 'null' for both of oss and null driver ;)
lgb
parents:
955
diff
changeset
|
526 const ao_info_t *info = audio_out_drivers[i++]->info; |
a6cecd9a1bad
'-ao' switch (including '-ao help'), fixing Arpi's bug (short name 'null' for both of oss and null driver ;)
lgb
parents:
955
diff
changeset
|
527 printf("\t%s\t%s\n", info->short_name, info->name); |
a6cecd9a1bad
'-ao' switch (including '-ao help'), fixing Arpi's bug (short name 'null' for both of oss and null driver ;)
lgb
parents:
955
diff
changeset
|
528 } |
a6cecd9a1bad
'-ao' switch (including '-ao help'), fixing Arpi's bug (short name 'null' for both of oss and null driver ;)
lgb
parents:
955
diff
changeset
|
529 printf("\n"); |
a6cecd9a1bad
'-ao' switch (including '-ao help'), fixing Arpi's bug (short name 'null' for both of oss and null driver ;)
lgb
parents:
955
diff
changeset
|
530 exit(0); |
a6cecd9a1bad
'-ao' switch (including '-ao help'), fixing Arpi's bug (short name 'null' for both of oss and null driver ;)
lgb
parents:
955
diff
changeset
|
531 } |
1639 | 532 |
1983 | 533 // check codec.conf |
534 if(!parse_codec_cfg(get_path("codecs.conf"))){ | |
535 if(!parse_codec_cfg(DATADIR"/codecs.conf")){ | |
536 mp_msg(MSGT_CPLAYER,MSGL_HINT,MSGTR_CopyCodecsConf); | |
537 exit(1); | |
538 } | |
539 } | |
540 | |
541 if(audio_codec && strcmp(audio_codec,"help")==0){ | |
542 printf("Available audio codecs:\n"); | |
543 list_codecs(1); | |
544 printf("\n"); | |
545 exit(0); | |
546 } | |
547 if(video_codec && strcmp(video_codec,"help")==0){ | |
548 printf("Available video codecs:\n"); | |
549 list_codecs(0); | |
550 printf("\n"); | |
551 exit(0); | |
552 } | |
553 | |
554 | |
1787
de6a0987a08d
stop fixed, fileselector supp. maybe not work, couldn't test
arpi
parents:
1772
diff
changeset
|
555 if(!num_filenames && !vcd_track && !dvd_title){ |
de6a0987a08d
stop fixed, fileselector supp. maybe not work, couldn't test
arpi
parents:
1772
diff
changeset
|
556 if(!use_gui){ |
1690 | 557 // no file/vcd/dvd -> show HELP: |
558 printf("%s",help_text); | |
559 exit(0); | |
1787
de6a0987a08d
stop fixed, fileselector supp. maybe not work, couldn't test
arpi
parents:
1772
diff
changeset
|
560 } else gui_no_filename=1; |
1690 | 561 } |
562 | |
563 // Many users forget to include command line in bugreports... | |
564 if(verbose){ | |
565 printf("CommandLine:"); | |
566 for(i=1;i<argc;i++)printf(" '%s'",argv[i]); | |
567 printf("\n"); | |
568 printf("num_filenames: %d\n",num_filenames); | |
569 } | |
570 | |
1639 | 571 mp_msg_init(verbose+MSGL_STATUS); |
1183 | 572 |
1639 | 573 //------ load global data first ------ |
955 | 574 |
442 | 575 |
212 | 576 // check font |
1422 | 577 #ifdef USE_OSD |
212 | 578 if(font_name){ |
337 | 579 vo_font=read_font_desc(font_name,font_factor,verbose>1); |
1582 | 580 if(!vo_font) mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,font_name); |
220 | 581 } else { |
582 // try default: | |
337 | 583 vo_font=read_font_desc(get_path("font/font.desc"),font_factor,verbose>1); |
1353 | 584 if(!vo_font) |
585 vo_font=read_font_desc(DATADIR"/font/font.desc",font_factor,verbose>1); | |
212 | 586 } |
1422 | 587 #endif |
212 | 588 |
1651 | 589 #ifdef USE_SUB |
590 // check .sub | |
591 if(sub_name){ | |
592 int l=strlen(sub_name); | |
593 if ((l>4) && ((0==strcmp(&sub_name[l-4],".utf")) | |
594 ||(0==strcmp(&sub_name[l-4],".UTF")))) | |
595 sub_utf8=1; | |
596 subtitles=sub_read_file(sub_name); | |
597 if(!subtitles) mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadSub,sub_name); | |
598 } | |
599 #endif | |
600 | |
1709 | 601 // It's time to init the GUI code: (and fork() the GTK process) |
602 #ifdef HAVE_NEW_GUI | |
603 if(use_gui){ | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
604 appInit( argc,argv,envp,(void*)mDisplay ); |
1856 | 605 inited_flags|=INITED_GUI; |
1803 | 606 mplShMem->Playing= (gui_no_filename) ? 0 : 1; |
1709 | 607 } |
608 #endif | |
1639 | 609 |
610 #ifdef HAVE_LIRC | |
611 lirc_mp_setup(); | |
1856 | 612 inited_flags|=INITED_LIRC; |
1639 | 613 #endif |
614 | |
615 #ifdef USE_TERMCAP | |
1729 | 616 if ( !use_gui ) load_termcap(NULL); // load key-codes |
1639 | 617 #endif |
618 | |
1816 | 619 // ========== Init keyboard FIFO (connection to libvo) ============ |
620 make_pipe(&keyb_fifo_get,&keyb_fifo_put); | |
1694 | 621 |
1639 | 622 //========= Catch terminate signals: ================ |
623 // terminate requests: | |
624 signal(SIGTERM,exit_sighandler); // kill | |
625 signal(SIGHUP,exit_sighandler); // kill -HUP / xterm closed | |
626 | |
1729 | 627 signal(SIGINT,exit_sighandler); // Interrupt from keyboard |
1639 | 628 |
629 signal(SIGQUIT,exit_sighandler); // Quit from keyboard | |
630 // fatal errors: | |
631 signal(SIGBUS,exit_sighandler); // bus error | |
632 signal(SIGSEGV,exit_sighandler); // segfault | |
633 signal(SIGILL,exit_sighandler); // illegal instruction | |
634 signal(SIGFPE,exit_sighandler); // floating point exc. | |
635 signal(SIGABRT,exit_sighandler); // abort() | |
636 | |
637 // ******************* Now, let's see the per-file stuff ******************** | |
638 | |
639 curr_filename=0; | |
640 play_next_file: | |
641 filename=(num_filenames>0)?filenames[curr_filename]:NULL; | |
1787
de6a0987a08d
stop fixed, fileselector supp. maybe not work, couldn't test
arpi
parents:
1772
diff
changeset
|
642 |
1745 | 643 #ifdef HAVE_NEW_GUI |
1787
de6a0987a08d
stop fixed, fileselector supp. maybe not work, couldn't test
arpi
parents:
1772
diff
changeset
|
644 if ( use_gui ) { |
1817
35d88a433502
fixed interaction between commandlien and fileselector
arpi
parents:
1816
diff
changeset
|
645 if(filename && !mplShMem->FilenameChanged) strcpy( mplShMem->Filename,filename ); |
1803 | 646 // mplShMem->Playing= (gui_no_filename) ? 0 : 1; |
1787
de6a0987a08d
stop fixed, fileselector supp. maybe not work, couldn't test
arpi
parents:
1772
diff
changeset
|
647 while(mplShMem->Playing!=1){ |
de6a0987a08d
stop fixed, fileselector supp. maybe not work, couldn't test
arpi
parents:
1772
diff
changeset
|
648 usleep(20000); |
1802 | 649 EventHandling(); |
1787
de6a0987a08d
stop fixed, fileselector supp. maybe not work, couldn't test
arpi
parents:
1772
diff
changeset
|
650 } |
1817
35d88a433502
fixed interaction between commandlien and fileselector
arpi
parents:
1816
diff
changeset
|
651 if(mplShMem->FilenameChanged){ |
1790 | 652 filename=mplShMem->Filename; |
653 } | |
1787
de6a0987a08d
stop fixed, fileselector supp. maybe not work, couldn't test
arpi
parents:
1772
diff
changeset
|
654 } |
de6a0987a08d
stop fixed, fileselector supp. maybe not work, couldn't test
arpi
parents:
1772
diff
changeset
|
655 #endif |
de6a0987a08d
stop fixed, fileselector supp. maybe not work, couldn't test
arpi
parents:
1772
diff
changeset
|
656 |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1962
diff
changeset
|
657 if(filename) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_Playing, filename); |
1650
7502b16bce63
make automatic subfile detection working with many files
atlka
parents:
1641
diff
changeset
|
658 |
7502b16bce63
make automatic subfile detection working with many files
atlka
parents:
1641
diff
changeset
|
659 #ifdef USE_SUB |
7502b16bce63
make automatic subfile detection working with many files
atlka
parents:
1641
diff
changeset
|
660 // check .sub |
1651 | 661 if(!sub_name){ |
1650
7502b16bce63
make automatic subfile detection working with many files
atlka
parents:
1641
diff
changeset
|
662 if(sub_auto && filename) { // auto load sub file ... |
7502b16bce63
make automatic subfile detection working with many files
atlka
parents:
1641
diff
changeset
|
663 subtitles=sub_read_file( sub_filename( get_path("sub/"), filename ) ); |
7502b16bce63
make automatic subfile detection working with many files
atlka
parents:
1641
diff
changeset
|
664 } |
7502b16bce63
make automatic subfile detection working with many files
atlka
parents:
1641
diff
changeset
|
665 if(!subtitles) subtitles=sub_read_file(get_path("default.sub")); // try default |
7502b16bce63
make automatic subfile detection working with many files
atlka
parents:
1641
diff
changeset
|
666 } |
7502b16bce63
make automatic subfile detection working with many files
atlka
parents:
1641
diff
changeset
|
667 #endif |
7502b16bce63
make automatic subfile detection working with many files
atlka
parents:
1641
diff
changeset
|
668 |
1762 | 669 if(subtitles && stream_dump_type==3) list_sub_file(subtitles); |
670 | |
1654 | 671 stream=NULL; |
672 demuxer=NULL; | |
673 d_audio=NULL; | |
674 d_video=NULL; | |
675 sh_audio=NULL; | |
676 sh_video=NULL; | |
1641
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
677 |
1639 | 678 #ifdef USE_LIBVO2 |
679 current_module="vo2_new"; | |
680 video_out=vo2_new(video_driver); | |
681 current_module=NULL; | |
682 #else | |
683 // check video_out driver name: | |
684 if (video_driver) | |
685 if ((i = strcspn(video_driver, ":")) > 0) | |
686 { | |
687 size_t i2 = strlen(video_driver); | |
688 | |
689 if (video_driver[i] == ':') | |
690 { | |
691 vo_subdevice = malloc(i2-i); | |
692 if (vo_subdevice != NULL) | |
693 strncpy(vo_subdevice, (char *)(video_driver+i+1), i2-i); | |
694 video_driver[i] = '\0'; | |
695 } | |
696 // printf("video_driver: %s, subdevice: %s\n", video_driver, vo_subdevice); | |
697 } | |
698 if(!video_driver) | |
699 video_out=video_out_drivers[0]; | |
700 else | |
701 for (i=0; video_out_drivers[i] != NULL; i++){ | |
702 const vo_info_t *info = video_out_drivers[i]->get_info (); | |
703 if(strcmp(info->short_name,video_driver) == 0){ | |
704 video_out = video_out_drivers[i];break; | |
705 } | |
706 } | |
707 #endif | |
708 if(!video_out){ | |
709 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_InvalidVOdriver,video_driver?video_driver:"?"); | |
710 exit_player(MSGTR_Exit_error); | |
711 } | |
712 | |
713 // check audio_out driver name: | |
714 if (audio_driver) | |
715 if ((i = strcspn(audio_driver, ":")) > 0) | |
716 { | |
717 size_t i2 = strlen(audio_driver); | |
718 | |
719 if (audio_driver[i] == ':') | |
720 { | |
721 ao_subdevice = malloc(i2-i); | |
722 if (ao_subdevice != NULL) | |
723 strncpy(ao_subdevice, (char *)(audio_driver+i+1), i2-i); | |
724 audio_driver[i] = '\0'; | |
725 } | |
726 // printf("audio_driver: %s, subdevice: %s\n", audio_driver, ao_subdevice); | |
727 } | |
728 if(!audio_driver) | |
729 audio_out=audio_out_drivers[0]; | |
730 else | |
731 for (i=0; audio_out_drivers[i] != NULL; i++){ | |
732 const ao_info_t *info = audio_out_drivers[i]->info; | |
733 if(strcmp(info->short_name,audio_driver) == 0){ | |
734 audio_out = audio_out_drivers[i];break; | |
735 } | |
736 } | |
737 if (!audio_out){ | |
738 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_InvalidAOdriver,audio_driver); | |
739 exit_player(MSGTR_Exit_error); | |
740 } | |
741 /*DSP!! if(dsp) audio_out->control(AOCONTROL_SET_DEVICE,(int)dsp);*/ | |
742 | |
743 | |
744 current_module="open_stream"; | |
1467 | 745 stream=open_stream(filename,vcd_track,&file_format); |
1641
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
746 if(!stream) goto goto_next_file;// exit_player(MSGTR_Exit_error); // error... |
1497
ad4d402b3d29
seek.c moved to demuxer.c, stream_reset in new_demuxer()
arpi
parents:
1496
diff
changeset
|
747 stream->start_pos+=seek_to_byte; |
598 | 748 |
1639 | 749 use_stdin=filename && (!strcmp(filename,"-")); |
750 | |
492 | 751 #ifdef HAVE_LIBCSS |
1639 | 752 current_module="libcss"; |
546 | 753 if (dvdimportkey) { |
754 if (dvd_import_key(dvdimportkey)) { | |
1582 | 755 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_ErrorDVDkey); |
1639 | 756 exit_player(MSGTR_Exit_error); |
546 | 757 } |
1582 | 758 mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_CmdlineDVDkey); |
546 | 759 } |
1018
e5fc7ec51fa3
-dvd is renamed to -dvdauth, variable dvd_device is renamed to dvd_auth_device. These changes are needed for future DVD playback developmenting
lgb
parents:
1015
diff
changeset
|
760 if (dvd_auth_device) { |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1039
diff
changeset
|
761 // if (dvd_auth(dvd_auth_device,f)) { |
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1039
diff
changeset
|
762 if (dvd_auth(dvd_auth_device,filename)) { |
1809 | 763 mp_msg(MSGT_CPLAYER,MSGL_FATAL,"Error in DVD auth...\n"); |
1639 | 764 exit_player(MSGTR_Exit_error); |
723 | 765 } |
1582 | 766 mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_DVDauthOk); |
492 | 767 } |
768 #endif | |
1 | 769 |
770 //============ Open & Sync stream and detect file format =============== | |
771 | |
442 | 772 if(!has_audio) audio_id=-2; // do NOT read audio packets... |
1 | 773 |
1639 | 774 current_module="demux_open"; |
775 | |
1496 | 776 demuxer=demux_open(stream,file_format,audio_id,video_id,dvdsub_id); |
1641
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
777 if(!demuxer) goto goto_next_file; // exit_player(MSGTR_Exit_error); // ERROR |
1375
dbcb5b5e1fae
file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents:
1369
diff
changeset
|
778 |
1660 | 779 //file_format=demuxer->file_format; |
1375
dbcb5b5e1fae
file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents:
1369
diff
changeset
|
780 |
1 | 781 d_audio=demuxer->audio; |
782 d_video=demuxer->video; | |
554 | 783 d_dvdsub=demuxer->sub; |
1 | 784 |
792 | 785 // DUMP STREAMS: |
786 if(stream_dump_type){ | |
787 FILE *f; | |
788 demux_stream_t *ds=NULL; | |
1639 | 789 current_module="dump"; |
792 | 790 // select stream to dump |
791 switch(stream_dump_type){ | |
792 case 1: ds=d_audio;break; | |
793 case 2: ds=d_video;break; | |
794 case 3: ds=d_dvdsub;break; | |
795 } | |
796 if(!ds){ | |
1582 | 797 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_DumpSelectedSteramMissing); |
1639 | 798 exit_player(MSGTR_Exit_error); |
792 | 799 } |
800 // disable other streams: | |
801 if(d_audio && d_audio!=ds) {ds_free_packs(d_audio); d_audio->id=-2; } | |
802 if(d_video && d_video!=ds) {ds_free_packs(d_video); d_video->id=-2; } | |
803 if(d_dvdsub && d_dvdsub!=ds) {ds_free_packs(d_dvdsub); d_dvdsub->id=-2; } | |
804 // let's dump it! | |
805 f=fopen(stream_dump_name?stream_dump_name:"stream.dump","wb"); | |
1639 | 806 if(!f){ |
807 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_CantOpenDumpfile); | |
808 exit_player(MSGTR_Exit_error); | |
809 } | |
792 | 810 while(!ds->eof){ |
811 unsigned char* start; | |
812 int in_size=ds_get_packet(ds,&start); | |
1660 | 813 if( (demuxer->file_format==DEMUXER_TYPE_AVI || demuxer->file_format==DEMUXER_TYPE_ASF) |
1246
7f69c1dd1e91
-dumpvideo stores frame size for avi/asf video frames (for ffmpeg testing)
arpi
parents:
1237
diff
changeset
|
814 && stream_dump_type==2) fwrite(&in_size,1,4,f); |
792 | 815 if(in_size>0) fwrite(start,in_size,1,f); |
816 } | |
817 fclose(f); | |
1582 | 818 mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_CoreDumped); |
1639 | 819 exit_player(MSGTR_Exit_eof); |
792 | 820 } |
821 | |
1375
dbcb5b5e1fae
file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents:
1369
diff
changeset
|
822 sh_audio=d_audio->sh; |
dbcb5b5e1fae
file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents:
1369
diff
changeset
|
823 sh_video=d_video->sh; |
792 | 824 |
1639 | 825 current_module="video_read_properties"; |
826 | |
1375
dbcb5b5e1fae
file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents:
1369
diff
changeset
|
827 if(sh_video){ |
1 | 828 |
1641
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
829 if(!video_read_properties(sh_video)) goto goto_next_file; // exit_player(MSGTR_Exit_error); // couldn't read header? |
1 | 830 |
1567 | 831 mp_msg(MSGT_CPLAYER,MSGL_INFO,"[V] filefmt:%d fourcc:0x%X size:%dx%d fps:%5.2f ftime:=%6.4f\n", |
1660 | 832 demuxer->file_format,sh_video->format, sh_video->disp_w,sh_video->disp_h, |
398 | 833 sh_video->fps,sh_video->frametime |
1375
dbcb5b5e1fae
file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents:
1369
diff
changeset
|
834 ); |
dbcb5b5e1fae
file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents:
1369
diff
changeset
|
835 |
dbcb5b5e1fae
file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents:
1369
diff
changeset
|
836 if(!sh_video->fps && !force_fps){ |
1582 | 837 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_FPSnotspecified); |
1641
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
838 goto goto_next_file; // exit_player(MSGTR_Exit_error); |
1375
dbcb5b5e1fae
file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents:
1369
diff
changeset
|
839 } |
dbcb5b5e1fae
file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents:
1369
diff
changeset
|
840 |
dbcb5b5e1fae
file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents:
1369
diff
changeset
|
841 } |
398 | 842 |
1 | 843 fflush(stdout); |
844 | |
778
13c0dfde813b
removed dummy audio track for -nosound, vo: flip detection
arpi_esp
parents:
766
diff
changeset
|
845 if(!sh_video){ |
1582 | 846 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_NoVideoStream); |
1641
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
847 goto goto_next_file; // exit_player(MSGTR_Exit_error); |
778
13c0dfde813b
removed dummy audio track for -nosound, vo: flip detection
arpi_esp
parents:
766
diff
changeset
|
848 } |
13c0dfde813b
removed dummy audio track for -nosound, vo: flip detection
arpi_esp
parents:
766
diff
changeset
|
849 |
303 | 850 //================== Init AUDIO (codec) ========================== |
1639 | 851 |
852 current_module="init_audio_codec"; | |
853 | |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
854 if(sh_audio){ |
303 | 855 // Go through the codec.conf and find the best codec... |
626 | 856 sh_audio->codec=NULL; |
1582 | 857 if(audio_family!=-1) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_TryForceAudioFmt,audio_family); |
626 | 858 while(1){ |
859 sh_audio->codec=find_codec(sh_audio->format,NULL,sh_audio->codec,1); | |
860 if(!sh_audio->codec){ | |
1299
fa50e6bc6091
As promised, -afm and -vfm to prefer audio/video driver family, -ac and -vc have higher precedence, so they can override -afm/-vfm.
atmos4
parents:
1296
diff
changeset
|
861 if(audio_family!=-1) { |
fa50e6bc6091
As promised, -afm and -vfm to prefer audio/video driver family, -ac and -vc have higher precedence, so they can override -afm/-vfm.
atmos4
parents:
1296
diff
changeset
|
862 sh_audio->codec=NULL; /* re-search */ |
1582 | 863 mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantFindAfmtFallback); |
1299
fa50e6bc6091
As promised, -afm and -vfm to prefer audio/video driver family, -ac and -vc have higher precedence, so they can override -afm/-vfm.
atmos4
parents:
1296
diff
changeset
|
864 audio_family=-1; |
fa50e6bc6091
As promised, -afm and -vfm to prefer audio/video driver family, -ac and -vc have higher precedence, so they can override -afm/-vfm.
atmos4
parents:
1296
diff
changeset
|
865 continue; |
fa50e6bc6091
As promised, -afm and -vfm to prefer audio/video driver family, -ac and -vc have higher precedence, so they can override -afm/-vfm.
atmos4
parents:
1296
diff
changeset
|
866 } |
1582 | 867 mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantFindAudioCodec,sh_audio->format); |
868 mp_msg(MSGT_CPLAYER,MSGL_HINT, MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("codecs.conf")); | |
1792 | 869 sh_audio=d_audio->sh=NULL; |
626 | 870 break; |
871 } | |
1286
543a94b241a2
Replaced LGBs video codec forcing change with mine for audio and video codecs, which is IMHO more convenient cause codecs are selected by name instead of number, one unclearity is left to me, that's why audio_format is used once before codecs selection for MPEG_PS files, that's why I left -afm in for that one.
atmos4
parents:
1285
diff
changeset
|
872 if(audio_codec && strcmp(sh_audio->codec->name,audio_codec)) continue; |
1299
fa50e6bc6091
As promised, -afm and -vfm to prefer audio/video driver family, -ac and -vc have higher precedence, so they can override -afm/-vfm.
atmos4
parents:
1296
diff
changeset
|
873 else if(audio_family!=-1 && sh_audio->codec->driver!=audio_family) continue; |
1567 | 874 mp_msg(MSGT_CPLAYER,MSGL_INFO,"%s audio codec: [%s] drv:%d (%s)\n",audio_codec?"Forcing":"Detected",sh_audio->codec->name,sh_audio->codec->driver,sh_audio->codec->info); |
626 | 875 break; |
303 | 876 } |
1 | 877 } |
878 | |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
879 if(sh_audio){ |
1567 | 880 mp_msg(MSGT_CPLAYER,MSGL_V,"Initializing audio codec...\n"); |
442 | 881 if(!init_audio(sh_audio)){ |
1582 | 882 mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CouldntInitAudioCodec); |
1792 | 883 sh_audio=d_audio->sh=NULL; |
1889 | 884 #ifdef HAVE_NEW_GUI |
885 if ( use_gui ) mplShMem->AudioType=0; | |
886 #endif | |
303 | 887 } else { |
1567 | 888 mp_msg(MSGT_CPLAYER,MSGL_INFO,"AUDIO: srate=%d chans=%d bps=%d sfmt=0x%X ratio: %d->%d\n",sh_audio->samplerate,sh_audio->channels,sh_audio->samplesize, |
758 | 889 sh_audio->sample_format,sh_audio->i_bps,sh_audio->o_bps); |
1889 | 890 #ifdef HAVE_NEW_GUI |
891 if ( use_gui ) mplShMem->AudioType=sh_audio->channels; | |
892 #endif | |
303 | 893 } |
175 | 894 } |
895 | |
303 | 896 //================== Init VIDEO (codec & libvo) ========================== |
897 | |
1639 | 898 current_module="init_video_codec"; |
899 | |
303 | 900 // Go through the codec.conf and find the best codec... |
626 | 901 sh_video->codec=NULL; |
1582 | 902 if(video_family!=-1) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_TryForceVideoFmt,video_family); |
626 | 903 while(1){ |
904 sh_video->codec=find_codec(sh_video->format, | |
905 sh_video->bih?((unsigned int*) &sh_video->bih->biCompression):NULL,sh_video->codec,0); | |
906 if(!sh_video->codec){ | |
1299
fa50e6bc6091
As promised, -afm and -vfm to prefer audio/video driver family, -ac and -vc have higher precedence, so they can override -afm/-vfm.
atmos4
parents:
1296
diff
changeset
|
907 if(video_family!=-1) { |
fa50e6bc6091
As promised, -afm and -vfm to prefer audio/video driver family, -ac and -vc have higher precedence, so they can override -afm/-vfm.
atmos4
parents:
1296
diff
changeset
|
908 sh_video->codec=NULL; /* re-search */ |
1582 | 909 mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_CantFindVfmtFallback); |
1299
fa50e6bc6091
As promised, -afm and -vfm to prefer audio/video driver family, -ac and -vc have higher precedence, so they can override -afm/-vfm.
atmos4
parents:
1296
diff
changeset
|
910 video_family=-1; |
fa50e6bc6091
As promised, -afm and -vfm to prefer audio/video driver family, -ac and -vc have higher precedence, so they can override -afm/-vfm.
atmos4
parents:
1296
diff
changeset
|
911 continue; |
fa50e6bc6091
As promised, -afm and -vfm to prefer audio/video driver family, -ac and -vc have higher precedence, so they can override -afm/-vfm.
atmos4
parents:
1296
diff
changeset
|
912 } |
1582 | 913 mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantFindVideoCodec,sh_video->format); |
914 mp_msg(MSGT_CPLAYER,MSGL_HINT, MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("codecs.conf")); | |
1641
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
915 goto goto_next_file; // exit_player(MSGTR_Exit_error); |
626 | 916 } |
1286
543a94b241a2
Replaced LGBs video codec forcing change with mine for audio and video codecs, which is IMHO more convenient cause codecs are selected by name instead of number, one unclearity is left to me, that's why audio_format is used once before codecs selection for MPEG_PS files, that's why I left -afm in for that one.
atmos4
parents:
1285
diff
changeset
|
917 // is next line needed anymore? - atmos :: |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1406
diff
changeset
|
918 if(!allow_dshow && sh_video->codec->driver==VFM_DSHOW) continue; // skip DShow |
1286
543a94b241a2
Replaced LGBs video codec forcing change with mine for audio and video codecs, which is IMHO more convenient cause codecs are selected by name instead of number, one unclearity is left to me, that's why audio_format is used once before codecs selection for MPEG_PS files, that's why I left -afm in for that one.
atmos4
parents:
1285
diff
changeset
|
919 else if(video_codec && strcmp(sh_video->codec->name,video_codec)) continue; |
1299
fa50e6bc6091
As promised, -afm and -vfm to prefer audio/video driver family, -ac and -vc have higher precedence, so they can override -afm/-vfm.
atmos4
parents:
1296
diff
changeset
|
920 else if(video_family!=-1 && sh_video->codec->driver!=video_family) continue; |
626 | 921 break; |
303 | 922 } |
923 | |
1567 | 924 mp_msg(MSGT_CPLAYER,MSGL_INFO,"%s video codec: [%s] drv:%d (%s)\n",video_codec?"Forcing":"Detected",sh_video->codec->name,sh_video->codec->driver,sh_video->codec->info); |
303 | 925 |
926 for(i=0;i<CODECS_MAX_OUTFMT;i++){ | |
487 | 927 int ret; |
303 | 928 out_fmt=sh_video->codec->outfmt[i]; |
534
2a45d5adcc88
do not query vo drivers for format 0xFFFFFFFF (thanx to szabi)
arpi_esp
parents:
510
diff
changeset
|
929 if(out_fmt==0xFFFFFFFF) continue; |
1422 | 930 #ifdef USE_LIBVO2 |
931 ret=vo2_query_format(video_out); | |
932 #else | |
487 | 933 ret=video_out->query_format(out_fmt); |
1422 | 934 #endif |
1567 | 935 mp_msg(MSGT_CPLAYER,MSGL_DBG2,"vo_debug: query(%s) returned 0x%X\n",vo_format_name(out_fmt),ret); |
487 | 936 if(ret) break; |
303 | 937 } |
938 if(i>=CODECS_MAX_OUTFMT){ | |
1582 | 939 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_VOincompCodec); |
1641
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
940 goto goto_next_file; // exit_player(MSGTR_Exit_error); |
303 | 941 } |
942 sh_video->outfmtidx=i; | |
943 | |
778
13c0dfde813b
removed dummy audio track for -nosound, vo: flip detection
arpi_esp
parents:
766
diff
changeset
|
944 if(flip==-1){ |
13c0dfde813b
removed dummy audio track for -nosound, vo: flip detection
arpi_esp
parents:
766
diff
changeset
|
945 // autodetect flipping |
13c0dfde813b
removed dummy audio track for -nosound, vo: flip detection
arpi_esp
parents:
766
diff
changeset
|
946 flip=0; |
13c0dfde813b
removed dummy audio track for -nosound, vo: flip detection
arpi_esp
parents:
766
diff
changeset
|
947 if(sh_video->codec->outflags[i]&CODECS_FLAG_FLIP) |
13c0dfde813b
removed dummy audio track for -nosound, vo: flip detection
arpi_esp
parents:
766
diff
changeset
|
948 if(!(sh_video->codec->outflags[i]&CODECS_FLAG_NOFLIP)) |
13c0dfde813b
removed dummy audio track for -nosound, vo: flip detection
arpi_esp
parents:
766
diff
changeset
|
949 flip=1; |
13c0dfde813b
removed dummy audio track for -nosound, vo: flip detection
arpi_esp
parents:
766
diff
changeset
|
950 } |
13c0dfde813b
removed dummy audio track for -nosound, vo: flip detection
arpi_esp
parents:
766
diff
changeset
|
951 |
1567 | 952 mp_msg(MSGT_CPLAYER,MSGL_DBG2,"vo_debug1: out_fmt=%s\n",vo_format_name(out_fmt)); |
487 | 953 |
1291 | 954 if(!init_video(sh_video)){ |
1582 | 955 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_CouldntInitVideoCodec); |
1641
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
956 goto goto_next_file; // exit_player(MSGTR_Exit_error); |
1 | 957 } |
958 | |
1439 | 959 if(auto_quality>0){ |
960 // Auto quality option enabled | |
961 output_quality=get_video_quality_max(sh_video); | |
962 if(auto_quality>output_quality) auto_quality=output_quality; | |
963 else output_quality=auto_quality; | |
1567 | 964 mp_msg(MSGT_CPLAYER,MSGL_V,"AutoQ: setting quality to %d\n",output_quality); |
1439 | 965 set_video_quality(sh_video,output_quality); |
966 } | |
967 | |
1 | 968 // ================== Init output files for encoding =============== |
969 if(encode_name){ | |
970 // encode file!!! | |
971 FILE *encode_file=fopen(encode_name,"rb"); | |
972 if(encode_file){ | |
973 fclose(encode_file); | |
1582 | 974 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_EncodeFileExists,encode_name); |
1639 | 975 exit_player(MSGTR_Exit_error); |
1 | 976 } |
977 encode_file=fopen(encode_name,"wb"); | |
978 if(!encode_file){ | |
1582 | 979 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_CantCreateEncodeFile); |
1639 | 980 exit_player(MSGTR_Exit_error); |
1 | 981 } |
398 | 982 write_avi_header_1(encode_file,mmioFOURCC('d', 'i', 'v', 'x'),sh_video->fps,sh_video->disp_w,sh_video->disp_h); |
1 | 983 fclose(encode_file); |
984 encode_index_name=malloc(strlen(encode_name)+8); | |
985 strcpy(encode_index_name,encode_name); | |
986 strcat(encode_index_name,".index"); | |
987 if((encode_file=fopen(encode_index_name,"wb"))) | |
988 fclose(encode_file); | |
989 else encode_index_name=NULL; | |
1856 | 990 sh_audio=d_audio->sh=NULL; // force nosound |
991 inited_flags|=INITED_ENCODE; | |
1 | 992 } |
993 | |
398 | 994 // ========== Init display (sh_video->disp_w*sh_video->disp_h/out_fmt) ============ |
1 | 995 |
1639 | 996 current_module="init_libvo"; |
997 | |
1 | 998 #ifdef X11_FULLSCREEN |
999 if(fullscreen){ | |
1000 if(vo_init()){ | |
1001 //if(verbose) printf("X11 running at %dx%d depth: %d\n",vo_screenwidth,vo_screenheight,vo_depthonscreen); | |
1002 } | |
1003 if(!screen_size_xy) screen_size_xy=vo_screenwidth; // scale with asp.ratio | |
1004 } | |
1005 #endif | |
1006 | |
1007 if(screen_size_xy>0){ | |
1008 if(screen_size_xy<=8){ | |
398 | 1009 screen_size_x=screen_size_xy*sh_video->disp_w; |
1010 screen_size_y=screen_size_xy*sh_video->disp_h; | |
1 | 1011 } else { |
1012 screen_size_x=screen_size_xy; | |
398 | 1013 screen_size_y=screen_size_xy*sh_video->disp_h/sh_video->disp_w; |
1 | 1014 } |
337 | 1015 } else if(!vidmode){ |
1016 if(!screen_size_x) screen_size_x=SCREEN_SIZE_X; | |
1017 if(!screen_size_y) screen_size_y=SCREEN_SIZE_Y; | |
398 | 1018 if(screen_size_x<=8) screen_size_x*=sh_video->disp_w; |
1019 if(screen_size_y<=8) screen_size_y*=sh_video->disp_h; | |
1 | 1020 } |
208
ae0f909ccc7c
Adds code to deal with vidmode selection. -- mgraffam
mgraffam
parents:
190
diff
changeset
|
1021 |
1422 | 1022 #ifndef USE_LIBVO2 |
340 | 1023 { const vo_info_t *info = video_out->get_info(); |
1567 | 1024 mp_msg(MSGT_CPLAYER,MSGL_INFO,"VO: [%s] %dx%d => %dx%d %s %s%s%s%s\n",info->short_name, |
398 | 1025 sh_video->disp_w,sh_video->disp_h, |
340 | 1026 screen_size_x,screen_size_y, |
1183 | 1027 vo_format_name(out_fmt), |
340 | 1028 fullscreen?"fs ":"", |
1029 vidmode?"vm ":"", | |
766 | 1030 softzoom?"zoom ":"", |
778
13c0dfde813b
removed dummy audio track for -nosound, vo: flip detection
arpi_esp
parents:
766
diff
changeset
|
1031 (flip==1)?"flip ":"" |
766 | 1032 // fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3) |
340 | 1033 ); |
1567 | 1034 mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Description: %s\n",info->name); |
1035 mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Author: %s\n", info->author); | |
1237 | 1036 if(strlen(info->comment) > 0) |
1567 | 1037 mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Comment: %s\n", info->comment); |
340 | 1038 } |
1422 | 1039 #endif |
340 | 1040 |
1753 | 1041 #ifdef HAVE_NEW_GUI |
1042 if ( use_gui ) | |
1043 { | |
1952 | 1044 mplResizeToMovieSize( sh_video->disp_w,sh_video->disp_h ); |
1045 moviewidth=screen_size_x=sh_video->disp_w; | |
1046 movieheight=screen_size_y=sh_video->disp_h; | |
1753 | 1047 } |
1048 #endif | |
1049 | |
1567 | 1050 mp_msg(MSGT_CPLAYER,MSGL_V,"video_out->init(%dx%d->%dx%d,flags=%d,'%s',0x%X)\n", |
398 | 1051 sh_video->disp_w,sh_video->disp_h, |
1 | 1052 screen_size_x,screen_size_y, |
766 | 1053 fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3), |
337 | 1054 title,out_fmt); |
1 | 1055 |
1422 | 1056 #ifdef USE_LIBVO2 |
1057 if(!vo2_start(video_out, | |
1058 sh_video->disp_w,sh_video->disp_h,out_fmt,0, | |
1059 fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3) )){ | |
1060 #else | |
398 | 1061 if(video_out->init(sh_video->disp_w,sh_video->disp_h, |
1 | 1062 screen_size_x,screen_size_y, |
766 | 1063 fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3), |
337 | 1064 title,out_fmt)){ |
1641
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
1065 #endif |
1582 | 1066 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_CannotInitVO); |
1641
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
1067 goto goto_next_file; // exit_player(MSGTR_Exit_error); |
1 | 1068 } |
1856 | 1069 inited_flags|=INITED_VO; |
1567 | 1070 mp_msg(MSGT_CPLAYER,MSGL_V,"INFO: Video OUT driver init OK!\n"); |
1 | 1071 |
1072 fflush(stdout); | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
1073 |
1 | 1074 //================== MAIN: ========================== |
1075 { | |
746 | 1076 |
1420 | 1077 //int frame_corr_num=0; // |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1078 //float v_frame=0; // Video |
1 | 1079 float time_frame=0; // Timer |
1080 int eof=0; | |
1081 int force_redraw=0; | |
1400 | 1082 //float num_frames=0; // number of frames played |
1382 | 1083 int grab_frames=0; |
212 | 1084 char osd_text_buffer[64]; |
715 | 1085 int drop_frame=0; |
1086 int drop_frame_cnt=0; | |
1439 | 1087 // for auto-quality: |
1478
6f9167f0fcca
'too slow' message is fixed - better detection now based on both drop_cnt and A-V sync
arpi
parents:
1467
diff
changeset
|
1088 float AV_delay=0; // average of A-V timestamp differences |
1439 | 1089 double cvideo_base_vtime; |
1090 double cvideo_base_vframe; | |
1091 double vdecode_time; | |
1 | 1092 |
1093 | |
1094 //================ SETUP AUDIO ========================== | |
1095 current_module="setup_audio"; | |
1096 | |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1097 if(sh_audio){ |
1237 | 1098 |
1099 const ao_info_t *info=audio_out->info; | |
1567 | 1100 mp_msg(MSGT_CPLAYER,MSGL_INFO,"AO: [%s] %iHz %s %s\n", |
1237 | 1101 info->short_name, |
1102 force_srate?force_srate:sh_audio->samplerate, | |
1103 sh_audio->channels>1?"Stereo":"Mono", | |
1456
8c57a5a3c645
printfs cleanup - moved to higher -v level or moved to stderr
arpi
parents:
1449
diff
changeset
|
1104 audio_out_format_name(sh_audio->sample_format) |
8c57a5a3c645
printfs cleanup - moved to higher -v level or moved to stderr
arpi
parents:
1449
diff
changeset
|
1105 ); |
1567 | 1106 mp_msg(MSGT_CPLAYER,MSGL_V,"AO: Description: %s\nAO: Author: %s\n", |
1237 | 1107 info->name, |
1108 info->author | |
1109 ); | |
1456
8c57a5a3c645
printfs cleanup - moved to higher -v level or moved to stderr
arpi
parents:
1449
diff
changeset
|
1110 if(strlen(info->comment) > 0) |
1567 | 1111 mp_msg(MSGT_CPLAYER,MSGL_V,"AO: Comment: %s\n", info->comment); |
969 | 1112 if(!audio_out->init(force_srate?force_srate:sh_audio->samplerate, |
1113 sh_audio->channels,sh_audio->sample_format,0)){ | |
1582 | 1114 mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CannotInitAO); |
1792 | 1115 sh_audio=d_audio->sh=NULL; |
1856 | 1116 } else { |
1117 inited_flags|=INITED_AO; | |
1 | 1118 } |
1119 | |
955 | 1120 // printf("Audio buffer size: %d bytes, delay: %5.3fs\n",audio_buffer_size,audio_buffer_delay); |
746 | 1121 |
758 | 1122 // fixup audio buffer size: |
782 | 1123 // if(outburst<MAX_OUTBURST){ |
1124 // sh_audio->a_buffer_size=sh_audio->audio_out_minsize+outburst; | |
1125 // printf("Audio out buffer size reduced to %d bytes\n",sh_audio->a_buffer_size); | |
1126 // } | |
758 | 1127 |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1128 // sh_audio->timer=-(audio_buffer_delay); |
1 | 1129 } |
1130 | |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1131 sh_video->timer=0; |
2000 | 1132 if(sh_audio) sh_audio->timer=-audio_delay; |
1 | 1133 |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1134 if(!sh_audio){ |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1962
diff
changeset
|
1135 mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_NoSound); |
1567 | 1136 if(verbose) mp_msg(MSGT_CPLAYER,MSGL_V,"Freeing %d unused audio chunks\n",d_audio->packs); |
1 | 1137 ds_free_packs(d_audio); // free buffered chunks |
1138 d_audio->id=-2; // do not read audio chunks | |
1856 | 1139 if(audio_out) uninit_player(INITED_AO); // close device |
1 | 1140 } |
1141 | |
1142 current_module=NULL; | |
1143 | |
1660 | 1144 if(demuxer->file_format!=DEMUXER_TYPE_AVI) pts_from_bps=0; // it must be 0 for mpeg/asf! |
398 | 1145 if(force_fps){ |
1146 sh_video->fps=force_fps; | |
1147 sh_video->frametime=1.0f/sh_video->fps; | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1962
diff
changeset
|
1148 mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_FPSforced,sh_video->fps,sh_video->frametime); |
398 | 1149 } |
1 | 1150 |
1639 | 1151 //==================== START PLAYING ======================= |
1152 | |
1582 | 1153 mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_StartPlaying);fflush(stdout); |
1 | 1154 |
1856 | 1155 if(!use_stdin){ |
1156 getch2_enable(); // prepare stdin for hotkeys... | |
1157 inited_flags|=INITED_GETCH2; | |
1158 } | |
1639 | 1159 |
1 | 1160 InitTimer(); |
1161 | |
1124
0e95f30ffd4c
-frames and -benchmark options to make chl & gabucino happy
arpi_esp
parents:
1059
diff
changeset
|
1162 total_time_usage_start=GetTimer(); |
0e95f30ffd4c
-frames and -benchmark options to make chl & gabucino happy
arpi_esp
parents:
1059
diff
changeset
|
1163 |
1 | 1164 while(!eof){ |
1439 | 1165 unsigned int aq_total_time=GetTimer(); |
1166 float aq_sleep_time=0; | |
1 | 1167 |
1125 | 1168 if(play_n_frames>=0){ |
1169 --play_n_frames; | |
1582 | 1170 if(play_n_frames<0) exit_player(MSGTR_Exit_frames); |
1125 | 1171 } |
1172 | |
1 | 1173 /*========================== PLAY AUDIO ============================*/ |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1174 while(sh_audio){ |
746 | 1175 unsigned int t; |
955 | 1176 int playsize=audio_out->get_space(); |
746 | 1177 |
955 | 1178 if(!playsize) break; // buffer is full, do not block here!!! |
746 | 1179 |
1180 if(playsize>MAX_OUTBURST) playsize=MAX_OUTBURST; // we shouldn't exceed it! | |
1181 //if(playsize>outburst) playsize=outburst; | |
291 | 1182 |
1183 // Update buffer if needed | |
1639 | 1184 current_module="decode_audio"; // Enter AUDIO decoder module |
746 | 1185 t=GetTimer(); |
1186 while(sh_audio->a_buffer_len<playsize && !d_audio->eof){ | |
1187 int ret=decode_audio(sh_audio,&sh_audio->a_buffer[sh_audio->a_buffer_len], | |
1188 playsize-sh_audio->a_buffer_len,sh_audio->a_buffer_size-sh_audio->a_buffer_len); | |
296 | 1189 if(ret>0) sh_audio->a_buffer_len+=ret; else break; |
1 | 1190 } |
1191 current_module=NULL; // Leave AUDIO decoder module | |
291 | 1192 t=GetTimer()-t;audio_time_usage+=t*0.000001; |
746 | 1193 |
1194 if(playsize>sh_audio->a_buffer_len) playsize=sh_audio->a_buffer_len; | |
1195 | |
955 | 1196 playsize=audio_out->play(sh_audio->a_buffer,playsize,0); |
1 | 1197 |
955 | 1198 if(playsize>0){ |
746 | 1199 sh_audio->a_buffer_len-=playsize; |
1200 memcpy(sh_audio->a_buffer,&sh_audio->a_buffer[playsize],sh_audio->a_buffer_len); | |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1201 sh_audio->timer+=playsize/(float)(sh_audio->o_bps); |
1 | 1202 } |
1203 | |
1204 break; | |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1205 } // if(sh_audio) |
1 | 1206 |
1207 /*========================== UPDATE TIMERS ============================*/ | |
746 | 1208 #if 0 |
1 | 1209 if(alsa){ |
1210 // Use system timer for sync, not audio card/driver | |
1211 time_frame-=GetRelativeTime(); | |
1212 if(time_frame<-0.1 || time_frame>0.1){ | |
1213 time_frame=0; | |
1214 } else { | |
398 | 1215 while(time_frame>0.022){ |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
1216 usec_sleep(time_frame-0.022); |
398 | 1217 time_frame-=GetRelativeTime(); |
1218 } | |
103 | 1219 while(time_frame>0.007){ |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
1220 usec_sleep(1000); // sleeps 1 clock tick (10ms)! |
103 | 1221 time_frame-=GetRelativeTime(); |
1222 } | |
398 | 1223 } |
1 | 1224 } |
746 | 1225 #endif |
1 | 1226 |
1227 /*========================== PLAY VIDEO ============================*/ | |
1228 | |
1439 | 1229 cvideo_base_vframe=sh_video->timer; |
1230 cvideo_base_vtime=video_time_usage; | |
1231 | |
1 | 1232 if(1) |
746 | 1233 while(1){ |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
1234 |
398 | 1235 float frame_time=1; |
1236 float pts1=d_video->pts; | |
1291 | 1237 int blit_frame=0; |
1 | 1238 |
1239 current_module="decode_video"; | |
715 | 1240 |
1 | 1241 //-------------------- Decode a frame: ----------------------- |
1242 | |
1439 | 1243 vdecode_time=video_time_usage; |
1244 | |
1660 | 1245 if(demuxer->file_format==DEMUXER_TYPE_MPEG_ES || demuxer->file_format==DEMUXER_TYPE_MPEG_PS){ |
111 | 1246 int in_frame=0; |
398 | 1247 float newfps; |
1462 | 1248 //videobuf_len=0; |
111 | 1249 while(videobuf_len<VIDEOBUFFER_SIZE-MAX_VIDEO_PACKET_SIZE){ |
1250 int i=sync_video_packet(d_video); | |
1295 | 1251 void* buffer=&videobuffer[videobuf_len+4]; |
111 | 1252 if(in_frame){ |
1253 if(i<0x101 || i>=0x1B0){ // not slice code -> end of frame | |
398 | 1254 #if 1 |
111 | 1255 // send END OF FRAME code: |
1256 videobuffer[videobuf_len+0]=0; | |
1257 videobuffer[videobuf_len+1]=0; | |
1258 videobuffer[videobuf_len+2]=1; | |
1259 videobuffer[videobuf_len+3]=0xFF; | |
1260 videobuf_len+=4; | |
1261 #endif | |
1421 | 1262 if(!i) eof=2; // EOF |
111 | 1263 break; |
1264 } | |
1265 } else { | |
1266 //if(i==0x100) in_frame=1; // picture startcode | |
1267 if(i>=0x101 && i<0x1B0) in_frame=1; // picture startcode | |
1421 | 1268 else if(!i){ eof=3; break;} // EOF |
111 | 1269 } |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
1270 if(grab_frames==2 && (i==0x1B3 || i==0x1B8)) grab_frames=1; |
1421 | 1271 if(!read_video_packet(d_video)){ eof=4; break;} // EOF |
111 | 1272 //printf("read packet 0x%X, len=%d\n",i,videobuf_len); |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1406
diff
changeset
|
1273 if(sh_video->codec->driver!=VFM_MPEG){ |
1296 | 1274 // if not libmpeg2: |
1295 | 1275 switch(i){ |
1276 case 0x1B3: header_process_sequence_header (picture, buffer);break; | |
1277 case 0x1B5: header_process_extension (picture, buffer);break; | |
1278 } | |
1279 } | |
111 | 1280 } |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
1281 |
111 | 1282 if(videobuf_len>max_framesize) max_framesize=videobuf_len; // debug |
1283 //printf("--- SEND %d bytes\n",videobuf_len); | |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
1284 if(grab_frames==1){ |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
1285 FILE *f=fopen("grab.mpg","ab"); |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
1286 fwrite(videobuffer,videobuf_len-4,1,f); |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
1287 fclose(f); |
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
1288 } |
1291 | 1289 |
1290 blit_frame=decode_video(video_out,sh_video,videobuffer,videobuf_len,drop_frame); | |
111 | 1291 |
1291 | 1292 // get mpeg fps: |
1293 newfps=frameratecode2framerate[picture->frame_rate_code]*0.0001f; | |
1294 if(ABS(sh_video->fps-newfps)>0.01f) if(!force_fps){ | |
1567 | 1295 mp_msg(MSGT_CPLAYER,MSGL_WARN,"Warning! FPS changed %5.3f -> %5.3f (%f) [%d] \n",sh_video->fps,newfps,sh_video->fps-newfps,picture->frame_rate_code); |
398 | 1296 sh_video->fps=newfps; |
1297 sh_video->frametime=10000.0f/(float)frameratecode2framerate[picture->frame_rate_code]; | |
1291 | 1298 } |
1299 | |
1300 // fix mpeg2 frametime: | |
1301 frame_time=(100+picture->repeat_count)*0.01f; | |
1302 picture->repeat_count=0; | |
1462 | 1303 videobuf_len=0; |
398 | 1304 |
1291 | 1305 } else { |
1306 // frame-based file formats: (AVI,ASF,MOV) | |
1307 unsigned char* start=NULL; | |
1308 int in_size=ds_get_packet(d_video,&start); | |
1421 | 1309 if(in_size<0){ eof=5;break;} |
1291 | 1310 if(in_size>max_framesize) max_framesize=in_size; |
1311 blit_frame=decode_video(video_out,sh_video,start,in_size,drop_frame); | |
1 | 1312 } |
1291 | 1313 |
1439 | 1314 vdecode_time=video_time_usage-vdecode_time; |
1315 | |
1 | 1316 //------------------------ frame decoded. -------------------- |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1498
diff
changeset
|
1317 //------------------------ add OSD to frame contents --------- |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1498
diff
changeset
|
1318 #ifndef USE_LIBVO2 |
1768 | 1319 current_module="draw_osd"; |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1498
diff
changeset
|
1320 video_out->draw_osd(); |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1498
diff
changeset
|
1321 #endif |
1 | 1322 |
1768 | 1323 current_module="av_sync"; |
1324 | |
398 | 1325 // Increase video timers: |
1400 | 1326 sh_video->num_frames+=frame_time; |
1546 | 1327 ++sh_video->num_frames_decoded; |
398 | 1328 frame_time*=sh_video->frametime; |
1660 | 1329 if(demuxer->file_format==DEMUXER_TYPE_ASF && !force_fps){ |
398 | 1330 // .ASF files has no fixed FPS - just frame durations! |
1331 float d=d_video->pts-pts1; | |
1332 if(d>=0 && d<5) frame_time=d; | |
595 | 1333 if(d>0){ |
1334 if(verbose) | |
1335 if((int)sh_video->fps==1000) | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1962
diff
changeset
|
1336 mp_msg(MSGT_CPLAYER,MSGL_STATUS,"\rASF framerate: %d fps \n",(int)(1.0f/d)); |
595 | 1337 sh_video->frametime=d; // 1ms |
1338 sh_video->fps=1.0f/d; | |
1339 } | |
398 | 1340 } |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1341 sh_video->timer+=frame_time; |
746 | 1342 time_frame+=frame_time; // for nosound |
1343 | |
1660 | 1344 if(demuxer->file_format==DEMUXER_TYPE_MPEG_PS) d_video->pts+=frame_time; |
940 | 1345 |
1567 | 1346 mp_dbg(MSGT_AVSYNC,MSGL_DBG2,"*** ftime=%5.3f ***\n",frame_time); |
780 | 1347 |
798 | 1348 if(drop_frame){ |
746 | 1349 |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1350 if(sh_audio && !d_audio->eof){ |
955 | 1351 int delay=audio_out->get_delay(); |
1567 | 1352 mp_dbg(MSGT_AVSYNC,MSGL_DBG2,"delay=%d\n",delay); |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1353 time_frame=sh_video->timer; |
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1354 time_frame-=sh_audio->timer-(float)delay/(float)sh_audio->o_bps; |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
1355 if(time_frame>-2*frame_time) { |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
1356 drop_frame=0; // stop dropping frames |
1567 | 1357 mp_msg(MSGT_AVSYNC,MSGL_DBG2,"\nstop frame drop %.2f\n", time_frame); |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
1358 }else{ |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
1359 ++drop_frame_cnt; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
1360 if (verbose > 0 && drop_frame_cnt%10 == 0) |
1567 | 1361 mp_msg(MSGT_AVSYNC,MSGL_DBG2,"\nstill dropping, %.2f\n", time_frame); |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
1362 } |
798 | 1363 } |
1709 | 1364 #ifdef HAVE_NEW_GUI |
1365 if(use_gui){ | |
1802 | 1366 EventHandling(); |
1709 | 1367 } |
1368 #endif | |
1729 | 1369 video_out->check_events(); // check events AST |
798 | 1370 } else { |
780 | 1371 // It's time to sleep... |
1372 current_module="sleep"; | |
1373 | |
1374 time_frame-=GetRelativeTime(); // reset timer | |
1375 | |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1376 if(sh_audio && !d_audio->eof){ |
955 | 1377 int delay=audio_out->get_delay(); |
1567 | 1378 mp_dbg(MSGT_AVSYNC,MSGL_DBG2,"delay=%d\n",delay); |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1379 time_frame=sh_video->timer; |
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1380 time_frame-=sh_audio->timer-(float)delay/(float)sh_audio->o_bps; |
798 | 1381 // we are out of time... drop next frame! |
940 | 1382 if(time_frame<-2*frame_time){ |
1478
6f9167f0fcca
'too slow' message is fixed - better detection now based on both drop_cnt and A-V sync
arpi
parents:
1467
diff
changeset
|
1383 static int drop_message=0; |
798 | 1384 drop_frame=frame_dropping; // tricky! |
1385 ++drop_frame_cnt; | |
1478
6f9167f0fcca
'too slow' message is fixed - better detection now based on both drop_cnt and A-V sync
arpi
parents:
1467
diff
changeset
|
1386 if(drop_frame_cnt>50 && AV_delay>0.5 && !drop_message){ |
6f9167f0fcca
'too slow' message is fixed - better detection now based on both drop_cnt and A-V sync
arpi
parents:
1467
diff
changeset
|
1387 drop_message=1; |
1582 | 1388 mp_msg(MSGT_AVSYNC,MSGL_WARN,MSGTR_SystemTooSlow); |
1478
6f9167f0fcca
'too slow' message is fixed - better detection now based on both drop_cnt and A-V sync
arpi
parents:
1467
diff
changeset
|
1389 } |
1567 | 1390 mp_msg(MSGT_AVSYNC,MSGL_DBG2,"\nframe drop %d, %.2f\n", drop_frame, time_frame); |
798 | 1391 } |
780 | 1392 } else { |
1124
0e95f30ffd4c
-frames and -benchmark options to make chl & gabucino happy
arpi_esp
parents:
1059
diff
changeset
|
1393 if( (time_frame<-3*frame_time || time_frame>3*frame_time) || benchmark) |
0e95f30ffd4c
-frames and -benchmark options to make chl & gabucino happy
arpi_esp
parents:
1059
diff
changeset
|
1394 time_frame=0; |
0e95f30ffd4c
-frames and -benchmark options to make chl & gabucino happy
arpi_esp
parents:
1059
diff
changeset
|
1395 |
780 | 1396 } |
798 | 1397 |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1398 // if(verbose>1)printf("sleep: %5.3f a:%6.3f v:%6.3f \n",time_frame,sh_audio->timer,sh_video->timer); |
1439 | 1399 |
1400 aq_sleep_time+=time_frame; | |
1709 | 1401 |
1402 #ifdef HAVE_NEW_GUI | |
1403 if(use_gui){ | |
1802 | 1404 EventHandling(); |
1709 | 1405 } |
1406 #endif | |
746 | 1407 |
1408 while(time_frame>0.005){ | |
1409 if(time_frame<=0.020) | |
1439 | 1410 // usec_sleep(10000); // sleeps 1 clock tick (10ms)! |
1411 usec_sleep(0); // sleeps 1 clock tick (10ms)! | |
746 | 1412 else |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
1413 usec_sleep(1000000*(time_frame-0.002)); |
1709 | 1414 #ifdef HAVE_NEW_GUI |
1415 if(use_gui){ | |
1802 | 1416 EventHandling(); |
1709 | 1417 } |
1418 #endif | |
746 | 1419 time_frame-=GetRelativeTime(); |
1420 } | |
117 | 1421 |
715 | 1422 current_module="flip_page"; |
1422 | 1423 #ifdef USE_LIBVO2 |
1424 if(blit_frame) vo2_flip(video_out,0); | |
1425 #else | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1498
diff
changeset
|
1426 video_out->check_events(); |
1962 | 1427 if(blit_frame){ |
1428 unsigned int t2=GetTimer(); | |
1429 video_out->flip_page(); | |
1430 t2=GetTimer()-t2;vout_time_usage+=t2*0.000001f; | |
1431 } | |
1422 | 1432 #endif |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1026
diff
changeset
|
1433 // usec_sleep(50000); // test only! |
780 | 1434 |
715 | 1435 } |
780 | 1436 |
1437 current_module=NULL; | |
715 | 1438 |
1 | 1439 if(eof) break; |
220 | 1440 if(force_redraw){ |
1441 --force_redraw; | |
577 | 1442 if(!force_redraw) osd_function=OSD_PLAY; |
746 | 1443 continue; |
220 | 1444 } |
1 | 1445 |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1446 // printf("A:%6.1f V:%6.1f A-V:%7.3f frame=%5.2f \r",d_audio->pts,d_video->pts,d_audio->pts-d_video->pts,sh_audio->timer); |
1 | 1447 // fflush(stdout); |
1448 | |
1449 #if 1 | |
1450 /*================ A-V TIMESTAMP CORRECTION: =========================*/ | |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1451 if(sh_audio){ |
780 | 1452 float a_pts=0; |
1453 float v_pts=0; | |
1454 | |
746 | 1455 // unplayed bytes in our and soundcard/dma buffer: |
955 | 1456 int delay_bytes=audio_out->get_delay()+sh_audio->a_buffer_len; |
746 | 1457 float delay=(float)delay_bytes/(float)sh_audio->o_bps; |
1458 | |
780 | 1459 if(pts_from_bps){ |
1498 | 1460 #if 1 |
1461 unsigned int samples=(sh_audio->audio.dwSampleSize)? | |
1462 ((ds_tell(d_audio)-sh_audio->a_in_buffer_len)/sh_audio->audio.dwSampleSize) : | |
1463 (d_audio->pack_no); // <- used for VBR audio | |
1464 a_pts=samples*(float)sh_audio->audio.dwScale/(float)sh_audio->audio.dwRate; | |
1465 #else | |
1481 | 1466 if(sh_audio->audio.dwSampleSize) |
1467 a_pts=(ds_tell(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->wf->nAvgBytesPerSec; | |
1468 else // VBR: | |
1469 a_pts=d_audio->pack_no*(float)sh_audio->audio.dwScale/(float)sh_audio->audio.dwRate; | |
1498 | 1470 #endif |
1471 // v_pts=d_video->pack_no*(float)sh_video->video.dwScale/(float)sh_video->video.dwRate; | |
1472 // printf("V_PTS: PTS: %8.3f BPS: %8.3f \n",d_video->pts,v_pts); | |
1473 delay_corrected=1; | |
780 | 1474 } else { |
1475 // PTS = (last timestamp) + (bytes after last timestamp)/(bytes per sec) | |
746 | 1476 a_pts=d_audio->pts; |
1498 | 1477 if(!delay_corrected) if(a_pts) delay_corrected=1; |
1478
6f9167f0fcca
'too slow' message is fixed - better detection now based on both drop_cnt and A-V sync
arpi
parents:
1467
diff
changeset
|
1478 //printf("*** %5.3f ***\n",a_pts); |
746 | 1479 a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; |
1456
8c57a5a3c645
printfs cleanup - moved to higher -v level or moved to stderr
arpi
parents:
1449
diff
changeset
|
1480 // v_pts=d_video->pts-frame_time; |
1498 | 1481 // v_pts=d_video->pts; |
780 | 1482 } |
1498 | 1483 v_pts=d_video->pts; |
746 | 1484 |
1567 | 1485 mp_dbg(MSGT_AVSYNC,MSGL_DBG2,"### A:%8.3f (%8.3f) V:%8.3f A-V:%7.4f \n",a_pts,a_pts-audio_delay-delay,v_pts,(a_pts-delay-audio_delay)-v_pts); |
780 | 1486 |
398 | 1487 if(delay_corrected){ |
1478
6f9167f0fcca
'too slow' message is fixed - better detection now based on both drop_cnt and A-V sync
arpi
parents:
1467
diff
changeset
|
1488 float x; |
6f9167f0fcca
'too slow' message is fixed - better detection now based on both drop_cnt and A-V sync
arpi
parents:
1467
diff
changeset
|
1489 AV_delay=(a_pts-delay-audio_delay)-v_pts; |
6f9167f0fcca
'too slow' message is fixed - better detection now based on both drop_cnt and A-V sync
arpi
parents:
1467
diff
changeset
|
1490 x=AV_delay*0.1f; |
1 | 1491 if(x<-max_pts_correction) x=-max_pts_correction; else |
1492 if(x> max_pts_correction) x= max_pts_correction; | |
780 | 1493 if(default_max_pts_correction>=0) |
1494 max_pts_correction=default_max_pts_correction; | |
1495 else | |
1496 max_pts_correction=sh_video->frametime*0.10; // +-10% of time | |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1497 sh_audio->timer+=x; c_total+=x; |
1567 | 1498 if(!quiet) mp_msg(MSGT_AVSYNC,MSGL_STATUS,"A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d %d\r", |
1498 | 1499 a_pts-audio_delay-delay,v_pts,AV_delay,c_total, |
1546 | 1500 (int)sh_video->num_frames,(int)sh_video->num_frames_decoded, |
1498 | 1501 (sh_video->timer>0.5)?(int)(100.0*video_time_usage/(double)sh_video->timer):0, |
1502 (sh_video->timer>0.5)?(int)(100.0*vout_time_usage/(double)sh_video->timer):0, | |
1503 (sh_video->timer>0.5)?(100.0*audio_time_usage/(double)sh_video->timer):0 | |
1504 ,drop_frame_cnt | |
1505 ,output_quality | |
1 | 1506 ); |
1507 fflush(stdout); | |
1508 } | |
780 | 1509 |
1 | 1510 } else { |
1511 // No audio: | |
1420 | 1512 |
1448 | 1513 if(!quiet) |
1567 | 1514 mp_msg(MSGT_AVSYNC,MSGL_STATUS,"V:%6.1f %3d %2d%% %2d%% %3.1f%% \r",d_video->pts, |
1400 | 1515 (int)sh_video->num_frames, |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1516 (sh_video->timer>0.5)?(int)(100.0*video_time_usage/(double)sh_video->timer):0, |
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1517 (sh_video->timer>0.5)?(int)(100.0*vout_time_usage/(double)sh_video->timer):0, |
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1518 (sh_video->timer>0.5)?(100.0*audio_time_usage/(double)sh_video->timer):0 |
442 | 1519 ); |
1 | 1520 |
1521 fflush(stdout); | |
1420 | 1522 |
1 | 1523 } |
1524 #endif | |
1525 | |
1439 | 1526 /*Output quality adjustments:*/ |
1527 if(auto_quality>0){ | |
1528 #if 0 | |
1529 /*If we took a long time decoding this frame, downgrade the quality.*/ | |
1530 if(output_quality>0&& | |
1531 (video_time_usage-cvideo_base_vtime)*sh_video->timer>= | |
1532 (0.95*sh_video->timer-(vout_time_usage+audio_time_usage))* | |
1533 (sh_video->timer-cvideo_base_vframe-frame_correction)){ | |
1534 output_quality>>=1; | |
1567 | 1535 mp_msg(MSGT_AUTOQ,MSGL_DBG2,"Downgrading quality to %i.\n",output_quality); |
1439 | 1536 set_video_quality(sh_video,output_quality); |
1537 } else | |
1538 /*If we had plenty of extra time, upgrade the quality.*/ | |
1539 if(output_quality<auto_quality&& | |
1540 vdecode_time<0.5*frame_time&& | |
1541 (video_time_usage-cvideo_base_vtime)*sh_video->timer< | |
1542 (0.67*sh_video->timer-(vout_time_usage+audio_time_usage))* | |
1543 (sh_video->timer-cvideo_base_vframe-frame_correction)){ | |
1544 output_quality++; | |
1567 | 1545 mp_msg(MSGT_AUTOQ,MSGL_DBG2,"Upgrading quality to %i.\n",output_quality); |
1439 | 1546 set_video_quality(sh_video,output_quality); |
1547 } | |
1548 #else | |
1496 | 1549 // float total=0.000001f * (GetTimer()-aq_total_time); |
1439 | 1550 // if(output_quality<auto_quality && aq_sleep_time>0.05f*total) |
1551 if(output_quality<auto_quality && aq_sleep_time>0) | |
1552 ++output_quality; | |
1553 else | |
1554 // if(output_quality>0 && aq_sleep_time<-0.05f*total) | |
1555 if(output_quality>1 && aq_sleep_time<0) | |
1556 --output_quality; | |
1557 else | |
1558 if(output_quality>0 && aq_sleep_time<-0.050f) // 50ms | |
1559 output_quality=0; | |
1560 // printf("total: %8.6f sleep: %8.6f q: %d\n",(0.000001f*aq_total_time),aq_sleep_time,output_quality); | |
1561 set_video_quality(sh_video,output_quality); | |
1562 #endif | |
1563 } | |
1564 | |
1422 | 1565 #ifdef USE_OSD |
220 | 1566 if(osd_visible){ |
1504
f4f686aed404
modified mplayer.c to rewert to PLAY after rewinding after 1 sec
atlka
parents:
1501
diff
changeset
|
1567 if (!--osd_visible){ vo_osd_progbar_type=-1; // disable |
f4f686aed404
modified mplayer.c to rewert to PLAY after rewinding after 1 sec
atlka
parents:
1501
diff
changeset
|
1568 if (osd_function != OSD_PAUSE) |
f4f686aed404
modified mplayer.c to rewert to PLAY after rewinding after 1 sec
atlka
parents:
1501
diff
changeset
|
1569 osd_function = OSD_PLAY; |
f4f686aed404
modified mplayer.c to rewert to PLAY after rewinding after 1 sec
atlka
parents:
1501
diff
changeset
|
1570 } |
220 | 1571 } |
1422 | 1572 #endif |
371 | 1573 |
1574 if(osd_function==OSD_PAUSE){ | |
1817
35d88a433502
fixed interaction between commandlien and fileselector
arpi
parents:
1816
diff
changeset
|
1575 int gui_pause_flag=0; // gany! |
1567 | 1576 mp_msg(MSGT_CPLAYER,MSGL_STATUS,"\n------ PAUSED -------\r");fflush(stdout); |
1793
ba11d77c587a
gui status maintaining - now pause from console works, and gui display is in sync with osd
arpi
parents:
1792
diff
changeset
|
1577 #ifdef HAVE_NEW_GUI |
ba11d77c587a
gui status maintaining - now pause from console works, and gui display is in sync with osd
arpi
parents:
1792
diff
changeset
|
1578 if(use_gui) mplShMem->Playing=2; |
ba11d77c587a
gui status maintaining - now pause from console works, and gui display is in sync with osd
arpi
parents:
1792
diff
changeset
|
1579 #endif |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1580 if (audio_out && sh_audio) |
1156 | 1581 audio_out->pause(); // pause audio, keep data if possible |
723 | 1582 while( |
371 | 1583 #ifdef HAVE_LIRC |
723 | 1584 lirc_mp_getinput()<=0 && |
371 | 1585 #endif |
1467 | 1586 (use_stdin || getch2(20)<=0) && mplayer_get_key()<=0){ |
1422 | 1587 #ifndef USE_LIBVO2 |
723 | 1588 video_out->check_events(); |
1422 | 1589 #endif |
1709 | 1590 #ifdef HAVE_NEW_GUI |
1591 if(use_gui){ | |
1802 | 1592 EventHandling(); |
1817
35d88a433502
fixed interaction between commandlien and fileselector
arpi
parents:
1816
diff
changeset
|
1593 if(mplShMem->Playing!=2 || (rel_seek_secs || abs_seek_pos)) |
35d88a433502
fixed interaction between commandlien and fileselector
arpi
parents:
1816
diff
changeset
|
1594 { gui_pause_flag=1; break; } // end of pause or seek |
1709 | 1595 } |
1596 #endif | |
1467 | 1597 if(use_stdin) usec_sleep(1000); // do not eat the CPU |
723 | 1598 } |
1599 osd_function=OSD_PLAY; | |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1600 if (audio_out && sh_audio) |
1156 | 1601 audio_out->resume(); // resume audio |
1793
ba11d77c587a
gui status maintaining - now pause from console works, and gui display is in sync with osd
arpi
parents:
1792
diff
changeset
|
1602 #ifdef HAVE_NEW_GUI |
1817
35d88a433502
fixed interaction between commandlien and fileselector
arpi
parents:
1816
diff
changeset
|
1603 if(use_gui && !gui_pause_flag) mplShMem->Playing=1; // play from keyboard |
1793
ba11d77c587a
gui status maintaining - now pause from console works, and gui display is in sync with osd
arpi
parents:
1792
diff
changeset
|
1604 #endif |
371 | 1605 } |
1606 | |
746 | 1607 |
1608 if(!force_redraw) break; | |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1609 } // while(sh_video->timer<sh_audio->timer || force_redraw) |
1 | 1610 |
1611 | |
1612 //================= Keyboard events, SEEKing ==================== | |
1613 | |
723 | 1614 { int c; |
1 | 1615 while( |
1616 #ifdef HAVE_LIRC | |
1617 (c=lirc_mp_getinput())>0 || | |
1618 #endif | |
1467 | 1619 (!use_stdin && (c=getch2(0))>0) || (c=mplayer_get_key())>0) switch(c){ |
1 | 1620 // seek 10 sec |
1621 case KEY_RIGHT: | |
220 | 1622 osd_function=OSD_FFW; |
1 | 1623 rel_seek_secs+=10;break; |
1624 case KEY_LEFT: | |
220 | 1625 osd_function=OSD_REW; |
1 | 1626 rel_seek_secs-=10;break; |
1627 // seek 1 min | |
1628 case KEY_UP: | |
220 | 1629 osd_function=OSD_FFW; |
1 | 1630 rel_seek_secs+=60;break; |
1631 case KEY_DOWN: | |
220 | 1632 osd_function=OSD_REW; |
1 | 1633 rel_seek_secs-=60;break; |
651 | 1634 // seek 10 min |
1635 case KEY_PAGE_UP: | |
1636 rel_seek_secs+=600;break; | |
1637 case KEY_PAGE_DOWN: | |
1638 rel_seek_secs-=600;break; | |
1 | 1639 // delay correction: |
1640 case '+': | |
746 | 1641 audio_delay+=0.1; // increase audio buffer delay |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1642 if(sh_audio) sh_audio->timer-=0.1; |
1 | 1643 break; |
1644 case '-': | |
746 | 1645 audio_delay-=0.1; // decrease audio buffer delay |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1646 if(sh_audio) sh_audio->timer+=0.1; |
1 | 1647 break; |
1648 // quit | |
1649 case KEY_ESC: // ESC | |
1639 | 1650 case 'q': exit_player(MSGTR_Exit_quit); |
1 | 1651 case KEY_ENTER: // ESC |
1639 | 1652 eof=1; // jump to next file |
1653 break; | |
36 | 1654 case 'g': grab_frames=2;break; |
1 | 1655 // pause |
1656 case 'p': | |
1657 case ' ': | |
220 | 1658 osd_function=OSD_PAUSE; |
371 | 1659 break; |
1660 case 'o': // toggle OSD | |
1661 osd_level=(osd_level+1)%3; | |
1 | 1662 break; |
939 | 1663 case 'z': |
1664 sub_delay -= 0.1; | |
1665 break; | |
1666 case 'x': | |
1667 sub_delay += 0.1; | |
1668 break; | |
1626 | 1669 case '9': |
1670 case '0': | |
459 | 1671 case '*': |
555 | 1672 case '/': { |
1626 | 1673 if(c=='*' || c=='0'){ |
1881
d75b24bda7ce
Applied fix for mixercontrol w/alsa ossemu by Christian Ohm.
atmos4
parents:
1863
diff
changeset
|
1674 mixer_incvolume(); |
555 | 1675 } else { |
1881
d75b24bda7ce
Applied fix for mixercontrol w/alsa ossemu by Christian Ohm.
atmos4
parents:
1863
diff
changeset
|
1676 mixer_decvolume(); |
555 | 1677 } |
1678 | |
1422 | 1679 #ifdef USE_OSD |
555 | 1680 if(osd_level){ |
1681 osd_visible=sh_video->fps; // 1 sec | |
1682 vo_osd_progbar_type=OSD_VOLUME; | |
1881
d75b24bda7ce
Applied fix for mixercontrol w/alsa ossemu by Christian Ohm.
atmos4
parents:
1863
diff
changeset
|
1683 vo_osd_progbar_value=(mixer_getbothvolume()*256.0)/100.0; |
1852 | 1684 //printf("volume: %d\n",vo_osd_progbar_value); |
555 | 1685 } |
1422 | 1686 #endif |
555 | 1687 } |
1688 break; | |
459 | 1689 case 'm': |
510 | 1690 mixer_usemaster=!mixer_usemaster; |
459 | 1691 break; |
1429 | 1692 |
1627
eeaee1632340
absolute seek debugging with 1-8 keys (disabled by default)
arpi
parents:
1626
diff
changeset
|
1693 #if 0 // change to 1 for absolute seeking tests |
eeaee1632340
absolute seek debugging with 1-8 keys (disabled by default)
arpi
parents:
1626
diff
changeset
|
1694 case '1': |
eeaee1632340
absolute seek debugging with 1-8 keys (disabled by default)
arpi
parents:
1626
diff
changeset
|
1695 case '2': |
eeaee1632340
absolute seek debugging with 1-8 keys (disabled by default)
arpi
parents:
1626
diff
changeset
|
1696 case '3': |
eeaee1632340
absolute seek debugging with 1-8 keys (disabled by default)
arpi
parents:
1626
diff
changeset
|
1697 case '4': |
eeaee1632340
absolute seek debugging with 1-8 keys (disabled by default)
arpi
parents:
1626
diff
changeset
|
1698 case '5': |
eeaee1632340
absolute seek debugging with 1-8 keys (disabled by default)
arpi
parents:
1626
diff
changeset
|
1699 case '6': |
eeaee1632340
absolute seek debugging with 1-8 keys (disabled by default)
arpi
parents:
1626
diff
changeset
|
1700 case '7': |
eeaee1632340
absolute seek debugging with 1-8 keys (disabled by default)
arpi
parents:
1626
diff
changeset
|
1701 case '8': |
eeaee1632340
absolute seek debugging with 1-8 keys (disabled by default)
arpi
parents:
1626
diff
changeset
|
1702 rel_seek_secs=0.99*(float)(c-'1')/7.0; |
eeaee1632340
absolute seek debugging with 1-8 keys (disabled by default)
arpi
parents:
1626
diff
changeset
|
1703 abs_seek_pos=3; |
eeaee1632340
absolute seek debugging with 1-8 keys (disabled by default)
arpi
parents:
1626
diff
changeset
|
1704 printf("ABS seek to %5.3f \n",rel_seek_secs); |
eeaee1632340
absolute seek debugging with 1-8 keys (disabled by default)
arpi
parents:
1626
diff
changeset
|
1705 break; |
eeaee1632340
absolute seek debugging with 1-8 keys (disabled by default)
arpi
parents:
1626
diff
changeset
|
1706 #else |
1429 | 1707 // Contrast: |
1708 case '1': | |
1709 case '2': | |
1710 if(c=='2'){ | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1498
diff
changeset
|
1711 if ( ++v_cont > 100 ) v_cont = 100; |
1429 | 1712 } else { |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1498
diff
changeset
|
1713 if ( --v_cont < 0 ) v_cont = 0; |
1429 | 1714 } |
1715 if(set_video_colors(sh_video,"Contrast",v_cont)){ | |
1716 #ifdef USE_OSD | |
1717 if(osd_level){ | |
1718 osd_visible=sh_video->fps; // 1 sec | |
1719 vo_osd_progbar_type=OSD_CONTRAST; | |
1726 | 1720 vo_osd_progbar_value=((v_cont)<<8)/100; |
1429 | 1721 } |
1722 #endif | |
1723 } | |
1724 break; | |
1725 | |
1726 // Brightness: | |
1727 case '3': | |
1728 case '4': | |
1729 if(c=='4'){ | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1498
diff
changeset
|
1730 if ( ++v_bright > 100 ) v_bright = 100; |
1429 | 1731 } else { |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1498
diff
changeset
|
1732 if ( --v_bright < 0 ) v_bright = 0; |
1429 | 1733 } |
1734 if(set_video_colors(sh_video,"Brightness",v_bright)){ | |
1735 #ifdef USE_OSD | |
1736 if(osd_level){ | |
1737 osd_visible=sh_video->fps; // 1 sec | |
1738 vo_osd_progbar_type=OSD_BRIGHTNESS; | |
1726 | 1739 vo_osd_progbar_value=((v_bright)<<8)/100; |
1429 | 1740 } |
1741 #endif | |
1742 } | |
1743 break; | |
1744 | |
1745 // Hue: | |
1746 case '5': | |
1747 case '6': | |
1748 if(c=='6'){ | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1498
diff
changeset
|
1749 if ( ++v_hue > 100 ) v_hue = 100; |
1429 | 1750 } else { |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1498
diff
changeset
|
1751 if ( --v_hue < 0 ) v_hue = 0; |
1429 | 1752 } |
1753 if(set_video_colors(sh_video,"Hue",v_hue)){ | |
1754 #ifdef USE_OSD | |
1755 if(osd_level){ | |
1756 osd_visible=sh_video->fps; // 1 sec | |
1757 vo_osd_progbar_type=OSD_HUE; | |
1726 | 1758 vo_osd_progbar_value=((v_hue)<<8)/100; |
1429 | 1759 } |
1760 #endif | |
1761 } | |
1762 break; | |
1763 | |
1764 // Saturation: | |
1765 case '7': | |
1766 case '8': | |
1767 if(c=='8'){ | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1498
diff
changeset
|
1768 if ( ++v_saturation > 100 ) v_saturation = 100; |
1429 | 1769 } else { |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1498
diff
changeset
|
1770 if ( --v_saturation < 0 ) v_saturation = 0; |
1429 | 1771 } |
1772 if(set_video_colors(sh_video,"Saturation",v_saturation)){ | |
1773 #ifdef USE_OSD | |
1774 if(osd_level){ | |
1775 osd_visible=sh_video->fps; // 1 sec | |
1776 vo_osd_progbar_type=OSD_SATURATION; | |
1726 | 1777 vo_osd_progbar_value=((v_saturation)<<8)/100; |
1429 | 1778 } |
1779 #endif | |
1780 } | |
1781 break; | |
1627
eeaee1632340
absolute seek debugging with 1-8 keys (disabled by default)
arpi
parents:
1626
diff
changeset
|
1782 #endif |
1429 | 1783 |
715 | 1784 case 'd': |
798 | 1785 frame_dropping=(frame_dropping+1)%3; |
1567 | 1786 mp_msg(MSGT_CPLAYER,MSGL_V,"== drop: %d == \n",frame_dropping); |
715 | 1787 break; |
1 | 1788 } |
1406 | 1789 } // keyboard event handler |
1790 | |
651 | 1791 if (seek_to_sec) { |
937 | 1792 int a,b; float d; |
1793 | |
1794 if (sscanf(seek_to_sec, "%d:%d:%f", &a,&b,&d)==3) | |
1795 rel_seek_secs += 3600*a +60*b +d ; | |
1796 else if (sscanf(seek_to_sec, "%d:%f", &a, &d)==2) | |
1797 rel_seek_secs += 60*a +d; | |
1798 else if (sscanf(seek_to_sec, "%f", &d)==1) | |
1799 rel_seek_secs += d; | |
1800 | |
1801 seek_to_sec = NULL; | |
651 | 1802 } |
937 | 1803 |
1627
eeaee1632340
absolute seek debugging with 1-8 keys (disabled by default)
arpi
parents:
1626
diff
changeset
|
1804 if(rel_seek_secs || abs_seek_pos){ |
1466 | 1805 current_module="seek"; |
1627
eeaee1632340
absolute seek debugging with 1-8 keys (disabled by default)
arpi
parents:
1626
diff
changeset
|
1806 if(demux_seek(demuxer,rel_seek_secs,abs_seek_pos)){ |
1405 | 1807 // success: |
889 | 1808 |
1369
7a2f1881b776
a_frame, v_frame killed, using sh_audio/video->timer. has_audio not more used after initialization.
arpi
parents:
1353
diff
changeset
|
1809 if(sh_audio){ |
1459
622c504f36ef
printf stuff moved seek.c->mplayer.c, resetting drop_frame_cnt after seek
arpi
parents:
1457
diff
changeset
|
1810 if(verbose){ |
622c504f36ef
printf stuff moved seek.c->mplayer.c, resetting drop_frame_cnt after seek
arpi
parents:
1457
diff
changeset
|
1811 float a_pts=d_audio->pts; |
622c504f36ef
printf stuff moved seek.c->mplayer.c, resetting drop_frame_cnt after seek
arpi
parents:
1457
diff
changeset
|
1812 a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; |
1567 | 1813 mp_msg(MSGT_AVSYNC,MSGL_V,"SEEK: A: %5.3f V: %5.3f A-V: %5.3f \n",a_pts,d_video->pts,a_pts-d_video->pts); |
1459
622c504f36ef
printf stuff moved seek.c->mplayer.c, resetting drop_frame_cnt after seek
arpi
parents:
1457
diff
changeset
|
1814 } |
1567 | 1815 mp_msg(MSGT_AVSYNC,MSGL_STATUS,"A:%6.1f V:%6.1f A-V:%7.3f ct: ? \r",d_audio->pts,d_video->pts,0.0f); |
1459
622c504f36ef
printf stuff moved seek.c->mplayer.c, resetting drop_frame_cnt after seek
arpi
parents:
1457
diff
changeset
|
1816 } else { |
1567 | 1817 mp_msg(MSGT_AVSYNC,MSGL_STATUS,"A: --- V:%6.1f \r",d_video->pts); |
1459
622c504f36ef
printf stuff moved seek.c->mplayer.c, resetting drop_frame_cnt after seek
arpi
parents:
1457
diff
changeset
|
1818 } |
622c504f36ef
printf stuff moved seek.c->mplayer.c, resetting drop_frame_cnt after seek
arpi
parents:
1457
diff
changeset
|
1819 fflush(stdout); |
622c504f36ef
printf stuff moved seek.c->mplayer.c, resetting drop_frame_cnt after seek
arpi
parents:
1457
diff
changeset
|
1820 |
622c504f36ef
printf stuff moved seek.c->mplayer.c, resetting drop_frame_cnt after seek
arpi
parents:
1457
diff
changeset
|
1821 if(sh_audio){ |
1466 | 1822 current_module="seek_audio_reset"; |
1334 | 1823 audio_out->reset(); // stop audio, throwing away buffered data |
1 | 1824 } |
1825 | |
1422 | 1826 #ifdef USE_OSD |
1334 | 1827 // Set OSD: |
1828 if(osd_level){ | |
1829 int len=((demuxer->movi_end-demuxer->movi_start)>>8); | |
1727 | 1830 if (len>0){ |
1831 osd_visible=sh_video->fps; // 1 sec | |
1832 vo_osd_progbar_type=0; | |
1833 vo_osd_progbar_value=(demuxer->filepos-demuxer->movi_start)/len; | |
1834 } | |
1334 | 1835 } |
1422 | 1836 #endif |
1405 | 1837 |
1420 | 1838 c_total=0; |
1 | 1839 max_pts_correction=0.1; |
1504
f4f686aed404
modified mplayer.c to rewert to PLAY after rewinding after 1 sec
atlka
parents:
1501
diff
changeset
|
1840 osd_visible=sh_video->fps; // to rewert to PLAY pointer after 1 sec |
1 | 1841 audio_time_usage=0; video_time_usage=0; vout_time_usage=0; |
1459
622c504f36ef
printf stuff moved seek.c->mplayer.c, resetting drop_frame_cnt after seek
arpi
parents:
1457
diff
changeset
|
1842 drop_frame_cnt=0; |
1405 | 1843 |
1 | 1844 } |
1405 | 1845 rel_seek_secs=0; |
1627
eeaee1632340
absolute seek debugging with 1-8 keys (disabled by default)
arpi
parents:
1626
diff
changeset
|
1846 abs_seek_pos=0; |
1466 | 1847 current_module=NULL; |
1848 } | |
1849 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
1850 #ifdef HAVE_NEW_GUI |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
1851 if(use_gui){ |
1735 | 1852 if(demuxer->file_format==DEMUXER_TYPE_AVI && sh_video->video.dwLength>2){ |
1853 // get pos from frame number / total frames | |
1854 mplShMem->Position=(float)d_video->pack_no*100.0f/sh_video->video.dwLength; | |
1855 } else { | |
1856 // get pos from file position / filesize | |
1857 int len=((demuxer->movi_end-demuxer->movi_start)); | |
1858 int pos=(demuxer->file_format==DEMUXER_TYPE_AVI)?demuxer->filepos:d_video->pos; | |
1859 mplShMem->Position=(len<=0)?0:((float)(pos-demuxer->movi_start) / len * 100.0f); | |
1860 } | |
1729 | 1861 mplShMem->TimeSec=d_video->pts; |
1772 | 1862 if(mplShMem->Playing==0) break; // STOP |
1863 if(mplShMem->Playing==2) osd_function=OSD_PAUSE; | |
1852 | 1864 if ( mplShMem->VolumeChanged ) |
1848 | 1865 { |
1852 | 1866 mixer_setvolume( mplShMem->Volume,mplShMem->Volume ); |
1867 mplShMem->VolumeChanged=0; | |
1868 #ifdef USE_OSD | |
1869 if ( osd_level ) | |
1870 { | |
1871 osd_visible=sh_video->fps; // 1 sec | |
1872 vo_osd_progbar_type=OSD_VOLUME; | |
1873 vo_osd_progbar_value=( ( mplShMem->Volume ) * 256.0 ) / 100.0; | |
1874 } | |
1848 | 1875 #endif |
1852 | 1876 } |
1877 mplShMem->Volume=(float)mixer_getbothvolume(); | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
1878 } |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
1879 #endif |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
1880 |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
1881 |
220 | 1882 //================= Update OSD ==================== |
1422 | 1883 #ifdef USE_OSD |
1421 | 1884 if(osd_level>=2){ |
780 | 1885 int pts=d_video->pts; |
595 | 1886 if(pts==osd_last_pts-1) ++pts; else osd_last_pts=pts; |
371 | 1887 vo_osd_text=osd_text_buffer; |
595 | 1888 sprintf(vo_osd_text,"%c %02d:%02d:%02d",osd_function,pts/3600,(pts/60)%60,pts%60); |
371 | 1889 } else { |
1890 vo_osd_text=NULL; | |
1891 } | |
220 | 1892 // for(i=1;i<=11;i++) osd_text_buffer[10+i]=i;osd_text_buffer[10+i]=0; |
371 | 1893 // vo_osd_text=osd_text_buffer; |
1422 | 1894 #endif |
458
49b0474b2e26
I really hope that you will learn how to use cvs, sooner or later...
arpi_esp
parents:
452
diff
changeset
|
1895 |
1422 | 1896 #ifdef USE_SUB |
258 | 1897 // find sub |
1204 | 1898 if(subtitles && d_video->pts>0){ |
1762 | 1899 float pts=d_video->pts; |
398 | 1900 if(sub_fps==0) sub_fps=sh_video->fps; |
482 | 1901 current_module="find_sub"; |
780 | 1902 find_sub(subtitles,sub_uses_time?(100*(pts+sub_delay)):((pts+sub_delay)*sub_fps)); // FIXME! frame counter... |
482 | 1903 current_module=NULL; |
258 | 1904 } |
1422 | 1905 #endif |
554 | 1906 |
1907 // DVD sub: | |
557 | 1908 { unsigned char* packet=NULL; |
1909 int len=ds_get_packet_sub(d_dvdsub,&packet); | |
1910 if(len>=2){ | |
1911 int len2; | |
1912 len2=(packet[0]<<8)+packet[1]; | |
1567 | 1913 mp_msg(MSGT_CPLAYER,MSGL_V,"\rDVD sub: %d / %d \n",len,len2); |
561 | 1914 if(len==len2) |
1915 spudec_decode(packet,len); | |
1916 else | |
1567 | 1917 mp_msg(MSGT_CPLAYER,MSGL_V,"fragmented dvd-subs not yet supported!!!\n"); |
557 | 1918 } else if(len>=0) { |
1567 | 1919 mp_msg(MSGT_CPLAYER,MSGL_V,"invalid dvd sub\n"); |
554 | 1920 } |
1921 } | |
1922 | |
1421 | 1923 } // while(!eof) |
1 | 1924 |
1567 | 1925 mp_msg(MSGT_GLOBAL,MSGL_V,"EOF code: %d \n",eof); |
1 | 1926 |
1639 | 1927 } |
1928 | |
1641
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
1929 |
1790 | 1930 if(curr_filename+1<num_filenames || use_gui){ |
1639 | 1931 // partial uninit: |
1932 | |
1857 | 1933 uninit_player(INITED_ALL-(INITED_GUI+INITED_LIRC)); |
1641
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
1934 |
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
1935 } |
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
1936 |
1808 | 1937 goto_next_file: // don't jump here after ao/vo/getch initialization! |
1938 | |
1797 | 1939 #ifdef HAVE_NEW_GUI |
1940 if(use_gui) | |
1941 { | |
1942 mplStop(); | |
1943 } | |
1944 #endif | |
1945 | |
1790 | 1946 if(use_gui || ++curr_filename<num_filenames){ |
1641
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
1947 |
1654 | 1948 current_module="uninit_vcodec"; |
1949 if(sh_video) uninit_video(sh_video); | |
1950 | |
1641
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
1951 current_module="free_demuxer"; |
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
1952 if(demuxer) free_demuxer(demuxer); |
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
1953 |
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
1954 current_module="free_stream"; |
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
1955 if(stream) free_stream(stream); |
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
1956 |
1639 | 1957 video_out=NULL; |
1958 audio_out=NULL; | |
1959 | |
1641
b7dae998505c
free stream/demuxer. continue playback with next file if error found
arpi
parents:
1639
diff
changeset
|
1960 goto play_next_file; |
1639 | 1961 } |
1962 | |
1582 | 1963 exit_player(MSGTR_Exit_eof); |
1639 | 1964 |
109 | 1965 return 1; |
1966 } |