Mercurial > mplayer.hg
annotate mencoder.c @ 5553:38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
author | arpi |
---|---|
date | Thu, 11 Apr 2002 02:52:03 +0000 |
parents | 8ec12d5ba6c6 |
children | cfab2ce8a840 |
rev | line source |
---|---|
3384 | 1 #define VCODEC_COPY 0 |
3361
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
2 #define VCODEC_FRAMENO 1 |
5553
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
3 // real codecs: |
3361
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
4 #define VCODEC_DIVX4 2 |
3504
21fc87d76300
support for RGB/BGR modes (tested with raw and divx4)
alex
parents:
3480
diff
changeset
|
5 #define VCODEC_LIBAVCODEC 4 |
4427
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
6 #define VCODEC_RAWRGB 6 |
4575 | 7 #define VCODEC_VFW 7 |
3361
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
8 |
3385 | 9 #define ACODEC_COPY 0 |
2583 | 10 #define ACODEC_PCM 1 |
11 #define ACODEC_VBRMP3 2 | |
4368 | 12 #define ACODEC_NULL 3 |
2531 | 13 |
14 #include <stdio.h> | |
15 #include <stdlib.h> | |
16 #include <string.h> | |
17 #include <signal.h> | |
18 | |
2591 | 19 #include "config.h" |
2531 | 20 #include "mp_msg.h" |
2978 | 21 #include "version.h" |
2531 | 22 #include "help_mp.h" |
23 | |
2978 | 24 static char* banner_text= |
25 "\n\n" | |
4757 | 26 "MEncoder " VERSION "(C) 2000-2002 Arpad Gereoffy (see DOCS!)\n" |
2978 | 27 "\n"; |
28 | |
3323 | 29 #include "cpudetect.h" |
30 | |
2531 | 31 #include "codec-cfg.h" |
4343
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4207
diff
changeset
|
32 #include "cfgparser.h" |
2531 | 33 |
34 #include "stream.h" | |
35 #include "demuxer.h" | |
36 #include "stheader.h" | |
4156
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
37 #include "playtree.h" |
2531 | 38 |
39 #include "aviwrite.h" | |
40 | |
41 #include "libvo/video_out.h" | |
42 | |
2574 | 43 #include "dec_audio.h" |
44 #include "dec_video.h" | |
45 | |
3357 | 46 #ifdef HAVE_MP3LAME |
2591 | 47 #include <lame/lame.h> |
3357 | 48 #endif |
2583 | 49 |
3521 | 50 #ifdef HAVE_LIBCSS |
51 #include "libmpdemux/dvdauth.h" | |
52 #endif | |
53 | |
3236 | 54 #include <inttypes.h> |
55 | |
3385 | 56 #include "fastmemcpy.h" |
57 | |
4388 | 58 /************************************************************************** |
59 Video accelerated architecture | |
60 **************************************************************************/ | |
5553
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
61 vo_vaa_t vo_vaa; // FIXME! remove me! |
5511 | 62 int vo_doublebuffering=0; |
63 int vo_directrendering=0; | |
64 int vo_config_count=0; | |
4388 | 65 |
2583 | 66 //-------------------------- |
67 | |
2531 | 68 // cache2: |
2618 | 69 static int stream_cache_size=0; |
2531 | 70 #ifdef USE_STREAM_CACHE |
71 extern int cache_fill_status; | |
72 #else | |
73 #define cache_fill_status 0 | |
74 #endif | |
75 | |
2618 | 76 int vcd_track=0; |
77 int audio_id=-1; | |
78 int video_id=-1; | |
79 int dvdsub_id=-1; | |
5388
3af2729c5c87
* New command line switch for mplayer & mencoder:
kmkaplan
parents:
5386
diff
changeset
|
80 int vobsub_id=-1; |
5436 | 81 char* audio_lang=NULL; |
82 char* dvdsub_lang=NULL; | |
5388
3af2729c5c87
* New command line switch for mplayer & mencoder:
kmkaplan
parents:
5386
diff
changeset
|
83 static char* spudec_ifo=NULL; |
2618 | 84 |
4355 | 85 static int has_audio=1; |
2531 | 86 char *audio_codec=NULL; // override audio codec |
87 char *video_codec=NULL; // override video codec | |
88 int audio_family=-1; // override audio codec family | |
89 int video_family=-1; // override video codec family | |
90 | |
3357 | 91 #ifdef HAVE_MP3LAME |
2661 | 92 int out_audio_codec=ACODEC_VBRMP3; |
3357 | 93 #else |
94 int out_audio_codec=ACODEC_PCM; | |
95 #endif | |
96 | |
4620 | 97 int out_video_codec= |
98 #ifdef HAVE_DIVX4ENCORE | |
99 VCODEC_DIVX4; | |
100 #else | |
101 #ifdef USE_LIBAVCODEC | |
102 VCODEC_LIBAVCODEC; | |
103 #else | |
104 VCODEC_RAW; | |
105 #endif | |
106 #endif | |
107 | |
2661 | 108 |
2531 | 109 // audio stream skip/resync functions requires only for seeking. |
110 // (they should be implemented in the audio codec layer) | |
111 //void skip_audio_frame(sh_audio_t *sh_audio){} | |
112 //void resync_audio_stream(sh_audio_t *sh_audio){} | |
113 | |
2618 | 114 int verbose=0; // must be global! |
2531 | 115 double video_time_usage=0; |
116 double vout_time_usage=0; | |
4834 | 117 double max_video_time_usage=0; |
118 double max_vout_time_usage=0; | |
4838 | 119 double cur_video_time_usage=0; |
120 double cur_vout_time_usage=0; | |
2531 | 121 static double audio_time_usage=0; |
122 static int total_time_usage_start=0; | |
4844
76acf5bbda78
exclude benchmark stuff execution from normal playback
nick
parents:
4838
diff
changeset
|
123 int benchmark=0; |
2531 | 124 |
2605 | 125 // A-V sync: |
126 int delay_corrected=1; | |
127 static float default_max_pts_correction=-1;//0.01f; | |
128 static float max_pts_correction=0;//default_max_pts_correction; | |
129 static float c_total=0; | |
130 | |
2613 | 131 float force_fps=0; |
132 float force_ofps=0; // set to 24 for inverse telecine | |
2531 | 133 |
2618 | 134 int force_srate=0; |
135 | |
2626 | 136 char* out_filename="test.avi"; |
137 char* mp3_filename=NULL; | |
138 char* ac3_filename=NULL; | |
139 | |
3657
af1f8e2d693a
added libavcodec support (mjpeg,h263,rv10,mpeg1 codecs tested&working) and added -ffourcc option (force fourcc in ouput)
alex
parents:
3563
diff
changeset
|
140 char *force_fourcc=NULL; |
af1f8e2d693a
added libavcodec support (mjpeg,h263,rv10,mpeg1 codecs tested&working) and added -ffourcc option (force fourcc in ouput)
alex
parents:
3563
diff
changeset
|
141 |
5553
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
142 int pass=0; |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
143 char* passtmpfile="divx2pass.log"; |
3377
4723f6fd750a
do not fault if 2pass VbrControl can't open the logfile
alex
parents:
3363
diff
changeset
|
144 int pass_working=0; |
2643 | 145 |
146 static int play_n_frames=-1; | |
147 | |
2661 | 148 //char *out_audio_codec=NULL; // override audio codec |
149 //char *out_video_codec=NULL; // override video codec | |
2626 | 150 |
2591 | 151 //#include "libmpeg2/mpeg2.h" |
152 //#include "libmpeg2/mpeg2_internal.h" | |
153 | |
3357 | 154 #ifdef HAVE_MP3LAME |
2626 | 155 int lame_param_quality=0; // best |
156 int lame_param_vbr=vbr_default; | |
157 int lame_param_mode=-1; // unset | |
158 int lame_param_padding=-1; // unset | |
159 int lame_param_br=-1; // unset | |
160 int lame_param_ratio=-1; // unset | |
3357 | 161 #endif |
2626 | 162 |
3236 | 163 static int vo_w=0, vo_h=0; |
5270 | 164 static int input_pitch, input_bpp; |
165 | |
2618 | 166 //-------------------------- config stuff: |
167 | |
4156
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
168 m_config_t* mconfig; |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
169 |
2618 | 170 static int cfg_inc_verbose(struct config *conf){ ++verbose; return 0;} |
171 | |
172 static int cfg_include(struct config *conf, char *filename){ | |
4156
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
173 return m_config_parse_config_file(mconfig, filename); |
2618 | 174 } |
175 | |
4620 | 176 static char *seek_to_sec=NULL; |
177 static off_t seek_to_byte=0; | |
178 | |
4159
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
179 static int parse_end_at(struct config *conf, const char* param); |
4427
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
180 static uint8_t* flip_upside_down(uint8_t* dst, const uint8_t* src, int width, int height); |
4159
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
181 |
2618 | 182 #include "get_path.c" |
183 | |
184 #include "cfg-mplayer-def.h" | |
185 #include "cfg-mencoder.h" | |
186 | |
4088 | 187 #ifdef USE_DVDREAD |
188 #include "spudec.h" | |
189 #endif | |
5388
3af2729c5c87
* New command line switch for mplayer & mencoder:
kmkaplan
parents:
5386
diff
changeset
|
190 #include "vobsub.h" |
4088 | 191 |
4743 | 192 /* FIXME */ |
193 void mencoder_exit(int level, char *how) | |
194 { | |
195 if (how) | |
196 printf("Exiting... (%s)\n", how); | |
197 else | |
198 printf("Exiting...\n"); | |
199 | |
200 exit(level); | |
201 } | |
202 | |
4488 | 203 void parse_cfgfiles( m_config_t* conf ) |
204 { | |
205 char *conffile; | |
206 if ((conffile = get_path("mencoder")) == NULL) { | |
207 mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_GetpathProblem); | |
208 } else { | |
209 if (m_config_parse_config_file(conf, conffile) < 0) | |
4743 | 210 mencoder_exit(1,"configfile error"); |
4488 | 211 free(conffile); |
212 } | |
213 } | |
214 | |
2591 | 215 //--------------------------------------------------------------------------- |
216 | |
4088 | 217 void *vo_spudec=NULL; |
218 | |
2591 | 219 int dec_audio(sh_audio_t *sh_audio,unsigned char* buffer,int total){ |
220 int size=0; | |
221 int eof=0; | |
222 while(size<total && !eof){ | |
223 int len=total-size; | |
224 if(len>MAX_OUTBURST) len=MAX_OUTBURST; | |
225 if(len>sh_audio->a_buffer_size) len=sh_audio->a_buffer_size; | |
226 if(len>sh_audio->a_buffer_len){ | |
227 int ret=decode_audio(sh_audio, | |
228 &sh_audio->a_buffer[sh_audio->a_buffer_len], | |
229 len-sh_audio->a_buffer_len, | |
230 sh_audio->a_buffer_size-sh_audio->a_buffer_len); | |
231 if(ret>0) sh_audio->a_buffer_len+=ret; else eof=1; | |
232 } | |
233 if(len>sh_audio->a_buffer_len) len=sh_audio->a_buffer_len; | |
234 memcpy(buffer+size,sh_audio->a_buffer,len); | |
235 sh_audio->a_buffer_len-=len; size+=len; | |
236 if(sh_audio->a_buffer_len>0) | |
237 memcpy(sh_audio->a_buffer,&sh_audio->a_buffer[len],sh_audio->a_buffer_len); | |
238 } | |
239 return size; | |
240 } | |
241 | |
4767 | 242 extern void me_register_options(m_config_t* cfg); |
243 | |
2591 | 244 //--------------------------------------------------------------------------- |
2531 | 245 |
246 static int eof=0; | |
3320
ac8b70dd5e45
use return 1; if interrupted - patch by Artur Skawina <skawina@geocities.com>
arpi
parents:
3240
diff
changeset
|
247 static int interrupted=0; |
2531 | 248 |
4159
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
249 enum end_at_type_t {END_AT_NONE, END_AT_TIME, END_AT_SIZE}; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
250 static enum end_at_type_t end_at_type = END_AT_NONE; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
251 static int end_at; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
252 |
2531 | 253 static void exit_sighandler(int x){ |
254 eof=1; | |
3320
ac8b70dd5e45
use return 1; if interrupted - patch by Artur Skawina <skawina@geocities.com>
arpi
parents:
3240
diff
changeset
|
255 interrupted=1; |
2531 | 256 } |
257 | |
5553
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
258 aviwrite_t* muxer=NULL; |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
259 FILE* muxer_f=NULL; |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
260 |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
261 // callback for ve_*.c: |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
262 void mencoder_write_chunk(aviwrite_stream_t *s,int len,unsigned int flags){ |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
263 aviwrite_write_chunk(muxer,s,muxer_f,len,flags); |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
264 } |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
265 |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
266 |
2618 | 267 int main(int argc,char* argv[], char *envp[]){ |
2531 | 268 |
269 stream_t* stream=NULL; | |
270 demuxer_t* demuxer=NULL; | |
4367
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
271 stream_t* stream2=NULL; |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
272 demuxer_t* demuxer2=NULL; |
2531 | 273 demux_stream_t *d_audio=NULL; |
274 demux_stream_t *d_video=NULL; | |
275 demux_stream_t *d_dvdsub=NULL; | |
276 sh_audio_t *sh_audio=NULL; | |
277 sh_video_t *sh_video=NULL; | |
278 int file_format=DEMUXER_TYPE_UNKNOWN; | |
5149 | 279 int i; |
2531 | 280 |
281 aviwrite_stream_t* mux_a=NULL; | |
282 aviwrite_stream_t* mux_v=NULL; | |
4377 | 283 int muxer_f_size=0; |
2531 | 284 |
3357 | 285 #ifdef HAVE_MP3LAME |
2591 | 286 lame_global_flags *lame; |
3357 | 287 #endif |
2583 | 288 |
2653 | 289 float audio_preload=0.5; |
2581 | 290 |
2613 | 291 double v_pts_corr=0; |
292 double v_timer_corr=0; | |
2605 | 293 |
4156
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
294 play_tree_t* playtree; |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
295 play_tree_iter_t* playtree_iter; |
2618 | 296 char* filename=NULL; |
4367
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
297 char* frameno_filename="frameno.avi"; |
2618 | 298 |
3361
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
299 int decoded_frameno=0; |
4367
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
300 int next_frameno=-1; |
3361
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
301 |
4387 | 302 unsigned int timer_start; |
303 | |
5223 | 304 mp_msg_init(); |
305 mp_msg_set_level(MSGL_STATUS); | |
2978 | 306 mp_msg(MSGT_CPLAYER,MSGL_INFO,"%s",banner_text); |
2622 | 307 |
308 // check codec.conf | |
309 if(!parse_codec_cfg(get_path("codecs.conf"))){ | |
3748 | 310 if(!parse_codec_cfg(CONFDIR"/codecs.conf")){ |
2622 | 311 mp_msg(MSGT_MENCODER,MSGL_HINT,MSGTR_CopyCodecsConf); |
4743 | 312 mencoder_exit(1,NULL); |
2622 | 313 } |
314 } | |
2531 | 315 |
3323 | 316 /* Test for cpu capabilities (and corresponding OS support) for optimizing */ |
317 #ifdef ARCH_X86 | |
318 GetCpuCaps(&gCpuCaps); | |
319 mp_msg(MSGT_CPLAYER,MSGL_INFO,"CPUflags: Type: %d MMX: %d MMX2: %d 3DNow: %d 3DNow2: %d SSE: %d SSE2: %d\n", | |
320 gCpuCaps.cpuType,gCpuCaps.hasMMX,gCpuCaps.hasMMX2, | |
321 gCpuCaps.has3DNow, gCpuCaps.has3DNowExt, | |
322 gCpuCaps.hasSSE, gCpuCaps.hasSSE2); | |
323 #endif | |
324 | |
4367
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
325 // FIXME: get rid of -dvd and other tricky options and config/playtree |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
326 stream2=open_stream(frameno_filename,0,&i); |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
327 if(stream2){ |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
328 demuxer2=demux_open(stream2,DEMUXER_TYPE_AVI,-1,-1,-2); |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
329 if(demuxer2) printf("Using pass3 control file: %s\n",frameno_filename); |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
330 } |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
331 |
4156
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
332 playtree = play_tree_new(); |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
333 mconfig = m_config_new(playtree); |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
334 m_config_register_options(mconfig,mencoder_opts); |
4767 | 335 me_register_options(mconfig); |
4488 | 336 parse_cfgfiles(mconfig); |
4156
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
337 |
4743 | 338 if(m_config_parse_command_line(mconfig, argc, argv, envp) < 0) mencoder_exit(1, "error parsing cmdline"); |
4156
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
339 playtree = play_tree_cleanup(playtree); |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
340 if(playtree) { |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
341 playtree_iter = play_tree_iter_new(playtree,mconfig); |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
342 if(playtree_iter) { |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
343 if(play_tree_iter_step(playtree_iter,0,0) != PLAY_TREE_ITER_ENTRY) { |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
344 play_tree_iter_free(playtree_iter); |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
345 playtree_iter = NULL; |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
346 } |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
347 filename = play_tree_iter_get_file(playtree_iter,1); |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
348 } |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
349 } |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
350 |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4088
diff
changeset
|
351 if(!filename && !vcd_track && !dvd_title && !tv_param_on){ |
2618 | 352 printf("\nMissing filename!\n\n"); |
4743 | 353 mencoder_exit(1,NULL); |
2618 | 354 } |
355 | |
5223 | 356 mp_msg_set_level(verbose+MSGL_STATUS); |
2600 | 357 |
2618 | 358 stream=open_stream(filename,vcd_track,&file_format); |
2531 | 359 |
360 if(!stream){ | |
361 printf("Cannot open file/device\n"); | |
4743 | 362 mencoder_exit(1,NULL); |
2531 | 363 } |
364 | |
365 printf("success: format: %d data: 0x%X - 0x%X\n",file_format, (int)(stream->start_pos),(int)(stream->end_pos)); | |
366 | |
5436 | 367 #ifdef USE_DVDREAD |
368 if(stream->type==STREAMTYPE_DVD){ | |
369 if(audio_lang && audio_id==-1) audio_id=dvd_aid_from_lang(stream,audio_lang); | |
370 if(dvdsub_lang && dvdsub_id==-1) dvdsub_id=dvd_sid_from_lang(stream,dvdsub_lang); | |
371 } | |
372 #endif | |
373 | |
3563 | 374 if(stream_cache_size) stream_enable_cache(stream,stream_cache_size*1024,0,0); |
2531 | 375 |
3979 | 376 #ifdef HAVE_LIBCSS |
377 // current_module="libcss"; | |
378 if (dvdimportkey) { | |
379 if (dvd_import_key(dvdimportkey)) { | |
380 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_ErrorDVDkey); | |
4743 | 381 mencoder_exit(1,NULL); |
3979 | 382 } |
383 mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_CmdlineDVDkey); | |
384 } | |
385 if (dvd_auth_device) { | |
386 // if (dvd_auth(dvd_auth_device,f)) { | |
387 if (dvd_auth(dvd_auth_device,filename)) { | |
388 mp_msg(MSGT_CPLAYER,MSGL_FATAL,"Error in DVD auth...\n"); | |
4743 | 389 mencoder_exit(1,NULL); |
3979 | 390 } |
391 mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_DVDauthOk); | |
392 } | |
393 #endif | |
394 | |
4367
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
395 if(!has_audio || demuxer2) audio_id=-2; /* do NOT read audio packets... */ |
4355 | 396 |
2882 | 397 //demuxer=demux_open(stream,file_format,video_id,audio_id,dvdsub_id); |
398 demuxer=demux_open(stream,file_format,audio_id,video_id,dvdsub_id); | |
2531 | 399 if(!demuxer){ |
400 printf("Cannot open demuxer\n"); | |
4743 | 401 mencoder_exit(1,NULL); |
2531 | 402 } |
403 | |
4367
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
404 d_audio=demuxer2 ? demuxer2->audio : demuxer->audio; |
2531 | 405 d_video=demuxer->video; |
406 d_dvdsub=demuxer->sub; | |
407 sh_audio=d_audio->sh; | |
408 sh_video=d_video->sh; | |
409 | |
410 if(!video_read_properties(sh_video)){ | |
411 printf("Couldn't read video properties\n"); | |
4743 | 412 mencoder_exit(1,NULL); |
2531 | 413 } |
414 | |
2622 | 415 mp_msg(MSGT_MENCODER,MSGL_INFO,"[V] filefmt:%d fourcc:0x%X size:%dx%d fps:%5.2f ftime:=%6.4f\n", |
2531 | 416 demuxer->file_format,sh_video->format, sh_video->disp_w,sh_video->disp_h, |
417 sh_video->fps,sh_video->frametime | |
418 ); | |
2581 | 419 |
4620 | 420 if(sh_audio && (out_audio_codec || seek_to_sec || !sh_audio->wf)){ |
2581 | 421 // Go through the codec.conf and find the best codec... |
422 sh_audio->codec=NULL; | |
2622 | 423 if(audio_family!=-1) mp_msg(MSGT_MENCODER,MSGL_INFO,MSGTR_TryForceAudioFmt,audio_family); |
2581 | 424 while(1){ |
425 sh_audio->codec=find_codec(sh_audio->format,NULL,sh_audio->codec,1); | |
426 if(!sh_audio->codec){ | |
427 if(audio_family!=-1) { | |
428 sh_audio->codec=NULL; /* re-search */ | |
2622 | 429 mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CantFindAfmtFallback); |
2581 | 430 audio_family=-1; |
431 continue; | |
432 } | |
2622 | 433 mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CantFindAudioCodec,sh_audio->format); |
434 mp_msg(MSGT_MENCODER,MSGL_HINT, MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("codecs.conf")); | |
2581 | 435 sh_audio=d_audio->sh=NULL; |
436 break; | |
437 } | |
438 if(audio_codec && strcmp(sh_audio->codec->name,audio_codec)) continue; | |
439 else if(audio_family!=-1 && sh_audio->codec->driver!=audio_family) continue; | |
2622 | 440 mp_msg(MSGT_MENCODER,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); |
2581 | 441 break; |
442 } | |
443 } | |
444 | |
4620 | 445 if(sh_audio && (out_audio_codec || seek_to_sec || !sh_audio->wf)){ |
2622 | 446 mp_msg(MSGT_MENCODER,MSGL_V,"Initializing audio codec...\n"); |
2581 | 447 if(!init_audio(sh_audio)){ |
2622 | 448 mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CouldntInitAudioCodec); |
2581 | 449 sh_audio=d_audio->sh=NULL; |
450 } else { | |
2622 | 451 mp_msg(MSGT_MENCODER,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, |
2581 | 452 sh_audio->sample_format,sh_audio->i_bps,sh_audio->o_bps); |
453 } | |
454 } | |
455 | |
2531 | 456 // set up video encoder: |
457 | |
5388
3af2729c5c87
* New command line switch for mplayer & mencoder:
kmkaplan
parents:
5386
diff
changeset
|
458 if (spudec_ifo) { |
3af2729c5c87
* New command line switch for mplayer & mencoder:
kmkaplan
parents:
5386
diff
changeset
|
459 unsigned int palette[16], width, height; |
3af2729c5c87
* New command line switch for mplayer & mencoder:
kmkaplan
parents:
5386
diff
changeset
|
460 if (vobsub_parse_ifo(spudec_ifo, palette, &width, &height, 1) >= 0) |
3af2729c5c87
* New command line switch for mplayer & mencoder:
kmkaplan
parents:
5386
diff
changeset
|
461 vo_spudec=spudec_new_scaled(palette, sh_video->disp_w, sh_video->disp_h); |
3af2729c5c87
* New command line switch for mplayer & mencoder:
kmkaplan
parents:
5386
diff
changeset
|
462 } |
5392
d7c586ebbacf
Fix bug noticed by Hajba Szilard in message <20020329151644.A23301@revai.hu>
kmkaplan
parents:
5390
diff
changeset
|
463 #ifdef USE_DVDREAD |
5388
3af2729c5c87
* New command line switch for mplayer & mencoder:
kmkaplan
parents:
5386
diff
changeset
|
464 if (vo_spudec==NULL) { |
4557 | 465 vo_spudec=spudec_new_scaled(stream->type==STREAMTYPE_DVD?((dvd_priv_t *)(stream->priv))->cur_pgc->palette:NULL, |
4088 | 466 sh_video->disp_w, sh_video->disp_h); |
5388
3af2729c5c87
* New command line switch for mplayer & mencoder:
kmkaplan
parents:
5386
diff
changeset
|
467 } |
4088 | 468 #endif |
469 | |
2531 | 470 // set up output file: |
2626 | 471 muxer_f=fopen(out_filename,"wb"); |
2887
bc648c6a464a
fixes a segfault if file specified in -o can't be accessed
pl
parents:
2884
diff
changeset
|
472 if(!muxer_f) { |
bc648c6a464a
fixes a segfault if file specified in -o can't be accessed
pl
parents:
2884
diff
changeset
|
473 printf("Cannot open output file '%s'\n", out_filename); |
4743 | 474 mencoder_exit(1,NULL); |
2887
bc648c6a464a
fixes a segfault if file specified in -o can't be accessed
pl
parents:
2884
diff
changeset
|
475 } |
bc648c6a464a
fixes a segfault if file specified in -o can't be accessed
pl
parents:
2884
diff
changeset
|
476 |
2531 | 477 muxer=aviwrite_new_muxer(); |
2581 | 478 |
479 // ============= VIDEO =============== | |
480 | |
2531 | 481 mux_v=aviwrite_new_stream(muxer,AVIWRITE_TYPE_VIDEO); |
482 | |
4575 | 483 mux_v->buffer_size=0x200000; // 2MB |
2531 | 484 mux_v->buffer=malloc(mux_v->buffer_size); |
485 | |
486 mux_v->source=sh_video; | |
487 | |
488 mux_v->h.dwSampleSize=0; // VBR | |
489 mux_v->h.dwScale=10000; | |
2613 | 490 mux_v->h.dwRate=mux_v->h.dwScale*(force_ofps?force_ofps:sh_video->fps); |
2531 | 491 |
2661 | 492 mux_v->codec=out_video_codec; |
2574 | 493 |
5553
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
494 mux_v->bih=NULL; |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
495 sh_video->codec=NULL; |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
496 sh_video->video_out=NULL; |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
497 sh_video->vfilter=NULL; // fixme! |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
498 |
2531 | 499 switch(mux_v->codec){ |
3384 | 500 case VCODEC_COPY: |
501 if (sh_video->bih) | |
502 mux_v->bih=sh_video->bih; | |
503 else | |
504 { | |
505 mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)); | |
506 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER); | |
507 mux_v->bih->biWidth=sh_video->disp_w; | |
508 mux_v->bih->biHeight=sh_video->disp_h; | |
509 mux_v->bih->biCompression=sh_video->format; | |
510 mux_v->bih->biPlanes=1; | |
511 mux_v->bih->biBitCount=24; // FIXME!!! | |
512 mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8); | |
513 } | |
514 printf("videocodec: framecopy (%dx%d %dbpp fourcc=%x)\n", | |
515 mux_v->bih->biWidth, mux_v->bih->biHeight, | |
516 mux_v->bih->biBitCount, mux_v->bih->biCompression); | |
2531 | 517 break; |
3361
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
518 case VCODEC_FRAMENO: |
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
519 mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)); |
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
520 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER); |
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
521 mux_v->bih->biWidth=vo_w; |
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
522 mux_v->bih->biHeight=vo_h; |
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
523 mux_v->bih->biPlanes=1; |
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
524 mux_v->bih->biBitCount=24; |
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
525 mux_v->bih->biCompression=mmioFOURCC('F','r','N','o'); |
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
526 mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8); |
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
527 break; |
5553
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
528 default: |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
529 |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
530 switch(mux_v->codec){ |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
531 case VCODEC_DIVX4: |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
532 sh_video->vfilter=vf_open_encoder(NULL,"divx4",mux_v); break; |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
533 case VCODEC_LIBAVCODEC: |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
534 sh_video->vfilter=vf_open_encoder(NULL,"lavc",mux_v); break; |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
535 case VCODEC_RAWRGB: |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
536 sh_video->vfilter=vf_open_encoder(NULL,"rawrgb",mux_v); break; |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
537 case VCODEC_VFW: |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
538 sh_video->vfilter=vf_open_encoder(NULL,"vfw",mux_v); break; |
4743 | 539 } |
5553
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
540 if(!mux_v->bih || !sh_video->vfilter){ |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
541 mp_msg(MSGT_MENCODER,MSGL_FATAL,"Failed to open the encoder\n"); |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
542 mencoder_exit(1,NULL); |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
543 } |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
544 sh_video->vfilter=append_filters(sh_video->vfilter); |
3377
4723f6fd750a
do not fault if 2pass VbrControl can't open the logfile
alex
parents:
3363
diff
changeset
|
545 |
5553
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
546 mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n"); |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
547 // Go through the codec.conf and find the best codec... |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
548 sh_video->inited=0; |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
549 codecs_reset_selection(0); |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
550 if(video_codec){ |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
551 // forced codec by name: |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
552 mp_msg(MSGT_CPLAYER,MSGL_INFO,"Forced video codec: %s\n",video_codec); |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
553 init_video(sh_video,video_codec,-1,-1); |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
554 } else { |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
555 int status; |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
556 // try in stability order: UNTESTED, WORKING, BUGGY, BROKEN |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
557 if(video_family>=0) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_TryForceVideoFmt,video_family); |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
558 for(status=CODECS_STATUS__MAX;status>=CODECS_STATUS__MIN;--status){ |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
559 if(video_family>=0) // try first the preferred codec family: |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
560 if(init_video(sh_video,NULL,video_family,status)) break; |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
561 if(init_video(sh_video,NULL,-1,status)) break; |
4365
9e20866c3250
added better fourcc handling for lavc, exiting if no lavc video codec name specified
alex
parents:
4355
diff
changeset
|
562 } |
5553
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
563 } |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
564 if(!sh_video->inited){ |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
565 mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantFindVideoCodec,sh_video->format); |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
566 mp_msg(MSGT_CPLAYER,MSGL_HINT, MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("codecs.conf")); |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
567 mencoder_exit(1,NULL); |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
568 } |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
569 mp_msg(MSGT_CPLAYER,MSGL_INFO,"%s video codec: [%s] drv:%d prio:%d (%s)\n", |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
570 video_codec?mp_gettext("Forcing"):mp_gettext("Detected"),sh_video->codec->name,sh_video->codec->driver,sh_video->codec->priority!=-1?sh_video->codec->priority:0,sh_video->codec->info); |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
571 mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n"); |
3657
af1f8e2d693a
added libavcodec support (mjpeg,h263,rv10,mpeg1 codecs tested&working) and added -ffourcc option (force fourcc in ouput)
alex
parents:
3563
diff
changeset
|
572 |
af1f8e2d693a
added libavcodec support (mjpeg,h263,rv10,mpeg1 codecs tested&working) and added -ffourcc option (force fourcc in ouput)
alex
parents:
3563
diff
changeset
|
573 } |
af1f8e2d693a
added libavcodec support (mjpeg,h263,rv10,mpeg1 codecs tested&working) and added -ffourcc option (force fourcc in ouput)
alex
parents:
3563
diff
changeset
|
574 |
af1f8e2d693a
added libavcodec support (mjpeg,h263,rv10,mpeg1 codecs tested&working) and added -ffourcc option (force fourcc in ouput)
alex
parents:
3563
diff
changeset
|
575 /* force output fourcc to .. */ |
4365
9e20866c3250
added better fourcc handling for lavc, exiting if no lavc video codec name specified
alex
parents:
4355
diff
changeset
|
576 if ((force_fourcc != NULL) && (strlen(force_fourcc) >= 4)) |
3657
af1f8e2d693a
added libavcodec support (mjpeg,h263,rv10,mpeg1 codecs tested&working) and added -ffourcc option (force fourcc in ouput)
alex
parents:
3563
diff
changeset
|
577 { |
af1f8e2d693a
added libavcodec support (mjpeg,h263,rv10,mpeg1 codecs tested&working) and added -ffourcc option (force fourcc in ouput)
alex
parents:
3563
diff
changeset
|
578 mux_v->bih->biCompression = mmioFOURCC(force_fourcc[0], force_fourcc[1], |
af1f8e2d693a
added libavcodec support (mjpeg,h263,rv10,mpeg1 codecs tested&working) and added -ffourcc option (force fourcc in ouput)
alex
parents:
3563
diff
changeset
|
579 force_fourcc[2], force_fourcc[3]); |
af1f8e2d693a
added libavcodec support (mjpeg,h263,rv10,mpeg1 codecs tested&working) and added -ffourcc option (force fourcc in ouput)
alex
parents:
3563
diff
changeset
|
580 printf("Forcing output fourcc to %x [%.4s]\n", |
4365
9e20866c3250
added better fourcc handling for lavc, exiting if no lavc video codec name specified
alex
parents:
4355
diff
changeset
|
581 mux_v->bih->biCompression, (char *)&mux_v->bih->biCompression); |
2531 | 582 } |
583 | |
4370 | 584 if(demuxer->file_format!=DEMUXER_TYPE_AVI) pts_from_bps=0; // it must be 0 for mpeg/asf! |
585 | |
2581 | 586 // ============= AUDIO =============== |
587 if(sh_audio){ | |
588 | |
589 mux_a=aviwrite_new_stream(muxer,AVIWRITE_TYPE_AUDIO); | |
590 | |
591 mux_a->buffer_size=0x100000; //16384; | |
592 mux_a->buffer=malloc(mux_a->buffer_size); | |
593 | |
594 mux_a->source=sh_audio; | |
595 | |
2661 | 596 mux_a->codec=out_audio_codec; |
2581 | 597 |
598 switch(mux_a->codec){ | |
3385 | 599 case ACODEC_COPY: |
4369 | 600 if (sh_audio->wf){ |
3385 | 601 mux_a->wf=sh_audio->wf; |
4370 | 602 if(!sh_audio->i_bps) sh_audio->i_bps=mux_a->wf->nAvgBytesPerSec; |
4369 | 603 } else { |
3385 | 604 mux_a->wf = malloc(sizeof(WAVEFORMATEX)); |
4370 | 605 mux_a->wf->nBlockAlign = 1; //mux_a->h.dwSampleSize; |
4369 | 606 mux_a->wf->wFormatTag = sh_audio->format; |
3385 | 607 mux_a->wf->nChannels = sh_audio->channels; |
608 mux_a->wf->nSamplesPerSec = sh_audio->samplerate; | |
4369 | 609 mux_a->wf->nAvgBytesPerSec=sh_audio->i_bps; //mux_a->h.dwSampleSize*mux_a->wf->nSamplesPerSec; |
3480 | 610 mux_a->wf->wBitsPerSample = 16; // FIXME |
3385 | 611 mux_a->wf->cbSize=0; // FIXME for l3codeca.acm |
612 } | |
4370 | 613 if(sh_audio->audio.dwScale){ |
614 mux_a->h.dwSampleSize=sh_audio->audio.dwSampleSize; | |
615 mux_a->h.dwScale=sh_audio->audio.dwScale; | |
616 mux_a->h.dwRate=sh_audio->audio.dwRate; | |
617 } else { | |
618 mux_a->h.dwSampleSize=mux_a->wf->nBlockAlign; | |
619 mux_a->h.dwScale=mux_a->h.dwSampleSize; | |
620 mux_a->h.dwRate=mux_a->wf->nAvgBytesPerSec; | |
621 } | |
622 printf("audiocodec: framecopy (format=%x chans=%d rate=%d bits=%d bps=%d sample=%d)\n", | |
3385 | 623 mux_a->wf->wFormatTag, mux_a->wf->nChannels, mux_a->wf->nSamplesPerSec, |
4370 | 624 mux_a->wf->wBitsPerSample, mux_a->wf->nAvgBytesPerSec, mux_a->h.dwSampleSize); |
2581 | 625 break; |
2583 | 626 case ACODEC_PCM: |
627 printf("CBR PCM audio selected\n"); | |
628 mux_a->h.dwSampleSize=2*sh_audio->channels; | |
629 mux_a->h.dwScale=1; | |
630 mux_a->h.dwRate=sh_audio->samplerate; | |
631 mux_a->wf=malloc(sizeof(WAVEFORMATEX)); | |
632 mux_a->wf->nBlockAlign=mux_a->h.dwSampleSize; | |
633 mux_a->wf->wFormatTag=0x1; // PCM | |
634 mux_a->wf->nChannels=sh_audio->channels; | |
635 mux_a->wf->nSamplesPerSec=sh_audio->samplerate; | |
636 mux_a->wf->nAvgBytesPerSec=mux_a->h.dwSampleSize*mux_a->wf->nSamplesPerSec; | |
637 mux_a->wf->wBitsPerSample=16; | |
638 mux_a->wf->cbSize=0; // FIXME for l3codeca.acm | |
639 break; | |
2581 | 640 case ACODEC_VBRMP3: |
3385 | 641 printf("MP3 audio selected\n"); |
2581 | 642 mux_a->h.dwSampleSize=0; // VBR |
2653 | 643 mux_a->h.dwScale=1152; // samples/frame |
2581 | 644 mux_a->h.dwRate=sh_audio->samplerate; |
2635
c1e24e01601b
fixed AVI header creation - now should be compatible with NaNdub
arpi
parents:
2627
diff
changeset
|
645 if(sizeof(MPEGLAYER3WAVEFORMAT)!=30) mp_msg(MSGT_MENCODER,MSGL_WARN,"sizeof(MPEGLAYER3WAVEFORMAT)==%d!=30, maybe broken C compiler?\n",sizeof(MPEGLAYER3WAVEFORMAT)); |
c1e24e01601b
fixed AVI header creation - now should be compatible with NaNdub
arpi
parents:
2627
diff
changeset
|
646 mux_a->wf=malloc(sizeof(MPEGLAYER3WAVEFORMAT)); // should be 30 |
2581 | 647 mux_a->wf->wFormatTag=0x55; // MP3 |
648 mux_a->wf->nChannels=sh_audio->channels; | |
2639 | 649 mux_a->wf->nSamplesPerSec=force_srate?force_srate:sh_audio->samplerate; |
2635
c1e24e01601b
fixed AVI header creation - now should be compatible with NaNdub
arpi
parents:
2627
diff
changeset
|
650 mux_a->wf->nAvgBytesPerSec=192000/8; // FIXME! |
2653 | 651 mux_a->wf->nBlockAlign=1152; // requires for l3codeca.acm + WMP 6.4 |
2635
c1e24e01601b
fixed AVI header creation - now should be compatible with NaNdub
arpi
parents:
2627
diff
changeset
|
652 mux_a->wf->wBitsPerSample=0; //16; |
c1e24e01601b
fixed AVI header creation - now should be compatible with NaNdub
arpi
parents:
2627
diff
changeset
|
653 // from NaNdub: (requires for l3codeca.acm) |
c1e24e01601b
fixed AVI header creation - now should be compatible with NaNdub
arpi
parents:
2627
diff
changeset
|
654 mux_a->wf->cbSize=12; |
c1e24e01601b
fixed AVI header creation - now should be compatible with NaNdub
arpi
parents:
2627
diff
changeset
|
655 ((MPEGLAYER3WAVEFORMAT*)(mux_a->wf))->wID=1; |
c1e24e01601b
fixed AVI header creation - now should be compatible with NaNdub
arpi
parents:
2627
diff
changeset
|
656 ((MPEGLAYER3WAVEFORMAT*)(mux_a->wf))->fdwFlags=2; |
2653 | 657 ((MPEGLAYER3WAVEFORMAT*)(mux_a->wf))->nBlockSize=1152; // ??? |
2635
c1e24e01601b
fixed AVI header creation - now should be compatible with NaNdub
arpi
parents:
2627
diff
changeset
|
658 ((MPEGLAYER3WAVEFORMAT*)(mux_a->wf))->nFramesPerBlock=1; |
c1e24e01601b
fixed AVI header creation - now should be compatible with NaNdub
arpi
parents:
2627
diff
changeset
|
659 ((MPEGLAYER3WAVEFORMAT*)(mux_a->wf))->nCodecDelay=0; |
2581 | 660 break; |
661 } | |
662 } | |
663 | |
2840
808fe0767cf8
fix typos - patch by Colin Marquardt <colin@marquardt-home.de>
pl
parents:
2825
diff
changeset
|
664 printf("Writing AVI header...\n"); |
2531 | 665 aviwrite_write_header(muxer,muxer_f); |
666 | |
5553
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
667 decoded_frameno=0; |
2531 | 668 |
2600 | 669 if(sh_audio) |
2583 | 670 switch(mux_a->codec){ |
3357 | 671 #ifdef HAVE_MP3LAME |
2583 | 672 case ACODEC_VBRMP3: |
673 | |
674 lame=lame_init(); | |
2591 | 675 lame_set_bWriteVbrTag(lame,0); |
2583 | 676 lame_set_in_samplerate(lame,sh_audio->samplerate); |
677 lame_set_num_channels(lame,mux_a->wf->nChannels); | |
2639 | 678 lame_set_out_samplerate(lame,mux_a->wf->nSamplesPerSec); |
2626 | 679 if(lame_param_vbr){ // VBR: |
680 lame_set_VBR(lame,lame_param_vbr); // vbr mode | |
681 lame_set_VBR_q(lame,lame_param_quality+1); // 1 = best vbr q 6=~128k | |
682 if(lame_param_br>0) lame_set_VBR_mean_bitrate_kbps(lame,lame_param_br); | |
683 } else { // CBR: | |
684 lame_set_quality(lame,lame_param_quality); // 0 = best q | |
685 if(lame_param_br>0) lame_set_brate(lame,lame_param_br); | |
686 } | |
687 if(lame_param_mode>=0) lame_set_mode(lame,lame_param_mode); // j-st | |
688 if(lame_param_ratio>0) lame_set_compression_ratio(lame,lame_param_ratio); | |
2583 | 689 lame_init_params(lame); |
2622 | 690 if(verbose){ |
2626 | 691 lame_print_config(lame); |
692 lame_print_internals(lame); | |
2622 | 693 } |
3357 | 694 break; |
695 #endif | |
2583 | 696 } |
697 | |
2531 | 698 signal(SIGINT,exit_sighandler); // Interrupt from keyboard |
699 signal(SIGQUIT,exit_sighandler); // Quit from keyboard | |
700 signal(SIGTERM,exit_sighandler); // kill | |
701 | |
4387 | 702 timer_start=GetTimerMS(); |
703 | |
4620 | 704 if (seek_to_sec) { |
705 int a,b; float d; | |
706 | |
707 if (sscanf(seek_to_sec, "%d:%d:%f", &a,&b,&d)==3) | |
708 d += 3600*a + 60*b; | |
709 else if (sscanf(seek_to_sec, "%d:%f", &a, &d)==2) | |
710 d += 60*a; | |
711 else | |
712 sscanf(seek_to_sec, "%f", &d); | |
713 | |
714 demux_seek(demuxer, d, 1); | |
715 } | |
716 | |
2531 | 717 while(!eof){ |
718 | |
2571 | 719 float frame_time=0; |
2531 | 720 int blit_frame=0; |
721 float a_pts=0; | |
722 float v_pts=0; | |
2574 | 723 unsigned char* start=NULL; |
724 int in_size; | |
2613 | 725 int skip_flag=0; // 1=skip -1=duplicate |
2531 | 726 |
4159
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
727 if((end_at_type == END_AT_SIZE && end_at <= ftell(muxer_f)) || |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
728 (end_at_type == END_AT_TIME && end_at < sh_video->timer)) |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
729 break; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
730 |
2643 | 731 if(play_n_frames>=0){ |
732 --play_n_frames; | |
733 if(play_n_frames<0) break; | |
734 } | |
735 | |
2581 | 736 if(sh_audio){ |
737 // get audio: | |
2583 | 738 while(mux_a->timer-audio_preload<mux_v->timer){ |
2653 | 739 int len=0; |
2581 | 740 if(mux_a->h.dwSampleSize){ |
2605 | 741 // CBR - copy 0.5 sec of audio |
2583 | 742 switch(mux_a->codec){ |
3385 | 743 case ACODEC_COPY: // copy |
4370 | 744 len=mux_a->wf->nAvgBytesPerSec/2; |
2583 | 745 len/=mux_a->h.dwSampleSize;if(len<1) len=1; |
746 len*=mux_a->h.dwSampleSize; | |
747 len=demux_read_data(sh_audio->ds,mux_a->buffer,len); | |
748 break; | |
749 case ACODEC_PCM: | |
750 len=mux_a->h.dwSampleSize*(mux_a->h.dwRate/2); | |
2591 | 751 len=dec_audio(sh_audio,mux_a->buffer,len); |
2583 | 752 break; |
753 } | |
2581 | 754 } else { |
2605 | 755 // VBR - encode/copy an audio frame |
756 switch(mux_a->codec){ | |
3385 | 757 case ACODEC_COPY: // copy |
4367
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
758 len=ds_get_packet(sh_audio->ds,(unsigned char**) &mux_a->buffer); |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
759 // printf("VBR audio framecopy not yet implemented!\n"); |
2605 | 760 break; |
3357 | 761 #ifdef HAVE_MP3LAME |
2605 | 762 case ACODEC_VBRMP3: |
2591 | 763 while(mux_a->buffer_len<4){ |
764 unsigned char tmp[2304]; | |
765 int len=dec_audio(sh_audio,tmp,2304); | |
766 if(len<=0) break; // eof | |
767 len=lame_encode_buffer_interleaved(lame, | |
768 tmp,len/4, | |
769 mux_a->buffer+mux_a->buffer_len,mux_a->buffer_size-mux_a->buffer_len); | |
770 if(len<0) break; // error | |
771 mux_a->buffer_len+=len; | |
772 } | |
773 if(mux_a->buffer_len<4) break; | |
774 len=mp_decode_mp3_header(mux_a->buffer); | |
2639 | 775 //printf("%d\n",len); |
2591 | 776 if(len<=0) break; // bad frame! |
777 while(mux_a->buffer_len<len){ | |
778 unsigned char tmp[2304]; | |
779 int len=dec_audio(sh_audio,tmp,2304); | |
780 if(len<=0) break; // eof | |
781 len=lame_encode_buffer_interleaved(lame, | |
782 tmp,len/4, | |
783 mux_a->buffer+mux_a->buffer_len,mux_a->buffer_size-mux_a->buffer_len); | |
784 if(len<0) break; // error | |
785 mux_a->buffer_len+=len; | |
786 } | |
2605 | 787 break; |
3357 | 788 #endif |
2605 | 789 } |
2581 | 790 } |
2583 | 791 if(len<=0) break; // EOF? |
792 aviwrite_write_chunk(muxer,mux_a,muxer_f,len,0); | |
2655 | 793 if(!mux_a->h.dwSampleSize && mux_a->timer>0) |
3354 | 794 mux_a->wf->nAvgBytesPerSec=0.5f+(double)mux_a->size/mux_a->timer; // avg bps (VBR) |
2591 | 795 if(mux_a->buffer_len>=len){ |
796 mux_a->buffer_len-=len; | |
797 memcpy(mux_a->buffer,mux_a->buffer+len,mux_a->buffer_len); | |
798 } | |
2581 | 799 } |
800 } | |
801 | |
802 // get video frame! | |
803 in_size=video_read_frame(sh_video,&frame_time,&start,force_fps); | |
804 if(in_size<0){ eof=1; break; } | |
3361
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
805 sh_video->timer+=frame_time; ++decoded_frameno; |
2613 | 806 |
807 v_timer_corr-=frame_time-(float)mux_v->h.dwScale/mux_v->h.dwRate; | |
2531 | 808 |
5553
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
809 if(demuxer2){ // 3-pass encoding, read control file (frameno.avi) |
4367
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
810 // find our frame: |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
811 while(next_frameno<decoded_frameno){ |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
812 int* start; |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
813 int len=ds_get_packet(demuxer2->video,(unsigned char**) &start); |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
814 if(len<0){ eof=1;break;} |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
815 if(len==0) --skip_flag; else // duplicate |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
816 if(len==4) next_frameno=start[0]; |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
817 } |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
818 if(eof) break; |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
819 if(skip_flag) printf("!!!!!!!!!!!!\n"); |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
820 skip_flag=next_frameno-decoded_frameno; |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
821 // find next frame: |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
822 while(next_frameno<=decoded_frameno){ |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
823 int* start; |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
824 int len=ds_get_packet(demuxer2->video,(unsigned char**) &start); |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
825 if(len<0){ eof=1;break;} |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
826 if(len==0) --skip_flag; else // duplicate |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
827 if(len==4) next_frameno=start[0]; |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
828 } |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
829 // if(eof) break; |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
830 // printf("Current fno=%d requested=%d skip=%d \n",decoded_frameno,fno,skip_flag); |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
831 } else { |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
832 |
2613 | 833 // check frame duplicate/drop: |
834 | |
835 if(v_timer_corr>=(float)mux_v->h.dwScale/mux_v->h.dwRate){ | |
836 v_timer_corr-=(float)mux_v->h.dwScale/mux_v->h.dwRate; | |
837 ++skip_flag; // skip | |
838 } else | |
839 while(v_timer_corr<=-(float)mux_v->h.dwScale/mux_v->h.dwRate){ | |
840 v_timer_corr+=(float)mux_v->h.dwScale/mux_v->h.dwRate; | |
841 --skip_flag; // dup | |
842 } | |
2531 | 843 |
2613 | 844 while( (v_pts_corr<=-(float)mux_v->h.dwScale/mux_v->h.dwRate && skip_flag>0) |
845 || (v_pts_corr<=-2*(float)mux_v->h.dwScale/mux_v->h.dwRate) ){ | |
846 v_pts_corr+=(float)mux_v->h.dwScale/mux_v->h.dwRate; | |
847 --skip_flag; // dup | |
848 } | |
849 if( (v_pts_corr>=(float)mux_v->h.dwScale/mux_v->h.dwRate && skip_flag<0) | |
850 || (v_pts_corr>=2*(float)mux_v->h.dwScale/mux_v->h.dwRate) ) | |
851 if(skip_flag<=0){ // we can't skip more than 1 frame now | |
852 v_pts_corr-=(float)mux_v->h.dwScale/mux_v->h.dwRate; | |
853 ++skip_flag; // skip | |
854 } | |
855 | |
4367
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
856 } // demuxer2 |
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
857 |
4088 | 858 #ifdef USE_DVDREAD |
859 // DVD sub: | |
860 if(vo_spudec){ | |
861 unsigned char* packet=NULL; | |
862 int len; | |
863 while((len=ds_get_packet_sub(d_dvdsub,&packet))>0){ | |
864 mp_msg(MSGT_MENCODER,MSGL_V,"\rDVD sub: len=%d v_pts=%5.3f s_pts=%5.3f \n",len,d_video->pts,d_dvdsub->pts); | |
5553
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
865 spudec_assemble(vo_spudec,packet,len,90000*d_dvdsub->pts); |
4088 | 866 } |
5553
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
867 spudec_heartbeat(vo_spudec,90000*d_video->pts); |
4088 | 868 } |
869 #endif | |
2613 | 870 |
2531 | 871 switch(mux_v->codec){ |
3384 | 872 case VCODEC_COPY: |
2574 | 873 mux_v->buffer=start; |
2639 | 874 if(skip_flag<=0) aviwrite_write_chunk(muxer,mux_v,muxer_f,in_size,(sh_video->ds->flags&1)?0x10:0); |
2574 | 875 break; |
5553
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
876 case VCODEC_FRAMENO: |
3361
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
877 mux_v->buffer=&decoded_frameno; // tricky |
3363
1459912caea5
set all frames to keyframes for -ovc frameno - allow seeking in resulting audio-only avi
arpi
parents:
3362
diff
changeset
|
878 if(skip_flag<=0) aviwrite_write_chunk(muxer,mux_v,muxer_f,sizeof(int),0x10); |
4575 | 879 break; |
5553
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
880 default: |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
881 // decode_video will callback down to ve_*.c encoders, through the video filters |
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
882 blit_frame=decode_video(sh_video,start,in_size,(skip_flag>0)?1:0); |
2639 | 883 if(skip_flag>0) break; |
5553
38697931adf4
video codecs moved to libmpencoders, crop/scale removed, use -vop for that
arpi
parents:
5546
diff
changeset
|
884 if(!blit_frame) aviwrite_write_chunk(muxer,mux_v,muxer_f,0,0); // empty. |
2531 | 885 } |
2613 | 886 |
887 if(skip_flag<0){ | |
2605 | 888 // duplicate frame |
2613 | 889 printf("\nduplicate %d frame(s)!!! \n",-skip_flag); |
890 while(skip_flag<0){ | |
891 aviwrite_write_chunk(muxer,mux_v,muxer_f,0,0); | |
892 ++skip_flag; | |
893 } | |
2639 | 894 } else |
895 if(skip_flag>0){ | |
2605 | 896 // skip frame |
897 printf("\nskip frame!!! \n"); | |
2613 | 898 --skip_flag; |
2605 | 899 } |
900 | |
4367
c2be4fb65cee
3-pass encoding support (reads frame skip/dup control and audio stream from frameno.avi)
arpi
parents:
4365
diff
changeset
|
901 if(sh_audio && !demuxer2){ |
2605 | 902 float AV_delay,x; |
903 // A-V sync! | |
904 if(pts_from_bps){ | |
905 unsigned int samples=(sh_audio->audio.dwSampleSize)? | |
906 ((ds_tell(d_audio)-sh_audio->a_in_buffer_len)/sh_audio->audio.dwSampleSize) : | |
907 (d_audio->pack_no); // <- used for VBR audio | |
4378 | 908 // printf("samples=%d \n",samples); |
2605 | 909 a_pts=samples*(float)sh_audio->audio.dwScale/(float)sh_audio->audio.dwRate; |
910 delay_corrected=1; | |
911 } else { | |
912 // PTS = (last timestamp) + (bytes after last timestamp)/(bytes per sec) | |
913 a_pts=d_audio->pts; | |
914 if(!delay_corrected) if(a_pts) delay_corrected=1; | |
915 //printf("*** %5.3f ***\n",a_pts); | |
916 a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; | |
917 } | |
918 v_pts=d_video->pts; | |
919 // av = compensated (with out buffering delay) A-V diff | |
2613 | 920 AV_delay=(a_pts-v_pts); AV_delay-=mux_a->timer-(mux_v->timer-(v_timer_corr+v_pts_corr)); |
2605 | 921 // compensate input video timer by av: |
922 x=AV_delay*0.1f; | |
923 if(x<-max_pts_correction) x=-max_pts_correction; else | |
924 if(x> max_pts_correction) x= max_pts_correction; | |
925 if(default_max_pts_correction>=0) | |
926 max_pts_correction=default_max_pts_correction; | |
927 else | |
928 max_pts_correction=sh_video->frametime*0.10; // +-10% of time | |
929 // sh_video->timer-=x; | |
930 c_total+=x; | |
2613 | 931 v_pts_corr+=x; |
4387 | 932 } |
2605 | 933 |
4387 | 934 // printf("A:%6.1f V:%6.1f A-V:%7.3f oAV:%7.3f diff:%7.3f ct:%7.3f vpc:%7.3f \r", |
935 // a_pts,v_pts,a_pts-v_pts, | |
936 // (float)(mux_a->timer-mux_v->timer), | |
937 // AV_delay, c_total, v_pts_corr ); | |
938 // printf("V:%6.1f \r", d_video->pts ); | |
2605 | 939 |
940 #if 0 | |
941 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%%\r", | |
942 a_pts,v_pts,a_pts-v_pts,c_total, | |
943 (int)sh_video->num_frames,(int)sh_video->num_frames_decoded, | |
944 (sh_video->timer>0.5)?(int)(100.0*video_time_usage/(double)sh_video->timer):0, | |
945 (sh_video->timer>0.5)?(int)(100.0*vout_time_usage/(double)sh_video->timer):0, | |
946 (sh_video->timer>0.5)?(100.0*audio_time_usage/(double)sh_video->timer):0 | |
947 ,cache_fill_status | |
948 ); | |
949 #endif | |
950 | |
4387 | 951 { float t=(GetTimerMS()-timer_start)*0.001f; |
952 float len=(demuxer->movi_end-demuxer->movi_start); | |
953 float p=len>1000 ? (float)(demuxer->filepos-demuxer->movi_start) / len : 0; | |
4393 | 954 if(!len && sh_audio && sh_audio->audio.dwLength>100){ |
955 p=(sh_audio->audio.dwSampleSize? ds_tell(sh_audio->ds)/sh_audio->audio.dwSampleSize : sh_audio->ds->pack_no) | |
956 / (float)(sh_audio->audio.dwLength); | |
957 } | |
4392
b50b2b0c65ea
status print fixes - DVD estimation worx, print remaining time instead of total
arpi
parents:
4388
diff
changeset
|
958 #if 0 |
b50b2b0c65ea
status print fixes - DVD estimation worx, print remaining time instead of total
arpi
parents:
4388
diff
changeset
|
959 mp_msg(MSGT_AVSYNC,MSGL_STATUS,"%d < %d < %d \r", |
b50b2b0c65ea
status print fixes - DVD estimation worx, print remaining time instead of total
arpi
parents:
4388
diff
changeset
|
960 (int)demuxer->movi_start, |
b50b2b0c65ea
status print fixes - DVD estimation worx, print remaining time instead of total
arpi
parents:
4388
diff
changeset
|
961 (int)demuxer->filepos, |
b50b2b0c65ea
status print fixes - DVD estimation worx, print remaining time instead of total
arpi
parents:
4388
diff
changeset
|
962 (int)demuxer->movi_end); |
b50b2b0c65ea
status print fixes - DVD estimation worx, print remaining time instead of total
arpi
parents:
4388
diff
changeset
|
963 #else |
4394 | 964 mp_msg(MSGT_AVSYNC,MSGL_STATUS,"Pos:%6.1fs %6df (%2d%%) %3dfps Trem:%4dmin %3dmb A-V:%5.3f [%d:%d]\r", |
4387 | 965 mux_v->timer, decoded_frameno, (int)(p*100), |
966 (t>1) ? (int)(decoded_frameno/t) : 0, | |
4392
b50b2b0c65ea
status print fixes - DVD estimation worx, print remaining time instead of total
arpi
parents:
4388
diff
changeset
|
967 (p>0.001) ? (int)((t/p-t)/60) : 0, |
4387 | 968 (p>0.001) ? (int)(ftell(muxer_f)/p/1024/1024) : 0, |
4394 | 969 v_pts_corr, |
970 (mux_v->timer>1) ? (int)(mux_v->size/mux_v->timer/125) : 0, | |
4427
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
971 (mux_a && mux_a->timer>1) ? (int)(mux_a->size/mux_a->timer/125) : 0 |
4387 | 972 ); |
4392
b50b2b0c65ea
status print fixes - DVD estimation worx, print remaining time instead of total
arpi
parents:
4388
diff
changeset
|
973 #endif |
4387 | 974 } |
975 | |
2605 | 976 fflush(stdout); |
977 | |
2531 | 978 |
979 | |
980 } // while(!eof) | |
981 | |
3357 | 982 #ifdef HAVE_MP3LAME |
983 // fixup CBR mp3 audio header: | |
3354 | 984 if(sh_audio && mux_a->codec==ACODEC_VBRMP3 && !lame_param_vbr){ |
985 mux_a->h.dwSampleSize=1; | |
986 mux_a->h.dwRate=mux_a->wf->nAvgBytesPerSec; | |
987 mux_a->h.dwScale=1; | |
988 printf("\n\nCBR audio effective bitrate: %8.3f kbit/s (%d bytes/sec)\n", | |
989 mux_a->h.dwRate*8.0f/1000.0f,mux_a->h.dwRate); | |
990 } | |
3357 | 991 #endif |
3354 | 992 |
2840
808fe0767cf8
fix typos - patch by Colin Marquardt <colin@marquardt-home.de>
pl
parents:
2825
diff
changeset
|
993 printf("\nWriting AVI index...\n"); |
2531 | 994 aviwrite_write_index(muxer,muxer_f); |
4377 | 995 muxer_f_size=ftell(muxer_f); |
2622 | 996 printf("Fixup AVI header...\n"); |
2531 | 997 fseek(muxer_f,0,SEEK_SET); |
998 aviwrite_write_header(muxer,muxer_f); // update header | |
4377 | 999 fclose(muxer_f); |
4368 | 1000 |
1001 if(out_video_codec==VCODEC_FRAMENO && mux_v->timer>100){ | |
4392
b50b2b0c65ea
status print fixes - DVD estimation worx, print remaining time instead of total
arpi
parents:
4388
diff
changeset
|
1002 printf("Recommended video bitrate for 650MB CD: %d\n",(int)((650*1024*1024-muxer_f_size)/mux_v->timer/125)); |
b50b2b0c65ea
status print fixes - DVD estimation worx, print remaining time instead of total
arpi
parents:
4388
diff
changeset
|
1003 printf("Recommended video bitrate for 700MB CD: %d\n",(int)((700*1024*1024-muxer_f_size)/mux_v->timer/125)); |
b50b2b0c65ea
status print fixes - DVD estimation worx, print remaining time instead of total
arpi
parents:
4388
diff
changeset
|
1004 printf("Recommended video bitrate for 800MB CD: %d\n",(int)((800*1024*1024-muxer_f_size)/mux_v->timer/125)); |
4368 | 1005 } |
1006 | |
4355 | 1007 printf("\nVideo stream: %8.3f kbit/s (%d bps) size: %d bytes %5.3f secs %d frames\n", |
1008 (float)(mux_v->size/mux_v->timer*8.0f/1000.0f), (int)(mux_v->size/mux_v->timer), mux_v->size, (float)mux_v->timer, decoded_frameno); | |
3361
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
1009 if(sh_audio) |
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
1010 printf("\nAudio stream: %8.3f kbit/s (%d bps) size: %d bytes %5.3f secs\n", |
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
1011 (float)(mux_a->size/mux_a->timer*8.0f/1000.0f), (int)(mux_a->size/mux_a->timer), mux_a->size, (float)mux_a->timer); |
5d70491f438c
new video codec: frameno (just the number of frame - for 3-pass encoding)
arpi
parents:
3357
diff
changeset
|
1012 |
2618 | 1013 if(stream) free_stream(stream); // kill cache thread |
1014 | |
3320
ac8b70dd5e45
use return 1; if interrupted - patch by Artur Skawina <skawina@geocities.com>
arpi
parents:
3240
diff
changeset
|
1015 return interrupted; |
2531 | 1016 } |
4159
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1017 |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1018 static int parse_end_at(struct config *conf, const char* param) |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1019 { |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1020 int i; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1021 |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1022 end_at_type = END_AT_NONE; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1023 |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1024 /* End at size parsing */ |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1025 { |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1026 char unit[4]; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1027 |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1028 end_at_type = END_AT_SIZE; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1029 |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1030 if(sscanf(param, "%d%3s", &end_at, unit) == 2) { |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1031 if(!strcasecmp(unit, "b")) |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1032 ; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1033 else if(!strcasecmp(unit, "kb")) |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1034 end_at *= 1024; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1035 else if(!strcasecmp(unit, "mb")) |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1036 end_at *= 1024*1024; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1037 else |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1038 end_at_type = END_AT_NONE; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1039 } |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1040 else |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1041 end_at_type = END_AT_NONE; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1042 } |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1043 |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1044 /* End at time parsing. This has to be last because of |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1045 * sscanf("%f", ...) below */ |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1046 if(end_at_type == END_AT_NONE) |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1047 { |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1048 int a,b; float d; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1049 |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1050 end_at_type = END_AT_TIME; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1051 |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1052 if (sscanf(param, "%d:%d:%f", &a, &b, &d) == 3) |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1053 end_at = 3600*a + 60*b + d; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1054 else if (sscanf(param, "%d:%f", &a, &d) == 2) |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1055 end_at = 60*a + d; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1056 else if (sscanf(param, "%f", &d) == 1) |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1057 end_at = d; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1058 else |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1059 end_at_type = END_AT_NONE; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1060 } |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1061 |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1062 if(end_at_type == END_AT_NONE) |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1063 return ERR_FUNC_ERR; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1064 |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1065 return 1; |
42fec596fe7c
-endpos option, patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4156
diff
changeset
|
1066 } |
4427
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
1067 |
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
1068 /* Flip the image in src and store the result in dst. src and dst may overlap. |
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
1069 width is the size of each line in bytes. */ |
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
1070 static uint8_t* flip_upside_down(uint8_t* dst, const uint8_t* src, int width, |
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
1071 int height) |
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
1072 { |
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
1073 uint8_t* tmp = malloc(width); |
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
1074 int i; |
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
1075 |
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
1076 for(i = 0; i < height/2; i++) { |
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
1077 memcpy(tmp, &src[i*width], width); |
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
1078 memcpy(&dst[i * width], &src[(height - i) * width], width); |
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
1079 memcpy(&dst[(height - i) * width], tmp, width); |
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
1080 } |
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
1081 |
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
1082 free(tmp); |
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
1083 return dst; |
6310422b9557
new video format: yuvrgb. patch by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
4408
diff
changeset
|
1084 } |
5270 | 1085 |