summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiaoqing MA <[email protected]>2018-07-10 19:37:58 +0800
committerXiaoqing MA <[email protected]>2018-07-10 19:37:58 +0800
commitda0c28aaa758f1c90dd174dcf4d5608d49c76f13 (patch)
treeecab65072b1bf4997df5676f16c91c687d01dd5a
parent6bff4390c0eb23efbd432796dcbecc2dd0e29de8 (diff)
ned ed 13
-rw-r--r--bin/testbin18208 -> 0 bytes
-rw-r--r--bin/test_dirbin22504 -> 0 bytes
-rw-r--r--inc/vdefine.h4
-rw-r--r--lib/libvdefine.abin15418 -> 0 bytes
-rw-r--r--src/libvdefine.abin15418 -> 0 bytes
-rw-r--r--src/vdefine.c13
-rw-r--r--src/vdefine.obin15056 -> 0 bytes
-rw-r--r--test/testbin18208 -> 0 bytes
-rw-r--r--test/test.c81
-rw-r--r--test/test_dirbin22504 -> 0 bytes
-rw-r--r--test/test_dir.c61
11 files changed, 46 insertions, 113 deletions
diff --git a/bin/test b/bin/test
deleted file mode 100644
index f6ed770..0000000
--- a/bin/test
+++ /dev/null
Binary files differ
diff --git a/bin/test_dir b/bin/test_dir
deleted file mode 100644
index 9e507c4..0000000
--- a/bin/test_dir
+++ /dev/null
Binary files differ
diff --git a/inc/vdefine.h b/inc/vdefine.h
index 3d6b0e0..cc83ed8 100644
--- a/inc/vdefine.h
+++ b/inc/vdefine.h
@@ -22,11 +22,11 @@ int is_mpeg_ts(const char* buff, size_t size);
void *memchr_flv(const char *buff_each, size_t size_each);
int is_flv_each(const char* buff_each, size_t size_each,const char *buff);
int is_flv(const char* buff, size_t size);
-int is_mp4_part_spe(const char *buff);//, int count_type)
+int is_mp4_part_spe(const char *buff);
int c_is_mp3(char c);
int is_mp4_part(const char *buff_part);
void *memmem_mp4(const char *buff_each, size_t size_each);
-int is_mp4_each(const char* buff_each, size_t size_each, const char *buff);//, int count_type)
+int is_mp4_each(const char* buff_each, size_t size_each, const char *buff);
int is_mp4(const char* buff, size_t size);
int AV_container_identify(const char* buff, size_t size);
diff --git a/lib/libvdefine.a b/lib/libvdefine.a
deleted file mode 100644
index f2182b7..0000000
--- a/lib/libvdefine.a
+++ /dev/null
Binary files differ
diff --git a/src/libvdefine.a b/src/libvdefine.a
deleted file mode 100644
index f2182b7..0000000
--- a/src/libvdefine.a
+++ /dev/null
Binary files differ
diff --git a/src/vdefine.c b/src/vdefine.c
index f7af817..60eac83 100644
--- a/src/vdefine.c
+++ b/src/vdefine.c
@@ -3,7 +3,7 @@
#define AV_CONTAINER_FLV 2
#define AV_CONTAINER_MP4 3
#define UNKNOWN 4
-#define FIT_TIMES 1//#define FIT_TIMES 2
+#define FIT_TIMES 1
#define MAX_FLV_FRAME max_flv_frame;
#include "vdefine.h"
@@ -55,8 +55,6 @@ int is_mpeg_ts_each(const char *buff_each, size_t size_each, const char *buff, s
if (*pack_tail == 0x47 && *(pack_tail-188) == 0x47)
{
ret_ts_each = 1;
- //printf("p-buff is %d.\n",p-buff);
- //printf("pack_tail - buff is %d.\n",pack_tail-buff);
break;
}
break;
@@ -107,7 +105,6 @@ int is_mpeg_ts(const char* buff, size_t size)
void *memchr_flv(const char *buff_each, size_t size_each)
{
void *ret_memflv = NULL;
- //int i;
const char *p = buff_each;
while (p < buff_each + size_each)
{
@@ -139,7 +136,6 @@ int is_flv_each(const char* buff_each, size_t size_each, const char *buff)
if (fit_times > FIT_TIMES)
{
ret_flv_each = 1;
- //printf("p-buff is %d.\n",p-buff);
break;
}
}
@@ -230,12 +226,8 @@ void *memmem_mp4(const char *buff_each, size_t size_each)
void *ret_memmp4 = NULL;
char s;
const char *p = buff_each;
- //int i;
while (p + 3 < buff_each + size_each)
{
- //if (is_mp4_part_spe(p) == 1)
- //if (is_mp4_part(p) == 1 && is_mp4_part_spe(p) == 1)
- //if (c_is_mp3(*p) == 1 && is_mp4_part_spe(p) == 1)
if (is_mp4_part(p) == 1)
{
ret_memmp4 = (void *)p;
@@ -274,7 +266,6 @@ int is_mp4_each(const char* buff_each, size_t size_each, const char *buff)
if (fit_times > FIT_TIMES&&sig_spe >= 1)
{
ret_mp4_each = 1;
- //printf("p-buff is %d.\n",p-buff);
break;
}
if (fit_times > FIT_TIMES+1)
@@ -339,7 +330,7 @@ int is_mp4(const char* buff, size_t size)
}
else
{
- ret_mp4_each = is_mp4_each(p_each, size - (p_each - buff), buff);//,count_type);//int ret = is_mp4_each(p_each, size - (p_each - buff), buff,count_type);
+ ret_mp4_each = is_mp4_each(p_each, size - (p_each - buff), buff);
if (ret_mp4_each == 1)
{
ret_mp4 = 1;
diff --git a/src/vdefine.o b/src/vdefine.o
deleted file mode 100644
index 75a7ba9..0000000
--- a/src/vdefine.o
+++ /dev/null
Binary files differ
diff --git a/test/test b/test/test
deleted file mode 100644
index f6ed770..0000000
--- a/test/test
+++ /dev/null
Binary files differ
diff --git a/test/test.c b/test/test.c
index 7ea5738..2121589 100644
--- a/test/test.c
+++ b/test/test.c
@@ -1,5 +1,5 @@
#include "vdefine.h"
-#define SIZE_BUFF 0xffffffff-1//16*16*16*16*16*16*16*16-1//6*16*16*16*16*16
+#define SIZE_BUFF 0xffffffff-1
#include <dirent.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -13,30 +13,27 @@ buff_inf *buff_get(char *vfile) {
buff_inf *buff_inf_h = (buff_inf *)malloc(sizeof(buff_inf));
FILE *fr = NULL;
- char *buff_ori = (char *)malloc(sizeof(char *)*SIZE_BUFF);//CH
- char *buff = buff_ori;//CH
+ char *buff_ori = (char *)malloc(sizeof(char *)*SIZE_BUFF);
+ char *buff = buff_ori;
memset(buff, 0, sizeof(buff));
if ((fr = fopen(vfile, "rb")) == NULL)
{
perror("fopen error:");
buff_inf_h->buff = NULL;
buff_inf_h->size = 0;
- return buff_inf_h;//-1;
+ return buff_inf_h;
}
- size_t i = 0;//unsigned int i = 0;//size_t i = 0;
- //int j = 0;
+ size_t i = 0;
while (!feof(fr))
{
fread(buff, 1, 1, fr);
buff += 1;
i++;
}
- buff_inf_h->buff = (char *)malloc(sizeof(char *) * (i-1));//(i-2));
- memcpy(buff_inf_h->buff, buff - i, i-1);//i-2);
- buff_inf_h->size = i-1;//i - 2;
- //buff_inf_h.buff = buff - i;
- //buff_inf_h.size = i;
- free(buff_ori);//CH--free(buff - i);//?
+ buff_inf_h->buff = (char *)malloc(sizeof(char *) * (i-1));
+ memcpy(buff_inf_h->buff, buff - i, i-1);
+ buff_inf_h->size = i-1;
+ free(buff_ori);
buff_ori = NULL;
fclose(fr);
return buff_inf_h;
@@ -46,7 +43,6 @@ int main(int argc, char *argv[])
{
char *vfile = argv[1];
buff_inf *buff_inf_h;
- //CH--char *buff;// = (char *)malloc(sizeof(char *)*size);//;
int ret;
int ret_sig = atoi(argv[2]);
int sig_show_all = atoi(argv[3]);
@@ -66,59 +62,38 @@ int main(int argc, char *argv[])
int divide_e = 1;
size = (buff_inf_h->size / divide_h)*(divide_e - divide_s);
-
- //CH--buff = (char *)malloc(sizeof(char *)*size);
- //CH--memcpy(buff, buff_inf_h->buff + (buff_inf_h->size / divide_h)*divide_s, size);
-
- //printf("buff_whole is %p.\n", buff_inf_h->buff);
- //printf("buff_inf_h.size/divide_h is %x.\n", buff_inf_h->size / divide_h);
- //printf("buff starts from(>=) %p.\n", buff);
- //printf("buff ends at(<) %p.\n", buff + size - 1);//+size
- ret = AV_container_identify(buff_inf_h->buff + (buff_inf_h->size / divide_h)*divide_s, size);;//CCH--ret = AV_container_identify(buff, size);//CH--(const char *)?
- //CH--free(buff);
- //CH--buff = NULL;
- //printf("define : %d.\n", ret);
- //printf("size of whole buff is %d.\n", buff_inf_h->size);//size - 1
- //printf("size of chosen buff is %d.\n", size);
+ ret = AV_container_identify(buff_inf_h->buff + (buff_inf_h->size / divide_h)*divide_s, size);
}
- else
- ret = AV_container_identify(buff_inf_h->buff, buff_inf_h->size);
+ else
+ {
+ ret = AV_container_identify(buff_inf_h->buff, buff_inf_h->size);
+ }
if (sig_show_all == 0)
{
if (ret != ret_sig)
{
- printf("-----------------data of [%s] is kind of [%d].\n",vfile,ret);// dp->d_name, ret);
- //printf("define : %d.\n", ret);
+ printf("-----------------data of [%s] is kind of [%d].\n",vfile,ret);
printf("size of whole buff is %d.\n", buff_inf_h->size);
- if (sig_choose_all == 0)
- printf("size of chosen buff is %d.\n", size);
+ if (sig_choose_all == 0)
+ {
+ printf("size of chosen buff is %d.\n", size);
+ }
}
}
else
{
- printf("-----------------data of [%s] is kind of [%d].\n", vfile, ret);// dp->d_name, ret);
+ printf("-----------------data of [%s] is kind of [%d].\n", vfile, ret);
printf("size of whole buff is %d.\n", buff_inf_h->size);
- if (sig_choose_all == 0)
- printf("size of chosen buff is %d.\n", size);
+ if (sig_choose_all == 0)
+ {
+ printf("size of chosen buff is %d.\n", size);
+ }
}
- free(buff_inf_h->buff);//CH--
- buff_inf_h->buff = NULL;//CH--
- free(buff_inf_h);//CH--
- buff_inf_h = NULL;//CH--
- /*
- free(buff);
-
- free(buff_inf_h->buff);
- buff_inf_h = NULL;
- free(buff_inf_h);
- return ret;
- */
-
- //CH--free(buff_inf_h->buff);
- //CH--buff_inf_h = NULL;
- //CH--free(buff_inf_h);
-
+ free(buff_inf_h->buff);
+ buff_inf_h->buff = NULL;
+ free(buff_inf_h);
+ buff_inf_h = NULL;
return ret;
}
diff --git a/test/test_dir b/test/test_dir
deleted file mode 100644
index 9e507c4..0000000
--- a/test/test_dir
+++ /dev/null
Binary files differ
diff --git a/test/test_dir.c b/test/test_dir.c
index 4566a20..14a8a62 100644
--- a/test/test_dir.c
+++ b/test/test_dir.c
@@ -1,5 +1,5 @@
#include "vdefine.h"
-#define SIZE_BUFF 0xffffffff-1//16*16*16*16*16*16*16*16-1//6*16*16*16*16*16
+#define SIZE_BUFF 0xffffffff-1
#include <dirent.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -14,7 +14,7 @@ buff_inf *buff_get(char *vfile) {
buff_inf *buff_inf_h = (buff_inf *)malloc(sizeof(buff_inf));
FILE *fr = NULL;
- char *buff_ori = (char *)malloc(sizeof(char *)*SIZE_BUFF);//CH
+ char *buff_ori = (char *)malloc(sizeof(char *)*SIZE_BUFF);
char *buff = buff_ori;//CH
memset(buff, 0, sizeof(buff));
if ((fr = fopen(vfile, "rb")) == NULL)
@@ -22,22 +22,19 @@ buff_inf *buff_get(char *vfile) {
perror("fopen error:");
buff_inf_h->buff = NULL;
buff_inf_h->size = 0;
- return buff_inf_h;//-1;
+ return buff_inf_h;
}
- size_t i = 0;//unsigned int i = 0;//size_t i = 0;
- //int j = 0;
+ size_t i = 0;
while (!feof(fr))
{
fread(buff, 1, 1, fr);
buff += 1;
i++;
}
- buff_inf_h->buff = (char *)malloc(sizeof(char *) * (i-1));//(i-2));
- memcpy(buff_inf_h->buff, buff - i, i-1);//i-2);
- buff_inf_h->size = i-1;//i - 2;
- //buff_inf_h.buff = buff - i;
- //buff_inf_h.size = i;
- free(buff_ori);//CH--free(buff - i);//?
+ buff_inf_h->buff = (char *)malloc(sizeof(char *) * (i-1));
+ memcpy(buff_inf_h->buff, buff - i, i-1);
+ buff_inf_h->size = i-1;
+ free(buff_ori);
buff_ori = NULL;
fclose(fr);
return buff_inf_h;
@@ -52,12 +49,10 @@ int main(int argc, char *argv[])
memcpy(vfile_ori,vdir,strlen(vdir));
strcat(vfile_ori, "/");
char *vfile = (char *)malloc(SIZE_FILE);
- //strcat(vdir,".dir");
dirp = opendir(vdir);
struct stat info;
buff_inf *buff_inf_h;
- //CH--char *buff;// = (char *)malloc(sizeof(char *)*size);//;
int ret;
int ret_sig = atoi(argv[2]);
int sig_show_all = atoi(argv[3]);
@@ -69,7 +64,7 @@ int main(int argc, char *argv[])
while ((dp = readdir(dirp)) != NULL)
{
memcpy(vfile,vfile_ori,SIZE_FILE);
- strncat(vfile, dp->d_name, strlen(dp->d_name));//strcat(vfile,dp->d_name);//vfile = dp->d_name;//fileinfo->name;//&((fileinfo->name)[0]);//argv[1];// "0003.dat";
+ strncat(vfile, dp->d_name, strlen(dp->d_name));
stat(vfile, &info);
if(S_ISDIR(info.st_mode))
@@ -87,22 +82,7 @@ int main(int argc, char *argv[])
divide_e = 1;//atoi(argv[7]);//1;
size = (buff_inf_h->size / divide_h)*(divide_e - divide_s);
- //size = atoi(argv[7]);
- //divide_e = (buff_inf_h->size / divide_h)*(divide_h-divide_s);
- //size = size>divide_e?divide_e:size;
- //CH--buff = (char *)malloc(sizeof(char *)*size);
- //CH--memcpy(buff, buff_inf_h->buff + (buff_inf_h->size / divide_h)*divide_s, size);
-
- //printf("buff_whole is %p.\n", buff_inf_h->buff);
- //printf("buff_inf_h.size/divide_h is %x.\n", buff_inf_h->size / divide_h);
- //printf("buff starts from(>=) %p.\n", buff);
- //printf("buff ends at(<) %p.\n", buff + size - 1);//+size
ret = AV_container_identify(buff_inf_h->buff + (buff_inf_h->size / divide_h)*divide_s, size);;//CCH--ret = AV_container_identify(buff, size);//CH--(const char *)?
- //CH--free(buff);
- //CH--buff = NULL;
- //printf("define : %d.\n", ret);
- //printf("size of whole buff is %d.\n", buff_inf_h->size);//size - 1
- //printf("size of chosen buff is %d.\n", size);
}
else
ret = AV_container_identify(buff_inf_h->buff, buff_inf_h->size);
@@ -111,7 +91,6 @@ int main(int argc, char *argv[])
if (ret != ret_sig)
{
printf("-----------------data of [%s] is kind of [%d].\n", dp->d_name, ret);
- //printf("define : %d.\n", ret);
printf("size of whole buff is %d.\n", buff_inf_h->size);
if (sig_choose_all == 0)
printf("size of chosen buff is %d.\n", size);
@@ -125,24 +104,12 @@ int main(int argc, char *argv[])
if (sig_choose_all == 0)
printf("size of chosen buff is %d.\n", size);
}
- free(buff_inf_h->buff);//CH--
- buff_inf_h->buff = NULL;//CH--
- free(buff_inf_h);//CH--
- buff_inf_h = NULL;//CH--
+ free(buff_inf_h->buff);
+ buff_inf_h->buff = NULL;
+ free(buff_inf_h);
+ buff_inf_h = NULL;
}
- /*
- free(buff);
-
- free(buff_inf_h->buff);
- buff_inf_h = NULL;
- free(buff_inf_h);
- return ret;
- */
-
- //CH--free(buff_inf_h->buff);
- //CH--buff_inf_h = NULL;
- //CH--free(buff_inf_h);
-
+
free(vfile);
free(vfile_ori);