/****用jmf ***/
程序如下:
/***************************************************
* 程序文件名称: VAplay.java
* 功能:处理视频图像捕获和音频播放
***************************************************/
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;
import java.net.*;
import javax.imageio.*;
import javax.swing.*;
import javax.media.*;
import javax.media.protocol.*;
import javax.media.control.*;
import javax.media.util.*;
import javax.media.format.*;
import com.sun.image.codec.jpeg.*;
class VAplay extends JFrame implements Runnable
{
//定义视频图像播放器
private static Player player = null;
//定义音频播放器
private static Player player2 = null;
//获取视频设备
private CaptureDeviceInfo device = null;
//获取音频设备
private CaptureDeviceInfo device2 = null;
//媒体定位器
private MediaLocator locator = null;
private Image image;
private Buffer buffer = null;
private BufferToImage b2i = null;
//设置摄像头驱动类型
String str = "vfw:Microsoft WDM Image Capture (Win32):0 ";
//定义播放组件变量
Component comV, comVC, comA;
//定义面板
JPanel p1, p2, p3, p4;
JLabel label = new JLabel( "对方IP: ");
//初始时,在接收图像窗口显示一幅静态图片
JLabel label2 = new JLabel(new ImageIcon( "image//load.gif "));
//定义二个线程,用于接收数据和发送数据
Thread thread1, thread2;
VAplay()
{
super( "★视频传输★ ");
setBounds(150, 100, 500, 500);
p1 = new JPanel(new GridLayout(1, 2)); //(int rows, int cols) 创建具有指定行数和列数的网格布局
p2 = new JPanel(new GridLayout(2, 1));
p3 = new JPanel(new BorderLayout());
p4 = new JPanel(new BorderLayout());