Added support for OA04A10, SC035GS, LT6911, and the new 5-inch LCD

Added support for OA04A10, SC035GS, LT6911, and the new 5-inch display
This commit is contained in:
某杰同学
2024-05-15 00:00:53 -07:00
parent 646bd60447
commit 20a606bbdb
942 changed files with 139276 additions and 19 deletions

4
.gitignore vendored
View File

@@ -1,5 +1,9 @@
*~
*.swp
*.o
*.a
*.ko
*.d
host-tools/
*.sqfs
build/tools/common/sd_tools/genimage.cfg.tmp

View File

@@ -15,6 +15,8 @@ CONFIG_STORAGE_TYPE_sd=y
CONFIG_MIPI_PANEL_ZCT2133V1=y
CONFIG_SENSOR_GCORE_GC4653=y
CONFIG_SENSOR_OV_OS04A10=y
CONFIG_SENSOR_LONTIUM_LT6911=y
CONFIG_SENSOR_SMS_SC035GS=y
CONFIG_UBOOT_2021_10=y
CONFIG_KERNEL_SRC_5.10=y
CONFIG_KERNEL_UNCOMPRESSED=y
@@ -22,5 +24,5 @@ CONFIG_KERNEL_UNCOMPRESSED=y
CONFIG_SENSOR_TUNING_PARAM_cv181x_src_gcore_gc4653=y
# CONFIG_SENSOR_TUNING_PARAM_sg200x_src_ov_os04a10=y
# CONFIG_ROOTFS_OVERLAYFS is not set
CONFIG_ENABLE_FREERTOS=y
# CONFIG_ENABLE_FREERTOS=y
# CONFIG_TARGET_PACKAGE_GATORD is not set

View File

@@ -68,5 +68,9 @@ then
devmem 0x0300118C 32 0x5
echo -n " beta "
fi
if [ -e /boot/kvmtest ]
then
cp /mnt/data/sensor_cfg.ini.LT /mnt/data/sensor_cfg.ini
fi
echo "OK"
fi

View File

@@ -57,6 +57,7 @@ ifneq ($(FLASH_SIZE_SHRINK),y)
@cp -f sample/mipi_tx/sample_dsi $(DESTDIR)/usr/bin
@cp -f sample/vio/sample_vio $(DESTDIR)/usr/bin
@cp -f sample/sensor_test/sensor_test $(DESTDIR)/usr/bin
@cp -f sample/test_mmf/test_mmf $(DESTDIR)/usr/bin
@cp -f sample/audio/sample_audio $(DESTDIR)/usr/bin
#@cp -f sample/cipher/sample_cipher $(DESTDIR)/usr/bin
#@cp -f sample/cvg/sample_cvg $(DESTDIR)/usr/bin

View File

