c# - DirectShow.Net play video with audio -
directshow.net contains sample project dxplay plays video without audio. need modify project make play audio. have read need add audio filter , connect pin didn't find way it.
here code sample sets filters up:
// add filters necessary render file. function // work number of different file types. ibasefilter sourcefilter = null; hr = m_filtergraph.addsourcefilter(filename, filename, out sourcefilter); dserror.throwexceptionforhr(hr); // samplegrabber interface m_sampgrabber = (isamplegrabber)new samplegrabber(); ibasefilter basegrabflt = (ibasefilter)m_sampgrabber; // configure sample grabber configuresamplegrabber(m_sampgrabber); // add filter hr = m_filtergraph.addfilter(basegrabflt, "ds.net grabber"); dserror.throwexceptionforhr(hr); // connect pieces together, use default renderer hr = icgb2.renderstream(null, null, sourcefilter, basegrabflt, null); dserror.throwexceptionforhr(hr);
could please hint me how can make play audio?
if video rendered , audio not, additional
icgb2.renderstream(null, mediatype.audio, sourcefilter, null, null)
will render audio part.
Comments
Post a Comment