Commit 698fe2a9 authored by Christophe Massiot's avatar Christophe Massiot

* 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
parent 02ddcc7d
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vlc_codec.h: codec related structures * vlc_codec.h: codec related structures
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2003 VideoLAN * 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 <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -115,7 +115,9 @@ struct encoder_t ...@@ -115,7 +115,9 @@ struct encoder_t
int i_qmin; int i_qmin;
int i_qmax; int i_qmax;
int i_hq; int i_hq;
vlc_bool_t b_strict_rc;
vlc_bool_t b_pre_me;
vlc_bool_t b_hurry_up;
}; };
/** /**
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ts.c: MPEG-II TS Muxer * ts.c: MPEG-II TS Muxer
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * 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 <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org> * Eric Petit <titer@videolan.org>
...@@ -405,8 +405,6 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -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; sout_mux_sys_t *p_sys = p_mux->p_sys;
ts_stream_t *p_stream; 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 ) ); p_input->p_sys = (void*)p_stream = malloc( sizeof( ts_stream_t ) );
/* Init this new stream */ /* Init this new stream */
...@@ -415,6 +413,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -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->i_decoder_specific_info = 0;
p_stream->p_decoder_specific_info = NULL; 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 */ /* All others fields depand on codec */
switch( p_input->p_fmt->i_cat ) switch( p_input->p_fmt->i_cat )
{ {
...@@ -537,6 +537,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -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->i_pcr_pid = p_stream->i_pid;
p_sys->p_pcr_input = p_input; p_sys->p_pcr_input = p_input;
msg_Dbg( p_mux, "new PCR PID is %d", p_sys->i_pcr_pid );
} }
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -551,8 +553,8 @@ static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -551,8 +553,8 @@ static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input )
ts_stream_t *p_stream; ts_stream_t *p_stream;
char *val; char *val;
msg_Dbg( p_mux, "removing input" );
p_stream = (ts_stream_t*)p_input->p_sys; 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 ) 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 ) ...@@ -588,6 +590,7 @@ static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input )
/* Empty TS buffer */ /* Empty TS buffer */
/* FIXME */ /* FIXME */
} }
msg_Dbg( p_mux, "new PCR PID is %d", p_sys->i_pcr_pid );
} }
/* Empty all data in chain_pes */ /* Empty all data in chain_pes */
...@@ -607,6 +610,7 @@ static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -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 ) if ( i_pid_video == p_stream->i_pid )
{ {
p_sys->i_pid_video = i_pid_video; 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" ) ) ) 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 ) ...@@ -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 ) if ( i_pid_audio == p_stream->i_pid )
{ {
p_sys->i_pid_audio = i_pid_audio; p_sys->i_pid_audio = i_pid_audio;
msg_Dbg( p_mux, "freeing audio PID %d", i_pid_audio );
} }
} }
free( p_stream ); free( p_stream );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mpegvideo.c * mpegvideo.c
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * 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 <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org> * Eric Petit <titer@videolan.org>
...@@ -434,10 +434,12 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block ) ...@@ -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_seq_progressive = VLC_TRUE;
p_sys->b_low_delay = VLC_TRUE; p_sys->b_low_delay = VLC_TRUE;
#if 0
msg_Dbg( p_dec, "Size %dx%d fps=%.3f", msg_Dbg( p_dec, "Size %dx%d fps=%.3f",
p_dec->fmt_out.video.i_width, p_dec->fmt_out.video.i_width,
p_dec->fmt_out.video.i_height, p_dec->fmt_out.video.i_height,
(float)p_sys->i_frame_rate / (float)p_sys->i_frame_rate_base ); (float)p_sys->i_frame_rate / (float)p_sys->i_frame_rate_base );
#endif
} }
else if( p_frag->p_buffer[3] == 0xb5 ) else if( p_frag->p_buffer[3] == 0xb5 )
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* transcode.c * transcode.c
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * 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 <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com> * Gildas Bazin <gbazin@netcourrier.com>
...@@ -102,6 +102,9 @@ struct sout_stream_sys_t ...@@ -102,6 +102,9 @@ struct sout_stream_sys_t
int i_qmax; int i_qmax;
vlc_bool_t i_hq; vlc_bool_t i_hq;
vlc_bool_t b_deinterlace; 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_top;
int i_crop_bottom; int i_crop_bottom;
...@@ -214,6 +217,18 @@ static int Open( vlc_object_t *p_this ) ...@@ -214,6 +217,18 @@ static int Open( vlc_object_t *p_this )
{ {
p_sys->b_deinterlace = VLC_TRUE; 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 */ /* crop */
if( ( val = sout_cfg_find_value( p_stream->p_cfg, "croptop" ) ) ) 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, ...@@ -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_qmin = p_sys->i_qmin;
id->p_encoder->i_qmax = p_sys->i_qmax; id->p_encoder->i_qmax = p_sys->i_qmax;
id->p_encoder->i_hq = p_sys->i_hq; 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 = avcodec_alloc_frame();
id->p_ff_pic_tmp0 = NULL; id->p_ff_pic_tmp0 = NULL;
...@@ -1363,6 +1381,10 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream, ...@@ -1363,6 +1381,10 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
/* Set the pts of the frame being encoded */ /* Set the pts of the frame being encoded */
pic.date = p_sys->i_output_pts; 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 /* Interpolate the next PTS
* (needed by the mpeg video packetizer which can send pts <= 0 ) */ * (needed by the mpeg video packetizer which can send pts <= 0 ) */
if( id->ff_dec_c && id->ff_dec_c->frame_rate > 0 ) if( id->ff_dec_c && id->ff_dec_c->frame_rate > 0 )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment