mirror of
https://github.com/pvvx/RTL00_WEB.git
synced 2025-07-31 20:31:05 +00:00
update
This commit is contained in:
parent
34d3652711
commit
39f77eb92b
1844 changed files with 899433 additions and 7 deletions
42
USDK/component/common/media/codec/aac/aac.h
Normal file
42
USDK/component/common/media/codec/aac/aac.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#ifndef _AAC_H
|
||||
#define _AAC_H
|
||||
|
||||
#include "dlist.h" //list management
|
||||
#include "basic_types.h"
|
||||
#include "osdep_service.h"
|
||||
//#include "osdep_api.h"
|
||||
|
||||
#define AAC_DEBUG 1
|
||||
|
||||
#if AAC_DEBUG
|
||||
#define AAC_PRINTF(fmt, args...) printf("\n\r%s: " fmt, __FUNCTION__, ## args)
|
||||
#define AAC_ERROR(fmt, args...) printf("\n\r%s: " fmt, __FUNCTION__, ## args)
|
||||
#else
|
||||
#define AAC_PRINTF(fmt, args...)
|
||||
#define AAC_ERROR(fmt, args...)
|
||||
#endif
|
||||
|
||||
struct rtp_au_hdr
|
||||
{
|
||||
u32 au_size; //contain AU size in octets(header length included)
|
||||
#if 0
|
||||
u16 au_index;
|
||||
u16 au_index_delta;
|
||||
u16 cts_flag;
|
||||
u16 cts_delta;
|
||||
u16 dts_flag;
|
||||
u16 dts_delta;
|
||||
u16 rap_flag;
|
||||
u16 stream_state;
|
||||
#endif
|
||||
u32 au_header_len; //record AU header size in octets
|
||||
};
|
||||
|
||||
struct rtp_aac_obj
|
||||
{
|
||||
u16 au_headers_len; //contain AU header size in octet (we will translate it into bit-wise count before sending)
|
||||
u8 au_header_num; //contain AU header number
|
||||
// struct rtp_au_hdr *au_hdr;
|
||||
};
|
||||
|
||||
#endif /*_AAC_H*/
|
||||
139
USDK/component/common/media/codec/avcodec.h
Normal file
139
USDK/component/common/media/codec/avcodec.h
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
#ifndef _AV_CODEC_H_
|
||||
#define _AV_CODEC_H_
|
||||
|
||||
/* Is this the place to include different codec header for rtp usage?*/
|
||||
|
||||
|
||||
struct codec_info
|
||||
{
|
||||
int codec_id;
|
||||
const char codec_name[8];
|
||||
u8 pt;
|
||||
u32 clock_rate;
|
||||
u8 audio_channels;
|
||||
void *priv;
|
||||
};
|
||||
|
||||
/* media type list -- range from 0-255 stored in 1 BYTE*/
|
||||
#define AVMEDIA_TYPE_VIDEO 0
|
||||
#define AVMEDIA_TYPE_AUDIO 1
|
||||
#define AVMEDIA_TYPE_SUBTITLE 2
|
||||
#define AVMEDIA_TYPE_UNKNOWN 255
|
||||
|
||||
/*codec id list -- id must match its placing order (starting from 0) in av_codec_tables*/
|
||||
|
||||
#define AV_CODEC_ID_MJPEG 0
|
||||
#define AV_CODEC_ID_H264 1
|
||||
#define AV_CODEC_ID_PCMU 2
|
||||
#define AV_CODEC_ID_PCMA 3
|
||||
#define AV_CODEC_ID_MP4A_LATM 4
|
||||
#define AV_CODEC_ID_MP4V_ES 5
|
||||
#define AV_CODEC_ID_UNKNOWN -1
|
||||
|
||||
/*rtp payload type mapping and standard rtp payload type table -- range from 0-255 in 1 BYTE*/
|
||||
#define RTP_PT_PCMU 0
|
||||
#define RTP_PT_GSM 3
|
||||
#define RTP_PT_G723 4
|
||||
#define RTP_PT_DVI4_R8000 5
|
||||
#define RTP_PT_DVI4_R16000 6
|
||||
#define RTP_PT_LPC 7
|
||||
#define RTP_PT_PCMA 8
|
||||
#define RTP_PT_G722 9
|
||||
#define RTP_PT_L16_C2 10
|
||||
#define RTP_PT_L16_C1 11
|
||||
#define RTP_PT_QCELP 12
|
||||
#define RTP_PT_CN 13
|
||||
#define RTP_PT_MPA 14
|
||||
#define RTP_PT_G728 15
|
||||
#define RTP_PT_DVI4_R11025 16
|
||||
#define RTP_PT_DVI4_R22050 17
|
||||
#define RTP_PT_G719 18
|
||||
#define RTP_PT_CELB 25
|
||||
#define RTP_PT_JPEG 26
|
||||
#define RTP_PT_NV 28
|
||||
#define RTP_PT_H261 31
|
||||
#define RTP_PT_MPV 32
|
||||
#define RTP_PT_MP2T 33
|
||||
#define RTP_PT_H263 34
|
||||
#define RTP_PT_RTCP_BASE 72
|
||||
#define RTP_PT_DYN_BASE 96
|
||||
#define RTP_PT_UNKNOWN 255
|
||||
/* AAC PROFILE */
|
||||
#define AV_PROFILE_AAC_MAIN 0
|
||||
#define AV_PROFILE_AAC_LOW 1
|
||||
#define AV_PROFILE_AAC_SSR 2
|
||||
#define AV_PROFILE_AAC_LTP 3
|
||||
#define AV_PROFILE_AAC_HE 4
|
||||
#define AV_PROFILE_AAC_HE_V2 28
|
||||
#define AV_PROFILE_AAC_LD 22
|
||||
#define AV_PROFILE_AAC_ELD 38
|
||||
#define AV_PROFILE_MPEG2_AAC_LOW 128
|
||||
#define AV_PROFILE_MPEG2_AAC_HE 131
|
||||
|
||||
#if 0
|
||||
/* MPEG4 VIDEO PROFILE */
|
||||
#define AV_PROFILE_MPEG4_SIMPLE 0
|
||||
#define AV_PROFILE_MPEG4_SIMPLE_SCALABLE 1
|
||||
#define AV_PROFILE_MPEG4_CORE 2
|
||||
#define AV_PROFILE_MPEG4_MAIN 3
|
||||
#define AV_PROFILE_MPEG4_N_BIT 4
|
||||
#define AV_PROFILE_MPEG4_SCALABLE_TEXTURE 5
|
||||
#define AV_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6
|
||||
#define AV_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7
|
||||
#define AV_PROFILE_MPEG4_HYBRID 8
|
||||
#define AV_PROFILE_MPEG4_ADVANCED_REAL_TIME 9
|
||||
#define AV_PROFILE_MPEG4_CORE_SCALABLE 10
|
||||
#define AV_PROFILE_MPEG4_ADVANCED_CODING 11
|
||||
#define AV_PROFILE_MPEG4_ADVANCED_CORE 12
|
||||
#define AV_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
|
||||
#define AV_PROFILE_MPEG4_SIMPLE_STUDIO 14
|
||||
#define AV_PROFILE_MPEG4_ADVANCED_SIMPLE 15
|
||||
/* DTS */
|
||||
#define AV_PROFILE_DTS 20
|
||||
#define AV_PROFILE_DTS_ES 30
|
||||
#define AV_PROFILE_DTS_96_24 40
|
||||
#define AV_PROFILE_DTS_HD_HRA 50
|
||||
#define AV_PROFILE_DTS_HD_MA 60
|
||||
#define AV_PROFILE_DTS_EXPRESS 70
|
||||
/* MPEG2 */
|
||||
#define AV_PROFILE_MPEG2_422 0
|
||||
#define AV_PROFILE_MPEG2_HIGH 1
|
||||
#define AV_PROFILE_MPEG2_SS 2
|
||||
#define AV_PROFILE_MPEG2_SNR_SCALABLE 3
|
||||
#define AV_PROFILE_MPEG2_MAIN 4
|
||||
#define AV_PROFILE_MPEG2_SIMPLE 5
|
||||
/* H264 */
|
||||
#define AV_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag
|
||||
#define AV_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag
|
||||
|
||||
#define AV_PROFILE_H264_BASELINE 66
|
||||
#define AV_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
|
||||
#define AV_PROFILE_H264_MAIN 77
|
||||
#define AV_PROFILE_H264_EXTENDED 88
|
||||
#define AV_PROFILE_H264_HIGH 100
|
||||
#define AV_PROFILE_H264_HIGH_10 110
|
||||
#define AV_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA)
|
||||
#define AV_PROFILE_H264_HIGH_422 122
|
||||
#define AV_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA)
|
||||
#define AV_PROFILE_H264_HIGH_444 144
|
||||
#define AV_PROFILE_H264_HIGH_444_PREDICTIVE 244
|
||||
#define AV_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)
|
||||
#define AV_PROFILE_H264_CAVLC_444 44
|
||||
#endif
|
||||
|
||||
/*av codec tables*/
|
||||
//#include "section_config.h"
|
||||
//SDRAM_DATA_SECTION
|
||||
static const struct codec_info av_codec_tables[] = {
|
||||
{AV_CODEC_ID_MJPEG, "MJPEG", RTP_PT_JPEG, 90000, 0, 0},
|
||||
{AV_CODEC_ID_H264, "H264", RTP_PT_DYN_BASE, 90000, 0, 0},
|
||||
{AV_CODEC_ID_PCMU, "PCMU", RTP_PT_PCMU, 8000, 1, 0},
|
||||
{AV_CODEC_ID_PCMA, "PCMA", RTP_PT_PCMA, 8000, 1, 0},
|
||||
{AV_CODEC_ID_MP4A_LATM, "MP4A", RTP_PT_DYN_BASE, 16000, 2, 0},
|
||||
{AV_CODEC_ID_MP4V_ES, "MP4V", RTP_PT_DYN_BASE, 90000, 0, 0},
|
||||
};
|
||||
#define AVCODEC_SIZE 6
|
||||
|
||||
void get_codec_by_id(struct codec_info *c, int id);
|
||||
|
||||
#endif //_AV_CODEC_H_
|
||||
27
USDK/component/common/media/codec/g711/g711.h
Normal file
27
USDK/component/common/media/codec/g711/g711.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
|
||||
#ifndef _G711_H
|
||||
#define _G711_H
|
||||
|
||||
#include "dlist.h" //list management
|
||||
#include "basic_types.h"
|
||||
#include "osdep_service.h"
|
||||
//#include "osdep_api.h"
|
||||
|
||||
#define G711_DEBUG 1
|
||||
|
||||
#if G711_DEBUG
|
||||
#define G711_PRINTF(fmt, args...) printf("\n\r%s: " fmt, __FUNCTION__, ## args)
|
||||
#define G711_ERROR(fmt, args...) printf("\n\r%s: " fmt, __FUNCTION__, ## args)
|
||||
#else
|
||||
#define G711_PRINTF(fmt, args...)
|
||||
#define G711_ERROR(fmt, args...)
|
||||
#endif
|
||||
|
||||
|
||||
//struct rtp_g711_obj {
|
||||
//};
|
||||
|
||||
|
||||
/*for debug purpose*/
|
||||
|
||||
#endif /*_G711_H*/
|
||||
75
USDK/component/common/media/codec/h264/h264.h
Normal file
75
USDK/component/common/media/codec/h264/h264.h
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
#ifndef _H264_H
|
||||
#define _H264_H
|
||||
|
||||
#include "dlist.h" //list management
|
||||
#include "basic_types.h"
|
||||
#include "osdep_service.h"
|
||||
//#include "osdep_api.h"
|
||||
|
||||
#define H264_DEBUG 0
|
||||
|
||||
#if H264_DEBUG
|
||||
#define H264_PRINTF(fmt, args...) printf("\n\r%s: " fmt, __FUNCTION__, ## args)
|
||||
#define H264_ERROR(fmt, args...) printf("\n\r%s: " fmt, __FUNCTION__, ## args)
|
||||
#else
|
||||
#define H264_PRINTF(fmt, args...)
|
||||
#define H264_ERROR(fmt, args...)
|
||||
#endif
|
||||
|
||||
#define MAX_NUM_NAL_PER_FRM 4
|
||||
|
||||
struct rtp_nal_obj
|
||||
{
|
||||
u8 start_code_len;
|
||||
unsigned char nal_header;
|
||||
u8 is_fu_start;
|
||||
u8 is_fu_end;
|
||||
u8 must_not_drop;
|
||||
u8 do_not_send;
|
||||
int offset;
|
||||
};
|
||||
|
||||
struct rtp_h264_obj
|
||||
{
|
||||
int num_nal;
|
||||
struct rtp_nal_obj nal_obj[MAX_NUM_NAL_PER_FRM];
|
||||
};
|
||||
|
||||
#endif /*_H264_H*/
|
||||
|
||||
#if 0
|
||||
|
||||
#ifndef _H264_H
|
||||
#define _H264_H
|
||||
|
||||
#include "dlist.h" //list management
|
||||
#include "basic_types.h"
|
||||
#include "osdep_service.h"
|
||||
//#include "osdep_api.h"
|
||||
|
||||
#define H264_DEBUG 0
|
||||
|
||||
#if H264_DEBUG
|
||||
#define H264_PRINTF(fmt, args...) printf("\n\r%s: " fmt, __FUNCTION__, ## args)
|
||||
#define H264_ERROR(fmt, args...) printf("\n\r%s: " fmt, __FUNCTION__, ## args)
|
||||
#else
|
||||
#define H264_PRINTF(fmt, args...)
|
||||
#define H264_ERROR(fmt, args...)
|
||||
#endif
|
||||
|
||||
/* in favor of rtp fragmentation */
|
||||
struct rtp_h264_obj
|
||||
{
|
||||
u8 start_code_len;
|
||||
unsigned char nal_header;
|
||||
u8 is_fu_start;
|
||||
u8 is_fu_end;
|
||||
u8 must_not_drop;
|
||||
};
|
||||
|
||||
|
||||
/********************************h264 over rtp******************************/
|
||||
|
||||
|
||||
#endif /*_H264_H*/
|
||||
#endif
|
||||
62
USDK/component/common/media/codec/mjpeg/mjpeg.h
Normal file
62
USDK/component/common/media/codec/mjpeg/mjpeg.h
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
|
||||
#ifndef _MJPEG_H
|
||||
#define _MJPEG_H
|
||||
|
||||
#include "dlist.h" //list management
|
||||
#include "basic_types.h"
|
||||
#include "osdep_service.h"
|
||||
//#include "osdep_api.h"
|
||||
|
||||
#define MJPEG_DEBUG 0
|
||||
|
||||
#if MJPEG_DEBUG
|
||||
#define MJPEG_PRINTF(fmt, args...) printf("\n\r%s: " fmt, __FUNCTION__, ## args)
|
||||
#define MJPEG_ERROR(fmt, args...) printf("\n\r%s: " fmt, __FUNCTION__, ## args)
|
||||
#else
|
||||
#define MJPEG_PRINTF(fmt, args...)
|
||||
#define MJPEG_ERROR(fmt, args...)
|
||||
#endif
|
||||
|
||||
struct jpeghdr {
|
||||
unsigned int tspec:8; /* type-specific field */
|
||||
unsigned int off:24; /* fragment byte offset */
|
||||
u8 type; /* id of jpeg decoder params */
|
||||
u8 q; /* quantization factor (or table id) */
|
||||
u8 width; /* frame width in 8 pixel blocks */
|
||||
u8 height; /* frame height in 8 pixel blocks */
|
||||
};
|
||||
|
||||
struct jpeghdr_rst {
|
||||
u16 dri; /*restart interval*/
|
||||
unsigned int f:1; /*restart first bit flag*/
|
||||
unsigned int l:1; /*restart last bit flag*/
|
||||
unsigned int count:14; /*restart count*/
|
||||
};
|
||||
|
||||
|
||||
struct jpeghdr_qtable {
|
||||
u8 mbz;
|
||||
u8 precision;
|
||||
u16 length;
|
||||
};
|
||||
|
||||
#define RTP_JPEG_RESTART 0x40
|
||||
#define USE_EXPLICIT_DQT 128
|
||||
#define USE_IMPLICIT_DQT 0
|
||||
|
||||
struct rtp_jpeg_obj
|
||||
{
|
||||
struct jpeghdr jpghdr;
|
||||
struct jpeghdr_rst rsthdr;
|
||||
struct jpeghdr_qtable qtable;
|
||||
u8 lqt[64*2]; /* Luma Quantizer table */
|
||||
u8 cqt[64*2]; /* Croma Quantizer table */
|
||||
int hdr_len;
|
||||
int frame_offset;
|
||||
};
|
||||
|
||||
/*for debug purpose*/
|
||||
void dumpJpegHeader(struct jpeghdr *jpghdr);
|
||||
void dumpRstDeader(struct jpeghdr_rst *rsthdr);
|
||||
|
||||
#endif /*_MJPEG_H*/
|
||||
89
USDK/component/common/media/framework/mmf_common.h
Normal file
89
USDK/component/common/media/framework/mmf_common.h
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
#ifndef _EXCHBUF_H
|
||||
#define _EXCHBUF_H
|
||||
#include "cmsis_os.h"
|
||||
#include "errno.h"
|
||||
|
||||
/*service task state*/
|
||||
#define S_STOP 0x00
|
||||
#define S_RUN 0x01
|
||||
#define S_FROZEN 0X02
|
||||
|
||||
#define CMD_SET_HEIGHT 0x00
|
||||
#define CMD_SET_WIDTH 0x01
|
||||
#define CMD_SET_BITRATE 0x02
|
||||
#define CMD_SET_FRAMERATE 0x03
|
||||
#define CMD_SET_CPZRATIO 0x04
|
||||
#define CMD_SET_FRAMETYPE 0x05
|
||||
#define CMD_SET_SAMPLERATE 0x06
|
||||
#define CMD_SET_CHANNEL 0x07
|
||||
#define CMD_SET_CODEC 0x08
|
||||
#define CMD_SET_STREAMNUM 0x09
|
||||
#define CMD_SET_SPS 0x0a
|
||||
#define CMD_SET_PPS 0x0b
|
||||
#define CMD_SET_LEVEL 0x0c
|
||||
#define CMD_SET_APPLY 0x1f
|
||||
#define CMD_SET_STREAMMING 0x20
|
||||
#define CMD_SET_INPUT_QUEUE 0x21
|
||||
#define CMD_SET_OUTPUT_QUEUE 0x22
|
||||
#define CMD_SET_PRIV_BUF 0x23
|
||||
#define CMD_SET_TASK_ON 0x24
|
||||
#define CMD_SET_TASK_FROZEN 0x25
|
||||
#define CMD_SET_TASK_OFF 0x26
|
||||
#define CMD_SELECT_CHANNEL 0x30
|
||||
#define CMD_SET_CB_START 0x40
|
||||
#define CMD_SET_CB_STOP 0x41
|
||||
#define CMD_SET_CB_PAUSE 0x42
|
||||
#define CMD_SET_CB_CUSTOMCMD 0x43
|
||||
#define CMD_FLUSH 0x50
|
||||
#define CMD_SET_FLAG 0X51
|
||||
#define CMD_GET_STREAM_READY 0x52
|
||||
#define CMD_GET_STREAM_STATUS 0x53
|
||||
|
||||
/*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
|
||||
|
||||
/*exchange buffer state*/
|
||||
#define STAT_INIT 0
|
||||
#define STAT_USED 1
|
||||
#define STAT_READY 2
|
||||
#define STAT_RESERVED 3
|
||||
|
||||
#define TIME_SYNC_EN 0
|
||||
#define TIME_SYNC_DIS 1
|
||||
|
||||
#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_AV_UNKNOWN 0xFF
|
||||
|
||||
#define MFT_CMD 0
|
||||
#define MFT_DATA 1
|
||||
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 codec_fmt; // FMT_V_xx or FMT_A_xx
|
||||
|
||||
uint32_t state;
|
||||
void* priv; // private use
|
||||
}exch_buf_t;
|
||||
|
||||
typedef int (*mmf_cb_t)(void*);
|
||||
#endif
|
||||
30
USDK/component/common/media/framework/mmf_sink.h
Normal file
30
USDK/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"
|
||||
|
||||
typedef struct _media_sink_module{
|
||||
void* (*create)(void);
|
||||
void (*destroy)(void*);
|
||||
int (*set_param)(void*, int, int);
|
||||
int (*handle)(void*, void*);
|
||||
}msink_module_t;
|
||||
|
||||
typedef struct _media_sink_context{
|
||||
xQueueHandle input_qid;
|
||||
xQueueHandle output_qid;
|
||||
int state;
|
||||
xTaskHandle hdl_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);
|
||||
int mmf_sink_put_frame(msink_context* ctx, exch_buf_t* exbuf);
|
||||
|
||||
// must be here
|
||||
#include "mmf_sink_modules/mmf_sink_list.h"
|
||||
#endif
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#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 mp4_module;
|
||||
#endif
|
||||
32
USDK/component/common/media/framework/mmf_source.h
Normal file
32
USDK/component/common/media/framework/mmf_source.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef _MEDIA_H
|
||||
#define _MEDIA_H
|
||||
#include "cmsis_os.h"
|
||||
#include "mmf_common.h"
|
||||
|
||||
typedef struct _media_source_module{
|
||||
void* (*create)(void);
|
||||
void (*destroy)(void*);
|
||||
int (*set_param)(void*, int, int);
|
||||
int (*handle)(void*, void*); // input output will cast to exch_buf_t
|
||||
}msrc_module_t;
|
||||
|
||||
|
||||
|
||||
typedef struct _media_source_context{
|
||||
xQueueHandle input_qid;
|
||||
xQueueHandle output_qid;
|
||||
int state;
|
||||
xTaskHandle hdl_task;
|
||||
|
||||
void* drv_priv;
|
||||
msrc_module_t* source;
|
||||
}msrc_context;
|
||||
|
||||
void mmf_source_close(msrc_context* ctx);
|
||||
msrc_context* mmf_source_open(msrc_module_t* source);
|
||||
int mmf_source_ctrl(msrc_context* ctx, int cmd, int arg);
|
||||
int mmf_source_get_frame(msrc_context* ctx, 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,35 @@
|
|||
#ifndef MMF_SOURCE_I2S_FILE_H
|
||||
#define MMF_SOURCE_I2S_FILE_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.c"
|
||||
#include "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
|
||||
|
||||
#endif /* MMF_SOURCE_I2S_FILE_H */
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#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 aacf_module;
|
||||
extern msrc_module_t pcmuf_module;
|
||||
extern msrc_module_t i2s_module;
|
||||
extern msrc_module_t rtp_src_module;
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load diff
34405
USDK/component/common/media/framework/mmf_source_modules/sample_h264.h
Normal file
34405
USDK/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
USDK/component/common/media/framework/mmf_source_modules/sample_pcmu.h
Normal file
14596
USDK/component/common/media/framework/mmf_source_modules/sample_pcmu.h
Normal file
File diff suppressed because it is too large
Load diff
110
USDK/component/common/media/muxer/mp4_encap.h
Normal file
110
USDK/component/common/media/muxer/mp4_encap.h
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
#ifndef _MP4_ENCAP_H_
|
||||
#define _MP4_ENCAP_H_
|
||||
|
||||
#include "basic_types.h"
|
||||
#include "osdep_service.h"
|
||||
|
||||
#define MAX_BOX_CHILD 8
|
||||
#define RBUF_SIZE 1024
|
||||
|
||||
typedef struct _mp4root{
|
||||
unsigned int video_len;
|
||||
unsigned int audio_len;
|
||||
unsigned int total;
|
||||
unsigned int keyindex;
|
||||
}MP4root,*PMP4root;
|
||||
|
||||
#define STORAGE_IDLE 0
|
||||
#define STORAGE_START 1
|
||||
#define STORAGE_WRITE_ALL 2
|
||||
#define STORAGE_WRITE_VIDEO 3
|
||||
#define STORAGE_WRITE_AUDIO 4
|
||||
#define STORAGE_STOP 5
|
||||
#define STORAGE_END 6
|
||||
|
||||
|
||||
#define STORAGE_ALL 0
|
||||
#define STORAGE_VIDEO 1
|
||||
#define STORAGE_AUDIO 2
|
||||
|
||||
typedef struct _mp4_payload{
|
||||
unsigned char *addr;
|
||||
unsigned int len;
|
||||
}mp4_payload,pmp4_payload;
|
||||
|
||||
typedef struct _mp4_write_info{
|
||||
int mp4_start_position;
|
||||
int mp4_end_position;
|
||||
int mp4_occupy_size;
|
||||
int mp4_empty_size;
|
||||
int mp4_write_start_position;
|
||||
int mp4_write_end_position;
|
||||
int mp4_write_occupy_size;
|
||||
int mp4_write_empty_size;
|
||||
int mp4_write_length;
|
||||
}mp4_winfo,*pmp4_winfo;
|
||||
|
||||
typedef struct _mp4_context{
|
||||
FATFS m_fs;
|
||||
int drv_num;
|
||||
char _drv[4];
|
||||
FIL m_file;
|
||||
char filename[32];
|
||||
int Fatfs_ok;
|
||||
int filecount;
|
||||
int width;
|
||||
int height;
|
||||
int sample_rate;
|
||||
int channel_count;
|
||||
int frame_rate;
|
||||
u32 start_time;//rtw_get_current_time()
|
||||
u32 file_name_index;
|
||||
u32 storage_state;
|
||||
MP4root root;
|
||||
MP4root root_reserve;
|
||||
int period_time;
|
||||
int file_total;
|
||||
int sps_start;
|
||||
int type;
|
||||
int sps_len;
|
||||
int pps_len;
|
||||
int sps_pps_mark;
|
||||
unsigned int *video_buffer_index;
|
||||
unsigned int *video_buffer_size;
|
||||
int video_size;
|
||||
unsigned int *audio_buffer_index;
|
||||
unsigned int *audio_buffer_size;
|
||||
int audio_size;
|
||||
unsigned char *moov_box;
|
||||
int moov_box_size;
|
||||
unsigned char *h264_buf;
|
||||
int H264_LENGTH;
|
||||
mp4_payload payload;
|
||||
mp4_payload reserved_payload;
|
||||
int reserved_start_index;
|
||||
int iframe;
|
||||
int reserved_type;
|
||||
_sema start_fatfs_write;
|
||||
int write_status;
|
||||
int audio_write_status;
|
||||
int video_write_status;
|
||||
int buffer_write_status;//0: real write 1: virtual write
|
||||
mp4_winfo winfo;
|
||||
int nal_len;
|
||||
int h264_extra_len;
|
||||
int mp4_muxer_enable;
|
||||
}mp4_context,*pmp4_context;
|
||||
#define IDLE 0
|
||||
#define FATFS_WRITING 1
|
||||
#define FATFS_DONE 2
|
||||
|
||||
void mp4_handle(pmp4_context mp4_ctx,unsigned char *buf,unsigned int size,int type);
|
||||
void set_mp4_audio_buffer(pmp4_context mp4_ctx,unsigned int *audio_index,unsigned int *audio_size,int size);
|
||||
void set_mp4_video_buffer(pmp4_context mp4_ctx,unsigned int *video_index,unsigned int *video_size,int size);
|
||||
void set_mp4_moov_buffer(pmp4_context mp4_ctx,unsigned char *moov,int size);
|
||||
int mp4_set_record(pmp4_context mp4_ctx,int num);
|
||||
void mp4_muxer_init(pmp4_context mp4_ctx);
|
||||
void mp4_muxer_close(pmp4_context mp4_ctx);
|
||||
int mp4_set_start_status(pmp4_context mp4_ctx);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue