winapi - How to connect a source filter to an encoder DMO? -
i have directshow app generating silent videos, filter graph is
my video frame generator -> selectable video compressor -> avi mux -> file writer
or just
my video frame generator -> avi mux -> file writer
this works expected, unless selected compressor dmo, in case pfiltergraph->connect() call source compressor fails - typically vfw_e_type_not_accepted or vfw_e_cannot_connect. make dmos work too. found deprecated sample (aviencoderdshow) able tweak compress input avi file wmv9 dmo, seemed promising on score. filter graph is
pfiltergraph->addsourcefilter(avi file) -> avi splitter -> dmo wrapper wmv -> avi mux -> file writer
so thought swap out source filter filter (or bouncing ball directshow sample it's based on). trying gives same connection failures though. source i'm supplying 32 bit rgb, wmv9 should accept. might stumbling on?
edit: details of preferred media type are:
majortype: mediatype_video subtype: mediasubtype_rgb32 bfixedsizesamples: 1 btemporalcompression: 0 lsamplesize: 3145728 formattype: clsid_ksdatatypehandlervideo punk: null cbformat: 1128 pbformat: 0x12ce4bf0
and exact point of failure vfw_e_type_not_accepted is
hr = preceivepin->receiveconnection((ipin *)this, pmt); cbasepin::attemptconnection(ipin * preceivepin, const cmediatype * pmt) line 1796 c++ cbasepin::agreemediatype(ipin * preceivepin, const cmediatype * pmt) line 1939 c++ cbasepin::connect(ipin * preceivepin, const _ammediatype * pmt) line 1728 c++ cfiltergraph::connectdirectinternal(struct ipin *,struct ipin *,struct _ammediatype const *) unknown cfiltergraph::connectdirect(struct ipin *,struct ipin *,struct _ammediatype const *) unknown connectfilters(ibasefilter * pupstream, ibasefilter * pdownstream, igraphbuilder * pgraph, _ammediatype * pmt) line 332 c++
my media type's pbformat set videoinfo, seems have same structure videoinfoheader additional data tacked on end of it. looks this:
rcsource {lt(0, 0) rb(0, 0) [0 x 0]} tagrect rctarget {lt(0, 0) rb(0, 0) [0 x 0]} tagrect dwbitrate 0 unsigned long dwbiterrorrate 0 unsigned long avgtimeperframe 0 __int64 bmiheader {bisize=40 biwidth=1024 biheight=768 ...} tagbitmapinfoheader bisize 40 unsigned long biwidth 1024 long biheight 768 long biplanes 1 unsigned short bibitcount 32 unsigned short bicompression 0 unsigned long bisizeimage 3145728 unsigned long bixpelspermeter 0 long biypelspermeter 0 long biclrused 0 unsigned long biclrimportant 0 unsigned long bmicolors 0x0d381c60 {{rgbblue=0 '\0' rgbgreen=0 '\0' rgbred=0 '\0' ...}, {rgbblue=0 '\0' rgbgreen=0 '\0' rgbred=...}, ...} tagrgbquad[256] dwbitmasks 0x0d381c60 {0, 0, 0} unsigned long[3] [0] 0 unsigned long [1] 0 unsigned long [2] 0 unsigned long truecolorinfo {dwbitmasks=0x0d381c60 {0, 0, 0} bmicolors=0x0d381c6c {{rgbblue=0 '\0' rgbgreen=0 '\0' rgbred=0 '\0' ...}, ...} }
some filters, multiplexers , encoders, require specify frame rate of video stream. , otherwise media types rejected generic error code, without mention frame rate cause.
wmv9 encoder dmo accept 32-bit rgb on input, should try out positive avgtimeperframe
value in videoinfoheader
structure of media type:
Comments
Post a Comment