From: Christophe Massiot Date: Thu, 27 Nov 2003 22:44:51 +0000 (+0000) Subject: * modules/stream_out/transcode.c: new options X-Git-Tag: 0.7.0~313 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=698fe2a987c57710be913bb78779252d6bcf9654;p=vlc * modules/stream_out/transcode.c: new options - strict_rc : strict rate control mode for CBR streams - pre_me : add a pre-motion estimation pass - hurry_up : allow to discard the hq mode in real-time if we're late * modules/mux/mpeg/ts.c: useful debug messages * modules/packetizer/mpegvideo.c: useless debug message --- diff --git a/include/vlc_codec.h b/include/vlc_codec.h index 452cabc269..a3960ce119 100644 --- a/include/vlc_codec.h +++ b/include/vlc_codec.h @@ -2,7 +2,7 @@ * vlc_codec.h: codec related structures ***************************************************************************** * Copyright (C) 1999-2003 VideoLAN - * $Id: vlc_codec.h,v 1.6 2003/11/24 23:22:01 gbazin Exp $ + * $Id: vlc_codec.h,v 1.7 2003/11/27 22:44:50 massiot Exp $ * * Authors: Gildas Bazin * @@ -115,7 +115,9 @@ struct encoder_t int i_qmin; int i_qmax; int i_hq; - + vlc_bool_t b_strict_rc; + vlc_bool_t b_pre_me; + vlc_bool_t b_hurry_up; }; /** diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c index ce3c81d5f3..1a3fb6c6a5 100644 --- a/modules/mux/mpeg/ts.c +++ b/modules/mux/mpeg/ts.c @@ -2,7 +2,7 @@ * ts.c: MPEG-II TS Muxer ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: ts.c,v 1.40 2003/11/27 19:39:53 fenrir Exp $ + * $Id: ts.c,v 1.41 2003/11/27 22:44:50 massiot Exp $ * * Authors: Laurent Aimar * Eric Petit @@ -405,8 +405,6 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) sout_mux_sys_t *p_sys = p_mux->p_sys; ts_stream_t *p_stream; - msg_Dbg( p_mux, "adding input codec=%4.4s", (char*)&p_input->p_fmt->i_codec ); - p_input->p_sys = (void*)p_stream = malloc( sizeof( ts_stream_t ) ); /* Init this new stream */ @@ -415,6 +413,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) p_stream->i_decoder_specific_info = 0; p_stream->p_decoder_specific_info = NULL; + msg_Dbg( p_mux, "adding input codec=%4.4s pid=%d", (char*)&p_input->p_fmt->i_codec, p_stream->i_pid ); + /* All others fields depand on codec */ switch( p_input->p_fmt->i_cat ) { @@ -537,6 +537,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) } p_sys->i_pcr_pid = p_stream->i_pid; p_sys->p_pcr_input = p_input; + + msg_Dbg( p_mux, "new PCR PID is %d", p_sys->i_pcr_pid ); } return VLC_SUCCESS; @@ -551,8 +553,8 @@ static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input ) ts_stream_t *p_stream; char *val; - msg_Dbg( p_mux, "removing input" ); p_stream = (ts_stream_t*)p_input->p_sys; + msg_Dbg( p_mux, "removing input pid=%d", p_stream->i_pid ); if( p_sys->i_pcr_pid == p_stream->i_pid ) { @@ -588,6 +590,7 @@ static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input ) /* Empty TS buffer */ /* FIXME */ } + msg_Dbg( p_mux, "new PCR PID is %d", p_sys->i_pcr_pid ); } /* Empty all data in chain_pes */ @@ -607,6 +610,7 @@ static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input ) if ( i_pid_video == p_stream->i_pid ) { p_sys->i_pid_video = i_pid_video; + msg_Dbg( p_mux, "freeing video PID %d", i_pid_video ); } } if( ( val = sout_cfg_find_value( p_mux->p_cfg, "pid-audio" ) ) ) @@ -615,6 +619,7 @@ static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input ) if ( i_pid_audio == p_stream->i_pid ) { p_sys->i_pid_audio = i_pid_audio; + msg_Dbg( p_mux, "freeing audio PID %d", i_pid_audio ); } } free( p_stream ); diff --git a/modules/packetizer/mpegvideo.c b/modules/packetizer/mpegvideo.c index 21f6da9da4..ff3815a8ec 100644 --- a/modules/packetizer/mpegvideo.c +++ b/modules/packetizer/mpegvideo.c @@ -2,7 +2,7 @@ * mpegvideo.c ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: mpegvideo.c,v 1.22 2003/11/22 16:53:02 fenrir Exp $ + * $Id: mpegvideo.c,v 1.23 2003/11/27 22:44:50 massiot Exp $ * * Authors: Laurent Aimar * Eric Petit @@ -434,10 +434,12 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block ) p_sys->b_seq_progressive = VLC_TRUE; p_sys->b_low_delay = VLC_TRUE; +#if 0 msg_Dbg( p_dec, "Size %dx%d fps=%.3f", p_dec->fmt_out.video.i_width, p_dec->fmt_out.video.i_height, (float)p_sys->i_frame_rate / (float)p_sys->i_frame_rate_base ); +#endif } else if( p_frag->p_buffer[3] == 0xb5 ) { diff --git a/modules/stream_out/transcode.c b/modules/stream_out/transcode.c index 12bcd1db0c..00be42e59e 100644 --- a/modules/stream_out/transcode.c +++ b/modules/stream_out/transcode.c @@ -2,7 +2,7 @@ * transcode.c ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: transcode.c,v 1.54 2003/11/27 10:34:51 gbazin Exp $ + * $Id: transcode.c,v 1.55 2003/11/27 22:44:51 massiot Exp $ * * Authors: Laurent Aimar * Gildas Bazin @@ -102,6 +102,9 @@ struct sout_stream_sys_t int i_qmax; vlc_bool_t i_hq; vlc_bool_t b_deinterlace; + vlc_bool_t b_strict_rc; + vlc_bool_t b_pre_me; + vlc_bool_t b_hurry_up; int i_crop_top; int i_crop_bottom; @@ -214,6 +217,18 @@ static int Open( vlc_object_t *p_this ) { p_sys->b_deinterlace = VLC_TRUE; } + if( sout_cfg_find( p_stream->p_cfg, "strict_rc" ) ) + { + p_sys->b_strict_rc = VLC_TRUE; + } + if( sout_cfg_find( p_stream->p_cfg, "pre_me" ) ) + { + p_sys->b_pre_me = VLC_TRUE; + } + if( sout_cfg_find( p_stream->p_cfg, "hurry_up" ) ) + { + p_sys->b_hurry_up = VLC_TRUE; + } /* crop */ if( ( val = sout_cfg_find_value( p_stream->p_cfg, "croptop" ) ) ) { @@ -1058,6 +1073,9 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream, id->p_encoder->i_qmin = p_sys->i_qmin; id->p_encoder->i_qmax = p_sys->i_qmax; id->p_encoder->i_hq = p_sys->i_hq; + id->p_encoder->b_strict_rc = p_sys->b_strict_rc; + id->p_encoder->b_pre_me = p_sys->b_pre_me; + id->p_encoder->b_hurry_up = p_sys->b_hurry_up; id->p_ff_pic = avcodec_alloc_frame(); id->p_ff_pic_tmp0 = NULL; @@ -1363,6 +1381,10 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream, /* Set the pts of the frame being encoded */ pic.date = p_sys->i_output_pts; + pic.b_progressive = 1; /* ffmpeg doesn't support interlaced encoding */ + pic.i_nb_fields = frame->repeat_pict; + pic.b_top_field_first = frame->top_field_first; + /* Interpolate the next PTS * (needed by the mpeg video packetizer which can send pts <= 0 ) */ if( id->ff_dec_c && id->ff_dec_c->frame_rate > 0 )