• 大小: 397KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-18
  • 语言: C#
  • 标签: C#  监控录像  

资源简介

新人写的代码。希望各位指教,不敢赚积分啦。没有找到免费下载,搞了个最低分,分享出来。

资源截图

代码片段和文件信息

/* This class has been written by
 * Corinna John (Hannover Germany)
 * cj@binary-universe.net
 * 
 * You may do with this code whatever you like
 * except selling it or claiming any rights/ownership.
 * 
 * Please send me a little feedback about what you‘re
 * using this code for and what changes you‘d like to
 * see in later versions. (And please excuse my bad english.)
 * 
 * WARNING: This is experimental code.
 * Please do not expect “Release Quality“.
 * */

using System;
using System.IO;
using System.Runtime.InteropServices;

namespace AviFile
{
public class AudioStream : AviStream{

public int CountBitsPerSample{
get{ return waveFormat.wBitsPerSample; }
}

public int CountSamplesPerSecond{
get{ return waveFormat.nSamplesPerSec; }
}

public int CountChannels{
get{ return waveFormat.nChannels; }
}

/// the stream‘s format
private Avi.PCMWAVEFORMAT waveFormat = new Avi.PCMWAVEFORMAT();

/// Initialize an AudioStream for an existing stream
/// The file that contains the stream
/// An IAVISTREAM from [aviFile]
public AudioStream(int aviFile IntPtr aviStream){
this.aviFile = aviFile;
this.aviStream = aviStream;

int size = Marshal.SizeOf(waveFormat);
Avi.AVIStreamReadFormat(aviStream 0 ref waveFormat ref size);
Avi.AVISTREAMINFO streamInfo = GetStreamInfo(aviStream);
}

/// Read the stream‘s header information
/// The IAVISTREAM to read from
/// AVISTREAMINFO
private Avi.AVISTREAMINFO GetStreamInfo(IntPtr aviStream){
Avi.AVISTREAMINFO streamInfo = new Avi.AVISTREAMINFO();
int result = Avi.AVIStreamInfo(aviStream ref streamInfo Marshal.SizeOf(streamInfo));
if(result != 0) {
throw new Exception(“Exception in AVIStreamInfo: “+result.ToString());
}
return streamInfo;
}

/// Read the stream‘s header information
/// AVISTREAMINFO
public Avi.AVISTREAMINFO GetStreamInfo(){
if(writeCompressed){
return GetStreamInfo(compressedStream);
}else{
return GetStreamInfo(aviStream);
}
}

/// Read the stream‘s format information
/// PCMWAVEFORMAT
public Avi.PCMWAVEFORMAT GetFormat(){
Avi.PCMWAVEFORMAT format = new Avi.PCMWAVEFORMAT();
int size = Marshal.SizeOf(format);
int result = Avi.AVIStreamReadFormat(aviStream 0 ref format ref size);
return format;
}

/// Returns all data needed to copy the stream
/// Do not forget to call Marshal.FreeHGlobal and release the raw data pointer
/// Receives the header information
/// Receives the format
/// Receives the length o

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-11-21 15:53  SyncChatClient\
     目录           0  2017-11-21 15:53  SyncChatClient\.vs\
     目录           0  2017-11-21 15:53  SyncChatClient\.vs\SyncChatClient\
     目录           0  2017-11-21 15:53  SyncChatClient\.vs\SyncChatClient\v14\
     文件       71680  2017-11-23 21:21  SyncChatClient\.vs\SyncChatClient\v14\.suo
     目录           0  2017-11-23 21:21  SyncChatClient\SyncChatClient\
     文件         189  2017-09-19 21:14  SyncChatClient\SyncChatClient\App.config
     文件        4464  2017-11-02 20:14  SyncChatClient\SyncChatClient\AudioStream.cs
     文件       12672  2017-11-13 14:45  SyncChatClient\SyncChatClient\Avi.cs
     文件       14643  2017-11-02 20:14  SyncChatClient\SyncChatClient\AviManager.cs
     文件        3626  2017-11-02 20:14  SyncChatClient\SyncChatClient\AviPlayer.cs
     文件        1093  2017-11-02 20:14  SyncChatClient\SyncChatClient\AviStream.cs
     文件        5139  2017-11-02 20:14  SyncChatClient\SyncChatClient\EditableVideoStream.cs
     文件        4799  2017-11-20 23:07  SyncChatClient\SyncChatClient\Form1.Designer.cs
     文件        8868  2017-11-23 21:21  SyncChatClient\SyncChatClient\Form1.cs
     文件        5817  2017-11-20 23:07  SyncChatClient\SyncChatClient\Form1.resx
     文件         529  2017-09-19 21:29  SyncChatClient\SyncChatClient\Program.cs
     目录           0  2017-11-21 15:53  SyncChatClient\SyncChatClient\Properties\
     文件        2520  2004-06-13 18:26  SyncChatClient\SyncChatClient\Properties\AssemblyInfo.cs
     文件        4464  2005-08-04 04:32  SyncChatClient\SyncChatClient\Properties\AudioStream.cs
     文件       12672  2012-11-11 18:23  SyncChatClient\SyncChatClient\Properties\Avi.cs
     文件       14643  2012-11-11 02:56  SyncChatClient\SyncChatClient\Properties\AviManager.cs
     文件        3626  2004-12-18 05:59  SyncChatClient\SyncChatClient\Properties\AviPlayer.cs
     文件        1093  2004-12-18 06:01  SyncChatClient\SyncChatClient\Properties\AviStream.cs
     文件        5139  2004-12-18 08:30  SyncChatClient\SyncChatClient\Properties\EditableVideoStream.cs
     文件        2841  2017-09-19 21:14  SyncChatClient\SyncChatClient\Properties\Resources.Designer.cs
     文件        5612  2017-09-19 21:14  SyncChatClient\SyncChatClient\Properties\Resources.resx
     文件        1101  2017-09-19 21:14  SyncChatClient\SyncChatClient\Properties\Settings.Designer.cs
     文件         249  2017-09-19 21:14  SyncChatClient\SyncChatClient\Properties\Settings.settings
     文件       25282  2012-11-13 03:35  SyncChatClient\SyncChatClient\Properties\VideoStream.cs
     文件        6056  2017-11-02 20:18  SyncChatClient\SyncChatClient\SyncChatClient.csproj
............此处省略32个文件信息

评论

共有 条评论