PhotoRec: avoid to split mov, stricter check for m2ts, m2t, ogg anti-split check

This commit is contained in:
Christophe Grenier 2008-07-30 09:20:33 +02:00
parent 90a4057611
commit 9194837f07
3 changed files with 11 additions and 2 deletions

View file

@ -82,7 +82,8 @@ static int header_check_m2ts(const unsigned char *buffer, const unsigned int buf
static int header_check_m2t(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new)
{
if(file_recovery!=NULL && file_recovery->file_stat!=NULL &&
file_recovery->file_stat->file_hint==&file_hint_m2ts)
file_recovery->file_stat->file_hint==&file_hint_m2ts &&
file_recovery->calculated_file_size == file_recovery->file_size)
return 0;
/* Each frame is 188 byte long and begins by a TS_SYNC_BYTE */
if(buffer[0]==0x47 && buffer[188]==0x47 && buffer[2*188]==0x47 &&

View file

@ -56,6 +56,12 @@ static int header_check_mov(const unsigned char *buffer, const unsigned int buff
{
unsigned int i=0;
unsigned int prev_atom_skip=0;
if(file_recovery!=NULL && file_recovery->file_stat!=NULL &&
file_recovery->file_stat->file_hint==&file_hint_mov &&
file_recovery->calculated_file_size == file_recovery->file_size)
{ /* PhotoRec is already trying to recover this mov file */
return 0;
}
while(i<buffer_size-8)
{
unsigned int atom_size;

View file

@ -54,7 +54,9 @@ static void register_header_check_ogg(file_stat_t *file_stat)
static int header_check_ogg(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new)
{
if(file_recovery!=NULL && file_recovery->file_stat!=NULL && file_recovery->file_stat->file_hint==&file_hint_ogg)
if(file_recovery!=NULL && file_recovery->file_stat!=NULL &&
file_recovery->file_stat->file_hint==&file_hint_ogg &&
file_recovery->calculated_file_size == file_recovery->file_size)
return 0;
if(memcmp(buffer,ogg_header,sizeof(ogg_header))==0)
{