我正在asp.net c#中工作。我想从内存流中播放视频。我正在加密和解密视频。我将解密的视频存储在内存流中,并且想要播放它,而不保存。我搜索了它并发现了帖子的数量,但大多数帖子都是未完成的或者提供了与directshow的链接。我也尝试过使用directshow,但这对我来说是全新的,并且包含大量演示,这使得混淆内存流使用哪一个。从内存流播放视频
我只是想从内存流中播放解密的视频数据。请让我知道我能做什么,如果有来自任何论坛的样品,它会更好。
我的解密代码
public bool DecryptData(String inName, String outName, byte[] rijnKey, byte[] rijnIV)
{
FileStream fin = null;
FileStream fout = null;
CryptoStream decStream = null;
try
{
fin = new FileStream(inName, FileMode.Open, FileAccess.Read);
//Create variables to help with read and write.
byte[] bin = new byte[bufLen]; //This is intermediate storage for the encryption.
long rdlen = 0; //This is the total number of bytes written.
long totlen = fin.Length; //This is the total length of the input file.
int len; //This is the number of bytes to be written at a time.
RijndaelManaged rijn = new RijndaelManaged();
//DES ds = new DESCryptoServiceProvider();
decStream = new CryptoStream(fin, rijn.CreateDecryptor(rijnKey, rijnIV), CryptoStreamMode.Read);
//odkoduj testowy fragment
byte[] test = new byte[testHeader.Length];
decStream.Read(test, 0, testHeader.Length);
string contents = new StreamReader(decStream).ReadToEnd();
byte[] unicodes = Encoding.Unicode.GetBytes(contents);
MemoryStream msOutput = new MemoryStream(unicodes);
//here I have to implement player that plays from memory stream.
}
catch
{}
}
您需要反正:) – Aby
我不知道,利用DirectShow,如何使用它?我已经下载它,并研究它的形式。但没有得到想法,使用哪个例子,以及如何在我的解密代码如上所示。你能指导我吗? – user3119503