推流:代码移植后,运行成功,但是遥控器无法正常显示摄像头画面;
This commit is contained in:
63
samples/sample_c/module_sample/camera_emu/ffmpeg_tc.h
Normal file
63
samples/sample_c/module_sample/camera_emu/ffmpeg_tc.h
Normal file
@ -0,0 +1,63 @@
|
||||
//
|
||||
// Created by tangchao on 2021/11/16.
|
||||
//
|
||||
|
||||
#ifndef PSDK_DEMO_FFMPEG_TC_H
|
||||
#define PSDK_DEMO_FFMPEG_TC_H
|
||||
|
||||
|
||||
//tc开始
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <libavutil/avassert.h>
|
||||
#include <libavutil/channel_layout.h>
|
||||
#include <libavutil/opt.h>
|
||||
#include <libavutil/mathematics.h>
|
||||
#include <libavutil/timestamp.h>
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libswscale/swscale.h>
|
||||
#include <libswresample/swresample.h>
|
||||
#include "libavdevice/avdevice.h"
|
||||
|
||||
#include <libavutil/imgutils.h>
|
||||
|
||||
#include <unistd.h>//usleep
|
||||
|
||||
|
||||
#define STREAM_DURATION 50.0 /*录制视频的持续时间 秒*/
|
||||
#define STREAM_FRAME_RATE 15 /* images/s 这里可以根据摄像头的采集速度来设置帧率 */
|
||||
#define STREAM_PIX_FMT AV_PIX_FMT_YUV420P /* default pix_fmt */
|
||||
#define SCALE_FLAGS SWS_BICUBIC
|
||||
//tc结束
|
||||
|
||||
|
||||
//存放视频的宽度和高度
|
||||
int video_width;
|
||||
int video_height;
|
||||
|
||||
|
||||
typedef struct IntputDev
|
||||
{
|
||||
AVCodecContext *pCodecCtx;
|
||||
AVCodec *pCodec;
|
||||
AVFormatContext *v_ifmtCtx;
|
||||
int videoindex;
|
||||
struct SwsContext *img_convert_ctx;
|
||||
AVPacket *in_packet;
|
||||
AVFrame *pFrame,*pFrameYUV;
|
||||
|
||||
/*下一帧的点数*/
|
||||
int64_t next_pts;
|
||||
}IntputDev;
|
||||
|
||||
char *getsystemtime();
|
||||
AVFrame *get_video_frame(IntputDev* input);
|
||||
//static void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt);
|
||||
void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt, char **data, int *datasize);
|
||||
char * encode2(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt, int *datasize);
|
||||
|
||||
#endif //PSDK_DEMO_FFMPEG_TC_H
|
Reference in New Issue
Block a user