summaryrefslogtreecommitdiffstats
path: root/src/file_amr.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2010-05-21 08:56:41 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2010-05-21 08:56:41 +0200
commit8ebbe0e42e7d201dc75d241dc9acbde7c2fd43ab (patch)
treed9c4ab1b2952b9669abce3393cd459dcd3e701e3 /src/file_amr.c
parent5afe3fc4208b33877b24c8fc1a045c5d2f3fbdb6 (diff)
PhotoRec: add information about amr file format
Diffstat (limited to 'src/file_amr.c')
-rw-r--r--src/file_amr.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/file_amr.c b/src/file_amr.c
index f0167b1..81e7ef4 100644
--- a/src/file_amr.c
+++ b/src/file_amr.c
@@ -29,6 +29,7 @@
#include <stdio.h>
#include "types.h"
#include "filegen.h"
+#include "log.h"
static void register_header_check_amr(file_stat_t *file_stat);
static int header_check_amr(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);
@@ -54,11 +55,38 @@ static void register_header_check_amr(file_stat_t *file_stat)
register_header_check(0, amr_header,sizeof(amr_header), &header_check_amr, file_stat);
}
+#if 0
+static int data_check_amr(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
+{
+ while(file_recovery->calculated_file_size + buffer_size/2 >= file_recovery->file_size &&
+ file_recovery->calculated_file_size + 2 < file_recovery->file_size + buffer_size/2)
+ {
+ const unsigned int i=file_recovery->calculated_file_size - file_recovery->file_size + buffer_size/2;
+ switch(buffer[i]&0x70)
+ {
+ case 0x00: file_recovery->calculated_file_size+=13; break;
+ case 0x10: file_recovery->calculated_file_size+=14; break;
+ case 0x20: file_recovery->calculated_file_size+=16; break;
+ case 0x30: file_recovery->calculated_file_size+=18; break;
+ case 0x40: file_recovery->calculated_file_size+=20; break;
+ case 0x50: file_recovery->calculated_file_size+=21; break;
+ case 0x60: file_recovery->calculated_file_size+=27; break;
+ case 0x70: file_recovery->calculated_file_size+=32; break;
+ }
+ }
+ return 1;
+}
+#endif
static int header_check_amr(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(memcmp(buffer,amr_header,sizeof(amr_header))==0)
{
reset_file_recovery(file_recovery_new);
+#if 0
+ file_recovery_new->calculated_file_size=6;
+ file_recovery_new->data_check=&data_check_amr;
+ file_recovery_new->file_check=&file_check_size;
+#endif
file_recovery_new->extension=file_hint_amr.extension;
return 1;
}