加解密多媒體檔案

來源:互聯網
上載者:User
加解密多媒體檔案 Delphi / Windows SDK/API
http://www.delphi2007.net/DelphiMultimedia/html/delphi_20061106153805172.html
procedure   FileXor(qFileName   :   String);       //加解密函數  
  var  
          fd   :   array[1..1024]   of   byte;  
          hf   :   integer;  
          br   :   Integer;  
          i   :   Integer;  
  begin  
          hf:=fileopen(qFileName,fmOpenReadWrite);  
        if   hf   <>   -1   then  
          begin  
                    FileSeek(hf,0,0);  
                    br   :=FileRead(hf,   fd,   1024);  
                    for   i   :=   1   to   br   do  
                    begin  
                          fd[i]   :=   (fd[i])   xor   (i   mod   $ff);  
                    end;  
                    FileSeek(hf,0,0);  
                    filewrite(hf,fd,   br);  
          end;  
          FileClose(hf);  
  end;  
  FORM的CREATE事件裡:  
      filexor(‘c:\pin.mpg');           //解密MPG檔案  
      mpp:=cvideo.Create(self);  //產生播放MPG控制項  
      try   
            mpp.ReadFile(‘c:\pin.mpg',0);  
      finally  
          filexor(‘c:\pin.mpg');  //重新加密MPG檔案  
      end;  
   
      mpp.free;  
   
  因為MPG檔案正在被使用,所以後來想重新加密MPG檔案不成功。只有在MPP.FREE後面再加密這個檔案才可以。但我在程式中還需要用到這個錄象檔案,不能馬上釋放,如果不馬上把這個檔案加密,程式突然中斷,我的錄象就相當於沒加密了,請問怎麼解決。  
  一般的錄象加密是怎麼做的,程式中是怎麼解密並啟動並執行,能給個例子嗎  
   
 

棄置站台     加密好   覆蓋掉原先的.                        
  錄影   本身支援流   播放才能   以   流的方式解壓.   播放.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.