comparison mplayer.c @ 1015:9744b50fe87f

some cleanup, old unused stuff removed
author arpi_esp
date Tue, 05 Jun 2001 01:14:38 +0000
parents e01dc1a88edf
children e5fc7ec51fa3
comparison
equal deleted inserted replaced
1014:e01dc1a88edf 1015:9744b50fe87f
57 #endif 57 #endif
58 58
59 #include "opendivx/decore.h" 59 #include "opendivx/decore.h"
60 60
61 61
62 #ifdef USE_XMMP_AUDIO 62 //extern int vo_screenwidth;
63 #include "libxmm/xmmp.h"
64 #include "libxmm/libxmm.h"
65 XMM xmm;
66 XMM_PluginSound *pSound=NULL;
67 #endif
68
69 extern int vo_screenwidth;
70 63
71 extern char* win32_codec_name; // must be set before calling DrvOpen() !!! 64 extern char* win32_codec_name; // must be set before calling DrvOpen() !!!
72 65
73 extern int errno; 66 extern int errno;
74 67
97 90
98 #define ABS(x) (((x)>=0)?(x):(-(x))) 91 #define ABS(x) (((x)>=0)?(x):(-(x)))
99 92
100 static subtitle* subtitles=NULL; 93 static subtitle* subtitles=NULL;
101 void find_sub(subtitle* subtitles,int key); 94 void find_sub(subtitle* subtitles,int key);
102
103 int osd_level=2;
104 95
105 //**************************************************************************// 96 //**************************************************************************//
106 // Config file 97 // Config file
107 //**************************************************************************// 98 //**************************************************************************//
108 99
137 return buff; 128 return buff;
138 } 129 }
139 130
140 static int max_framesize=0; 131 static int max_framesize=0;
141 132
142 //static int dbg_es_sent=0;
143 //static int dbg_es_rcvd=0;
144
145 //static int show_packets=0; 133 //static int show_packets=0;
146 134
147 //**************************************************************************// 135 //**************************************************************************//
148 //**************************************************************************// 136 //**************************************************************************//
149 // Input media streaming & demultiplexer: 137 // Input media streaming & demultiplexer:
151 139
152 #include "stream.h" 140 #include "stream.h"
153 #include "demuxer.h" 141 #include "demuxer.h"
154 142
155 #include "stheader.h" 143 #include "stheader.h"
156
157 #if 0
158
159 typedef struct {
160 // file:
161 // MainAVIHeader avih;
162 // unsigned int movi_start;
163 // unsigned int movi_end;
164 // index:
165 AVIINDEXENTRY* idx;
166 int idx_size;
167 int idx_pos;
168 int idx_pos_a;
169 int idx_pos_v;
170 int idx_offset; // ennyit kell hozzaadni az index offset ertekekhez
171 // video:
172 unsigned int bitrate;
173 } avi_header_t;
174
175 avi_header_t avi_header;
176
177 #endif
178 144
179 int avi_bitrate=0; 145 int avi_bitrate=0;
180 146
181 demuxer_t *demuxer=NULL; 147 demuxer_t *demuxer=NULL;
182 148
202 memset(demuxer->v_streams[id],0,sizeof(sh_video_t)); 168 memset(demuxer->v_streams[id],0,sizeof(sh_video_t));
203 } 169 }
204 return demuxer->v_streams[id]; 170 return demuxer->v_streams[id];
205 } 171 }
206 172
207
208 //#include "demux_avi.c"
209 //#include "demux_mpg.c"
210
211 demux_stream_t *d_audio=NULL; 173 demux_stream_t *d_audio=NULL;
212 demux_stream_t *d_video=NULL; 174 demux_stream_t *d_video=NULL;
213 demux_stream_t *d_dvdsub=NULL; 175 demux_stream_t *d_dvdsub=NULL;
214 176
215 sh_audio_t *sh_audio=NULL;//&sh_audio_i; 177 sh_audio_t *sh_audio=NULL;
216 sh_video_t *sh_video=NULL;//&sh_video_i; 178 sh_video_t *sh_video=NULL;
217 179
218 char* encode_name=NULL; 180 char* encode_name=NULL;
219 char* encode_index_name=NULL; 181 char* encode_index_name=NULL;
220 int encode_bitrate=0; 182 int encode_bitrate=0;
221 183
222 extern int asf_packetsize; 184 extern int asf_packetsize; // for seeking
223 185
224 extern float avi_audio_pts; 186 extern float avi_audio_pts;
225 extern float avi_video_pts; 187 extern float avi_video_pts;
226 extern float avi_video_ftime; 188 extern float avi_video_ftime;
227 extern int skip_video_frames; 189 extern int skip_video_frames;
233 int read_asf_header(demuxer_t *demuxer); 195 int read_asf_header(demuxer_t *demuxer);
234 196
235 // MPEG video stream parser: 197 // MPEG video stream parser:
236 #include "parse_es.c" 198 #include "parse_es.c"
237 199
238 extern int num_elementary_packets100; 200 extern int num_elementary_packets100; // for MPEG-ES fileformat detection
239 extern int num_elementary_packets101; 201 extern int num_elementary_packets101;
240 202
241 extern picture_t *picture; 203 extern picture_t *picture; // exported from libmpeg2/decode.c
242 204
243 static const int frameratecode2framerate[16] = { 205 static const int frameratecode2framerate[16] = {
244 0, 206 0,
245 // Official mpeg1/2 framerates: 207 // Official mpeg1/2 framerates:
246 24000*10000/1001, 24*10000,25*10000, 30000*10000/1001, 30*10000,50*10000,60000*10000/1001, 60*10000, 208 24000*10000/1001, 24*10000,25*10000, 30000*10000/1001, 30*10000,50*10000,60000*10000/1001, 60*10000,
286 } 248 }
287 #endif 249 #endif
288 250
289 //**************************************************************************// 251 //**************************************************************************//
290 //**************************************************************************// 252 //**************************************************************************//
291
292 // AVI file header reader/parser/writer:
293 //#include "aviheader.c"
294 //#include "aviwrite.c"
295
296 // ASF headers:
297 //#include "asfheader.c"
298 //#include "demux_asf.c"
299
300 // DLL codecs init routines
301 //#include "dll_init.c"
302 253
303 // Common FIFO functions, and keyboard/event FIFO code 254 // Common FIFO functions, and keyboard/event FIFO code
304 #include "fifo.c" 255 #include "fifo.c"
305 256
306 //**************************************************************************// 257 //**************************************************************************//
340 #ifdef HAVE_GUI 291 #ifdef HAVE_GUI
341 if ( nogui ) 292 if ( nogui )
342 #endif 293 #endif
343 getch2_disable(); 294 getch2_disable();
344 video_out->uninit(); 295 video_out->uninit();
345 #ifdef USE_XMMP_AUDIO
346 if(verbose) printf("XMM: closing audio driver...\n");
347 if(pSound){
348 pSound->Exit( pSound );
349 xmm_Exit( &xmm );
350 }
351 #endif
352 if(encode_name) avi_fixate(); 296 if(encode_name) avi_fixate();
353 #ifdef HAVE_LIRC 297 #ifdef HAVE_LIRC
354 #ifdef HAVE_GUI 298 #ifdef HAVE_GUI
355 if ( nogui ) 299 if ( nogui )
356 #endif 300 #endif
390 extern void write_avi_header_1(FILE *f,int fcc,float fps,int width,int height); 334 extern void write_avi_header_1(FILE *f,int fcc,float fps,int width,int height);
391 extern int vo_init(void); 335 extern int vo_init(void);
392 extern int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen); 336 extern int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen);
393 337
394 // options: 338 // options:
339 int osd_level=2;
395 int divx_quality=0; 340 int divx_quality=0;
396 char *seek_to_sec=NULL; 341 char *seek_to_sec=NULL;
397 int seek_to_byte=0; 342 int seek_to_byte=0;
398 int has_audio=1; 343 int has_audio=1;
399 //int has_video=1; 344 //int has_video=1;
1922 (int)num_frames, 1867 (int)num_frames,
1923 (v_frame>0.5)?(int)(100.0*video_time_usage/(double)v_frame):0, 1868 (v_frame>0.5)?(int)(100.0*video_time_usage/(double)v_frame):0,
1924 (v_frame>0.5)?(int)(100.0*vout_time_usage/(double)v_frame):0, 1869 (v_frame>0.5)?(int)(100.0*vout_time_usage/(double)v_frame):0,
1925 (v_frame>0.5)?(100.0*audio_time_usage/(double)v_frame):0 1870 (v_frame>0.5)?(100.0*audio_time_usage/(double)v_frame):0
1926 ,drop_frame_cnt 1871 ,drop_frame_cnt
1927 // dbg_es_sent-dbg_es_rcvd
1928 ); 1872 );
1929 fflush(stdout); 1873 fflush(stdout);
1930 } 1874 }
1931 frame_corr_num=0; frame_correction=0; 1875 frame_corr_num=0; frame_correction=0;
1932 } 1876 }
1942 printf("V:%6.1f %3d %2d%% %2d%% %3.1f%% \r",v_pts, 1886 printf("V:%6.1f %3d %2d%% %2d%% %3.1f%% \r",v_pts,
1943 (int)num_frames, 1887 (int)num_frames,
1944 (v_frame>0.5)?(int)(100.0*video_time_usage/(double)v_frame):0, 1888 (v_frame>0.5)?(int)(100.0*video_time_usage/(double)v_frame):0,
1945 (v_frame>0.5)?(int)(100.0*vout_time_usage/(double)v_frame):0, 1889 (v_frame>0.5)?(int)(100.0*vout_time_usage/(double)v_frame):0,
1946 (v_frame>0.5)?(100.0*audio_time_usage/(double)v_frame):0 1890 (v_frame>0.5)?(100.0*audio_time_usage/(double)v_frame):0
1947 // dbg_es_sent-dbg_es_rcvd
1948 ); 1891 );
1949 1892
1950 fflush(stdout); 1893 fflush(stdout);
1951 frame_corr_num=0; 1894 frame_corr_num=0;
1952 } 1895 }