Encryption/decryption of multimedia files Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiMultimedia/html/delphi_20061106153805172.html
Procedure filexor (qfilename: string); // encryption/Decryption Function
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;
In the create event of form:
Filexor ('C: \ pin. mpg'); // decrypt the MPG file
MPP: = cvideo. Create (Self); // generates a playback MPG control.
Try
MPP. readfile ('C: \ pin. mpg', 0 );
Finally
Filexor ('C: \ pin. mpg'); // re-encrypt the MPG file
End;
MPP. Free;
Because the MPG file is being used, it is unsuccessful to re-encrypt the MPG file. Only after MPP. Free can this file be encrypted. But in Program You still need to use this video file and cannot release it immediately. If you do not encrypt the file immediately, the program will suddenly be interrupted and my video will be unencrypted. How can you solve this problem.
How is the general Video Encryption done, how is the program decrypted and run, Can you give an example?
encrypt the created copy to overwrite the original one.
the video itself supports stream playback to decompress and play the video as a stream.