@@ -27,8 +27,8 @@
#define LT6911_ID 6911
#define INPUT_WIDTH (1920)
#define INPUT_HEIGHT (1080)
#define INPUT_WIDTH (1920) // 1920 1280 800
#define INPUT_HEIGHT (1080) // 1080 720 600
/****************************************************************************
* global variables *
@@ -401,6 +401,7 @@ static CVI_S32 sensor_set_init(VI_PIPE ViPipe, ISP_INIT_ATTR_S *pstInitAttr)
static CVI_S32 sensor_probe(VI_PIPE ViPipe)
{
printf("[sensor_prob = lt6911_probe] \n");
return lt6911_probe(ViPipe);
}
@@ -421,3 +422,4 @@ ISP_SNS_OBJ_S stSnsLT6911_Obj = {
.pfnExpAeCb = cmos_init_ae_exp_function,
.pfnSnsProbe = sensor_probe,
};

View File

@@ -20,8 +20,8 @@ extern "C" {
#include "lt6911_cmos_ex.h"
// not real time resolution
#define WIDTH 3840//3840 1920
#define HEIGHT 2160//2160 1080
#define WIDTH 1920 // 3840 1920 1280 800
#define HEIGHT 1080 // 2160 1080 720 600
static LT6911_MODE_S g_astLt6911_mode[LT6911_MODE_NUM] = {
[LT6911_MODE_NORMAL] = {
@@ -50,8 +50,8 @@ struct combo_dev_attr_s lt6911_rx_attr = {
.mac_clk = RX_MAC_CLK_600M,
.mipi_attr = {
.raw_data_type = YUV422_8BIT,
.lane_id = {2, 0, 1, 3, 4}, //3, 0, 1, 2, 4 ; 1, 4, 3, 2, 0 2, 0, 1, 3, 4 3, 1, 2, 4, 0
.pn_swap = {1, 1, 1, 1, 1},
.lane_id = {2, 4, 3, 1, 0}, //3, 0, 1, 2, 4 ; 1, 4, 3, 2, 0 2, 0, 1, 3, 4 3, 1, 2, 4, 0
.pn_swap = {0, 0, 0, 0, 0},
.wdr_mode = CVI_MIPI_WDR_MODE_NONE,
.dphy = {
.enable = 1,

View File

@@ -17,10 +17,11 @@
#include "cvi_sns_ctrl.h"
#include "lt6911_cmos_ex.h"
#define LT6911_I2C_DEV 3
#define LT6911_I2C_DEV 4
#define LT6911_I2C_BANK_ADDR 0xff
CVI_U8 lt6911_i2c_addr = 0x2b;
CVI_U8 lt6911_i2c_addr = 0x56;
const CVI_U32 lt6911_addr_byte = 1;
const CVI_U32 lt6911_data_byte = 1;
static int g_fd[VI_MAX_PIPE_NUM] = {[0 ... (VI_MAX_PIPE_NUM - 1)] = -1};
@@ -145,6 +146,7 @@ static int lt6911_i2c_read(VI_PIPE ViPipe, int RegAddr)
uint8_t bank = RegAddr >> 8;
uint8_t addr = RegAddr & 0xff;
printf("[lt6911_i2c_read] : addr = %x \n", addr);
lt6911_write_register(ViPipe, LT6911_I2C_BANK_ADDR, bank);
return lt6911_read_register(ViPipe, addr);
}
@@ -154,6 +156,7 @@ static int lt6911_i2c_write(VI_PIPE ViPipe, int RegAddr, int data)
uint8_t bank = RegAddr >> 8;
uint8_t addr = RegAddr & 0xff;
printf("[lt6911_i2c_write] : addr = %x. data = %x \n", addr, data);
lt6911_write_register(ViPipe, LT6911_I2C_BANK_ADDR, bank);
return lt6911_write_register(ViPipe, addr, data);
}
@@ -185,22 +188,43 @@ int lt6911_probe(VI_PIPE ViPipe)
int nVal;
int nVal2;
// PinMUX
printf("########### PinMux #######################################################################\n");
system("devmem 0x0300116C 32 0x3");
system("devmem 0x03001170 32 0x3");
system("devmem 0x03001174 32 0x3");
system("devmem 0x03001178 32 0x3");
system("devmem 0x0300117C 32 0x3");
system("devmem 0x03001180 32 0x3");
system("devmem 0x03001184 32 0x3");
system("devmem 0x03001188 32 0x3");
system("devmem 0x0300118C 32 0x3");
system("devmem 0x03001190 32 0x3");
printf("########### PinMux End #######################################################################\n");
usleep(50);
printf("[lt6911_probe] -189 \n");
if (lt6911_i2c_init(ViPipe) != CVI_SUCCESS)
return CVI_FAILURE;
printf("[lt6911_probe] -195 \n");
nVal = lt6911_read(ViPipe, LT6911_CHIP_ID_ADDR_H);
nVal2 = lt6911_read(ViPipe, LT6911_CHIP_ID_ADDR_L);
if (nVal < 0 || nVal2 < 0) {
CVI_TRACE_SNS(CVI_DBG_ERR, "read sensor id error. \n");
return nVal;
printf("[lt6911_probe] jump return nVal -198 \n");
// return nVal;
}
printf("[lt6911_probe] -201 \n");
printf("data:%02x %02x\n", nVal, nVal2);
if ((((nVal & 0xFF) << 8) | (nVal2 & 0xFF)) != LT6911_CHIP_ID) {
CVI_TRACE_SNS(CVI_DBG_ERR, "Sensor ID Mismatch! Use the wrong sensor??\n");
return CVI_FAILURE;
printf("[lt6911_probe] jump return CVI_FAILURE -206 \n");
// return CVI_FAILURE;
}
printf("[lt6911_probe] -208 = exit success \n");
return CVI_SUCCESS;
}

View File

@@ -252,6 +252,20 @@ void os04a10_init(VI_PIPE ViPipe)
enWDRMode = g_pastOs04a10[ViPipe]->enWDRMode;
u8ImgMode = g_pastOs04a10[ViPipe]->u8ImgMode;
// PinMUX
printf("########### PinMux #######################################################################\n");
system("devmem 0x0300116C 32 0x3");
system("devmem 0x03001170 32 0x3");
system("devmem 0x03001174 32 0x3");
system("devmem 0x03001178 32 0x3");
system("devmem 0x0300117C 32 0x3");
system("devmem 0x03001180 32 0x3");
system("devmem 0x03001184 32 0x3");
system("devmem 0x03001188 32 0x3");
system("devmem 0x0300118C 32 0x3");
system("devmem 0x03001190 32 0x3");
printf("########### PinMux End #######################################################################\n");
os04a10_i2c_init(ViPipe);
if (enWDRMode == WDR_MODE_2To1_LINE) {

View File

@@ -101,9 +101,13 @@ struct combo_dev_attr_s sc035gs_rx_attr = {
.mac_clk = RX_MAC_CLK_200M,
.mipi_attr = {
.raw_data_type = RAW_DATA_12BIT,
.lane_id = {2, 0, 1, -1, -1},
.lane_id = {4, 3, 2, -1, -1},
.pn_swap = {0, 0, 0, 0, 0},
.wdr_mode = CVI_MIPI_WDR_MODE_NONE,
.pn_swap = {1, 1, 1, 0, 0},
.dphy = {
.enable = 1,
.hs_settle = 8,
},
},
.mclk = {
.cam = 0,

View File

@@ -208,6 +208,19 @@ void sc035gs_exit(VI_PIPE ViPipe)
/* 1296P30 and 1296P25 */
static void sc035gs_linear_1296P30_init(VI_PIPE ViPipe)
{
printf("########### PinMux #######################################################################\n");
system("devmem 0x0300116C 32 0x3");
system("devmem 0x03001170 32 0x3");
system("devmem 0x03001174 32 0x3");
system("devmem 0x03001178 32 0x3");
system("devmem 0x0300117C 32 0x3");
system("devmem 0x03001180 32 0x3");
system("devmem 0x03001184 32 0x3");
system("devmem 0x03001188 32 0x3");
system("devmem 0x0300118C 32 0x5");
system("devmem 0x03001190 32 0x3");
printf("########### PinMux End #######################################################################\n");
sc035gs_write_register(ViPipe, 0x0103, 0x01);
delay_ms(33);
sc035gs_write_register(ViPipe, 0x0100, 0x00);

View File

@@ -343,6 +343,16 @@ CVI_S32 CVI_SYS_StartThermalThread(void);
CVI_S32 CVI_SYS_StopThermalThread(void);
struct sys_ion_data2 {
__u32 size;
__u32 cached;
__u32 dmabuf_fd;
__u64 addr_p;
__u8 name[32];
};
int ionFree2(struct sys_ion_data2 *para);
#ifdef __cplusplus
#if __cplusplus
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -629,6 +629,22 @@ int ionFree(struct sys_ion_data *para)
return CVI_SUCCESS;
}
int ionFree2(struct sys_ion_data2 *para)
{
CVI_S32 fd = -1;
CVI_S32 ret = CVI_SUCCESS;
if ((fd = get_sys_fd()) == -1)
return CVI_ERR_SYS_NOTREADY;
ret = ioctl(fd, SYS_ION_FREE, para);
if (ret < 0) {
printf("ioctl SYS_ION_ALLOC failed\n");
}
return CVI_SUCCESS;
}
static CVI_S32 _SYS_IonAlloc(CVI_U64 *pu64PhyAddr, CVI_VOID **ppVirAddr,
CVI_U32 u32Len, CVI_BOOL cached, const CVI_CHAR *name)
{

View File

@@ -220,7 +220,7 @@ CVI_S32 SAMPLE_PLAT_VPSS_INIT(VPSS_GRP VpssGrp, SIZE_S stSizeIn, SIZE_S stSizeOu
stVpssGrpAttr.stFrameRate.s32SrcFrameRate = -1;
stVpssGrpAttr.stFrameRate.s32DstFrameRate = -1;
stVpssGrpAttr.enPixelFormat = SAMPLE_PIXEL_FORMAT;
stVpssGrpAttr.enPixelFormat = SAMPLE_PIXEL_FORMAT; // PIXEL_FORMAT_YUYV / SAMPLE_PIXEL_FORMAT / PIXEL_FORMAT_UYVY / PIXEL_FORMAT_YUV_400
stVpssGrpAttr.u32MaxW = stSizeIn.u32Width;
stVpssGrpAttr.u32MaxH = stSizeIn.u32Height;
stVpssGrpAttr.u8VpssDev = 0;

View File

@@ -891,7 +891,8 @@ CVI_S32 SAMPLE_COMM_SNS_GetDevAttr(SAMPLE_SNS_TYPE_E enSnsType, VI_DEV_ATTR_S *p
case OV_OS04A10_MIPI_4M_1440P_30FPS_10BIT_WDR2TO1:
case TECHPOINT_TP2850_MIPI_2M_30FPS_8BIT:
case TECHPOINT_TP2850_MIPI_4M_30FPS_8BIT:
pstViDevAttr->enBayerFormat = BAYER_FORMAT_GR;
// pstViDevAttr->enBayerFormat = BAYER_FORMAT_RG;
pstViDevAttr->enBayerFormat = BAYER_FORMAT_GB;
break;
case SOI_K06_MIPI_4M_25FPS_10BIT:
pstViDevAttr->enBayerFormat = BAYER_FORMAT_GB;
@@ -1131,7 +1132,8 @@ CVI_S32 SAMPLE_COMM_SNS_GetIspAttrBySns(SAMPLE_SNS_TYPE_E enSnsType, ISP_PUB_ATT
case TECHPOINT_TP2850_MIPI_2M_30FPS_8BIT:
case TECHPOINT_TP2850_MIPI_4M_30FPS_8BIT:
// on licheervnano
pstPubAttr->enBayer = BAYER_RGGB;
pstPubAttr->enBayer = BAYER_BGGR;
// pstPubAttr->enBayer = BAYER_RGGB;
//pstPubAttr->enBayer = BAYER_GRBG;
break;
#ifdef ARCH_CV182X

View File

@@ -0,0 +1,10 @@
*.bin
*.patch
test_mmf
!librtsp/include
!librtsp/src
!*/include
!*/*/include
!*/*/*/include
!*/*/*/*/include
!*/*/*/*/*/include

View File

@@ -0,0 +1,88 @@
SHELL = /bin/bash
ifeq ($(PARAM_FILE), )
PARAM_FILE:=../../Makefile.param
include $(PARAM_FILE)
endif
include ../sample.mk
SDIR = $(PWD)
SRCS = $(wildcard $(SDIR)/*.c)
INCS = -I$(MW_INC) -I$(ISP_INC) -I../common/ -I$(KERNEL_INC) -I$(MW_INC)/linux
SRCS_CPP += $(wildcard $(SDIR)/media_server-1.0.1/*.cpp) \
$(wildcard $(SDIR)/media_server-1.0.1/media/*.cpp)
CFLAGS += -I$(SDIR)/media_server-1.0.1
CPPFLAGS += -I$(SDIR)/media_server-1.0.1/include \
-I$(SDIR)/media_server-1.0.1/librtsp/source/server \
-I$(SDIR)/media_server-1.0.1/sdk/include \
-I$(SDIR)/media_server-1.0.1/sdk/libhttp/include \
-I$(SDIR)/media_server-1.0.1/librtp/include \
-I$(SDIR)/media_server-1.0.1/libmpeg/include \
-I$(SDIR)/media_server-1.0.1/libflv/include \
-I$(SDIR)/media_server-1.0.1/libmkv/include \
-I$(SDIR)/media_server-1.0.1 \
-I$(SDIR)/media_server-1.0.1/media \
-I$(SDIR)/media_server-1.0.1/avcodec/avcodec/include \
-I$(SDIR)/media_server-1.0.1/avcodec/avbsf/include \
-I$(SDIR)/media_server-1.0.1/libmov/include \
-D__ERROR__=00*10000000+__LINE__*1000
OBJS = $(SRCS:.c=.o)
OBJS += $(SRCS_CPP:.cpp=.o)
DEPS = $(SRCS:.c=.d)
TARGET = test_mmf
ifeq ($(CONFIG_ENABLE_SDK_ASAN), y)
TARGET = test_mmf_asan
endif
PKG_CONFIG_PATH = $(MW_PATH)/pkgconfig
REQUIRES = cvi_common cvi_sample cvi_ive
MW_LIBS = $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --libs --define-variable=mw_dir=$(MW_PATH) $(REQUIRES))
LIBS = $(MW_LIBS)
ifeq ($(MULTI_PROCESS_SUPPORT), 1)
DEFS += -DRPC_MULTI_PROCESS
LIBS += -lnanomsg
endif
EXTRA_CFLAGS = $(INCS) $(DEFS)
EXTRA_LDFLAGS = $(LIBS) -lpthread -lm -lini
LIBS += -L$(SDIR)/media_server-1.0.1/libs -lrtsp -lhttp -lflv -lmov -lrtp -lmpeg -lsdk -lavcodec -lavbsf
# IVE_SUPPORT = 1
ifeq ($(IVE_SUPPORT), 1)
CFLAGS += -DIVE_SUPPORT
IVE_PATH = $(MW_PATH)/../install/soc_cv1835_wevb_0002a_spinand/tpu_64/cvitek_ive_sdk
EXTRA_CFLAGS += -I$(IVE_PATH)/include/ive
EXTRA_LDFLAGS += -L$(IVE_PATH)/lib -lcvi_ive_tpu-static
TPU_PATH = $(MW_PATH)/../install/soc_cv1835_wevb_0002a_spinand/tpu_64/cvitek_tpu_sdk
EXTRA_CFLAGS += -I$(TPU_PATH)/include
EXTRA_LDFLAGS += -L$(TPU_PATH)/lib -lcviruntime-static -lcvimath-static -lcvikernel-static -lcnpy -lglog -lz
endif
.PHONY : clean all
all: $(TARGET)
$(COMMON_DIR)/%.o: $(COMMON_DIR)/%.c
@$(CC) $(DEPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $<
@echo [$(notdir $(CC))] $(notdir $@)
$(SDIR)/%.o: $(SDIR)/%.c
@$(CC) $(DEPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $<
@echo [$(notdir $(CC))] $(notdir $@)
$(TARGET): $(COMM_OBJ) $(OBJS) $(ISP_OBJ) $(MW_LIB)/libvpu.a $(MW_LIB)/libsys.a
@$(CXX) -o $@ -Wl,--start-group $(OBJS) $(COMM_OBJS) -lsys $(MW_LIB)/libsys.a -Wl,--end-group $(ELFFLAGS) $(EXTRA_LDFLAGS)
@echo -e $(BLUE)[LINK]$(END)[$(notdir $(CXX))] $(notdir $@)
clean:
@rm -f $(OBJS) $(DEPS) $(COMM_OBJ) $(COMM_DEPS) $(TARGET)
-include $(DEPS)

View File

@@ -0,0 +1 @@
!*.a

View File

@@ -0,0 +1,58 @@
ROOT:=../../sdk
#--------------------------------Output------------------------------
# OUTTYPE: 0-exe, 1-dll, 2-static
#--------------------------------------------------------------------
OUTTYPE = 2
OUTFILE = libavbsf.a
#-------------------------------Include------------------------------
#
# INCLUDES = $(addprefix -I,$(INCLUDES)) # add -I prefix
#--------------------------------------------------------------------
INCLUDES = . \
./include \
../avcodec/include \
../h264/include \
../h265/include \
../../media-server/libflv/include \
$(ROOT)/include
#-------------------------------Source-------------------------------
#
#--------------------------------------------------------------------
SOURCE_PATHS = src
SOURCE_FILES = $(foreach dir,$(SOURCE_PATHS),$(wildcard $(dir)/*.cpp))
SOURCE_FILES += $(foreach dir,$(SOURCE_PATHS),$(wildcard $(dir)/*.c))
_SOURCE_FILES =
SOURCE_FILES := $(filter-out $(_SOURCE_FILES),$(SOURCE_FILES))
#-----------------------------Library--------------------------------
#
# LIBPATHS = $(addprefix -L,$(LIBPATHS)) # add -L prefix
#--------------------------------------------------------------------
LIBPATHS =
ifdef RELEASE
# relase library path
LIBPATHS +=
else
LIBPATHS +=
endif
LIBS =
STATIC_LIBS =
#-----------------------------DEFINES--------------------------------
#
# DEFINES := $(addprefix -D,$(DEFINES)) # add -L prefix
#--------------------------------------------------------------------
DEFINES = NO_CRYPTO __ERROR__=31*10000000+__LINE__*1000
include $(ROOT)/gcc.mk
GCC_VER_GTE44 := $(shell echo `gcc -dumpversion | cut -f1-2 -d.` \< 4.4 | bc )
ifeq ($(GCC_VER_GTE44),1)
CFLAGS += -march=i586
endif

View File

@@ -0,0 +1,183 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\avpbs.h" />
<ClInclude Include="include\avbsf.h" />
<ClInclude Include="include\avpkt2bs.h" />
<ClInclude Include="include\avpktutil.h" />
<ClInclude Include="include\avpktutil2.h" />
<ClInclude Include="include\flv\flv2pkt.h" />
<ClInclude Include="include\flv\pkt2flv.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\avbsf-aac.c" />
<ClCompile Include="src\avbsf-h264.c" />
<ClCompile Include="src\avbsf-h265.c" />
<ClCompile Include="src\avbsf-h266.c" />
<ClCompile Include="src\avbsf.c" />
<ClCompile Include="src\avpbs-aac.c" />
<ClCompile Include="src\avpbs-av1.c" />
<ClCompile Include="src\avpbs-g7xx.c" />
<ClCompile Include="src\avpbs-h266.c" />
<ClCompile Include="src\avpbs-mp3.c" />
<ClCompile Include="src\avpbs-opus.c" />
<ClCompile Include="src\avpbs-vpx.c" />
<ClCompile Include="src\avpbs.c" />
<ClCompile Include="src\avpkt2bs.c" />
<ClCompile Include="src\avpbs-h264.c" />
<ClCompile Include="src\avpbs-h265.c" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>{454FC5B7-C7DC-4E78-9803-254C35FC01E6}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>avbsf</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>OS_WINDOWS;__ERROR__=(31 * 10000000 + __LINE__ * 1000);WIN32;_DEBUG;_LIB;OS_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>.;include;../avcodec/include;../h264/include;../h265/include;../../sdk/include;../../media-server/libflv/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>OS_WINDOWS;__ERROR__=(31 * 10000000 + __LINE__ * 1000);_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>.;include;../avcodec/include;../h264/include;../h265/include;../../sdk/include;../../media-server/libflv/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>OS_WINDOWS;__ERROR__=(31 * 10000000 + __LINE__ * 1000);WIN32;NDEBUG;_LIB;OS_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>.;include;../avcodec/include;../h264/include;../h265/include;../../sdk/include;../../media-server/libflv/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>OS_WINDOWS;__ERROR__=(31 * 10000000 + __LINE__ * 1000);NDEBUG;_LIB;OS_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>.;include;../avcodec/include;../h264/include;../h265/include;../../sdk/include;../../media-server/libflv/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Source Files\nalu">
<UniqueIdentifier>{b400754a-da08-44b3-bf21-18886b75a95d}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\pkt2bs">
<UniqueIdentifier>{9d789f34-842e-4d7b-8273-438e2ad08cd0}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\bs2pkt">
<UniqueIdentifier>{04272f84-8ed2-4a97-abcb-04009e46b57a}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\flv">
<UniqueIdentifier>{5fcf7895-5c97-41d7-b695-4058140fe8dd}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\avbsf.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\avpbs.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\avpkt2bs.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\avpktutil.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\avpktutil2.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\flv\flv2pkt.h">
<Filter>Header Files\flv</Filter>
</ClInclude>
<ClInclude Include="include\flv\pkt2flv.h">
<Filter>Header Files\flv</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\avpbs.c">
<Filter>Source Files\bs2pkt</Filter>
</ClCompile>
<ClCompile Include="src\avpbs-aac.c">
<Filter>Source Files\bs2pkt</Filter>
</ClCompile>
<ClCompile Include="src\avpbs-av1.c">
<Filter>Source Files\bs2pkt</Filter>
</ClCompile>
<ClCompile Include="src\avpbs-g7xx.c">
<Filter>Source Files\bs2pkt</Filter>
</ClCompile>
<ClCompile Include="src\avpbs-h264.c">
<Filter>Source Files\bs2pkt</Filter>
</ClCompile>
<ClCompile Include="src\avpbs-h265.c">
<Filter>Source Files\bs2pkt</Filter>
</ClCompile>
<ClCompile Include="src\avpbs-h266.c">
<Filter>Source Files\bs2pkt</Filter>
</ClCompile>
<ClCompile Include="src\avpbs-mp3.c">
<Filter>Source Files\bs2pkt</Filter>
</ClCompile>
<ClCompile Include="src\avpbs-opus.c">
<Filter>Source Files\bs2pkt</Filter>
</ClCompile>
<ClCompile Include="src\avpbs-vpx.c">
<Filter>Source Files\bs2pkt</Filter>
</ClCompile>
<ClCompile Include="src\avpkt2bs.c">
<Filter>Source Files\pkt2bs</Filter>
</ClCompile>
<ClCompile Include="src\avbsf.c">
<Filter>Source Files\nalu</Filter>
</ClCompile>
<ClCompile Include="src\avbsf-h266.c">
<Filter>Source Files\nalu</Filter>
</ClCompile>
<ClCompile Include="src\avbsf-aac.c">
<Filter>Source Files\nalu</Filter>
</ClCompile>
<ClCompile Include="src\avbsf-h264.c">
<Filter>Source Files\nalu</Filter>
</ClCompile>
<ClCompile Include="src\avbsf-h265.c">
<Filter>Source Files\nalu</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,363 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
0C9FC5F2298D010A00FB85DD /* avbsf-h265.c in Sources */ = {isa = PBXBuildFile; fileRef = 0C9FC5EC298D010A00FB85DD /* avbsf-h265.c */; };
0C9FC5F3298D010A00FB85DD /* avbsf-h264.c in Sources */ = {isa = PBXBuildFile; fileRef = 0C9FC5ED298D010A00FB85DD /* avbsf-h264.c */; };
0C9FC5F4298D010A00FB85DD /* avbsf-h266.c in Sources */ = {isa = PBXBuildFile; fileRef = 0C9FC5EE298D010A00FB85DD /* avbsf-h266.c */; };
0C9FC5F5298D010A00FB85DD /* avbsf-aac.c in Sources */ = {isa = PBXBuildFile; fileRef = 0C9FC5EF298D010A00FB85DD /* avbsf-aac.c */; };
0C9FC5F6298D010A00FB85DD /* avbsf.c in Sources */ = {isa = PBXBuildFile; fileRef = 0C9FC5F0298D010A00FB85DD /* avbsf.c */; };
0C9FC5F7298D010A00FB85DD /* avpbs-h266.c in Sources */ = {isa = PBXBuildFile; fileRef = 0C9FC5F1298D010A00FB85DD /* avpbs-h266.c */; };
46850374262413E500E7ABEC /* avpbs-h265.c in Sources */ = {isa = PBXBuildFile; fileRef = 46850368262413E500E7ABEC /* avpbs-h265.c */; };
46850375262413E600E7ABEC /* avpbs-vpx.c in Sources */ = {isa = PBXBuildFile; fileRef = 46850369262413E500E7ABEC /* avpbs-vpx.c */; };
46850376262413E600E7ABEC /* avpbs-g7xx.c in Sources */ = {isa = PBXBuildFile; fileRef = 4685036A262413E500E7ABEC /* avpbs-g7xx.c */; };
46850377262413E600E7ABEC /* avpbs-aac.c in Sources */ = {isa = PBXBuildFile; fileRef = 4685036B262413E500E7ABEC /* avpbs-aac.c */; };
46850378262413E600E7ABEC /* avpbs-opus.c in Sources */ = {isa = PBXBuildFile; fileRef = 4685036C262413E500E7ABEC /* avpbs-opus.c */; };
46850379262413E600E7ABEC /* avpbs.c in Sources */ = {isa = PBXBuildFile; fileRef = 4685036D262413E500E7ABEC /* avpbs.c */; };
4685037A262413E600E7ABEC /* avpbs-mp3.c in Sources */ = {isa = PBXBuildFile; fileRef = 4685036E262413E500E7ABEC /* avpbs-mp3.c */; };
4685037B262413E600E7ABEC /* avpbs-h264.c in Sources */ = {isa = PBXBuildFile; fileRef = 4685036F262413E500E7ABEC /* avpbs-h264.c */; };
4685037E262413E600E7ABEC /* avpbs-av1.c in Sources */ = {isa = PBXBuildFile; fileRef = 46850372262413E500E7ABEC /* avpbs-av1.c */; };
4CEE46E827A70CA900740460 /* avpkt2bs.c in Sources */ = {isa = PBXBuildFile; fileRef = 4CEE46E327A70AE600740460 /* avpkt2bs.c */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
0C9FC5EC298D010A00FB85DD /* avbsf-h265.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "avbsf-h265.c"; path = "src/avbsf-h265.c"; sourceTree = "<group>"; };
0C9FC5ED298D010A00FB85DD /* avbsf-h264.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "avbsf-h264.c"; path = "src/avbsf-h264.c"; sourceTree = "<group>"; };
0C9FC5EE298D010A00FB85DD /* avbsf-h266.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "avbsf-h266.c"; path = "src/avbsf-h266.c"; sourceTree = "<group>"; };
0C9FC5EF298D010A00FB85DD /* avbsf-aac.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "avbsf-aac.c"; path = "src/avbsf-aac.c"; sourceTree = "<group>"; };
0C9FC5F0298D010A00FB85DD /* avbsf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = avbsf.c; path = src/avbsf.c; sourceTree = "<group>"; };
0C9FC5F1298D010A00FB85DD /* avpbs-h266.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "avpbs-h266.c"; path = "src/avpbs-h266.c"; sourceTree = "<group>"; };
46850368262413E500E7ABEC /* avpbs-h265.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "avpbs-h265.c"; path = "src/avpbs-h265.c"; sourceTree = "<group>"; };
46850369262413E500E7ABEC /* avpbs-vpx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "avpbs-vpx.c"; path = "src/avpbs-vpx.c"; sourceTree = "<group>"; };
4685036A262413E500E7ABEC /* avpbs-g7xx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "avpbs-g7xx.c"; path = "src/avpbs-g7xx.c"; sourceTree = "<group>"; };
4685036B262413E500E7ABEC /* avpbs-aac.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "avpbs-aac.c"; path = "src/avpbs-aac.c"; sourceTree = "<group>"; };
4685036C262413E500E7ABEC /* avpbs-opus.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "avpbs-opus.c"; path = "src/avpbs-opus.c"; sourceTree = "<group>"; };
4685036D262413E500E7ABEC /* avpbs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = avpbs.c; path = src/avpbs.c; sourceTree = "<group>"; };
4685036E262413E500E7ABEC /* avpbs-mp3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "avpbs-mp3.c"; path = "src/avpbs-mp3.c"; sourceTree = "<group>"; };
4685036F262413E500E7ABEC /* avpbs-h264.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "avpbs-h264.c"; path = "src/avpbs-h264.c"; sourceTree = "<group>"; };
46850372262413E500E7ABEC /* avpbs-av1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "avpbs-av1.c"; path = "src/avpbs-av1.c"; sourceTree = "<group>"; };
46E55E302460588000D8BDBA /* libavbsf.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libavbsf.a; sourceTree = BUILT_PRODUCTS_DIR; };
46E55E38246058CA00D8BDBA /* include */ = {isa = PBXFileReference; lastKnownFileType = folder; path = include; sourceTree = "<group>"; };
4CEE46E327A70AE600740460 /* avpkt2bs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = avpkt2bs.c; path = src/avpkt2bs.c; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
46E55E2E2460588000D8BDBA /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
46E55E272460588000D8BDBA = {
isa = PBXGroup;
children = (
46E55E38246058CA00D8BDBA /* include */,
46E55E3A2460591E00D8BDBA /* src */,
46E55E312460588000D8BDBA /* Products */,
);
sourceTree = "<group>";
};
46E55E312460588000D8BDBA /* Products */ = {
isa = PBXGroup;
children = (
46E55E302460588000D8BDBA /* libavbsf.a */,
);
name = Products;
sourceTree = "<group>";
};
46E55E3A2460591E00D8BDBA /* src */ = {
isa = PBXGroup;
children = (
4CEE46E327A70AE600740460 /* avpkt2bs.c */,
4685036D262413E500E7ABEC /* avpbs.c */,
4685036B262413E500E7ABEC /* avpbs-aac.c */,
46850372262413E500E7ABEC /* avpbs-av1.c */,
4685036A262413E500E7ABEC /* avpbs-g7xx.c */,
4685036F262413E500E7ABEC /* avpbs-h264.c */,
46850368262413E500E7ABEC /* avpbs-h265.c */,
4685036E262413E500E7ABEC /* avpbs-mp3.c */,
4685036C262413E500E7ABEC /* avpbs-opus.c */,
46850369262413E500E7ABEC /* avpbs-vpx.c */,
0C9FC5EF298D010A00FB85DD /* avbsf-aac.c */,
0C9FC5ED298D010A00FB85DD /* avbsf-h264.c */,
0C9FC5EC298D010A00FB85DD /* avbsf-h265.c */,
0C9FC5EE298D010A00FB85DD /* avbsf-h266.c */,
0C9FC5F0298D010A00FB85DD /* avbsf.c */,
0C9FC5F1298D010A00FB85DD /* avpbs-h266.c */,
);
name = src;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
46E55E2C2460588000D8BDBA /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
46E55E2F2460588000D8BDBA /* avbsf */ = {
isa = PBXNativeTarget;
buildConfigurationList = 46E55E342460588000D8BDBA /* Build configuration list for PBXNativeTarget "avbsf" */;
buildPhases = (
46E55E2C2460588000D8BDBA /* Headers */,
46E55E2D2460588000D8BDBA /* Sources */,
46E55E2E2460588000D8BDBA /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = avbsf;
productName = avbsf;
productReference = 46E55E302460588000D8BDBA /* libavbsf.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
46E55E282460588000D8BDBA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1240;
ORGANIZATIONNAME = ireader;
TargetAttributes = {
46E55E2F2460588000D8BDBA = {
CreatedOnToolsVersion = 11.3.1;
};
};
};
buildConfigurationList = 46E55E2B2460588000D8BDBA /* Build configuration list for PBXProject "avbsf" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 46E55E272460588000D8BDBA;
productRefGroup = 46E55E312460588000D8BDBA /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
46E55E2F2460588000D8BDBA /* avbsf */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
46E55E2D2460588000D8BDBA /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0C9FC5F5298D010A00FB85DD /* avbsf-aac.c in Sources */,
46850377262413E600E7ABEC /* avpbs-aac.c in Sources */,
4CEE46E827A70CA900740460 /* avpkt2bs.c in Sources */,
4685037A262413E600E7ABEC /* avpbs-mp3.c in Sources */,
46850374262413E500E7ABEC /* avpbs-h265.c in Sources */,
46850379262413E600E7ABEC /* avpbs.c in Sources */,
46850376262413E600E7ABEC /* avpbs-g7xx.c in Sources */,
4685037E262413E600E7ABEC /* avpbs-av1.c in Sources */,
0C9FC5F4298D010A00FB85DD /* avbsf-h266.c in Sources */,
0C9FC5F6298D010A00FB85DD /* avbsf.c in Sources */,
0C9FC5F2298D010A00FB85DD /* avbsf-h265.c in Sources */,
0C9FC5F3298D010A00FB85DD /* avbsf-h264.c in Sources */,
0C9FC5F7298D010A00FB85DD /* avpbs-h266.c in Sources */,
46850378262413E600E7ABEC /* avpbs-opus.c in Sources */,
4685037B262413E600E7ABEC /* avpbs-h264.c in Sources */,
46850375262413E600E7ABEC /* avpbs-vpx.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
46E55E322460588000D8BDBA /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"__ERROR__=(31*10000000+__LINE__*1000)",
"DEBUG=1",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
USER_HEADER_SEARCH_PATHS = (
.,
./include,
../avcodec/include,
../h264/include,
../h265/include,
../../sdk/include,
"../../media-server/libflv/include",
);
};
name = Debug;
};
46E55E332460588000D8BDBA /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = "__ERROR__=(31*10000000+__LINE__*1000)";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
USER_HEADER_SEARCH_PATHS = (
.,
./include,
../avcodec/include,
../h264/include,
../h265/include,
../../sdk/include,
"../../media-server/libflv/include",
);
};
name = Release;
};
46E55E352460588000D8BDBA /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
EXECUTABLE_PREFIX = lib;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Debug;
};
46E55E362460588000D8BDBA /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
EXECUTABLE_PREFIX = lib;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
46E55E2B2460588000D8BDBA /* Build configuration list for PBXProject "avbsf" */ = {
isa = XCConfigurationList;
buildConfigurations = (
46E55E322460588000D8BDBA /* Debug */,
46E55E332460588000D8BDBA /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
46E55E342460588000D8BDBA /* Build configuration list for PBXNativeTarget "avbsf" */ = {
isa = XCConfigurationList;
buildConfigurations = (
46E55E352460588000D8BDBA /* Debug */,
46E55E362460588000D8BDBA /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 46E55E282460588000D8BDBA /* Project object */;
}

View File

@@ -0,0 +1,70 @@
#ifndef _avbsf_h_
#define _avbsf_h_
#include <stdint.h>
#include "avcodecid.h"
#ifdef __cplusplus
extern "C" {
#endif
/// @param[in] flags 0x01-keyframe, other-undefined
/// @return 0-ok, other-error
typedef int (*avbsf_onpacket)(void* param, int64_t pts, int64_t dts, const uint8_t* data, int bytes, int flags);
struct avbsf_t
{
void* (*create)(const uint8_t* extra, int bytes, avbsf_onpacket onpacket, void* param);
int (*destroy)(void** pbsf);
int (*input)(void* bsf, int64_t pts, int64_t dts, const uint8_t* nalu, int bytes);
};
struct avbsf_t* avbsf_find(AVPACKET_CODEC_ID codec);
#ifdef __cplusplus
}
// AV Bitstream Filter
class AVBitStreamFilter
{
public:
static AVBitStreamFilter* Create(AVPACKET_CODEC_ID codec, const void* extra, int bytes, avbsf_onpacket onpacket, void* param)
{
avbsf_t* bsf = avbsf_find(codec);
if (!bsf)
return NULL;
void* ptr = bsf->create((const uint8_t*)extra, bytes, onpacket, param);
if (!ptr)
return NULL;
return new AVBitStreamFilter(bsf, ptr);
}
public:
~AVBitStreamFilter()
{
if (m_bsf && m_ptr)
{
m_bsf->destroy(&m_ptr);
m_bsf = NULL;
}
}
int Input(int64_t pts, int64_t dts, const uint8_t* nalu, int bytes)
{
return m_bsf->input(m_ptr, pts, dts, nalu, bytes);
}
private:
AVBitStreamFilter(avbsf_t* bsf, void* ptr) : m_bsf(bsf), m_ptr(ptr) {}
AVBitStreamFilter(AVBitStreamFilter&) {}
AVBitStreamFilter& operator= (AVBitStreamFilter&) { return *this; }
private:
avbsf_t* m_bsf;
void* m_ptr;
};
#endif
#endif /* !_avbsf_h_ */

View File

@@ -0,0 +1,71 @@
#ifndef _avpbs_h_
#define _avpbs_h_
#include <stdint.h>
#include "avpacket.h"
#include "avcodecid.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef int (*avpbs_onpacket)(void* param, struct avpacket_t* pkt);
// avpacket bitstream helper
struct avpbs_t
{
void* (*create)(int stream, AVPACKET_CODEC_ID codec, const uint8_t* extra, int bytes, avpbs_onpacket onpacket, void* param);
int (*destroy)(void** ppbs);
int (*input)(void* pbs, int64_t pts, int64_t dts, const uint8_t* data, int bytes, int flags);
};
struct avpbs_t* avpbs_find(AVPACKET_CODEC_ID codec);
#ifdef __cplusplus
}
// AVPacket Bitstream
class AVPBitStream
{
public:
static AVPBitStream* Create(int stream, AVPACKET_CODEC_ID codec, const void* extra, int bytes, avpbs_onpacket onpacket, void* param)
{
avpbs_t* bs = avpbs_find(codec);
if (!bs)
return NULL;
void* ptr = bs->create(stream, codec, (const uint8_t*)extra, bytes, onpacket, param);
if (!ptr)
return NULL;
return new AVPBitStream(bs, ptr);
}
public:
~AVPBitStream()
{
if (m_bs && m_stream)
{
m_bs->destroy(&m_stream);
m_bs = NULL;
}
}
int Input(int64_t pts, int64_t dts, const void* data, int bytes, int flags)
{
return m_bs->input(m_stream, pts, dts, (const uint8_t*)data, bytes, flags);
}
private:
AVPBitStream(avpbs_t* bs, void* stream) : m_bs(bs), m_stream(stream) {}
AVPBitStream(AVPBitStream&) {}
AVPBitStream& operator= (AVPBitStream&) { return *this; }
private:
avpbs_t* m_bs;
void* m_stream;
};
#endif
#endif /* !_avpbs_h_ */

View File

@@ -0,0 +1,81 @@
#ifndef _avpkt2bs_h_
#define _avpkt2bs_h_
#include <stddef.h>
#include <stdint.h>
#include "avpacket.h"
#include "mpeg4-aac.h"
#include "mpeg4-avc.h"
#include "mpeg4-vvc.h"
#include "mpeg4-hevc.h"
#include "mp3-header.h"
#include "opus-head.h"
#include "aom-av1.h"
#if defined(__cplusplus)
extern "C" {
#endif
struct avpkt2bs_t
{
union
{
struct mpeg4_aac_t aac;
struct opus_head_t opus;
} a;
union
{
struct aom_av1_t av1;
struct mpeg4_avc_t avc;
struct mpeg4_hevc_t hevc;
struct mpeg4_vvc_t vvc;
} v;
uint8_t* ptr;
int cap;
};
int avpkt2bs_create(struct avpkt2bs_t* bs);
int avpkt2bs_destroy(struct avpkt2bs_t* bs);
/// @return <0-error, >0-bytes
int avpkt2bs_input(struct avpkt2bs_t* bs, const struct avpacket_t* pkt);
#if defined(__cplusplus)
struct AVPacket2BitStream
{
public:
AVPacket2BitStream()
{
avpkt2bs_create(&m_bs);
}
~AVPacket2BitStream()
{
avpkt2bs_destroy(&m_bs);
}
public:
int Input(const struct avpacket_t* pkt)
{
return avpkt2bs_input(&m_bs, pkt);
}
// get ptr
operator const void* () const {
return m_bs.ptr;
}
private:
AVPacket2BitStream(AVPacket2BitStream&) {}
AVPacket2BitStream& operator= (AVPacket2BitStream&) { return *this; }
private:
avpkt2bs_t m_bs;
};
}
#endif
#endif /* !_avpkt2bs_h_ */

View File

@@ -0,0 +1,96 @@
#ifndef _avpktutil_h_
#define _avpktutil_h_
#include "avpacket.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
struct avpktutil_t
{
struct avstream_t* streams[8];
int count;
};
static inline struct avstream_t* avpktutil_addvideo(struct avpktutil_t* s, int stream, AVPACKET_CODEC_ID codec, int width, int height, const void* extra, size_t bytes)
{
struct avstream_t* video;
if((size_t)s->count >= sizeof(s->streams)/sizeof(s->streams[0]))
return NULL;
video = avstream_alloc((int)bytes);
if(!video) return NULL;
video->stream = stream;
video->codecid = codec;
video->width = width;
video->height = height;
memcpy(video->extra, extra, bytes);
s->streams[s->count++] = video;
return video;
}
static inline struct avstream_t* avpktutil_addaudio(struct avpktutil_t* s, int stream, AVPACKET_CODEC_ID codec, int channel_count, int bit_per_sample, int sample_rate, const void* extra, size_t bytes)
{
struct avstream_t* audio;
if((size_t)s->count >= sizeof(s->streams)/sizeof(s->streams[0]))
return NULL;
audio = avstream_alloc((int)bytes);
if(!audio) return NULL;
audio->stream = stream;
audio->codecid = codec;
audio->channels = channel_count;
audio->sample_rate = sample_rate;
audio->sample_bits = bit_per_sample;
memcpy(audio->extra, extra, bytes);
s->streams[s->count++] = audio;
return audio;
}
static inline struct avstream_t* avpktutil_addsubtitle(struct avpktutil_t* s, int stream, AVPACKET_CODEC_ID codec, const void* extra, size_t bytes)
{
struct avstream_t* subtitle;
if((size_t)s->count >= sizeof(s->streams)/sizeof(s->streams[0]))
return NULL;
subtitle = avstream_alloc((int)bytes);
if(!subtitle) return NULL;
subtitle->stream = stream;
subtitle->codecid = codec;
memcpy(subtitle->extra, extra, bytes);
s->streams[s->count++] = subtitle;
return subtitle;
}
static inline int avpktutil_input(struct avpktutil_t* s, struct avstream_t* stream, const void* buffer, size_t bytes, int64_t pts, int64_t dts, int flags, struct avpacket_t** pkt0)
{
struct avpacket_t* pkt;
(void)s; //ignore
//app_log(LOG_DEBUG, "track %u pts: %lld, dts: %lld, size: %u, key: %d\n", stream->stream, pts, dts, bytes, flags ? 1 : 0);
pkt = avpacket_alloc((int)bytes);
if (!pkt) return -(__ERROR__ + ENOMEM);
avstream_addref(stream);
memmove(pkt->data, buffer, bytes);
pkt->pts = pts;
pkt->dts = dts;
pkt->flags = flags;
pkt->stream = stream;
*pkt0 = pkt;
return 0;
}
static inline int avpktutil_destroy(struct avpktutil_t* s)
{
int i;
for(i = 0; i < s->count; i++)
{
avstream_release(s->streams[i]);
s->streams[i] = NULL;
}
return 0;
}
#endif /* _avpktutil_h_ */

View File

@@ -0,0 +1,107 @@
#ifndef _avpktutil2_h_
#define _avpktutil2_h_
#include "avpktutil.h"
#include "mpeg4-aac.h"
#include "mp3-header.h"
#include "webm-vpx.h"
// avpktutil2_t is deprecated, should use avpbs_find(@avbps.h) or AVPBitStream(@avbps.hpp)
#pragma deprecated(avpktutil2_t)
struct avpktutil2_t
{
struct avpktutil_t pkt;
struct avstream_t* video;
struct avstream_t* audio;
union {
struct mpeg4_aac_t aac;
struct mp3_header_t mp3;
} a;
};
static inline struct avstream_t* avpktutil2_findstream(struct avpktutil2_t* s, int stream, AVPACKET_CODEC_ID codec, const void* data, size_t bytes)
{
int r;
(void)stream; // ignore
switch (codec)
{
case AVCODEC_VIDEO_H264:
case AVCODEC_VIDEO_H265:
case AVCODEC_VIDEO_H266:
if (!s->video)
s->video = avpktutil_addvideo(&s->pkt, s->pkt.count, codec, 0, 0, 0, 0);
return s->video;
case AVCODEC_VIDEO_VP8:
if (!s->video)
{
int width = 0, height = 0;
struct webm_vpx_t vpx;
const unsigned char src[] = { 0x00, 0x1f, 0x80, 0x02, 0x02, 0x02, 0x00, 0x00 };
if(0 == webm_vpx_codec_configuration_record_from_vp8(&vpx, &width, &height, data, bytes))
s->video = avpktutil_addvideo(&s->pkt, s->pkt.count, codec, width, height, src, sizeof(src));
}
return s->video;
case AVCODEC_VIDEO_VP9:
if (!s->video)
{
const unsigned char src[] = { 0x00, 0x1f, 0x80, 0x02, 0x02, 0x02, 0x00, 0x00 };
s->video = avpktutil_addvideo(&s->pkt, s->pkt.count, codec, 0, 0, src, sizeof(src));
}
return s->video;
case AVCODEC_AUDIO_AAC:
if(!s->audio)
{
r = mpeg4_aac_adts_load((const uint8_t*)data, bytes, &s->a.aac);
if(r > 0)
s->audio = avpktutil_addaudio(&s->pkt, s->pkt.count, AVCODEC_AUDIO_AAC, s->a.aac.channel_configuration, 16, s->a.aac.sampling_frequency, 0, 0);
}
return s->audio;
case AVCODEC_AUDIO_MP3:
if(!s->audio)
{
// FIXME: mp3 sample bits
r = mp3_header_load(&s->a.mp3, data, (int)bytes);
if(r > 0)
s->audio = avpktutil_addaudio(&s->pkt, s->pkt.count, AVCODEC_AUDIO_MP3, mp3_get_channel(&s->a.mp3), 16, mp3_get_frequency(&s->a.mp3), NULL, 0);
}
return s->audio;
case AVCODEC_AUDIO_OPUS:
if (!s->audio)
s->audio = avpktutil_addaudio(&s->pkt, s->pkt.count, AVCODEC_AUDIO_OPUS, 2, 16, 48000, 0, 0);
return s->audio;
case AVCODEC_AUDIO_G711A:
case AVCODEC_AUDIO_G711U:
if (!s->audio)
s->audio = avpktutil_addaudio(&s->pkt, s->pkt.count, codec, 1, 16, 8000, 0, 0);
return s->audio;
default:
assert(0);
return NULL;
}
}
static inline int avpktutil2_input(struct avpktutil2_t* s, int stream, AVPACKET_CODEC_ID codec, const void* data, size_t bytes, int64_t pts, int64_t dts, int flags, struct avpacket_t** pkt0)
{
struct avstream_t* av;
av = avpktutil2_findstream(s, stream, codec, data, bytes);
if(!av)
return -(__ERROR__ + ENOENT);
return avpktutil_input(&s->pkt, av, data, bytes, pts, dts, flags, pkt0);
}
static inline int avpktutil2_destroy(struct avpktutil2_t* s)
{
return avpktutil_destroy(&s->pkt);
}
#endif /* _avpktutil2_h_ */

View File

@@ -0,0 +1,155 @@
#ifndef _flv2pkt_h_
#define _flv2pkt_h_
// EXPORT API:
// 1. int flv2avpkt_init(struct flv2avpkt_t* ctx)
// 2. int flv2avpkt_destroy(struct flv2avpkt_t* ctx)
// 3. int flv2avpkt_input(struct flv2avpkt_t* ctx, int avtype, const void* data, size_t bytes, uint32_t pts, uint32_t dts, int flags, flv2avpkt_onpacket onpacket, void* param)
#include "avpbs.h"
#include "flv-proto.h"
#include "flv-header.h"
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#if defined(__cplusplus)
extern "C" {
#endif
struct flv2avpkt_t
{
struct
{
avpbs_t* bs;
void* ptr;
} streams[3]; // 0-video, 1-audio, 2-metadata
uint16_t video, audio;
};
typedef int (flv2avpkt_onpacket)(void* param, struct avpacket_t* pkt);
static inline int flv2avpkt_init(struct flv2avpkt_t* ctx)
{
memset(ctx, 0, sizeof(*ctx));
return 0;
}
static inline int flv2avpkt_destroy(struct flv2avpkt_t* ctx)
{
size_t i;
for (i = 0; i < sizeof(ctx->streams) / sizeof(ctx->streams[0]); i++)
{
if (ctx->streams[i].bs && ctx->streams[i].ptr)
ctx->streams[i].bs->destroy(&ctx->streams[i].ptr);
}
memset(ctx, 0, sizeof(*ctx));
return 0;
}
static int flv2avpkt_find(struct flv2avpkt_t* ctx, int avtype, const void* data, int bytes, flv2avpkt_onpacket onpacket, void* param)
{
void* ptr;
avpbs_t* bs;
AVPACKET_CODEC_ID codec;
int stream;
stream = FLV_SCRIPT_METADATA == avtype ? 2 : ((avtype & 0xFF) <= 0x0F ? 0 : 1);
assert(stream >= 0 && stream < (int)(sizeof(ctx->streams) / sizeof(ctx->streams[0])));
if (ctx->streams[stream].ptr)
{
if (0 == stream && (ctx->video & (1 << (avtype & 0x0F))))
return 0;
else if (1 == stream && (ctx->audio & (1 << ((avtype >> 4) & 0x0F))))
return 1;
else if (2 == stream)
return 2;
}
switch (avtype)
{
case FLV_AUDIO_ASC:
codec = AVCODEC_AUDIO_AAC;
break;
case FLV_AUDIO_OPUS_HEAD:
codec = AVCODEC_AUDIO_OPUS;
break;
case FLV_VIDEO_AVCC:
codec = AVCODEC_VIDEO_H264;
break;
case FLV_VIDEO_HVCC:
codec = AVCODEC_VIDEO_H265;
break;
case FLV_VIDEO_VVCC:
codec = AVCODEC_VIDEO_H266;
break;
case FLV_VIDEO_AV1C:
codec = AVCODEC_VIDEO_AV1;
break;
case FLV_AUDIO_MP3:
case FLV_AUDIO_MP3_8K:
codec = AVCODEC_AUDIO_MP3;
break;
case FLV_AUDIO_G711A:
codec = AVCODEC_AUDIO_G711A;
break;
case FLV_AUDIO_G711U:
codec = AVCODEC_AUDIO_G711U;
break;
case FLV_SCRIPT_METADATA:
codec = AVCODEC_DATA_RAW;
break;
default:
return -1;
}
bs = avpbs_find(codec);
if (!bs)
return -1;
ptr = bs->create(stream, codec, (const uint8_t*)data, bytes, onpacket, param);
if (!ptr)
return -1;
if (0 == stream)
ctx->video = 1 << (avtype & 0x0F);
else if(1 == stream)
ctx->audio = 1 << ((avtype >> 4) & 0x0F);
if (ctx->streams[stream].bs && ctx->streams[stream].ptr)
ctx->streams[stream].bs->destroy(&ctx->streams[stream].ptr);
ctx->streams[stream].bs = bs;
ctx->streams[stream].ptr = ptr;
return stream;
}
static inline int flv2avpkt_input(struct flv2avpkt_t* ctx, int avtype, const void* data, size_t bytes, uint32_t pts, uint32_t dts, int flags, flv2avpkt_onpacket onpacket, void* param)
{
int stream;
stream = flv2avpkt_find(ctx, avtype, data, (int)bytes, onpacket, param);
if (stream < 0 || stream >= (int)(sizeof(ctx->streams) / sizeof(ctx->streams[0])))
return -1;
if (avtype >= FLV_AUDIO_ASC)
return 0;
return ctx->streams[stream].bs->input(ctx->streams[stream].ptr, pts, dts, (const uint8_t*)data, (int)bytes, flags);
}
#if defined(__cplusplus)
}
#endif
#endif /* !_flv2pkt_h_ */

View File

@@ -0,0 +1,162 @@
#ifndef _pkt2flv_h_
#define _pkt2flv_h_
// EXPORT API:
// 1. int avpkt2flv_reset(struct avpkt2flv_t* flv)
// 2. int avpkt2flv_input(struct avpkt2flv_t* flv, const struct avpacket_t* pkt, flv_muxer2_handler handler, void* param)
#include "avpacket.h"
#include "avstream.h"
#include "avcodecid.h"
#include "flv-proto.h"
#include "flv-header.h"
#include "flv-writer.h"
#include "rtsp-payloads.h"
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#if defined(__cplusplus)
extern "C" {
#endif
struct avpkt2flv_t
{
int ash; // audio sequence header
int vsh; // video sequence header
};
typedef int (*avpkt2flv_handler)(void* param, int type, const struct flv_vec_t* vec, int num, uint32_t timestamp);
static inline int avpkt2flv_reset(struct avpkt2flv_t* flv)
{
memset(flv, 0, sizeof(*flv));
return 0;
}
static int avpkt2flv_audio(struct avpkt2flv_t* flv, const struct avpacket_t* pkt, uint8_t codec, avpkt2flv_handler handler, void* param)
{
int r, n;
uint8_t header[2][2];
struct flv_vec_t vec[4];
struct flv_audio_tag_header_t tag;
n = 0;
tag.codecid = codec;
if (AVCODEC_AUDIO_AAC == pkt->stream->codecid || AVCODEC_AUDIO_OPUS == pkt->stream->codecid)
{
tag.rate = FLV_SOUND_RATE_44100; // 44k-SoundRate
tag.bits = FLV_SOUND_BIT_16; // 16-bit samples
tag.channels = FLV_SOUND_CHANNEL_STEREO; // Stereo sound
}
else
{
switch (pkt->stream->sample_rate)
{
case 5500: tag.rate = FLV_SOUND_RATE_5500; break;
case 11025: tag.rate = FLV_SOUND_RATE_11025; break;
case 22050: tag.rate = FLV_SOUND_RATE_22050; break;
case 44100: tag.rate = FLV_SOUND_RATE_44100; break;
default: tag.rate = FLV_SOUND_RATE_44100;
}
tag.bits = (uint8_t)(8 == pkt->stream->sample_bits ? FLV_SOUND_BIT_8 : FLV_SOUND_BIT_16);
tag.channels = (uint8_t)(pkt->stream->channels < 2 ? FLV_SOUND_CHANNEL_MONO : FLV_SOUND_CHANNEL_STEREO);
}
if (!flv->ash)
{
flv->ash = 1;
tag.avpacket = FLV_SEQUENCE_HEADER;
vec[n].len = flv_audio_tag_header_write(&tag, header[0], sizeof(header[0]));
vec[n].ptr = header[0];
vec[n + 1].ptr = pkt->stream->extra;
vec[n + 1].len = pkt->stream->bytes;
assert(vec[0].len > 0);
r = handler(param, FLV_TYPE_AUDIO, vec, n + 2, (uint32_t)pkt->dts);
if (0 != r) return r;
//n += 2;
}
tag.avpacket = FLV_AVPACKET;
vec[n].len = flv_audio_tag_header_write(&tag, header[1], sizeof(header[1]));
vec[n].ptr = header[1];
vec[n + 1].ptr = pkt->data;
vec[n + 1].len = pkt->size;
assert(vec[n].len > 0);
return handler(param, FLV_TYPE_AUDIO, vec, n + 2, (uint32_t)pkt->dts);
}
static int avpkt2flv_video(struct avpkt2flv_t* flv, const struct avpacket_t* pkt, uint8_t codec, avpkt2flv_handler handler, void* param)
{
int r, n;
uint8_t header[2][5];
struct flv_vec_t vec[4];
struct flv_video_tag_header_t tag;
n = 0;
tag.codecid = codec;
if (!flv->vsh)
{
flv->vsh = 1;
tag.cts = 0;
tag.keyframe = 1; // keyframe
tag.avpacket = FLV_SEQUENCE_HEADER;
vec[n].len = flv_video_tag_header_write(&tag, header[0], sizeof(header[0]));
vec[n].ptr = header[0];
vec[n + 1].ptr = pkt->stream->extra;
vec[n + 1].len = pkt->stream->bytes;
assert(vec[n].len > 0);
r = handler(param, FLV_TYPE_VIDEO, vec, n + 2, (uint32_t)pkt->dts);
if (0 != r) return r;
//n += 2;
}
tag.cts = (int32_t)((uint32_t)pkt->pts - (uint32_t)pkt->dts);
tag.keyframe = (uint8_t)((pkt->flags & AVPACKET_FLAG_KEY) ? FLV_VIDEO_KEY_FRAME : FLV_VIDEO_INTER_FRAME);
tag.avpacket = FLV_AVPACKET;
vec[n].len = flv_video_tag_header_write(&tag, header[1], sizeof(header[1]));
vec[n].ptr = header[1];
vec[n + 1].ptr = pkt->data;
vec[n + 1].len = pkt->size;
assert(vec[n].len > 0);
return handler(param, FLV_TYPE_VIDEO, vec, n + 2, (uint32_t)pkt->dts);
}
static int avpkt2flv_script(const struct avpacket_t* pkt, avpkt2flv_handler handler, void* param)
{
struct flv_vec_t vec[1];
vec[0].ptr = pkt->data;
vec[0].len = pkt->size;
return handler(param, FLV_TYPE_SCRIPT, vec, 1, (uint32_t)pkt->dts);
}
static inline int avpkt2flv_input(struct avpkt2flv_t* flv, const struct avpacket_t* pkt, avpkt2flv_handler handler, void* param)
{
int i;
i = avcodecid_find_by_codecid(pkt->stream->codecid);
if (-1 == i)
return -1; // not found
switch (avstream_type(pkt->stream))
{
case AVSTREAM_AUDIO:
return avpkt2flv_audio(flv, pkt, (uint8_t)s_payloads[i].flv, handler, param);
case AVSTREAM_VIDEO:
return avpkt2flv_video(flv, pkt, (uint8_t)s_payloads[i].flv, handler, param);
case AVSTREAM_DATA:
return avpkt2flv_script(pkt, handler, param);
default:
assert(0);
return -1;
}
}
#if defined(__cplusplus)
}
#endif
#endif /* !_pkt2flv_h_ */

View File

@@ -0,0 +1,74 @@
#include "avbsf.h"
#include "mpeg4-aac.h"
#include "cbuffer.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
struct aacbsf_t
{
struct mpeg4_aac_t aac;
struct cbuffer_t ptr;
avbsf_onpacket onpacket;
void* param;
};
static int aacbsf_destroy(void** pp)
{
struct aacbsf_t* bsf;
if (pp && *pp)
{
bsf = (struct aacbsf_t*)*pp;
cbuffer_free(&bsf->ptr);
free(bsf);
*pp = NULL;
}
return 0;
}
static void* aacbsf_create(const uint8_t* extra, int bytes, avbsf_onpacket onpacket, void* param)
{
struct aacbsf_t* bsf;
bsf = calloc(1, sizeof(*bsf));
if (!bsf) return NULL;
cbuffer_init(&bsf->ptr);
if (mpeg4_aac_audio_specific_config_load(extra, bytes, &bsf->aac) < 0)
{
aacbsf_destroy((void**)&bsf);
return NULL;
}
bsf->onpacket = onpacket;
bsf->param = param;
return bsf;
}
static int aacbsf_input(void* param, int64_t pts, int64_t dts, const uint8_t* data, int bytes)
{
int r;
struct aacbsf_t* bsf;
bsf = (struct aacbsf_t*)param;
cbuffer_resize(&bsf->ptr, bytes + 128);
r = mpeg4_aac_adts_save(&bsf->aac, bytes, bsf->ptr.ptr, bsf->ptr.cap);
if (r < 0)
return r;
bsf->ptr.len = r;
r = cbuffer_append(&bsf->ptr, data, bytes);
if (r < 0)
return r;
return bsf->onpacket(bsf->param, pts, dts, bsf->ptr.ptr, (int)bsf->ptr.len, 0);
}
struct avbsf_t* avbsf_aac(void)
{
static struct avbsf_t bsf = {
aacbsf_create,
aacbsf_destroy,
aacbsf_input,
};
return &bsf;
}

View File

@@ -0,0 +1,152 @@
#include "avbsf.h"
#include "cbuffer.h"
#include "mpeg4-avc.h"
#include "avdtsinfer.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#define H264_NAL_IDR 5 // Coded slice of an IDR picture
#define H264_NAL_SPS 7 // Sequence parameter set
#define H264_NAL_PPS 8 // Picture parameter set
#define H264_NAL_AUD 9 // Access unit delimiter
static const uint8_t startcode[] = { 0x00, 0x00, 0x00, 0x01 };
struct h264bsf_t
{
struct mpeg4_avc_t avc;
struct cbuffer_t ptr;
int sps_pps_flag;
int vcl;
int64_t pts;
int64_t dts;
struct avdtsinfer_t infer;
uint8_t extra[4 * 1024];
int extra_bytes;
avbsf_onpacket onpacket;
void* param;
};
static int h264bsf_destroy(void** pp)
{
struct h264bsf_t* bsf;
if (pp && *pp)
{
bsf = (struct h264bsf_t*)*pp;
cbuffer_free(&bsf->ptr);
free(bsf);
*pp = NULL;
}
return 0;
}
static void* h264bsf_create(const uint8_t* extra, int bytes, avbsf_onpacket onpacket, void* param)
{
struct h264bsf_t* bsf;
bsf = calloc(1, sizeof(*bsf));
if (!bsf) return NULL;
avdtsinfer_reset(&bsf->infer);
cbuffer_init(&bsf->ptr);
bsf->sps_pps_flag = 0;
if (bytes > 5 && bytes <= sizeof(bsf->extra) && 0x00 == extra[0] && 0x00 == extra[1] && (0x01 == extra[2] || (0x00 == extra[2] && 0x01 == extra[3])))
{
memcpy(bsf->extra, extra, bytes);
bsf->extra_bytes = bytes;
}
else if (0 == mpeg4_avc_decoder_configuration_record_load(extra, bytes, &bsf->avc))
{
bsf->extra_bytes = mpeg4_avc_to_nalu(&bsf->avc, bsf->extra, sizeof(bsf->extra));
if (bsf->extra_bytes < 0)
bsf->extra_bytes = 0;
}
bsf->onpacket = onpacket;
bsf->param = param;
return bsf;
}
static int h264bsf_input(void* param, int64_t pts, int64_t dts, const uint8_t* nalu, int bytes)
{
int r;
uint8_t nalt;
struct h264bsf_t* bsf;
bsf = (struct h264bsf_t*)param;
if (bytes > 3 && 0x00 == nalu[0] && 0x00 == nalu[1] && (0x01 == nalu[2] || (0x00 == nalu[2] && 0x01 == nalu[3])))
{
nalu += 0x01 == nalu[2] ? 3 : 4;
bytes -= 0x01 == nalu[2] ? 3 : 4;
}
if (bsf->vcl && (dts != bsf->dts || 0 == bytes || h264_is_new_access_unit(nalu, bytes)))
{
bsf->dts = avdtsinfer_update(&bsf->infer, 1 == bsf->vcl ? 1 : 0, bsf->pts, pts);
r = bsf->onpacket(bsf->param, bsf->pts, bsf->dts, bsf->ptr.ptr, (int)bsf->ptr.len, 1==bsf->vcl ? 0x01 : 0);
bsf->ptr.len = 0;
bsf->sps_pps_flag = 0;
bsf->vcl = 0;
if (0 != r)
return r;
}
if (bytes < 1)
return 0;
nalt = nalu[0] & 0x1f;
switch (nalt)
{
case H264_NAL_SPS:
case H264_NAL_PPS:
//data[k++] = 0; // SPS/PPS add zero_byte(ITU H.264 B.1.2 Byte stream NAL unit semantics)
bsf->sps_pps_flag = 1;
break;
case H264_NAL_IDR:
// insert SPS/PPS before IDR frame
if (0 == bsf->sps_pps_flag)
{
bsf->sps_pps_flag = 1; // don't insert more than one-times
// write sps/pps at first
cbuffer_insert(&bsf->ptr, 0, bsf->extra, bsf->extra_bytes);
}
bsf->vcl = 1;
break;
#if defined(H2645_FILTER_AUD)
case H264_NAL_AUD:
return 0; // filter AUD
#endif
default:
if (nalt > 0 && nalt < H264_NAL_IDR)
{
bsf->vcl = 2;
bsf->sps_pps_flag = 0; // clear sps/pps flags on VCL NAL
}
}
if (cbuffer_append(&bsf->ptr, startcode, sizeof(startcode)) <= 0
|| cbuffer_append(&bsf->ptr, nalu, bytes) <= 0 )
return -(__ERROR__ + ENOMEM);
bsf->pts = pts;
bsf->dts = dts;
return 0;
}
struct avbsf_t* avbsf_h264(void)
{
static struct avbsf_t bsf = {
h264bsf_create,
h264bsf_destroy,
h264bsf_input,
};
return &bsf;
}

View File

@@ -0,0 +1,152 @@
#include "avbsf.h"
#include "cbuffer.h"
#include "mpeg4-hevc.h"
#include "avdtsinfer.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#define H265_NAL_VPS 32
#define H265_NAL_SPS 33
#define H265_NAL_PPS 34
#define H265_NAL_AUD 35 // Access unit delimiter
#define H265_NAL_SEI_PREFIX 39
#define H265_NAL_SEI_SUFFIX 40
static const uint8_t startcode[] = { 0x00, 0x00, 0x00, 0x01 };
struct h265bsf_t
{
struct mpeg4_hevc_t hevc;
struct cbuffer_t ptr;
int vps_sps_pps_flag;
int vcl;
int64_t pts;
int64_t dts;
struct avdtsinfer_t infer;
uint8_t extra[4 * 1024];
int extra_bytes;
avbsf_onpacket onpacket;
void* param;
};
static int h265bsf_destroy(void** pp)
{
struct h265bsf_t* bsf;
if (pp && *pp)
{
bsf = (struct h265bsf_t*)*pp;
cbuffer_free(&bsf->ptr);
free(bsf);
*pp = NULL;
}
return 0;
}
static void* h265bsf_create(const uint8_t* extra, int bytes, avbsf_onpacket onpacket, void* param)
{
struct h265bsf_t* bsf;
bsf = calloc(1, sizeof(*bsf));
if (!bsf) return NULL;
avdtsinfer_reset(&bsf->infer);
cbuffer_init(&bsf->ptr);
bsf->vps_sps_pps_flag = 0;
if (bytes > 5 && bytes <= sizeof(bsf->extra) && 0x00 == extra[0] && 0x00 == extra[1] && (0x01 == extra[2] || (0x00 == extra[2] && 0x01 == extra[3])))
{
memcpy(bsf->extra, extra, bytes);
bsf->extra_bytes = bytes;
}
else if (0 == mpeg4_hevc_decoder_configuration_record_load(extra, bytes, &bsf->hevc))
{
bsf->extra_bytes = mpeg4_hevc_to_nalu(&bsf->hevc, bsf->extra, sizeof(bsf->extra));
if (bsf->extra_bytes < 0)
bsf->extra_bytes = 0;
}
bsf->onpacket = onpacket;
bsf->param = param;
return bsf;
}
static int h265bsf_input(void* param, int64_t pts, int64_t dts, const uint8_t* nalu, int bytes)
{
int r;
uint8_t nalt;
uint8_t irap;
struct h265bsf_t* bsf;
bsf = (struct h265bsf_t*)param;
if (bytes > 3 && 0x00 == nalu[0] && 0x00 == nalu[1] && (0x01 == nalu[2] || (0x00 == nalu[2] && 0x01 == nalu[3])))
{
nalu += 0x01 == nalu[2] ? 3 : 4;
bytes -= 0x01 == nalu[2] ? 3 : 4;
}
if (bsf->vcl && (dts != bsf->dts || 0 == bytes || h265_is_new_access_unit(nalu, bytes)))
{
bsf->dts = avdtsinfer_update(&bsf->infer, 1 == bsf->vcl ? 1 : 0, bsf->pts, pts);
r = bsf->onpacket(bsf->param, bsf->pts, bsf->dts, bsf->ptr.ptr, (int)bsf->ptr.len, 1 == bsf->vcl ? 0x01 : 0);
bsf->ptr.len = 0;
bsf->vps_sps_pps_flag = 0;
bsf->vcl = 0;
if (0 != r)
return r;
}
if (bytes < 1)
return 0;
nalt = (nalu[0] >> 1) & 0x3F;
switch (nalt)
{
case H265_NAL_VPS:
case H265_NAL_SPS:
case H265_NAL_PPS:
bsf->vps_sps_pps_flag = 1;
break;
#if defined(H2645_FILTER_AUD)
case H265_NAL_AUD:
return 0; // ignore AUD
#endif
case H265_NAL_SEI_PREFIX:
case H265_NAL_SEI_SUFFIX:
// fallthough
default:
irap = 16 <= nalt && nalt <= 23;
if (irap && 0 == bsf->vps_sps_pps_flag)
{
bsf->vps_sps_pps_flag = 1; // don't insert more than one-times
// write vps/sps/pps at first
cbuffer_insert(&bsf->ptr, 0, bsf->extra, bsf->extra_bytes);
}
}
if (cbuffer_append(&bsf->ptr, startcode, sizeof(startcode)) <= 0
|| cbuffer_append(&bsf->ptr, nalu, bytes) <= 0)
return -(__ERROR__ + ENOMEM);
bsf->pts = pts;
bsf->dts = dts;
if (nalt < H265_NAL_VPS)
bsf->vcl = (16 <= nalt && nalt <= 23) ? 1 : 2;
return 0;
}
struct avbsf_t* avbsf_h265(void)
{
static struct avbsf_t bsf = {
h265bsf_create,
h265bsf_destroy,
h265bsf_input,
};
return &bsf;
}

View File

@@ -0,0 +1,159 @@
#include "avbsf.h"
#include "cbuffer.h"
#include "mpeg4-vvc.h"
#include "avdtsinfer.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#define H266_NAL_IDR_W_RADL 7
#define H266_NAL_RSV_IRAP 11
#define H266_NAL_OPI 12
#define H266_NAL_DCI 13
#define H266_NAL_VPS 14
#define H266_NAL_SPS 15
#define H266_NAL_PPS 16
#define H266_NAL_PREFIX_APS 17
#define H266_NAL_SUFFIX_APS 18
#define H266_NAL_PH 19
#define H266_NAL_AUD 20
#define H266_NAL_PREFIX_SEI 23
#define H266_NAL_SUFFIX_SEI 24
static const uint8_t startcode[] = { 0x00, 0x00, 0x00, 0x01 };
struct h266bsf_t
{
struct mpeg4_vvc_t vvc;
struct cbuffer_t ptr;
int vps_sps_pps_flag;
int vcl;
int64_t pts;
int64_t dts;
struct avdtsinfer_t infer;
uint8_t extra[4 * 1024];
int extra_bytes;
avbsf_onpacket onpacket;
void* param;
};
static int h266bsf_destroy(void** pp)
{
struct h266bsf_t* bsf;
if (pp && *pp)
{
bsf = (struct h266bsf_t*)*pp;
cbuffer_free(&bsf->ptr);
free(bsf);
*pp = NULL;
}
return 0;
}
static void* h266bsf_create(const uint8_t* extra, int bytes, avbsf_onpacket onpacket, void* param)
{
struct h266bsf_t* bsf;
bsf = calloc(1, sizeof(*bsf));
if (!bsf) return NULL;
avdtsinfer_reset(&bsf->infer);
cbuffer_init(&bsf->ptr);
bsf->vps_sps_pps_flag = 0;
if (bytes > 5 && bytes <= sizeof(bsf->extra) && 0x00 == extra[0] && 0x00 == extra[1] && (0x01 == extra[2] || (0x00 == extra[2] && 0x01 == extra[3])))
{
memcpy(bsf->extra, extra, bytes);
bsf->extra_bytes = bytes;
}
else if (0 == mpeg4_vvc_decoder_configuration_record_load(extra, bytes, &bsf->vvc))
{
bsf->extra_bytes = mpeg4_vvc_to_nalu(&bsf->vvc, bsf->extra, sizeof(bsf->extra));
if (bsf->extra_bytes < 0)
bsf->extra_bytes = 0;
}
bsf->onpacket = onpacket;
bsf->param = param;
return bsf;
}
static int h266bsf_input(void* param, int64_t pts, int64_t dts, const uint8_t* nalu, int bytes)
{
int r;
uint8_t nalt;
uint8_t irap;
struct h266bsf_t* bsf;
bsf = (struct h266bsf_t*)param;
if (bytes > 3 && 0x00 == nalu[0] && 0x00 == nalu[1] && (0x01 == nalu[2] || (0x00 == nalu[2] && 0x01 == nalu[3])))
{
nalu += 0x01 == nalu[2] ? 3 : 4;
bytes -= 0x01 == nalu[2] ? 3 : 4;
}
if (bsf->vcl && (dts != bsf->dts || 0 == bytes || h266_is_new_access_unit(nalu, bytes)))
{
bsf->dts = avdtsinfer_update(&bsf->infer, 1 == bsf->vcl ? 1 : 0, bsf->pts, pts);
r = bsf->onpacket(bsf->param, bsf->pts, bsf->dts, bsf->ptr.ptr, (int)bsf->ptr.len, 1 == bsf->vcl ? 0x01 : 0);
bsf->ptr.len = 0;
bsf->vps_sps_pps_flag = 0;
bsf->vcl = 0;
if (0 != r)
return r;
}
if (bytes < 2)
return 0;
nalt = (nalu[1] >> 3) & 0x1F;
switch (nalt)
{
case H266_NAL_VPS:
case H266_NAL_SPS:
case H266_NAL_PPS:
bsf->vps_sps_pps_flag = 1;
break;
#if defined(H2645_FILTER_AUD)
case H266_NAL_AUD:
return 0; // ignore AUD
#endif
case H266_NAL_PREFIX_SEI:
case H266_NAL_SUFFIX_SEI:
// fallthough
default:
irap = H266_NAL_IDR_W_RADL <= nalt && nalt <= H266_NAL_RSV_IRAP;
if (irap && 0 == bsf->vps_sps_pps_flag)
{
bsf->vps_sps_pps_flag = 1; // don't insert more than one-times
// write vps/sps/pps at first
cbuffer_insert(&bsf->ptr, 0, bsf->extra, bsf->extra_bytes);
}
}
if (cbuffer_append(&bsf->ptr, startcode, sizeof(startcode)) <= 0
|| cbuffer_append(&bsf->ptr, nalu, bytes) <= 0)
return -(__ERROR__ + ENOMEM);
bsf->pts = pts;
bsf->dts = dts;
if (nalt < H266_NAL_OPI)
bsf->vcl = (H266_NAL_IDR_W_RADL <= nalt && nalt <= H266_NAL_RSV_IRAP) ? 1 : 2;
return 0;
}
struct avbsf_t* avbsf_h266(void)
{
static struct avbsf_t bsf = {
h266bsf_create,
h266bsf_destroy,
h266bsf_input,
};
return &bsf;
}

View File

@@ -0,0 +1,44 @@
#include "avbsf.h"
#include <stdlib.h>
struct avbsf_t* avbsf_aac(void);
struct avbsf_t* avbsf_h264(void);
struct avbsf_t* avbsf_h265(void);
struct avbsf_t* avbsf_h266(void);
struct avbsf_t* avbsf_find(AVPACKET_CODEC_ID codec)
{
switch (codec)
{
// video
case AVCODEC_VIDEO_H264:
return avbsf_h264();
case AVCODEC_VIDEO_H265:
return avbsf_h265();
case AVCODEC_VIDEO_H266:
return avbsf_h266();
//case AVCODEC_VIDEO_AV1:
// return avbsf_av1();
//case AVCODEC_VIDEO_VP8:
//case AVCODEC_VIDEO_VP9:
// return avbsf_vpx();
// audio
case AVCODEC_AUDIO_AAC:
return avbsf_aac();
//case AVCODEC_AUDIO_MP3:
// return avbsf_mp3();
//case AVCODEC_AUDIO_OPUS:
// return avbsf_opus();
//case AVCODEC_AUDIO_G711A:
//case AVCODEC_AUDIO_G711U:
//case AVCODEC_AUDIO_G726:
//case AVCODEC_AUDIO_G729:
// return avbsf_g7xx();
//default:
// return avbsf_common();
}
return NULL;
}

View File

@@ -0,0 +1,141 @@
#include "avpbs.h"
#include "mpeg4-aac.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
struct avpbs_aac_t
{
int avs;
int64_t pts, dts; // last frame pts/dts
struct mpeg4_aac_t aac;
struct avstream_t* stream;
avpbs_onpacket onpacket;
void* param;
};
static int avpbs_aac_destroy(void** pp)
{
struct avpbs_aac_t* bs;
if (pp && *pp)
{
bs = (struct avpbs_aac_t*)*pp;
avstream_release(bs->stream);
free(bs);
*pp = NULL;
}
return 0;
}
static void* avpbs_aac_create(int stream, AVPACKET_CODEC_ID codec, const uint8_t* extra, int bytes, avpbs_onpacket onpacket, void* param)
{
struct avpbs_aac_t* bs;
bs = calloc(1, sizeof(*bs));
if (!bs) return NULL;
// can be failure
mpeg4_aac_audio_specific_config_load(extra, bytes, &bs->aac);
assert(AVCODEC_AUDIO_AAC == codec);
bs->onpacket = onpacket;
bs->param = param;
bs->avs = stream;
return bs;
}
static int avpbs_aac_create_stream(struct avpbs_aac_t* bs)
{
avstream_release(bs->stream);
bs->stream = avstream_alloc(2 + bs->aac.npce);
if (!bs->stream)
return -(__ERROR__ + ENOMEM);
bs->stream->stream = bs->avs;
bs->stream->codecid = AVCODEC_AUDIO_AAC;
bs->stream->channels = bs->aac.channels;
bs->stream->sample_rate = bs->aac.sampling_frequency;
bs->stream->sample_bits = 16;
bs->stream->bytes = mpeg4_aac_audio_specific_config_save(&bs->aac, bs->stream->extra, bs->stream->bytes);
return bs->stream->bytes > 0 ? 0 : -1;
}
static int avpbs_aac_input_one_frame(struct avpbs_aac_t* bs, int64_t pts, int64_t dts, const uint8_t* data, int bytes, int flags)
{
int r;
struct avpacket_t* pkt;
pkt = avpacket_alloc(bytes);
if (!pkt) return -(__ERROR__ + ENOMEM);
if (!bs->stream || bs->stream->channels != bs->aac.channels
|| bs->stream->sample_rate != (int)bs->aac.sampling_frequency)
{
r = avpbs_aac_create_stream(bs);
if (0 != r)
{
avpacket_release(pkt);
return r;
}
}
memcpy(pkt->data, data, bytes);
pkt->size = bytes;
pkt->pts = pts;
pkt->dts = dts;
pkt->flags = flags;
pkt->stream = bs->stream;
avstream_addref(bs->stream);
bs->dts = dts;
bs->pts = pts;
r = bs->onpacket(bs->param, bs->stream ? pkt : NULL);
avpacket_release(pkt);
return r;
}
static int avpbs_aac_input(void* param, int64_t pts, int64_t dts, const uint8_t* data, int bytes, int flags)
{
int r, adts, len;
struct avpbs_aac_t* bs;
bs = (struct avpbs_aac_t*)param;
if (dts <= bs->dts)
dts = bs->dts + 1000 * 1024 /*samples per frame*/ / (bs->aac.sampling_frequency > 0 ? bs->aac.sampling_frequency : 44100);
if (pts <= bs->pts)
pts = bs->dts + 1000 * 1024 /*samples per frame*/ / (bs->aac.sampling_frequency > 0 ? bs->aac.sampling_frequency : 44100);
if (bytes >= 7 && 0xFF == data[0] && 0xF0 == (data[1] & 0xF0))
{
do
{
len = mpeg4_aac_adts_frame_length(data, bytes);
adts = mpeg4_aac_adts_load(data, bytes, &bs->aac);
if (adts <= 0 || len < adts || len > bytes)
return -(__ERROR__ + EINVAL);
assert(adts >= 7);
r = avpbs_aac_input_one_frame(bs, pts, dts, (const uint8_t*)data + adts, len - adts, flags);
if (0 != r)
return r;
pts += 1000 * 1024 /*samples per frame*/ / (bs->aac.sampling_frequency > 0 ? bs->aac.sampling_frequency : 44100);
dts += 1000 * 1024 /*samples per frame*/ / (bs->aac.sampling_frequency > 0 ? bs->aac.sampling_frequency : 44100);
bytes -= len;
data += len;
} while (bytes >= 7 && 0xFF == data[0] && 0xF0 == (data[1] & 0xF0));
return 0;
}
else
{
return avpbs_aac_input_one_frame(bs, pts, dts, data, bytes, flags);
}
}
struct avpbs_t* avpbs_aac(void)
{
static struct avpbs_t bs = {
avpbs_aac_create,
avpbs_aac_destroy,
avpbs_aac_input,
};
return &bs;
}

View File

@@ -0,0 +1,93 @@
#include "avpbs.h"
#include "aom-av1.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
struct avpbs_av1_t
{
struct aom_av1_t av1;
struct avstream_t* stream;
avpbs_onpacket onpacket;
void* param;
};
static int avpbs_av1_destroy(void** pp)
{
struct avpbs_av1_t* bs;
if (pp && *pp)
{
bs = (struct avpbs_av1_t*)*pp;
avstream_release(bs->stream);
free(bs);
*pp = NULL;
}
return 0;
}
static int avpbs_av1_create_stream(struct avpbs_av1_t* bs, int stream, const uint8_t* extra, int bytes)
{
avstream_release(bs->stream);
bs->stream = avstream_alloc(bytes);
if (!bs->stream)
return -(__ERROR__ + ENOMEM);
bs->stream->stream = stream;
bs->stream->codecid = AVCODEC_VIDEO_AV1;
memcpy(bs->stream->extra, extra, bytes);
return bs->stream->bytes > 0 ? 0 : -1;
}
static void* avpbs_av1_create(int stream, AVPACKET_CODEC_ID codec, const uint8_t* extra, int bytes, avpbs_onpacket onpacket, void* param)
{
struct avpbs_av1_t* bs;
bs = calloc(1, sizeof(*bs));
if (!bs) return NULL;
if (bytes > 0 && aom_av1_codec_configuration_record_load(extra, bytes, &bs->av1) < 0)
{
avpbs_av1_destroy((void**)&bs);
return NULL;
}
avpbs_av1_create_stream(bs, stream, extra, bytes);
assert(AVCODEC_VIDEO_AV1 == codec);
bs->onpacket = onpacket;
bs->param = param;
return bs;
}
static int avpbs_av1_input(void* param, int64_t pts, int64_t dts, const uint8_t* data, int bytes, int flags)
{
int r;
struct avpacket_t* pkt;
struct avpbs_av1_t* bs;
bs = (struct avpbs_av1_t*)param;
pkt = avpacket_alloc(bytes);
if (!pkt) return -(__ERROR__ + ENOMEM);
// TODO: stream width/height
memcpy(pkt->data, data, bytes);
pkt->pts = pts;
pkt->dts = dts;
pkt->flags = flags;
pkt->stream = bs->stream;
avstream_addref(bs->stream);
r = bs->onpacket(bs->param, bs->stream ? pkt : NULL);
avpacket_release(pkt);
return r;
}
struct avpbs_t* avpbs_av1(void)
{
static struct avpbs_t bs = {
avpbs_av1_create,
avpbs_av1_destroy,
avpbs_av1_input,
};
return &bs;
}

View File

@@ -0,0 +1,91 @@
#include "avpbs.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
// g711/g726/729
struct avpbs_g7xx_t
{
struct avstream_t* stream;
avpbs_onpacket onpacket;
void* param;
};
static int avpbs_g7xx_destroy(void** pp)
{
struct avpbs_g7xx_t* bs;
if (pp && *pp)
{
bs = (struct avpbs_g7xx_t*)*pp;
avstream_release(bs->stream);
free(bs);
*pp = NULL;
}
return 0;
}
static void* avpbs_g7xx_create(int stream, AVPACKET_CODEC_ID codec, const uint8_t* extra, int bytes, avpbs_onpacket onpacket, void* param)
{
struct avpbs_g7xx_t* bs;
bs = calloc(1, sizeof(*bs));
if (!bs) return NULL;
bs->stream = avstream_alloc(0);
if (bs->stream)
{
bs->stream->stream = stream;
switch (codec)
{
case AVCODEC_AUDIO_G711A:
case AVCODEC_AUDIO_G711U:
case AVCODEC_AUDIO_G726:
case AVCODEC_AUDIO_G729:
bs->stream->codecid = codec;
bs->stream->channels = 1;
bs->stream->sample_rate = 8000;
bs->stream->sample_bits = 16;
break;
default:
assert(0);
}
}
(void)extra, (void)bytes; // ignore
bs->onpacket = onpacket;
bs->param = param;
return bs;
}
static int avpbs_g7xx_input(void* param, int64_t pts, int64_t dts, const uint8_t* data, int bytes, int flags)
{
int r;
struct avpacket_t* pkt;
struct avpbs_g7xx_t* bs;
bs = (struct avpbs_g7xx_t*)param;
pkt = avpacket_alloc(bytes);
if (!pkt) return -(__ERROR__ + ENOMEM);
memcpy(pkt->data, data, bytes);
pkt->pts = pts;
pkt->dts = dts;
pkt->flags = flags;
pkt->stream = bs->stream;
avstream_addref(bs->stream);
r = bs->onpacket(bs->param, bs->stream ? pkt : NULL);
avpacket_release(pkt);
return r;
}
struct avpbs_t* avpbs_g7xx(void)
{
static struct avpbs_t bs = {
avpbs_g7xx_create,
avpbs_g7xx_destroy,
avpbs_g7xx_input,
};
return &bs;
}

View File

@@ -0,0 +1,121 @@
#include "avpbs.h"
#include "h264-sps.h"
#include "mpeg4-avc.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#define H264_STARTCODE_PADDING 32 // 3->4 startcode
struct avpbs_h264_t
{
int avs;
struct mpeg4_avc_t avc;
struct avstream_t* stream;
avpbs_onpacket onpacket;
void* param;
};
static int avpbs_h264_create_stream(struct avpbs_h264_t* bs)
{
int x, y;
struct h264_sps_t sps;
avstream_release(bs->stream);
bs->stream = avstream_alloc((int)(bs->avc.off + (bs->avc.nb_sps + bs->avc.nb_pps) * 2 + 64));
if (!bs->stream)
return -(__ERROR__ + ENOMEM);
memset(&sps, 0, sizeof(sps));
h264_sps_parse(bs->avc.sps[0].data, bs->avc.sps[0].bytes, &sps);
h264_display_rect(&sps, &x, &y, &bs->stream->width, &bs->stream->height);
bs->stream->stream = bs->avs;
bs->stream->codecid = AVCODEC_VIDEO_H264;
bs->stream->bytes = mpeg4_avc_decoder_configuration_record_save(&bs->avc, bs->stream->extra, bs->stream->bytes);
return bs->stream->bytes > 0 ? 0 : -1;
}
static int avpbs_h264_destroy(void** pp)
{
struct avpbs_h264_t* bs;
if (pp && *pp)
{
bs = (struct avpbs_h264_t*)*pp;
avstream_release(bs->stream);
free(bs);
*pp = NULL;
}
return 0;
}
static void* avpbs_h264_create(int stream, AVPACKET_CODEC_ID codec, const uint8_t* extra, int bytes, avpbs_onpacket onpacket, void* param)
{
int n;
struct avpbs_h264_t* bs;
bs = calloc(1, sizeof(*bs));
if (!bs) return NULL;
bs->onpacket = onpacket;
bs->param = param;
bs->avs = stream;
// can be failure
assert(AVCODEC_VIDEO_H264 == codec);
n = mpeg4_h264_bitstream_format(extra, bytes);
if (n >= 0) {
h264_annexbtomp4(&bs->avc, extra, bytes, NULL, 0, NULL, NULL);
} else if (bytes >= 7 && 0x01 == extra[0]) {
mpeg4_avc_decoder_configuration_record_load(extra, bytes, &bs->avc);
}
if (bs->avc.nb_sps > 0 && bs->avc.nb_pps > 0)
avpbs_h264_create_stream(bs);
return bs;
}
static int avpbs_h264_input(void* param, int64_t pts, int64_t dts, const uint8_t* nalu, int bytes, int flags)
{
int r, vcl, update;
struct avpacket_t* pkt;
struct avpbs_h264_t* bs;
bs = (struct avpbs_h264_t*)param;
pkt = avpacket_alloc(bytes + H264_STARTCODE_PADDING);
if (!pkt) return -(__ERROR__ + ENOMEM);
r = h264_annexbtomp4(&bs->avc, nalu, bytes, pkt->data, pkt->size, &vcl, &update);
if (r < 1 || (update && bs->avc.nb_sps > 0 && bs->avc.nb_pps > 0 && 0 != avpbs_h264_create_stream(bs)))
{
avpacket_release(pkt);
return r < 0 ? r : (-(__ERROR__ + E2BIG)); // h264 data process failed
}
if (!bs->stream)
{
avpacket_release(pkt);
return 0; // discard
}
pkt->size = r;
pkt->pts = pts;
pkt->dts = dts;
pkt->flags = (flags & (~AVPACKET_FLAG_KEY)) | (1 == vcl ? AVPACKET_FLAG_KEY : 0);
pkt->stream = bs->stream;
avstream_addref(bs->stream);
r = bs->onpacket(bs->param, bs->stream ? pkt : NULL);
avpacket_release(pkt);
return r;
}
struct avpbs_t* avpbs_h264(void)
{
static struct avpbs_t bs = {
avpbs_h264_create,
avpbs_h264_destroy,
avpbs_h264_input,
};
return &bs;
}

View File

@@ -0,0 +1,131 @@
#include "avpbs.h"
#include "h265-sps.h"
#include "mpeg4-avc.h"
#include "mpeg4-hevc.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#define H265_NAL_SPS 33
#define h265_STARTCODE_PADDING 32 // 3->4 startcode
struct avpbs_h265_t
{
int avs;
struct mpeg4_hevc_t hevc;
struct avstream_t* stream;
avpbs_onpacket onpacket;
void* param;
};
static int avpbs_h265_create_stream(struct avpbs_h265_t* bs)
{
int x, y;
struct h265_sps_t sps;
avstream_release(bs->stream);
bs->stream = avstream_alloc((int)(bs->hevc.off + bs->hevc.numOfArrays * 2 + 64));
if (!bs->stream)
return -(__ERROR__ + ENOMEM);
for (x = 0; x < bs->hevc.numOfArrays; x++)
{
if (H265_NAL_SPS != bs->hevc.nalu[x].type)
continue;
memset(&sps, 0, sizeof(sps));
h265_sps_parse(bs->hevc.nalu[x].data, bs->hevc.nalu[x].bytes, &sps);
h265_display_rect(&sps, &x, &y, &bs->stream->width, &bs->stream->height);
break;
}
bs->stream->stream = bs->avs;
bs->stream->codecid = AVCODEC_VIDEO_H265;
bs->stream->bytes = mpeg4_hevc_decoder_configuration_record_save(&bs->hevc, bs->stream->extra, bs->stream->bytes);
return bs->stream->bytes > 0 ? 0 : -1;
}
static int avpbs_h265_destroy(void** pp)
{
struct avpbs_h265_t* bs;
if (pp && *pp)
{
bs = (struct avpbs_h265_t*)*pp;
avstream_release(bs->stream);
free(bs);
*pp = NULL;
}
return 0;
}
static void* avpbs_h265_create(int stream, AVPACKET_CODEC_ID codec, const uint8_t* extra, int bytes, avpbs_onpacket onpacket, void* param)
{
int n;
struct avpbs_h265_t* bs;
bs = calloc(1, sizeof(*bs));
if (!bs) return NULL;
bs->onpacket = onpacket;
bs->param = param;
bs->avs = stream;
// can be failure
assert(AVCODEC_VIDEO_H265 == codec);
n = mpeg4_h264_bitstream_format(extra, bytes);
if (n >= 0) {
h265_annexbtomp4(&bs->hevc, extra, bytes, NULL, 0, NULL, NULL);
} else if (bytes >= 23 && 0x01 == extra[0]) {
mpeg4_hevc_decoder_configuration_record_load(extra, bytes, &bs->hevc);
}
if (bs->hevc.numOfArrays >= 3)
avpbs_h265_create_stream(bs);
return bs;
}
static int avpbs_h265_input(void* param, int64_t pts, int64_t dts, const uint8_t* nalu, int bytes, int flags)
{
int r, vcl, update;
struct avpacket_t* pkt;
struct avpbs_h265_t* bs;
bs = (struct avpbs_h265_t*)param;
pkt = avpacket_alloc(bytes + h265_STARTCODE_PADDING);
if (!pkt) return -(__ERROR__ + ENOMEM);
r = h265_annexbtomp4(&bs->hevc, nalu, bytes, pkt->data, pkt->size, &vcl, &update);
if (r < 1 || (update && bs->hevc.numOfArrays >= 3 && 0 != avpbs_h265_create_stream(bs)))
{
avpacket_release(pkt);
return r < 0 ? r : (-(__ERROR__ + E2BIG)); // h265 data process failed
}
if (!bs->stream)
{
avpacket_release(pkt);
return 0; // discard
}
pkt->size = r;
pkt->pts = pts;
pkt->dts = dts;
pkt->flags = (flags & (~AVPACKET_FLAG_KEY)) | (1 == vcl ? AVPACKET_FLAG_KEY : 0);
pkt->stream = bs->stream;
avstream_addref(bs->stream);
r = bs->onpacket(bs->param, bs->stream ? pkt : NULL);
avpacket_release(pkt);
return r;
}
struct avpbs_t* avpbs_h265(void)
{
static struct avpbs_t bs = {
avpbs_h265_create,
avpbs_h265_destroy,
avpbs_h265_input,
};
return &bs;
}

View File

@@ -0,0 +1,117 @@
#include "avpbs.h"
#include "mpeg4-avc.h"
#include "mpeg4-vvc.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#define h266_STARTCODE_PADDING 32 // 3->4 startcode
struct avpbs_h266_t
{
int avs;
struct mpeg4_vvc_t vvc;
struct avstream_t* stream;
avpbs_onpacket onpacket;
void* param;
};
static int avpbs_h266_create_stream(struct avpbs_h266_t* bs)
{
avstream_release(bs->stream);
bs->stream = avstream_alloc((int)(bs->vvc.off + bs->vvc.numOfArrays * 2 + 64));
if (!bs->stream)
return -(__ERROR__ + ENOMEM);
bs->stream->stream = bs->avs;
bs->stream->codecid = AVCODEC_VIDEO_H265;
bs->stream->width = bs->vvc.max_picture_width;
bs->stream->height = bs->vvc.max_picture_height;
bs->stream->bytes = mpeg4_vvc_decoder_configuration_record_save(&bs->vvc, bs->stream->extra, bs->stream->bytes);
return bs->stream->bytes > 0 ? 0 : -1;
}
static int avpbs_h266_destroy(void** pp)
{
struct avpbs_h266_t* bs;
if (pp && *pp)
{
bs = (struct avpbs_h266_t*)*pp;
avstream_release(bs->stream);
free(bs);
*pp = NULL;
}
return 0;
}
static void* avpbs_h266_create(int stream, AVPACKET_CODEC_ID codec, const uint8_t* extra, int bytes, avpbs_onpacket onpacket, void* param)
{
int n;
struct avpbs_h266_t* bs;
bs = calloc(1, sizeof(*bs));
if (!bs) return NULL;
bs->onpacket = onpacket;
bs->param = param;
bs->avs = stream;
// can be failure
assert(AVCODEC_VIDEO_H266 == codec);
n = mpeg4_h264_bitstream_format(extra, bytes);
if (n >= 0) {
h266_annexbtomp4(&bs->vvc, extra, bytes, NULL, 0, NULL, NULL);
}
else if (bytes >= 5 && 0xF8 == (0xF8 & extra[0])) { // '11111'b;
mpeg4_vvc_decoder_configuration_record_load(extra, bytes, &bs->vvc);
}
if (bs->vvc.numOfArrays >= 3)
avpbs_h266_create_stream(bs);
return bs;
}
static int avpbs_h266_input(void* param, int64_t pts, int64_t dts, const uint8_t* nalu, int bytes, int flags)
{
int r, vcl, update;
struct avpacket_t* pkt;
struct avpbs_h266_t* bs;
bs = (struct avpbs_h266_t*)param;
pkt = avpacket_alloc(bytes + h266_STARTCODE_PADDING);
if (!pkt) return -(__ERROR__ + ENOMEM);
r = h266_annexbtomp4(&bs->vvc, nalu, bytes, pkt->data, pkt->size, &vcl, &update);
if (r < 1 || (update && bs->vvc.numOfArrays >= 3 && 0 != avpbs_h266_create_stream(bs)))
{
avpacket_release(pkt);
return r < 0 ? r : (-(__ERROR__ + E2BIG)); // h266 data process failed
}
if (!bs->stream)
{
avpacket_release(pkt);
return 0; // discard
}
pkt->size = r;
pkt->pts = pts;
pkt->dts = dts;
pkt->flags = (flags & (~AVPACKET_FLAG_KEY)) | (1 == vcl ? AVPACKET_FLAG_KEY : 0);
pkt->stream = bs->stream;
avstream_addref(bs->stream);
r = bs->onpacket(bs->param, bs->stream ? pkt : NULL);
avpacket_release(pkt);
return r;
}
struct avpbs_t* avpbs_h266(void)
{
static struct avpbs_t bs = {
avpbs_h266_create,
avpbs_h266_destroy,
avpbs_h266_input,
};
return &bs;
}

View File

@@ -0,0 +1,104 @@
#include "avpbs.h"
#include "mp3-header.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
struct avpbs_mp3_t
{
int avs;
struct mp3_header_t mp3;
struct avstream_t* stream;
avpbs_onpacket onpacket;
void* param;
};
static int avpbs_mp3_destroy(void** pp)
{
struct avpbs_mp3_t* bs;
if (pp && *pp)
{
bs = (struct avpbs_mp3_t*)*pp;
avstream_release(bs->stream);
free(bs);
*pp = NULL;
}
return 0;
}
static void* avpbs_mp3_create(int stream, AVPACKET_CODEC_ID codec, const uint8_t* extra, int bytes, avpbs_onpacket onpacket, void* param)
{
struct avpbs_mp3_t* bs;
bs = calloc(1, sizeof(*bs));
if (!bs) return NULL;
// can be failure
mp3_header_load(&bs->mp3, extra, bytes);
assert(AVCODEC_AUDIO_MP3 == codec);
bs->onpacket = onpacket;
bs->param = param;
bs->avs = stream;
return bs;
}
static int avpbs_mp3_create_stream(struct avpbs_mp3_t* bs)
{
avstream_release(bs->stream);
bs->stream = avstream_alloc(0);
if (!bs->stream)
return -(__ERROR__ + ENOMEM);
bs->stream->stream = bs->avs;
bs->stream->codecid = AVCODEC_AUDIO_MP3;
bs->stream->channels = mp3_get_channel(&bs->mp3);
bs->stream->sample_rate = mp3_get_frequency(&bs->mp3);
bs->stream->sample_bits = 16;
return 0;
}
static int avpbs_mp3_input(void* param, int64_t pts, int64_t dts, const uint8_t* data, int bytes, int flags)
{
int r;
struct avpacket_t* pkt;
struct avpbs_mp3_t* bs;
bs = (struct avpbs_mp3_t*)param;
pkt = avpacket_alloc(bytes);
if (!pkt) return -(__ERROR__ + ENOMEM);
r = mp3_header_load(&bs->mp3, data, bytes);
if (r < 0)
{
assert(0);
return r;
}
if (!bs->stream || bs->stream->channels != mp3_get_channel(&bs->mp3)
|| bs->stream->sample_rate != mp3_get_frequency(&bs->mp3))
{
avpbs_mp3_create_stream(bs);
}
memcpy(pkt->data, data, bytes);
pkt->size = bytes - r;
pkt->pts = pts;
pkt->dts = dts;
pkt->flags = flags;
pkt->stream = bs->stream;
avstream_addref(bs->stream);
r = bs->onpacket(bs->param, bs->stream ? pkt : NULL);
avpacket_release(pkt);
return r;
}
struct avpbs_t* avpbs_mp3(void)
{
static struct avpbs_t bs = {
avpbs_mp3_create,
avpbs_mp3_destroy,
avpbs_mp3_input,
};
return &bs;
}

View File

@@ -0,0 +1,112 @@
#include "avpbs.h"
#include "opus-head.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
struct avpbs_opus_t
{
int avs;
struct opus_head_t opus;
struct avstream_t* stream;
avpbs_onpacket onpacket;
void* param;
};
static int avpbs_opus_destroy(void** pp)
{
struct avpbs_opus_t* bs;
if (pp && *pp)
{
bs = (struct avpbs_opus_t*)*pp;
avstream_release(bs->stream);
free(bs);
*pp = NULL;
}
return 0;
}
static void* avpbs_opus_create(int stream, AVPACKET_CODEC_ID codec, const uint8_t* extra, int bytes, avpbs_onpacket onpacket, void* param)
{
struct avpbs_opus_t* bs;
bs = calloc(1, sizeof(*bs));
if (!bs) return NULL;
// default
bs->opus.input_sample_rate = 48000;
// can be failure
opus_head_load(extra, bytes, &bs->opus);
assert(AVCODEC_AUDIO_OPUS == codec);
bs->onpacket = onpacket;
bs->param = param;
bs->avs = stream;
return bs;
}
static int avpbs_opus_create_stream(struct avpbs_opus_t* bs)
{
avstream_release(bs->stream);
bs->stream = avstream_alloc(0);
if (!bs->stream)
return -(__ERROR__ + ENOMEM);
bs->stream->stream = bs->avs;
bs->stream->codecid = AVCODEC_AUDIO_OPUS;
bs->stream->channels = opus_head_channels(&bs->opus);
bs->stream->sample_rate = bs->opus.input_sample_rate;
bs->stream->sample_bits = 16;
return 0;
}
static int avpbs_opus_input(void* param, int64_t pts, int64_t dts, const uint8_t* data, int bytes, int flags)
{
int r;
struct avpacket_t* pkt;
struct avpbs_opus_t* bs;
bs = (struct avpbs_opus_t*)param;
pkt = avpacket_alloc(bytes);
if (!pkt) return -(__ERROR__ + ENOMEM);
if (bytes > 8 && 0 == memcmp(data, "OpusHead", 8))
{
r = opus_head_load(data, bytes, &bs->opus);
if (r < 0)
return r;
if (r >= bytes)
return 0; // ignore
data += r;
bytes -= r;
}
if (!bs->stream || bs->stream->channels != opus_head_channels(&bs->opus)
|| bs->stream->sample_rate != (int)bs->opus.input_sample_rate)
{
avpbs_opus_create_stream(bs);
}
memcpy(pkt->data, data, bytes);
pkt->size = bytes;
pkt->pts = pts;
pkt->dts = dts;
pkt->flags = flags;
pkt->stream = bs->stream;
avstream_addref(bs->stream);
r = bs->onpacket(bs->param, bs->stream ? pkt : NULL);
avpacket_release(pkt);
return r;
}
struct avpbs_t* avpbs_opus(void)
{
static struct avpbs_t bs = {
avpbs_opus_create,
avpbs_opus_destroy,
avpbs_opus_input,
};
return &bs;
}

View File

@@ -0,0 +1,106 @@
#include "avpbs.h"
#include "webm-vpx.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
struct avpbs_vpx_t
{
int avs;
struct webm_vpx_t vpx;
AVPACKET_CODEC_ID codec;
struct avstream_t* stream;
avpbs_onpacket onpacket;
void* param;
};
static int avpbs_vpx_destroy(void** pp)
{
struct avpbs_vpx_t* bs;
if (pp && *pp)
{
bs = (struct avpbs_vpx_t*)*pp;
avstream_release(bs->stream);
free(bs);
*pp = NULL;
}
return 0;
}
static int avpbs_vpx_create_stream(struct avpbs_vpx_t* bs, int width, int height, const uint8_t* extra, int bytes)
{
avstream_release(bs->stream);
bs->stream = avstream_alloc(bytes);
if (!bs->stream)
return -(__ERROR__ + ENOMEM);
bs->stream->width = width;
bs->stream->height = height;
bs->stream->stream = bs->avs;
bs->stream->codecid = bs->codec;
memcpy(bs->stream->extra, extra, bytes);
return bs->stream->bytes > 0 ? 0 : -1;
}
static void* avpbs_vpx_create(int stream, AVPACKET_CODEC_ID codec, const uint8_t* extra, int bytes, avpbs_onpacket onpacket, void* param)
{
struct avpbs_vpx_t* bs;
bs = calloc(1, sizeof(*bs));
if (!bs) return NULL;
bs->avs = stream;
bs->codec = codec;
if(webm_vpx_codec_configuration_record_load(extra, bytes, &bs->vpx) > 0)
avpbs_vpx_create_stream(bs, 0, 0, extra, bytes);
assert(AVCODEC_VIDEO_VP8 == codec || AVCODEC_VIDEO_VP9 == codec);
bs->onpacket = onpacket;
bs->param = param;
return bs;
}
static int avpbs_vpx_input(void* param, int64_t pts, int64_t dts, const uint8_t* data, int bytes, int flags)
{
int r, width, height;
struct avpacket_t* pkt;
struct avpbs_vpx_t* bs;
bs = (struct avpbs_vpx_t*)param;
pkt = avpacket_alloc(bytes);
if (!pkt) return -(__ERROR__ + ENOMEM);
flags &= ~AVPACKET_FLAG_KEY;
if ( (AVCODEC_VIDEO_VP8 == bs->codec && webm_vpx_codec_configuration_record_from_vp8(&bs->vpx, &width, &height, data, bytes) >= 0)
|| (AVCODEC_VIDEO_VP9 == bs->codec && webm_vpx_codec_configuration_record_from_vp9(&bs->vpx, &width, &height, data, bytes) >= 0))
{
flags = AVPACKET_FLAG_KEY;
if (!bs->stream || bs->stream->width != width || bs->stream->height != height)
{
uint8_t extra[32];
r = webm_vpx_codec_configuration_record_save(&bs->vpx, extra, sizeof(extra));
avpbs_vpx_create_stream(bs, width, height, extra, r);
}
}
memcpy(pkt->data, data, bytes);
pkt->pts = pts;
pkt->dts = dts;
pkt->flags = flags;
pkt->stream = bs->stream;
avstream_addref(bs->stream);
r = bs->onpacket(bs->param, bs->stream ? pkt : NULL);
avpacket_release(pkt);
return r;
}
struct avpbs_t* avpbs_vpx(void)
{
static struct avpbs_t bs = {
avpbs_vpx_create,
avpbs_vpx_destroy,
avpbs_vpx_input,
};
return &bs;
}

View File

@@ -0,0 +1,124 @@
#include "avpbs.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
static struct avpbs_t* avpbs_common(void);
struct avpbs_t* avpbs_h264(void);
struct avpbs_t* avpbs_h265(void);
struct avpbs_t* avpbs_h266(void);
struct avpbs_t* avpbs_av1(void);
struct avpbs_t* avpbs_vpx(void);
struct avpbs_t* avpbs_aac(void);
struct avpbs_t* avpbs_mp3(void);
struct avpbs_t* avpbs_opus(void);
struct avpbs_t* avpbs_g7xx(void);
struct avpbs_t* avpbs_find(AVPACKET_CODEC_ID codec)
{
switch (codec)
{
// video
case AVCODEC_VIDEO_H264:
return avpbs_h264();
case AVCODEC_VIDEO_H265:
return avpbs_h265();
case AVCODEC_VIDEO_H266:
return avpbs_h266();
case AVCODEC_VIDEO_AV1:
return avpbs_av1();
case AVCODEC_VIDEO_VP8:
case AVCODEC_VIDEO_VP9:
return avpbs_vpx();
// audio
case AVCODEC_AUDIO_AAC:
return avpbs_aac();
case AVCODEC_AUDIO_MP3:
return avpbs_mp3();
case AVCODEC_AUDIO_OPUS:
return avpbs_opus();
case AVCODEC_AUDIO_G711A:
case AVCODEC_AUDIO_G711U:
case AVCODEC_AUDIO_G726:
case AVCODEC_AUDIO_G729:
return avpbs_g7xx();
default:
return avpbs_common();
}
}
struct avpbs_common_t
{
struct avstream_t* stream;
avpbs_onpacket onpacket;
void* param;
};
static int avpbs_common_destroy(void** pp)
{
struct avpbs_common_t* bs;
if (pp && *pp)
{
bs = (struct avpbs_common_t*)*pp;
avstream_release(bs->stream);
free(bs);
*pp = NULL;
}
return 0;
}
static void* avpbs_common_create(int stream, AVPACKET_CODEC_ID codec, const uint8_t* extra, int bytes, avpbs_onpacket onpacket, void* param)
{
struct avpbs_common_t* bs;
bs = calloc(1, sizeof(*bs));
if (!bs) return NULL;
bs->stream = avstream_alloc(bytes);
if (bs->stream)
{
bs->stream->stream = stream;
bs->stream->codecid = codec;
memcpy(bs->stream->extra, extra, bytes);
}
bs->onpacket = onpacket;
bs->param = param;
return bs;
}
static int avpbs_common_input(void* param, int64_t pts, int64_t dts, const uint8_t* data, int bytes, int flags)
{
int r;
struct avpacket_t* pkt;
struct avpbs_common_t* bs;
bs = (struct avpbs_common_t*)param;
pkt = avpacket_alloc(bytes);
if (!pkt) return -(__ERROR__ + ENOMEM);
memcpy(pkt->data, data, bytes);
pkt->pts = pts;
pkt->dts = dts;
pkt->flags = flags;
pkt->stream = bs->stream;
avstream_addref(bs->stream);
r = bs->onpacket(bs->param, pkt);
avpacket_release(pkt);
return r;
}
static struct avpbs_t* avpbs_common(void)
{
static struct avpbs_t bs = {
avpbs_common_create,
avpbs_common_destroy,
avpbs_common_input,
};
return &bs;
}

View File

@@ -0,0 +1,164 @@
#include "avpkt2bs.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#define N_PACKER_SIZE (32 * 1024 * 1024)
int avpkt2bs_create(struct avpkt2bs_t* bs)
{
memset(bs, 0, sizeof(*bs));
return 0;
}
int avpkt2bs_destroy(struct avpkt2bs_t* bs)
{
if (bs->ptr)
{
assert(bs->cap > 0);
free(bs->ptr);
bs->ptr = NULL;
bs->cap = 0;
}
return 0;
}
static int avpkt2bs_realloc(struct avpkt2bs_t* bs, int bytes)
{
void* p;
if (bytes > bs->cap)
{
if(bytes > N_PACKER_SIZE)
return -(__ERROR__ + ENOMEM);
p = realloc(bs->ptr, bytes);
if (NULL == p)
return -(__ERROR__ + ENOMEM);
bs->ptr = (uint8_t*)p;
bs->cap = bytes;
}
return 0;
}
static int avpkt2bs_aac_input(struct avpkt2bs_t* bs, const struct avpacket_t* pkt)
{
int r;
if (0 == bs->a.aac.sampling_frequency)
{
r = mpeg4_aac_audio_specific_config_load((const uint8_t*)pkt->stream->extra, pkt->stream->bytes, &bs->a.aac);
if (r < 0)
return r;
}
r = avpkt2bs_realloc(bs, 7 + bs->a.aac.npce + pkt->size);
if (0 != r)
return r;
r = mpeg4_aac_adts_save(&bs->a.aac, pkt->size, bs->ptr, bs->cap);
if (r < 0 || r + pkt->size > bs->cap)
return r < 0 ? r : (-(__ERROR__ + E2BIG));
memmove(bs->ptr + r, pkt->data, pkt->size);
return r + pkt->size;
}
static int avpkt2bs_h264_input(struct avpkt2bs_t* bs, const struct avpacket_t* pkt)
{
int r;
if (0 == bs->v.avc.off)
{
r = mpeg4_avc_decoder_configuration_record_load((const uint8_t*)pkt->stream->extra, pkt->stream->bytes, &bs->v.avc);
if (r < 0)
return r;
}
r = avpkt2bs_realloc(bs, pkt->size + 16 + sizeof(bs->v.avc.data));
if (0 != r)
return r;
return h264_mp4toannexb(&bs->v.avc, pkt->data, pkt->size, bs->ptr, bs->cap);
}
static int avpkt2bs_h265_input(struct avpkt2bs_t* bs, const struct avpacket_t* pkt)
{
int r;
if (0 == bs->v.hevc.off)
{
r = mpeg4_hevc_decoder_configuration_record_load((const uint8_t*)pkt->stream->extra, pkt->stream->bytes, &bs->v.hevc);
if (r < 0)
return r;
}
r = avpkt2bs_realloc(bs, pkt->size + 16 + sizeof(bs->v.hevc.data));
if (0 != r)
return r;
return h265_mp4toannexb(&bs->v.hevc, pkt->data, pkt->size, bs->ptr, bs->cap);
}
static int avpkt2bs_h266_input(struct avpkt2bs_t* bs, const struct avpacket_t* pkt)
{
int r;
if (0 == bs->v.vvc.off)
{
r = mpeg4_vvc_decoder_configuration_record_load((const uint8_t*)pkt->stream->extra, pkt->stream->bytes, &bs->v.vvc);
if (r < 0)
return r;
}
r = avpkt2bs_realloc(bs, pkt->size + 16 + sizeof(bs->v.vvc.data));
if (0 != r)
return r;
return h266_mp4toannexb(&bs->v.vvc, pkt->data, pkt->size, bs->ptr, bs->cap);
}
static int avpkt2bs_copy_input(struct avpkt2bs_t* bs, const struct avpacket_t* pkt)
{
int r;
r = avpkt2bs_realloc(bs, pkt->size);
if (0 != r)
return r;
memcpy(bs->ptr, pkt->data, pkt->size);
return pkt->size;
}
int avpkt2bs_input(struct avpkt2bs_t* bs, const struct avpacket_t* pkt)
{
switch (pkt->stream->codecid)
{
case AVCODEC_AUDIO_AAC:
return avpkt2bs_aac_input(bs, pkt);
case AVCODEC_AUDIO_MP3:
case AVCODEC_AUDIO_OPUS:
case AVCODEC_AUDIO_G711A:
case AVCODEC_AUDIO_G711U:
return avpkt2bs_copy_input(bs, pkt);
case AVCODEC_VIDEO_H264:
return avpkt2bs_h264_input(bs, pkt);
case AVCODEC_VIDEO_H265:
return avpkt2bs_h265_input(bs, pkt);
case AVCODEC_VIDEO_H266:
return avpkt2bs_h266_input(bs, pkt);
case AVCODEC_VIDEO_AV1:
case AVCODEC_VIDEO_VP8:
case AVCODEC_VIDEO_VP9:
return avpkt2bs_copy_input(bs, pkt);
case AVCODEC_DATA_MP2P:
return avpkt2bs_copy_input(bs, pkt);
case AVCODEC_VIDEO_SVAC:
case AVCODEC_AUDIO_SVAC:
return avpkt2bs_copy_input(bs, pkt);
default:
return -(__ERROR__ + ENOPROTOOPT);
}
}

View File

@@ -0,0 +1,137 @@
ROOT:=../../sdk
CONTRIB:=../../3rd
__ENABLE_X264__ ?= 0
__ENABLE_X262__ ?= 0
__ENABLE_OPENH264__ ?= 0
__ENABLE_FAAC__ ?= 0
__ENABLE_OPUS__ ?= 0
__ENABLE_MP2__ ?= 0
__ENABLE_FREETYPE__ ?= 0
__ENABLE_RESAMPLER__ ?= 0
#--------------------------------Output------------------------------
# OUTTYPE: 0-exe, 1-dll, 2-static
#--------------------------------------------------------------------
OUTTYPE = 2
OUTFILE = libavcodec.a
#-------------------------------Include------------------------------
#
# INCLUDES = $(addprefix -I,$(INCLUDES)) # add -I prefix
#--------------------------------------------------------------------
INCLUDES = . \
./include \
$(ROOT)/include \
$(CONTRIB) \
$(CONTRIB)/opus \
$(CONTRIB)/faac \
$(CONTRIB)/x264 \
$(CONTRIB)/openh264 \
$(CONTRIB)/freetype/include \
$(CONTRIB)/twolame \
$(CONTRIB)/soxr
#-------------------------------Source-------------------------------
#
#--------------------------------------------------------------------
SOURCE_PATHS = source
SOURCE_FILES = $(foreach dir,$(SOURCE_PATHS),$(wildcard $(dir)/*.cpp))
SOURCE_FILES += $(foreach dir,$(SOURCE_PATHS),$(wildcard $(dir)/*.c))
_SOURCE_FILES =
#-----------------------------Library--------------------------------
#
# LIBPATHS = $(addprefix -L,$(LIBPATHS)) # add -L prefix
#--------------------------------------------------------------------
LIBPATHS = $(CONTRIB)/openssl/$(PLATFORM) $(CONTRIB)/soxr/$(PLATFORM)
ifdef RELEASE
# relase library path
LIBPATHS +=
else
LIBPATHS +=
endif
LIBS =
STATIC_LIBS =
#-----------------------------DEFINES--------------------------------
#
# DEFINES := $(addprefix -D,$(DEFINES)) # add -L prefix
#--------------------------------------------------------------------
DEFINES = NO_CRYPTO
#-----------------------------CUSTOM--------------------------------
#
#--------------------------------------------------------------------
ifeq ($(__ENABLE_X264__),1)
STATIC_LIBS += $(CONTRIB)/x264/$(PLATFORM)/libx264.a
DEFINES += _AVCODEC_X264_
else
_SOURCE_FILES += source/x264enc.c
endif
ifeq ($(__ENABLE_X262__),1)
STATIC_LIBS += $(CONTRIB)/x264/$(PLATFORM)/libx264.a
DEFINES += _AVCODEC_X262_
else
_SOURCE_FILES += source/x262enc.c
endif
ifeq ($(__ENABLE_OPENH264__),1)
STATIC_LIBS += $(CONTRIB)/openh264/$(PLATFORM)/libopenh264.a
DEFINES += _AVCODEC_OPENH264_
else
_SOURCE_FILES += source/openh264enc.cpp
endif
ifeq ($(__ENABLE_FAAC__),1)
STATIC_LIBS += $(CONTRIB)/faac/$(PLATFORM)/libfaac.a
STATIC_LIBS += $(CONTRIB)/faac/$(PLATFORM)/libfaad2.a
DEFINES += _AVCODEC_FAAC_
else
_SOURCE_FILES += source/faac-decoder.c
_SOURCE_FILES += source/faac-encoder.c
endif
ifeq ($(__ENABLE_OPUS__),1)
STATIC_LIBS += $(CONTRIB)/opus/$(PLATFORM)/libopus.a
DEFINES += _AVCODEC_OPUS_
else
_SOURCE_FILES += source/opus-decoder.c
_SOURCE_FILES += source/opus-encoder.c
endif
ifeq ($(__ENABLE_MP2__),1)
STATIC_LIBS += $(CONTRIB)/twolame/$(PLATFORM)/libtwolame.a
DEFINES += _AVCODEC_TWOLAME_
else
_SOURCE_FILES += source/mp2lame-encoder.c
endif
ifeq ($(__ENABLE_FREETYPE__),1)
LIBS += freetype
DEFINES += _AVCODEC_FREETYPE_
else
_SOURCE_FILES += source/text-render-freetype.c
endif
ifeq ($(__ENABLE_RESAMPLER__),1)
LIBS += soxr
DEFINES += _AVCODEC_SOXR_
else
_SOURCE_FILES += source/audio-resampler.c
endif
#-----------------------------COMMON--------------------------------
#
#--------------------------------------------------------------------
SOURCE_FILES := $(filter-out $(_SOURCE_FILES),$(SOURCE_FILES))
include $(ROOT)/gcc.mk
GCC_VER_GTE44 := $(shell echo `gcc -dumpversion | cut -f1-2 -d.` \< 4.4 | bc )
ifeq ($(GCC_VER_GTE44),1)
CFLAGS += -march=i586
endif

View File

@@ -0,0 +1,215 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\audio-mixer.h" />
<ClInclude Include="include\audio-resampler.h" />
<ClInclude Include="include\avbuffer.h" />
<ClInclude Include="include\avcodecid.h" />
<ClInclude Include="include\avdtsinfer.h" />
<ClInclude Include="include\avframe.h" />
<ClInclude Include="include\avpacket.h" />
<ClInclude Include="include\avsegment.h" />
<ClInclude Include="include\avstatistic.h" />
<ClInclude Include="include\avstream.h" />
<ClInclude Include="include\avtimeline.h" />
<ClInclude Include="include\bitmap.h" />
<ClInclude Include="include\colorspace.h" />
<ClInclude Include="include\h264-encoder.h" />
<ClInclude Include="include\h264-parameter.h" />
<ClInclude Include="include\audio-decoder.h" />
<ClInclude Include="include\audio-encoder.h" />
<ClInclude Include="include\text-render.h" />
<ClInclude Include="include\yuv-overlay.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="source\audio-mixer.c" />
<ClCompile Include="source\audio-resampler.c" />
<ClCompile Include="source\avbuffer.c" />
<ClCompile Include="source\avdtsinfer.c" />
<ClCompile Include="source\avframe.c" />
<ClCompile Include="source\avpacket.c" />
<ClCompile Include="source\avsegment.c" />
<ClCompile Include="source\avstatistic.c" />
<ClCompile Include="source\avstream.c" />
<ClCompile Include="source\avtimeline.c" />
<ClCompile Include="source\bitmap.c" />
<ClCompile Include="source\colorspace.c" />
<ClCompile Include="source\faac-decoder.c" />
<ClCompile Include="source\faac-encoder.c" />
<ClCompile Include="source\fdk-decoder.c" />
<ClCompile Include="source\g711-decoder.c" />
<ClCompile Include="source\g711-encoder.c" />
<ClCompile Include="source\interpolation-bilinear.c" />
<ClCompile Include="source\mp2lame-encoder.c" />
<ClCompile Include="source\openh264enc.cpp" />
<ClCompile Include="source\opus-decoder.c" />
<ClCompile Include="source\opus-encoder.c" />
<ClCompile Include="source\text-render-freetype.c" />
<ClCompile Include="source\text-render-gdi.c" />
<ClCompile Include="source\x262enc.c" />
<ClCompile Include="source\x264enc.c" />
<ClCompile Include="source\yuv-overlay.c" />
<ClCompile Include="test\faac-decoder-test.cpp" />
<ClCompile Include="test\faac-encoder-test.cpp" />
<ClCompile Include="test\fdk-decoder-test.cpp" />
<ClCompile Include="test\g711-decoder-test.cpp" />
<ClCompile Include="test\g711-encoder-test.cpp" />
<ClCompile Include="test\interpolation-test.cpp" />
<ClCompile Include="test\text-render-test.cpp" />
<ClCompile Include="test\x264-encode-test.cpp" />
<ClCompile Include="test\yuv-overlay-test.cpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{01E9D416-4A49-416E-8182-22241F07C295}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>avcodec</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;OS_WINDOWS;_CRT_SECURE_NO_WARNINGS;_AVCODEC_FAAC_;_AVCODEC_OPUS_;_AVCODEC_TWOLAME_;_AVCODEC_X264_;_AVCODEC_OPENH264_;_AVCODEC_FREETYPE_;%(PreprocessorDefinitions);_AVCODEC_SOXR_</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.;include;../../sdk/include;../../3rd/freetype/include;../../3rd/freetype/include/freetype2;../../3rd/faac;../../3rd/twolame;../../3rd;../../3rd/soxr;../../3rd/fdk</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
<Lib>
<AdditionalLibraryDirectories>..\..\3rd\openh264\win32;..\..\3rd\x264\win32;..\..\3rd\freetype\win32;..\..\3rd\opus\win32;..\..\3rd\faac\win32;..\..\3rd\soxr\win32</AdditionalLibraryDirectories>
<AdditionalDependencies>libx264-164.lib;openh264-v2.1.1.lib;freetype.lib;opus.lib;libfaac-1.30.lib;libfaad-2.10.0.lib;libsoxr.lib;fdk-aac.lib</AdditionalDependencies>
</Lib>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_LIB;OS_WINDOWS;%(PreprocessorDefinitions);_AVCODEC_FAAC_;_AVCODEC_OPUS_;_AVCODEC_TWOLAME_;_AVCODEC_X264_;_AVCODEC_OPENH264_;_AVCODEC_FREETYPE_;_AVCODEC_SOXR_</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.;include;../../sdk/include;../../3rd/freetype/include;../../3rd/freetype/include/freetype2;../../3rd/faac;../../3rd/twolame;../../3rd;../../3rd/soxr;../../3rd/fdk</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
<Lib>
<AdditionalLibraryDirectories>..\..\3rd\openh264\win64;..\..\3rd\x264\win64;..\..\3rd\freetype\win64;..\..\3rd\opus\win64;..\..\3rd\faac\win64;..\..\3rd\soxr\win64;..\..\3rd\fdk\win642</AdditionalLibraryDirectories>
<AdditionalDependencies>libx264-164.lib;openh264-v2.1.1.lib;freetype.lib;opus.lib;libfaac-1.30.lib;libfaad-2.10.0.lib;libsoxr.lib</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;OS_WINDOWS;%(PreprocessorDefinitions);_AVCODEC_FAAC_;_AVCODEC_OPUS_;_AVCODEC_TWOLAME_;_AVCODEC_X264_;_AVCODEC_OPENH264_;_AVCODEC_FREETYPE_;_AVCODEC_SOXR_</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.;include;../../sdk/include;../../3rd/freetype/include;../../3rd/freetype/include/freetype2;../../3rd/faac;../../3rd/twolame;../../3rd;../../3rd/soxr;../../3rd/fdk</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Lib>
<AdditionalDependencies>libx264-164.lib;openh264-v2.1.1.lib;freetype.lib;opus.lib;libfaac-1.30.lib;libfaad-2.10.0.lib;libsoxr.lib;fdk-aac.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\3rd\openh264\win32;..\..\3rd\x264\win32;..\..\3rd\freetype\win32;..\..\3rd\opus\win32;..\..\3rd\faac\win32;..\..\3rd\soxr\win32</AdditionalLibraryDirectories>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_LIB;OS_WINDOWS;%(PreprocessorDefinitions);_AVCODEC_FAAC_;_AVCODEC_OPUS_;_AVCODEC_TWOLAME_;_AVCODEC_X264_;_AVCODEC_OPENH264_;_AVCODEC_FREETYPE_;_AVCODEC_SOXR_</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.;include;../../sdk/include;../../3rd/freetype/include;../../3rd/freetype/include/freetype2;../../3rd/faac;../../3rd/twolame;../../3rd;../../3rd/soxr;../../3rd/fdk</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Lib>
<AdditionalLibraryDirectories>..\..\3rd\openh264\win64;..\..\3rd\x264\win64;..\..\3rd\freetype\win64;..\..\3rd\opus\win64;..\..\3rd\faac\win64;..\..\3rd\soxr\win64;..\..\3rd\fdk\win64</AdditionalLibraryDirectories>
<AdditionalDependencies>libx264-164.lib;openh264-v2.1.1.lib;freetype.lib;opus.lib;libfaac-1.30.lib;libfaad-2.10.0.lib;libsoxr.lib;fdk-aac.lib</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,189 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="test">
<UniqueIdentifier>{bbd98074-db13-40f1-a56f-da8585db8737}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\avpacket.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\h264-parameter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\yuv-overlay.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\colorspace.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\h264-encoder.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\text-render.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\bitmap.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\avstatistic.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\avframe.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\audio-encoder.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\audio-decoder.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\avbuffer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\avstream.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\avcodecid.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\avtimeline.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\audio-mixer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\avsegment.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\avdtsinfer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\audio-resampler.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="source\x264enc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\yuv-overlay.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\colorspace.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\interpolation-bilinear.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\bitmap.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\openh264enc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="test\text-render-test.cpp">
<Filter>test</Filter>
</ClCompile>
<ClCompile Include="test\x264-encode-test.cpp">
<Filter>test</Filter>
</ClCompile>
<ClCompile Include="test\yuv-overlay-test.cpp">
<Filter>test</Filter>
</ClCompile>
<ClCompile Include="test\interpolation-test.cpp">
<Filter>test</Filter>
</ClCompile>
<ClCompile Include="source\text-render-freetype.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\text-render-gdi.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\opus-encoder.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\avbuffer.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\avframe.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\avpacket.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\faac-encoder.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\faac-decoder.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="test\faac-encoder-test.cpp">
<Filter>test</Filter>
</ClCompile>
<ClCompile Include="test\faac-decoder-test.cpp">
<Filter>test</Filter>
</ClCompile>
<ClCompile Include="source\mp2lame-encoder.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\avstream.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\avstatistic.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\avtimeline.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\audio-mixer.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\avsegment.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\g711-decoder.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\g711-encoder.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="test\g711-decoder-test.cpp">
<Filter>test</Filter>
</ClCompile>
<ClCompile Include="test\g711-encoder-test.cpp">
<Filter>test</Filter>
</ClCompile>
<ClCompile Include="source\avdtsinfer.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\opus-decoder.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\audio-resampler.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\x262enc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\fdk-decoder.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="test\fdk-decoder-test.cpp">
<Filter>test</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,408 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
46BC16B726858C3D0008446D /* avsegment.c in Sources */ = {isa = PBXBuildFile; fileRef = 46BC16B626858C3D0008446D /* avsegment.c */; };
46E55E592473849400D8BDBA /* avtimeline.c in Sources */ = {isa = PBXBuildFile; fileRef = 46E55E582473849400D8BDBA /* avtimeline.c */; };
46EDF1F62938DF080055AF56 /* g711-decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 46EDF1F52938DF080055AF56 /* g711-decoder.c */; };
46EDF1F92938DF120055AF56 /* audio-mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = 46EDF1F82938DF120055AF56 /* audio-mixer.c */; };
46EDF1FC2938DF1B0055AF56 /* audio-resampler.c in Sources */ = {isa = PBXBuildFile; fileRef = 46EDF1FB2938DF1B0055AF56 /* audio-resampler.c */; };
46EDF1FF2938DF280055AF56 /* g711-encoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 46EDF1FE2938DF280055AF56 /* g711-encoder.c */; };
46EDF2022938DF3A0055AF56 /* x262enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 46EDF2012938DF3A0055AF56 /* x262enc.c */; };
46F3016524023F2A005EF41A /* mp2lame-encoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 46F3015124023F2A005EF41A /* mp2lame-encoder.c */; };
46F3016624023F2A005EF41A /* avbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 46F3015224023F2A005EF41A /* avbuffer.c */; };
46F3016724023F2A005EF41A /* colorspace.c in Sources */ = {isa = PBXBuildFile; fileRef = 46F3015324023F2A005EF41A /* colorspace.c */; };
46F3016824023F2A005EF41A /* avpacket.c in Sources */ = {isa = PBXBuildFile; fileRef = 46F3015424023F2A005EF41A /* avpacket.c */; };
46F3016924023F2A005EF41A /* faac-encoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 46F3015524023F2A005EF41A /* faac-encoder.c */; };
46F3016A24023F2A005EF41A /* bitmap.c in Sources */ = {isa = PBXBuildFile; fileRef = 46F3015624023F2A005EF41A /* bitmap.c */; };
46F3016B24023F2A005EF41A /* avframe.c in Sources */ = {isa = PBXBuildFile; fileRef = 46F3015724023F2A005EF41A /* avframe.c */; };
46F3016C24023F2A005EF41A /* opus-decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 46F3015824023F2A005EF41A /* opus-decoder.c */; };
46F3016D24023F2A005EF41A /* interpolation-bilinear.c in Sources */ = {isa = PBXBuildFile; fileRef = 46F3015924023F2A005EF41A /* interpolation-bilinear.c */; };
46F3016E24023F2A005EF41A /* text-render-freetype.c in Sources */ = {isa = PBXBuildFile; fileRef = 46F3015A24023F2A005EF41A /* text-render-freetype.c */; };
46F3016F24023F2A005EF41A /* opus-encoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 46F3015B24023F2A005EF41A /* opus-encoder.c */; };
46F3017124023F2A005EF41A /* faac-decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 46F3015D24023F2A005EF41A /* faac-decoder.c */; };
46F3017324023F2A005EF41A /* yuv-overlay.c in Sources */ = {isa = PBXBuildFile; fileRef = 46F3015F24023F2A005EF41A /* yuv-overlay.c */; };
46F3017424023F2A005EF41A /* x264enc.c in Sources */ = {isa = PBXBuildFile; fileRef = 46F3016024023F2A005EF41A /* x264enc.c */; };
46F3017524023F2A005EF41A /* openh264enc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F3016124023F2A005EF41A /* openh264enc.cpp */; };
46F3017624023F2A005EF41A /* avstream.c in Sources */ = {isa = PBXBuildFile; fileRef = 46F3016224023F2A005EF41A /* avstream.c */; };
46F3017724023F2A005EF41A /* avstatistic.c in Sources */ = {isa = PBXBuildFile; fileRef = 46F3016324023F2A005EF41A /* avstatistic.c */; };
46F3017824023F2A005EF41A /* rgb-overlay.c in Sources */ = {isa = PBXBuildFile; fileRef = 46F3016424023F2A005EF41A /* rgb-overlay.c */; };
4CEE46E227A70A9100740460 /* avdtsinfer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4CEE46E127A70A9100740460 /* avdtsinfer.c */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
46BC16B626858C3D0008446D /* avsegment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = avsegment.c; sourceTree = "<group>"; };
46E55E582473849400D8BDBA /* avtimeline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = avtimeline.c; sourceTree = "<group>"; };
46EDF1F52938DF080055AF56 /* g711-decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "g711-decoder.c"; sourceTree = "<group>"; };
46EDF1F82938DF120055AF56 /* audio-mixer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "audio-mixer.c"; sourceTree = "<group>"; };
46EDF1FB2938DF1B0055AF56 /* audio-resampler.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "audio-resampler.c"; sourceTree = "<group>"; };
46EDF1FE2938DF280055AF56 /* g711-encoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "g711-encoder.c"; sourceTree = "<group>"; };
46EDF2012938DF3A0055AF56 /* x262enc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = x262enc.c; sourceTree = "<group>"; };
46F3010E24023837005EF41A /* libavcodec.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libavcodec.a; sourceTree = BUILT_PRODUCTS_DIR; };
46F3014C24023EB3005EF41A /* include */ = {isa = PBXFileReference; lastKnownFileType = folder; path = include; sourceTree = "<group>"; };
46F3015124023F2A005EF41A /* mp2lame-encoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "mp2lame-encoder.c"; sourceTree = "<group>"; };
46F3015224023F2A005EF41A /* avbuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = avbuffer.c; sourceTree = "<group>"; };
46F3015324023F2A005EF41A /* colorspace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = colorspace.c; sourceTree = "<group>"; };
46F3015424023F2A005EF41A /* avpacket.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = avpacket.c; sourceTree = "<group>"; };
46F3015524023F2A005EF41A /* faac-encoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "faac-encoder.c"; sourceTree = "<group>"; };
46F3015624023F2A005EF41A /* bitmap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bitmap.c; sourceTree = "<group>"; };
46F3015724023F2A005EF41A /* avframe.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = avframe.c; sourceTree = "<group>"; };
46F3015824023F2A005EF41A /* opus-decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "opus-decoder.c"; sourceTree = "<group>"; };
46F3015924023F2A005EF41A /* interpolation-bilinear.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "interpolation-bilinear.c"; sourceTree = "<group>"; };
46F3015A24023F2A005EF41A /* text-render-freetype.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "text-render-freetype.c"; sourceTree = "<group>"; };
46F3015B24023F2A005EF41A /* opus-encoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "opus-encoder.c"; sourceTree = "<group>"; };
46F3015D24023F2A005EF41A /* faac-decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "faac-decoder.c"; sourceTree = "<group>"; };
46F3015F24023F2A005EF41A /* yuv-overlay.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "yuv-overlay.c"; sourceTree = "<group>"; };
46F3016024023F2A005EF41A /* x264enc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = x264enc.c; sourceTree = "<group>"; };
46F3016124023F2A005EF41A /* openh264enc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = openh264enc.cpp; sourceTree = "<group>"; };
46F3016224023F2A005EF41A /* avstream.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = avstream.c; sourceTree = "<group>"; };
46F3016324023F2A005EF41A /* avstatistic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = avstatistic.c; sourceTree = "<group>"; };
46F3016424023F2A005EF41A /* rgb-overlay.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "rgb-overlay.c"; sourceTree = "<group>"; };
4CEE46E127A70A9100740460 /* avdtsinfer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = avdtsinfer.c; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
46F3010C24023837005EF41A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
46F3010524023837005EF41A = {
isa = PBXGroup;
children = (
46F3014C24023EB3005EF41A /* include */,
46F3015024023F2A005EF41A /* source */,
46F3010F24023837005EF41A /* Products */,
);
sourceTree = "<group>";
};
46F3010F24023837005EF41A /* Products */ = {
isa = PBXGroup;
children = (
46F3010E24023837005EF41A /* libavcodec.a */,
);
name = Products;
sourceTree = "<group>";
};
46F3015024023F2A005EF41A /* source */ = {
isa = PBXGroup;
children = (
46EDF1F82938DF120055AF56 /* audio-mixer.c */,
46EDF1FB2938DF1B0055AF56 /* audio-resampler.c */,
46F3015224023F2A005EF41A /* avbuffer.c */,
4CEE46E127A70A9100740460 /* avdtsinfer.c */,
46F3015724023F2A005EF41A /* avframe.c */,
46F3015424023F2A005EF41A /* avpacket.c */,
46BC16B626858C3D0008446D /* avsegment.c */,
46F3016324023F2A005EF41A /* avstatistic.c */,
46F3016224023F2A005EF41A /* avstream.c */,
46E55E582473849400D8BDBA /* avtimeline.c */,
46F3015624023F2A005EF41A /* bitmap.c */,
46F3015324023F2A005EF41A /* colorspace.c */,
46F3015D24023F2A005EF41A /* faac-decoder.c */,
46F3015524023F2A005EF41A /* faac-encoder.c */,
46EDF1F52938DF080055AF56 /* g711-decoder.c */,
46EDF1FE2938DF280055AF56 /* g711-encoder.c */,
46F3015924023F2A005EF41A /* interpolation-bilinear.c */,
46F3015124023F2A005EF41A /* mp2lame-encoder.c */,
46F3016124023F2A005EF41A /* openh264enc.cpp */,
46F3015824023F2A005EF41A /* opus-decoder.c */,
46F3015B24023F2A005EF41A /* opus-encoder.c */,
46F3016424023F2A005EF41A /* rgb-overlay.c */,
46F3015A24023F2A005EF41A /* text-render-freetype.c */,
46EDF2012938DF3A0055AF56 /* x262enc.c */,
46F3016024023F2A005EF41A /* x264enc.c */,
46F3015F24023F2A005EF41A /* yuv-overlay.c */,
);
path = source;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
46F3010A24023837005EF41A /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
46F3010D24023837005EF41A /* avcodec */ = {
isa = PBXNativeTarget;
buildConfigurationList = 46F3011224023837005EF41A /* Build configuration list for PBXNativeTarget "avcodec" */;
buildPhases = (
46F3010A24023837005EF41A /* Headers */,
46F3010B24023837005EF41A /* Sources */,
46F3010C24023837005EF41A /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = avcodec;
productName = avcodec;
productReference = 46F3010E24023837005EF41A /* libavcodec.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
46F3010624023837005EF41A /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1240;
ORGANIZATIONNAME = ireader;
TargetAttributes = {
46F3010D24023837005EF41A = {
CreatedOnToolsVersion = 11.3;
};
};
};
buildConfigurationList = 46F3010924023837005EF41A /* Build configuration list for PBXProject "avcodec" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 46F3010524023837005EF41A;
productRefGroup = 46F3010F24023837005EF41A /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
46F3010D24023837005EF41A /* avcodec */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
46F3010B24023837005EF41A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
46F3016724023F2A005EF41A /* colorspace.c in Sources */,
46F3016C24023F2A005EF41A /* opus-decoder.c in Sources */,
46EDF1FF2938DF280055AF56 /* g711-encoder.c in Sources */,
46F3017624023F2A005EF41A /* avstream.c in Sources */,
46F3016B24023F2A005EF41A /* avframe.c in Sources */,
46EDF1FC2938DF1B0055AF56 /* audio-resampler.c in Sources */,
46F3017124023F2A005EF41A /* faac-decoder.c in Sources */,
46F3017424023F2A005EF41A /* x264enc.c in Sources */,
46F3016624023F2A005EF41A /* avbuffer.c in Sources */,
46F3016A24023F2A005EF41A /* bitmap.c in Sources */,
46EDF1F62938DF080055AF56 /* g711-decoder.c in Sources */,
46F3017824023F2A005EF41A /* rgb-overlay.c in Sources */,
46F3016924023F2A005EF41A /* faac-encoder.c in Sources */,
46BC16B726858C3D0008446D /* avsegment.c in Sources */,
46EDF2022938DF3A0055AF56 /* x262enc.c in Sources */,
4CEE46E227A70A9100740460 /* avdtsinfer.c in Sources */,
46F3017324023F2A005EF41A /* yuv-overlay.c in Sources */,
46EDF1F92938DF120055AF56 /* audio-mixer.c in Sources */,
46F3016F24023F2A005EF41A /* opus-encoder.c in Sources */,
46F3016E24023F2A005EF41A /* text-render-freetype.c in Sources */,
46F3017524023F2A005EF41A /* openh264enc.cpp in Sources */,
46F3017724023F2A005EF41A /* avstatistic.c in Sources */,
46F3016D24023F2A005EF41A /* interpolation-bilinear.c in Sources */,
46F3016824023F2A005EF41A /* avpacket.c in Sources */,
46F3016524023F2A005EF41A /* mp2lame-encoder.c in Sources */,
46E55E592473849400D8BDBA /* avtimeline.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
46F3011024023837005EF41A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
OS_MAC,
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
USER_HEADER_SEARCH_PATHS = (
.,
include,
../../sdk/include,
../../3rd/faac,
../../3rd/freetype/include,
../../3rd/freetype/include/freetype2,
../../3rd/twolame,
../../3rd/,
);
};
name = Debug;
};
46F3011124023837005EF41A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = OS_MAC;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
USER_HEADER_SEARCH_PATHS = (
.,
include,
../../sdk/include,
../../3rd/faac,
../../3rd/freetype/include,
../../3rd/freetype/include/freetype2,
../../3rd/twolame,
../../3rd/,
);
};
name = Release;
};
46F3011324023837005EF41A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
EXECUTABLE_PREFIX = lib;
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Debug;
};
46F3011424023837005EF41A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
EXECUTABLE_PREFIX = lib;
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
46F3010924023837005EF41A /* Build configuration list for PBXProject "avcodec" */ = {
isa = XCConfigurationList;
buildConfigurations = (
46F3011024023837005EF41A /* Debug */,
46F3011124023837005EF41A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
46F3011224023837005EF41A /* Build configuration list for PBXNativeTarget "avcodec" */ = {
isa = XCConfigurationList;
buildConfigurations = (
46F3011324023837005EF41A /* Debug */,
46F3011424023837005EF41A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 46F3010624023837005EF41A /* Project object */;
}

View File

@@ -0,0 +1,33 @@
#ifndef _audio_decoder_h_
#define _audio_decoder_h_
#include "audio-encoder.h"
#ifdef __cplusplus
extern "C" {
#endif
struct audio_decoder_t
{
void* (*create)(int format, int channels, int samplerate, const void* extradata, int extradata_size);
void (*destroy)(void* audio);
/// @return >0-got a packet, 0-need more data, <0-error
int (*decode)(void* audio, const struct avpacket_t* pkt);
/// Get decode audio frame
/// @param[out] frame alloc memory internal, use avframe_release to free memory
/// @return >0-got a packet, 0-no packet, <0-error
int (*getframe)(void* audio, struct avframe_t** frame);
};
struct audio_decoder_t* fdk_decoder(void);
struct audio_decoder_t* faac_decoder(void);
struct audio_decoder_t* opus_decoder(void);
struct audio_decoder_t* g711a_decoder(void);
struct audio_decoder_t* g711u_decoder(void);
#ifdef __cplusplus
}
#endif
#endif /* !_audio_decoder_h_ */

View File

@@ -0,0 +1,54 @@
#ifndef _audio_encoder_h_
#define _audio_encoder_h_
#include "avframe.h"
#include "avpacket.h"
#ifdef __cplusplus
extern "C" {
#endif
enum {
AUDIO_BITRATE_CBR = 0,
AUDIO_BITRATE_VBR,
};
struct audio_parameter_t
{
int format; // enum pcm_sample_format
int channels; // 1, 2
int samplerate; // 8000, 16000, 24000, 32000, 44100, 48000
int profile;
int level;
int bitrate;
int bitrate_mode; // CBR/VBR
int min_bitrate_kbps; // vbr only
int max_bitrate_kbps; // vbr only
};
struct audio_encoder_t
{
void* (*create)(const struct audio_parameter_t* param);
void (*destroy)(void* audio);
/// pic->flags & AVPACKET_FLAG_KEY => force IDR
/// @return >0-got a packet, 0-need more data, <0-error
int (*encode)(void* audio, const struct avframe_t* frame);
/// @return >0-got a packet, 0-no packet, <0-error
int (*getpacket)(void* audio, struct avpacket_t* pkt);
};
struct audio_encoder_t* faac_encoder(void);
struct audio_encoder_t* opus_encoder(void);
struct audio_encoder_t* mp2lame_encoder(void);
struct audio_encoder_t* g711a_encoder(void);
struct audio_encoder_t* g711u_encoder(void);
#ifdef __cplusplus
}
#endif
#endif /* !_audio_encoder_h_ */

View File

@@ -0,0 +1,19 @@
#ifndef _audio_mixer_h_
#define _audio_mixer_h_
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
void audio_mixer_s16(int16_t* dst, const int16_t* src, float mul, int len);
void audio_mixer_float(float* dst, const float* src, float mul, int len);
void audio_mixer_double(double* dst, const double* src, double mul, int len);
#ifdef __cplusplus
}
#endif
#endif /* !_audio_mixer_h_ */

View File

@@ -0,0 +1,38 @@
#ifndef _audio_resampler_h_
#define _audio_resampler_h_
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef void* audio_resampler_t;
enum audio_resampler_format_t
{
// interleaved samples: [ L|R L|R L|R ...]
AUDIO_RESAMPLE_AUDIO_INTERLEAVED_FLOAT32 = 0,
AUDIO_RESAMPLE_AUDIO_INTERLEAVED_FLOAT64,
AUDIO_RESAMPLE_AUDIO_INTERLEAVED_INT32,
AUDIO_RESAMPLE_AUDIO_INTERLEAVED_INT16,
// split/planar samples: [ LLL... | RRR... ]
AUDIO_RESAMPLE_AUDIO_PLANAR_FLOAT32 = 4,
AUDIO_RESAMPLE_AUDIO_PLANAR_FLOAT64,
AUDIO_RESAMPLE_AUDIO_PLANAR_INT32,
AUDIO_RESAMPLE_AUDIO_PLANAR_INT16,
};
audio_resampler_t audio_resampler_create(int channels, int input_rate, enum audio_resampler_format_t input_format, int output_rate, enum audio_resampler_format_t output_format);
int audio_resampler_destroy(audio_resampler_t resampler);
/// @param[in] samples input data length(samples per channel)
/// @param[in] len output samples length(samples per channel)
/// @return >0-output samples length, <0-error, =0-reserved
int audio_resampler_process(audio_resampler_t resampler, const void* data, int samples, void* out, int len);
#ifdef __cplusplus
}
#endif
#endif /* !_audio_resampler_h_ */

View File

@@ -0,0 +1,30 @@
#ifndef _avbuffer_h_
#define _avbuffer_h_
#include <stdint.h>
struct avbuffer_t
{
volatile int32_t refcount;
uint8_t *data;
int size; // capacity
void (*free)(void *opaque, void* data);
void *opaque;
};
#ifdef __cplusplus
extern "C" {
#endif
///@param[in] size alloc packet data size, don't include sizeof(struct avpacket_t)
///@return alloc new avpacket_t, use avpacket_release to free memory
struct avbuffer_t* avbuffer_alloc(int size);
int32_t avbuffer_addref(struct avbuffer_t* buf);
int32_t avbuffer_release(struct avbuffer_t* buf);
#ifdef __cplusplus
}
#endif
#endif /* !_avbuffer_h_ */

View File

@@ -0,0 +1,48 @@
#ifndef _avcodecid_h_
#define _avcodecid_h_
typedef enum AVPACKET_CODEC_ID
{
AVCODEC_NONE = 0x00,
AVCODEC_VIDEO_MPEG1,
AVCODEC_VIDEO_MPEG2,
AVCODEC_VIDEO_MPEG4,
AVCODEC_VIDEO_H264,
AVCODEC_VIDEO_H265,
AVCODEC_VIDEO_H266,
AVCODEC_VIDEO_VP8,
AVCODEC_VIDEO_VP9,
AVCODEC_VIDEO_AV1,
AVCODEC_VIDEO_AVS,
AVCODEC_VIDEO_SVAC,
AVCODEC_IMAGE_PNG = 0x100,
AVCODEC_IMAGE_GIF,
AVCODEC_IMAGE_BMP,
AVCODEC_IMAGE_JPEG,
AVCODEC_AUDIO_PCM = 0x10000,
AVCODEC_AUDIO_G711A, // G711 alaw
AVCODEC_AUDIO_G711U, // G711 ulaw
AVCODEC_AUDIO_G719,
AVCODEC_AUDIO_G726,
AVCODEC_AUDIO_G729,
AVCODEC_AUDIO_MP3,
AVCODEC_AUDIO_AAC,
AVCODEC_AUDIO_AC3,
AVCODEC_AUDIO_OPUS,
AVCODEC_AUDIO_MP2, // MPEG-2 Layer II
AVCODEC_AUDIO_SPEEX,
AVCODEC_AUDIO_SVAC,
AVCODEC_TEXT_WEBVTT = 0x20000,
AVCODEC_TEXT_SRT,
AVCODEC_TEXT_CC,
AVCODEC_DATA_RAW = 0x30000,
AVCODEC_DATA_MP2P, // MPEG-2 PS
AVCODEC_DATA_MP2T, // MPEG-2 TS
} AVPACKET_CODEC_ID;
#endif /* !_avcodecid_h_ */

View File

@@ -0,0 +1,37 @@
#ifndef _avdtsinfer_h_
#define _avdtsinfer_h_
#include <inttypes.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
struct avdtsinfer_t
{
int64_t count;
int64_t last_dts; // last I/P frame dts
int64_t consecutive_prev_max_pts;
int64_t max_pts; // maximum frame pts
int bframes; // consecutive b-frames
int max_bframes; // max consecutive b-frames
int fps1000; // 1/fps * 1000
int residual;
};
void avdtsinfer_reset(struct avdtsinfer_t* infer);
/// infer current frame dts from next frame pts
/// @param[in] idr current frame type, 1-h.264/h.265 idr frame, other-B/P frame
/// @param[in] pts current frame pts
/// @param[in] next_pts next frame pts
/// @return current frame dts
int64_t avdtsinfer_update(struct avdtsinfer_t* infer, int idr, int64_t pts, int64_t next_pts);
#ifdef __cplusplus
}
#endif
#endif /* !_avdtsinfer_h_ */

View File

@@ -0,0 +1,110 @@
#ifndef _avframe_h_
#define _avframe_h_
#include <stdint.h>
enum picture_format
{
PICTURE_NONE = -1,
PICTURE_YUV420 = 0, ///< AV_PIX_FMT_YUV420P: planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
PICTURE_YUV422 = 4, ///< AV_PIX_FMT_YUV422P: planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
PICTURE_YUV444 = 5, ///< AV_PIX_FMT_YUV444P: planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
PICTURE_NV12 = 25, ///< AV_PIX_FMT_NV12: planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
PICTURE_NV21 = 26, ///< AV_PIX_FMT_NV21: as above, but U and V bytes are swapped
// https://en.wikipedia.org/wiki/RGBA_color_space
PICTURE_RGBA = 28, ///< AV_PIX_FMT_RGBA(byte-oreder): packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
PICTURE_RGB24 = 2, ///< AV_PIX_FMT_RGB24: packed RGB 8:8:8, 24bpp, RGBRGB...
PICTURE_RGB16 = 43, ///< AV_PIX_FMT_RGB565BE: packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
//PICTURE_BGRA = 30, ///< AV_PIX_FMT_BGRA(byte-oreder): packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
//PICTURE_BGR24 = 3, ///< AV_PIX_FMT_BGR24: packed RGB 8:8:8, 24bpp, BGRBGR...
//PICTURE_BRG16 = 47, ///< AV_PIX_FMT_BGR565BE: packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
};
#define PICTURE_RGB32 PICTURE_RGBA
#define PICTURE_RGB565 PICTURE_RGB16
enum picture_type
{
PICTURE_TYPE_NONE = 0, ///< Undefined
PICTURE_TYPE_I, ///< Intra
PICTURE_TYPE_P, ///< Predicted
PICTURE_TYPE_B, ///< Bi-dir predicted
PICTURE_TYPE_S, ///< S(GMC)-VOP MPEG-4
PICTURE_TYPE_SI, ///< Switching Intra
PICTURE_TYPE_SP, ///< Switching Predicted
PICTURE_TYPE_BI, ///< BI type
};
enum pcm_sample_format
{
PCM_SAMPLE_FMT_NONE = -1,
PCM_SAMPLE_FMT_U8 = 0x0008, ///< unsigned 8 bits
PCM_SAMPLE_FMT_S16 = 0x0010, ///< signed 16 bits
PCM_SAMPLE_FMT_S32 = 0x0020, ///< signed 32 bits
PCM_SAMPLE_FMT_FLOAT = 0x0820, ///< float
PCM_SAMPLE_FMT_DOUBLE = 0x0840, ///< double
PCM_SAMPLE_FMT_U8P = 0x8008, ///< unsigned 8 bits, planar
PCM_SAMPLE_FMT_S16P = 0x8010, ///< signed 16 bits, planar
PCM_SAMPLE_FMT_S32P = 0x8020, ///< signed 32 bits, planar
PCM_SAMPLE_FMT_FLTP = 0x8820, ///< float, planar
PCM_SAMPLE_FMT_DBLP = 0x8840, ///< double, planar
PCM_SAMPLE_FMT_S64 = 0x0040, ///< signed 64 bits
PCM_SAMPLE_FMT_S64P = 0x8040, ///< signed 64 bits, planar
};
#define PCM_SAMPLE_BITS(format) ((format) & 0xFF) /// get pcm sample bits
#define PCM_SAMPLE_FLOAT(format) ((format) & 0x0800) /// pcm sample is float
#define PCM_SAMPLE_PLANAR(format) ((format) & 0x8000) /// pcm sample is planar
struct avframe_t
{
int format; ///< picture_format/pcm_sample_format
int64_t pts;
int64_t dts;
/// video only
int flags; ///< PICTURE_TYPE_XXX
int width; ///< video width
int height; ///< video height
int crop_top; ///< The number of pixels to discard from the the top/bottom/left/right border of the frame
int crop_bottom;
int crop_left;
int crop_right;
/// audio only
int channels; ///< number of audio channels
int sample_bits; ///< bits per sample
int sample_rate; ///< samples per second(frequency)
int samples; ///< number of audio samples (per channel)
uint8_t* data[8]; // AAC 8-channels
/// For video, size in bytes of each picture line
/// For audio, size in bytes of each plane
int linesize[8];
void* opaque; // internal use only
};
#ifdef __cplusplus
extern "C" {
#endif
///@param[in] size alloc frame data size, don't include sizeof(struct avframe_t), data[0] pointer to memory
///@return alloc new avframe_t, use avframe_release to free memory
struct avframe_t* avframe_alloc(int size);
int32_t avframe_addref(struct avframe_t* frame);
int32_t avframe_release(struct avframe_t* frame);
#ifdef __cplusplus
}
#endif
#endif /* !_avframe_h_ */

View File

@@ -0,0 +1,38 @@
#ifndef _avpacket_h_
#define _avpacket_h_
#include <stdint.h>
#include "avstream.h"
#ifdef __cplusplus
extern "C" {
#endif
#define AVPACKET_FLAG_KEY 0x0001
#define AVPACKET_FLAG_LOST 0x0100 // some packets lost before the packet
#define AVPACKET_FLAG_CORRUPT 0x0200 // the packet data is corrupt
struct avpacket_t
{
uint8_t* data;
int size;
int64_t pts;
int64_t dts;
struct avstream_t* stream;
int flags; // AVPACKET_FLAG_XXX
void* opaque; // internal use only
};
///@param[in] size alloc packet data size, don't include sizeof(struct avpacket_t)
///@return alloc new avpacket_t, use avpacket_release to free memory
struct avpacket_t* avpacket_alloc(int size);
int32_t avpacket_addref(struct avpacket_t* pkt);
int32_t avpacket_release(struct avpacket_t* pkt);
#ifdef __cplusplus
}
#endif
#endif /* !_avpacket_h_ */

View File

@@ -0,0 +1,19 @@
#ifndef _avscale_h_
#define _avscale_h_
#include "avframe.h"
#ifdef __cplusplus
extern "C" {
#endif
/// scale picture
/// @param src input picture
/// @param dst output picture, dst->format/dst->width/dst->height/dst->linesize MUST set by user
/// @return 0-ok, other-error
int avscale(struct avframe_t* dst, const struct avframe_t* src);
#ifdef __cplusplus
}
#endif
#endif /* !_avscale_h_ */

View File

@@ -0,0 +1,45 @@
#ifndef _av_segment_h_
#define _av_segment_h_
#include <stdint.h>
#include "avpacket.h"
#ifdef __cplusplus
extern "C" {
#endif
struct avsegment_t
{
struct
{
int64_t size; // bytes limit (A+V)
int64_t packets; // packets limit (A+V)
int64_t duration; // duration limit (ms)
} limit;
// current
int64_t size; // bytes
int64_t packets; // packets
int64_t timeline; // first packet timestamp(dts/pts)
struct avstream_t* streams[8]; // stream version
int keyframe; // keyframe counter
int video; // has video
int audio; // has audio
};
/// @param[in] timeline first packet timestamp
void avsegment_reset(struct avsegment_t* seg, int64_t timeline);
/// @param[in] timeline timestamp return by timeline input32/input64
/// @return >0-should create new segment, 0-don't need, <0-error
int avsegment_check(struct avsegment_t* seg, const struct avpacket_t* pkt, int64_t timeline, int discontinuity);
/// @param[in] timeline timestamp return by timeline input32/input64
/// @return 0-ok, other-error
int avsegment_input(struct avsegment_t* seg, const struct avpacket_t* pkt, int64_t timeline);
#ifdef __cplusplus
}
#endif
#endif /* !_av_segment_h_ */

View File

@@ -0,0 +1,84 @@
#ifndef _avstatistic_h_
#define _avstatistic_h_
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
struct avjitter_t {
int duration;
int count;
int max;
int min;
};
struct avbitrate_t
{
uint32_t i; // internal use only
uint32_t interval; // bucket interval(ms)
uint32_t packets[6]; // N + 1
uint64_t buckets[6]; // N + 1
int64_t clock; // last clock
uint64_t total; // total bytes
};
struct avstatistic_t
{
int64_t clock; // start time(UTC+0 ms)
struct
{
int64_t pts; // last packet pts
int64_t dts; // last packet dts
uint64_t packets;
struct avjitter_t jitter;
struct avbitrate_t bitrate;
int64_t first_pts;
int64_t first_dts;
int64_t first_recv; // first data byte
int64_t first_packet; // first audio/video/data chunk/packet
} streams[8];
//#define s_audio streams[0]
//#define s_video streams[1]
};
void avstatistic_init(struct avstatistic_t* stats, int64_t clock, int interval);
/// update stream stats, include bitrate/jitter
/// @return 0-ok, other-error
int avstatistic_input(struct avstatistic_t* stats, int64_t clock, int stream, int64_t pts, int64_t dts, uint64_t bytes);
/// @return stream frame rate(in (N-1) * interval)
double avstatistic_getfps(const struct avstatistic_t* stats, int stream);
/// @return total bitrate
uint64_t avstatistic_getbitrate(const struct avstatistic_t* stats);
/// avjitter_clear clear all data
void avjitter_clear(struct avjitter_t* jitter);
/// avjitter_input update jitter min/max
void avjitter_input(struct avjitter_t* jitter, int value);
/// avjitter_format output format jitter string
int avjitter_format(const struct avjitter_t* jitter, char* buf, int len);
/// avbitrate_clear clear all data
void avbitrate_clear(struct avbitrate_t* rate);
/// avbitrate_input [10 | 10 | 10 | 10 | 10 | 10] bytes bucket
void avbitrate_input(struct avbitrate_t* rate, int64_t clock, uint64_t bytes);
/// avbitrate_get bytes per second
uint64_t avbitrate_get(const struct avbitrate_t* rate);
#ifdef __cplusplus
}
#endif
#endif /* !_avstatistic_h_ */

View File

@@ -0,0 +1,59 @@
#ifndef _avstream_h_
#define _avstream_h_
#include <stdint.h>
#include "avcodecid.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum AVSTREAM_TYPE {
AVSTREAM_UNKNOWN,
AVSTREAM_AUDIO,
AVSTREAM_VIDEO,
AVSTREAM_SUBTITLE,
AVSTREAM_DATA,
} AVSTREAM_TYPE;
struct avtimebase_t
{
int num; // numerator
int den; // denominator
};
struct avstream_t
{
int stream; // stream index
enum AVPACKET_CODEC_ID codecid;
struct avtimebase_t timebase;
// video only
int width;
int height;
double fps; // optional
// audio only
int channels; ///< number of audio channels
int sample_bits; ///< bits per sample
int sample_rate; ///< samples per second(frequency)
// stream extra data(codec data)
void* extra;
int bytes;
void* opaque; // internal use only
};
///@param[in] size alloc packet data size, don't include sizeof(struct avpacket_t)
///@return alloc new avpacket_t, use avpacket_release to free memory
struct avstream_t* avstream_alloc(int size);
int32_t avstream_addref(struct avstream_t* stream);
int32_t avstream_release(struct avstream_t* stream);
AVSTREAM_TYPE avstream_type(const struct avstream_t* stream);
#ifdef __cplusplus
}
#endif
#endif /* !_avstream_h_ */

