Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

New Post: From COM IStream to concurrent::streams::istream

$
0
0
Hi Steve,
I believe I found the way, perhaps not the most elegant way:
concurrency::streams::producer_consumer_buffer<uint8_t> buff;
concurrency::streams::basic_istream<uint8_t> is(buff);  
    
web::http::http_response response(web::http::status_codes::OK);
response.set_body(is, L"audio/vnd.wave");

pAudioOut->SetBuffer(buff);

request.reply(response);    
then in my write I do have something like (simplified):
STDMETHOD(Write)(const void * pv, ULONG cb, ULONG *pcbWritten)
    {
        buffer.putn((uint8_t*)pv, cb);
        return S_OK;
    }
and in the destructor:
buffer.close(std::ios::out).wait();
Thanks,
Pierre

Viewing all articles
Browse latest Browse all 4845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>