Native read from file descriptor

Put your problem here if it does not fit any of the other categories.

Native read from file descriptor

Postby mikeisprettyfly » Mon Nov 09, 2009 11:14 am

I'm having an issue loading in files through the android-ndk, using FileDescriptors to obtain a "handle" to the file, then passing the handle to the C side through JNI.

From there, I should be able to call fdopen() in order to open the file for reading.

I'm trying this as an attempt to reuse some 3d model loading code I wrote, but I ran into an issue.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.         AssetFileDescriptor fileDesc = m_Context.getResources().openRawResourceFd(R.raw.megaman);
  3.  
  4.         int loc = (int)fileDesc.getStartOffset();
  5.  
  6.         nativeLoadModel(loc);
  7.  
  8.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


The first line there always hangs, and I am brought to a screen that says "The JAR of this class file belongs to container 'Android 1.6' which does not allow modifications to source attachments on its entries."

I'm not sure exactly what I'd be doing wrong, I know it is failing on the Java side because it won't return from that first line.

Any help would be greatly appreciated.
-Mike
mikeisprettyfly
Freshman
Freshman
 
Posts: 2
Joined: Mon Nov 09, 2009 10:40 am
Location: Winter Park

Top

Postby mikeisprettyfly » Mon Nov 09, 2009 11:36 pm

After looking into it for a few hours I found a way to get the file loaded, I had to rename it to .mp3 in order for it to stay uncompressed. That seemed to be the main issue.

Now I'm just having a small issue passing in and using the file descriptor.

Does anyone have experience using these on the Android.
-Mike
mikeisprettyfly
Freshman
Freshman
 
Posts: 2
Joined: Mon Nov 09, 2009 10:40 am
Location: Winter Park

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 26 guests