View File

@@ -0,0 +1,41 @@
#ifndef _avtimeline_h_
#define _avtimeline_h_
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
struct avtimeline_t
{
uint32_t gap;
int64_t t0; // init timestamp
int64_t max;
struct
{
int init;
int repeat; // same dts repeat times
int64_t t; // last mapped dts timestamp
int64_t dts; // last dts
int64_t tmax; // mapped max pts timestamp
} streams[8];
};
void avtimeline_init(struct avtimeline_t* t, uint32_t gap, int64_t t0);
void avtimeline_reset(struct avtimeline_t* t);
/// @return mapped pts
int64_t avtimeline_input32(struct avtimeline_t* t, int stream, uint32_t dts, uint32_t pts, int* discontinuity);
/// @return mapped pts
int64_t avtimeline_input64(struct avtimeline_t* t, int stream, int64_t dts, int64_t pts, int* discontinuity);
#ifdef __cplusplus
}
#endif
#endif /* !_avtimeline_h_ */

View File

@@ -0,0 +1,53 @@
#ifndef _bitmap_h_
#define _bitmap_h_
#if defined(OS_WINDOWS)
#include <Windows.h>
#else
#include <stdint.h>
#pragma pack(push)
#pragma pack(2)
typedef struct tagBITMAPFILEHEADER {
uint16_t bfType;
uint32_t bfSize;
uint16_t bfReserved1;
uint16_t bfReserved2;
uint32_t bfOffBits;
} BITMAPFILEHEADER;
typedef struct tagBITMAPINFOHEADER {
uint32_t biSize;
int32_t biWidth;
int32_t biHeight;
uint16_t biPlanes;
uint16_t biBitCount;
uint32_t biCompression;
uint32_t biSizeImage;
int32_t biXPelsPerMeter;
int32_t biYPelsPerMeter;
uint32_t biClrUsed;
uint32_t biClrImportant;
} BITMAPINFOHEADER;
#pragma pack(pop)
#endif
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/// @param[out] bi bi->biSize MUST be set
/// @return >0-rgb size, =0-error
size_t bitmap_load(const char* file, BITMAPINFOHEADER* bi, void* data, size_t bytes);
/// @return 0-ok, other-error
int bitmap_save(const char* file, const BITMAPINFOHEADER* bi, const void* data);
#ifdef __cplusplus
}
#endif
#endif /* !_bitmap_h_ */

