title: What's the replacement for the avcodec_thread_init?
body: <p>I am using ffmpeg to encode/decode videos.
  I used a old version in the past, but recently I switched a new version and found that many ffmpeg functions are non-longer in use.</p>
  
  <p>Here is my old code:</p>
  
  <pre><code> pCodecCtx=pVideoStream-&gt;codec;
     pCodecCtx-&gt;codec_id = pOutputFormat-&gt;video_codec;
     pCodecCtx-&gt;codec_type = ffmpeg::AVMEDIA_TYPE_VIDEO;
  
     pCodecCtx-&gt;bit_rate = Bitrate;
     pCodecCtx-&gt;width = getWidth();
     pCodecCtx-&gt;height = getHeight();
     pCodecCtx-&gt;time_base.den = fps;
     pCodecCtx-&gt;time_base.num = 1;
     pCodecCtx-&gt;gop_size = Gop;
     pCodecCtx-&gt;pix_fmt = ffmpeg::PIX_FMT_YUV420P;
  
  
     avcodec_thread_init(pCodecCtx, 10);
  
     //if (c-&gt;codec_id == CODEC_ID_MPEG2VIDEO)
     //{
        //c-&gt;max_b_frames = 2;  // just for testing, we also add B frames
     //}
  
     // some formats want stream headers to be separate
     if(pFormatCtx-&gt;oformat-&gt;flags &amp; AVFMT_GLOBALHEADER)
        pCodecCtx-&gt;flags |= CODEC_FLAG_GLOBAL_HEADER;
  
  
     if (av_set_parameters(pFormatCtx, NULL) &lt; 0)
     {
        printf("Invalid output format parameters\n");
        return false;
     }
  
     ffmpeg::dump_format(pFormatCtx, 0, fileName.toStdString().c_str(), 1);
  
     // open_video
     // find the video encoder
     pCodec = avcodec_find_encoder(pCodecCtx-&gt;codec_id);
     if (!pCodec)
     {
        printf("codec not found\n");
        return false;
     }
     // open the codec
     if (avcodec_open(pCodecCtx, pCodec) &lt; 0)
     {
        printf("could not open codec\n");
        return false;
     }
  
     // Allocate memory for output
     if(!initOutputBuf())
     {
        printf("Can't allocate memory for output bitstream\n");
        return false;
     }
  
     // Allocate the YUV frame
     if(!initFrame())
     {
        printf("Can't init frame\n");
        return false;
     }
  
     if (url_fopen(&amp;pFormatCtx-&gt;pb, fileName.toStdString().c_str(), URL_WRONLY) &lt; 0)
     {
        printf( "Could not open '%s'\n", fileName.toStdString().c_str());
        return false;
     }
  
     av_write_header(pFormatCtx);
  </code></pre>
  
  <p>Here, <code>avcodec_thread_init</code> is no-longer in use and I cannot find anyhints about what function I should use to replace it? Any ideas?</p>