47 lines
849 B
C
47 lines
849 B
C
|
#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
|