From 382c3d3656a74a469501468895a178988fddc4ed Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Wed, 14 Jun 2006 21:39:47 +0000 Subject: [PATCH] *** empty log message *** --- player.cc | 9 +- player.h | 2 +- surface.cc | 1 - surface.h | 1 - surfacewin.cc | 321 +++++++++++++++++++++++++------------------------- surfacewin.h | 3 +- 6 files changed, 169 insertions(+), 168 deletions(-) diff --git a/player.cc b/player.cc index 88331ab..ad51549 100644 --- a/player.cc +++ b/player.cc @@ -285,8 +285,11 @@ int Player::playInt(bool* doUnlock) audio->reset(); video->reset(); demuxer->reset(); - if (startFrameNum > lengthFrames) startFrameNum = 0; - demuxer->setFrameNum(startFrameNum); + if (isRecording) + { + if (startFrameNum > lengthFrames) startFrameNum = 0; + demuxer->setFrameNum(startFrameNum); + } if (!isRadio) demuxer->seek(); videoStartup = true; @@ -491,6 +494,7 @@ void Player::unLock() #endif } +/* void Player::restartAt(ULLONG timecode) { if (paused) togglePauseInt(); @@ -522,6 +526,7 @@ void Player::restartAt(ULLONG timecode) audio->doMuting(); fbwd = false; } +*/ void Player::restartAtFrame(ULONG newFrame) { diff --git a/player.h b/player.h index 4d8a25e..92d3efa 100644 --- a/player.h +++ b/player.h @@ -92,7 +92,7 @@ class Player : public Thread_TYPE, public Callback void setEndTS(); void doConnectionLost(); - void restartAt(ULLONG timeCode); +// void restartAt(ULLONG timeCode); void restartAtFrame(ULONG newFrame); MessageQueue* commandMessageQueue; diff --git a/surface.cc b/surface.cc index 04c1d5a..8a4c42b 100644 --- a/surface.cc +++ b/surface.cc @@ -1,6 +1,5 @@ /* Copyright 2004-2005 Chris Tallon - Portions copyright 2004 Jon Gettler This file is part of VOMP. diff --git a/surface.h b/surface.h index 66fb5fe..557f630 100644 --- a/surface.h +++ b/surface.h @@ -1,6 +1,5 @@ /* Copyright 2004-2005 Chris Tallon - Portions copyright 2004 Jon Gettler This file is part of VOMP. diff --git a/surfacewin.cc b/surfacewin.cc index 8cc3fbb..0cb251e 100644 --- a/surfacewin.cc +++ b/surfacewin.cc @@ -1,6 +1,5 @@ /* - Copyright 2004-2005 Chris Tallon - Portions copyright 2004 Jon Gettler + Copyright 2006 Marten Richter This file is part of VOMP. @@ -26,54 +25,54 @@ SurfaceWin::SurfaceWin(int id) : Surface(id) { - d3dtexture=NULL; - d3dsurface=NULL; - sheight=swidth=0; - event = CreateEvent(NULL,/*FALSE*/TRUE,FALSE,NULL); + d3dtexture=NULL; + d3dsurface=NULL; + sheight=swidth=0; + event = CreateEvent(NULL,/*FALSE*/TRUE,FALSE,NULL); } SurfaceWin::~SurfaceWin() { - if (d3dsurface) d3dsurface->Release(); - if (d3dtexture) d3dtexture->Release(); - CloseHandle(event); + if (d3dsurface) d3dsurface->Release(); + if (d3dtexture) d3dtexture->Release(); + CloseHandle(event); } int SurfaceWin::create(UINT width, UINT height) { - LPDIRECT3DDEVICE9 d3ddev=((OsdWin*)(Osd::getInstance()))->getD3dDev(); - while (true) { - if (screen==this) { - if (d3ddev->CreateTexture(1024,1024,0,0,D3DFMT_A8R8G8B8, - // Does every adapter with alpha blending support this? - D3DPOOL_DEFAULT,&d3dtexture ,NULL)!=D3D_OK) { - MILLISLEEP(50);//wait maybe next time it will work - continue; - } - if (d3dtexture->GetSurfaceLevel(0,&d3dsurface)!=D3D_OK) { - d3dtexture->Release(); - d3dtexture=NULL; - MILLISLEEP(50); - continue; - } - } else { - HRESULT hres; - if (hres=d3ddev->CreateOffscreenPlainSurface(width,height,D3DFMT_A8R8G8B8, - D3DPOOL_SYSTEMMEM,&d3dsurface,NULL)!=D3D_OK) { - MILLISLEEP(50);//wait maybe next time it will work - continue; - } - - } - sheight=height; - swidth=width; - /* If someone does high performance Animations on the OSD, we have to change the types - of surface in order to address these performance issues, if we have only very few updates - per second this would be fast enough !*/ - break; - } - SetEvent(event); - return 1; + LPDIRECT3DDEVICE9 d3ddev=((OsdWin*)(Osd::getInstance()))->getD3dDev(); + while (true) { + if (screen==this) { + if (d3ddev->CreateTexture(1024,1024,0,0,D3DFMT_A8R8G8B8, + // Does every adapter with alpha blending support this? + D3DPOOL_DEFAULT,&d3dtexture ,NULL)!=D3D_OK) { + MILLISLEEP(50);//wait maybe next time it will work + continue; + } + if (d3dtexture->GetSurfaceLevel(0,&d3dsurface)!=D3D_OK) { + d3dtexture->Release(); + d3dtexture=NULL; + MILLISLEEP(50); + continue; + } + } else { + HRESULT hres; + if (hres=d3ddev->CreateOffscreenPlainSurface(width,height,D3DFMT_A8R8G8B8, + D3DPOOL_SYSTEMMEM,&d3dsurface,NULL)!=D3D_OK) { + MILLISLEEP(50);//wait maybe next time it will work + continue; + } + + } + sheight=height; + swidth=width; + /* If someone does high performance Animations on the OSD, we have to change the types + of surface in order to address these performance issues, if we have only very few updates + per second this would be fast enough !*/ + break; + } + SetEvent(event); + return 1; } void SurfaceWin::display() @@ -85,44 +84,44 @@ int SurfaceWin::fillblt(int x, int y, int width, int height, unsigned int c) WaitForSingleObject(event,INFINITE); //since this might be called before surface //allocation we will wait in this case, hopefully without deadlocks OsdWin* osd=((OsdWin*)(Osd::getInstance())); - + if (!d3dsurface) { - return 0; //why does this happen + return 0; //why does this happen } LPDIRECT3DDEVICE9 d3ddev=osd->getD3dDev(); - + if (screen==this) { - //This should not happen! - return 0; + //This should not happen! + return 0; } else { - osd->BeginPainting(); - D3DLOCKED_RECT lockrect; - int cx,cy,cwidth,cheight; - cx=min(max(x,0),swidth); - cy=min(max(y,0),sheight); - cwidth=min(width,swidth-x); - cheight=min(height,sheight-y); - RECT rect={cx,cy,cwidth,cheight}; - - if (d3dsurface->LockRect(&lockrect,&rect,D3DLOCK_DISCARD)!=D3D_OK) { - return 0; - } - unsigned int line; - unsigned int column; - for (line=0;lineUnlockRect()!=D3D_OK) { - osd->EndPainting(); - return 0; - } - osd->EndPainting(); + osd->BeginPainting(); + D3DLOCKED_RECT lockrect; + int cx,cy,cwidth,cheight; + cx=min(max(x,0),swidth); + cy=min(max(y,0),sheight); + cwidth=min(width,swidth-x); + cheight=min(height,sheight-y); + RECT rect={cx,cy,cwidth,cheight}; + + if (d3dsurface->LockRect(&lockrect,&rect,D3DLOCK_DISCARD)!=D3D_OK) { + return 0; + } + unsigned int line; + unsigned int column; + for (line=0;lineUnlockRect()!=D3D_OK) { + osd->EndPainting(); + return 0; + } + osd->EndPainting(); } return 0; @@ -134,65 +133,65 @@ void SurfaceWin::drawPixel(int x, int y, unsigned int c) WaitForSingleObject(event,INFINITE); //since this might be called before surface //allocation we will wait in this case, hopefully without deadlocks if (!d3dsurface) { - return; //why does this happen + return; //why does this happen } OsdWin* osd=((OsdWin*)(Osd::getInstance())); LPDIRECT3DDEVICE9 d3ddev=osd->getD3dDev(); if (x>swidth || y>sheight) return; //do not draw outside the surface if (screen==this) { - //This should not happen! - return ; + //This should not happen! + return ; } else { - osd->BeginPainting(); - D3DLOCKED_RECT lockrect; - RECT rect={x,y,x+1,y+1}; - if (d3dsurface->LockRect(&lockrect,&rect,D3DLOCK_DISCARD)!=D3D_OK) { - osd->EndPainting(); - return ; - } - unsigned int*row=(unsigned int*)(((char*)lockrect.pBits)); - row[0]=c; - if (d3dsurface->UnlockRect()!=D3D_OK) { - osd->EndPainting(); - return ; - } - osd->EndPainting(); + osd->BeginPainting(); + D3DLOCKED_RECT lockrect; + RECT rect={x,y,x+1,y+1}; + if (d3dsurface->LockRect(&lockrect,&rect,D3DLOCK_DISCARD)!=D3D_OK) { + osd->EndPainting(); + return ; + } + unsigned int*row=(unsigned int*)(((char*)lockrect.pBits)); + row[0]=c; + if (d3dsurface->UnlockRect()!=D3D_OK) { + osd->EndPainting(); + return ; + } + osd->EndPainting(); } } void SurfaceWin::drawHorzLine(int x1, int x2, int y, unsigned int c) { - fillblt(x1, y, x2-x1, 1, c); + fillblt(x1, y, x2-x1, 1, c); } void SurfaceWin::drawVertLine(int x, int y1, int y2, unsigned int c) { - fillblt(x, y1, 1, y2-y1, c); + fillblt(x, y1, 1, y2-y1, c); } int SurfaceWin::updateToScreen(int sx, int sy, int w, int h, int dx, int dy) // FIXME new, replace others with this FIXME { - WaitForSingleObject(event,INFINITE); //since this might be called before surface + WaitForSingleObject(event,INFINITE); //since this might be called before surface //allocation we will wait in this case, hopefully without deadlocks - if (!d3dsurface) { - return 0; //why does this happen - } - OsdWin* osd=((OsdWin*)(Osd::getInstance())); - LPDIRECT3DDEVICE9 d3ddev=osd->getD3dDev(); + if (!d3dsurface) { + return 0; //why does this happen + } + OsdWin* osd=((OsdWin*)(Osd::getInstance())); + LPDIRECT3DDEVICE9 d3ddev=osd->getD3dDev(); LPDIRECT3DSURFACE9 screensurface=((SurfaceWin*)screen)->getD3dsurface(); - if (!screensurface) return 0; - RECT sourcerect={sx,sy,sx+w,sy+h}; - POINT destpoint={dx,dy}; - osd->BeginPainting(); - if (d3ddev->UpdateSurface(d3dsurface,&sourcerect,screensurface,&destpoint)!=D3D_OK) { - Log::getInstance()->log("Surface", Log::DEBUG, "Could not update to Screen!"); - osd->EndPainting(); - return 0; - } - osd->EndPainting(); - return 0; + if (!screensurface) return 0; + RECT sourcerect={sx,sy,sx+w,sy+h}; + POINT destpoint={dx,dy}; + osd->BeginPainting(); + if (d3ddev->UpdateSurface(d3dsurface,&sourcerect,screensurface,&destpoint)!=D3D_OK) { + Log::getInstance()->log("Surface", Log::DEBUG, "Could not update to Screen!"); + osd->EndPainting(); + return 0; + } + osd->EndPainting(); + return 0; } int SurfaceWin::blt(int fd, unsigned long shandle, int sx, int sy, int width, int height, unsigned long dhandle, int dx, int dy) @@ -203,68 +202,68 @@ int SurfaceWin::blt(int fd, unsigned long shandle, int sx, int sy, int width, in void SurfaceWin::screenShot(char* fileName) { - //Isn't this for debugging only, so I won't implement it yet + //Isn't this for debugging only, so I won't implement it yet } void SurfaceWin::readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b) { - //Isn't this for debugging only, so I won't implement it yet + //Isn't this for debugging only, so I won't implement it yet } void SurfaceWin::ReleaseSurface() { - ResetEvent(event); - LPDIRECT3DSURFACE9 temp_surf=d3dsurface; - LPDIRECT3DTEXTURE9 temp_text=d3dtexture; - d3dsurface=NULL; - d3dtexture=NULL; - sheight=swidth=0; - if (temp_surf) temp_surf->Release(); - if (temp_text) temp_text->Release(); + ResetEvent(event); + LPDIRECT3DSURFACE9 temp_surf=d3dsurface; + LPDIRECT3DTEXTURE9 temp_text=d3dtexture; + d3dsurface=NULL; + d3dtexture=NULL; + sheight=swidth=0; + if (temp_surf) temp_surf->Release(); + if (temp_text) temp_text->Release(); } void SurfaceWin::drawJpeg(char *fileName,DWORD x, DWORD y,DWORD *width, DWORD *height){ - WaitForSingleObject(event,INFINITE); //since this might be called before surface + WaitForSingleObject(event,INFINITE); //since this might be called before surface //allocation we will wait in this case, hopefully without deadlocks - if (!d3dsurface) { - return ; //why does this happen - } - OsdWin* osd=((OsdWin*)(Osd::getInstance())); - - - D3DXIMAGE_INFO image_inf; - osd->BeginPainting(); -// D3DXGetImageInfoFromFile(fileName,&image_inf); - D3DXGetImageInfoFromResource(NULL,fileName,&image_inf); - RECT dest_rec={x,y,x+image_inf.Width, - y+image_inf.Height}; -/* if (D3DXLoadSurfaceFromFile( - d3dsurface, - NULL, - &dest_rec, - fileName, - NULL, - D3DX_FILTER_NONE, - 0, - &image_inf)!=D3D_OK) { - Log::getInstance()->log("Surface", Log::DEBUG, "Could not open jpeg!"); - - }*/ - if (D3DXLoadSurfaceFromResource( - d3dsurface, - NULL, - &dest_rec, - NULL, - fileName, - NULL, - D3DX_FILTER_NONE, - 0, - &image_inf)!=D3D_OK) { - Log::getInstance()->log("Surface", Log::DEBUG, "Could not open jpeg!"); - - } - osd->EndPainting(); - *width=image_inf.Width; - *height=image_inf.Height; - + if (!d3dsurface) { + return ; //why does this happen + } + OsdWin* osd=((OsdWin*)(Osd::getInstance())); + + + D3DXIMAGE_INFO image_inf; + osd->BeginPainting(); +// D3DXGetImageInfoFromFile(fileName,&image_inf); + D3DXGetImageInfoFromResource(NULL,fileName,&image_inf); + RECT dest_rec={x,y,x+image_inf.Width, + y+image_inf.Height}; +/* if (D3DXLoadSurfaceFromFile( + d3dsurface, + NULL, + &dest_rec, + fileName, + NULL, + D3DX_FILTER_NONE, + 0, + &image_inf)!=D3D_OK) { + Log::getInstance()->log("Surface", Log::DEBUG, "Could not open jpeg!"); + + }*/ + if (D3DXLoadSurfaceFromResource( + d3dsurface, + NULL, + &dest_rec, + NULL, + fileName, + NULL, + D3DX_FILTER_NONE, + 0, + &image_inf)!=D3D_OK) { + Log::getInstance()->log("Surface", Log::DEBUG, "Could not open jpeg!"); + + } + osd->EndPainting(); + *width=image_inf.Width; + *height=image_inf.Height; + } diff --git a/surfacewin.h b/surfacewin.h index 104aec6..6409103 100644 --- a/surfacewin.h +++ b/surfacewin.h @@ -1,6 +1,5 @@ /* - Copyright 2004-2005 Chris Tallon - Portions copyright 2004 Jon Gettler + Copyright 2006 Marten Richter This file is part of VOMP. -- 2.39.5