Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: load movie from jar archive?



i use this and it works fine from loading mp4s from a jar........
wouldn't imagine this would work with large mov files........
the url c'tor for a movie using the jar "protocol" does not work which would circumvent the byte array creation......
ah well........

InputStream lcl_inFile = null;

JarFile lcl_jarFile = new JarFile(mstr_jarFileToUse);


ZipEntry lcl_jarEntry = lcl_jarFile.getEntry(mstr_movieSource);


lcl_inFile = lcl_jarFile.getInputStream(lcl_jarEntry);


// load the file into memory
DataInputStream lcl_byteStream = new DataInputStream(lcl_inFile);


int li_size = lcl_byteStream.available();

// add a small bit of padding to the array for the chunk load size i.e. 1024
byte lba_byteArray[] = new byte[li_size + 1024];


int li_result = 0;


while(li_result != -1)
{
li_result += lcl_byteStream.read(lba_byteArray, li_result, 1024);
}


// create a QTHandle from it
QTHandle lcl_qtHandle = new QTHandle(lba_byteArray);

// you must specify your data ref type here
DataRef lcl_dr = new DataRef(lcl_qtHandle, StdQTConstants.kDataRefFileExtensionTag, ".mp4");

Movie mcl_movie = Movie.fromDataRef(lcl_dr, StdQTConstants.newMovieActive | StdQTConstants4.newMovieAsyncOK);



hope that helps......
noel

On 22 Sep 2005, at 18:02, Daniel Giribet wrote:

Thanks for the snippet.

What I had in mind exactly is to print a movie's (or binary atom file) whole hierarcy of atoms. I have code that does this already, but only starting from a valid atom container instance. I have tried unsuccessfully to coax a movie to an atom container but have failed (maybe it's not really possible?).

I'll try using a handle ref to the byte data as you point out, see if I can get the atom structure from that.


Daniel Giribet

Rolf Howarth wrote:

// QTHandle should provide this constructor but doesn't, so duplicate it here.
public class MyQTHandleRef extends QTHandleRef
{
public MyQTHandleRef(byte[] bytes, int offset, int len) throws QTException
{
super(len, false);
setBytesAt(0, len, bytes, offset);
}
}


byte[] buffer = ...;
QTHandleRef handle = new MyQTHandleRef(buffer, 0, length);
DataRef dref = new DataRef(handle StdQTConstants.kDataRefFileExtensionTag, ".mov");
Movie movie = Movie.fromDataRef(dref, 0);


-Rolf

At 5:52 pm +0200 20/9/05, Daniel Giribet wrote:

I have done two tries to actually try coaxing a mov into a byte array (for different reasons than yours). I didn't have any success (endianess issues?) and the structures created don't resemble a movie at all.


_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-java mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-java/email@hidden

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-java mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-java/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.