Skip to content

Commit

Permalink
update media codec framework:
Browse files Browse the repository at this point in the history
1. support video encoder;
2. add api document;
3. add demo for video encoder;

Signed-off-by: kevin.z.m <kevin@allwinnertech.com>
  • Loading branch information
kevin.z.m committed Jun 19, 2015
1 parent 191d57e commit 72f2b85
Show file tree
Hide file tree
Showing 29 changed files with 2,612 additions and 35 deletions.
1 change: 0 additions & 1 deletion sunxi-cedarx/LIBRARY/EXTERNAL
Submodule EXTERNAL deleted from 03f08d
2 changes: 1 addition & 1 deletion sunxi-cedarx/SOURCE/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

SUBDIRS = base common vdecoder omxil plugin
SUBDIRS = base common vdecoder vencoder omxil plugin

#LDFLAGS = -Wl,--no-undefined
22 changes: 22 additions & 0 deletions sunxi-cedarx/SOURCE/base/CdxUtils.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include <CdxTypes.h>

#include <sys/time.h>
#include <execinfo.h>
#include <CdxLog.h>

//#include <CdxUtils.h>

Expand All @@ -29,3 +31,23 @@ cdx_int64 CdxGetNowUs(cdx_void)
return (cdx_int64)tv.tv_usec + tv.tv_sec * 1000000ll;
}

void CdxBTDump(void)
{
/*
int ret, i;
void *buffer[128] = {NULL};
char **bt;
ret = backtrace(buffer, 128);
bt = backtrace_symbols(buffer, ret);
CDX_LOGW("-----------------BT START. (%d) (%p)---------------", ret, bt);
for (i = 0; i < ret; i++)
{
CDX_LOGW("<DEBUG>: %s", bt[i]);
}
CDX_LOGW("-----------------BT END.---------------");
*/
return ;
}

28 changes: 2 additions & 26 deletions sunxi-cedarx/SOURCE/base/include/CdxConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
#ifndef CONFIG_H
#define CONFIG_H
#ifndef CDX_CONFIG_H
#define CDX_CONFIG_H

// option of conpile tool chain for linux makefile.
// arm-linux-gnueabihf- or arm-none-linux-gnueabi- tool chain
Expand All @@ -27,11 +27,6 @@
#define OPTION_OS_ANDROID 1
#define OPTION_OS_LINUX 2

// option for os version config.
#define OPTION_OS_VERSION_ANDROID_4_2 1
#define OPTION_OS_VERSION_ANDROID_4_4 2
#define OPTION_OS_VERSION_ANDROID_5_0 3

// option for momory driver config.
#define OPTION_MEMORY_DRIVER_SUNXIMEM 1
#define OPTION_MEMORY_DRIVER_ION 2
Expand All @@ -45,10 +40,6 @@
#define OPTION_PRODUCT_IPTV 4
#define OPTION_PRODUCT_DVB 5

// option for chip config.
#define OPTION_CHIP_1651 1


// option for dram interface.
#define OPTION_DRAM_INTERFACE_DDR1_16BITS 1
#define OPTION_DRAM_INTERFACE_DDR1_32BITS 2
Expand All @@ -69,7 +60,6 @@
#define CONFIG_CC OPTION_CC_GNUEABIHF
#define CONFIG_OS OPTION_OS_LINUX
#define CONFIG_MEMORY_DRIVER OPTION_MEMORY_DRIVER_VE
#define CONFIG_CHIP OPTION_CHIP_1651
#define CONFIG_DRAM_INTERFACE OPTION_DRAM_INTERFACE_DDR3_32BITS

#ifdef CONFIG_LOG_LEVEL
Expand All @@ -78,19 +68,5 @@
#define CONFIG_LOG_LEVEL OPTION_LOG_LEVEL_WARNING
//#endif

