diff options
Diffstat (limited to 'VideoPreview')
-rw-r--r-- | VideoPreview/src/base/UMusic.pas | 75 | ||||
-rw-r--r-- | VideoPreview/src/media/UMedia_dummy.pas | 126 | ||||
-rw-r--r-- | VideoPreview/src/media/UVideo.pas | 165 | ||||
-rw-r--r-- | VideoPreview/src/media/UVisualizer.pas | 129 | ||||
-rw-r--r-- | VideoPreview/src/menu/UMenuBackgroundVideo.pas | 3 | ||||
-rw-r--r-- | VideoPreview/src/screens/UScreenSing.pas | 3 |
6 files changed, 459 insertions, 42 deletions
diff --git a/VideoPreview/src/base/UMusic.pas b/VideoPreview/src/base/UMusic.pas index 7f2b3e30..1c6b3a85 100644 --- a/VideoPreview/src/base/UMusic.pas +++ b/VideoPreview/src/base/UMusic.pas @@ -43,6 +43,27 @@ uses type TNoteType = (ntFreestyle, ntNormal, ntGolden); + {** + * acoStretch: Stretch to screen width and height + * - ignores aspect + * + no borders + * + no image data loss + * acoCrop: Stretch to screen width or height, crop the other dimension + * + keeps aspect + * + no borders + * - frame borders are cropped (image data loss) + * acoLetterBox: Stretch to screen width, add bars at or crop top and bottom + * + keeps aspect + * - borders at top and bottom + * o top/bottom is cropped if width < height (unusual) + *} + TAspectCorrection = (acoStretch, acoCrop, acoLetterBox); + + TRectCoords = record + Left, Right: double; + Upper, Lower: double; + end; + const // ScoreFactor defines how a notehit of a specified notetype is // measured in comparison to the other types @@ -334,9 +355,49 @@ type procedure SetPosition(Time: real); function GetPosition: real; - procedure GetFrame(Time: Extended); - procedure DrawGL(Screen: integer); + procedure SetScreen(Screen: integer); + function GetScreen(): integer; + + procedure SetScreenPosition(X, Y: double; Z: double = 0.0); + procedure GetScreenPosition(var X, Y, Z: double); + + procedure SetWidth(Width: double); + function GetWidth(): double; + + procedure SetHeight(Height: double); + function GetHeight(): double; + + {** + * Sub-image of the video frame to draw. + * This can be used for zooming or similar purposes. + *} + procedure SetFrameRange(Range: TRectCoords); + function GetFrameRange(): TRectCoords; + + function GetFrameAspect(): real; + + procedure SetAspectCorrection(AspectCorrection: TAspectCorrection); + function GetAspectCorrection(): TAspectCorrection; + + + procedure SetAlpha(Alpha: double); + function GetAlpha(): double; + + procedure SetReflectionSpacing(Spacing: double); + function GetReflectionSpacing(): double; + procedure GetFrame(Time: Extended); + procedure Draw(); + procedure DrawReflection(); + + + property Screen: integer read GetScreen; + property Width: double read GetWidth write SetWidth; + property Height: double read GetHeight write SetWidth; + property Alpha: double read GetAlpha write SetAlpha; + property ReflectionSpacing: double read GetReflectionSpacing write SetReflectionSpacing; + property FrameAspect: real read GetFrameAspect; + property AspectCorrection: TAspectCorrection read GetAspectCorrection; property Loop: boolean read GetLoop write SetLoop; property Position: real read GetPosition write SetPosition; end; @@ -414,7 +475,15 @@ type (* IVideoDecoder = Interface( IGenericDecoder ) ['{2F184B2B-FE69-44D5-9031-0A2462391DCA}'] - function Open(const Filename: IPath): TVideoDecodeStream; + function Open(const Filename: IPath): TVideoDecodeStream; + + procedure SetPosition(Time: real); + function GetPosition: real; + + procedure UpdateTexture(Texture: glUint); + + property Loop: boolean read GetLoop write SetLoop; + property Position: real read GetPosition write SetPosition; end; *) diff --git a/VideoPreview/src/media/UMedia_dummy.pas b/VideoPreview/src/media/UMedia_dummy.pas index 8ebfd3a9..a77579f4 100644 --- a/VideoPreview/src/media/UMedia_dummy.pas +++ b/VideoPreview/src/media/UMedia_dummy.pas @@ -112,9 +112,43 @@ type procedure SetPosition(Time: real); function GetPosition: real; - procedure GetFrame(Time: Extended); - procedure DrawGL(Screen: integer); + procedure SetScreen(Screen: integer); + function GetScreen(): integer; + + procedure SetScreenPosition(X, Y: double; Z: double = 0.0); + procedure GetScreenPosition(var X, Y, Z: double); + + procedure SetWidth(Width: double); + function GetWidth(): double; + + procedure SetHeight(Height: double); + function GetHeight(): double; + + procedure SetFrameRange(Range: TRectCoords); + function GetFrameRange(): TRectCoords; + + function GetFrameAspect(): real; + + procedure SetAspectCorrection(AspectCorrection: TAspectCorrection); + function GetAspectCorrection(): TAspectCorrection; + + procedure SetAlpha(Alpha: double); + function GetAlpha(): double; + + procedure SetReflectionSpacing(Spacing: double); + function GetReflectionSpacing(): double; + procedure GetFrame(Time: Extended); + procedure Draw(); + procedure DrawReflection(); + + property Screen: integer read GetScreen; + property Width: double read GetWidth write SetWidth; + property Height: double read GetHeight write SetWidth; + property Alpha: double read GetAlpha write SetAlpha; + property ReflectionSpacing: double read GetReflectionSpacing write SetReflectionSpacing; + property FrameAspect: real read GetFrameAspect; + property AspectCorrection: TAspectCorrection read GetAspectCorrection; property Loop: boolean read GetLoop write SetLoop; property Position: real read GetPosition write SetPosition; end; @@ -329,11 +363,97 @@ begin Result := 0; end; +procedure TVideo_Dummy.SetScreen(Screen: integer); +begin +end; + +function TVideo_Dummy.GetScreen(): integer; +begin + Result := 0; +end; + +procedure TVideo_Dummy.SetScreenPosition(X, Y: double; Z: double = 0.0); +begin +end; + +procedure TVideo_Dummy.GetScreenPosition(var X, Y, Z: double); +begin + X := 0; + Y := 0; + Z := 0; +end; + +procedure TVideo_Dummy.SetWidth(Width: double); +begin +end; + +function TVideo_Dummy.GetWidth(): double; +begin + Result := 0; +end; + +procedure TVideo_Dummy.SetHeight(Height: double); +begin +end; + +function TVideo_Dummy.GetHeight(): double; +begin + Result := 0; +end; + +procedure TVideo_Dummy.SetFrameRange(Range: TRectCoords); +begin +end; + +function TVideo_Dummy.GetFrameRange(): TRectCoords; +begin + Result.Left := 0; + Result.Right := 0; + Result.Upper := 0; + Result.Lower := 0; +end; + +function TVideo_Dummy.GetFrameAspect(): real; +begin + Result := 0; +end; + +procedure TVideo_Dummy.SetAspectCorrection(AspectCorrection: TAspectCorrection); +begin +end; + +function TVideo_Dummy.GetAspectCorrection(): TAspectCorrection; +begin + Result := acoStretch; +end; + +procedure TVideo_Dummy.SetAlpha(Alpha: double); +begin +end; + +function TVideo_Dummy.GetAlpha(): double; +begin + Result := 0; +end; + +procedure TVideo_Dummy.SetReflectionSpacing(Spacing: double); +begin +end; + +function TVideo_Dummy.GetReflectionSpacing(): double; +begin + Result := 0; +end; + procedure TVideo_Dummy.GetFrame(Time: Extended); begin end; -procedure TVideo_Dummy.DrawGL(Screen: integer); +procedure TVideo_Dummy.Draw(); +begin +end; + +procedure TVideo_Dummy.DrawReflection(); begin end; diff --git a/VideoPreview/src/media/UVideo.pas b/VideoPreview/src/media/UVideo.pas index c7d59fc8..28b19223 100644 --- a/VideoPreview/src/media/UVideo.pas +++ b/VideoPreview/src/media/UVideo.pas @@ -48,24 +48,6 @@ interface {$DEFINE PIXEL_FMT_BGR} {$ENDIF} -type - {** - * vacStretch: Stretch to screen width and height - * - ignores aspect - * + no borders - * + no image data loss - * vacCrop: Stretch to screen width or height, crop the other dimension - * + keeps aspect - * + no borders - * - frame borders are cropped (image data loss) - * vacLetterBox: Stretch to screen width, add bars at or crop top and bottom - * + keeps aspect - * - borders at top and bottom - * o top/bottom is cropped if width < height (unusual) - *} - TAspectCorrection = (acoStretch, acoCrop, acoLetterBox); - - implementation uses @@ -113,11 +95,6 @@ const {$ENDIF} type - TRectCoords = record - Left, Right: double; - Upper, Lower: double; - end; - IVideo_FFmpeg = interface (IVideo) ['{E640E130-C8C0-4399-AF02-67A3569313AB}'] function Open(const FileName: IPath): boolean; @@ -149,6 +126,8 @@ type fSwScaleContext: PSwsContext; {$ENDIF} + fScreen: integer; //actual screen to draw on + fAspect: real; //**< width/height ratio fAspectCorrection: TAspectCorrection; @@ -183,8 +162,40 @@ type procedure SetPosition(Time: real); function GetPosition: real; - procedure GetFrame(Time: Extended); - procedure DrawGL(Screen: integer); + procedure SetScreen(Screen: integer); + function GetScreen(): integer; + + procedure SetScreenPosition(X, Y: double; Z: double = 0.0); + procedure GetScreenPosition(var X, Y, Z: double); + + procedure SetWidth(Width: double); + function GetWidth(): double; + + procedure SetHeight(Height: double); + function GetHeight(): double; + + {** + * Sub-image of the video frame to draw. + * This can be used for zooming or similar purposes. + *} + procedure SetFrameRange(Range: TRectCoords); + function GetFrameRange(): TRectCoords; + + function GetFrameAspect(): real; + + procedure SetAspectCorrection(AspectCorrection: TAspectCorrection); + function GetAspectCorrection(): TAspectCorrection; + + + procedure SetAlpha(Alpha: double); + function GetAlpha(): double; + + procedure SetReflectionSpacing(Spacing: double); + function GetReflectionSpacing(): double; + + procedure GetFrame(Time: Extended); + procedure Draw(); + procedure DrawReflection(); end; TVideoPlayback_FFmpeg = class( TInterfacedObject, IVideoPlayback ) @@ -935,7 +946,7 @@ begin TexRect.Lower := fCodecContext^.height / fTexHeight; end; -procedure TVideo_FFmpeg.DrawGL(Screen: integer); +procedure TVideo_FFmpeg.Draw(); var ScreenRect: TRectCoords; TexRect: TRectCoords; @@ -945,7 +956,7 @@ begin // TODO: Philipp: IMO TVideoPlayback should not clear the screen at // all, because clearing is already done by the background class // at this moment. - if (Screen = 1) then + if (fScreen = 1) then begin // It is important that we just clear once before we start // drawing the first screen otherwise the first screen @@ -998,6 +1009,11 @@ begin {$IFEND} end; +procedure TVideo_FFmpeg.DrawReflection(); +begin + +end; + procedure TVideo_FFmpeg.ShowDebugInfo(); begin {$IFDEF Info} @@ -1107,6 +1123,101 @@ begin Result := fFrameTime; end; +procedure TVideo_FFmpeg.SetScreen(Screen: integer); +begin + +end; + +function TVideo_FFmpeg.GetScreen(): integer; +begin + +end; + + +procedure TVideo_FFmpeg.SetScreenPosition(X, Y: double; Z: double = 0.0); +begin + +end; + +procedure TVideo_FFmpeg.GetScreenPosition(var X, Y, Z: double); +begin + +end; + + +procedure TVideo_FFmpeg.SetWidth(Width: double); +begin + +end; + +function TVideo_FFmpeg.GetWidth(): double; +begin + +end; + + +procedure TVideo_FFmpeg.SetHeight(Height: double); +begin + +end; + +function TVideo_FFmpeg.GetHeight(): double; +begin + +end; + + +procedure TVideo_FFmpeg.SetFrameRange(Range: TRectCoords); +begin + +end; + +function TVideo_FFmpeg.GetFrameRange(): TRectCoords; +begin + +end; + + +function TVideo_FFmpeg.GetFrameAspect(): real; +begin + +end; + + +procedure TVideo_FFmpeg.SetAspectCorrection(AspectCorrection: TAspectCorrection); +begin + +end; + +function TVideo_FFmpeg.GetAspectCorrection(): TAspectCorrection; +begin + +end; + + + +procedure TVideo_FFmpeg.SetAlpha(Alpha: double); +begin + +end; + +function TVideo_FFmpeg.GetAlpha(): double; +begin + +end; + + +procedure TVideo_FFmpeg.SetReflectionSpacing(Spacing: double); +begin + +end; + +function TVideo_FFmpeg.GetReflectionSpacing(): double; +begin + +end; + + initialization MediaManager.Add(TVideoPlayback_FFmpeg.Create); diff --git a/VideoPreview/src/media/UVisualizer.pas b/VideoPreview/src/media/UVisualizer.pas index 4f553521..b3ed7b0f 100644 --- a/VideoPreview/src/media/UVisualizer.pas +++ b/VideoPreview/src/media/UVisualizer.pas @@ -110,6 +110,8 @@ type fState: TProjectMState; + fScreen: integer; + fVisualTex: GLuint; fPCMData: TPCMData; fRndPCMcount: integer; @@ -144,8 +146,35 @@ type procedure SetLoop(Enable: boolean); function GetLoop(): boolean; + procedure SetScreen(Screen: integer); + function GetScreen(): integer; + + procedure SetScreenPosition(X, Y: double; Z: double = 0.0); + procedure GetScreenPosition(var X, Y, Z: double); + + procedure SetWidth(Width: double); + function GetWidth(): double; + + procedure SetHeight(Height: double); + function GetHeight(): double; + + procedure SetFrameRange(Range: TRectCoords); + function GetFrameRange(): TRectCoords; + + function GetFrameAspect(): real; + + procedure SetAspectCorrection(AspectCorrection: TAspectCorrection); + function GetAspectCorrection(): TAspectCorrection; + + procedure SetAlpha(Alpha: double); + function GetAlpha(): double; + + procedure SetReflectionSpacing(Spacing: double); + function GetReflectionSpacing(): double; + procedure GetFrame(Time: Extended); - procedure DrawGL(Screen: integer); + procedure Draw(); + procedure DrawReflection(); end; TVideoPlayback_ProjectM = class( TInterfacedObject, IVideoVisualization ) @@ -262,6 +291,88 @@ begin Result := true; end; +procedure TVideo_ProjectM.SetScreen(Screen: integer); +begin +end; + +function TVideo_ProjectM.GetScreen(): integer; +begin + Result := 0; +end; + +procedure TVideo_ProjectM.SetScreenPosition(X, Y: double; Z: double = 0.0); +begin +end; + +procedure TVideo_ProjectM.GetScreenPosition(var X, Y, Z: double); +begin + X := 0; + Y := 0; + Z := 0; +end; + +procedure TVideo_ProjectM.SetWidth(Width: double); +begin +end; + +function TVideo_ProjectM.GetWidth(): double; +begin + Result := 0; +end; + +procedure TVideo_ProjectM.SetHeight(Height: double); +begin +end; + +function TVideo_ProjectM.GetHeight(): double; +begin + Result := 0; +end; + +procedure TVideo_ProjectM.SetFrameRange(Range: TRectCoords); +begin +end; + +function TVideo_ProjectM.GetFrameRange(): TRectCoords; +begin + Result.Left := 0; + Result.Right := 0; + Result.Upper := 0; + Result.Lower := 0; +end; + +function TVideo_ProjectM.GetFrameAspect(): real; +begin + Result := 0; +end; + +procedure TVideo_ProjectM.SetAspectCorrection(AspectCorrection: TAspectCorrection); +begin +end; + +function TVideo_ProjectM.GetAspectCorrection(): TAspectCorrection; +begin + Result := acoStretch; +end; + +procedure TVideo_ProjectM.SetAlpha(Alpha: double); +begin +end; + +function TVideo_ProjectM.GetAlpha(): double; +begin + Result := 1; +end; + +procedure TVideo_ProjectM.SetReflectionSpacing(Spacing: double); +begin +end; + +function TVideo_ProjectM.GetReflectionSpacing(): double; +begin + Result := 0; +end; + {** * Returns the stack depth of the given OpenGL matrix mode stack. *} @@ -485,11 +596,11 @@ end; * Draws the current frame to screen. * TODO: this is not used yet. Data is directly drawn on GetFrame(). *} -procedure TVideo_ProjectM.DrawGL(Screen: integer); +procedure TVideo_ProjectM.Draw(); begin {$IFDEF UseTexture} // have a nice black background to draw on - if (Screen = 1) then + if (fScreen = 1) then begin glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); @@ -521,10 +632,10 @@ begin // draw projectM frame // Screen is 1 to 2. So current screen is from (Screen - 1) to (Screen) glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f((Screen - 1), 0); - glTexCoord2f(1, 0); glVertex2f(Screen, 0); - glTexCoord2f(1, 1); glVertex2f(Screen, 1); - glTexCoord2f(0, 1); glVertex2f((Screen - 1), 1); + glTexCoord2f(0, 0); glVertex2f((fScreen - 1), 0); + glTexCoord2f(1, 0); glVertex2f(fScreen, 0); + glTexCoord2f(1, 1); glVertex2f(fScreen, 1); + glTexCoord2f(0, 1); glVertex2f((fScreen - 1), 1); glEnd(); glDisable(GL_TEXTURE_2D); @@ -538,6 +649,10 @@ begin {$ENDIF} end; +procedure TVideo_ProjectM.DrawReflection(); +begin +end; + {** * Produces random "sound"-data in case no audio-data is available. * Otherwise the visualization will look rather boring. diff --git a/VideoPreview/src/menu/UMenuBackgroundVideo.pas b/VideoPreview/src/menu/UMenuBackgroundVideo.pas index bfaee702..b997807f 100644 --- a/VideoPreview/src/menu/UMenuBackgroundVideo.pas +++ b/VideoPreview/src/menu/UMenuBackgroundVideo.pas @@ -158,7 +158,8 @@ begin begin fBgVideo.GetFrame(VideoBGTimer.GetTime()); // FIXME: why do we draw on screen 2? Seems to be wrong. - fBgVideo.DrawGL(2); + fBgVideo.SetScreen(2); + fBgVideo.Draw(); end; end; diff --git a/VideoPreview/src/screens/UScreenSing.pas b/VideoPreview/src/screens/UScreenSing.pas index 233f1e38..dc43881a 100644 --- a/VideoPreview/src/screens/UScreenSing.pas +++ b/VideoPreview/src/screens/UScreenSing.pas @@ -847,7 +847,8 @@ begin fCurrentVideo.GetFrame(VideoFrameTime); end; - fCurrentVideo.DrawGL(ScreenAct); + fCurrentVideo.SetScreen(ScreenAct); + fCurrentVideo.Draw; end; // draw static menu (FG) |