Question about neko-cpp (CFFI)

While trying to generate working lime with video support, I got following problem:
If we want to decode video file in lime.ndll (which is c/cpp actually), and pass video data to haxe, we need to allocate objects for it. We have few options.

First is abstract - I don’t change value of VideoBuffer now, and I don’t need to read it in haxe -> I need to toss it around just to sake of not creating static variable, so I went into this option. But, in order to display video with shader, I have to read values from VideoBuffer cpp class, so I need to create neko object, like in AudioBuffer:

	static int id_bitsPerSample;
	static int id_channels;
	static int id_data;
	static int id_sampleRate;
	int bitsPerSample = 0;
	int channels = 0;
	Bytes *data = new Bytes ();
	value mValue();
	int sampleRate = 0;
	id_bitsPerSample = val_id ("bitsPerSample");
	id_channels = val_id ("channels");
	id_data = val_id ("data");
	id_sampleRate = val_id ("sampleRate");
	mValue = alloc_empty_object ();
	alloc_field (mValue, id_bitsPerSample, alloc_int (bitsPerSample));
	alloc_field (mValue, id_channels, alloc_int (channels));
	alloc_field (mValue, id_data, data ? data->Value () : alloc_null ());
	alloc_field (mValue, id_sampleRate, alloc_int (sampleRate));

I have acces to those data from haxe then, with few assumptions -> don’t pass pointers (there aren’t functions for it even), and data may be changed just with “alloc_field(o,f,v)” function.

This will be convinient, but I will need to pass at least 5 pointers to haxe -> VideoBuffer, AudioBuffer, and pointers to 3 yuv planes.
My question is -> something like this will be bad->

  neko_object { //one big object, consisting of:
    abstract vb //pointer to videobuffer, so we have reference for it
    abstract ab //pointer to audiobuffer, same reason
    abstract yplane //this is char yplane[n], but I should be able to read it in haxe, so it
    // shouldn't be of abstract type
    ...    
    val_int vwidth //value of video width, which will be int
    ...
  } 

How could I pass this (char *) value?
Problem is also that this value may be changed from frame to frame.

Generally it would be good not to have one function corresponding to every one of this parameters, But to pass it in one container at once, like in one big object…?

This is the file I am working on:

functions lime_video_load and lime_video_load_frame
Any ideas?

Best regards, Ret

you could pass a pointer as a double, should be safe on most platforms

I thought also about creating shader on c++ side, not on haxe’s - so everything related to decoding could be inside lime.ndll, haxe could just push rectangle in which next frames could be drawn into.