View File

@@ -0,0 +1,38 @@
#ifndef _colorspace_h_
#define _colorspace_h_
#ifdef __cplusplus
extern "C"
{
#endif
// Convert Between YUV and RGB
void rgb2yuv(unsigned char r, unsigned char g, unsigned char b, unsigned char* y, unsigned char* u, unsigned char* v);
void yuv2rgb(unsigned char y, unsigned char u, unsigned char v, unsigned char* r, unsigned char* g, unsigned char* b);
//void rgb24_yuv444(const unsigned char* rgb, int w, int h, int stride, unsigned char* y, unsigned char* u, unsigned char* v);
//void yuv444_rgb24(const unsigned char* y, const unsigned char* u, const unsigned char* v, int stride_y, int stride_uv, int w, int h, unsigned char* rgb);
// Convert Between YV12(Planar, top-down) and RGB(byte order 'R'/'G'/'B'/'A')
void rgb24_yv12(const unsigned char* rgb, int w, int h, int stride, unsigned char* y, unsigned char* u, unsigned char* v);
void rgb32_yv12(const unsigned char* rgb, int w, int h, int stride, unsigned char* y, unsigned char* u, unsigned char* v);
void yv12_rgb24(const unsigned char* y, const unsigned char* u, const unsigned char* v, int stride_y, int stride_uv, int w, int h, unsigned char* rgb);
void yv12_rgb32(const unsigned char* y, const unsigned char* u, const unsigned char* v, int stride_y, int stride_uv, int w, int h, unsigned char* rgb);
void nv12_rgb24(const unsigned char* y, const unsigned char* v, int stride_y, int stride_uv, int w, int h, unsigned char* rgb);
// contrast [0.0, 10.0] default: 1.0f - 0.01f[increment]
// brightness [-100.0, 100.0] default: 0.0f - 0.1f
// hue [-180.0, 180.0] default: 0.0f - 0.1f
// saturation [0.0, 10.0] default: 1.0f - 0.01f
void yuv_adjust(unsigned char* y, unsigned char* u, unsigned char* v, double contrast, double hue, double saturation, double brightness);
void yv12_adjust(unsigned char* y, unsigned char* u, unsigned char* v, int stride_y, int stride_uv, int w, int h, double contrast, double hue, double saturation, double brightness);
void nv12_adjust(unsigned char* y, unsigned char* v, int stride_y, int stride_uv, int w, int h, double contrast, double hue, double saturation, double brightness);
#ifdef __cplusplus
}
#endif
#endif /* !_colorspace_h_ */