#define CONFIG_ENABLE_DEMUX_ASF 1
#define CONFIG_ENABLE_DEMUX_AVI 1
#define CONFIG_ENABLE_DEMUX_BLUERAYDISK 1
#define CONFIG_ENABLE_DEMUX_MPEGDASH 1
#define CONFIG_ENABLE_DEMUX_FLV 1
#define CONFIG_ENABLE_DEMUX_HLS 1
#define CONFIG_ENABLE_DEMUX_MKV 1
#define CONFIG_ENABLE_DEMUX_MMS 1
#define CONFIG_ENABLE_DEMUX_MOV 1
#define CONFIG_ENABLE_DEMUX_MPG 1
#define CONFIG_ENABLE_DEMUX_PMP 1
#define CONFIG_ENABLE_DEMUX_OGG 1
#define CONFIG_ENABLE_DEMUX_RX 1
#define CONFIG_ENABLE_DEMUX_TS 1

#endif
6 changes: 5 additions & 1 deletion sunxi-cedarx/SOURCE/base/include/CdxUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@
extern "C"
{
#endif
#include <CdxTypes.h>

cdx_int64 CdxGetNowUs(cdx_void);
cdx_int64 CdxGetNowUs();

void CdxBTDump(void);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 7 additions & 1 deletion sunxi-cedarx/SOURCE/base/include/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define LOG_H

#include "CdxConfig.h"
#include <CdxUtils.h>

#ifndef LOG_TAG
#define LOG_TAG "awplayer"
Expand Down Expand Up @@ -52,7 +53,12 @@
#error "invalid configuration of os."
#endif

#define loge(fmt, arg...) AWLOG(LOG_LEVEL_ERROR, "\033[40;31m"fmt"\033[0m", ##arg)
#define loge(fmt, arg...) \
do { \
AWLOG(LOG_LEVEL_ERROR, "\033[40;31m"fmt"\033[0m", ##arg) ; \
CdxBTDump(); \
} while (0)

#define logw(fmt, arg...) AWLOG(LOG_LEVEL_WARNING, fmt, ##arg)
#define logi(fmt, arg...)
#define logd(fmt, arg...) AWLOG(LOG_LEVEL_WARNING, fmt, ##arg)
Expand Down
2 changes: 2 additions & 0 deletions sunxi-cedarx/SOURCE/common/Makefile.am
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ LOCAL_INCLUDE = -I./include \
-I$(top_srcdir)/base/include
libcedar_common_la_CFLAGS += $(LOCAL_INCLUDE)

libcedar_common_la_LIBADD = $(top_srcdir)/base/libcedar_base.la

libcedar_common_la_LDFLAGS = $(CEDAR_LDFLAGS)


8 changes: 5 additions & 3 deletions sunxi-cedarx/SOURCE/common/ve.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ int VeInitialize(void)
#if (CONFIG_MEMORY_DRIVER == OPTION_MEMORY_DRIVER_VE)
firstMemchunk.physAddr = gVeEnvironmentInfo.phymem_start - PAGE_OFFSET;
firstMemchunk.size = gVeEnvironmentInfo.phymem_total_size;
logd("xxxxxxx firstMemchunk.size(%d)", firstMemchunk.size);
logd("xxxxxxx firstMemchunk.size(%d) '0x%x'", firstMemchunk.size, firstMemchunk.physAddr);
#endif
}

Expand Down Expand Up @@ -291,6 +291,7 @@ void VeEnableEncoder()
volatile vetop_reg_mode_sel_t* pVeModeSelect;
pthread_mutex_lock(&gVeRegisterMutex);
pVeModeSelect = (vetop_reg_mode_sel_t*)(gVeEnvironmentInfo.address_macc + VE_MODE_SELECT);
pVeModeSelect->mode = 11;
pVeModeSelect->enc_enable = 1;
pVeModeSelect->enc_isp_enable = 1;
pthread_mutex_unlock(&gVeRegisterMutex);
Expand All @@ -301,6 +302,7 @@ void VeDisableEncoder()
volatile vetop_reg_mode_sel_t* pVeModeSelect;
pthread_mutex_lock(&gVeRegisterMutex);
pVeModeSelect = (vetop_reg_mode_sel_t*)(gVeEnvironmentInfo.address_macc + VE_MODE_SELECT);
pVeModeSelect->mode = 0x7;
pVeModeSelect->enc_enable = 0;
pVeModeSelect->enc_isp_enable = 0;
pthread_mutex_unlock(&gVeRegisterMutex);
Expand Down Expand Up @@ -395,9 +397,9 @@ void *VeMalloc(int size)
pthread_mutex_lock(&gVeMemoryMutex);

void *addr = NULL;
size = (size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
size = (size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1); /* align to 4096 */
struct MemChunkS *c, *bestChunk = NULL;
for(c = &firstMemchunk; c != NULL; c = c->next)
for (c = &firstMemchunk; c != NULL; c = c->next)
{
if(c->virtAddr == NULL && c->size >= size)
{
Expand Down
4 changes: 3 additions & 1 deletion sunxi-cedarx/SOURCE/configure
Original file line number Diff line number Diff line change
Expand Up @@ -16073,7 +16073,7 @@ fi
done


ac_config_files="$ac_config_files Makefile base/Makefile common/Makefile omxil/Makefile vdecoder/Makefile plugin/Makefile plugin/vdecoder/Makefile plugin/vdecoder/h264/Makefile plugin/vdecoder/mjpeg/Makefile plugin/vdecoder/mpeg2/Makefile plugin/vdecoder/mpeg4/Makefile plugin/vdecoder/others/Makefile"
ac_config_files="$ac_config_files Makefile base/Makefile common/Makefile omxil/Makefile vdecoder/Makefile vencoder/Makefile plugin/Makefile plugin/vdecoder/Makefile plugin/vdecoder/h264/Makefile plugin/vdecoder/mjpeg/Makefile plugin/vdecoder/mpeg2/Makefile plugin/vdecoder/mpeg4/Makefile plugin/vdecoder/others/Makefile plugin/vencoder/Makefile"

cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
Expand Down Expand Up @@ -17187,13 +17187,15 @@ do
"common/Makefile") CONFIG_FILES="$CONFIG_FILES common/Makefile" ;;
"omxil/Makefile") CONFIG_FILES="$CONFIG_FILES omxil/Makefile" ;;
"vdecoder/Makefile") CONFIG_FILES="$CONFIG_FILES vdecoder/Makefile" ;;
"vencoder/Makefile") CONFIG_FILES="$CONFIG_FILES vencoder/Makefile" ;;
"plugin/Makefile") CONFIG_FILES="$CONFIG_FILES plugin/Makefile" ;;
"plugin/vdecoder/Makefile") CONFIG_FILES="$CONFIG_FILES plugin/vdecoder/Makefile" ;;
"plugin/vdecoder/h264/Makefile") CONFIG_FILES="$CONFIG_FILES plugin/vdecoder/h264/Makefile" ;;
"plugin/vdecoder/mjpeg/Makefile") CONFIG_FILES="$CONFIG_FILES plugin/vdecoder/mjpeg/Makefile" ;;
"plugin/vdecoder/mpeg2/Makefile") CONFIG_FILES="$CONFIG_FILES plugin/vdecoder/mpeg2/Makefile" ;;
"plugin/vdecoder/mpeg4/Makefile") CONFIG_FILES="$CONFIG_FILES plugin/vdecoder/mpeg4/Makefile" ;;
"plugin/vdecoder/others/Makefile") CONFIG_FILES="$CONFIG_FILES plugin/vdecoder/others/Makefile" ;;
"plugin/vencoder/Makefile") CONFIG_FILES="$CONFIG_FILES plugin/vencoder/Makefile" ;;

*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
Expand Down
1 change: 1 addition & 0 deletions sunxi-cedarx/SOURCE/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ AC_CONFIG_FILES([Makefile
common/Makefile
omxil/Makefile
vdecoder/Makefile
vencoder/Makefile
plugin/Makefile
plugin/vdecoder/Makefile
plugin/vdecoder/h264/Makefile
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion sunxi-cedarx/SOURCE/vdecoder/videoengine.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ int VideoEngineDecode(VideoEngine* pVideoEngine,

/* /proc/[pid]/maps */

int GetLocalPathFromProcessMaps(char *localPath, int len)
static int GetLocalPathFromProcessMaps(char *localPath, int len)
{
#define LOCAL_LIB "libcedar_vdecoder.so"
char path[512] = {0};
Expand Down
Loading

0 comments on commit 72f2b85

Please sign in to comment.