summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorXiaoqing MA <[email protected]>2018-07-13 19:14:09 +0800
committerXiaoqing MA <[email protected]>2018-07-13 19:14:09 +0800
commit519a649207ae31f44f1f38bc83e55fcc366613b7 (patch)
tree83f432a962cf0e75cd2d2a2d4485c1fa181ad9ce /inc
parent6da7a14888fff0cefd68bfb67718ad1c7cccf0a1 (diff)
1.修改命名为av_format_identify.h与av_format_identify.c
2.头文件av_format_identify.h中仅保留供调用者查看的函数定义 3.添加.gitignore用以排除特定文件类型(.a,.o)的上传 4.将视频封装格式判断函数AV_container_identify返回数值与类型对应的宏顶一顶到AV_container_identify.h中 5.修改is_mp4_part_boxtype为is_mp4_boxtype,修改is_mp4_part_4char为is_mp4_boxname 6.取消函数char_is_mp4,将其以for循环的形式直接放入is_mp4_boxname中 7.将计数型变量fit_times初始化由1变为0并改变其与对应上限值FIT_TIMES的关系比较运算符>为>= 8.在is_mp4_each中,修改fit_times >= FIT_TIMES + 1为fit_times > FIT_TIMES 8.全局变量设置为以"g_"开头的形式,且保证变量名命名清晰,mp4_box_type_all变为p_mp4_box_type_all,count_type变为g_mp4_box_type_count.同时将g_mp4_box_type_count设置为const int. 9.将所有数值变量定义为宏,包括#define TS_SYNC_BYTE 0x47, #define TS_PKT_SIZE 188, #define FLV_TAG_AUDIO 0x08, #define FLV_TAG_VIDEO 0x09, #define FLV_TAG_SCRIPT_DATA 0x12 10.修改is_mpeg_ts_each函数:Continuity counter的变化是针对PID的,且PID为8191时除外; 11.修改is_mpeg_ts_each函数:为防止其他封装格式视频内会出现部分形似ts package情况,将条件进一步严苛至特定查找未来188倍数的字节是否为0x47,倍数的选择为剩余字节流长度除以188取整的数目及其半数与四分之一数的取整 12.修改is_mp4_each函数,加入对mdat box可能出现的largesize情况的考虑。
Diffstat (limited to 'inc')
-rw-r--r--inc/av_format_identify.h (renamed from inc/vdefine.h)26
1 files changed, 9 insertions, 17 deletions
diff --git a/inc/vdefine.h b/inc/av_format_identify.h
index 7e10e54..132cb8b 100644
--- a/inc/vdefine.h
+++ b/inc/av_format_identify.h
@@ -1,12 +1,11 @@
-#ifndef _VDEFINE_H
-#define _VDEFINE_H
+#ifndef _AV_FORMAT_IDENTIFY_H
+#define _AV_FORMAT_IDENTIFY_H
#include <arpa/inet.h>
#include <stdlib.h>
-#define _GNU_SOURCE
-#define __USE_GNU
#include <string.h>
#include <stdio.h>
+#include <stdint.h>
#include <math.h>
#include <sys/types.h>
@@ -14,8 +13,10 @@
#include <arpa/inet.h>
-extern const char *mp4_box_type_all[];
-extern int count_type;
+#define AV_CONTAINER_MPEGTS 1
+#define AV_CONTAINER_FLV 2
+#define AV_CONTAINER_MP4 3
+#define UNKNOWN 4
/*To find that whether the initial size bytes pointed to by buff satisfies the rules of MPEG-TS AV Container
* by supposing that its first 1 byte is sync_byte in ts header.*/
@@ -23,29 +24,20 @@ int is_mpeg_ts_each(const char *buff, size_t size);
/*To identify whether the whole byte stream belongs to MPEG_TS container*/
int is_mpeg_ts(const char* buff, size_t size);
-/*Scanning the initial size bytes of the memory area pointed to by buff for the first instance of 0x08, 0x09 or 0x12*/
-void *memchr_flv(const char *buff, size_t size);
+
/*To find that whether the initial size bytes pointed to by buff satisfies the rules of FLV AV Container
* by supposing that its first 1 byte is TagType in FLV Tag Header.*/
int is_flv_each(const char* buff, size_t size);
/*To identify whether the whole byte stream belongs to FLV container*/
int is_flv(const char* buff, size_t size);
-/*whether the initial several bytes of the memory area pointed to by buff_part is one kind of Boxtype of MP4 file*/
-int is_mp4_part_boxtype(const char *buff);
-/*whether one byte is number or lower case*/
-int char_is_mp4(char c);
-/*whether all of those initial 4 bytes of the memory area pointed to by buff are number or lower case */
-int is_mp4_part_4char(const char *buff);
-/*Scanning the initial size bytes of the memory area pointed to by buff for the first instance of continuous 4 bytes of number or lower case*/
-void *memmem_mp4(const char *buff, size_t size);
/*To find that whether the initial size bytes pointed to by buff satisfies the rules of MP4 AV Container
* by supposing that its first 4 byte is Boxtype in Box of MP4 file.*/
int is_mp4_each(const char* buff, size_t size);
/*To identify whether the whole byte stream belongs to MP4 container*/
int is_mp4(const char* buff, size_t size);
+/*To identify the container type of the whole byte stream*/
int AV_container_identify(const char* buff, size_t size);
-
#endif