1 /** 2 \brief VDPAU filters Deinterlacer 3 \author mean (C) 2010 4 5 This version uses openGL to convert the output surface to YV12 6 7 8 */ 9 10 // 11 #define ADM_INVALID_FRAME_NUM 0x80000000 12 #define ADM_NB_SURFACES 5 13 14 15 enum 16 { 17 ADM_KEEP_TOP=0, 18 ADM_KEEP_BOTTOM=1, 19 ADM_KEEP_BOTH=2 20 }; 21 /** 22 \class VDPSlot 23 */ 24 class VDPSlot 25 { 26 public: 27 VDPSlot() ; 28 ~VDPSlot(); 29 VdpVideoSurface surface; 30 bool isExternal; 31 uint64_t pts; 32 uint32_t frameNumber; 33 ADMImage *image; 34 }; 35 /** 36 \class glRGB 37 */ 38 class glRGB : public ADM_coreVideoFilterQtGl 39 { 40 protected: 41 42 protected: 43 bool render(ADMImage *image,ADM_PLANE plane,QGLFramebufferObject *fbo); 44 45 public: 46 glRGB(ADM_coreVideoFilter *previous,CONFcouple *conf); 47 ~glRGB(); 48 qreal realMatrix[4*4]; getConfiguration(void)49 virtual const char *getConfiguration(void) {return "none";}; /// Return current configuration as a human readable string 50 virtual bool getNextFrame(uint32_t *fn,ADMImage *image); /// Return the next image 51 virtual bool getCoupledConf(CONFcouple **couples) ; /// Return the current filter configuration 52 virtual void setCoupledConf(CONFcouple *couples); configure(void)53 virtual bool configure(void) {return true;} /// Start graphical user interface 54 55 bool surfaceToImage(VdpOutputSurface surf,ADMImage *image); /// VDPAU->openGL 56 bool imageToImage(const char *buffer,ADMImage *image); /// VDPAU->CPU->OpenGL (slow) 57 bool probe(VdpOutputSurface surf,ADMImage *image); 58 }; 59 60 /** 61 \class vdpauVideoFilterDeint 62 */ 63 class vdpauVideoFilterDeint : public ADM_coreVideoFilter 64 { 65 protected: 66 VDPSlot xslots[3]; 67 bool eof; 68 bool secondField; 69 uint64_t nextPts; 70 ADMColorScalerSimple *scaler; 71 bool passThrough; 72 bool setupVdpau(void); 73 bool cleanupVdpau(void); 74 bool updateConf(void); 75 uint8_t *tempBuffer; 76 vdpauFilterDeint configuration; 77 VdpOutputSurface outputSurface; 78 std::list <VdpVideoSurface> freeSurface; 79 VdpVideoSurface surfacePool[ADM_NB_SURFACES]; 80 VdpVideoMixer mixer; 81 glRGB *rgb; 82 protected: 83 bool initGl(void); 84 bool initOnceGl(void); 85 bool deInitGl(void); 86 protected: 87 bool rotateSlots(void); 88 bool clearSlots(void); 89 bool uploadImage(ADMImage *next,const VdpVideoSurface surface) ; 90 bool fillSlot(int slot,ADMImage *image); 91 bool getResult(ADMImage *image); 92 bool getResultSlow(ADMImage *image); 93 bool sendField(bool topField); 94 95 public: 96 virtual bool goToTime(uint64_t usSeek); 97 vdpauVideoFilterDeint(ADM_coreVideoFilter *previous,CONFcouple *conf); 98 ~vdpauVideoFilterDeint(); 99 100 virtual const char *getConfiguration(void); /// Return current configuration as a human readable string 101 virtual bool getNextFrame(uint32_t *fn,ADMImage *image); /// Return the next image 102 virtual bool getCoupledConf(CONFcouple **couples) ; /// Return the current filter configuration 103 virtual bool configure(void) ; /// Start graphical user interface 104 }; 105 106 //EOF 107 108 // EOF 109