View File

@@ -0,0 +1,32 @@
#ifndef _h264_encoder_h_
#define _h264_encoder_h_
#include "avframe.h"
#include "avpacket.h"
#include "h264-parameter.h"
#ifdef __cplusplus
extern "C" {
#endif
struct h264_encoder_t
{
void* (*create)(const struct h264_parameter_t* param);
void (*destroy)(void* h264);
/// pic->flags & AVPACKET_FLAG_KEY => force IDR
/// @return >0-ok, other-error
int (*input)(void* h264, const struct avframe_t* pic);
/// @return >=0-got packet, <0-error
int (*getpacket)(void* h264, struct avpacket_t* pkt);
};
struct h264_encoder_t* x264_encoder(void);
struct h264_encoder_t* x262_encoder(void); // MPEG-2 Video
struct h264_encoder_t* openh264_encoder(void);
#ifdef __cplusplus
}
#endif
#endif /* !_h264_encoder_h_ */

View File

@@ -0,0 +1,64 @@
#ifndef _h264_parameter_h_
#define _h264_parameter_h_
// https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC
enum h264_profile
{
H264_PROFILE_UNKNOWN = 0,
H264_PROFILE_BASELINE = 66,
H264_PROFILE_MAIN = 77,
H264_PROFILE_EXTENDED = 88,
H264_PROFILE_HIGH = 100,
H264_PROFILE_HIGH10 = 110,
H264_PROFILE_HIGH422 = 122,
H264_PROFILE_HIGH444 = 244,
H264_PROFILE_CAVLC = 44,
H264_PROFILE_SCALABLE_BASELINE = 83,
H264_PROFILE_SCALABLE_HIGH = 86,
H264_PROFILE_STEREO_HIGH = 128,
H264_PROFILE_MULTIVIEW_HIGH = 118,
H264_PROFILE_MULTIVIEW_DEPTH_HIGH = 138,
};
enum h264_level
{
H264_LEVEL_UNKNOWN = 0,
H264_LEVEL_1_0, // 128<32><38>96@30.9 (8) / 176<37><36>144@15.0 (4)
H264_LEVEL_1_B, // 128<32><38>96@30.9 (8) / 176<37><36>144@15.0 (4)
H264_LEVEL_1_1, // 176<37><36>144@30.3 (9) / 320<32><30>240@10.0 (3) / 352<35><32>288@7.5 (2)
H264_LEVEL_1_2, // 320<32><30>240@20.0 (7) / 352<35><32>288@15.2 (6)
H264_LEVEL_1_3, // 320<32><30>240@36.0 (7) / 352<35><32>288@30.0 (6)
H264_LEVEL_2_0, // 320<32><30>240@36.0 (7) / 352<35><32>288@30.0 (6)
H264_LEVEL_2_1, // 352<35><32>480@30.0 (7) / 352<35><32>576@25.0 (6)
H264_LEVEL_2_2, // 352<35><32>480@30.7 (12) / 352<35><32>576@25.6 (10) / 720<32><30>480@15.0 (6) / 720<32><30>576@12.5 (5)
H264_LEVEL_3_0, // 352<35><32>480@61.4 (12) / 352<35><32>576@51.1 (10) / 720<32><30>480@30.0 (6) / 720<32><30>576@25.0 (5)
H264_LEVEL_3_1, // 720<32><30>480@80.0 (13) / 720<32><30>576@66.7 (11) / 1280<38><30>720@30.0 (5)
H264_LEVEL_3_2, // 1280<38><30>720@60.0 (5) / 1280<38><30>1024@42.2 (4)
H264_LEVEL_4_0, // 1280<38><30>720@68.3 (9) / 1920<32><30>1080@30.1 (4) / 2048<34><38>1024@30.0 (4)
H264_LEVEL_4_1, // 1280<38><30>720@68.3 (9) / 1920<32><30>1080@30.1 (4) / 2048<34><38>1024@30.0 (4)
H264_LEVEL_4_2, // 1280<38><30>720@145.1 (9) / 1920<32><30>1080@64.0 (4) / 2048<34><38>1080@60.0 (4)
H264_LEVEL_5_0, // 1920<32><30>1080@72.3 (13) / 2048<34><38>1024@72.0 (13) / 2048<34><38>1080@67.8 (12) / 2560<36><30>1920@30.7 (5) / 3672<37><32>1536@26.7 (5)
H264_LEVEL_5_1, // 1920<32><30>1080@120.5 (16) / 2560<36><30>1920@51.2 (9) / 3840<34><30>2160@31.7 (5) / 4096<39><36>2048@30.0 (5) / 4096<39><36>2160@28.5 (5) / 4096<39><36>2304@26.7 (5)
H264_LEVEL_5_2, // 1920<32><30>1080@172.0 (16) / 2560<36><30>1920@108.0 (9) / 3840<34><30>2160@66.8 (5) / 4096<39><36>2048@63.3 (5) / 4096<39><36>2160@60.0 (5) / 4096<39><36>2304@56.3 (5)
};
struct h264_parameter_t
{
int profile; // H264_PROFILE_XXX
int level; // H264_LEVEL_XXX
int width;
int height;
int format; // PICTURE_YUV420/PICTURE_YUV422/PICTURE_YUV444
int frame_rate; // 25000/1000.0 => 25.0fps
int gop_size; // frames per gop
int bitrate; // bits per second
int bitrate_mode; // CBR/VBR/ABR/CQP/CRF
int stream_mode; // 0-H.264 AnnexB, 1-H.264 MP4
};
#endif /* !_h264_parameter_h_ */

