Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Get the input/output buffers
- ComPtr<IMFMediaBuffer> outputBuffer;
- ComPtr<IMFMediaBuffer> inputBuffer;
- CHK(inputSample->GetBufferByIndex(0, &inputBuffer));
- CHK(outputSample->GetBufferByIndex(0, &outputBuffer));
- // Copy sample time, duration, attributes
- long long time = 0;
- long long duration = 0;
- (void)inputSample->GetSampleTime(&time);
- (void)inputSample->GetSampleDuration(&duration);
- CHK(outputSample->SetSampleTime(time));
- CHK(outputSample->SetSampleDuration(duration));
- CHK(inputSample->CopyAllItems(outputSample.Get()));
- // Set output buffer length (work around SinkWriter bug)
- unsigned long length = 0;
- CHK(outputBuffer->GetMaxLength(&length));
- CHK(outputBuffer->SetCurrentLength(length));
- unsigned long cbInputData = 0;
- unsigned long cbOutputData = 0;
- byte* pInputData;
- byte* pOutputData;
- CHK(inputBuffer->Lock(&pInputData, NULL, &cbInputData));
- CHK(outputBuffer->Lock(&pOutputData, NULL, &cbOutputData));
- unsigned long x = 0;
- while (x < cbInputData)
- {
- (*(pOutputData + x++)) = 255;
- (*(pOutputData + x++)) = 0;
- (*(pOutputData + x++)) = 0;
- (*(pOutputData + x++)) = 255;
- //Trace("B: %i", (*(pInputData + x++)));
- //Trace("\tG: %i", (*(pInputData + x++)));
- //Trace("\tR: %i", (*(pInputData + x++)));
- //Trace("\tA: %i\n", (*(pInputData + x++)));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement