Advertisement
FrayxRulez

Untitled

Feb 3rd, 2015
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. // Get the input/output buffers
  2. ComPtr<IMFMediaBuffer> outputBuffer;
  3. ComPtr<IMFMediaBuffer> inputBuffer;
  4. CHK(inputSample->GetBufferByIndex(0, &inputBuffer));
  5. CHK(outputSample->GetBufferByIndex(0, &outputBuffer));
  6.  
  7. // Copy sample time, duration, attributes
  8. long long time = 0;
  9. long long duration = 0;
  10. (void)inputSample->GetSampleTime(&time);
  11. (void)inputSample->GetSampleDuration(&duration);
  12. CHK(outputSample->SetSampleTime(time));
  13. CHK(outputSample->SetSampleDuration(duration));
  14. CHK(inputSample->CopyAllItems(outputSample.Get()));
  15.  
  16. // Set output buffer length (work around SinkWriter bug)
  17. unsigned long length = 0;
  18. CHK(outputBuffer->GetMaxLength(&length));
  19. CHK(outputBuffer->SetCurrentLength(length));
  20.  
  21. unsigned long cbInputData = 0;
  22. unsigned long cbOutputData = 0;
  23. byte* pInputData;
  24. byte* pOutputData;
  25.  
  26. CHK(inputBuffer->Lock(&pInputData, NULL, &cbInputData));
  27. CHK(outputBuffer->Lock(&pOutputData, NULL, &cbOutputData));
  28.  
  29. unsigned long x = 0;
  30.  
  31. while (x < cbInputData)
  32. {
  33. (*(pOutputData + x++)) = 255;
  34. (*(pOutputData + x++)) = 0;
  35. (*(pOutputData + x++)) = 0;
  36. (*(pOutputData + x++)) = 255;
  37.  
  38. //Trace("B: %i", (*(pInputData + x++)));
  39. //Trace("\tG: %i", (*(pInputData + x++)));
  40. //Trace("\tR: %i", (*(pInputData + x++)));
  41. //Trace("\tA: %i\n", (*(pInputData + x++)));
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement