求助:关于视频音频采集和传输 有谁写过关于视频音频采集和传输的程序,已知两IP之间。能不能分享下,或者知道和了解的指教一下,小妹是菜鸟,很多东西不明白,小妹一定感激不尽,谢谢!^_^ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 JMF可以马上解决 实现音频视频采集 上SUN的网站看下吧,传输可用RTP 顺便贴一段代码你看下package jmfsample;import javax.media.*;import javax.media.protocol.*;import javax.media.control.*;import javax.media.format.*;import javax.media.util.BufferToImage;import java.io.IOException;import java.net.*;import java.awt.*;public class MonitorCDS extends PushBufferDataSource implements CaptureDevice { private PushBufferDataSource delegate = null; private PushBufferStream [] delStreams = null; private MonitorStream monitorStream = null; private PushBufferStream [] monitorStreams = null; boolean delStarted = false; // variable used by MonitorStream also private Control [] controls; public MonitorCDS(DataSource ds) { // Get the stream from the actual datasource // and create a MonitorStream from it // Export the MonitorControl interface of the MonitorStream if (ds instanceof PushBufferDataSource) { delegate = (PushBufferDataSource) ds; delStreams = delegate.getStreams(); monitorStream = new MonitorStream(delStreams[0], this); monitorStreams = new PushBufferStream[] {monitorStream}; controls = new Control[] {monitorStream}; } } public Object [] getControls() { return controls; } public Object getControl(String value) { if (value.equals("jmfsample.MonitorStream") || value.equals("javax.media.control.MonitorControl")) return monitorStream; else return null; } public javax.media.CaptureDeviceInfo getCaptureDeviceInfo() { return ((CaptureDevice)delegate).getCaptureDeviceInfo(); } public FormatControl[] getFormatControls() { return ((CaptureDevice)delegate).getFormatControls(); } public String getContentType() { return delegate.getContentType(); } public void connect() throws IOException { if (delegate == null) throw new IOException("Incompatible DataSource"); // Delegate is already connected } public void disconnect() { monitorStream.setEnabled(false); delegate.disconnect(); } public synchronized void start() throws IOException { startDelegate(); delStarted = true; } public synchronized void stop() throws IOException { if (!monitorStream.isEnabled()) { stopDelegate(); } delStarted = false; } public Time getDuration() { return delegate.getDuration(); } public PushBufferStream [] getStreams() { return monitorStreams; } void startDelegate() throws IOException { delegate.start(); } void stopDelegate() throws IOException { delegate.stop(); }} interface 接口 问题求解 多线程 银行账户问题 从服务器端把数据下载保存在客户端? 为什么我的图像Icon不能显示呢 如何使用Jbuilder linux下如何安装jre? 初学者提问? 如何获得系统时间? 怎样才能得到当前的类所在的包名和其路径 关于JAVA应用程序(Java Application)的deliver问题 我对多线程的理解 java画图程序打开文件和保存文件问题
import javax.media.protocol.*;
import javax.media.control.*;
import javax.media.format.*;
import javax.media.util.BufferToImage;
import java.io.IOException;
import java.net.*;
import java.awt.*;public class MonitorCDS extends PushBufferDataSource implements CaptureDevice { private PushBufferDataSource delegate = null;
private PushBufferStream [] delStreams = null;
private MonitorStream monitorStream = null;
private PushBufferStream [] monitorStreams = null;
boolean delStarted = false; // variable used by MonitorStream also
private Control [] controls; public MonitorCDS(DataSource ds) {
// Get the stream from the actual datasource
// and create a MonitorStream from it
// Export the MonitorControl interface of the MonitorStream
if (ds instanceof PushBufferDataSource) {
delegate = (PushBufferDataSource) ds;
delStreams = delegate.getStreams();
monitorStream = new MonitorStream(delStreams[0], this);
monitorStreams = new PushBufferStream[] {monitorStream};
controls = new Control[] {monitorStream};
}
} public Object [] getControls() {
return controls;
} public Object getControl(String value) {
if (value.equals("jmfsample.MonitorStream") ||
value.equals("javax.media.control.MonitorControl"))
return monitorStream;
else
return null;
} public javax.media.CaptureDeviceInfo getCaptureDeviceInfo() {
return ((CaptureDevice)delegate).getCaptureDeviceInfo();
} public FormatControl[] getFormatControls() {
return ((CaptureDevice)delegate).getFormatControls();
} public String getContentType() {
return delegate.getContentType();
} public void connect() throws IOException {
if (delegate == null)
throw new IOException("Incompatible DataSource");
// Delegate is already connected
} public void disconnect() {
monitorStream.setEnabled(false);
delegate.disconnect();
} public synchronized void start() throws IOException {
startDelegate();
delStarted = true;
} public synchronized void stop() throws IOException {
if (!monitorStream.isEnabled()) {
stopDelegate();
}
delStarted = false;
} public Time getDuration() {
return delegate.getDuration();
} public PushBufferStream [] getStreams() {
return monitorStreams;
} void startDelegate() throws IOException {
delegate.start();
} void stopDelegate() throws IOException {
delegate.stop();
}}