summaryrefslogtreecommitdiffstats
path: root/mencoder.c
diff options
context:
space:
mode:
authorhenry <henry@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-03-01 20:21:58 +0000
committerhenry <henry@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-03-01 20:21:58 +0000
commit18abbb69a1198ab205444219aad830d20a8acd9c (patch)
treea0a29016c7a1d17bc8e7cdac20108975f73b1608 /mencoder.c
parent9bc6e8097212e5358a0dce1dda158b0f05e017d9 (diff)
downloadmpv-18abbb69a1198ab205444219aad830d20a8acd9c.tar.bz2
mpv-18abbb69a1198ab205444219aad830d20a8acd9c.tar.xz
fixes for encoding of multiple files
- do not uninitialize video encoder between files - checks for image size & format change moved from mencoder.c to vfilters by Oded Shimon <ods15@ods15.dyndns.org> git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14879 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mencoder.c')
-rw-r--r--mencoder.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/mencoder.c b/mencoder.c
index 016dac2977..78a5e22992 100644
--- a/mencoder.c
+++ b/mencoder.c
@@ -392,8 +392,6 @@ char* frameno_filename="frameno.avi";
int decoded_frameno=0;
int next_frameno=-1;
int curfile=0;
-int prevwidth = 0;
-int prevhieght = 0; ///< When different from 0, after decoding a frame, Resolution must be checked to match previous file
unsigned int timer_start;
@@ -739,8 +737,9 @@ case VCODEC_FRAMENO:
mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8);
}
break;
-default:
-
+default: {
+ static vf_instance_t * ve = NULL;
+ if (!ve) {
switch(mux_v->codec){
case VCODEC_DIVX4:
sh_video->vfilter=vf_open_encoder(NULL,"divx4",(char *)mux_v); break;
@@ -765,6 +764,8 @@ default:
mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_EncoderOpenFailed);
mencoder_exit(1,NULL);
}
+ ve = sh_video->vfilter;
+ } else sh_video->vfilter = ve;
// append 'expand' filter, it fixes stride problems and renders osd:
if (auto_expand) {
char* vf_args[] = { "osd", "1", NULL };
@@ -776,7 +777,7 @@ default:
init_best_video_codec(sh_video,video_codec_list,video_fm_list);
mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n");
if(!sh_video->inited) mencoder_exit(1,NULL);
-
+ }
}
if (!curfile) {
@@ -1544,13 +1545,7 @@ default:
blit_frame=decode_video(sh_video,start,in_size,
skip_flag>0 && (!sh_video->vfilter || ((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter, VFCTRL_SKIP_NEXT_FRAME, 0) != CONTROL_TRUE));
- if (prevwidth) {
- if ((mux_v->bih->biWidth != prevwidth) || (mux_v->bih->biHeight != prevhieght)) {
- mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_ResolutionDoesntMatch);
- mencoder_exit(1,NULL);
- }
- prevhieght = prevwidth = 0;
- }
+ if (sh_video->vf_inited < 0) mencoder_exit(1, NULL);
if(!blit_frame){
badframes++;
@@ -1724,28 +1719,33 @@ if(sh_audio && !demuxer2){
} // while(!at_eof)
-/* Emit the remaining frames in the video system */
-/*TODO emit frmaes delayed by decoder lag*/
- if(sh_video && sh_video->vfilter){
- mp_msg(MSGT_FIXME, MSGL_FIXME, "\nFlushing video frames\n");
- ((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter,
- VFCTRL_FLUSH_FRAMES, 0);
- }
-
if (!interrupted && filelist[++curfile].name != 0) {
+ // Before uniniting sh_video and the filter chain, break apart the VE.
+ vf_instance_t * ve; // this will be the filter right before the ve.
+ for (ve = sh_video->vfilter; ve->next && ve->next->next; ve = ve->next);
+ if (ve->next)
+ ve->next = NULL; // I'm telling the last filter, before the VE, there is nothing after it
+ else // There is no chain except the VE.
+ sh_video->vfilter = NULL;
+
if(sh_video){ uninit_video(sh_video);sh_video=NULL; }
if(demuxer) free_demuxer(demuxer);
if(stream) free_stream(stream); // kill cache thread
- prevwidth = mux_v->bih->biWidth;
- prevhieght = mux_v->bih->biHeight;
-
at_eof = 0;
m_config_pop(mconfig);
goto play_next_file;
}
+/* Emit the remaining frames in the video system */
+/*TODO emit frmaes delayed by decoder lag*/
+if(sh_video && sh_video->vfilter){
+ mp_msg(MSGT_MENCODER, MSGL_INFO, "\nFlushing video frames\n");
+ ((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter,
+ VFCTRL_FLUSH_FRAMES, 0);
+}
+
#ifdef HAVE_MP3LAME
// fixup CBR mp3 audio header:
if(sh_audio && mux_a->codec==ACODEC_VBRMP3 && !lame_param_vbr){