Ivan Antón (Ozono Multimedia S.L.L.) schrieb:
> Hi.
>
> I am using comtypes to interact with DirectShow an have one question about:
>
> What I´m doing wrong to get this error message?
>
> Fragment of code:
> (...)
> if_baseFilter =
> filtro_fs.QueryInterface(comtypes.gen.DirectShowLib.IBaseFilter)
> enum = if_baseFilter.EnumPins()
> print enum
> pin, npi = enum.Next(1)
> print pin
> pin.QueryId()
> (...)
>
> Output:
> <POINTER(IEnumPins) object 146b800>
> <POINTER(IPin) object 146b6c0>
> Traceback (most recent call last):
> File "prueba.py", line 64, in ?
> pin.QueryId()
> ValueError: NULL COM pointer access
Well, it seems the enum.Next(1) call has failed. This call returns
a tuple of two value; the first one is a COM pointer, the second one
is an integer. The integer denotes how mane items have been fetched
by the call. In your case, it seems that 0 have been fetched, and
the COM pointer is invalid. So, you should check that "npi != 0",
or you should check that the COM pointer is not a NULL-pointer:
"if pin: pin.QueryId()".
But, since comtypes implements the iterator protocol on IEnumXXX interfaces,
you can iterate directly over if_baseFilter.EnumPins():
if_baseFilter = filtro_fs.QueryInterface(comtypes.gen.DirectShowLib.IBaseFilter)
for pin in if_baseFilter.EnumPins():
print pin.QueryId()
Thomas
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
comtypes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/comtypes-users