feat: 新增视频推流(待优化)
parent
2eb9906370
commit
945bca9356
@ -0,0 +1,20 @@
|
||||
#ifndef FFMPEGINCLUDE_H
|
||||
#define FFMPEGINCLUDE_H
|
||||
|
||||
extern "C" {
|
||||
#include "libavcodec/avcodec.h"
|
||||
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavutil/channel_layout.h>
|
||||
#include <libavutil/common.h>
|
||||
#include <libavutil/frame.h>
|
||||
#include <libavutil/imgutils.h>
|
||||
#include <libavutil/mem.h>
|
||||
#include <libavutil/opt.h>
|
||||
#include <libavutil/parseutils.h>
|
||||
#include <libavutil/samplefmt.h>
|
||||
#include <libavutil/time.h>
|
||||
#include <libswscale/swscale.h>
|
||||
}
|
||||
|
||||
#endif // FFMPEGINCLUDE_H
|
@ -0,0 +1,32 @@
|
||||
#ifndef FFMPEGPUSHSTREAM_H
|
||||
#define FFMPEGPUSHSTREAM_H
|
||||
|
||||
#include "ffmpeginclude.h"
|
||||
#include <QDebug>
|
||||
#include <QObject>
|
||||
|
||||
class FFmpegPushStream : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FFmpegPushStream(QObject *parent = nullptr);
|
||||
/**
|
||||
* @brief 设置推流地址
|
||||
* @param url 远端推流地址
|
||||
*/
|
||||
void setRemoteIP(QString url);
|
||||
signals:
|
||||
|
||||
private:
|
||||
AVFormatContext *inputFormatCtx = nullptr; //
|
||||
AVFormatContext *outputFormatCtx = NULL; //
|
||||
AVCodecContext *encoderCtx = nullptr; //
|
||||
const AVCodec *encoder = nullptr; // 编码器
|
||||
int videoIndex = -1;
|
||||
QString pushStreamIP; // 推流地址
|
||||
bool mInitStatus = false;
|
||||
public slots:
|
||||
int pushStream(AVPacket *pkt, int frm_cnt);
|
||||
int openNetworkStream(AVFormatContext *inputFormatCtx);
|
||||
};
|
||||
|
||||
#endif // FFMPEGPUSHSTREAM_H
|
Loading…
Reference in New Issue