Permalink
Browse files

vdpau: cosmetics

  • Loading branch information...
FernetMenta committed Nov 7, 2011
1 parent 9308421 commit 0de726f3303488e3170c2254b40db892061e68f4
Showing with 18 additions and 20 deletions.
  1. +17 −20 xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
  2. +1 −0 xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h
@@ -1077,6 +1077,21 @@ void CVDPAU::SpewHardwareAvailable() //Copyright (c) 2008 Wladimir J. van der L
}
+bool CVDPAU::IsSurfaceValid(vdpau_render_state *render)
+{
+ // find render state in queue
+ bool found(false);
+ for(unsigned int i = 0; i < m_videoSurfaces.size(); ++i)
+ {
+ if(m_videoSurfaces[i] == render)
+ {
+ found = true;
+ break;
+ }
+ }
+ return found;
+}
+
int CVDPAU::FFGetBuffer(AVCodecContext *avctx, AVFrame *pic)
{
//CLog::Log(LOGNOTICE,"%s",__FUNCTION__);
@@ -1185,16 +1200,7 @@ void CVDPAU::FFReleaseBuffer(AVCodecContext *avctx, AVFrame *pic)
pic->data[i]= NULL;
// find render state in queue
- bool found(false);
- for(i = 0; i < vdp->m_videoSurfaces.size(); ++i)
- {
- if(vdp->m_videoSurfaces[i] == render)
- {
- found = true;
- break;
- }
- }
- if (!found)
+ if (!vdp->IsSurfaceValid(render))
{
CLog::Log(LOGDEBUG, "CVDPAU::FFReleaseBuffer - ignoring invalid buffer");
return;
@@ -1320,16 +1326,7 @@ int CVDPAU::Decode(AVCodecContext *avctx, AVFrame *pFrame)
return VC_ERROR;
// ffmpeg vc-1 decoder does not flush, make sure the data buffer is still valid
- bool found(false);
- for(unsigned int i = 0; i < m_videoSurfaces.size(); ++i)
- {
- if(m_videoSurfaces[i] == render)
- {
- found = true;
- break;
- }
- }
- if (!found)
+ if (!IsSurfaceValid(render))
{
CLog::Log(LOGWARNING, "CVDPAU::Decode - ignoring invalid buffer");
return VC_BUFFER;
@@ -100,6 +100,7 @@ class CVDPAU
void SpewHardwareAvailable();
void InitCSCMatrix(int Height);
bool CheckStatus(VdpStatus vdp_st, int line);
+ bool IsSurfaceValid(vdpau_render_state *render);
void CheckFeatures();
void SetColor();

0 comments on commit 0de726f

Please sign in to comment.