View File

@@ -0,0 +1,40 @@
#ifndef _text_render_h_
#define _text_render_h_
#include <stddef.h>
#include <wchar.h>
#ifdef __cplusplus
extern "C" {
#endif
struct text_parameter_t
{
const char* font;
int size; // font size
int color;
};
struct text_render_t
{
void* (*create)(const struct text_parameter_t* param);
void (*destroy)(void* render);
/// @param[in] txt unicode string
/// @param[out] w bitmap width
/// @param[out] h bitmap height
/// @param[out] pitch bitmap line bytes(>=w)
/// @return NULL-failed, other-bitmap data
const void* (*draw)(void* render, const wchar_t* txt, int *w, int *h, int* pitch);
int (*config)(void* render, const struct text_parameter_t* param);
};
struct text_render_t* text_render_gdi(void);
struct text_render_t* text_render_freetype(void);
#ifdef __cplusplus
}
#endif
#endif /* !_text_render_h_ */

View File

@@ -0,0 +1,29 @@
#ifndef _yuv_overlay_h_
#define _yuv_overlay_h_
#include "avframe.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _overlay_t
{
int x;
int y;
int w;
int h;
uint8_t alpha; // opaque: [0, 255] default to 0(src overwrite dst)
int mask;
int op;
int src_alpha; // 1-src has alpha channel
} overlay_t;
int yuv_overlay(struct avframe_t* dst, const struct avframe_t* src, const overlay_t* overlay);
#ifdef __cplusplus
}
#endif
#endif /* !_yuv_overlay_h_ */

