/* * softdevice plugin for VDR * * Copyright (C) 2005 Martin Wache * * This code is distributed under the terms and conditions of the * GNU GENERAL PUBLIC LICENSE. See the file COPYING for details. * * $Id: PicBuffer.h,v 1.12 2009-06-14 16:37:22 lucke Exp $ */ #ifndef __PIC_BUFFER_H__ #define __PIC_BUFFER_H__ #ifdef HAVE_CONFIG # include "config.h" #endif extern "C" { #if HAVE_FFMPEG_LOCAL # include #else # include #endif } #ifndef STAND_ALONE #include #include #else #include "VdrReplacements.h" #endif class cPicBufferManager; typedef struct { PixelFormat format; uint8_t *pixel[4]; int stride[4]; unsigned int use_count; // count the users of this buffer int buf_num; int max_width; // maximal size of the picture edge + picture int max_height; cPicBufferManager *owner; // picture context int edge_width; // size of edges (needed by some ffmpeg codecs) int edge_height; int width; // size of the actual picture (without edges) int height; int dtg_active_format; float aspect_ratio; int64_t pts; bool interlaced_frame; int top_field_first; int pict_type; int pic_num; // to calculate the age int age; // needed by ffmpeg void *priv_data; } sPicBuffer; void InitPicBuffer(sPicBuffer *Pic); void FillPicBuffer(sPicBuffer *Pic, int color); void ClearPicBuffer(sPicBuffer *Pic); void CopyPicBufferContext(sPicBuffer *dest,sPicBuffer *orig); bool AllocatePicBuffer(sPicBuffer *buf,PixelFormat pix_fmt,int w, int h); void DeallocatePicBuffer(sPicBuffer *buf); int GetFormatBPP(PixelFormat fmt); void GetChromaSubSample(PixelFormat pix_fmt, int &hChromaShift, int &vChromaShift); class cPicBufferManager { public: int lastPicNum; #define LAST_PICBUF 10 sPicBuffer PicBuffer[LAST_PICBUF]; cMutex PicBufMutex; cPicBufferManager(); virtual ~cPicBufferManager(); inline sPicBuffer *PicBuf(unsigned int buf_num) { return ( buf_num