70 m_backgroundFrame = 0; |
68 m_backgroundFrame = 0; |
71 } |
69 } |
72 |
70 |
73 void VideoFrame::copyMembers(const VideoFrame& frame) |
71 void VideoFrame::copyMembers(const VideoFrame& frame) |
74 { |
72 { |
75 #ifdef CACHE_CV_TEXTURE |
|
76 m_cachedCVTextureRef = frame.m_cachedCVTextureRef; |
73 m_cachedCVTextureRef = frame.m_cachedCVTextureRef; |
77 #endif |
|
78 m_cachedCIImage = frame.m_cachedCIImage; |
74 m_cachedCIImage = frame.m_cachedCIImage; |
79 m_cachedQImage = frame.m_cachedQImage; |
75 m_cachedQImage = frame.m_cachedQImage; |
80 m_cachedNSBitmap = frame.m_cachedNSBitmap; |
76 m_cachedNSBitmap = frame.m_cachedNSBitmap; |
81 m_videoPlayer = frame.m_videoPlayer; |
77 m_videoPlayer = frame.m_videoPlayer; |
82 m_brightness = frame.m_brightness; |
78 m_brightness = frame.m_brightness; |
107 return m_videoPlayer->videoRect(); |
103 return m_videoPlayer->videoRect(); |
108 } |
104 } |
109 |
105 |
110 CVOpenGLTextureRef VideoFrame::cachedCVTexture() const |
106 CVOpenGLTextureRef VideoFrame::cachedCVTexture() const |
111 { |
107 { |
112 #ifdef CACHE_CV_TEXTURE |
|
113 if (!m_cachedCVTextureRef && m_videoPlayer){ |
108 if (!m_cachedCVTextureRef && m_videoPlayer){ |
114 m_videoPlayer->setColors(m_brightness, m_contrast, m_hue, m_saturation); |
109 m_videoPlayer->setColors(m_brightness, m_contrast, m_hue, m_saturation); |
115 (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = m_videoPlayer->currentFrameAsCVTexture(); |
110 (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = m_videoPlayer->currentFrameAsCVTexture(); |
116 CVOpenGLTextureRetain((const_cast<VideoFrame *>(this))->m_cachedCVTextureRef); |
|
117 } |
111 } |
118 return m_cachedCVTextureRef; |
112 return m_cachedCVTextureRef; |
119 #else |
|
120 if (m_videoPlayer){ |
|
121 m_videoPlayer->setColors(m_brightness, m_contrast, m_hue, m_saturation); |
|
122 return m_videoPlayer->currentFrameAsCVTexture(); |
|
123 } |
|
124 return 0; |
|
125 #endif |
|
126 } |
113 } |
127 |
114 |
128 void *VideoFrame::cachedCIImage() const |
115 void *VideoFrame::cachedCIImage() const |
129 { |
116 { |
130 if (!m_cachedCIImage && m_videoPlayer){ |
117 if (!m_cachedCIImage && m_videoPlayer){ |
340 return (m_videoPlayer == 0); |
327 return (m_videoPlayer == 0); |
341 } |
328 } |
342 |
329 |
343 void VideoFrame::invalidateImage() const |
330 void VideoFrame::invalidateImage() const |
344 { |
331 { |
345 #ifdef CACHE_CV_TEXTURE |
|
346 if (m_cachedCVTextureRef){ |
332 if (m_cachedCVTextureRef){ |
347 CVOpenGLTextureRelease(m_cachedCVTextureRef); |
333 CVOpenGLTextureRelease(m_cachedCVTextureRef); |
348 (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = 0; |
334 (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = 0; |
349 } |
335 } |
350 #endif |
|
351 if (m_cachedCIImage){ |
336 if (m_cachedCIImage){ |
352 [(CIImage *) m_cachedCIImage release]; |
337 [(CIImage *) m_cachedCIImage release]; |
353 (const_cast<VideoFrame *>(this))->m_cachedCIImage = 0; |
338 (const_cast<VideoFrame *>(this))->m_cachedCIImage = 0; |
354 } |
339 } |
355 if (m_cachedNSBitmap){ |
340 if (m_cachedNSBitmap){ |
359 (const_cast<VideoFrame *>(this))-> m_cachedQImage = QImage(); |
344 (const_cast<VideoFrame *>(this))-> m_cachedQImage = QImage(); |
360 } |
345 } |
361 |
346 |
362 void VideoFrame::retain() const |
347 void VideoFrame::retain() const |
363 { |
348 { |
364 #ifdef CACHE_CV_TEXTURE |
|
365 if (m_cachedCVTextureRef) |
349 if (m_cachedCVTextureRef) |
366 CVOpenGLTextureRetain(m_cachedCVTextureRef); |
350 CVOpenGLTextureRetain(m_cachedCVTextureRef); |
367 #endif |
|
368 if (m_cachedCIImage) |
351 if (m_cachedCIImage) |
369 [(CIImage *) m_cachedCIImage retain]; |
352 [(CIImage *) m_cachedCIImage retain]; |
370 if (m_backgroundFrame) |
353 if (m_backgroundFrame) |
371 m_backgroundFrame->retain(); |
354 m_backgroundFrame->retain(); |
372 if (m_cachedNSBitmap) |
355 if (m_cachedNSBitmap) |
373 [m_cachedNSBitmap retain]; |
356 [m_cachedNSBitmap retain]; |
374 } |
357 } |
375 |
358 |
376 void VideoFrame::release() const |
359 void VideoFrame::release() const |
377 { |
360 { |
378 #ifdef CACHE_CV_TEXTURE |
361 if (m_cachedCVTextureRef) |
379 if (m_cachedCVTextureRef){ |
|
380 CVOpenGLTextureRelease(m_cachedCVTextureRef); |
362 CVOpenGLTextureRelease(m_cachedCVTextureRef); |
381 (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = 0; |
|
382 } |
|
383 #endif |
|
384 if (m_cachedCIImage) |
363 if (m_cachedCIImage) |
385 [(CIImage *) m_cachedCIImage release]; |
364 [(CIImage *) m_cachedCIImage release]; |
386 if (m_backgroundFrame) |
365 if (m_backgroundFrame) |
387 m_backgroundFrame->release(); |
366 m_backgroundFrame->release(); |
388 if (m_cachedNSBitmap) |
367 if (m_cachedNSBitmap) |
389 [m_cachedNSBitmap release]; |
368 [m_cachedNSBitmap release]; |
390 |
369 |
391 (const_cast<VideoFrame *>(this))->m_backgroundFrame = 0; |
370 (const_cast<VideoFrame *>(this))->m_backgroundFrame = 0; |
|
371 (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = 0; |
392 (const_cast<VideoFrame *>(this))->m_cachedCIImage = 0; |
372 (const_cast<VideoFrame *>(this))->m_cachedCIImage = 0; |
393 (const_cast<VideoFrame *>(this))->m_cachedNSBitmap = 0; |
373 (const_cast<VideoFrame *>(this))->m_cachedNSBitmap = 0; |
394 } |
374 } |
395 |
375 |
396 }} //namespace Phonon::QT7 |
376 }} //namespace Phonon::QT7 |