View File

@@ -0,0 +1,22 @@
#include "audio-mixer.h"
void audio_mixer_s16(int16_t* dst, const int16_t* src, float mul, int len)
{
int i;
for (i = 0; i < len; i++)
dst[i] += (int16_t)((float)src[i] * mul);
}
void audio_mixer_float(float* dst, const float* src, float mul, int len)
{
int i;
for (i = 0; i < len; i++)
dst[i] += src[i] * mul;
}
void audio_mixer_double(double* dst, const double* src, double mul, int len)
{
int i;
for (i = 0; i < len; i++)
dst[i] += src[i] * mul;
}

View File

@@ -0,0 +1,42 @@
#include "audio-resampler.h"
#if defined(_AVCODEC_SOXR_)
#include "soxr.h"
#include <assert.h>
audio_resampler_t audio_resampler_create(int channels, int input_rate, enum audio_resampler_format_t input_format, int output_rate, enum audio_resampler_format_t output_format)
{
soxr_t soxr;
soxr_error_t err;
soxr_io_spec_t spec;
soxr_quality_spec_t quality;
soxr_runtime_spec_t runtime;
spec = soxr_io_spec(input_format, output_format);
quality = soxr_quality_spec(SOXR_HQ, 0);
runtime = soxr_runtime_spec(1);
soxr = soxr_create(input_rate, output_rate, channels, &err, &spec, &quality, &runtime);
return 0 == err ? soxr : NULL;
}
int audio_resampler_destroy(audio_resampler_t resampler)
{
if (resampler)
soxr_delete(resampler);
return 0;
}
int audio_resampler_process(audio_resampler_t resampler, const void* data, int samples, void* out, int len)
{
size_t n[2];
soxr_error_t err;
err = soxr_process(resampler, data, samples, &n[0], out, len, &n[1]);
if (err)
return -1;
assert(samples == n[0]);
return (int)n[1];
}
#endif /* _AVCODEC_SOXR_ */

