title: How can I use ffmpeg's swscale to convert from NV12 to RGB32?
body: <p>Say I have an NV12 frame in memory as an array of bytes. I know:</p>
  
  <ul>
  <li>its Width and Height</li>
  <li>its Stride (total width of a line including padding), which is the same for Y and UV components as per NV12 specification</li>
  <li>I know where Y begins, U begins at Y + (Stride * Height), and V begins at U + 1 (interleaved with U).</li>
  </ul>
  
  <p>Now this is what I have so far:</p>
  
  <pre><code>SwsContext* context = sws_getContext(frameWidth, frameHeight, AV_PIX_FMT_NV12, frameWidth, frameHeight, AV_PIX_FMT_RGB32, 0, nullptr, nullptr, nullptr);
  sws_scale(context, 
  </code></pre>
  
  <p>So I don't know what the parameters to <a href="http://ffmpeg.org/doxygen/0.6/swscale_8h.html#8a2e20acdddf0767448ff4912d7e1eee" rel="nofollow">sws_scale</a> should be:</p>
  
  <ul>
  <li>srcSlice : a pointer to the array of bytes? It should apparently be a
  pointer to a pointer, but what I have is just a single-dimensional
  array of bytes.</li>
  <li>srcStride : apparently expects an array of strides, but I have just one stride for the entire file. Should I pass an array with just
  one element?</li>
  <li>srcSliceY : an offset to the first byte I guess? Should be 0 then.</li>
  <li>srcSliceH : the frame height I guess</li>
  <li>dst : once again, pointer to a pointer, but my destination output is actually just another array of bytes...</li>
  <li>dstStride : Width * 4 I guess?</li>
  </ul>
  
  <p>Any help appreciated.</p>