資源簡介
開發平臺 Eclipse 3.5 Android SDK2.2 VS2008;主要功能:1、 手機拍攝視頻,服務器端播放視頻流;手動對視頻錄像。
2、 把手機作為固定的監控攝像頭使用的時候,可自動對有運動出現的場景進行錄像,視頻保存在服務器端。靈敏度的設置可以對付小波動的干擾,檢測到的光流總和如果低于設置值則不會自動錄像。當自動錄像開始后,如果在約5秒之內沒有檢測到運動出現(低于靈敏度),程序會自動結束錄像,直到下一次運動出現才會生成另外一個以系統時間命名的avi視頻文件。視頻編碼的選擇,目前是以彈出對話框的形式提供監控者選擇,也可以在程序中設置操作系統已經安裝好的編碼器。如果要停止自動錄像,首先把自動錄像標記設置為0,然后點擊停止錄像按鈕。
代碼片段和文件信息
package?com.kapokcam.android.comm;
import?java.io.IOException;
import?java.io.InputStream;
import?java.io.OutputStream;
import?java.util.ArrayList;
import?com.kapokcam.android.ui.KapokCamLocalViewActivity;
import?android.content.Context;
import?android.os.Handler;
import?android.util.Log;
public?abstract?class?KapokCommHandler?{
public?enum?ConnectionStatus?{
DISCONNECTED?CONNECTING?CONNECTED
}
private?static?final?String?TAG?=?“KapokCommHandler“;
protected?Handler?handler?=?null;
protected?Context?context?=?null;
protected?OutputStream?outputStream?=?null;
protected?InputStream?inputStream?=?null;
private?ArrayList?recvQueue?=?new?ArrayList();
private?ArrayList?sendQueue?=?new?ArrayList();
private?static?final?int?MAX_SENDQ_SIZE?=?2;
private?static?final?int?MAX_RECVQ_SIZE?=?5;
private?int?dropped?=?0;
protected?ConnectionStatus?connectionStatus?=?ConnectionStatus.DISCONNECTED;
private?SendThread?sendThread?=?null;
private?RecvThread?recvThread?=?null;
private?ConnectThread?connectThread?=?null;
protected?KapokCommHandler(Context?context?Handler?handler)?{
this.context?=?context;
this.handler?=?handler;
}
public?ConnectionStatus?getConnectionStatus()?{
return?connectionStatus;
}
public?boolean?isConnected()?{
return?connectionStatus?==?ConnectionStatus.CONNECTED;
}
public?final?void?clearSENDQ()?{
synchronized?(sendQueue)?{
sendQueue.clear();
}
}
public?final?void?clearRECVQ()?{
synchronized?(recvQueue)?{
recvQueue.clear();
}
}
public?final?void?sendQ(byte[]?data)?{
synchronized?(sendQueue)?{
if?(sendQueue.size()?==?MAX_SENDQ_SIZE)?{
++dropped;
Log.i(TAG?“dropped?“?+?dropped?+?“?pkgs“);
//?frameQ.remove(0);
//?frameQ.add(data);
return;
}
if?(sendQueue.size()?==?0)?{
sendQueue.add(data);
sendQueue.notify();
return;
}
sendQueue.add(data);
}
}
public?final?void?recvQ(byte[]?data)?{
synchronized?(recvQueue)?{
if?(recvQueue.size()?==?MAX_RECVQ_SIZE)?{
//?++dropped;
//?Log.i(TAG?“dropped?“?+?dropped?+?“?pkgs“);
//?frameQ.remove(0);
//?frameQ.add(data);
return;
}
if?(recvQueue.size()?==?0)?{
recvQueue.add(data);
recvQueue.notify();
return;
}
recvQueue.add(data);
}
}
public?final?boolean?canAcceptMore()?{
synchronized?(sendQueue)?{
if?(sendQueue.size()?==?MAX_SENDQ_SIZE)
return?false;
}
return?true;
}
public?final?void?doWrite(byte[]?data)?{
Log.i(TAG?“doWrite()“);
try?{
outputStream.write(data);
}?catch?(IOException?ioe)?{
ioe.printStackTrace();
Log.e(TAG?“doWrite()?failed“?ioe);
connectionStatus?=?ConnectionStatus.DISCONNECTED;
synchronized?(sendQueue)?{
sendQueue.clear();
}
handler.obtainMessage(KapokCamLocalViewActivity.MESSAGE_DISCONNECTED)
.sendToTarget();
disconnect();
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2016-08-29?13:29??Android視頻監控\
?????目錄???????????0??2016-08-29?13:26??Android視頻監控\android端源代碼\
?????目錄???????????0??2016-08-29?13:26??Android視頻監控\android端源代碼\comm\
?????文件????????6656??2015-10-31?10:57??Android視頻監控\android端源代碼\comm\KapokCommHandler.java
?????文件????????2869??2015-10-31?10:57??Android視頻監控\android端源代碼\comm\KapokInetHandler.java
?????目錄???????????0??2016-08-29?13:26??Android視頻監控\android端源代碼\decoder\
?????文件????????4459??2015-10-31?10:57??Android視頻監控\android端源代碼\decoder\EncodeHandler.java
?????文件????????1103??2015-10-31?10:57??Android視頻監控\android端源代碼\decoder\JpegHandler.java
?????目錄???????????0??2016-08-29?13:26??Android視頻監控\android端源代碼\ui\
?????文件????????1042??2015-10-31?10:57??Android視頻監控\android端源代碼\ui\KapokCamApp.java
?????文件????????2782??2015-10-31?10:57??Android視頻監控\android端源代碼\ui\KapokCamCapActivity.java
?????文件????????1688??2015-10-31?10:57??Android視頻監控\android端源代碼\ui\KapokCamLocalSettingActivity.java
?????文件???????16300??2015-10-31?10:57??Android視頻監控\android端源代碼\ui\KapokCamLocalViewActivity.java
?????文件????????2127??2015-10-31?10:57??Android視頻監控\android端源代碼\ui\KapokCamRemoteView.java
?????文件????????1051??2015-10-31?10:57??Android視頻監控\android端源代碼\ui\KapokCamRemoteViewActivity.java
?????文件????????4156??2015-10-31?10:57??Android視頻監控\android端源代碼\ui\KapokCamTabActivity.java
?????文件??????250335??2015-10-31?10:57??Android視頻監控\Cam320.apk
?????文件??????731136??2015-10-31?10:57??Android視頻監控\Cam320.exe
?????文件?????2085888??2015-10-31?10:57??Android視頻監控\cv210.dll
?????文件?????2201088??2015-10-31?10:57??Android視頻監控\cxcore210.dll
?????文件??????781312??2015-10-31?10:57??Android視頻監控\highgui210.dll
?????文件??????566698??2015-10-31?10:57??Android視頻監控\libjpeg.lib
?????文件??????819892??2015-10-31?10:57??Android視頻監控\libjpeg8.lib
?????目錄???????????0??2016-08-29?13:34??Android視頻監控\使用文檔\
?????文件???????33792??2016-08-29?13:32??Android視頻監控\使用文檔\作品說明.doc
?????文件??????250368??2016-08-29?13:34??Android視頻監控\使用文檔\移動視頻監控文檔.doc
?????目錄???????????0??2016-08-29?13:38??Android視頻監控\服務器端源代碼\
?????文件????????7947??2015-10-31?10:57??Android視頻監控\服務器端源代碼\CommHandler.cpp
?????文件????????2134??2015-10-31?10:57??Android視頻監控\服務器端源代碼\CommHandler.h
?????文件????????3817??2015-10-31?10:57??Android視頻監控\服務器端源代碼\commoncam.h
?????目錄???????????0??2016-08-29?13:26??Android視頻監控\服務器端源代碼\icons\
............此處省略110個文件信息
評論
共有 條評論