Bugfix: PGS YVU => YUV
[xy_vsfilter.git] / src / subpic / PooledSubPic.h
blob77ab6de2f5a2cf3477a53d65e3ba823ec75d5591
1 #pragma once
3 #include "StdAfx.h"
4 #include "MemSubPic.h"
5 //#include <atlcoll.h>
7 using namespace std;
9 class CPooledSubPic;
10 interface IPooledAllocator
12 STDMETHOD_(void, ReleaseItem)(void* Item) PURE;
13 STDMETHOD_(void, OnItemDestruct)(void* Item) PURE;
16 class CPooledSubPicAllocator : public CSubPicExAllocatorImpl//, public IPooledAllocator
18 public:
19 STDMETHODIMP_(void) ReleaseItem(void* Item);
20 STDMETHODIMP_(void) OnItemDestruct(void* Item);
22 bool STDMETHODCALLTYPE InitPool(int capacity);
24 CPooledSubPicAllocator(int alpha_blt_dst_type, SIZE maxsize, int capacity, int type=-1 );
25 virtual ~CPooledSubPicAllocator();
26 private:
27 CCritSec _poolLock;
29 int _type;
30 int _alpha_blt_dst_type;
31 CSize _maxsize;
32 int _capacity;
33 CAtlList<CPooledSubPic*> _free;
34 CAtlList<CPooledSubPic*> _using;
36 CPooledSubPic* DoAlloc();
37 virtual bool AllocEx(bool fStatic, ISubPicEx** ppSubPic);
39 void CollectUnUsedItem();
40 STDMETHODIMP_(int) SetSpdColorType(int color_type);
41 STDMETHODIMP_(bool) IsSpdColorTypeSupported(int type);
44 class CPooledSubPic : public CMemSubPic
46 friend class CPooledSubPicAllocator;
47 public:
48 CPooledSubPic(SubPicDesc& spd, int alpha_blt_dst_type, CPooledSubPicAllocator* pool):CMemSubPic(spd, alpha_blt_dst_type),_pool(pool){}
49 virtual ~CPooledSubPic();
51 private:
52 CCritSec _csLock;
53 CPooledSubPicAllocator* _pool;