zoneminder/src/zm_packet.h

70 lines
2.1 KiB
C
Raw Normal View History

//ZoneMinder Packet Wrapper Class
//Copyright 2017 ZoneMinder LLC
//
//This file is part of ZoneMinder.
//
//ZoneMinder is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//ZoneMinder is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with ZoneMinder. If not, see <http://www.gnu.org/licenses/>.
#ifndef ZM_PACKET_H
#define ZM_PACKET_H
extern "C" {
#include <libavformat/avformat.h>
}
#ifdef __FreeBSD__
#include <sys/time.h>
#endif // __FreeBSD__
#include "zm_image.h"
#include "zm_thread.h"
class ZMPacket {
public:
Mutex mutex;
int keyframe;
2017-10-10 03:32:09 +08:00
AVPacket packet; // Input packet, undecoded
AVFrame *in_frame; // Input image, decoded Theoretically only filled if needed.
AVFrame *out_frame; // Input image, decoded Theoretically only filled if needed.
2017-11-22 08:55:40 +08:00
uint8_t *buffer;
Image *image; // Our internal image object representing this frame
Image *analysis_image; // Our internal image object representing this frame
int score;
struct timeval *timestamp;
2017-11-21 00:48:56 +08:00
AVMediaType codec_type;
2017-11-22 08:55:40 +08:00
int image_index;
2017-12-01 03:37:36 +08:00
public:
AVPacket *av_packet() { return &packet; }
AVPacket *set_packet( AVPacket *p ) ;
AVFrame *av_frame() { return out_frame; }
Image *get_image( Image *i=NULL );
Image *set_image( Image * );
int is_keyframe() { return keyframe; };
int decode( AVCodecContext *ctx );
2017-11-14 01:14:57 +08:00
void reset();
2017-11-18 03:30:38 +08:00
explicit ZMPacket( Image *image );
explicit ZMPacket( ZMPacket &packet );
ZMPacket();
~ZMPacket();
void lock() { mutex.lock(); };
void unlock() { mutex.unlock(); };
AVFrame *get_out_frame( const AVCodecContext *ctx );
};
#endif /* ZM_PACKET_H */