3

enter image description here

Basically I don't know what to do...

I downloaded the JMF library and inserted the library into the project. It was working fine until I came across this problem. Let me know what you think. Thanks!!!

Zev

Zeveso
  • 1,274
  • 3
  • 21
  • 41

1 Answers1

6

You could explicitly make _buf into a javax.media.Buffer by writing out its full name, like

javax.media.Buffer _buf = frameGrabber.grabFrame();

Alternatively, you could import all of the classes of javax.media by placing in your import statements (or above the class definition public class mediaFunction) :

import javax.media.*;

Or you could import specifically javax.media.Buffer so Java knows that Buffer really means javax.media.Buffer, by importing:

import javax.media.Buffer;

This article on packages and imports may help.

What I'm guessing is you imported java.nio.* or java.nio.Buffer, so it thinks that Buffer implicitly means java.nio.Buffer, not the buffer type that frameGrabber.grabFrame() returns, or in other words, javax.media.Buffer. Regardless, my first solution ought to fix your problem.

Zach L
  • 16,072
  • 4
  • 38
  • 39
  • I have tried that, I should have included that I tried that. It's like I don't even have that API. Where would I find javax.media.Buffer? – Zeveso Jan 30 '11 at 23:58
  • Here is the documentation for [javax.media.Buffer](http://download.oracle.com/docs/cd/E17802_01/j2se/javase/technologies/desktop/media/jmf/2.1.1/apidocs/javax/media/Buffer.html). Did you try compiling with my suggestion(s)? I'm surprised that it didn't work. – Zach L Jan 31 '11 at 00:07
  • Yes, they have been tried and I have looked at the documentation. I wondered if I had to "customize" JMF... I could not get it to run... still not sure what the problem is... like I said before... its like I don't have the API/ Library – Zeveso Jan 31 '11 at 00:17
  • I doubt you'd have to 'customize' JMF. The fact that it recognizes frameGrabber.grabFrame() returns a javax.media.Buffer seems to indicate you have the library. I'm absolutely puzzled :-p – Zach L Jan 31 '11 at 00:20
  • That is a puzzle. I definitely looks like Eclipse thinks the type `Buffer` belongs to the package `java.nio.Buffer`. The red squiggles in the line below are another indication that the buffer you have is not the buffer it is expecting. Are you sure there are no references to `java.nio.*` in that class? Also, you might want to try cleaning the project (Project -> Clean...) and rebuilding it. Check the Problems view too (Window -> Show View -> Problems) - you may have other classpath issues. – Stewart Murrie Jan 31 '11 at 00:52
  • Another thing to try: remove the explicit type declaration so you have just the following on one line: `frameGrabber.grabFrame();` Now, put your cursor on that line and bring up Quick Fix (Ctrl+1 or Edit -> Quick Fix). One of the options should be 'Assign to local variable'. Hit that and see what it does. – Stewart Murrie Jan 31 '11 at 00:54
  • @user516664 What error does it print out when you try my first suggestion (and if that doesn't work, try britishmutt's suggestions) – Zach L Jan 31 '11 at 01:01
  • I do have java.nio.Buffer... and yet it wants something else, but I thought the error was saying I needed javax.media.Buffer... I tried cleaning it, but it still did not work. Also I am in netbeans... so I could not check out the Window > show view > problems... I don't believe I have quickfix due to me using netbeans... I not written enough code to test it for e.printstacktrace(); errors... – Zeveso Jan 31 '11 at 01:53
  • @user516664 are you SURE you changed the line `Buffer _buf = frameGrabber.grabFrame();` to `javax.media.Buffer _buf = frameGrabber.grabFrame();` and then compiled? It wants _buf to be a javax.media.Buffer – Zach L Jan 31 '11 at 02:23
  • i restarted netbeans IDE and it worked WOOT! idk what happened, but it worked... wew.. that was frustrating... i did change it to javax.media.Buffer earlier... and its still that... so that and restart made it work thanks everyone!!! – Zeveso Jan 31 '11 at 02:30