PhotoRec: disable data check of .m2ts files for small blocksize

This commit is contained in:
Christophe Grenier 2014-07-26 16:21:22 +02:00
parent 4d8291bb4c
commit 617c63a47f

View file

@ -115,7 +115,9 @@ static int header_check_m2ts(const unsigned char *buffer, const unsigned int buf
{
unsigned int i;
if(file_recovery!=NULL && file_recovery->file_stat!=NULL &&
file_recovery->data_check==&data_check_ts_192)
file_recovery->file_stat->file_hint==&file_hint_m2ts &&
(file_recovery->data_check==&data_check_ts_192 ||
file_recovery->blocksize < 5))
return 0;
/* BDAV MPEG-2 transport stream */
/* Each frame is 192 byte long and begins by a TS_SYNC_BYTE */
@ -141,17 +143,13 @@ static int header_check_m2ts(const unsigned char *buffer, const unsigned int buf
}
else
file_recovery_new->extension="ts";
file_recovery_new->min_filesize=192;
file_recovery_new->calculated_file_size=0;
/* data_check_ts_192 is for a check at header_check_m2ts() beginning
* so always define data_check even if it will only really work
* for blocksize >= 3 */
file_recovery_new->data_check=&data_check_ts_192;
if(file_recovery_new->blocksize > 5/2)
{
file_recovery_new->file_check=&file_check_size_lax;
}
file_recovery_new->file_rename=&file_rename_ts_192;
file_recovery_new->min_filesize=192;
if(file_recovery_new->blocksize < 5)
return 1;
file_recovery_new->calculated_file_size=0;
file_recovery_new->data_check=&data_check_ts_192;
file_recovery_new->file_check=&file_check_size_lax;
return 1;
}