Discussion:
Supporting both VIDEOINFOHEADER2 and VIDEOINFOHEADER
(too old to reply)
Bob
2008-07-17 07:41:01 UTC
Permalink
I have an issue supporting both of these. My filter enumerates 2 media types,
one with each of the different structures. The VIDEOINFOHEADER2 is first, so
the downstream filters can make use of pixel aspect ratio and interlacing
information when possible.

This works when the downstream filter supports VIH2. However, if the
downstream filter doesn't accept VIH2, RenderStream fails, seemingly without
ever trying VIH. If I put the VIH media type first, it succeeds. But then if
my down stream filter supports both VIH and VIH2, it uses VIH instead and
can't use the pixel aspect/interlacing information.

How do I fix this?
Chris P.
2008-07-17 12:35:22 UTC
Permalink
Post by Bob
I have an issue supporting both of these. My filter enumerates 2 media types,
one with each of the different structures. The VIDEOINFOHEADER2 is first, so
the downstream filters can make use of pixel aspect ratio and interlacing
information when possible.
This works when the downstream filter supports VIH2. However, if the
downstream filter doesn't accept VIH2, RenderStream fails, seemingly without
ever trying VIH. If I put the VIH media type first, it succeeds. But then if
my down stream filter supports both VIH and VIH2, it uses VIH instead and
can't use the pixel aspect/interlacing information.
It seems as though your enumeration on your output pin is not working
correctly. I would add some trace information here so you can see when it
is being called and what the results are. These are only the "preferred
media types" anyway.

How many formats does GraphEdit list on your output pin?
--
http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]
n***@gmail.com
2014-11-22 23:23:57 UTC
Permalink
I think you can support both VIDEOINFOHEADER and VIDEOINFOHEADER2.Just do a simple check on format type.And to get aspect ratio on VIDEOINFOHEADER,youu should calculate from this :
//try 4:3 assume w is width and h is height
float scale=(w-h);
float ratioX=w/scale;
float ratioY=h/scale;
//if ratioX==4 and ratioY==3
//it is 4:3
//Otherwise assume it is 16:9
Hope it help.

Loading...