CRACK.cd

Don't Pay, We Know Another Way!

Ads

DIVFIX V1.10

Download the crack/serial/keygen for "DivFix v1.10".
Download with DSL speed using USENExT.

NFO

History.txt: 1.10 - Auto-clear option to clear the listbox after finishing - Fixed I/O error 103 when stripping the index - Fixed bugs in the "Cut out bad parts" option - Displaying the time of the errors - The "Keep original file" is turned on by default for safety purpos e - Now if the destination dir is empty, DivFix puts the new video, where the original was - Displaying the name and the number of errors after finishing with a file - Linux version is now available for those who wanted it - Change in my postal address (for those who want send me postcards... ;) 1.091 - fixed a bug where pressing the Stop button while Error checking, the buttons remain disabled - fixed a bug which made the backup file shorter with 4 byte - fixed a bug which give "Read beyon end of file" error in rare cases - fixed a bug where DivFix did not rebuild the index of files with odd filesize - fixed the problem with keyframe detecting - usage of DivFix.ini file to remember the last options and source fold er - redesigned GUI with multiple file selection (you can use the Insert, Delet e keys) - command line starting with wildcard will now use the listbox in the G UI, instead of starting DivFix with each file - when selecting "Keep original file" option, you need to give a dir ectory to the backup file instead selecting the backup file itself. The filename will be automatically 'DivFix.'+the original filename - the message window was changed from TMemo (because it's buffer-limitat ion ) to TRichEdit component. You can clear it via a pop-up menu or by turning on t he Auto- clear setting (which clear the messages at before every rebuild, strip or check). The messages will now scroll normally... :) 1.08 - All the functions can be used with command-line parameters now (use DivFi& #120; /? for help) - Logging will redirect the messages into a log-file - The backup file can be saved in other places than the current directory - Read-only files now can be opened - At the error messages DivFix does not count audio frames into the rep orted error position - The '.DivFix' extension went to the front of the filenam e - New DivFix logo (Thanks to Attila Kárpáti), clicking on it will jump to the 'official' DivFix homepage ( http://divfix.maxeline.com ). - Few little bugfix - Perl version of DivFix included (Thanks to David Hoffman for the tran slation) 1.07 - The processing speed is greatly improved when DivFix is dealing with corrupted parts of the avi - DivFix no longer stops responding until processing corrupted parts - With the "Keep the original file" setting, DivFix will make i ndex rebuilding on a backup copy (the new file will have the same name plus the '.DivFi 0;' extension. - With the "Cut out the bad parts" setting, DivFix will not cop y the corrupted frames into the backup file 1.06 Changes in the Win32 version: - Fixed a few I/O error bug (Thanks to Kimmo Hassinen for sending me vi deos wich produce the errors) - Fixed the bug in the Stayontop feature which ceased to function prope rly after turning it off and turning back - DivFix is now working with OpenDML videos containing interleaved inde xes - Stop button for interrupting the rebuilding or error checking process - DivFix can be used now with command-line parameters to batch-process multiple files (see it at the Usage part of this document). Whith that, i think the DOS version is no longer necessary (and i remove it from the archive), especia lly not, because it was not updated with the changes in the Win32 version. - The executable is now compressed with the UPX compression utility (Th anks to Volker Wiens for the suggestion) - The archive is now contain the source code and released under the GNU Publ ic License (see License.txt for the details) 1.05 Changes in the Win32 version: - Fixed two bug causing I/O errors - Fixed a possible bug which cause truncating the avi (i hope this prob lem is now eliminated) - Added the error-checking function, but this check is not 100% bulletproof, because it will detect faulty frames only if the frame-header is damaged t oo. - For a request, DivFix show the position where the corrupted frame was found. 1.04 Changes in the Win32 version: - Fixed a bug caused DivFix to cut the avi to the size of the prev ious size after a rebuild,strip and resume. Sorry for those who had problems from th is... - Added a nice progress indicator. - Changed the Regenerate in the File menu to Rebuild. That has the same func tion as the button, i just forgott to rename it and a few people found it confu sing. 1.03 Changes in the Win32 version: - Fixed another cause for "I/O Error" bug. If a frame header wa s corrupted, DivFix stopped with this error. Now it will give you an error message , where the corrupted frame was and continue the searching for the next valid frame. The corrupted frame will not be in the index, but if you still experience problems (frozen picture during playback), the only soluti on is cutting the damaged frame out with VirtualDub (or with any other editor). The error detection is not perfect, it only scan the frame header. So if the damage is only in the frame data and the header is perfect, DivFix ; will not notice it (and the video will freeze). - Added a scroll bar to the status display to see the error messages, if there is too much... - Fixed the problem with seeking in some movies after using DivFix . - The About window is no longer sizable (Thanks to Atte for detecting this serious security hole! :)) 1.02 Changes in the Win32 version: - At least fixed that annoying "I/O Error" bug... :) 1.01 Changes in the Win32 version: - you can change if you want the DivFix window stay on the top (usefull for drag-and-drop) - you can open the files with drag-and-drop (Thanks for Angus Johnson and Anders Melander for their Drag and Drop Component Suite) - Fixed the bug with the "Read beyond end of file" error - This new readme file... :) 1.0 First version (without version number) This version was not intended for global distribution (so, sorry for the missi ng readme file :) License.txt: GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02 9;11-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRAN TY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS ED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it doe s.> Copyright (C) <year> <name of author> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021 ;11-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w' . This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropri ate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. <signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. Perl version/avistrip: #!/usr/bin/env perl die "Usage: $0 avifile ...\n" if $#ARGV < 0; foreach $filename (@argv) { open AVIFILE,"+<$filename" or die "Cannot open $filename: $!\ n"; seek AVIFILE,8,0 or die "Failed seeking to position 8 of $filena me\n"; read AVIFILE,$chunkname,8; if ($chunkname ne "AVI LIST") { die "$filename: Not an AVI file\n"; } $pos=16; $size=0; do { $pos += $size; seek AVIFILE,$pos,0 or die "Failed seeking to position $pos in $file name\n"; if ((read AVIFILE,$nextsize,4) != 4) { die "Couldn't read size a t $pos in $filename\n"; } $size = unpack "i",$nextsize; if ((read AVIFILE,$chunkname,4) != 4) { die "Couldn't read name at $p os in $filename\n"; } $pos += 8; } while ($chunkname ne "movi"); $streamstart = $pos - 4; $streamsize = $size; if (($streamstart + $streamsize) / ( -s $filename) < 0.75) { die "Refusing to truncate $filename at " . ($streamstart + $streamsize ) . " - ratio suspiciously high\n"; } truncate AVIFILE,$streamstart + $streamsize or die "Cannot truncate inde& #120; in $filename\n"; seek AVIFILE,$streamstart - 4,0 or die "Cannot seek to start of stream in $filename, whatever that means\n"; print AVIFILE pack "i",$streamsize; close AVIFILE; } Perl version/divfix: #!/usr/bin/env perl use Getopt::Std; $KeyFrame = 16; $NormFrame = 0; sub writeint { my $fh = shift; my $i = shift; print $fh pack "i",$i; } sub readint { my $fh = shift; my $buf; read $fh,$buf,4; return unpack "i",$buf; } if (!getopts('vbd') || $#ARGV < 0) { die <<"END"; Usage: $0 [-v] [-b[d]] avifile ... -v: verbose, progress meter -b: keep backup -d: discard bad parts (only valid with -b) END } $KeepBackup = $opt_b; $DiscardBadParts = $opt_d; $verbose = $opt_v; foreach $filename (@ARGV) { $InputSize = -s $filename; $OutputName = $filename . ".tmp.idx"; $BackupName = $filename . ".DivFix"; open Input,"+<$filename" or die "Cannot open $filename: $!\n& #34;; open Output,"+>$OutputName" or die "Cannot open temporary fil e $OutputName: $!\n"; if ($KeepBackup) { open Backup,">$BackupName" or do { unlink $OutputName; die "Cannot open $BackupName: $!\n"; } } seek Input,8,0; read Input,$ChunkName,8; if ($ChunkName ne 'AVI LIST') { die "$filename: not an AVI file.\n& #34;; } if ($verbose) { print "Rebuilding index of $filename...\n"; } $Position=16; $Size=0; do { $Position += $Size; seek Input,$Position,0; $Size = readint(Input); read Input,$ChunkName,4; $Position += 8; } until ($ChunkName eq 'movi'); $StreamStart=$Position-4; $StreamSize=$Size; $ChunkName='idx1'; print Output $ChunkName; writeint(Output,$Size); $Position=4; $i=0; $Frame=0; $Difference=0; $Interleaved=0; seek Input,0,0; if ($KeepBackup) { read Input,$Buffer,$StreamStart+4; print Backup $Buffer; } do { if ($verbose) { printf "%2.1f% \r", $Position * 100.0 / $Inp utSize; } seek Input,$StreamStart+$Position,0; if (! eof Input) { BStartRead: read Input,$ChunkName,4; if ($ChunkName eq 'LIST') { seek Input,8,1; $Position += 12; goto BStartRead; } if ($ChunkName eq 'JUNK') { $Size = readint(Input); $Position += $Size+8; seek Input,$StreamStart+$Position,0; goto BStartRead; } if ((substr($ChunkName,0,2) eq 'ix') || (substr($ChunkName,2, 2) eq 'ix')) { seek Input,12,1; $Position += 16; seek Input,$StreamStart+$Position,0; $Interleaved=1; goto BStartRead; } if (! eof Input) { # if ((($ChunkName[1] In Number) && ($ChunkName[2] In Number)) && ((Copy ($ChunkName,3,2) eq 'dc') || (Copy($ChunkName,3,2) eq 'db') || ( Copy($ChunkName,3,2) eq 'wb'))) if ($ChunkName =~ m/^\d\d(dc|db|wb)/o) { $Frame++; if ($Interleaved) { seek Input,-16,1; $Position -= 16; $Interleaved=0; } $Temp = read Input,$TempBuf,4; $Size = unpack "i",$TempBuf; if (($Size<0) && ($Temp==4)) { $Position += 4; seek Input,$StreamStart+$Position,0; read Input,$ChunkName,4; if ($ChunkName eq 'LIST') { seek Input,8,1; $Position += 12; goto BStartRead; } if ($ChunkName eq 'JUNK') { $Size = readint(Input); $Position += $Size+8; seek Input,$StreamStart+$Position,0; goto BStartRead; } seek Input,$StreamStart+$Position,0; goto BError; } if (! eof Input) { read Input,$FrameType,1; $j=((($Position+$Size) >> 1)+(($Position+$Size) % 2))*2+8; seek Input,$StreamStart+$j-1,0; if (! eof Input) { if (length($ChunkName) != 4) { $ChunkName = substr($ChunkName . " ",0,4); } print Output $ChunkName; # if (((Copy($ChunkName,3,2) eq 'dc') || (Copy($ChunkName,3,2) eq &# 39;db') || (Copy($ChunkName,3,2) eq 'wb')) && (($ChunkName[1] In Number) && ($ChunkName[2] In Number)) && (($FrameType & 64)==0)) if ($ChunkName =~ m/^\d\d(dc|db|wb)/o && (($FrameType & 64)==0)) { writeint(Output,$KeyFrame) } else { writeint(Output,$NormFrame); } if ($DiscardBadParts) { $j=$Position-$Difference; writeint(Output,$j) } else { writeint(Output,$Position); } writeint(Output,$Size); $j=$Position; $Position=((($Position+$Size) >> 1)+(($Position+$Size) % 2))*2+8 ; seek Input,$StreamStart+$j,0; if ($KeepBackup) { if ($Position-$j>32768) { for ($k=1;$k <= int (($Position-$j) / 32768);$k++) { read Input,$Buffer,32768; print Backup $Buffer; } read Input,$Buffer,(($Position-$j) % 32768); print Backup $Buffer; } else { read Input,$Buffer,$Position-$j; print Backup $Buffer; } } $i++; } } } else { BError: if ($ChunkName ne 'idx1') { print " Corrupted data detected at frame $$Frame\n"; print " Error offset: ",$StreamStart+$Position,"\n"; # Shouldn't this > be a >= if (tell Output > 16) { seek Output,-16,1; } $j=$Position; do { seek Input,$StreamStart+$Position,0; if (! eof Input) { read Input,$Buffer,32768; $k=1; do { if (((substr($Buffer,$k-1,1) eq 'd') || (substr($Buffer,$k- 1,1) eq 'w')) && (! eof Input)) { if (((substr($Buffer,$k,1) eq 'c') || (substr($Buffer,$k,1 ;) eq 'b')) && (! eof Input)) { seek Input,$StreamStart+$Position+$k-3,0; if (! eof Input) {read Input,$ChunkName,4; } } } $k++; # right-brace until ((((Copy($ChunkName,3,2) eq 'dc') || (Copy($Ch unkName,3,2) eq 'db') || (Copy($ChunkName,3,2) eq 'wb')) && (($C hunkName[1] In Number) && ($ChunkName[2] In Number))) || ($ChunkName eq ' ;idx1') || ($k>32768)); } until (($ChunkName =~ m/^\d\d(dc|db|wb)/o) || ($ChunkName eq 'id 0;1') || ($k>32768)); } $Position += $k-3; # right-brace until ((((Copy($ChunkName,3,2) eq 'dc') || (Copy($Chu nkName,3,2) eq 'db') || (Copy($ChunkName,3,2) eq 'wb')) && (($Ch unkName[1] In Number) && ($ChunkName[2] In Number))) || ($ChunkName eq ' idx1') || eof Input); } until (($ChunkName =~ m/^\d\d(dc|db|wb)/o) || ($ChunkName eq 'idx ;1') || eof Input); if (! eof Input) { $Position--; } if ($KeepBackup) { if (!($DiscardBadParts)) { seek Input,$StreamStart+$j,0; if ($Position-$j>32768) { for ($k=1; $k <= int (($Position-$j) / 32768);$k++) { read Input,$Buffer,32768; print Backup $Buffer; } read Input,$Buffer,(($Position-$j) % 32768); print Backup $Buffer; } else { read Input,$Buffer,$Position-$j; print Backup $Buffer; } } else { $Difference+=$Position-$j; } } } else { seek Input,6,1; read Input,$ChunkName,2; seek Input,-8,1; if (($ChunkName eq 'dc') || ($ChunkName eq 'wb') || ($Chunk Name eq 'db')) { $ChunkName='idx1'; } else { $ChunkName='0000'; goto BError; } } } } } } until ((eof Input) || ($ChunkName eq 'idx1')); $Size=$i*16; seek Output,4,0; writeint(Output,$Size); if ($KeepBackup) { seek Backup,0,2; $StreamSize=tell(Backup) - $StreamStart; seek Backup,$StreamStart-4,0; writeint(Backup,$StreamSize); seek Backup,$StreamStart+$StreamSize,0; seek Output,0,0; do { $Temp = read Output,$Buffer,32768; print Backup $Buffer; } until (!($Temp==32768)); truncate Backup, tell Backup; close Backup; } else { seek Input,0,2; $StreamSize=tell(Input) - $StreamStart; seek Input,$StreamStart-4,0; writeint(Input,$StreamSize); seek Input,$StreamStart+$StreamSize,0; seek Output,0,0; do { $Temp = read Output,$Buffer,32768; print Input $Buffer; } until (!($Temp==32768)); truncate Input, tell Input; } close Input; close Output; unlink $OutputName; if ($verbose) { print "Done. \n"; } } Readme.txt: 1. About This program was created to be able to watch partially downloaded DivX (AVI) mov ies. It can rebuild or strip the index part of the movie, which is at the end of the file. There are also a basic error detection, which can detect serious errors in the a udio/video stream. 2. Usage !!! W A R N I N G !!! For your maximum safety, you should use this program on a backup copy first to avoid problems from possible bugs and from continuing the download later without strip ping the index. If you want to continue the download later, don't forget to strip the inde&# 120;! !!! W A R N I N G !!! If you have a partially downloaded movie and you want to look in it, then open t he file with DivFix and use the "Rebuild Index" function. Now you can look the movie. If you want to continue the download, open the file again with DivFix, use the "Str ip Index" function, finish the download and then use the "Rebuild Index" again to corre ct the file-size in the AVI header (the only data which is changed by DivFix from the original movi e). You can use DivFix with command-line parameters too (and you can use wildca rds). For detailed help on the parameters use "DivFix.exe /?". 3. Known bugs: In some cases after using DivFix, the source file remain locked and can not be deleted, but this looks like a WindowsXP bug for me. Some people reported problems using DivFix with the XVID codec, but unf ortunately it works correctly all of my XVID films... :) There should be still some I/O-error (but hey, this is the first and only program i made with Borland Delphi... :). If you can send me a video that produce such error, i will try to fix it. But if you send meg bug-report, PLEASE write down the version number too... :) 4. Future plans: (I should do many of those already, but don't have too much free time la tely) Support for AVIs larger than 2GB Keyboard shortcuts to the functions selectable prefix or suffix for the filename Selectable starting directory (fix or remember the last dir) Resizable form (i want to do this with my Delphi 3, so ideas are welcome) Rebuild only with a given size (ideal for a preview) Maybe a read-error handling (retry or ignore at read errors) The name of the temporary index and logfile will be created from the AV I filename At batch execution at an error, DivFix should continue with the ne xt file Coloring the filenames in the listbox which are ready or which have pro blems 6. Copyright Copyright (C) 2000-2003 Csaba Budai This program is released under the GNU General Public License. It may be used fr eely, and you are welcome to redistribute it under certain conditions. For details, pl ease read the file License.txt which comes with this archive. If not, please con tact me for the original archive. 7. Contact addresses You can download the recent DivFix versions from the 'official' Div Fix page: http://divfix.maxel ine.com If you like this program, you should send a postcard (with a nice picture about your city or country) or $5 (but you are not forced to do so, because this is a freeware utility) to the following address: Budai Csaba Tatabanya Elod vezer u. 14. 3/12. 2800 Hungary You can send bugreports (please include the version number!!!), suggestions, etc . to the following e-mail address: divfix@freemail.hu or you can speak with me on the following ICQ number: UIN: 91811374 Meanwhile i lost my previous e-mail addres at the usa.net and with it a few unan swered mail. Sorry for those i did not answer (because of that) or answered later (beca use i have a few life-related problems and that's why i was late with the new version). Special thanks to Kimmo Hassinen and Arty (arty@freemail.hu) for the beta testin g! Yes, you can send those mail-bombs to him in case of any damage, that my program do for you... :) Source/About.pas: {DivFix is a utility for reindexing partial DivX AVI movies Copyright (C) 2000-2003 Csaba Budai This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021 9;1-1307 USA} unit About; {$DEFINE WINDOWS} interface uses SysUtils, Classes, {$IFDEF WINDOWS} Windows, Messages, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls , ShellApi; {$ELSE} QGraphics, QControls, QForms, QDialogs, QStdCtrls, QExtCtrls; {$ENDIF} type TForm2 = class(TForm) Button1: TButton; Bevel1: TBevel; Bevel2: TBevel; Bevel3: TBevel; Memo1: TMemo; Bevel4: TBevel; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; Label8: TLabel; Label9: TLabel; Label10: TLabel; Label11: TLabel; Label12: TLabel; Label13: TLabel; procedure Button1Click(Sender: TObject); procedure SendEMail(Sender: TObject); procedure ShowWebPage(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form2: TForm2; implementation uses DivX; {$IFDEF WINDOWS} {$R *.DFM} {$ELSE} {$R *.dfm} {$ENDIF} procedure TForm2.Button1Click(Sender: TObject); begin Form2.Close; Form1.Enabled:=True; end; procedure TForm2.SendEMail(Sender: TObject); begin {$IFDEF WINDOWS} ShellExecute(0,'open',pchar('mailto:divfix@freemail.h u'),nil,nil,SW_NORMAL); {$ELSE} Libc.system('mozilla mailto:divfix@freemail.hu &'); {$ENDIF} end; procedure TForm2.ShowWebPage(Sender: TObject); begin {$IFDEF WINDOWS} ShellExecute(0,'open',pchar('http://divfix.maxeline.com'),nil,nil,SW_MAXI MIZE); {$ELSE} Libc.system('mozilla http:// divfix.maxeline.com &'); {$ENDIF} end; end. Source/DirRequester.pas: {DivFix is a utility for reindexing partial DivX AVI movies Copyright (C) 2000-2003 Csaba Budai This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021 9;1-1307 USA} unit DirRequester; {$DEFINE WINDOWS} interface uses SysUtils, Classes, {$IFDEF WINDOWS} Windows, Messages, Graphics, Controls, Forms, Dialogs, StdCtrls, FileCtrl; {$ELSE} QGraphics, QControls, QForms, QDialogs, QStdCtrls, QComCtrls, QFileCtrls; {$ENDIF} type TForm4 = class(TForm) Button1: TButton; Button2: TButton; {$IFDEF WINDOWS} DriveComboBox1: TDriveComboBox; DirectoryListBox1: TDirectoryListBox; {$ELSE} DirectoryTreeView1: TDirectoryTreeView; {$ENDIF} procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); {$IFNDEF WINDOWS} procedure FormShow(Sender: TObject); {$ENDIF} private { Private declarations } public { Public declarations } end; var Form4: TForm4; implementation uses DivX; {$IFDEF WINDOWS} {$R *.DFM} {$ELSE} {$R *.dfm} {$ENDIF} procedure TForm4.Button1Click(Sender: TObject); begin {$IFDEF WINDOWS} If Copy(DirectoryListBox1.Directory,Length(DirectoryListBox1. Directory),1)='\' Then Form1.MaskEdit2.Text:=DirectoryListBox1.Directory Else Form1.MaskEdit2.Text:=DirectoryListBox1.Directory+' \'; {$ELSE} If Copy(DirectoryTreeView1.Directory,Length(DirectoryTreeView1.Director y),1)='/' Then Form1.MaskEdit2.Text:=DirectoryTreeView1.Directory Else Form1.MaskEdit2.Text:=DirectoryTreeView1.Directory+'/ 9;; {$ENDIF} Form1.Enabled:=True; Form4.Close; end; procedure TForm4.Button2Click(Sender: TObject); begin Form1.Enabled:=True; Form4.Close; end; procedure TForm4.FormClose(Sender: TObject; var Action: TCloseAction); begin Form1.Enabled:=True; end; {$IFNDEF WINDOWS} procedure TForm4.FormShow(Sender: TObject); begin DirectoryTreeView1.Directory:=Form1.MaskEdit2.Text; end; {$ENDIF} end. Source/DivFix.dof: [Compiler] A=1 B=0 C=1 D=1 E=0 F=0 G=1 H=1 I=1 J=1 K=0 L=1 M=0 N=1 O=1 P=1 Q=0 R=0 S=0 T=0 U=0 V=1 W=0 X=1 Y=0 Z=1 ShowHints=1 ShowWarnings=1 UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs= BDE; [Linker] MapFile=0 OutputObjs=0 ConsoleApp=1 DebugInfo=0 MinStackSize=16384 MaxStackSize=1048576 ImageBase=4194304 ExeDescription= [Directories] OutputDir= UnitOutputDir= SearchPath= Packages=VCLX30;VCL30;VCLDB30;VCLDBX30;VCLSMP30;QRPT30 Conditionals= DebugSourceDirs= UsePackages=0 [Parameters] RunParams= HostApplication= [Version Info] IncludeVerInfo=1 AutoIncBuild=0 MajorVer=1 MinorVer=1 Release=0 Build=0 Debug=0 PreRelease=0 Special=0 Private=0 DLL=0 Locale=1038 CodePage=1250 [Version Info Keys] CompanyName=Budai Csaba FileDescription=Utility for reindexing DivX AVI files FileVersion=1.1.0.0 InternalName= LegalCopyright=Copyright (C) 2000-2002 Csaba Budai LegalTrademarks= OriginalFilename=DivFix.exe ProductName=DivFix ProductVersion=1.10 Comments=This program is released under the terms of the GNU General Public Lice nse Source/DivFix.dpr: {DivFix is a utility for reindexing partial DivX AVI movies Copyright (C) 2000-2003 Csaba Budai This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021 9;1-1307 USA} program DivFix; {$DEFINE WINDOWS} uses {$IFDEF WINDOWS} Forms, {$ELSE} QForms, {$ENDIF} SysUtils, DivX in 'DivX.pas' {Form1}, About in 'About.pas' {Form2}, Parameters in 'Parameters.pas' {Form3}, DirRequester in 'DirRequester.pas' {Form4}; Var SearchRec : TSearchRec; StripIndex : Boolean; ErrorCheck : Boolean; i : Byte; {$IFDEF WINDOWS} {$R *.RES} {$ELSE} {$R *.res} {$ENDIF} begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.CreateForm(TForm2, Form2); Application.CreateForm(TForm3, Form3); Application.CreateForm(TForm4, Form4); If ParamCount>0 Then Begin StripIndex:=False; ErrorCheck:=False; Form1.Tag:=1; If (ParamStr(1)='/?') Or (ParamStr(1)='-h') Or (Para mStr(1)='-H') Then Begin Form3.Button1.Cancel:=True; Form3.Show; Form3.Refresh; Repeat Application.ProcessMessages; Until Not (Form3.Button1.Cancel); Exit; End; If ParamCount>1 Then Begin i:=2; Repeat If (ParamStr(i)='-r') Or (ParamStr(i)='-R') Then StripInde& #120;:=True Else If (ParamStr(i)='-e') Or (ParamStr(i)='-E') Then Er rorCheck:=True Else If (ParamStr(i)='-o') Or (ParamStr(i)='-O') Then Begin Form1.CheckBox1.Checked:=True; Form1.CheckBox2.Enabled:=True; If (i<ParamCount) And (ParamStr(i+1)[1]<>'- 9;) Then Begin Inc(i); Form1.MaskEdit2.Text:=ParamStr(i); End Else Form1.MaskEdit2.Text:=ExtractFilePath(ParamStr(1 ;)); End Else If (ParamStr(i)='-c') Or (ParamStr(i)='-C') Then Fo rm1.CheckBox2.Checked:=True Else If (ParamStr(i)='-l') Or (ParamStr(i)='-L') Then Begin Form1.CheckBox3.Checked:=True; If (i<ParamCount) And (ParamStr(i+1)[1]<>'- 9;) Then Begin Inc(i); Form1.MaskEdit3.Text:=ParamStr(i); End Else Form1.MaskEdit3.Text:='DivFix.log'; End; Inc(i); Until i>ParamCount; If FindFirst(ParamStr(1),faAnyFile,SearchRec)=0 Then Begin Repeat Form1.ListBox1.Items.Add(ExtractFilePath(ParamStr( 9;))+SearchRec.Name); Form1.Show; Form1.Refresh; Until FindNext(SearchRec)<>0; FindClose(SearchRec); If StripIndex Then Form1.Button2Click(nil) Else If ErrorCheck Then Form1.Button3Click(nil) Else Form1.Button1Click(nil); End; End Else Begin If FindFirst(ParamStr(1),faAnyFile,SearchRec)=0 Then Begin Repeat Form1.ListBox1.Items.Add(ExtractFilePath(ParamStr(&# 49;))+SearchRec.Name); Until FindNext(SearchRec)<>0; FindClose(SearchRec); Form1.Show; Form1.Refresh; Form1.Button1Click(nil); End; End; End Else Begin Application.Run; End; end. Source/DivFix.drc: #define ComObj_SOleError 65328 #define ComObj_SNoMethod 65329 #define ComObj_SVarNotObject 65330 #define Consts_SmkcIns 65344 #define Consts_SmkcDel 65345 #define Consts_SmkcShift 65346 #define Consts_SmkcCtrl 65347 #define Consts_SmkcAlt 65348 #define Consts_SOutOfRange 65349 #define Consts_SInvalidFileName 65350 #define Consts_SInsertLineError 65351 #define Consts_SInvalidClipFmt 65352 #define Consts_SIconToClipboard 65353 #define Consts_SInvalidMemoSize 65354 #define Consts_SBitsIndexError 65355 #define Consts_SDuplicateMenus 65356 #define ComStrs_sRichEditInsertError 65357 #define ComStrs_sRichEditLoadFail 65358 #define ComStrs_sRichEditSaveFail 65359 #define Consts_SMsgDlgAll 65360 #define Consts_SMsgDlgNoToAll 65361 #define Consts_SMsgDlgYesToAll 65362 #define Consts_SmkcBkSp 65363 #define Consts_SmkcTab 65364 #define Consts_SmkcEsc 65365 #define Consts_SmkcEnter 65366 #define Consts_SmkcSpace 65367 #define Consts_SmkcPgUp 65368 #define Consts_SmkcPgDn 65369 #define Consts_SmkcEnd 65370 #define Consts_SmkcHome 65371 #define Consts_SmkcLeft 65372 #define Consts_SmkcUp 65373 #define Consts_SmkcRight 65374 #define Consts_SmkcDown 65375 #define Consts_SVIcons 65376 #define Consts_SVBitmaps 65377 #define Consts_SMaskErr 65378 #define Consts_SMaskEditErr 65379 #define Consts_SMsgDlgWarning 65380 #define Consts_SMsgDlgError 65381 #define Consts_SMsgDlgInformation 65382 #define Consts_SMsgDlgConfirm 65383 #define Consts_SMsgDlgYes 65384 #define Consts_SMsgDlgNo 65385 #define Consts_SMsgDlgOK 65386 #define Consts_SMsgDlgCancel 65387 #define Consts_SMsgDlgHelp 65388 #define Consts_SMsgDlgAbort 65389 #define Consts_SMsgDlgRetry 65390 #define Consts_SMsgDlgIgnore 65391 #define Consts_SGroupIndexTooLow 65392 #define Consts_SNoMDIForm 65393 #define Consts_SControlParentSetToSelf 65394 #define Consts_SOKButton 65395 #define Consts_SCancelButton 65396 #define Consts_SYesButton 65397 #define Consts_SNoButton 65398 #define Consts_SHelpButton 65399 #define Consts_SCloseButton 65400 #define Consts_SIgnoreButton 65401 #define Consts_SRetryButton 65402 #define Consts_SAbortButton 65403 #define Consts_SAllButton 65404 #define Consts_SCannotDragForm 65405 #define Consts_SVMetafiles 65406 #define Consts_SVEnhMetafiles 65407 #define Consts_SInvalidImageList 65408 #define Consts_SReplaceImage 65409 #define Consts_SImageIndexError 65410 #define Consts_SImageReadFail 65411 #define Consts_SWindowDCError 65412 #define Consts_SWindowClass 65413 #define Consts_SCannotFocus 65414 #define Consts_SParentRequired 65415 #define Consts_SMDIChildNotVisible 65416 #define Consts_SVisibleChanged 65417 #define Consts_SCannotShowModal 65418 #define Consts_SPropertyOutOfRange 65419 #define Consts_SMenuIndexError 65420 #define Consts_SMenuReinserted 65421 #define Consts_SMenuNotFound 65422 #define Consts_SNoTimers 65423 #define Consts_SInvalidName 65424 #define Consts_SDuplicateClass 65425 #define Consts_SInvalidPropertyValue 65426 #define Consts_SInvalidPropertyPath 65427 #define Consts_SUnknownProperty 65428 #define Consts_SReadOnlyProperty 65429 #define Consts_SPropertyException 65430 #define Consts_SAncestorNotFound 65431 #define Consts_SInvalidBitmap 65432 #define Consts_SInvalidIcon 65433 #define Consts_SInvalidMetafile 65434 #define Consts_SChangeIconSize 65435 #define Consts_SUnknownClipboardFormat 65436 #define Consts_SOutOfResources 65437 #define Consts_SNoCanvasHandle 65438 #define Consts_SInvalidImageSize 65439 #define Consts_SAssignError 65440 #define Consts_SFCreateError 65441 #define Consts_SFOpenError 65442 #define Consts_SReadError 65443 #define Consts_SWriteError 65444 #define Consts_SMemoryStreamError 65445 #define Consts_SCantWriteResourceStreamError 65446 #define Consts_SClassNotFound 65447 #define Consts_SInvalidImage 65448 #define Consts_SResNotFound 65449 #define Consts_SListIndexError 65450 #define Consts_SListCapacityError 65451 #define Consts_SListCountError 65452 #define Consts_SSortedListError 65453 #define Consts_SDuplicateString 65454 #define Consts_SDuplicateName 65455 #define SysUtils_SLongMonthNameNov 65456 #define SysUtils_SLongMonthNameDec 65457 #define SysUtils_SShortDayNameSun 65458 #define SysUtils_SShortDayNameMon 65459 #define SysUtils_SShortDayNameTue 65460 #define SysUtils_SShortDayNameWed 65461 #define SysUtils_SShortDayNameThu 65462 #define SysUtils_SShortDayNameFri 65463 #define SysUtils_SShortDayNameSat 65464 #define SysUtils_SLongDayNameSun 65465 #define SysUtils_SLongDayNameMon 65466 #define SysUtils_SLongDayNameTue 65467 #define SysUtils_SLongDayNameWed 65468 #define SysUtils_SLongDayNameThu 65469 #define SysUtils_SLongDayNameFri 65470 #define SysUtils_SLongDayNameSat 65471 #define SysUtils_SShortMonthNameJul 65472 #define SysUtils_SShortMonthNameAug 65473 #define SysUtils_SShortMonthNameSep 65474 #define SysUtils_SShortMonthNameOct 65475 #define SysUtils_SShortMonthNameNov 65476 #define SysUtils_SShortMonthNameDec 65477 #define SysUtils_SLongMonthNameJan 65478 #define SysUtils_SLongMonthNameFeb 65479 #define SysUtils_SLongMonthNameMar 65480 #define SysUtils_SLongMonthNameApr 65481 #define SysUtils_SLongMonthNameMay 65482 #define SysUtils_SLongMonthNameJun 65483 #define SysUtils_SLongMonthNameJul 65484 #define SysUtils_SLongMonthNameAug 65485 #define SysUtils_SLongMonthNameSep 65486 #define SysUtils_SLongMonthNameOct 65487 #define SysUtils_SVarNotArray 65488 #define SysUtils_SVarArrayBounds 65489 #define SysUtils_SExternalException 65490 #define SysUtils_SAssertionFailed 65491 #define SysUtils_SIntfCastError 65492 #define SysUtils_SAssertError 65493 #define SysUtils_SAbstractError 65494 #define SysUtils_SModuleAccessViolation 65495 #define SysUtils_SWin32Error 65496 #define SysUtils_SUnkWin32Error 65497 #define SysUtils_SShortMonthNameJan 65498 #define SysUtils_SShortMonthNameFeb 65499 #define SysUtils_SShortMonthNameMar 65500 #define SysUtils_SShortMonthNameApr 65501 #define SysUtils_SShortMonthNameMay 65502 #define SysUtils_SShortMonthNameJun 65503 #define SysUtils_SInvalidPointer 65504 #define SysUtils_SInvalidCast 65505 #define SysUtils_SAccessViolation 65506 #define SysUtils_SStackOverflow 65507 #define SysUtils_SControlC 65508 #define SysUtils_SPrivilege 65509 #define SysUtils_SException 65510 #define SysUtils_SExceptTitle 65511 #define SysUtils_SInvalidFormat 65512 #define SysUtils_SArgumentMissing 65513 #define SysUtils_SInvalidVarCast 65514 #define SysUtils_SInvalidVarOp 65515 #define SysUtils_SDispatchError 65516 #define SysUtils_SReadAccess 65517 #define SysUtils_SWriteAccess 65518 #define SysUtils_SVarArrayCreate 65519 #define SysUtils_SOutOfMemory 65520 #define SysUtils_SInOutError 65521 #define SysUtils_SFileNotFound 65522 #define SysUtils_SInvalidFilename 65523 #define SysUtils_STooManyOpenFiles 65524 #define SysUtils_SAccessDenied 65525 #define SysUtils_SEndOfFile 65526 #define SysUtils_SDiskFull 65527 #define SysUtils_SInvalidInput 65528 #define SysUtils_SDivByZero 65529 #define SysUtils_SRangeError 65530 #define SysUtils_SIntOverflow 65531 #define SysUtils_SInvalidOp 65532 #define SysUtils_SZeroDivide 65533 #define SysUtils_SOverflow 65534 #define SysUtils_SUnderflow 65535 STRINGTABLE BEGIN ComObj_SOleError, "OLE error %.8x" ComObj_SNoMethod, "Method '%s' not supported by automation object&# 34; ComObj_SVarNotObject, "Variant does not reference an automation object" Consts_SmkcIns, "Ins" Consts_SmkcDel, "Del" Consts_SmkcShift, "Shift+" Consts_SmkcCtrl, "Ctrl+" Consts_SmkcAlt, "Alt+" Consts_SOutOfRange, "Value must be between %d and %d" Consts_SInvalidFileName, "Invalid file name - %s" Consts_SInsertLineError, "Unable to insert a line" Consts_SInvalidClipFmt, "Invalid clipboard format" Consts_SIconToClipboard, "Clipboard does not support Icons" Consts_SInvalidMemoSize, "Text exceeds memo capacity" Consts_SBitsIndexError, "Bits index out of range" Consts_SDuplicateMenus, "Menu '%s' is already being used by another form" ComStrs_sRichEditInsertError, "RichEdit line insertion error" ComStrs_sRichEditLoadFail, "Failed to Load Stream" ComStrs_sRichEditSaveFail, "Failed to Save Stream" Consts_SMsgDlgAll, "&All" Consts_SMsgDlgNoToAll, "N&o to All" Consts_SMsgDlgYesToAll, "Y&es to All" Consts_SmkcBkSp, "BkSp" Consts_SmkcTab, "Tab" Consts_SmkcEsc, "Esc" Consts_SmkcEnter, "Enter" Consts_SmkcSpace, "Space" Consts_SmkcPgUp, "PgUp" Consts_SmkcPgDn, "PgDn" Consts_SmkcEnd, "End" Consts_SmkcHome, "Home" Consts_SmkcLeft, "Left" Consts_SmkcUp, "Up" Consts_SmkcRight, "Right" Consts_SmkcDown, "Down" Consts_SVIcons, "Icons" Consts_SVBitmaps, "Bitmaps" Consts_SMaskErr, "Invalid input value" Consts_SMaskEditErr, "Invalid input value. Use escape key to abandon chang es" Consts_SMsgDlgWarning, "Warning" Consts_SMsgDlgError, "Error" Consts_SMsgDlgInformation, "Information" Consts_SMsgDlgConfirm, "Confirm" Consts_SMsgDlgYes, "&Yes" Consts_SMsgDlgNo, "&No" Consts_SMsgDlgOK, "OK" Consts_SMsgDlgCancel, "Cancel" Consts_SMsgDlgHelp, "&Help" Consts_SMsgDlgAbort, "&Abort" Consts_SMsgDlgRetry, "&Retry" Consts_SMsgDlgIgnore, "&Ignore" Consts_SGroupIndexTooLow, "GroupIndex cannot be less than a previ ous menu item's GroupIndex" Consts_SNoMDIForm, "Cannot create form. No MDI forms are currently active&# 34; Consts_SControlParentSetToSelf, "A control cannot have itself as its parent " Consts_SOKButton, "OK" Consts_SCancelButton, "Cancel" Consts_SYesButton, "&Yes" Consts_SNoButton, "&No" Consts_SHelpButton, "&Help" Consts_SCloseButton, "&Close" Consts_SIgnoreButton, "&Ignore" Consts_SRetryButton, "&Retry" Consts_SAbortButton, "Abort" Consts_SAllButton, "&All" Consts_SCannotDragForm, "Cannot drag a form" Consts_SVMetafiles, "Metafiles" Consts_SVEnhMetafiles, "Enhanced Metafiles" Consts_SInvalidImageList, "Invalid ImageList" Consts_SReplaceImage, "Unable to Replace Image" Consts_SImageIndexError, "Invalid ImageList Index" Consts_SImageReadFail, "Failed to read ImageList data from stream" Consts_SWindowDCError, "Error creating window device context" Consts_SWindowClass, "Error creating window class" Consts_SCannotFocus, "Cannot focus a disabled or invisible window" Consts_SParentRequired, "Control '%s' has no parent window" Consts_SMDIChildNotVisible, "Cannot hide an MDI Child Form" Consts_SVisibleChanged, "Cannot change Visible in OnShow or OnHide" Consts_SCannotShowModal, "Cannot make a visible window modal" Consts_SPropertyOutOfRange, "%s property out of range" Consts_SMenuIndexError, "Menu index out of range" Consts_SMenuReinserted, "Menu inserted twice" Consts_SMenuNotFound, "Sub-menu is not in menu" Consts_SNoTimers, "Not enough timers available" Consts_SInvalidName, "''%s'' is not a valid component name& #34; Consts_SDuplicateClass, "A class named %s already exists" Consts_SInvalidPropertyValue, "Invalid property value" Consts_SInvalidPropertyPath, "Invalid property path" Consts_SUnknownProperty, "Property does not exist" Consts_SReadOnlyProperty, "Property is read-only" Consts_SPropertyException, "Error reading %s.%s: %s" Consts_SAncestorNotFound, "Ancestor for '%s' not found" Consts_SInvalidBitmap, "Bitmap image is not valid" Consts_SInvalidIcon, "Icon image is not valid" Consts_SInvalidMetafile, "Metafile is not valid" Consts_SChangeIconSize, "Cannot change the size of an icon" Consts_SUnknownClipboardFormat, "Unsupported clipboard format" Consts_SOutOfResources, "Out of system resources" Consts_SNoCanvasHandle, "Canvas does not allow drawing" Consts_SInvalidImageSize, "Invalid image size" Consts_SAssignError, "Cannot assign a %s to a %s" Consts_SFCreateError, "Cannot create file %s" Consts_SFOpenError, "Cannot open file %s" Consts_SReadError, "Stream read error" Consts_SWriteError, "Stream write error" Consts_SMemoryStreamError, "Out of memory while expanding memory strea m" Consts_SCantWriteResourceStreamError, "Can't write to a read-only resou rce stream" Consts_SClassNotFound, "Class %s not found" Consts_SInvalidImage, "Invalid stream format" Consts_SResNotFound, "Resource %s not found" Consts_SListIndexError, "List index out of bounds (%d)" Consts_SListCapacityError, "List capacity out of bounds (%d)" Consts_SListCountError, "List count out of bounds (%d)" Consts_SSortedListError, "Operation not allowed on sorted string list" Consts_SDuplicateString, "String list does not allow duplicates" Consts_SDuplicateName, "A component named %s already exists" SysUtils_SLongMonthNameNov, "November" SysUtils_SLongMonthNameDec, "December" SysUtils_SShortDayNameSun, "Sun" SysUtils_SShortDayNameMon, "Mon" SysUtils_SShortDayNameTue, "Tue" SysUtils_SShortDayNameWed, "Wed" SysUtils_SShortDayNameThu, "Thu" SysUtils_SShortDayNameFri, "Fri" SysUtils_SShortDayNameSat, "Sat" SysUtils_SLongDayNameSun, "Sunday" SysUtils_SLongDayNameMon, "Monday" SysUtils_SLongDayNameTue, "Tuesday" SysUtils_SLongDayNameWed, "Wednesday" SysUtils_SLongDayNameThu, "Thursday" SysUtils_SLongDayNameFri, "Friday" SysUtils_SLongDayNameSat, "Saturday" SysUtils_SShortMonthNameJul, "Jul" SysUtils_SShortMonthNameAug, "Aug" SysUtils_SShortMonthNameSep, "Sep" SysUtils_SShortMonthNameOct, "Oct" SysUtils_SShortMonthNameNov, "Nov" SysUtils_SShortMonthNameDec, "Dec" SysUtils_SLongMonthNameJan, "January" SysUtils_SLongMonthNameFeb, "February" SysUtils_SLongMonthNameMar, "March" SysUtils_SLongMonthNameApr, "April" SysUtils_SLongMonthNameMay, "May" SysUtils_SLongMonthNameJun, "June" SysUtils_SLongMonthNameJul, "July" SysUtils_SLongMonthNameAug, "August" SysUtils_SLongMonthNameSep, "September" SysUtils_SLongMonthNameOct, "October" SysUtils_SVarNotArray, "Variant is not an array" SysUtils_SVarArrayBounds, "Variant array index out of bounds" SysUtils_SExternalException, "External exception %x ;" SysUtils_SAssertionFailed, "Assertion failed" SysUtils_SIntfCastError, "Interface not supported" SysUtils_SAssertError, "%s (%s, line %d)" SysUtils_SAbstractError, "Abstract Error" SysUtils_SModuleAccessViolation, "Access violation at address %p in module '%s'. %s of address %p" SysUtils_SWin32Error, "Win32 Error. Code: %d.\n%s" SysUtils_SUnkWin32Error, "A Win32 API function failed" SysUtils_SShortMonthNameJan, "Jan" SysUtils_SShortMonthNameFeb, "Feb" SysUtils_SShortMonthNameMar, "Mar" SysUtils_SShortMonthNameApr, "Apr" SysUtils_SShortMonthNameMay, "May" SysUtils_SShortMonthNameJun, "Jun" SysUtils_SInvalidPointer, "Invalid pointer operation" SysUtils_SInvalidCast, "Invalid class typecast" SysUtils_SAccessViolation, "Access violation at address %p. %s of address % p" SysUtils_SStackOverflow, "Stack overflow" SysUtils_SControlC, "Control-C hit" SysUtils_SPrivilege, "Privileged instruction" SysUtils_SException, "Exception %s in module %s at %p.\n%s%s" SysUtils_SExceptTitle, "Application Error" SysUtils_SInvalidFormat, "Format '%s' invalid or incompatible with argument" SysUtils_SArgumentMissing, "No argument for format '%s'" SysUtils_SInvalidVarCast, "Invalid variant type conversion" SysUtils_SInvalidVarOp, "Invalid variant operation" SysUtils_SDispatchError, "Variant method calls not supported" SysUtils_SReadAccess, "Read" SysUtils_SWriteAccess, "Write" SysUtils_SVarArrayCreate, "Error creating variant array" SysUtils_SOutOfMemory, "Out of memory" SysUtils_SInOutError, "I/O error %d" SysUtils_SFileNotFound, "File not found" SysUtils_SInvalidFilename, "Invalid filename" SysUtils_STooManyOpenFiles, "Too many open files" SysUtils_SAccessDenied, "File access denied" SysUtils_SEndOfFile, "Read beyond end of file" SysUtils_SDiskFull, "Disk full" SysUtils_SInvalidInput, "Invalid numeric input" SysUtils_SDivByZero, "Division by zero" SysUtils_SRangeError, "Range check error" SysUtils_SIntOverflow, "Integer overflow" SysUtils_SInvalidOp, "Invalid floating point operation" SysUtils_SZeroDivide, "Floating point division by zero" SysUtils_SOverflow, "Floating point overflow" SysUtils_SUnderflow, "Floating point underflow" END Source/DivFix.dsk: [MainWindow] Create=1 Visible=1 State=2 Left=2 Top=8 Width=1032 Height=106 MaxLeft=0 MaxTop=0 MaxWidth=1032 MaxHeight=106 ClientWidth=1024 ClientHeight=60 [WatchWindow] Create=1 Visible=1 State=0 Left=192 Top=592 Width=832 Height=150 MaxLeft=-1 MaxTop=-1 ClientWidth=824 ClientHeight=123 [ProjectManager] LargeButtons=1 Column0Width=75 Column1Width=125 Column2Width=125 [BreakpointWindow] Create=1 Visible=1 State=0 Left=380 Top=289 Width=453 Height=197 MaxLeft=-1 MaxTop=-1 ClientWidth=445 ClientHeight=170 Column0Width=100 Column1Width=60 Column2Width=240 Column3Width=40 [PropertyInspector] Create=1 Visible=1 State=0 Left=-1 Top=105 Width=194 Height=641 MaxLeft=-1 MaxTop=-1 ClientWidth=186 ClientHeight=617 SplitPos=84 [HistoryLists\hiWatchExpression] Count=32 H0=filesize(backup) H1=FilePos(Backup) H2=Backup H3=keytype H4=filepos(input) H5=FrameType H6=FrameType And 46593 H7=(46593 and 46593) H8=(46593 and 1) H9=46593 and 1 H10=frametype and 64 H11=Text2 H12=LastFrame H13=(FilePos(Output)-LastIndexPosition)/16 H14=(FilePos(Output)-LastIndexPosition) H15=Lastindexposition H16=FilePos(Output) H17=size H18=i H19=frame H20=Difference H21=position H22=j H23=Round((100-Progressbar1.Position)*((CurrentTime-StartTime)/P rogressbar1.Position)) H24=(100-Progressbar1.Position)*((CurrentTime-StartTime)/Progres sbar1.Position) H25=(100-Progressbar1.Position)*((CurrentTime-StartTime) Div Pro gressbar1.Position) H26=CurrentTime-StartTime H27=Progressbar1.Position H28=CurrentTime H29=StartTime H30=StreamStart H31=ChunkName [HistoryLists\hiOpenFile] Count=9 H0=e:\program files\borland\delphi 3\projects\divx\parameters.pas H1=e:\program files\borland\delphi 3\projects\divx\dirrequester.pas H2=e:\program files\borland\delphi 3\projects\divx\about.pas H3=e:\program files\borland\delphi 3\projects\divx\divx.pas H4=e:\program files\borland\delphi 3\projects\divfix108_source_only \source\divx.pas H5=e:\program files\borland\delphi 3\projects\divx\divfix.dpr H6=e:\divfix\source\divfix.dpr H7=e:\divfix\source\divx.pas H8=e:\divfix\source\about.pas [HistoryLists\hiRunParams] Count=7 H0="E:\D\DivFix\Copy of SPLASH.AVI" H1='E:\D\DivFix\Copy of SPLASH.AVI' H2=E:\D\DivFix\Copy of SPLASH.AVI H3=-h H4=e:\d\divfix\ppp\*.avi -l H5=e:\d\divfix\ppp\*.avi -o H6=e:\d\divfix\ppp\*.avi -o -l [HistoryLists\hiUnitAlias] Count=1 H0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; [HistoryLists\hiLibUnitAliases] Count=1 H0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; [Closed Files] File_0=SourceModule,'E:\Program Files\Borland\Delphi 3\Projects\DivFi 20;108_source_only\Source\DivX.pas',0,1,1029, 9;,1047,0,0 File_1=SourceModule,'E:\DivFix\Source\DivX.pas',0,1, 9;9,1,26,1,0 File_2=SourceModule,'E:\Program Files\Borland\Delphi 3\Source\DragDrop\Compo nents\DropTarget.pas',0,1,569,1,584,0,0 File_3=SourceModule,'E:\Program Files\Borland\Delphi 3\Source\DragDrop\Compo nents\DropSource.pas',0,1,1058,1,1071,0, 0 File_4=SourceModule,'e:\Program Files\Borland\Delphi 3\Projects\DivX\DivFi&# 120;.dpr',0,1,1,1,1,0,0 File_5=SourceModule,'e:\Program Files\Borland\Delphi 3\Projects\DivX\About.d fm',0,1,10,1,10,0,0 [Modules] Module0=E:\Program Files\Borland\Delphi 3\Projects\DivX\DivFix.dpr Module1=E:\Program Files\Borland\Delphi 3\Projects\DivX\Parameters.pas Module2=E:\Program Files\Borland\Delphi 3\Projects\DivX\DirRequester.pas Module3=E:\Program Files\Borland\Delphi 3\Projects\DivX\About.pas Module4=E:\Program Files\Borland\Delphi 3\Projects\DivX\DivX.pas Count=5 EditWindowCount=1 [E:\Program Files\Borland\Delphi 3\Projects\DivX\DivFix.dpr] ModuleType=SourceModule FormState=0 FormOnTop=0 [E:\Program Files\Borland\Delphi 3\Projects\DivX\Parameters.pas] ModuleType=SourceModule FormState=1 FormOnTop=0 [E:\Program Files\Borland\Delphi 3\Projects\DivX\DirRequester.pas] ModuleType=SourceModule FormState=1 FormOnTop=0 [E:\Program Files\Borland\Delphi 3\Projects\DivX\About.pas] ModuleType=SourceModule FormState=1 FormOnTop=0 [E:\Program Files\Borland\Delphi 3\Projects\DivX\DivX.pas] ModuleType=SourceModule FormState=1 FormOnTop=0 [EditWindow0] Create=1 Visible=1 State=0 Left=190 Top=105 Width=834 Height=487 MaxLeft=-1 MaxTop=-1 ClientWidth=826 ClientHeight=460 SplitPos=50 MessagePane=0 ViewCount=5 CurrentView=0 View0=0 View1=1 View2=2 View3=3 View4=4 [View0] Module=E:\Program Files\Borland\Delphi 3\Projects\DivX\DivFix.dpr CursorX=24 CursorY=2 TopLine=1 LeftCol=1 [View1] Module=E:\Program Files\Borland\Delphi 3\Projects\DivX\DivX.pas CursorX=24 CursorY=2 TopLine=1 LeftCol=1 [View2] Module=E:\Program Files\Borland\Delphi 3\Projects\DivX\About.pas CursorX=24 CursorY=2 TopLine=1 LeftCol=1 [View3] Module=E:\Program Files\Borland\Delphi 3\Projects\DivX\DirRequester.pas CursorX=24 CursorY=2 TopLine=1 LeftCol=1 [View4] Module=E:\Program Files\Borland\Delphi 3\Projects\DivX\Parameters.pas CursorX=24 CursorY=2 TopLine=1 LeftCol=1 [Watches] Count=2 Watch0='FilePos(Backup)',256,0,18,1 Watch1='FileSize(Backup)',256,0,18,1 [Breakpoints] Count=0 Source/DivFix.res: ˙˙˙˙( ˙˙˙˙(  └€€€€€€€€€└└└€€€˙˙˙˙˙˙˙ ˙˙˙˙˙ˆˆˆˆˆˆ˙˙˙˙˙řůůü╠ňř˙Ÿ˙╧ňřůůüüňř˙Ÿ˙╧ňř˙˙˙˙˙ř đđđđđđ╗╗ˆ˙ˆđ€ˆ˙ˆ€└€€€€€ €€€€€ƒ˙└đ ˙╟0˙˙MAINICON •(╚ ˙˙˙˙╚4VS_VE RSION_INFO╜ď ?& StringFileInfo040E04E28Com panyNameBudai CsabatLFileDescription Utility for reindexing DivX AVI file s0FileVersion1.1.0.0!I nternalNamenJLegalCopyrightCopyrigh t (C) 2000-2002 Csaba Budai )LegalTrademarks>OriginalFilen ameDivFix.exe.ProductNameDiv Fix. ProductVersion1.10Ž–Comments This program is released under the terms of the GNU General Public LicenseDV arFileInfo$Translationâ Source/DivX.pas: {DivFix is a utility for reindexing partial DivX AVI movies Copyright (C) 2000-2003 Csaba Budai This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021 9;1-1307 USA} unit DivX; {$DEFINE WINDOWS} interface uses SysUtils, Classes, {$IFDEF WINDOWS} Windows, Messages, Graphics, Controls, Forms, Dialogs, StdCtrls, Mask, Menus, ExtCtrls, Buttons, DropSource, DropTarget,ComCtrls, OleCtnrs, ShellApi, F ileCtrl; {$ELSE} QStdCtrls, QForms, QExtCtrls, QControls, QComCtrls, QGraphics, QDialogs, QTypes, Qt, QMenus, QMask, QButtons; {$ENDIF} type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; SpeedButton2: TSpeedButton; SpeedButton3: TSpeedButton; CheckBox1: TCheckBox; CheckBox2: TCheckBox; CheckBox3: TCheckBox; MaskEdit2: TMaskEdit; MaskEdit3: TMaskEdit; MainMenu1: TMainMenu; File1: TMenuItem; Open1: TMenuItem; Rebuild1: TMenuItem; Strip1: TMenuItem; Check1: TMenuItem; Exit1: TMenuItem; Settings1: TMenuItem; Stayontop1: TMenuItem; Help1: TMenuItem; About1: TMenuItem; OpenDialog1: TOpenDialog; OpenDialog2: TOpenDialog; {$IFDEF WINDOWS} DropFileTarget1: TDropFileTarget; {$ENDIF} ProgressBar1: TProgressBar; Image1: TImage; Bevel1: TBevel; Button5: TButton; Button6: TButton; ListBox1: TListBox; Bevel2: TBevel; Button7: TButton; {$IFDEF WINDOWS} RichEdit1: TRichEdit; {$ELSE} Memo1: TMemo; {$ENDIF} PopupMenu1: TPopupMenu; Clear1: TMenuItem; Autoclear1: TMenuItem; Autoclearlist1: TMenuItem; procedure SpeedButton2Click(Sender: TObject); procedure SpeedButton3Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Exit1Click(Sender: TObject); procedure About1Click(Sender: TObject); procedure StayTop(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); {$IFDEF WINDOWS} procedure DropFileTarget1Drop(Sender: TObject; ShiftState: TShiftState; Point: TPoint; var Effect: Integer); {$ENDIF} procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); procedure CheckBox1Click(Sender: TObject); procedure CheckBox3Click(Sender: TObject); procedure ShowWebPage(Sender: TObject); procedure Button5Click(Sender: TObject); procedure Button6Click(Sender: TObject); procedure Button7Click(Sender: TObject); procedure Clear1Click(Sender: TObject); procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Autoclear1Click(Sender: TObject); procedure Autoclearlist1Click(Sender: TObject); private { Private declarations } public Input,Output : File; Backup : File; Log : Text; Config : Text; i,j : Cardinal; Size,Position : Cardinal; Scale,Rate : Cardinal; StreamStart : Cardinal; IndexStart : Cardinal; StreamSize : Cardinal; AVISize : Cardinal; Difference : Cardinal; IndexDifference : Cardinal; Frame,Time : Cardinal; LastIndexPosition : Cardinal; LastBackupPosition : Cardinal; LastFrame,LastIndex : Cardinal; Item : Cardinal; Errors : Cardinal; FrameType : Cardinal; KeyType : Cardinal; Interleaved : Boolean; OnTop : Boolean; StopButton : Boolean; Logging : Boolean; CommandLine : Boolean; CfgStay : Boolean; CfgClear : Boolean; CfgCList : Boolean; CfgKeep : Boolean; CfgCut : Boolean; CfgLog : Boolean; CfgDir : String; CfgDest : String; ConfigDir : String; Text,Hour,Minute : String; Second : String; Text2 : String[2]; Codec : String[4]; Chunkname : String[8]; Temp : integer; Buffer : Array [0..32800] Of Byte; end; Const KeyFrame : Longint = 16; NormFrame : Longint = 0; Number : Set of char =['0'..'9']; var Form1: TForm1; implementation uses About, DirRequester; {$IFDEF WINDOWS} {$R *.DFM} {$ELSE} {$R *.dfm} {$ENDIF} procedure DisableButtons; begin Form1.File1.Enabled:=False; Form1.Settings1.Enabled:=False; Form1.Help1.Enabled:=False; Form1.ListBox1.Enabled:=False; Form1.SpeedButton2.Enabled:=False; Form1.SpeedButton3.Enabled:=False; Form1.MaskEdit2.Enabled:=False; Form1.MaskEdit3.Enabled:=False; Form1.Button1.Enabled:=False; Form1.Button2.Enabled:=False; Form1.Button3.Enabled:=False; Form1.Button5.Enabled:=False; Form1.Button6.Enabled:=False; Form1.Button7.Enabled:=False; Form1.CheckBox1.Enabled:=False; Form1.CheckBox2.Enabled:=False; Form1.CheckBox3.Enabled:=False; end; procedure EnableButtons; begin Form1.File1.Enabled:=True; Form1.Settings1.Enabled:=True; Form1.Help1.Enabled:=True; Form1.ListBox1.Enabled:=True; If Form1.CheckBox1.Checked Then Begin Form1.SpeedButton2.Enabled:=True; Form1.MaskEdit2.Enabled:=True; End; If Form1.CheckBox3.Checked Then Begin Form1.SpeedButton3.Enabled:=True; Form1.MaskEdit3.Enabled:=True; End; Form1.Button1.Enabled:=True; Form1.Button2.Enabled:=True; Form1.Button3.Enabled:=True; Form1.Button5.Enabled:=True; Form1.Button6.Enabled:=True; Form1.Button7.Enabled:=True; Form1.CheckBox1.Enabled:=True; If Form1.CheckBox1.Checked Then Form1.CheckBox2.Enabled: =True; Form1.CheckBox3.Enabled:=True; end; procedure WriteOut(Text : String); begin If Form1.Logging Then Writeln(Form1.Log,Text) Else Begin {$IFDEF WINDOWS} Form1.RichEdit1.Lines.Append(Text); Form1.RichEdit1.Perform(EM_SCROLLCARET,0,0); {$ELSE} Form1.Memo1.Lines.Append(Text); {$ENDIF} End; end; procedure ZeroAlign(Var Text : String); Var i : Integer; begin For i:=1 To Length(Text) Do If Text[i]=' ' Then Text[i]:='0'; end; function CheckOtherIndex(Var Input : File) : Cardinal; Var Position,i : Cardinal; OldPosition : Cardinal; Buffer : Array [0..32800] of Byte; Text : String[2]; Text2 : String[4]; Temp : Integer; begin OldPosition:=FilePos(Input); Seek(Input,FileSize(Input)-32768); BlockRead(Input,Buffer,32768); Text2:=' '; i:=32768; Repeat Move(Buffer[i],Text2[1],4); Text:=Copy(Text2,3,2); Dec(i); Until (i<0) Or (((Text='dc') Or (Text='db') Or (Text='wb')) And ((Text2[1] In Number) And (Text2[2] In Number))) Or (Text2='idx1'); If (((Text='dc') Or (Text='db') Or (Text='w b')) And ((Text2[1] In Number) And (Text2[2] In Number))) Then Begin Move(Buffer[i-15],Text2[1],4); Text:=Copy(Text2,3,2); If (((Text='dc') Or (Text='db') Or (Text=' ;wb')) And ((Text2[1] In Number) And (Text2[2] In Number))) Th en Begin Position:=FileSize(Input); i:=32768; If Position>32768 Then Repeat Dec(Position,32764); Seek(Input,Position); BlockRead(Input,Buffer,32768,Temp); i:=Temp; Repeat Dec(i); Move(Buffer[i],Text2[1],4); Until (i<0) Or (Text2='idx1'); Until (Position<32768) Or (Text2='idx1'); If (Position<32768) And (Text2<>'idx1') Th en Begin i:=Position; Position:=0; Seek(Input,0); Repeat Dec(i); Move(Buffer[i],Text2[1],4); Until (i<0) Or (Text2='idx1'); End; Seek(Input,OldPosition); If Text2='idx1' Then Result:=Position+i Else Result:=0; End Else Result:=0; End Else Result:=0; end; procedure TForm1.SpeedButton2Click(Sender: TObject); begin Form4.Left:=Form1.Left+70; Form4.Top:=Form1.Top-28; Form1.Enabled:=False; {$IFDEF WINDOWS} Application.NormalizeTopMosts; Form4.ShowModal; Application.RestoreTopMosts; If Stayontop1.Checked Then SetWindowPos(TForm1(Self).Handle,HWND_TOPMOST,0,0,0,0,SW P_NOSIZE+SWP_NOMOVE); {$ELSE} Form4.ShowModal; {$ENDIF} end; procedure TForm1.SpeedButton3Click(Sender: TObject); begin If OpenDialog2.Execute Then MaskEdit3.Text:=OpenDialog2.FileName; end; procedure TForm1.Button1Click(Sender: TObject); Var k : Cardinal; Label BError; Label BStartRead; begin {$IFDEF WINDOWS} If Autoclear1.Checked Then RichEdit1.Clear; {$ELSE} If Autoclear1.Checked Then Memo1.Clear; {$ENDIF} Logging:=False; DisableButtons; If ListBox1.Items.Count=0 Then Begin WriteOut(' No file selected.'); EnableButtons; Exit; End Else Begin i:=0; While i<=ListBox1.Items.Count-1 Do Begin {$IFDEF WINDOWS} ListBox1.Perform(LB_SETSEL,0,i); {$ENDIF} Inc(i); End; End; Item:=0; Errors:=0; If CheckBox3.Checked Then WriteOut(' Rebuilding index...'); Repeat {$IFDEF WINDOWS} If Item>0 Then ListBox1.Perform(LB_SETSEL,0,Item-1); ListBox1.Perform(LB_SETSEL,1,Item); {$ENDIF} AssignFile(Input,ListBox1.Items.Strings[Item]); ChDir(ConfigDir); AssignFile(Output,'$TEMP.IDX'); AssignFile(Log,MaskEdit3.Text); If CheckBox1.Checked Then Begin {$I-} FileMode:=0; Reset(Input,1); FileMode:=2; {$I+} End Else Begin {$I-} Reset(Input,1); {$I+} End; If IOResult<>0 Then Begin WriteOut(' Can not open the file.'); EnableButtons; Exit; End; Seek(Input,4); BlockRead(Input,AVISize,4); BlockRead(Input,ChunkName[1],8); ChunkName[0]:=#8; If ChunkName<>'AVI LIST' Then Begin WriteOut(' This is not an AVI file.'); CloseFile(Input); EnableButtons; Exit; End; {$I-} Rewrite(Output,1); {$I+} If IOResult<>0 Then Begin WriteOut(' Cannot create temporary index file.'); CloseFile(Input); EnableButtons; Exit; End; If CheckBox3.Checked Then Begin {$I-} Reset(Log); {$I+} If IOResult<>0 Then Begin {$I-} Rewrite(Log); {$I+} If IOResult<>0 Then Begin WriteOut(' Cannot create log file.'); CloseFile(Input); CloseFile(Output); EnableButtons; Exit; End Else Begin CloseFile(Log); Append(Log); End; End Else Begin CloseFile(Log); Append(Log); End; End; If CheckBox1.Checked Then Begin If (MaskEdit2.Text='') Or (MaskEdit2.Text='./') O r (MaskEdit2.Text='.\') Then AssignFile(Backup,ExtractFilePath(ListBox1.Items.Strings[Ite m])+'DivFix.'+ ExtractFileName(ListBox1.Items.Strings[Item])) Else AssignFile(Backup,ExtractFilePath(MaskEdit2.Text)+'DivFi 0;.'+ ExtractFileName(ListBox1.Items.Strings[Item])); {$I-} Rewrite(Backup,1); {$I+} If IOResult<>0 Then Begin WriteOut(' Cannot create backup file.'); CloseFile(Input); CloseFile(Output); If CheckBox3.Checked Then CloseFile(Log); Erase(Output); EnableButtons; Exit; End; End; If CheckBox3.Checked Then Begin Logging:=True; WriteOut(' Index rebuilding for file: '+ListBox1.Items. Strings[Item]); End Else WriteOut(' Index rebuilding for file: '+ListBox1.I tems.Strings[Item]); Chunkname[0]:=#4; Codec[0]:=#4; Seek(Input,112); BlockRead(Input,Codec[1],4); Codec:=UpperCase(Codec); Seek(Input,128); BlockRead(Input,Scale,4); BlockRead(Input,Rate,4); Position:=16; Size:=0; Repeat Position:=Position+Size; Seek(Input,Position); BlockRead(Input,Size,4); BlockRead(Input,Chunkname[1],4); Inc(Position,8); Until Chunkname='movi'; StreamStart:=Position-4; StreamSize:=Size; IndexStart:=CheckOtherIndex(Input); If IndexStart=0 Then IndexStart:=FileSize(Input); Chunkname:='idx1'; BlockWrite(Output,Chunkname[1],4); BlockWrite(Output,Size,4); LastIndexPosition:=FilePos(Output); Position:=4; i:=0; Frame:=0; Difference:=0; IndexDifference:=0; Interleaved:=False; StopButton:=False; Seek(Input,0); If CheckBox1.Checked Then Begin For k:=1 To (StreamStart+4) Div 32768 Do Begin BlockRead(Input,Buffer,32768,Temp); BlockWrite(Backup,Buffer,Temp); End; BlockRead(Input,Buffer,((StreamStart+4) Mod 32768),Temp); BlockWrite(Backup,Buffer,Temp); End; Repeat ProgressBar1.Position:=Position Div ((FileSize(Input)-StreamStart) Div 100); If StreamStart+Position>IndexStart Then Seek(Input,IndexStart ) Else Seek(Input,StreamStart+Position); BStartRead: If Not Eof(Input) Then Begin BlockRead(Input,Chunkname[1],4,Temp); If ChunkName='LIST' Then Begin Seek(Input,FilePos(Input)+8); Inc(Position,12); Goto BStartRead; End; If ChunkName='JUNK' Then Begin BlockRead(Input,Size,4); Position:=Position+Size+8; Inc(Difference,(Size+8)); If StreamStart+Position>IndexStart Then Seek(Input,Index Start) Else Seek(Input,StreamStart+Position); Goto BStartRead; End; Text2:=Copy(ChunkName,3,2); If (Copy(ChunkName,1,2)='ix') Or (Text2='ix ;') Then Begin Inc(Position,16); If StreamStart+Position>IndexStart Then Seek(Input,Index Start) Else Seek(Input,StreamStart+Position); Interleaved:=True; Goto BStartRead; End; If Not Eof(Input) Then Begin If ((ChunkName[1] In Number) And (ChunkName[2] In Number)) And ((Text2='dc') Or (Text2='db') Or (Tex t2='wb')) Then Begin If (Text2='dc') Or (Text2='db') Then Begin If Frame=0 Then Begin BlockRead(Input,Size,4); BlockRead(Input,KeyType,4); If KeyType=65536 Then KeyType:=1 Else If KeyType=$b0010000 Then KeyTy pe:=2 // Else If Codec='DIVX' Then KeyType:=1 Else KeyType:=3; Seek(Input,FilePos(Input)-8); End; Inc(Frame); End; If Interleaved Then Begin Seek(Input,FilePos(Input)-16); Dec(Position,16); Interleaved:=False; End; BlockRead(Input,Size,4,Temp); If (Size<0) And (Temp=4) Then Begin Inc(Position,4); If StreamStart+Position>IndexStart Then Seek(Input,Inde 0;Start) Else Seek(Input,StreamStart+Position); BlockRead(Input,Chunkname[1],4,Temp); If ChunkName='LIST' Then Begin Seek(Input,FilePos(Input)+8); Inc(Position,12); Goto BStartRead; End; If ChunkName='JUNK' Then Begin BlockRead(Input,Size,4); Position:=Position+Size+8; If StreamStart+Position>IndexStart Then Seek(Input,Inde 20;Start) Else Seek(Input,StreamStart+Position); Goto BStartRead; End; If StreamStart+Position>IndexStart Then Seek(Input,Inde 0;Start) Else Seek(Input,StreamStart+Position); Goto BError; End; If Not Eof(Input) Then Begin If Size>0 Then BlockRead(Input,FrameType,4) Else FrameType:=64; j:=(((Position+Size) Div 2)+((Position+Size) Mod 2))*2+8; If StreamStart+j-1>IndexStart Then Seek(Input,Inde 20;Start) Else Seek(Input,StreamStart+j-1); If Not Eof(Input) Then Begin If ((Text2='dc') Or (Text2='db')) And ( ((KeyType=1) And (FrameType=65536)) Or ((KeyType=2) And (FrameType=$b001000& #48;)) Or ((KeyType=3) And (FrameType And 64=0))) Then If Size>0 Then LastIndexPosition:=FilePos(Output); LastIndex:=FilePos(Output); BlockWrite(Output,Chunkname[1],4); Text2:=Copy(ChunkName,3,2); If ((Text2='dc') Or (Text2='db') Or (Tex t2='wb')) And ((Chunkname[1]In Number) And (ChunkName[2] In Number)) Then If ((Text2='wb') Or (((KeyType=1) And (FrameTy pe=65536)) Or ((KeyType=2) And (FrameType=$b001000 ;0)) Or ((KeyType=3) And (FrameType And 64=0)))) And (Size> 0) Then BlockWrite(Output,KeyFrame,4) Else BlockWrite(Output,NormFrame,4); If CheckBox2.Checked Then Begin j:=Position-Difference; BlockWrite(Output,j,4); End Else BlockWrite(Output,Position,4); BlockWrite(Output,Size,4); j:=Position; Position:=(((Position+Size) Div 2)+((Position+Size) Mod 2))*2+8; If StreamStart+j>IndexStart Then Seek(Input,IndexStar t) Else Seek(Input,StreamStart+j); If CheckBox1.Checked Then Begin If ((Text2='dc') Or (Text2='db')) And (((KeyType=1) And (FrameType=65536)) Or ((KeyType=2) And (FrameType=$b001000 ;0)) Or ((KeyType=3) And (FrameType And 64=0))) Then If Size>0 Then LastBackupPosition:=FilePos(Backup); LastFrame:=FilePos(Backup); If Position-j>32768 Then Begin For k:=1 To (Position-j) Div 32768 Do Begin BlockRead(Input,Buffer,32768,Temp); BlockWrite(Backup,Buffer,Temp); End; BlockRead(Input,Buffer,((Position-j) Mod 32768),Temp); BlockWrite(Backup,Buffer,Temp); End Else Begin BlockRead(Input,Buffer,Position-j,Temp); BlockWrite(Backup,Buffer,Temp); End; End; Inc(i); End; End; End Else Begin BError: If Chunkname<>'idx1' Then Begin Inc(Errors); Str(Frame,Text); Time:=(Frame*Scale) Div Rate; Str(Time Div 3600:2,Hour); Str(Time Div 60:2,Minute); Str(Time Mod 60:2,Second); ZeroAlign(Hour); ZeroAlign(Minute); ZeroAlign(Second); Text:=' Corrupted data detected at frame '+Text+ 9; ('+Hour+':'+Minute +':'+Second+')'; If FilePos(Output)>16 Then Seek(Output,FilePos(Output)-1 6); WriteOut(Text); Str(StreamStart+Position,Text); Text:=' Error offset: '+Text+' ($'+IntToH ex(StreamStart+Position,8)+')'; WriteOut(Text); IndexDifference:=(FilePos(Output)-LastIndexPosition) Div 16; Dec(i,IndexDifference+1); Seek(Output,LastIndexPosition); If CheckBox1.Checked Then If LastBackupPosition>0 Then Begin Seek(Backup,LastBackupPosition); End; j:=Position; Repeat If StreamStart+Position>IndexStart Then Seek(Input,Inde 20;Start) Else Seek(Input,StreamStart+Position); If Not Eof(Input) Then Begin BlockRead(Input,Buffer[1],32768,Temp); k:=1; Repeat If ((Chr(Buffer[k])='d') Or (Chr(Buffer[k])='w')) Then Begin If ((Chr(Buffer[k+1])='c') Or (Chr(Buffer[k+1]) ='b')) Then Begin If StreamStart+Position+k-3>IndexStart Then Seek(Input ,IndexStart) Else Seek(Input,StreamStart+Position+k-3); If Not Eof(Input) Then BlockRead(Input,ChunkName[1],4); If Not Eof(Input) Then BlockRead(Input,Size,4); If Not Eof(Input) Then BlockRead(Input,FrameType,4); End; End; Inc(k); Text2:=Copy(ChunkName,3,2); Until (((Text2='dc') Or (Text2='db')) And ((C hunkName[1] In Number) And (ChunkName[2] In Number)) And (((KeyType=1) And (FrameT ype=65536)) Or ((KeyType=2) And (FrameType=$b0010 8;00)) Or ((KeyType=3) And (FrameType And 64=0)))) Or (Chunkname='idx1') Or (k>Temp); Inc(Position,k-3); End; Application.ProcessMessages; If StopButton Then Begin WriteOut(' Index rebuilding aborted...'); ProgressBar1.Position:=0; StopButton:=False; CloseFile(Input); CloseFile(Output); If CheckBox1.Checked Then CloseFile(Backup); If CheckBox3.Checked Then CloseFile(Log); Erase(Output); EnableButtons; Exit; End; Text2:=Copy(ChunkName,3,2); Until (((Text2='dc') Or (Text2='db') Or (T ext2='wb')) And ((ChunkName[1] In Number) And (ChunkName[2] In Number)) And (((KeyType=1) And (FrameType=65536)) Or ((KeyType=2) And (FrameType=$b00100&# 48;0)) Or ((KeyType=3) And (FrameType And 64=0)))) Or (Chunkname='idx1') Or Eof(Input); If Not Eof(Input) Then Dec(Position) Else Begin If CheckBox1.Checked Then Begin Seek(Backup,LastFrame); Truncate(Backup); End; Seek(Output,LastIndex); Truncate(Output); Inc(i,IndexDifference-2); End; If CheckBox1.Checked Then Begin If Not(CheckBox2.Checked) Then Begin If StreamStart+j>IndexStart Then Seek(Input,Index Start) Else Seek(Input,StreamStart+j); If Position-j>32768 Then Begin For k:=1 To (Position-j) Div 32768 Do Begin BlockRead(Input,Buffer,32768,Temp); BlockWrite(Backup,Buffer,Temp); End; BlockRead(Input,Buffer,((Position-j) Mod 32768),Temp); BlockWrite(Backup,Buffer,Temp); End Else Begin BlockRead(Input,Buffer,Position-j,Temp); BlockWrite(Backup,Buffer,Temp); End; End Else Difference:=FilePos(Input)-LastBackupPosition-12; End; End Else Begin Seek(Input,FilePos(Input)+6); ChunkName[0]:=#2; BlockRead(Input,ChunkName[1],2); Seek(Input,FilePos(Input)-8); If (ChunkName='dc') Or (ChunkName='wb') Or (ChunkNa me='db') Then Begin ChunkName[0]:=#4; ChunkName:='idx1'; End Else Begin ChunkName[0]:=#4; ChunkName:='0000'; Goto BError; End; End; End; End; End; Application.ProcessMessages; If StopButton Then Begin WriteOut(' Index rebuilding aborted...'); ProgressBar1.Position:=0; StopButton:=False; CloseFile(Input); CloseFile(Output); If CheckBox1.Checked Then CloseFile(Backup); If CheckBox3.Checked Then CloseFile(Log); Erase(Output); EnableButtons; Exit; End; Until (Eof(Input)) Or (ChunkName='idx1'); Size:=i*16; Seek(Output,4); BlockWrite(Output,Size,4); If CheckBox1.Checked Then Begin If ChunkName='idx1' Then StreamSize:=FilePos(Backup)-Stream Start-4 Else StreamSize:=Filesize(Backup)-StreamStart-4; Seek(Backup,StreamStart-4); Inc(StreamSize,4); BlockWrite(Backup,StreamSize,4); Seek(Backup,StreamStart+StreamSize); If (StreamStart+StreamSize) MOD 2=1 Then Begin Buffer[0]:=0; BlockWrite(Backup,Buffer,1); End; Seek(Output,0); Repeat BlockRead(Output,Buffer,32768,Temp); BlockWrite(Backup,Buffer,Temp); Until Not(Temp=32768); Str(Errors,Text); WriteOut(' Finished with '+ListBox1.Items.Strings[Item]+& #39; .'); WriteOut(' Number of errors: '+Text); WriteOut(' Done.'); WriteOut(''); ProgressBar1.Position:=100; Truncate(Backup); CloseFile(Input); CloseFile(Output); CloseFile(Backup); If CheckBox3.Checked Then CloseFile(Log); Erase(Output); End Else Begin If ChunkName='idx1' Then StreamSize:=FilePos(Input)-StreamS tart-4 Else StreamSize:=Filesize(Input)-StreamStart; Seek(Input,StreamStart-4); BlockWrite(Input,StreamSize,4); If StreamStart+StreamSize>IndexStart Then Seek(Input,IndexSt art) Else Seek(Input,StreamStart+StreamSize); If (StreamStart+StreamSize) MOD 2=1 Then Begin Buffer[0]:=0; BlockWrite(Input,Buffer,1); End; Seek(Output,0); Repeat BlockRead(Output,Buffer,32768,Temp); BlockWrite(Input,Buffer,Temp); Until Not(Temp=32768); Truncate(Input); Str(Errors,Text); WriteOut(' Finished with '+ListBox1.Items.Strings[Item]+& #39; .'); WriteOut(' Number of errors: '+Text); WriteOut(' Done.'); WriteOut(''); If CheckBox3.Checked Then CloseFile(Log); ProgressBar1.Position:=100; CloseFile(Input); CloseFile(Output); Erase(Output); End; Inc(Item); Until Item=ListBox1.Items.Count; If CheckBox3.Checked Then Begin Logging:=False; WriteOut(' Done.'); WriteOut(''); End; If Autoclearlist1.Checked Then ListBox1.Items.Clear; {$IFDEF WINDOWS} ListBox1.Perform(LB_SETSEL,0,Item-1); {$ENDIF} EnableButtons; end; procedure TForm1.Button2Click(Sender: TObject); begin {$IFDEF WINDOWS} If Autoclear1.Checked Then RichEdit1.Clear; {$ELSE} If Autoclear1.Checked Then Memo1.Clear; {$ENDIF} DisableButtons; If ListBox1.Items.Count=0 Then Begin WriteOut(' No file selected.'); EnableButtons; Exit; End; Item:=0; If CheckBox3.Checked Then WriteOut(' Stripping index...'); Repeat AssignFile(Input,ListBox1.Items.Strings[Item]); AssignFile(Log,MaskEdit3.Text); {$I-} Reset(Input,1); {$I+} If IOResult<>0 Then Begin WriteOut(' Can not open the file.'); EnableButtons; Exit; End; If CheckBox3.Checked Then Begin {$I-} Reset(Log); {$I+} If IOResult<>0 Then Begin {$I-} Rewrite(Log); {$I+} i:=ioresult; If {IOResult}i<>0 Then Begin WriteOut(' Cannot create log file.'); CloseFile(Input); EnableButtons; Exit; End Else Begin CloseFile(Log); Append(Log); End; End Else Begin CloseFile(Log); Append(Log); End; End; Seek(Input,8); BlockRead(Input,ChunkName[1],8); ChunkName[0]:=#8; If ChunkName<>'AVI LIST' Then Begin WriteOut(' This is not an AVI file.'); CloseFile(Input); EnableButtons; Exit; End; If CheckBox3.Checked Then Begin Logging:=True; WriteOut(' Stripping index for file: '+ListBox1.Items.S trings[Item]); End Else WriteOut(' Stripping index for file: '+ListBox1.It ems.Strings[Item]); Position:=16; Size:=0; Chunkname[0]:=#4; Repeat Position:=Position+Size; Seek(Input,Position); BlockRead(Input,Size,4); BlockRead(Input,Chunkname[1],4); Inc(Position,8); Until Chunkname='movi'; StreamStart:=Position-4; StreamSize:=Size; IndexStart:=CheckOtherIndex(Input); If IndexStart=0 Then Begin WriteOut(' Unexpected end of file, index not found.'); CloseFile(Input); If CheckBox3.Checked Then CloseFile(Log); EnableButtons; Exit; End; Seek(Input,IndexStart); Truncate(Input); Seek(Input,StreamStart-4); BlockWrite(Input,StreamSize,4); CloseFile(Input); WriteOut(' Done.'); WriteOut(''); If CheckBox3.Checked Then CloseFile(Log); Inc(Item); Until Item=ListBox1.Items.Count; If CheckBox3.Checked Then Begin Logging:=False; WriteOut(' Done.'); WriteOut(''); End; If Autoclearlist1.Checked Then ListBox1.Items.Clear; EnableButtons; end; procedure TForm1.Button3Click(Sender: TObject); Label CError; Label CStartRead; begin {$IFDEF WINDOWS} If Autoclear1.Checked Then RichEdit1.Clear; {$ELSE} If Autoclear1.Checked Then Memo1.Clear; {$ENDIF} DisableButtons; If ListBox1.Items.Count=0 Then Begin WriteOut(' No file selected.'); EnableButtons; Exit; End; Item:=0; Errors:=0; If CheckBox3.Checked Then WriteOut(' Error checking... '); Repeat AssignFile(Input,ListBox1.Items.Strings[Item]); AssignFile(Log,MaskEdit3.Text); {$I-} FileMode:=0; Reset(Input,1); FileMode:=2; {$I+} If IOResult<>0 Then Begin WriteOut(' Can not open the file.'); EnableButtons; Exit; End; If CheckBox3.Checked Then Begin {$I-} Reset(Log); {$I+} If IOResult<>0 Then Begin {$I-} Rewrite(Log); {$I+} If IOResult<>0 Then Begin WriteOut(' Cannot create log file.'); CloseFile(Input); EnableButtons; Exit; End Else Begin CloseFile(Log); Append(Log); End; End Else Begin CloseFile(Log); Append(Log); End; End; Seek(Input,8); BlockRead(Input,ChunkName[1],8); ChunkName[0]:=#8; If ChunkName<>'AVI LIST' Then Begin WriteOut(' This is not an AVI file.'); CloseFile(Input); If CheckBox3.Checked Then CloseFile(Log); EnableButtons; Exit; End; If CheckBox3.Checked Then Begin Logging:=True; WriteOut(' Error checking for file: '+ListBox1.Items.Strings [Item]); End Else WriteOut(' Error checking for file: '+ListBox1.Items.St rings[Item]); WriteOut(' NOTE: The error checking is not perfect!'); Chunkname[0]:=#4; Seek(Input,128); BlockRead(Input,Scale,4); BlockRead(Input,Rate,4); Position:=16; Size:=0; Repeat Position:=Position+Size; Seek(Input,Position); BlockRead(Input,Size,4); BlockRead(Input,Chunkname[1],4); Inc(Position,8); Until Chunkname='movi'; StreamStart:=Position-4; StreamSize:=Size; IndexStart:=CheckOtherIndex(Input); If IndexStart=0 Then IndexStart:=FileSize(Input); Chunkname:='idx1'; Position:=4; i:=0; Frame:=0; Interleaved:=False; StopButton:=False; Repeat ProgressBar1.Position:=Position Div (FileSize(Input) Div 100 ;); If StreamStart+Position>IndexStart Then Seek(Input,IndexStar t) Else Seek(Input,StreamStart+Position); If Not Eof(Input) Then Begin CStartRead: BlockRead(Input,Chunkname[1],4,Temp); If ChunkName='LIST' Then Begin Seek(Input,FilePos(Input)+8); Inc(Position,12); Goto CStartRead; End; If ChunkName='JUNK' Then Begin BlockRead(Input,Size,4); Position:=Position+Size+8; If StreamStart+Position>IndexStart Then Seek(Input,Index Start) Else Seek(Input,StreamStart+Position); Goto CStartRead; End; Text2:=Copy(ChunkName,3,2); If (Copy(ChunkName,1,2)='ix') Or (Text2='ix ;') Then Begin Seek(Input,FilePos(Input)+12); Inc(Position,16); If StreamStart+Position>IndexStart Then Seek(Input,Index Start) Else Seek(Input,StreamStart+Position); Interleaved:=True; Goto CStartRead; End; If Not Eof(Input) Then Begin If ((ChunkName[1] In Number) And (ChunkName[2] In Number)) And ((Text2='dc') Or (Text2='db') Or (Tex t2='wb')) Then Begin If (Text2='dc') Or (Text2='db') Then Inc(Fra me); If Interleaved Then Begin Seek(Input,FilePos(Input)-16); Dec(Position,16); Interleaved:=False; End; BlockRead(Input,Size,4,Temp); If (Size<0) And (Temp=4) Then Begin Inc(Position,4); If StreamStart+Position>IndexStart Then Seek(Input,Inde 0;Start) Else Seek(Input,StreamStart+Position); BlockRead(Input,Chunkname[1],4); If ChunkName='LIST' Then Begin Seek(Input,FilePos(Input)+8); Inc(Position,12); Goto CStartRead; End; If ChunkName='JUNK' Then Begin BlockRead(Input,Size,4); Position:=Position+Size+8; If StreamStart+Position>IndexStart Then Seek(Input,Inde 20;Start) Else Seek(Input,StreamStart+Position); Goto CStartRead; End; If StreamStart+Position>IndexStart Then Seek(Input,Inde 0;Start) Else Seek(Input,StreamStart+Position); Goto CError; End; If Not Eof(Input) Then Begin j:=(((Position+Size) Div 2)+((Position+Size) Mod 2))*2+8; If StreamStart+j-1>IndexStart Then Seek(Input,Inde 20;Start) Else Seek(Input,StreamStart+j-1); If Not Eof(Input) Then Begin Position:=(((Position+Size) Div 2)+((Position+Size) Mod 2))*2+8; Inc(i); End; End; End Else CError: If Chunkname<>'idx1' Then Begin Inc(Errors); Str(Frame,Text); Time:=(Frame*Scale) Div Rate; Str(Time Div 3600:2,Hour); Str(Time Div 60:2,Minute); Str(Time Mod 60:2,Second); ZeroAlign(Hour); ZeroAlign(Minute); ZeroAlign(Second); Text:=' Corrupted data detected at frame '+Text+ 9; ('+Hour+':'+Minute +':'+Second+')'; WriteOut(Text); Str(StreamStart+Position,Text); Text:=' Error offset: '+Text+' ($'+IntToH ex(StreamStart+Position,8)+')'; WriteOut(Text); Repeat If StreamStart+Position>IndexStart Then Seek(Input,Inde& #120;Start) Else Seek(Input,StreamStart+Position); If Not Eof(Input) Then Begin BlockRead(Input,Buffer[1],32768,Temp); j:=1; Repeat If ((Chr(Buffer[j])='d') Or (Chr(Buffer[j])='w')) And (Not Eof(Input)) Then Begin If ((Chr(Buffer[j+1])='c') Or (Chr(Buffer[j+1])= 'b')) And (Not Eof(Input)) Then Begin If StreamStart+Position+j-3>IndexStart Then Seek( Input,IndexStart) Else Seek(Input,StreamStart+Position+j-3); If Not Eof(Input) Then BlockRead(Input,ChunkName[1],4); End; End; Inc(j); Text2:=Copy(ChunkName,3,2); Until (((Text2='dc') Or (Text2='db') Or (Text2='wb')) And ((ChunkName[1] In Number ) And (ChunkName[2] In Number))) Or (Chunkname='idx1 ') Or (j>Temp); End; Inc(Position,j-3); Application.ProcessMessages; If StopButton Then Begin WriteOut(' Error checking aborted...'); ProgressBar1.Position:=0; StopButton:=False; CloseFile(Input); If CheckBox3.Checked Then CloseFile(Log); EnableButtons; Exit; End; Text2:=Copy(ChunkName,3,2); Until (((Text2='dc') Or (Text2='db') Or (Text2='wb')) And ((ChunkName[1] In Number) And (ChunkName[2] In Number))) Or (Chunkname='idx1&# 39;) Or Eof(Input); If Not Eof(Input) Then Dec(Position); End Else Begin Seek(Input,FilePos(Input)+6); ChunkName[0]:=#2; BlockRead(Input,ChunkName[1],2); Seek(Input,FilePos(Input)-8); If (ChunkName='dc') Or (ChunkName='wb') Or (ChunkNa me='db') Then Begin ChunkName[0]:=#4; ChunkName:='idx1'; End Else Begin ChunkName[0]:=#4; ChunkName:='0000'; Goto CError; End End; End; End; Application.ProcessMessages; If StopButton Then Begin WriteOut(' Error checking aborted...'); ProgressBar1.Position:=0; StopButton:=False; CloseFile(Input); If CheckBox3.Checked Then CloseFile(Log); EnableButtons; Exit; End; Until (Eof(Input)) Or (ChunkName='idx1'); Str(Errors,Text); WriteOut(' Finished with '+ListBox1.Items.Strings[Item]+' .'); WriteOut(' Number of errors: '+Text); WriteOut(' Done.'); WriteOut(''); If CheckBox3.Checked Then CloseFile(Log); ProgressBar1.Position:=100; CloseFile(Input); Inc(Item); Until Item=ListBox1.Items.Count; If CheckBox3.Checked Then Begin Logging:=False; Str(Errors,Text); WriteOut(' Finished with '+ListBox1.Items.Strings[Item]+ 9; .'); WriteOut(' Number of errors: '+Text); WriteOut(' Done.'); WriteOut(''); End; If Autoclearlist1.Checked Then ListBox1.Items.Clear; EnableButtons; end; procedure TForm1.Exit1Click(Sender: TObject); begin Close; end; procedure TForm1.About1Click(Sender: TObject); begin Form1.Enabled:=False; Form2.Show; end; procedure TForm1.StayTop(Sender: TObject); begin If Stayontop1.Checked Then Begin Stayontop1.Checked:=Not(Stayontop1.Checked); {$IFDEF WINDOWS} SetWindowPos(TForm1(Self).Handle,HWND_NOTOPMOST,0,0,0,0, SWP_NOSIZE+SWP_NOMOVE); {$ENDIF} End Else Begin Stayontop1.Checked:=Not(Stayontop1.Checked); {$IFDEF WINDOWS} SetWindowPos(TForm1(Self).Handle,HWND_TOPMOST,0,0,0,0,SW P_NOSIZE+SWP_NOMOVE); {$ENDIF} End; end; procedure TForm1.FormCreate(Sender: TObject); begin {$IFDEF WINDOWS} DropFileTarget1.register(Form1); {$ENDIF} If Tag=0 Then Begin GetDir(0,ConfigDir); {$IFDEF WINDOWS} If Copy(ConfigDir,Length(ConfigDir),1)='\' Then AssignFile(Config ,ConfigDir+'DivFix.ini') Else AssignFile(Config,ConfigDir+'\DivFix.ini'); {$ELSE} If Copy(ConfigDir,Length(ConfigDir),1)='/' Then AssignFile(Config ,ConfigDir+'DivFix.ini') Else AssignFile(Config,ConfigDir+'/DivFix.ini'); {$ENDIF} {$I-} Reset(Config); {$I+} If IOResult=0 Then Begin While Not(Eof(Config)) Do Begin Readln(Config,Text); If Copy(Text,1,7)='LastDir' Then Begin Form1.OpenDialog1.InitialDir:=Copy(Text,9,Length(Te 0;t)-9); {$IFDEF WINDOWS} CfgDir:=Form1.OpenDialog1.InitialDir+'\'; {$ELSE} CfgDir:=Form1.OpenDialog1.InitialDir+'/'; {$ENDIF} End; If Copy(Text,1,7)='DestDir' Then Begin Form1.MaskEdit2.Text:=Copy(Text,9,Length(Text)-7) ; CfgDest:=Form1.MaskEdit2.Text; End