View File

@@ -0,0 +1,43 @@
#include "avbuffer.h"
#include "sys/atomic.h"
#include <stdlib.h>
#include <assert.h>
struct avbuffer_t* avbuffer_alloc(int size)
{
struct avbuffer_t* buf;
buf = malloc(sizeof(*buf) + size);
if (buf)
{
buf->data = (uint8_t*)(buf + 1);
buf->size = size;
buf->refcount = 1;
buf->free = NULL;
buf->opaque = NULL;
}
return buf;
}
int32_t avbuffer_addref(struct avbuffer_t* buf)
{
if (NULL == buf || NULL == buf->data)
return -1;
return atomic_increment32(&buf->refcount);
}
int32_t avbuffer_release(struct avbuffer_t* buf)
{
int32_t ref;
if (NULL == buf || NULL == buf->data)
return -1;
ref = atomic_decrement32(&buf->refcount);
assert(ref >= 0);
if (0 == ref)
{
if (buf->free)
buf->free(buf->opaque, buf->data);
free(buf);
}
return ref;
}

View File

@@ -0,0 +1,93 @@
#include "avdtsinfer.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdio.h>
void avdtsinfer_reset(struct avdtsinfer_t* infer)
{
memset(infer, 0, sizeof(*infer));
infer->fps1000 = 1000;
}
int64_t avdtsinfer_update(struct avdtsinfer_t* infer, int idr, int64_t pts, int64_t next_pts)
{
int64_t dts;
assert(pts >= 0 && next_pts >= 0); // can't be negative value
if (infer->count > 0 && pts < infer->max_pts)
{
// B Frames
infer->bframes++;
infer->max_bframes = infer->max_bframes > infer->bframes ? infer->max_bframes : infer->bframes;
}
else
{
// I/P frame
if (infer->bframes > 0 && infer->consecutive_prev_max_pts < infer->max_pts)
{
// calc fps between two consecutive I/P frames
infer->fps1000 = (int)((infer->max_pts - infer->consecutive_prev_max_pts) * 1000 / (infer->bframes + 1));
//printf("fps: (%lld - %lld) / %d = %.1f\n", infer->max_pts, infer->consecutive_prev_max_pts, infer->bframes + 1, infer->fps1000 / 1000.0);
}
infer->consecutive_prev_max_pts = infer->count > 0 ? infer->max_pts : pts;
infer->max_pts = pts;
infer->bframes = 0;
}
// update fps on IDR frame
if (1 == idr && pts > infer->consecutive_prev_max_pts && (infer->max_bframes + 1) * infer->fps1000 / 1000 < pts - infer->consecutive_prev_max_pts)
{
// key frame dts offset
infer->last_dts += pts - infer->consecutive_prev_max_pts - (infer->max_bframes + 1) * infer->fps1000 / 1000;
//infer->last_dts = (infer->last_dts < dts || 0 == infer->count) ? dts : (infer->last_dts + 1); // monotone increasing
}
else
{
if (0 == infer->max_bframes && next_pts >= pts)
{
infer->last_dts = pts; // non-B-frames: dts = pts
}
else
{
dts = infer->last_dts + infer->fps1000 / 1000;
infer->residual += infer->fps1000 % 1000;
if (infer->residual >= 1000)
{
dts += infer->residual / 1000;
infer->residual %= 1000;
}
// keep dts <= pts (for ffmpeg)
infer->last_dts = dts > pts ? (infer->last_dts + 1) : dts;
}
}
infer->count++;
return infer->last_dts;
}
#if defined(_DEBUG) || defined(DEBUG)
void avdtsinfer_test(void)
{
// pts from Elecard_about_Tomsk_part2_HEVC_720p.mp4
const int idr[] = { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, };
const int64_t pts[] = { 160, 426, 293, 226, 193, 260, 360, 326, 393, 693, 560, 493, 460, 526, 626, 593, 660, 960, 826, 760, 726, 793, 893, 860, 926, 1286, 1126, 1046, 1006, 1086, 1206, 1166, 1246, 1606, 1446, 1366, 1326, 1406, 1526, 1486, 1566, 1926, 1766, 1686, 1646, 1726, 1806, 1846, 1886, 2246, 2086, 2006, 1966, 2046, 2166, 2126, 2206, 2566, 2406, 2326 };
const int64_t dts[] = { 0, 33, 66, 100, 133, 166, 200, 233, 266, 300, 333, 366, 400, 433, 466, 500, 533, 566, 613, 646, 679, 714, 746, 779, 813, 846, 886, 926, 966, 1006, 1046, 1086, 1126, 1166, 1206, 1246, 1286, 1326, 1366, 1406 };
int i;
int64_t v, v0;
struct avdtsinfer_t infer;
avdtsinfer_reset(&infer);
//infer.fps1000 = 33333; // 33.3
v0 = 0;
for (i = 0; i < sizeof(pts) / sizeof(pts[0]) - 1; i++)
{
v = avdtsinfer_update(&infer, idr[i], pts[i], pts[i+1]);
printf("pts -> dts: %"PRId64" -> %"PRId64"(%"PRId64") %s %s\n", pts[i], v, v-v0, idr[i] ? "[IDR]" : "", v > pts[i] ? "[-]" : "");
v0 = v;
}
}
#endif

View File

@@ -0,0 +1,40 @@
#include "avframe.h"
#include "avbuffer.h"
#include <string.h>
#include <assert.h>
struct avframe_t* avframe_alloc(int size)
{
struct avbuffer_t* buf;
struct avframe_t* frame;
buf = avbuffer_alloc(size + sizeof(struct avframe_t));
if (buf)
{
frame = (struct avframe_t*)buf->data;
memset(frame, 0, sizeof(struct avframe_t));
frame->data[0] = (uint8_t*)(frame + 1);
frame->opaque = buf;
return frame;
}
return NULL;
}
int32_t avframe_addref(struct avframe_t* frame)
{
struct avbuffer_t* buf;
if (NULL == frame || NULL == frame->opaque)
return -1;
buf = (struct avbuffer_t*)frame->opaque;
return avbuffer_addref(buf);
}
int32_t avframe_release(struct avframe_t* frame)
{
struct avbuffer_t* buf;
if (NULL == frame || NULL == frame->opaque)
return -1;
buf = (struct avbuffer_t*)frame->opaque;
return avbuffer_release(buf);
}

Some files were not shown because too many files have changed in this diff Show More