mirror of
https://github.com/sengeiou/realtek_ameba_mp_sdk.git
synced 2026-07-03 10:05:42 +00:00
ameba micropython sdk first commit
This commit is contained in:
commit
8508ee6139
5619 changed files with 1874619 additions and 0 deletions
38
sdk/component/common/media/framework/hantro_modify_parm.h
Normal file
38
sdk/component/common/media/framework/hantro_modify_parm.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#ifndef HANTRO_MODIFY_PARM_H
|
||||
#define HANTRO_MODIFY_PARM_H
|
||||
|
||||
#define CMD_VIDEO_H264_CHG_FPS 0x01
|
||||
#define CMD_VIDEO_H264_CHG_RESOLUTION 0x02
|
||||
#define CMD_VIDEO_H264_CHG_BPS 0x03
|
||||
#define CMD_VIDEO_H264_CHG_IFRAME 0x04
|
||||
|
||||
struct mmf_video_h264_parm{
|
||||
int cmd_code;
|
||||
int config_flag;
|
||||
int fps;
|
||||
int width;
|
||||
int height;
|
||||
int bps;
|
||||
};
|
||||
|
||||
struct mmf_video_modify_parm_context{
|
||||
struct mmf_video_h264_parm h264_parm[3];
|
||||
};
|
||||
|
||||
void mmf_video_modify_parm_init(void);
|
||||
|
||||
void mmf_video_isp_reset_buffer(int streamid);
|
||||
|
||||
void mmf_video_h264_change_parm_cb(void *ctx);
|
||||
|
||||
int mmf_video_h264_change_fps(int streamid,int fps);
|
||||
|
||||
int mmf_video_h264_change_resolution(int streamid,int width,int height);
|
||||
|
||||
int mmf_video_h264_change_bps(int streamid,int bps);
|
||||
|
||||
int mmf_video_h264_force_iframe(int streamid);
|
||||
|
||||
void mmf_video_nv12_change_parm_cb(void *ctx);
|
||||
|
||||
#endif
|
||||
26
sdk/component/common/media/framework/jpeg_snapshot.h
Normal file
26
sdk/component/common/media/framework/jpeg_snapshot.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef JPEG_SNAPSHOT_H
|
||||
#define JPEG_SNAPSHOT_H
|
||||
|
||||
#include "video_common_api.h"
|
||||
|
||||
void jpeg_snapshot_initial_with_instance(void* jpeg_ctx, uint32_t dest_addr, uint32_t dest_len, uint8_t snapshot_during_jpeg_streaming);
|
||||
void jpeg_snapshot_initial(uint32_t width, uint32_t height, uint32_t fps, uint32_t level, uint32_t dest_addr, uint32_t dest_len);
|
||||
int jpeg_snapshot_encode_cb(uint32_t y_addr,uint32_t uv_addr);
|
||||
void jpeg_snapshot_cb(void);
|
||||
|
||||
int jpeg_snapshot_isp_config(int streamid);
|
||||
int jpeg_snapshot_get_buffer(VIDEO_BUFFER* video_buf, uint32_t timeout_ms);
|
||||
void jpeg_snapshot_set_processing(uint8_t snapshot_processing);
|
||||
uint8_t jpeg_snapshot_get_processing();
|
||||
|
||||
// For AT command
|
||||
void jpeg_snapshot_stream();
|
||||
int jpeg_snapshot_isp();
|
||||
int jpeg_snapshot_isp_change_resolution(int width,int height);
|
||||
void jpeg_snapshot_isp_callback(int arg);
|
||||
|
||||
int yuv_snapshot_isp_config(int width,int height,int fps,int streamid);
|
||||
int yuv_snapshot_isp(unsigned char **raw_y);
|
||||
int yuv_snapshot_isp_deinit();
|
||||
|
||||
#endif
|
||||
35
sdk/component/common/media/framework/memory_encoder.h
Normal file
35
sdk/component/common/media/framework/memory_encoder.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef ENCODER_MEMORY_H
|
||||
#define ENCODER_MEMORY_H
|
||||
|
||||
#include "osdep_service.h"
|
||||
#include <stdint.h>
|
||||
|
||||
struct encoder_buffer{
|
||||
_mutex memory_lock;
|
||||
|
||||
uint8_t* pool;
|
||||
uint8_t* pool_table; // index table
|
||||
int32_t max_pool_blk; //
|
||||
|
||||
int32_t blk_size; // one block size
|
||||
int32_t mem_size; // total pool size
|
||||
|
||||
int32_t pool_blk_idx;
|
||||
int32_t rest_pool_blk;
|
||||
|
||||
|
||||
int32_t blk_serial;
|
||||
|
||||
int32_t min_rest_blk;
|
||||
};
|
||||
|
||||
|
||||
void *memory_init(int size,int block_size);
|
||||
void memory_deinit(void *ctx);
|
||||
//u8* _memory_realloc(struct encoder_buffer *eb,uint8_t *addr,uint32_t size);
|
||||
uint8_t* memory_realloc(void *ctx,uint8_t *addr,uint32_t size);
|
||||
void memory_free(void *ctx,uint8_t *addr);
|
||||
void* memory_alloc(void *ctx,uint32_t size);
|
||||
void dump_info(void *ctx);
|
||||
|
||||
#endif
|
||||
79
sdk/component/common/media/framework/mmf_command.h
Normal file
79
sdk/component/common/media/framework/mmf_command.h
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
#ifndef _MMF_COMMAND_H_
|
||||
#define _MMF_COMMAND_H_
|
||||
|
||||
#include <FreeRTOS.h>
|
||||
#include <task.h>
|
||||
#include "basic_types.h"
|
||||
#include "osdep_service.h"
|
||||
|
||||
#define MMF_CMD_DEBUG 0
|
||||
|
||||
#if MMF_CMD_DEBUG
|
||||
#define MMF_CMD_PRINTF(fmt, args...) printf("\n\r%s: " fmt, __FUNCTION__, ## args)
|
||||
#define MMF_CMD_ERROR(fmt, args...) printf("\n\r%s: " fmt, __FUNCTION__, ## args)
|
||||
#else
|
||||
#define MMF_CMD_PRINTF(fmt, args...)
|
||||
#define MMF_CMD_ERROR(fmt, args...) printf("\n\r%s: " fmt, __FUNCTION__, ## args)
|
||||
#endif
|
||||
|
||||
#define MMF_COMMAND_SERVICE_PRIORITY tskIDLE_PRIORITY + 1
|
||||
#define MMF_COMMAND_BUF_SIZE 512
|
||||
#define DEF_MMF_COMMAND_PORT 16385
|
||||
|
||||
#define MMF_COMMAND_SELECT_SOCK 8
|
||||
|
||||
// TODO: command list
|
||||
/*mmf command list*/
|
||||
|
||||
typedef struct {
|
||||
struct list_head list;
|
||||
u8 bCmd;
|
||||
u8 bSubCommand;
|
||||
u8 bidx;
|
||||
u8 bLen;// sizeof[data]
|
||||
u16 wParam;
|
||||
u16 wAddr;
|
||||
u8 *data; // max: 32byte
|
||||
} mcmd_t;
|
||||
|
||||
typedef struct mmf_command_socket
|
||||
{
|
||||
int server_socket;
|
||||
u8 *server_ip;
|
||||
u16 server_port;
|
||||
u8 *remote_ip;
|
||||
u16 remote_port;
|
||||
int client_socket;
|
||||
|
||||
mcmd_t* command;
|
||||
u8 *request;
|
||||
u8 *response;
|
||||
int (*cb_command)(void*,void*);
|
||||
} mcmd_socket_t;
|
||||
|
||||
typedef struct mmf_command_context
|
||||
{
|
||||
struct list_head cmd_list;
|
||||
_mutex list_lock;
|
||||
_sema cmd_in_sema;
|
||||
xTaskHandle queue_task;
|
||||
int (*cb_custom)(void*);
|
||||
mcmd_socket_t* mcmd_socket;
|
||||
xTaskHandle socket_task;
|
||||
} mcmd_context;
|
||||
|
||||
mcmd_t* mcmd_cmd_create(u8 bCmd, u8 bSubCommand, u8 bidx, u8 bLen, u16 wParam, u16 wAddr, u8 *data);
|
||||
void mcmd_queue_service(void *param);
|
||||
int mcmd_queue_task_open(mcmd_context *ctx);
|
||||
mcmd_context * mcmd_context_init();
|
||||
void mcmd_context_deinit(mcmd_context *ctx);
|
||||
void mcmd_in_cmd_queue(mcmd_t *cmd, mcmd_context *ctx);
|
||||
mcmd_t *mcmd_out_cmd_queue(mcmd_context *ctx);
|
||||
|
||||
mcmd_socket_t* mcmd_socket_create();
|
||||
void mcmd_socket_free(mcmd_socket_t *mcmd_socket);
|
||||
char mcmd_socket_bind_server(mcmd_socket_t *mcmd_socket);
|
||||
char mcmd_socket_accept_client(mcmd_socket_t *mcmd_socket);
|
||||
mcmd_t* mcmd_parse_cmd(u8 *data);
|
||||
|
||||
#endif
|
||||
94
sdk/component/common/media/framework/mmf_common.h
Normal file
94
sdk/component/common/media/framework/mmf_common.h
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
#ifndef _EXCHBUF_H
|
||||
#define _EXCHBUF_H
|
||||
#include "cmsis_os.h"
|
||||
#include "osdep_service.h"
|
||||
#include "mmf_dbg.h"
|
||||
|
||||
/*service task state*/
|
||||
#define S_STOP 0x00
|
||||
#define S_RUN 0x01
|
||||
#define S_FROZEN 0X02
|
||||
|
||||
/*exchange buffer state*/
|
||||
#define STAT_INIT 0
|
||||
#define STAT_USED 1
|
||||
#define STAT_READY 2
|
||||
#define STAT_RESERVED 3
|
||||
|
||||
/*output sink state*/
|
||||
#define SINK_STOP 0x00
|
||||
#define SINK_RUN 0x01
|
||||
|
||||
typedef struct _media_source_module msrc_module_t;
|
||||
typedef struct _media_sink_module msink_module_t;
|
||||
|
||||
typedef struct _share_cache{
|
||||
_mutex mutex;
|
||||
uint8_t* data; // command arg
|
||||
}share_cache_t;
|
||||
|
||||
typedef struct _exch_buf_output_list{
|
||||
uint8_t index;
|
||||
msink_module_t * sink; // destination sink
|
||||
xQueueHandle output_qid;
|
||||
uint8_t send;
|
||||
}output_list_t;
|
||||
|
||||
typedef struct _exch_buf{
|
||||
//_list node; // linking node
|
||||
uint32_t type; // CMD, or DATA
|
||||
uint32_t cmd; // command
|
||||
uint32_t arg; // command arg
|
||||
|
||||
uint8_t* data; //
|
||||
uint32_t index;
|
||||
uint32_t len;
|
||||
uint32_t timestamp; // 0: not set
|
||||
uint32_t hw_timestamp; // ISP hw timestamp
|
||||
uint32_t codec_fmt; // FMT_V_xx or FMT_A_xx
|
||||
|
||||
uint32_t state;
|
||||
void* priv; // private use
|
||||
|
||||
xQueueHandle source_qid;
|
||||
output_list_t* output_sink_list;
|
||||
uint8_t sink_cnt;
|
||||
uint32_t dst_count;
|
||||
uint32_t* ref_count;
|
||||
_mutex ref_count_lock;
|
||||
uint32_t share_cache_size;
|
||||
uint32_t max_share_cnt;
|
||||
share_cache_t* cache_list;
|
||||
}exch_buf_t;
|
||||
|
||||
/*CMDs necessary for MMF*/
|
||||
#define CMD_SET_STREAMMING 0x00
|
||||
#define CMD_SET_INPUT_QUEUE 0x01
|
||||
#define CMD_SET_OUTPUT_QUEUE 0x02
|
||||
#define CMD_SET_TASK_ON 0x03
|
||||
#define CMD_SET_TASK_FROZEN 0x04
|
||||
#define CMD_SET_TASK_OFF 0x05
|
||||
|
||||
/* CMDs optional for MMF*/
|
||||
#define CMD_SET_CB_START 0x0a
|
||||
#define CMD_SET_CB_STOP 0x0b
|
||||
#define CMD_SET_CB_PAUSE 0x0c
|
||||
#define CMD_SET_CB_CUSTOMCMD 0x0d
|
||||
|
||||
/* currently supported media format type */
|
||||
#define FMT_V_MJPG 0x00
|
||||
#define FMT_V_H264 0x01
|
||||
#define FMT_V_MP4V_ES 0x02
|
||||
#define FMT_A_PCMU 0x10
|
||||
#define FMT_A_PCMA 0x11
|
||||
#define FMT_A_MP4A_LATM 0x12
|
||||
#define FMT_A_AAC_RAW 0x13
|
||||
#define FMT_AV_UNKNOWN 0xFF
|
||||
|
||||
/* common error code for MMF */
|
||||
#define EAGAIN 11
|
||||
#define EFAULT 14
|
||||
#define EINVAL 22
|
||||
#define ENOSR 63
|
||||
|
||||
#endif
|
||||
111
sdk/component/common/media/framework/mmf_dbg.h
Normal file
111
sdk/component/common/media/framework/mmf_dbg.h
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
#ifndef __MMF_DBG_H_
|
||||
#define __MMF_DBG_H_
|
||||
|
||||
#include "platform_stdlib.h"
|
||||
|
||||
extern int PRINT_TS_DIFF;
|
||||
|
||||
// Define debug group
|
||||
#define _MMF_DBG_RTSP_ 0x00000001
|
||||
#define _MMF_DBG_RTP_ 0x00000002
|
||||
#define _MMF_DBG_ISP_ 0x00000004
|
||||
#define _MMF_DBG_ENCODER_ 0x00000008
|
||||
|
||||
extern u32 ConfigDebugMmfErr;
|
||||
extern u32 ConfigDebugMmfWarn;
|
||||
extern u32 ConfigDebugMmfInfo;
|
||||
|
||||
#define DBG_MMF_ERR_MSG_ON(x) (ConfigDebugMmfErr |= (x))
|
||||
#define DBG_MMF_WARN_MSG_ON(x) (ConfigDebugMmfWarn |= (x))
|
||||
#define DBG_MMF_INFO_MSG_ON(x) (ConfigDebugMmfInfo |= (x))
|
||||
|
||||
#define DBG_MMF_ERR_MSG_OFF(x) (ConfigDebugMmfErr &= ~(x))
|
||||
#define DBG_MMF_WARN_MSG_OFF(x) (ConfigDebugMmfWarn &= ~(x))
|
||||
#define DBG_MMF_INFO_MSG_OFF(x) (ConfigDebugMmfInfo &= ~(x))
|
||||
|
||||
|
||||
#define RTSP_ERR_PREFIX "[RTSP Err]"
|
||||
#define RTSP_WARN_PREFIX "[RTSP Wrn]"
|
||||
#define RTSP_INFO_PREFIX "[RTSP Inf]"
|
||||
|
||||
#define RTP_ERR_PREFIX "[RTP Err]"
|
||||
#define RTP_WARN_PREFIX "[RTP Wrn]"
|
||||
#define RTP_INFO_PREFIX "[RTP Inf]"
|
||||
|
||||
#define ISP_ERR_PREFIX "[ISP Err]"
|
||||
#define ISP_WARN_PREFIX "[ISP Wrn]"
|
||||
#define ISP_INFO_PREFIX "[ISP Inf]"
|
||||
|
||||
#define ENCODER_ERR_PREFIX "[Enc Err]"
|
||||
#define ENCODER_WARN_PREFIX "[Enc Wrn]"
|
||||
#define ENCODER_INFO_PREFIX "[Enc Inf]"
|
||||
|
||||
|
||||
#define MMF_PRINTK printf
|
||||
|
||||
#define RTSP_DBG_ERROR(...) \
|
||||
do { \
|
||||
if (ConfigDebugMmfErr&_MMF_DBG_RTSP_) \
|
||||
MMF_PRINTK("\n\r" RTSP_ERR_PREFIX __VA_ARGS__); \
|
||||
}while(0)
|
||||
#define RTP_DBG_ERROR(...) \
|
||||
do { \
|
||||
if (ConfigDebugMmfErr&_MMF_DBG_RTP_) \
|
||||
MMF_PRINTK("\n\r" RTP_ERR_PREFIX __VA_ARGS__); \
|
||||
}while(0)
|
||||
#define ISP_DBG_ERROR(...) \
|
||||
do { \
|
||||
if (ConfigDebugMmfErr&_MMF_DBG_ISP_) \
|
||||
MMF_PRINTK("\n\r" ISP_ERR_PREFIX __VA_ARGS__); \
|
||||
}while(0)
|
||||
#define ENCODER_DBG_ERROR(...) \
|
||||
do { \
|
||||
if (ConfigDebugMmfErr&_MMF_DBG_ENCODER_) \
|
||||
MMF_PRINTK("\n\r" ENCODER_ERR_PREFIX __VA_ARGS__); \
|
||||
}while(0)
|
||||
|
||||
// DBG_WARNING
|
||||
#define RTSP_DBG_WARNING(...) \
|
||||
do { \
|
||||
if (ConfigDebugMmfWarn&_MMF_DBG_RTSP_) \
|
||||
MMF_PRINTK("\n\r" RTSP_WARN_PREFIX __VA_ARGS__); \
|
||||
}while(0)
|
||||
#define RTP_DBG_WARNING(...) \
|
||||
do { \
|
||||
if (ConfigDebugMmfWarn&_MMF_DBG_RTP_) \
|
||||
MMF_PRINTK("\n\r" RTP_WARN_PREFIX __VA_ARGS__); \
|
||||
}while(0)
|
||||
#define ISP_DBG_WARNING(...) \
|
||||
do { \
|
||||
if (ConfigDebugMmfWarn&_MMF_DBG_ISP_) \
|
||||
MMF_PRINTK("\n\r" ISP_WARN_PREFIX __VA_ARGS__); \
|
||||
}while(0)
|
||||
#define ENCODER_DBG_WARNING(...) \
|
||||
do { \
|
||||
if (ConfigDebugMmfWarn&_MMF_DBG_ENCODER_) \
|
||||
MMF_PRINTK("\n\r" ENCODER_WARN_PREFIX __VA_ARGS__); \
|
||||
}while(0)
|
||||
|
||||
// DBG_INFO
|
||||
#define RTSP_DBG_INFO(...) \
|
||||
do { \
|
||||
if (ConfigDebugMmfInfo&_MMF_DBG_RTSP_) \
|
||||
MMF_PRINTK("\n\r" RTSP_INFO_PREFIX __VA_ARGS__); \
|
||||
}while(0)
|
||||
#define RTP_DBG_INFO(...) \
|
||||
do { \
|
||||
if (ConfigDebugMmfInfo&_MMF_DBG_RTP_) \
|
||||
MMF_PRINTK("\n\r" RTP_INFO_PREFIX __VA_ARGS__); \
|
||||
}while(0)
|
||||
#define ISP_DBG_INFO(...) \
|
||||
do { \
|
||||
if (ConfigDebugMmfInfo&_MMF_DBG_ISP_) \
|
||||
MMF_PRINTK("\n\r" ISP_INFO_PREFIX __VA_ARGS__); \
|
||||
}while(0)
|
||||
#define ENCODER_DBG_INFO(...) \
|
||||
do { \
|
||||
if (ConfigDebugMmfInfo&_MMF_DBG_ENCODER_) \
|
||||
MMF_PRINTK("\n\r" ENCODER_INFO_PREFIX __VA_ARGS__); \
|
||||
}while(0)
|
||||
#endif
|
||||
|
||||
30
sdk/component/common/media/framework/mmf_sink.h
Normal file
30
sdk/component/common/media/framework/mmf_sink.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef _STREAM_H
|
||||
#define _STREAM_H
|
||||
#include "cmsis_os.h"
|
||||
#include "mmf_common.h"
|
||||
#include "mmf_source_modules/mmf_source_list.h" // for sink modules to find src
|
||||
|
||||
struct _media_sink_module{
|
||||
void* (*create)(void);
|
||||
void (*destroy)(void*);
|
||||
int (*set_param)(void*, int, int);
|
||||
int (*handle)(void*,void*); // data handle, input output will cast to exch_buf_t
|
||||
};
|
||||
|
||||
typedef struct _media_sink_context{
|
||||
xQueueHandle input_qid;
|
||||
//xQueueHandle output_qid;
|
||||
int state;
|
||||
xTaskHandle hdl_task; // queue service task
|
||||
|
||||
void* drv_priv; // private data for module
|
||||
msink_module_t * sink;
|
||||
}msink_context;
|
||||
|
||||
void mmf_sink_close(msink_context* ctx);
|
||||
msink_context* mmf_sink_open(msink_module_t *sink);
|
||||
int mmf_sink_ctrl(msink_context* ctx, int cmd, int arg);
|
||||
|
||||
// must be here
|
||||
#include "mmf_sink_modules/mmf_sink_list.h"
|
||||
#endif
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef _MMF_SINK_I2S_H_
|
||||
#define _MMF_SINK_I2S_H_
|
||||
|
||||
#include "i2s_api.h"
|
||||
#include "g711/g711_codec.h"
|
||||
#include "alc5651.h"
|
||||
|
||||
void i2s_mod_close(void* ctx);
|
||||
void* i2s_mod_open(void);
|
||||
int i2s_mod_set_param(void* ctx, int cmd, int arg);
|
||||
int i2s_mod_handle(void* ctx, void* b);
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef _STREAM_MODULES_H
|
||||
#define _STREAM_MODULES_H
|
||||
#include "../mmf_sink.h"
|
||||
|
||||
//list all avaliable modules here
|
||||
extern msink_module_t rtsp_module;
|
||||
extern msink_module_t rtsp2_module;
|
||||
extern msink_module_t i2s_sink_module;
|
||||
extern msink_module_t audio_sink_module;
|
||||
extern msink_module_t audio_wrapper_sink_module;
|
||||
extern msink_module_t mp4_module;
|
||||
extern msink_module_t mp3_sink_module;
|
||||
extern msink_module_t rtsp2_module2;
|
||||
extern msink_module_t rtsp2_module3;
|
||||
extern msink_module_t uvcd_module;
|
||||
#endif
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef MMF_SINK_MP3_FILE_H
|
||||
#define MMF_SINK_MP3_FILE_H
|
||||
#include "mmf_sink.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "platform_opts.h"
|
||||
#include "mp3/mp3_codec.h"
|
||||
#include "diag.h"
|
||||
#include "i2s_api.h"
|
||||
#include "analogin_api.h"
|
||||
#include <stdlib.h>
|
||||
#include "section_config.h"
|
||||
#if CONFIG_EXAMPLE_MP3_STREAM_SGTL5000
|
||||
#include "sgtl5000.h"
|
||||
#else
|
||||
#include "alc5651.h"
|
||||
#endif
|
||||
|
||||
void mp3_sink_mod_close(void* ctx);
|
||||
void* mp3_sink_mod_open(void);
|
||||
int mp3_sink_mod_set_param(void* ctx, int cmd, int arg);
|
||||
int mp3_sink_mod_handle(void* ctx, void* b);
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
|
||||
#endif /* MMF_SINK_MP3_FILE_H */
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
#ifndef _MMF_SINK_MP4_H_
|
||||
#define _MMF_SINK_MP4_H_
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include <platform/platform_stdlib.h>
|
||||
#include "basic_types.h"
|
||||
#include "platform_opts.h"
|
||||
#include "section_config.h"
|
||||
|
||||
#include "ff.h"
|
||||
#include <fatfs_ext/inc/ff_driver.h>
|
||||
#include "sdio_host.h"
|
||||
#include "sdio_combine.h"
|
||||
#include <disk_if/inc/sdcard.h>
|
||||
|
||||
#include "sockets.h"
|
||||
#include "lwip/netif.h"
|
||||
#if defined(CONFIG_PLATFORM_8195BHP)
|
||||
#include "mp4_muxer.h"
|
||||
#endif
|
||||
#ifdef CONFIG_PLATFORM_8195A
|
||||
#include "mp4_encap.h"
|
||||
#endif
|
||||
|
||||
void mp4_mod_close(void* ctx);
|
||||
void* mp4_mod_open(void);
|
||||
int mp4_mod_set_param(void* ctx, int cmd, int arg);
|
||||
int mp4_mod_handle(void* ctx, void* b);
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
#define CMD_MP4_SET_HEIGHT 0x10
|
||||
#define CMD_MP4_SET_WIDTH 0x11
|
||||
#define CMD_MP4_SET_FRAMERATE 0x12
|
||||
#define CMD_MP4_SET_GOP 0x13
|
||||
#define CMD_MP4_SET_SAMPLERATE 0x14
|
||||
#define CMD_MP4_SET_CHANNEL_CNT 0x15
|
||||
#define CMD_MP4_SET_ST_PERIOD 0x16
|
||||
#define CMD_MP4_SET_ST_TOTAL 0x17
|
||||
#define CMD_MP4_SET_ST_TYPE 0x18
|
||||
#define CMD_MP4_SET_ST_FILENAME 0x19
|
||||
#define CMD_MP4_SET_ST_START 0x1a
|
||||
#define CMD_MP4_SET_ST_STOP 0x1b
|
||||
#define CMD_MP4_SET_START_CB 0x1c
|
||||
#define CMD_MP4_SET_STOP_CB 0x1d
|
||||
#define CMD_MP4_GET_STATUS 0x1e
|
||||
|
||||
#define CMD_MP4_SET_FATFS_DRV_NUM 0x20
|
||||
#define CMD_MP4_SET_FATFS_DRV 0x21
|
||||
#define CMD_MP4_SET_FATFS_SD 0x22
|
||||
#define CMD_MP4_SET_FATFS_BUF_SIZE 0x23
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef _MMF_SINK_AUDIO_H_
|
||||
#define _MMF_SINK_AUDIO_H_
|
||||
|
||||
#include "audio_api.h"
|
||||
#include "g711/g711_codec.h"
|
||||
|
||||
#include "mmf_source.h"
|
||||
#include "cmsis.h"
|
||||
//#include "shell.h"
|
||||
//#include "main.h"
|
||||
//#include "hal_cache.h"
|
||||
//#include "hal_timer.h"
|
||||
#include "cmsis_os.h"
|
||||
#include <math.h>
|
||||
#include "hal_timer.h"
|
||||
#include "sgpio_api.h"
|
||||
#include "audio_api.h"
|
||||
|
||||
typedef enum {
|
||||
AUDIO_MODE_UNKNOWN = -1,
|
||||
AUDIO_MODE_G711A = 1,
|
||||
AUDIO_MODE_G711U = 2
|
||||
}Audio_mode;
|
||||
|
||||
typedef struct {
|
||||
Audio_mode mode; //intend to encode as G711A or G711U
|
||||
int len; //data length
|
||||
// _sema RWSema;
|
||||
unsigned char *raw_data; //address of buffered data (not encoded
|
||||
int data_start; // a shift value to show where the data starts
|
||||
int data_end; // a shift value shows data ending
|
||||
}audio_buf_context;
|
||||
|
||||
void audio_mod_close(void* ctx);
|
||||
void* audio_mod_open(void);
|
||||
int audio_mod_set_param(void* ctx, int cmd, int arg);
|
||||
int audio_mod_handle(void* ctx, void* b);
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef _MMF_SINK_AUDIO_H_
|
||||
#define _MMF_SINK_AUDIO_H_
|
||||
|
||||
#include "mmf_wrapper/mmf_wrapper_pro_audio.h"
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef _MMF_SINK_RTSP_H_
|
||||
#define _MMF_SINK_RTSP_H_
|
||||
|
||||
#include "rtsp/rtsp_api.h"
|
||||
#include "sockets.h"
|
||||
#include "lwip/netif.h"
|
||||
|
||||
void rtsp_mod_close(void* ctx);
|
||||
void* rtsp_mod_open(void);
|
||||
int rtsp_mod_set_param(void* ctx, int cmd, int arg);
|
||||
int rtsp_mod_handle(void* ctx, void* b);
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
#define CMD_RSTP_SET_FRAMERATE 0x10
|
||||
#define CMD_RSTP_SET_BITRATE 0x11
|
||||
#define CMD_RSTP_SET_SAMPLERATE 0x12
|
||||
#define CMD_RSTP_SET_CHANNEL 0x13
|
||||
#define CMD_RSTP_SET_SPS 0x14
|
||||
#define CMD_RSTP_SET_PPS 0x15
|
||||
#define CMD_RSTP_SET_LEVEL 0x16
|
||||
#define CMD_RSTP_SET_APPLY 0x17
|
||||
#define CMD_RSTP_SET_CODEC 0x18
|
||||
#define CMD_RSTP_SET_START_CB 0x19
|
||||
#define CMD_RSTP_SET_STOP_CB 0x1a
|
||||
#define CMD_RSTP_SET_PAUSE_CB 0x1b
|
||||
#define CMD_RSTP_SET_CUSTOM_CB 0x1c
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#ifndef _MMF_SINK_RTSP2_H_
|
||||
#define _MMF_SINK_RTSP2_H_
|
||||
|
||||
#include "rtsp/rtsp_api.h"
|
||||
#include "sockets.h"
|
||||
#include "lwip/netif.h"
|
||||
|
||||
void rtsp2_mod_close(void* ctx);
|
||||
void* rtsp2_mod_open(void);
|
||||
int rtsp2_mod_set_param(void* ctx, int cmd, int arg);
|
||||
int rtsp2_mod_handle(void* ctx, void* b);
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
#define CMD_RSTP2_SELECT_CHANNEL 0x10
|
||||
#define CMD_RSTP2_SET_FRAMERATE 0x11
|
||||
#define CMD_RSTP2_SET_BITRATE 0x12
|
||||
#define CMD_RSTP2_SET_SAMPLERATE 0x13
|
||||
#define CMD_RSTP2_SET_CHANNEL 0x14
|
||||
#define CMD_RSTP2_SET_SPS 0x15
|
||||
#define CMD_RSTP2_SET_PPS 0x16
|
||||
#define CMD_RSTP2_SET_LEVEL 0x17
|
||||
#define CMD_RSTP2_SET_APPLY 0x18
|
||||
#define CMD_RSTP2_SET_CODEC 0x19
|
||||
#define CMD_RSTP2_SET_FLAG 0x1a
|
||||
#define CMD_RSTP2_SET_START_CB 0x1b
|
||||
#define CMD_RSTP2_SET_STOP_CB 0x1c
|
||||
#define CMD_RSTP2_SET_PAUSE_CB 0x1d
|
||||
#define CMD_RSTP2_SET_CUSTOM_CB 0x1e
|
||||
|
||||
#define TIME_SYNC_EN 0
|
||||
#define TIME_SYNC_DIS 1
|
||||
|
||||
#endif
|
||||
52
sdk/component/common/media/framework/mmf_source.h
Normal file
52
sdk/component/common/media/framework/mmf_source.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#ifndef _MEDIA_H
|
||||
#define _MEDIA_H
|
||||
#include "cmsis_os.h"
|
||||
#include "mmf_common.h"
|
||||
#include "mmf_sink_modules/mmf_sink_list.h" // for source modules to set dest_sink
|
||||
|
||||
struct _media_source_module{
|
||||
void* (*create)(void);
|
||||
void (*destroy)(void*);
|
||||
int (*set_param)(void*, int, int);
|
||||
int (*handle)(void*, void*); // data handle, input output will cast to exch_buf_t
|
||||
};
|
||||
|
||||
typedef struct _media_source_output_queue{
|
||||
uint8_t index;
|
||||
msink_module_t * sink; // destination sink
|
||||
xQueueHandle output_qid;
|
||||
uint8_t sink_state; // SINK_STOP or SINK_RUN
|
||||
}msrc_output_queue_t;
|
||||
|
||||
typedef struct _media_source_context{
|
||||
xQueueHandle input_qid;
|
||||
msrc_output_queue_t* output_qid_list;
|
||||
//xQueueHandle output_qid;
|
||||
int state;
|
||||
xTaskHandle hdl_task; // queue service task
|
||||
|
||||
void* drv_priv;
|
||||
msrc_module_t * source;
|
||||
|
||||
uint8_t stream_on;
|
||||
uint32_t free_exch_buf_cnt;
|
||||
_sema stream_off_done_sema;
|
||||
uint8_t sink_cnt;
|
||||
uint8_t max_share_cnt;
|
||||
uint32_t share_cache_size;// if 0 -> don't use cache, use referece count
|
||||
uint32_t exch_buf_cnt;
|
||||
exch_buf_t* p_exbuf;
|
||||
}msrc_context;
|
||||
|
||||
void mmf_source_close(msrc_context* ctx);
|
||||
msrc_context* mmf_source_open(msrc_module_t *source, uint8_t sink_cnt, uint8_t max_share_cnt, uint32_t cache_size);
|
||||
int mmf_source_ctrl(msrc_context* ctx, int cmd, int arg);
|
||||
void mmf_source_sink_state_change(msrc_context* ctx, msink_module_t* sink, uint8_t state);
|
||||
char mmf_source_all_sink_off(msrc_context* ctx);
|
||||
void mmf_source_reset_exbuf_sending_list(exch_buf_t *exbuf);
|
||||
void mmf_source_add_exbuf_sending_list(exch_buf_t *exbuf, msink_module_t *sink);
|
||||
void mmf_source_add_exbuf_sending_list_all(exch_buf_t *exbuf);
|
||||
|
||||
// must be here
|
||||
#include "mmf_source_modules/mmf_source_list.h"
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,61 @@
|
|||
#ifndef _MMF_SOURCE_AAC_ENCODE_H_
|
||||
#define _MMF_SOURCE_AAC_ENCODE_H_
|
||||
|
||||
#include "aac_util.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "aac_util.h"
|
||||
#include <math.h>
|
||||
#include "psych.h"
|
||||
#include "faac.h"
|
||||
|
||||
#include "sample_aacenc.h"
|
||||
#include "faac_api.h"
|
||||
|
||||
#include "memory_encoder.h"
|
||||
#include "encoder_buffer_handler.h"
|
||||
|
||||
#define AAC_MAX_BUFFER_COUNT 6
|
||||
#define AAC_DISABLE 0
|
||||
#define AAC_ENABLE 1
|
||||
|
||||
#define AAC_DEBUG_SHOW 0
|
||||
|
||||
struct aac_enc_buf_handle{
|
||||
struct enc_buf_data enc_data[AAC_MAX_BUFFER_COUNT];
|
||||
struct enc_list_handle enc_list;
|
||||
};
|
||||
|
||||
struct aacen_context
|
||||
{
|
||||
faacEncHandle hEncoder;
|
||||
int bit_length;
|
||||
int sample_rate;
|
||||
int channel;
|
||||
int samplesInput;
|
||||
int maxBytesOutput;
|
||||
void *source_addr;
|
||||
unsigned char *outputBuffer;
|
||||
struct mem_info mem_info_value;
|
||||
struct encoder_list_head encoder_lh;
|
||||
_sema encoder_output_sema;
|
||||
};
|
||||
|
||||
void* aac_encode_mod_open(void);
|
||||
void aacf_encode_close(void* ctx);
|
||||
int aacf_encode_mod_set_param(void* ctx, int cmd, int arg);
|
||||
int aac_encode_mod_handle(void* ctx, void* b);
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
#define CMD_AACEN_SET_BIT_LENGTH 0x10
|
||||
#define CMD_AACEN_SET_SAMPLE_RATE 0x11
|
||||
#define CMD_AACEN_SET_APPLY 0x12
|
||||
#define CMD_AACEN_SET_CHANEEL 0X13
|
||||
|
||||
#define CMD_AACEN_MEMORY_SIZE 0X30
|
||||
#define CMD_AACEN_BLOCK_SIZE 0X31
|
||||
#define CMD_AACEN_MAX_FRAME_SIZE 0X32
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef _MMF_SOURCE_AAC_FILE_H_
|
||||
#define _MMF_SOURCE_AAC_FILE_H_
|
||||
|
||||
#include "sample_aac.h"
|
||||
|
||||
void* aacf_mod_open(void);
|
||||
void aacf_mod_close(void* ctx);
|
||||
int aacf_mod_set_param(void* ctx, int cmd, int arg);
|
||||
int aacf_mod_handle(void* ctx, void* b);
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef _MMF_SOURCE_GEO_H_
|
||||
#define _MMF_SOURCE_GEO_H_
|
||||
|
||||
#include "videodev2.h"
|
||||
#include "uvcvideo.h"
|
||||
#include "v4l2_intf.h"
|
||||
|
||||
#include "driver/geo/patch_uvc_geo.h"
|
||||
|
||||
void* geo_mod_open(void);
|
||||
void geo_mod_close(void* ctx);
|
||||
int geo_mod_set_param(void* ctx, int cmd, int arg);
|
||||
int geo_mod_handle(void* ctx, void* b);
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
#define CMD_GEO_SELECT_CHANNEL 0x10
|
||||
#define CMD_GEO_SET_HEIGHT 0x11
|
||||
#define CMD_GEO_SET_WIDTH 0x12
|
||||
#define CMD_GEO_SET_FRAMERATE 0x13
|
||||
#define CMD_GEO_SET_SAMPLERATE 0x14
|
||||
#define CMD_GEO_SET_CPZRATIO 0x15
|
||||
#define CMD_GEO_SET_FRAMETYPE 0x16
|
||||
#define CMD_GEO_SET_APPLY 0x17
|
||||
#define CMD_GEO_SET_CHANNEL 0x18
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
#ifndef _MMF_SOURCE_H1V6_H264_H_
|
||||
#define _MMF_SOURCE_H1V6_H264_H_
|
||||
|
||||
#include "basic_types.h"
|
||||
#include "osdep_service.h"
|
||||
#include <platform_opts.h>
|
||||
#include "cmsis.h"
|
||||
#include "rtl8195bhp_video.h"
|
||||
#include "hal_encorder.h"
|
||||
#include "hal_cache.h"
|
||||
#include "section_config.h"
|
||||
|
||||
#include "memory_encoder.h"
|
||||
#include "hantro_h264_encoder.h"
|
||||
#include "isp_api.h"
|
||||
|
||||
void* h1v6_h264_open(void);
|
||||
void h1v6_h264_close(void* ctx);
|
||||
int h1v6_h264_set_param(void* ctx, int cmd, int arg);
|
||||
int h1v6_h264_handle(void* ctx, void* b);
|
||||
|
||||
struct h1v6_h264_rc_parm
|
||||
{
|
||||
unsigned int rcMode;
|
||||
unsigned int iQp; // for fixed QP
|
||||
unsigned int pQp; // for fixed QP
|
||||
unsigned int minQp; // for CBR/VBR
|
||||
unsigned int minIQp; // for CBR/VBR
|
||||
unsigned int maxQp; // for CBR/VBR
|
||||
};
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
#define CMD_HANTRO_H264_SET_HEIGHT 0x10
|
||||
#define CMD_HANTRO_H264_SET_WIDTH 0x11
|
||||
#define CMD_HANTRO_H264_BITRATE 0x12
|
||||
#define CMD_HANTRO_H264_FPS 0x13
|
||||
#define CMD_HANTRO_H264_GOP 0x14
|
||||
#define CMD_HANTRO_H264_RCMODE 0x15
|
||||
#define CMD_HANTRO_H264_SET_RCPARAM 0x16
|
||||
#define CMD_HANTRO_H264_GET_RCPARAM 0x17
|
||||
#define CMD_HANTRO_H264_APPLY 0x18
|
||||
|
||||
#define CMD_ISP_STREAMID 0X20
|
||||
#define CMD_ISP_HW_SLOT 0X21
|
||||
#define CMD_ISP_SW_SLOT 0X22
|
||||
|
||||
#define CMD_H1V6_MEMORY_SIZE 0X30
|
||||
#define CMD_H1V6_BLOCK_SIZE 0X31
|
||||
#define CMD_H1V6_MAX_FRAME_SIZE 0X32
|
||||
|
||||
#define CMD_SNAPSHOT_ENCODE_CB 0x40
|
||||
#define CMD_HANTRO_H264_CHANGE_PARM_CB 0x41
|
||||
#endif
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef _MMF_SOURCE_H1V6_JPEG_H_
|
||||
#define _MMF_SOURCE_H1V6_JPEG_H_
|
||||
|
||||
#include "hantro_jpeg_encoder.h"
|
||||
|
||||
void* h1v6_jpeg_open(void);
|
||||
void h1v6_jpeg_close(void* ctx);
|
||||
int h1v6_jpeg_set_param(void* ctx, int cmd, int arg);
|
||||
int h1v6_jpeg_handle(void* ctx, void* b);
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
#define CMD_HANTRO_JPEG_SET_HEIGHT 0x10
|
||||
#define CMD_HANTRO_JPEG_SET_WIDTH 0x11
|
||||
#define CMD_HANTRO_JPEG_LEVEL 0x12
|
||||
#define CMD_HANTRO_JPEG_FPS 0x13
|
||||
#define CMD_HANTRO_JPEG_HEADER_TYPE 0x14
|
||||
#define CMD_HANTRO_JPEG_APPLY 0x15
|
||||
|
||||
#define CMD_ISP_STREAMID 0X20
|
||||
#define CMD_ISP_HW_SLOT 0X21
|
||||
#define CMD_ISP_SW_SLOT 0X22
|
||||
|
||||
#define CMD_H1V6_MEMORY_SIZE 0X30
|
||||
#define CMD_H1V6_BLOCK_SIZE 0X31
|
||||
#define CMD_H1V6_MAX_FRAME_SIZE 0X32
|
||||
|
||||
#define CMD_SNAPSHOT_CB 0X40
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef _MMF_SOURCE_H264_FILE_H_
|
||||
#define _MMF_SOURCE_H264_FILE_H_
|
||||
#include "encoder_buffer_handler.h"
|
||||
#include "isp_api.h"
|
||||
|
||||
#define CMD_ISP_STREAMID 0x10
|
||||
#define CMD_ISP_HW_SLOT 0x11
|
||||
#define CMD_ISP_SW_SLOT 0x12
|
||||
#define CMD_ISP_HEIGHT 0x13
|
||||
#define CMD_ISP_WIDTH 0x14
|
||||
#define CMD_ISP_FPS 0x15
|
||||
#define CMD_ISP_FORMAT 0x16
|
||||
#define CMD_ISP_APPLY 0x17
|
||||
|
||||
struct uvc_format{
|
||||
int width;
|
||||
int height;
|
||||
int format;
|
||||
int fps;
|
||||
};
|
||||
|
||||
struct h1v6_nv12_context {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
int fps;
|
||||
long index;
|
||||
int start;
|
||||
int format;
|
||||
int uvc_format;//0:yuy2 1:nv12 2:mjpg 3:jpeg
|
||||
struct isp_info isp_info_value;
|
||||
};
|
||||
#endif
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
#ifndef _MMF_SOURCE_H264_FILE_H_
|
||||
#define _MMF_SOURCE_H264_FILE_H_
|
||||
|
||||
#include "sample_h264.h"
|
||||
#include "memory_encoder.h"
|
||||
#include "encoder_buffer_handler.h"
|
||||
#include "timer_api.h"
|
||||
|
||||
#define H264F_DBG_SHOW 0
|
||||
#define H264F_MAX_BUFFER_COUNT 6
|
||||
|
||||
struct h264f_enc_buf_handle{
|
||||
struct enc_buf_data enc_data[H264F_MAX_BUFFER_COUNT];
|
||||
struct enc_list_handle enc_list;
|
||||
};
|
||||
|
||||
struct h264f_context
|
||||
{
|
||||
unsigned int fps;
|
||||
void *source_addr;
|
||||
unsigned char *outputBuffer;
|
||||
struct mem_info mem_info_value;
|
||||
struct encoder_list_head encoder_lh;
|
||||
_sema encoder_output_sema;
|
||||
};
|
||||
|
||||
void* h264f_mod_open(void);
|
||||
void h264f_mod_close(void* ctx);
|
||||
int h264f_mod_set_param(void* ctx, int cmd, int arg);
|
||||
int h264f_mod_handle(void* ctx, void* b);
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
#define CMD_H264F_SET_FPS 0x10
|
||||
#define CMD_H264F_SET_APPLY 0x11
|
||||
|
||||
#define CMD_H264F_MEMORY_SIZE 0X20
|
||||
#define CMD_H264F_BLOCK_SIZE 0X21
|
||||
#define CMD_H264F_MAX_FRAME_SIZE 0X22
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef _MMF_SOURCE_H264_UNIT_H_
|
||||
#define _MMF_SOURCE_H264_UNIT_H_
|
||||
|
||||
#include "h264_encode.h"
|
||||
|
||||
void* h264_unit_open(void);
|
||||
void h264_unit_close(void* ctx);
|
||||
int h264_unit_set_param(void* ctx, int cmd, int arg);
|
||||
int h264_unit_handle(void* ctx, void* b);
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
#ifndef MMF_SOURCE_I2S_H
|
||||
#define MMF_SOURCE_I2S_H
|
||||
|
||||
#include "mmf_source.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
//#include "example_rtsp_server_i2s.h"
|
||||
#include "rtsp/rtsp_api.h"
|
||||
#include "sockets.h"
|
||||
#include "lwip/netif.h"
|
||||
|
||||
#include "i2s_api.h"
|
||||
#include "alc5651.h"
|
||||
#include "g711/g711_codec.h"
|
||||
#include "gpio_api.h" // mbed
|
||||
#include "gpio_irq_api.h"
|
||||
|
||||
#include <platform/platform_stdlib.h>
|
||||
#include "platform_opts.h"
|
||||
#include "dlist.h"
|
||||
#include "basic_types.h"
|
||||
#include "osdep_service.h"
|
||||
|
||||
#define I2S_DMA_PAGE_SIZE 320 // 2 ~ 4096
|
||||
#define I2S_DMA_PAGE_NUM 4 // Vaild number is 2~4
|
||||
#define RECV_PAGE_NUM I2S_DMA_PAGE_NUM
|
||||
|
||||
#define G711_FSIZE 160
|
||||
#define I2S_MODE_SWITCH PE_5
|
||||
|
||||
#define I2S_SCLK_PIN PC_1
|
||||
#define I2S_WS_PIN PC_0
|
||||
#define I2S_SD_PIN PC_2
|
||||
|
||||
void* i2s_mod_open(void);
|
||||
void i2s_mod_close(void* ctx);
|
||||
int i2s_mod_set_param(void* ctx, int cmd, int arg);
|
||||
int i2s_mod_handle(void* ctx, void* b);
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
#define CMD_I2S_SET_FRAMETYPE 0x10
|
||||
|
||||
#endif /* MMF_SOURCE_I2S_H */
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef _MEDIA_MODULES_H
|
||||
#define _MEDIA_MODULES_H
|
||||
#include "../mmf_source.h"
|
||||
|
||||
//list all avaliable modules here
|
||||
extern msrc_module_t uvc_module;
|
||||
extern msrc_module_t geo_module;
|
||||
extern msrc_module_t mjpgf_module;
|
||||
extern msrc_module_t h264f_module;
|
||||
extern msrc_module_t h264_unit_module;
|
||||
extern msrc_module_t h264sd_module;
|
||||
extern msrc_module_t aacf_module;
|
||||
extern msrc_module_t pcmuf_module;
|
||||
extern msrc_module_t i2s_module;
|
||||
extern msrc_module_t rtp_src_module;
|
||||
extern msrc_module_t mp4de_module;
|
||||
extern msrc_module_t audio_module;
|
||||
extern msrc_module_t audio_wrapper_module;
|
||||
#ifdef CONFIG_PLATFORM_8195BHP
|
||||
extern msrc_module_t aac_enc_module;
|
||||
extern msrc_module_t h1v6_nv12_module;
|
||||
#endif
|
||||
#ifdef CONFIG_PLATFORM_8195BHP
|
||||
extern msrc_module_t h1v6_h264_module;
|
||||
extern msrc_module_t h1v6_jpeg_module;
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef _MMF_SOURCE_MJPG_FILE_H_
|
||||
#define _MMF_SOURCE_MJPG_FILE_H_
|
||||
|
||||
#include "sample_jpeg.h"
|
||||
|
||||
void* mjpgf_mod_open(void);
|
||||
void mjpgf_mod_close(void* ctx);
|
||||
int mjpgf_mod_set_param(void* ctx, int cmd, int arg);
|
||||
int mjpgf_mod_handle(void* ctx, void* b);
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#ifndef _MMF_SOURCE_MP4DE_H_
|
||||
#define _MMF_SOURCE_MP4DE_H_
|
||||
|
||||
|
||||
#define CMD_SET_SAMPLERATE 0x06
|
||||
#define CMD_SET_CHANNEL 0x07
|
||||
#define CMD_SET_CODEC 0x08
|
||||
#define CMD_SET_STREAMNUM 0x09
|
||||
#define CMD_SET_APPLY 0x1f
|
||||
|
||||
/*mp4 storage*/
|
||||
#define CMD_SET_ST_PERIOD 0X60
|
||||
#define CMD_SET_ST_TOTAL 0X61
|
||||
#define CMD_SET_ST_TYPE 0X62
|
||||
#define CMD_SET_ST_FILENAME 0x63
|
||||
#define CMD_SET_ST_START 0x64
|
||||
/*mp4 storage*/
|
||||
#define STORAGE_ALL 0
|
||||
#define STORAGE_VIDEO 1
|
||||
#define STORAGE_AUDIO 2
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef _MMF_SOURCE_PCMU_FILE_H_
|
||||
#define _MMF_SOURCE_PCMU_FILE_H_
|
||||
|
||||
#include "sample_pcmu.h"
|
||||
|
||||
void* pcmuf_mod_open(void);
|
||||
void pcmuf_mod_close(void* ctx);
|
||||
int pcmuf_mod_set_param(void* ctx, int cmd, int arg);
|
||||
int pcmuf_mod_handle(void* ctx, void* b);
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
#ifndef _MMF_SOURCE_PRO_AUDIO_H_
|
||||
#define _MMF_SOURCE_PRO_AUDIO_H_
|
||||
|
||||
#include "mmf_source.h"
|
||||
#include "cmsis.h"
|
||||
//#include "shell.h"
|
||||
//#include "main.h"
|
||||
//#include "hal_cache.h"
|
||||
//#include "hal_timer.h"
|
||||
#include "cmsis_os.h" // CMSIS RTOS header file
|
||||
#include <math.h>
|
||||
#include "hal_timer.h"
|
||||
#include "sgpio_api.h"
|
||||
#include "audio_api.h"
|
||||
//#include "g711/g711_codec.h"
|
||||
#include "../../../audio/g711/g711_codec.h"
|
||||
|
||||
#define DEBUG_LOG_BUF_SIZE 256
|
||||
#define G711_FSIZE 160
|
||||
#define RECV_PAGE_NUM 2
|
||||
|
||||
typedef enum {
|
||||
AUDIO_MODE_UNKNOWN = -1,
|
||||
AUDIO_MODE_G711A = 1,
|
||||
AUDIO_MODE_G711U = 2
|
||||
}Audio_mode;
|
||||
|
||||
typedef struct {
|
||||
Audio_mode mode; //intend to encode as G711A or G711U
|
||||
int len; //data length
|
||||
// _sema RWSema;
|
||||
unsigned char *raw_data; //address of buffered data (not encoded
|
||||
int data_start; // a shift value to show where the data starts
|
||||
int data_end; // a shift value shows data ending
|
||||
}audio_buf_context;
|
||||
|
||||
void* audio_mod_open(void);
|
||||
void audio_mod_close(void* ctx);
|
||||
int audio_mod_set_param(void* ctx, int cmd, int arg);
|
||||
int audio_mod_handle(void* ctx, void* b);
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
#define CMD_AUDIO_SET_FRAMETYPE 0x10
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef _MMF_SOURCE_PRO_AUDIO_H_
|
||||
#define _MMF_SOURCE_PRO_AUDIO_H_
|
||||
|
||||
#include "mmf_wrapper/mmf_wrapper_pro_audio.h"
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
#ifndef _MMF_SOURCE_RTP_H_
|
||||
#define _MMF_SOURCE_RTP_H_
|
||||
|
||||
#include "wifi_conf.h"
|
||||
#include "lwip/api.h" //netconn use
|
||||
#include <lwip/sockets.h>
|
||||
#include "rtsp/rtp_api.h"
|
||||
|
||||
#define MAX_SELECT_SOCKET 8
|
||||
#define DEFAULT_RTP_PORT 16384
|
||||
|
||||
#if CONFIG_EXAMPLE_MP3_STREAM_RTP
|
||||
#define G711_BLK_SIZE (634)
|
||||
#define AUDIO_BUF_SIZE (646) //160 BYTE DATA + 12 BYTE RTP HEADER
|
||||
#elif CONFIG_EXAMPLE_MEDIA_BISTREAM || CONFIG_EXAMPLE_MEDIA_H264_AND_TWO_WAY_AUDIO || CONFIG_MEDIA_STREAMING_AND_RECORDING
|
||||
#define G711_BLK_SIZE (160)
|
||||
#define AUDIO_BUF_SIZE (1500) //160 BYTE DATA + 12 BYTE RTP HEADER
|
||||
#else
|
||||
#define G711_BLK_SIZE (160)
|
||||
#define AUDIO_BUF_SIZE (172) //160 BYTE DATA + 12 BYTE RTP HEADER
|
||||
#endif
|
||||
|
||||
#define AUDIO_BUF_DEPTH (4)
|
||||
|
||||
typedef struct rtp_exbuf_type
|
||||
{
|
||||
u8 buf[AUDIO_BUF_SIZE];
|
||||
int len;
|
||||
}rtp_exbuf_t;
|
||||
|
||||
typedef struct rtp_client_type
|
||||
{
|
||||
TaskHandle_t task_handle;
|
||||
xQueueHandle cache_queue;
|
||||
xQueueHandle done_queue;
|
||||
struct connect_context connect_ctx;
|
||||
_sema rtp_sema;
|
||||
u8 rtp_shutdown;
|
||||
u8 rtp_socket_closed;
|
||||
}rtp_client_t;
|
||||
|
||||
void* rtp_mod_open(void);
|
||||
void rtp_mod_close(void* ctx);
|
||||
int rtp_mod_set_param(void* ctx, int cmd, int arg);
|
||||
int rtp_mod_handle(void* ctx, void* b);
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
#define CMD_RTP_SET_PRIV_BUF 0x10
|
||||
#define CMD_RTP_SET_SINK_MODULE 0x11
|
||||
#define CMD_RTP_SET_SUPPORTED_PAYLOAD_TYPE 0x12
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef _MMF_SOURCE_UVC_H_
|
||||
#define _MMF_SOURCE_UVC_H_
|
||||
|
||||
#include "videodev2.h"
|
||||
#include "uvcvideo.h"
|
||||
#include "v4l2_driver.h"
|
||||
#include "uvc_intf.h"
|
||||
|
||||
void* uvc_mod_open(void);
|
||||
void uvc_mod_close(void* ctx);
|
||||
int uvc_mod_set_param(void* ctx, int cmd, int arg);
|
||||
int uvc_mod_handle(void* ctx, void* b);
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
#define CMD_UVC_SET_HEIGHT 0x10
|
||||
#define CMD_UVC_SET_WIDTH 0x11
|
||||
#define CMD_UVC_SET_FRAMERATE 0x12
|
||||
#define CMD_UVC_SET_CPZRATIO 0x13
|
||||
#define CMD_UVC_SET_FRAMETYPE 0x14
|
||||
#define CMD_UVC_SET_APPLY 0x15
|
||||
#define CMD_UVC_GET_STREAM_READY 0x16
|
||||
#define CMD_UVC_GET_STREAM_STATUS 0x17
|
||||
|
||||
#endif
|
||||
3200
sdk/component/common/media/framework/mmf_source_modules/sample_aac.h
Normal file
3200
sdk/component/common/media/framework/mmf_source_modules/sample_aac.h
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
34405
sdk/component/common/media/framework/mmf_source_modules/sample_h264.h
Normal file
34405
sdk/component/common/media/framework/mmf_source_modules/sample_h264.h
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
14596
sdk/component/common/media/framework/mmf_source_modules/sample_pcmu.h
Normal file
14596
sdk/component/common/media/framework/mmf_source_modules/sample_pcmu.h
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef _MMF_WRAPPER_PRO_AUDIO_H_
|
||||
#define _MMF_WRAPPER_PRO_AUDIO_H_
|
||||
|
||||
#include "g711/g711_codec.h"
|
||||
|
||||
#define ENABLE_SPEEX_AEC (1)
|
||||
#define ENABLE_AAC_ENC (1)
|
||||
#define ENABLE_AAC_DEC (1)
|
||||
|
||||
#define AUDIO_DMA_PAGE_NUM 2
|
||||
#define AUDIO_DMA_PAGE_SIZE (320)
|
||||
|
||||
#define G711_FSIZE (160)
|
||||
|
||||
void *audio_wrapper_open();
|
||||
void audio_wrapper_close();
|
||||
int audio_wrapper_set_param(void *ctx, int cmd, int arg);
|
||||
int audio_wrapper_sink_mod_handle(void *ctx, void *b);
|
||||
int audio_wrapper_source_mod_handle(void *ctx, void *b);
|
||||
|
||||
/*customized CMDs used for this module - all customized CMDs should start from 0x10 at least*/
|
||||
#define CMD_AUDIO_SET_SOURCE_FRAMETYPE 0x10
|
||||
#define CMD_AUDIO_SET_SINK_FRAMETYPE 0x11
|
||||
#define CMD_AUDIO_TX_ENABLE 0x12
|
||||
#define CMD_AUDIO_RX_ENABLE 0x13
|
||||
|
||||
#define CMD_AUDIO_AACEN_SET_SAMPLERATE 0x20
|
||||
#define CMD_AUDIO_AACEN_SET_CHANNEL 0x21
|
||||
#define CMD_AUDIO_AACEN_SET_APPLY 0x22
|
||||
|
||||
#define CMD_AUDIO_AACDE_SET_SAMPLERATE 0x30
|
||||
#define CMD_AUDIO_AACDE_SET_CHANNEL 0x31
|
||||
#define CMD_AUDIO_AACDE_SET_APPLY 0x32
|
||||
|
||||
#endif
|
||||
85
sdk/component/common/media/framework/sensor_service.h
Normal file
85
sdk/component/common/media/framework/sensor_service.h
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
#ifndef _SENSOR_SERVICE_H_
|
||||
#define _SENSOR_SERVICE_H_
|
||||
|
||||
void init_sensor_service(void);
|
||||
|
||||
/**
|
||||
* ambient light sensor init
|
||||
*
|
||||
* @param param For future use.
|
||||
* @return 0 for success
|
||||
*/
|
||||
int ambient_light_sensor_init(void *param);
|
||||
|
||||
/**
|
||||
* Turn on ambient light sensor power.
|
||||
*
|
||||
* Some ambient light sensor has low power mode and able to save power while not in use.
|
||||
*
|
||||
* @param enable 1 for power on, 0 for power off
|
||||
* @return 0 for success
|
||||
*/
|
||||
int ambient_light_sensor_power(int enable);
|
||||
|
||||
/**
|
||||
* Get LUX (illuminance) from ambient light sensor
|
||||
*
|
||||
* @param sensibility Range:0~100. Ambient light sensor is able to adjust the integration time to get more precision lux value
|
||||
* @return 0 for success
|
||||
*/
|
||||
int ambient_light_sensor_get_lux(int sensibility);
|
||||
|
||||
/**
|
||||
* IR cut init
|
||||
*
|
||||
* @param param For future use.
|
||||
* @return 0 for success
|
||||
*/
|
||||
int ir_cut_init(void *param);
|
||||
|
||||
/**
|
||||
* enable/disable IR cut
|
||||
*
|
||||
* @param enable 1 for enable, 0 for disable
|
||||
* @return 0 for success
|
||||
*/
|
||||
int ir_cut_enable(int enable);
|
||||
|
||||
/**
|
||||
* IR ctrl init
|
||||
*
|
||||
* @param param For future use.
|
||||
* @return 0 for success
|
||||
*/
|
||||
int ir_ctrl_init(void *param);
|
||||
|
||||
/**
|
||||
* Adjust IR LED brightness
|
||||
*
|
||||
* @param brightness range:0.0~1.0
|
||||
* @return 0 for success
|
||||
*/
|
||||
int ir_ctrl_set_brightness(float brightness);
|
||||
|
||||
/**
|
||||
* enable/disable gray mode
|
||||
*
|
||||
* In low light situation, we can turn on IR LED to get enough light.
|
||||
* But it also turns thing red. So we need enter gray mode.
|
||||
*
|
||||
* @param enable 1 for enable, 0 for disable
|
||||
* @return 0 for success
|
||||
*/
|
||||
int sensor_external_set_gray_mode(int enable);
|
||||
|
||||
/**
|
||||
* loop routine
|
||||
*
|
||||
* If sensor implementation are block functions without and task swith, then we can put some delay here to let other task do their jobs.
|
||||
* We can also put some routine related to sensor here.
|
||||
*
|
||||
* @return 0 for success
|
||||
*/
|
||||
int sensor_external_loop();
|
||||
|
||||
#endif
|
||||
10
sdk/component/common/media/framework/snapshot_tftp_handler.h
Normal file
10
sdk/component/common/media/framework/snapshot_tftp_handler.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef SNAPSHOT_TFTP_HANDLER_H
|
||||
#define SNAPSHOT_TFTP_HANDLER_H
|
||||
|
||||
void jpeg_snapshot_create_tftp_thread();
|
||||
void jpeg_snapshot_set_tftp_host_ip(char* addr_string);
|
||||
char* jpeg_snapshot_get_tftp_host_ip();
|
||||
void jpeg_snapshot_set_filename(char* file_name);
|
||||
char* jpeg_snapshot_get_filename();
|
||||
|
||||
#endif /* SNAPSHOT_TFTP_HANDLER_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue