Encryption/decryption of multimedia files

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.