#include #include #include #include #include #include #include #include #include #include #include #include #include //#include "fy_type.h" #include #include #include #include #include #include #include "types/type_def.h" #include "dsp/fh_system_mpi.h" #include "dsp/fh_venc_mpi.h" #include "dsp/fh_jpege_mpi.h" #include "dsp/fh_vdec_mpi.h" #include "sample_opts.h" #include "vmm_api.h" #include #define HTTP_MJPEG_PORT (1111) #define YUV_BUF_NUM 3 enum stream_type { FH_PES = 0x1, FH_RTSP = 0x2, FH_HTTP = 0x4, FH_RAW = 0x8, }; struct stream_info { FH_UINT32 grpid; enum stream_type type; }; #define MAX_GRP_NUM 4 static struct stream_info g_stream_info[MAX_GRP_NUM]; static FH_VOID _get_stream_info_type() { memset(g_stream_info, 0, sizeof(g_stream_info)); g_stream_info[0].type |= FH_RTSP; } FH_SINT32 sample_dmc_init(FH_CHAR *dst_ip, FH_UINT32 port) { FH_SINT32 rtspgrp; // FH_SINT32 rawgrp; _get_stream_info_type(); dmc_init(); rtspgrp = 7; // rawgrp = 0; dmc_rtsp_subscribe(rtspgrp, port); dmc_http_mjpeg_subscribe(HTTP_MJPEG_PORT); return 0; } FH_SINT32 sample_dmc_deinit(FH_VOID) { dmc_rtsp_unsubscribe(); dmc_http_mjpeg_unsubscribe(); dmc_deinit(); return 0; } #define DUMP_MJPEG 0 #define DUMP_STREAM 0 FH_VOID *sample_common_get_stream_proc(FH_VOID *arg) { FH_SINT32 ret, i; FH_SINT32 end_flag; FH_SINT32 subtype; FH_VENC_STREAM stream; // FH_SINT32 mediaType = 0; int chn=0; unsigned int*p = (unsigned int*)arg; unsigned int chns = p[0]; unsigned int *stop = (p+1); #if(DUMP_STREAM) int chan_cnts[4] = {0,0,0,0}; FILE* fps[4] = {NULL,NULL,NULL,NULL}; char fname[128]; #define DUMP_CNT 50 #endif prctl(PR_SET_NAME, "demo_get_stream"); printf("chns: 0x%x\n",chns); while (*stop == 0) { //WR_PROC_DEV(TRACE_PROC, "timing_GetStream_START"); /*阻塞模式下,获取一帧H264或者H265数据*/ #if 0 ret = -1; if((chns & (1<enType = PT_JPEG; pstVdecChnAttr->u32BufSize = 1920 * 1080/2; pstVdecChnAttr->u32Priority = 5; pstVdecChnAttr->u32PicWidth = 3840; pstVdecChnAttr->u32PicHeight = 2160; pstVdecChnAttr->stVdecJpegAttr.enMode = VIDEO_MODE_FRAME; pstVdecChnAttr->stVdecJpegAttr.enJpegFormat = JPG_COLOR_FMT_YCBCR420; FH_VDEC_SetChnVBCnt(0, 1); FH_VDEC_CreateChn(0, pstVdecChnAttr); FH_VDEC_StartRecvStream(0); #endif printf("Enter %s\n",__FUNCTION__); while (*stop == 0) { for(chn=0;chn<8;chn++){ if(!(chns & (1<