HxNvr/HxRtspBase/HxVideoFrame.h

47 lines
849 B
C
Raw Normal View History

2024-04-17 15:31:43 +08:00
#ifndef HXVIDEOFRAME_H
#define HXVIDEOFRAME_H
#include <QTime>
#include <QUuid>
#include <QObject>
#include <HxTrace.h>
extern "C"
{
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
}
typedef struct __HxVideoFrame
{
QDateTime time;
AVFormatContext *ifmt_ctx;
AVPacket *packet;
__HxVideoFrame() {}
__HxVideoFrame(QDateTime time, AVFormatContext *ifmt_ctx, AVPacket *packet)
{
this->time = time;
this->ifmt_ctx = ifmt_ctx;
this->packet = av_packet_clone(packet);
}
__HxVideoFrame copy() { return __HxVideoFrame(this->time, this->ifmt_ctx, this->packet); }
void free()
{
ifmt_ctx = nullptr;
if (packet)
{
av_packet_unref(packet);
av_packet_free(&packet);
}
}
} HxVideoFrame;
#endif // HXVIDEOFRAME_H