Log in or register to post comments

how would i compare the image name in render frame method of videoplayback.cpp

April 25, 2013 - 5:39am #1

Hii,

How would i compare the image in render frame method of videoplayback cpp file to set the current target, i have all the images name and totoal number of image targets in my java file from server(script/web service). Now can i pass whole image name array as well the total number of images from videoplayback.java to videoplayback of cpp file.

Suppose i only know at run time after downloading the dat and xml and hitting a server script, that i have 100 image targets and those name are image1, image2.... iamge100, 

Now how would i set the Current target in render frame and how should i compare the image target name.

how would i compare the image name in render frame method of vid

April 25, 2013 - 11:02pm #3

Hi Thanks for your reply. but NUM_TARGETS is given as  static const int, which can not be modified, means i i passing a value from java file to videoplayback.cpp but becuase of static const int it can not be modified, also i tried to make it simple varible then try to assign in it, still it was not workig.

here is my code to  assign value to NUM_TARGETS from videoplayback.java to videoplayback.cpp file

-------------------------------------------------------------------------------------------

Java file:-

public native void sum(int a);

inside oncreate-

sum(100);

--------------------------------------------------------------------------------------------

CPP file:-

JNIEXPORT void JNICALL

Java_com_qualcomm_QCARSamples_VideoPlayback_VideoPlayback_sum(JNIEnv *env, jobject thisObj,int firstAddend)
{
NUM_TARGETS=firstAddend;
}
 
it gives error while compiling the code.
 

how would i compare the image name in render frame method of vid

April 25, 2013 - 7:12am #2

Hi,

in the VP sample you have this code:

if (strcmp(imageTarget.getName(), "stones") == 0)
            currentTarget=STONES;
        else
            currentTarget=CHIPS;

Then, you can use the same basic idea (to associate target name to current target) but you need to extend it with a bit of extra C++ coding.

You can also pass variables from Java to C++; an an example, take a look at the

setActivityPortraitMode function in VideoPlayback.cpp and VideoPlayback.java as an example of how to pass variable values from Java to C++.

 

 

Log in or register to post comments