FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to wrap extern(C) int function (GstPad*, GstCaps*) Func

 
Post new topic   Reply to topic     Forum Index -> gtkD
View previous topic :: View next topic  
Author Message
kaarna



Joined: 03 Apr 2006
Posts: 92
Location: Finland

PostPosted: Thu Jun 28, 2007 11:33 am    Post subject: How to wrap extern(C) int function (GstPad*, GstCaps*) Func Reply with quote

So is it at all possible to wrap this kind of functions, that don't have a gpointer user_data, that can be used for the D instance? Normally the D instance is put onto the gpointer/void* user_data argument. But what about this:

Code:
public typedef extern(C) int  function (GstPad*, GstCaps*) GstPadSetCapsFunction;

public void setSetCapsFunction( int delegate(Caps) dlg )
{
   onSetSetCapsListener = dlg;
   gst_pad_set_setcaps_function( gstPad, callBackSetSetCaps );
}
   
int delegate(Caps) onSetSetCapsListener;

extern(C) static int callBackSetSetCaps(GstPad* pad, GstCaps* caps)
{
   //Umm so what do I do here, as I haven't got the D instance?
        //How do I call the onSetSetCapsListener?
}


Or could there be another way? Can't find any implementions of this kind of stuff from elsewhere on gtkD.

Quick responses would be appreciated, as I'm in a hurry to do a release on 1st of July... Smile
Back to top
View user's profile Send private message AIM Address MSN Messenger
Ant



Joined: 06 Mar 2004
Posts: 306
Location: Canada

PostPosted: Thu Jun 28, 2007 10:38 pm    Post subject: Re: How to wrap extern(C) int function (GstPad*, GstCaps*) Reply with quote

satelliittipupu wrote:
So is it at all possible to wrap this kind of functions, that don't have a gpointer user_data, that can be used for the D instance? Normally the D instance is put onto the gpointer/void* user_data argument. But what about this:

Code:
public typedef extern(C) int  function (GstPad*, GstCaps*) GstPadSetCapsFunction;

public void setSetCapsFunction( int delegate(Caps) dlg )
{
   onSetSetCapsListener = dlg;
   gst_pad_set_setcaps_function( gstPad, callBackSetSetCaps );
}
   
int delegate(Caps) onSetSetCapsListener;

extern(C) static int callBackSetSetCaps(GstPad* pad, GstCaps* caps)
{
   //Umm so what do I do here, as I haven't got the D instance?
        //How do I call the onSetSetCapsListener?
}


Or could there be another way? Can't find any implementions of this kind of stuff from elsewhere on gtkD.

Quick responses would be appreciated, as I'm in a hurry to do a release on 1st of July... :)


if nothing better comes up...
int delegate(Caps) dlg[GstPad*] // or something like that - with correct D sintax
of course you'll have to manage the associative array yourself.

Ant
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> gtkD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group