CVImageBufferRef vs __NSCFType
I've got a callback for QTCaptureVideoPreviewOutput -captureOutput:didOutputVideoFrame:withSampleBuffer:fromConnection getting called in 0.6, but the result type for didOutputVideoFrame is coming is __NSCFType rather than CVImageBufferRef. Looks like the CV types are supposed to work?
Hi! Can you add a little more information to the issue maybe? What is the problem exactly? Do you have a sample script we could try? Thank you :-) -- Thibault Martin-Lagardette On Aug 21, 2010, at 16:04, Steven Parkes wrote:
I've got a callback for QTCaptureVideoPreviewOutput -captureOutput:didOutputVideoFrame:withSampleBuffer:fromConnection getting called in 0.6, but the result type for didOutputVideoFrame is coming is __NSCFType rather than CVImageBufferRef.
Looks like the CV types are supposed to work? _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Can you add a little more information to the issue maybe?
The callback is getting most of its parameters typed correctly, but one of them seems to be not. Not only does #inspect show this, but trying to pass it to a framework function fails with 2010-08-23 11:09:11.789 macruby[77790:9207] *** Ignoring exception: expected instance of Pointer, got `#<__NSCFType:0x2004d4a80>' (__NSCFType) (TypeError)
Do you have a sample script we could try?
Sure. http://gist.github.com/545987. I can submit a trac issue if it's not me doing something stupid ...
It is a problem in the QTKit bridgesupport, where `captureOutput:didOutputVideoFrame:withSampleBuffer:fromConnection` is not defined. This means it's defintely not something you are doing wrong (and it's not MacRuby's fault either – it has no way, without proper BridgeSupport support, to know the actual type of the parameter) This has been fixed in BridgeSupport already, and should be released soon(-ish). However, I don't think there is any workaround in the meantime, except waiting for the BridgeSupport update. Thanks for giving more details btw :-) -- Thibault Martin-Lagardette On Aug 23, 2010, at 11:12, Steven Parkes wrote:
Can you add a little more information to the issue maybe?
The callback is getting most of its parameters typed correctly, but one of them seems to be not. Not only does #inspect show this, but trying to pass it to a framework function fails with
2010-08-23 11:09:11.789 macruby[77790:9207] *** Ignoring exception: expected instance of Pointer, got `#<__NSCFType:0x2004d4a80>' (__NSCFType) (TypeError)
Do you have a sample script we could try?
Sure. http://gist.github.com/545987.
I can submit a trac issue if it's not me doing something stupid ... _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
On 24/08/2010, at 8:49 AM, Thibault Martin-Lagardette wrote:
It is a problem in the QTKit bridgesupport, where `captureOutput:didOutputVideoFrame:withSampleBuffer:fromConnection` is not defined. This means it's defintely not something you are doing wrong (and it's not MacRuby's fault either – it has no way, without proper BridgeSupport support, to know the actual type of the parameter)
This has been fixed in BridgeSupport already, and should be released soon(-ish). However, I don't think there is any workaround in the meantime, except waiting for the BridgeSupport update.
Previous BridgeSupport errors and omissions have been fixed by manual editing of the BridgeSupport file pending an updated version. Can you supply a copy of the fix in this case? Paul Howson
It is true. After looking at what exactly was needed, I reduced it to a very simple bridgesupport file :D At first I thought it would be a bunch of inter-dependant bridgesupport files, but looks like it was way easier than that :-) <?xml version="1.0"?> <!DOCTYPE signatures SYSTEM "file://localhost/System/Library/DTDs/BridgeSupport.dtd"> <signatures version="0.9"> <cftype name='CVBufferRef' type='^{__CVBuffer=}'/> </signatures> Add this into a file like QTKit-capturefix.bridgesupport, and call this line just after QTKit: framework 'QTKit' # Fixes the call to captureOutput:didOutputVideoFrame:withSampleBuffer:fromConnection: load_bridge_support_file '/path/to/QTKit-capturefix.bridgesupport' Hope this helps :-) -- Thibault Martin-Lagardette On Aug 24, 2010, at 17:31, Paul Howson wrote:
On 24/08/2010, at 8:49 AM, Thibault Martin-Lagardette wrote:
It is a problem in the QTKit bridgesupport, where `captureOutput:didOutputVideoFrame:withSampleBuffer:fromConnection` is not defined. This means it's defintely not something you are doing wrong (and it's not MacRuby's fault either – it has no way, without proper BridgeSupport support, to know the actual type of the parameter)
This has been fixed in BridgeSupport already, and should be released soon(-ish). However, I don't think there is any workaround in the meantime, except waiting for the BridgeSupport update.
Previous BridgeSupport errors and omissions have been fixed by manual editing of the BridgeSupport file pending an updated version. Can you supply a copy of the fix in this case?
Paul Howson
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Hope this helps :-)
Yup. I'm getting the hang of bridgesupport (coming from an MRI FFI world ...) Any obvious reason why this doesn't seem to work? <?xml version='1.0'?> <!DOCTYPE signatures SYSTEM "file://localhost/System/Library/DTDs/BridgeSupport.dtd "> <signatures version='0.9'> <struct name='ProcessSerialNumber' type='{ProcessSerialNumber="highLongOfPSN"I"lowLongOfPSN"I}' /> <function name='GetCurrentProcess'> <reval type='s' /> <arg type='^{ProcessSerialNumber=II}' type_modifier='o' /> </function> </signatures> load_bridge_support_file(...) psn = ProcessSerialNumber.new GetCurrentProcess(psn) p psn I don't see the member values getting set the way I expect: they come back as zero, which isn't right. I can see it making the call in gdb and 'o' seems right by the other examples, but? I know (think?) I can get this information from NSWorkspace ... this was more to test my understanding and prove I could the values back I expect ... but I don't seem to be able to ...
Hi Steven, Here is a correct snippet that works with the exact same bridgesupport file: framework 'Carbon' load_bridge_support_file('b.bridgesupport') ptr = Pointer.new("{ProcessSerialNumber=II}") GetCurrentProcess(ptr) p ptr[0].lowLongOfPSN The idea is that you want to pass a pointer to the structure, and not the sctructure itself to GetCurrentProcess :-) You can, as you said, do (almost) the same with Cocoa: framework "AppKit" info = NSWorkspace.sharedWorkspace.activeApplication puts "Serial # Low : " + info["NSApplicationProcessSerialNumberLow"].to_s puts "Serial # High: " + info["NSApplicationProcessSerialNumberHigh"].to_s However, please note that this will get the current **application** PSN, which, in case you run the script in Terminal, will be Terminal's PSN, not MacRuby's. -- Thibault Martin-Lagardette On Aug 25, 2010, at 18:20, Steven Parkes wrote:
Hope this helps :-)
Yup. I'm getting the hang of bridgesupport (coming from an MRI FFI world ...)
Any obvious reason why this doesn't seem to work?
<?xml version='1.0'?> <!DOCTYPE signatures SYSTEM "file://localhost/System/Library/DTDs/BridgeSupport.dtd "> <signatures version='0.9'> <struct name='ProcessSerialNumber' type='{ProcessSerialNumber="highLongOfPSN"I"lowLongOfPSN"I}' /> <function name='GetCurrentProcess'> <reval type='s' /> <arg type='^{ProcessSerialNumber=II}' type_modifier='o' /> </function> </signatures>
load_bridge_support_file(...) psn = ProcessSerialNumber.new GetCurrentProcess(psn) p psn
I don't see the member values getting set the way I expect: they come back as zero, which isn't right. I can see it making the call in gdb and 'o' seems right by the other examples, but?
I know (think?) I can get this information from NSWorkspace ... this was more to test my understanding and prove I could the values back I expect ... but I don't seem to be able to ... _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
ptr = Pointer.new("{ProcessSerialNumber=II}" )
Thanks. I had tried Pointer.new_with_type (trying to go from examples I found). I don't understand the difference between the two (yet).
However, please note that this will get the current **application** PSN, which, in case you run the script in Terminal, will be Terminal's PSN, not MacRuby's.
Yeah, I know. I can also get the PSN from NSWorkspace with less hassle. This was just an example since I figure I may have to do this in other places in the future ... Thanks!
participants (3)
-
Paul Howson
-
Steven Parkes
-
Thibault Martin-Lagardette