Advertisement
Guest User

Untitled

a guest
Apr 21st, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1.       avcodec_decode_video2(codecCtx, frame, &frameFinished, &pkt);
  2.       if(frameFinished){
  3.         //(pFrame->data[0]+y*pFrame->linesize[0], 1, pFrame->linesize[0], pFile);
  4.        
  5.         struct SwsContext* convertCtx;
  6.         //This can be improved significantly
  7.         convertCtx = sws_getContext(codecCtx->width, codecCtx->height, codecCtx->pix_fmt,
  8.                                 32,  18,  AV_PIX_FMT_RGB32, 0, 0, 0, 0);
  9.      
  10.         size_t allocSize = av_image_get_buffer_size(codecCtx->pix_fmt, codecCtx->width, codecCtx->height, 4);
  11.         uint8_t *outData[1];
  12.         outData[0] = (uint8_t*) malloc(allocSize);
  13.         int outLinesize;
  14.  
  15.         sws_scale(convertCtx, frame->data, frame->linesize, 0, 18, outData, &outLinesize);
  16.  
  17.         sws_freeContext(convertCtx);
  18.    
  19.         FramesIn.push(outData[1]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement