JMF Video Display Help

C

cazzaran

I'm displaying a video stream from a capture card onto a JPanel, and I
have another JPanel under it that displays a message. My problem is
that I need to be able to resize these dynamically since the message
can be different sizes. I can do this, but when I do, the video stream
skips a few frames, which is very annoying.

Right now, everything is in Swing, but I was considering moving to SWT
since this is running on a Windows env. I'm not sure if that will help
though, since the video stream will still be a Swing component, and I
think it's the over head that is causing it. But maybe the SWT resizes
are faster.

Any one have any idea how to speed this up? I'm not against using
native stuff in my Java app, since cross platform isn't an issue, I'm
just not sure how to go from here.
 
J

JScoobyCed

I'm displaying a video stream from a capture card onto a JPanel, and I
have another JPanel under it that displays a message. My problem is
that I need to be able to resize these dynamically since the message
can be different sizes. I can do this, but when I do, the video stream
skips a few frames, which is very annoying.

Right now, everything is in Swing, but I was considering moving to SWT
since this is running on a Windows env. I'm not sure if that will help
though, since the video stream will still be a Swing component, and I
think it's the over head that is causing it. But maybe the SWT resizes
are faster.

Any one have any idea how to speed this up? I'm not against using
native stuff in my Java app, since cross platform isn't an issue, I'm
just not sure how to go from here.

Is the painting of the two components (video and text components) done
in the same (re)paint() method?
Maybe posting some code would help in this case. I am sure that a proper
design of the "refresh" of each components would work on AWT, Swing or SWT.
 
C

cazzaran

Perhaps I'm doing it wrong... I resize by calling revalidate(), like
this:

public void resizeMessage(int messageHeight) {
if(messageHeight > 0) {
messagePanel.setVisible(true);
} else {
messagePanel.setVisible(false);
}
Component[] components =
eOAppFrame.getContentPane().getComponents();
for (int i = 0; i < components.length; i++) {
JPanel component = (JPanel) components;
if (component.equals(videoPanel)) {
component.setPreferredSize(new Dimension(800, 600 -
messageHeight));
component.revalidate();
} else if (component.equals(messagePanel)) {
component.setPreferredSize(new Dimension(800,
messageHeight));
component.revalidate();
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top