video capture - MediaFoundation with multi-input device? -
i have project source device has svideo , composite connector available capture. in directshow, can use iamcrossbar set 1 capture from, in mediafoundation single video stream , c00d3704 status when try start streaming (using sourcereader). there way select input in mediafoundation?
nb: leadtools claims able this, don't know how. nothing else i've found says how it.
pointers correct interface and/or attributes enough...
the answer depends on specific capture card, nevertheless pretty simple. capture cards (like dual head datapath card), appear 2 separate devices (for each card in system). therefore, activate them separately, following enumeration (error checking omitted brevity):
uint32 devicecount = 0; imfactivate** devices = nullptr; microsoft::wrl::comptr<imfattributes> attributes = nullptr; hr = ::mfcreateattributes(attributes.getaddressof(), 1); hr = ::attributes->setguid(mf_devsource_attribute_source_type, mf_devsource_attribute_source_type_vidcap_guid); hr = ::mfenumdevicesources(attributes.get(), &devices, &devicecount);
and activation of device using getmediafoundationactivator
, member function activateobject
.
this makes sense card 1 referenced above since has separate hardware on card each input. , can concurrently activate each result.
however possible driver report svideo , composite 1 device since using same hardware. in case, find separate streams types on single imfsourcereader
.
imfmediatype* mediatype = nullptr; hresult hr = s_ok; while (hr == s_ok) { hr = reader->getnativemediatype((dword)mf_source_reader_first_video_stream, index, &mediatype); if (hr == mf_e_no_more_types) break; // ... [ process media type ] ++index; }
in case, set stream selection (imfsourcereader::setstreamselection). go detail on topic here.
if intending concurrently capture audio, have build aggregate source, wrote bit here;
assuming capture card has recent drivers, locate , read available streams without trouble. luck.
Comments
Post a Comment