--- mpeg4ip-1.5.0.1/player/plugin/audio/ffmpeg/ffmpeg.cpp.libav 2014-01-13 17:46:26.110549997 +0000 +++ mpeg4ip-1.5.0.1/player/plugin/audio/ffmpeg/ffmpeg.cpp 2014-01-13 17:53:09.571478201 +0000 @@ -134,7 +134,6 @@ static codec_data_t *ffmpeg_create (cons ffmpeg->m_vft = vft; ffmpeg->m_ifptr = ifptr; - avcodec_init(); avcodec_register_all(); ffmpeg->m_codecId = ffmpeg_find_codec(stream_type, compressor, type, @@ -142,7 +141,7 @@ static codec_data_t *ffmpeg_create (cons // must have a codecID - we checked it earlier ffmpeg->m_codec = avcodec_find_decoder(ffmpeg->m_codecId); - ffmpeg->m_c = avcodec_alloc_context(); + ffmpeg->m_c = avcodec_alloc_context3(ffmpeg->m_codec); if (ainfo != NULL) { ffmpeg->m_c->channels = ainfo->chans; @@ -169,7 +168,7 @@ static codec_data_t *ffmpeg_create (cons ffmpeg->m_c->extradata = (uint8_t *)userdata; ffmpeg->m_c->extradata_size = ud_size; } - if (avcodec_open(ffmpeg->m_c, ffmpeg->m_codec) < 0) { + if (avcodec_open2(ffmpeg->m_c, ffmpeg->m_codec, NULL) < 0) { ffmpeg_message(LOG_CRIT, "ffmpeg", "failed to open codec"); return NULL; } @@ -282,7 +281,6 @@ static int ffmpeg_codec_check (lib_messa { enum CodecID fcodec; AVCodec *c; - avcodec_init(); avcodec_register_all(); fcodec = ffmpeg_find_codec(stream_type, compressor, type, profile, --- mpeg4ip-1.5.0.1/player/plugin/video/ffmpeg/ffmpeg.cpp.libav 2014-01-13 17:55:19.515642035 +0000 +++ mpeg4ip-1.5.0.1/player/plugin/video/ffmpeg/ffmpeg.cpp 2014-01-13 18:00:02.040796327 +0000 @@ -171,7 +171,6 @@ static codec_data_t *ffmpeg_create (cons ffmpeg->m_vft = vft; ffmpeg->m_ifptr = ifptr; - avcodec_init(); avcodec_register_all(); av_log_set_level(AV_LOG_QUIET); @@ -180,7 +179,7 @@ static codec_data_t *ffmpeg_create (cons // must have a codecID - we checked it earlier ffmpeg->m_codec = avcodec_find_decoder(ffmpeg->m_codecId); - ffmpeg->m_c = avcodec_alloc_context(); + ffmpeg->m_c = avcodec_alloc_context3(ffmpeg->m_codec); ffmpeg->m_picture = avcodec_alloc_frame(); bool open_codec = true; bool run_userdata = false; @@ -266,7 +265,7 @@ static codec_data_t *ffmpeg_create (cons break; } if (open_codec) { - if (avcodec_open(ffmpeg->m_c, ffmpeg->m_codec) < 0) { + if (avcodec_open2(ffmpeg->m_c, ffmpeg->m_codec, NULL) < 0) { ffmpeg_message(LOG_CRIT, "ffmpeg", "failed to open codec"); return NULL; } @@ -401,7 +400,7 @@ static int ffmpeg_decode (codec_data_t * break; } if (open_codec) { - if (avcodec_open(ffmpeg->m_c, ffmpeg->m_codec) < 0) { + if (avcodec_open2(ffmpeg->m_c, ffmpeg->m_codec, NULL) < 0) { ffmpeg_message(LOG_CRIT, "ffmpeg", "failed to open codec"); return buflen; } @@ -624,7 +623,6 @@ static int ffmpeg_codec_check (lib_messa { enum CodecID fcodec; AVCodec *c; - avcodec_init(); avcodec_register_all(); av_log_set_level(AV_LOG_QUIET); fcodec = ffmpeg_find_codec(stream_type, compressor, type, profile, --- mpeg4ip-1.5.0.1/server/mp4live/audio_ffmpeg.cpp.libav 2014-01-13 18:02:36.833759002 +0000 +++ mpeg4ip-1.5.0.1/server/mp4live/audio_ffmpeg.cpp 2014-01-13 18:07:54.419940838 +0000 @@ -447,7 +447,6 @@ bool CFfmpegAudioEncoder::Init (void) { const char *encoding = Profile()->GetStringValue(CFG_AUDIO_ENCODING); - avcodec_init(); avcodec_register_all(); if (strcasecmp(encoding,AUDIO_ENCODING_MP3) == 0) { @@ -477,7 +476,7 @@ bool CFfmpegAudioEncoder::Init (void) error_message("Couldn't find audio codec"); return false; } - m_avctx = avcodec_alloc_context(); + m_avctx = avcodec_alloc_context3(m_codec); m_frame = avcodec_alloc_frame(); m_avctx->codec_type = AVMEDIA_TYPE_AUDIO; @@ -515,7 +514,7 @@ bool CFfmpegAudioEncoder::Init (void) m_avctx->sample_rate = Profile()->GetIntegerValue(CFG_AUDIO_SAMPLE_RATE); m_avctx->channels = Profile()->GetIntegerValue(CFG_AUDIO_CHANNELS); - if (avcodec_open(m_avctx, m_codec) < 0) { + if (avcodec_open2(m_avctx, m_codec, NULL) < 0) { error_message("Couldn't open ffmpeg codec"); return false; } @@ -647,7 +646,6 @@ void InitFFmpegAudio (void) AddAudioEncoderTable(&ffmpeg_alaw_audio_encoder_table); AddAudioEncoderTable(&ffmpeg_ulaw_audio_encoder_table); #ifdef MAY_HAVE_AMR_CODEC - avcodec_init(); avcodec_register_all(); bool have_amr_nb = avcodec_find_encoder(CODEC_ID_AMR_NB) != NULL; bool have_amr_wb = avcodec_find_encoder(CODEC_ID_AMR_WB) != NULL; --- mpeg4ip-1.5.0.1/server/mp4live/video_ffmpeg.cpp.libav 2014-01-13 18:02:36.833759002 +0000 +++ mpeg4ip-1.5.0.1/server/mp4live/video_ffmpeg.cpp 2014-01-13 18:16:33.840593502 +0000 @@ -69,7 +69,6 @@ CFfmpegVideoEncoder::CFfmpegVideoEncoder bool CFfmpegVideoEncoder::Init (void) { - avcodec_init(); avcodec_register_all(); if (m_push != NULL) { @@ -110,7 +109,7 @@ bool CFfmpegVideoEncoder::Init (void) return false; } - m_avctx = avcodec_alloc_context(); + m_avctx = avcodec_alloc_context3(m_codec); m_picture = avcodec_alloc_frame(); m_avctx->width = Profile()->m_videoWidth; m_avctx->height = Profile()->m_videoHeight; @@ -182,7 +181,7 @@ bool CFfmpegVideoEncoder::Init (void) debug_message("key frame count is %d", m_key_frame_count); } m_count = 0; - if (avcodec_open(m_avctx, m_codec) < 0) { + if (avcodec_open2(m_avctx, m_codec, NULL) < 0) { error_message("Couldn't open codec"); return false; } @@ -213,7 +212,7 @@ bool CFfmpegVideoEncoder::EncodeImage( m_count = 0; } } - if (wantKeyFrame) m_picture->pict_type = FF_I_TYPE; //m_picture->key_frame = 1; + if (wantKeyFrame) m_picture->pict_type = AV_PICTURE_TYPE_I; //m_picture->key_frame = 1; else //m_picture->key_frame = 0; m_picture->pict_type = AV_PICTURE_TYPE_I;