diff --git a/src/file_m2ts.c b/src/file_m2ts.c index 47d5591e..07842d19 100644 --- a/src/file_m2ts.c +++ b/src/file_m2ts.c @@ -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; }