findhy / mp4parser

Automatically exported from code.google.com/p/mp4parser
0 stars 0 forks source link

mp4parser dependency MappedByteBuffer #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

mp4parser has dependencies on certain Java classes, first of all 
java.nio.MappedByteBuffer, which are ** not ** allowed by the Google AppEngine 
runtime (see http://code.google.com/appengine/docs/java/jrewhitelist.html). 
Google AppEngine throws an exception e.g "java.lang.NoClassDefFoundError: 
java.nio.MappedByteBuffer is a restricted class. Please see the Google App 
Engine developer's guide for more details." is thrown for the unsupported 
class(es).

- Would it be possible to remove the dependency by mp4parser on these Java 
classes, so as to enable the library to work within Google AppEngine?

Original issue reported on code.google.com by jcmoissi...@gmail.com on 22 Jun 2011 at 8:11

GoogleCodeExporter commented 9 years ago
never thought of that - I am not even sure where this class actually used since 
a do not use it directly. But as it seems the app-engine does not allow any 
java.nio Buffers. That's a problem for me since I use these all over the place.
I would need to create a new level of abstraction ... Not sure if I can do this 
this weekend but I'll try. My GF is on a business trip - got some time to spare

Original comment by Sebastian.Annies on 24 Jun 2011 at 3:03

GoogleCodeExporter commented 9 years ago
Introducing the interface was easy. Now there is still the getSegment method 
returning a ByteBuffer. Let's see...

Original comment by Sebastian.Annies on 27 Jun 2011 at 9:08

GoogleCodeExporter commented 9 years ago
java.nio.ByteBuffer is in the whitelist of Google AppEngine
I don't clearly understand your last comment

Original comment by jcmoissi...@gmail.com on 27 Jun 2011 at 1:49

GoogleCodeExporter commented 9 years ago
Ooops. I didn't read the list too carefully. 
I like the interface without ByteBuffer better, anyhow. The change was not that 
big.

Original comment by Sebastian.Annies on 27 Jun 2011 at 2:07

GoogleCodeExporter commented 9 years ago
Two days ago, I've done successful test with mp4parser in a Java application.
Today, I've done a new try with Google App Engine and I get the message
===========================================
java.lang.NoClassDefFoundError: java.nio.MappedByteBuffer is a restricted 
class. Please see the Google  App Engine developer's guide for more details.
    at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
    at com.coremedia.iso.IsoBufferWrapperImpl.<init>(IsoBufferWrapperImpl.java:75)
.......
===========================================
line 75 is:

buffers.add(raf.getChannel().map(FileChannel.MapMode.READ_ONLY, i, filelength - 
i).slice());

Is there an implicit usage of MappedByteBuffer?

Original comment by jcmoissi...@gmail.com on 29 Jun 2011 at 5:01

GoogleCodeExporter commented 9 years ago
The MappedByteBuffer is always used if you map a file into the memory. Perhaps 
you could try to read the file into a bytebuffer by yourself and then put that 
into the IsoBufferWrapper. That should not use a MappedByteBuffer!

Original comment by Sebastian.Annies on 29 Jun 2011 at 5:37

GoogleCodeExporter commented 9 years ago
OK
It's a bit tricky, but I will try it and send a report
Thank you for the reply

Original comment by jcmoissi...@gmail.com on 29 Jun 2011 at 8:09

GoogleCodeExporter commented 9 years ago

It's trash, but it do the work for the test. Now, I'm confident that the 
library can work in Google App Engine.
I will search how I have to do it properly to be compatible with future version 
of your code (something like surcharge of IsoBufferWrapperImpl class and better 
attention to large files). Any advice is welcome.
Thank's for your help. 

Other point:
I think you have a problem in HandlerBox.java if the name returned by getName() 
is a string with length=1 and the only char is the byte 0 (which occurs); then 
you produce a malformed string with a 0 in the middle
Possibly the same problem occurs in DataEntryUrnBox.java in the getName method

Original comment by jcmoissi...@gmail.com on 7 Jul 2011 at 1:28

GoogleCodeExporter commented 9 years ago
I added a FileChannelIsoBufferWrapperImpl based on RandomAccessFile. Just check 
out the trunk. This should work on AppEngine.

Original comment by Sebastian.Annies on 7 Jul 2011 at 2:31

GoogleCodeExporter commented 9 years ago
Fine
It works

Original comment by jcmoissi...@gmail.com on 7 Jul 2011 at 4:12

GoogleCodeExporter commented 9 years ago
is it ok to close the issue?

Original comment by Sebastian.Annies on 8 Jul 2011 at 6:37

GoogleCodeExporter commented 9 years ago
closing. seems to be resolved

Original comment by Sebastian.Annies on 14 Jul 2011 at 9:55

GoogleCodeExporter commented 9 years ago
Renamed FileChannelIsoBufferWrapperImpl to 
RandomAccessFileIsoBufferWrapperImpl. The old name was misleading!

Original comment by Sebastian.Annies on 15 Jul 2011 at 4:23