29 #include <boost/assert.hpp>
34 static const auto WAIT_FOR_CONSUMER_TIMEOUT = std::chrono::milliseconds{50};
39 directx_samplegrabber_callback::directx_samplegrabber_callback(
40 MediaSampleExchangePtr
const &exchange)
41 : sampleExchange_(exchange) {}
43 directx_samplegrabber_callback::~directx_samplegrabber_callback() {
55 HRESULT directx_samplegrabber_callback::QueryInterface(
56 REFIID interfaceRequested,
void **handleToInterfaceRequested) {
57 if (handleToInterfaceRequested ==
nullptr) {
60 if (interfaceRequested == IID_IUnknown) {
61 *handleToInterfaceRequested =
static_cast<IUnknown *
>(
this);
62 }
else if (interfaceRequested == IID_ISampleGrabberCB) {
63 *handleToInterfaceRequested =
static_cast<ISampleGrabberCB *
>(
this);
93 HRESULT directx_samplegrabber_callback::SampleCB(
double time,
94 IMediaSample *sample) {
97 BOOST_ASSERT_MSG(_stayAlive,
"Should be alive when samplecb is called");
98 sampleExchange_->signalSampleProduced(sample);
105 !sampleExchange_->waitForSampleConsumed(WAIT_FOR_CONSUMER_TIMEOUT)) {