Ticket #51578: ffmpeg3_compat.patch

File ffmpeg3_compat.patch, 2.2 KB (added by jjstickel (Jonathan Stickel), 8 years ago)
  • VTK/IO/FFMPEG/vtkFFMPEGWriter.cxx

    int vtkFFMPEGWriterInternal::Start() 
    191191  c->height = this->Dim[1];
    192192  if (this->Writer->GetCompression())
    193193    {
    194     c->pix_fmt = PIX_FMT_YUVJ422P;
     194    c->pix_fmt = AV_PIX_FMT_YUVJ422P;
    195195    }
    196196  else
    197197    {
    198     c->pix_fmt = PIX_FMT_BGR24;
     198    c->pix_fmt = AV_PIX_FMT_BGR24;
    199199    }
    200200
    201201  //to do playback at actual recorded rate, this will need more work see also below
    int vtkFFMPEGWriterInternal::Start() 
    274274#endif
    275275
    276276  //for the output of the writer's input...
    277   this->rgbInput = avcodec_alloc_frame();
     277  this->rgbInput = av_frame_alloc();
    278278  if (!this->rgbInput)
    279279    {
    280280    vtkGenericWarningMacro (<< "Could not make rgbInput avframe." );
    281281    return 0;
    282282    }
    283   int RGBsize = avpicture_get_size(PIX_FMT_RGB24, c->width, c->height);
     283  int RGBsize = avpicture_get_size(AV_PIX_FMT_RGB24, c->width, c->height);
    284284  unsigned char *rgb = (unsigned char *)av_malloc(sizeof(unsigned char) * RGBsize);
    285285  if (!rgb)
    286286    {
    int vtkFFMPEGWriterInternal::Start() 
    288288    return 0;
    289289    }
    290290  //The rgb buffer should get deleted when this->rgbInput is.
    291   avpicture_fill((AVPicture *)this->rgbInput, rgb, PIX_FMT_RGB24, c->width, c->height);
     291  avpicture_fill((AVPicture *)this->rgbInput, rgb, AV_PIX_FMT_RGB24, c->width, c->height);
    292292
    293293  //and for the output to the codec's input.
    294   this->yuvOutput = avcodec_alloc_frame();
     294  this->yuvOutput = av_frame_alloc();
    295295  if (!this->yuvOutput)
    296296    {
    297297    vtkGenericWarningMacro (<< "Could not make yuvOutput avframe." );
    int vtkFFMPEGWriterInternal::Write(vtkImageData *id) 
    349349  //convert that to YUV for input to the codec
    350350#ifdef VTK_FFMPEG_HAS_IMG_CONVERT
    351351  img_convert((AVPicture *)this->yuvOutput, cc->pix_fmt,
    352               (AVPicture *)this->rgbInput, PIX_FMT_RGB24,
     352              (AVPicture *)this->rgbInput, AV_PIX_FMT_RGB24,
    353353              cc->width, cc->height);
    354354#else
    355355  //convert that to YUV for input to the codec
    356356  SwsContext* convert_ctx = sws_getContext(
    357     cc->width, cc->height, PIX_FMT_RGB24,
     357    cc->width, cc->height, AV_PIX_FMT_RGB24,
    358358    cc->width, cc->height, cc->pix_fmt,
    359359    SWS_BICUBIC, NULL, NULL, NULL);
    360360