add and update

This commit is contained in:
pvvx 2016-11-22 07:48:09 +03:00
parent 03ed2886cb
commit bda4d33012
109 changed files with 73065 additions and 85 deletions

View 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

View 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

View file

@ -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

View 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

View file

@ -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 */

View file

@ -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

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff