--- modules/stream_out/switcher.c.old 2012-03-20 22:28:07.167715332 +0800 +++ modules/stream_out/switcher.c 2012-03-20 22:41:23.994454082 +0800 @@ -292,7 +292,6 @@ p_stream->pf_send = Send; p_stream->p_sys = p_sys; - avcodec_init(); avcodec_register_all(); return VLC_SUCCESS; @@ -355,7 +354,7 @@ return NULL; } - id->ff_enc_c = avcodec_alloc_context(); + id->ff_enc_c = avcodec_alloc_context3( NULL ); /* Set CPU capabilities */ unsigned i_cpu = vlc_CPU(); @@ -388,7 +387,7 @@ id->ff_enc_c->bit_rate = p_fmt->i_bitrate; vlc_avcodec_lock(); - if( avcodec_open( id->ff_enc_c, id->ff_enc ) ) + if( avcodec_open2( id->ff_enc_c, id->ff_enc, NULL ) ) { vlc_avcodec_unlock(); msg_Err( p_stream, "cannot open encoder" ); @@ -748,7 +747,7 @@ return 0; } - id->ff_enc_c = avcodec_alloc_context(); + id->ff_enc_c = avcodec_alloc_context3( NULL ); /* Set CPU capabilities */ unsigned i_cpu = vlc_CPU(); @@ -844,7 +843,7 @@ if ( id->i_nb_pred >= p_sys->i_gop ) { - id->p_frame->pict_type = FF_I_TYPE; + id->p_frame->pict_type = AV_PICTURE_TYPE_I; #if 0 id->p_frame->me_threshold = 0; id->p_frame->mb_threshold = 0; @@ -853,7 +852,7 @@ } else { - id->p_frame->pict_type = FF_P_TYPE; + id->p_frame->pict_type = AV_PICTURE_TYPE_P; #if 0 if ( id->p_frame->mb_type != NULL ) { @@ -873,7 +872,7 @@ #if 0 if ( id->p_frame->mb_type == NULL - && id->ff_enc_c->coded_frame->pict_type != FF_I_TYPE ) + && id->ff_enc_c->coded_frame->pict_type != AV_PICTURE_TYPE_I ) { int mb_width = (id->ff_enc_c->width + 15) / 16; int mb_height = (id->ff_enc_c->height + 15) / 16; @@ -926,13 +925,13 @@ switch ( id->ff_enc_c->coded_frame->pict_type ) { - case FF_I_TYPE: + case AV_PICTURE_TYPE_I: p_out->i_flags |= BLOCK_FLAG_TYPE_I; break; - case FF_P_TYPE: + case AV_PICTURE_TYPE_P: p_out->i_flags |= BLOCK_FLAG_TYPE_P; break; - case FF_B_TYPE: + case AV_PICTURE_TYPE_B: p_out->i_flags |= BLOCK_FLAG_TYPE_B; break; default: