JpegImagesToMovie.java - How does processor use read(Buffer buf)
up vote
1
down vote
favorite
I am looking at the JMF code source, written out as an answer on this thread by user Mavie. As I try to trace the code, from the function doIt --> ImageDataSource --> ImageSourceStream, I'm not too clear how the program reads the list of image files from the vector.
As far as I know, this part of the code read(Buffer buf) reads the image data file, but this function does not seem to be called by the processor from within the code itself.
I have managed to get the code running perfectly fine, but do not understand the logical flow. How/Where does the processor call this function to read and generate the video?
read(Buffer buf) - part of the entire source code
/**
* This is called from the Processor to read a frame worth of video
* data.
*/
public void read(Buffer buf) throws IOException
// Check if we've finished all the frames.
if (nextImage >= images.size())
// We are done. Set EndOfMedia.
//System.err.println("Done reading all images.");
buf.setEOM(true);
buf.setOffset(0);
buf.setLength(0);
ended = true;
return;
String imageFile = (String) images.elementAt(nextImage);
nextImage++;
//System.err.println(" - reading image file: " + imageFile);
// Open a random access file for the next image.
RandomAccessFile raFile;
raFile = new RandomAccessFile(imageFile, "r");
byte data = null;
// Check the input buffer type & size.
if (buf.getData() instanceof byte)
data = (byte) buf.getData();
// Check to see the given buffer is big enough for the frame.
if (data == null
java jmf
add a comment |
up vote
1
down vote
favorite
I am looking at the JMF code source, written out as an answer on this thread by user Mavie. As I try to trace the code, from the function doIt --> ImageDataSource --> ImageSourceStream, I'm not too clear how the program reads the list of image files from the vector.
As far as I know, this part of the code read(Buffer buf) reads the image data file, but this function does not seem to be called by the processor from within the code itself.
I have managed to get the code running perfectly fine, but do not understand the logical flow. How/Where does the processor call this function to read and generate the video?
read(Buffer buf) - part of the entire source code
/**
* This is called from the Processor to read a frame worth of video
* data.
*/
public void read(Buffer buf) throws IOException
// Check if we've finished all the frames.
if (nextImage >= images.size())
// We are done. Set EndOfMedia.
//System.err.println("Done reading all images.");
buf.setEOM(true);
buf.setOffset(0);
buf.setLength(0);
ended = true;
return;
String imageFile = (String) images.elementAt(nextImage);
nextImage++;
//System.err.println(" - reading image file: " + imageFile);
// Open a random access file for the next image.
RandomAccessFile raFile;
raFile = new RandomAccessFile(imageFile, "r");
byte data = null;
// Check the input buffer type & size.
if (buf.getData() instanceof byte)
data = (byte) buf.getData();
// Check to see the given buffer is big enough for the frame.
if (data == null
java jmf
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am looking at the JMF code source, written out as an answer on this thread by user Mavie. As I try to trace the code, from the function doIt --> ImageDataSource --> ImageSourceStream, I'm not too clear how the program reads the list of image files from the vector.
As far as I know, this part of the code read(Buffer buf) reads the image data file, but this function does not seem to be called by the processor from within the code itself.
I have managed to get the code running perfectly fine, but do not understand the logical flow. How/Where does the processor call this function to read and generate the video?
read(Buffer buf) - part of the entire source code
/**
* This is called from the Processor to read a frame worth of video
* data.
*/
public void read(Buffer buf) throws IOException
// Check if we've finished all the frames.
if (nextImage >= images.size())
// We are done. Set EndOfMedia.
//System.err.println("Done reading all images.");
buf.setEOM(true);
buf.setOffset(0);
buf.setLength(0);
ended = true;
return;
String imageFile = (String) images.elementAt(nextImage);
nextImage++;
//System.err.println(" - reading image file: " + imageFile);
// Open a random access file for the next image.
RandomAccessFile raFile;
raFile = new RandomAccessFile(imageFile, "r");
byte data = null;
// Check the input buffer type & size.
if (buf.getData() instanceof byte)
data = (byte) buf.getData();
// Check to see the given buffer is big enough for the frame.
if (data == null
java jmf
I am looking at the JMF code source, written out as an answer on this thread by user Mavie. As I try to trace the code, from the function doIt --> ImageDataSource --> ImageSourceStream, I'm not too clear how the program reads the list of image files from the vector.
As far as I know, this part of the code read(Buffer buf) reads the image data file, but this function does not seem to be called by the processor from within the code itself.
I have managed to get the code running perfectly fine, but do not understand the logical flow. How/Where does the processor call this function to read and generate the video?
read(Buffer buf) - part of the entire source code
/**
* This is called from the Processor to read a frame worth of video
* data.
*/
public void read(Buffer buf) throws IOException
// Check if we've finished all the frames.
if (nextImage >= images.size())
// We are done. Set EndOfMedia.
//System.err.println("Done reading all images.");
buf.setEOM(true);
buf.setOffset(0);
buf.setLength(0);
ended = true;
return;
String imageFile = (String) images.elementAt(nextImage);
nextImage++;
//System.err.println(" - reading image file: " + imageFile);
// Open a random access file for the next image.
RandomAccessFile raFile;
raFile = new RandomAccessFile(imageFile, "r");
byte data = null;
// Check the input buffer type & size.
if (buf.getData() instanceof byte)
data = (byte) buf.getData();
// Check to see the given buffer is big enough for the frame.
if (data == null
java jmf
java jmf
edited Nov 10 at 4:31
Andrew Thompson
152k27162336
152k27162336
asked Nov 9 at 16:17
Jones Lee
112
112
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53229470%2fjpegimagestomovie-java-how-does-processor-use-readbuffer-buf%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown