[Scummvm-devel] VideoPlayer improvement: video positioning.

Vladimir Menshakov whoozle at yandex.ru
Mon Jan 11 12:54:59 CET 2010


11.01.10, 08:59, "Filippos Karapetis" :
> > Vladimir Menshakov wrote:
> > 
> > > VideoPlayer renders video in the center of the screen which makes
> > > post-processing more complicated as it should be :) I see two
> > > possible solutions: 1) Remove postProcess(byte *) and replace it with
> > > virtual method "render" or something. VideoPlayer's default
> > > implementation will do copyFrameToBuffer(centerx, centery). 2) Allow
> > > manual _frameX/Y modification via other method/extended arguments.
> > Sounds like a sound idea to me.
> 
> 
> The second solution sounds better, imho. E.g. there could be a new method,
> "setFrameLocation(x, y)" which would change the default placement.
> 
Both solutions don't affect VideoPlayer for the regular engine in any sense. Postprocessing used only in sword1/2, and easily could be ported (by changing prototype and adding one line of the parent videoplayer::render call). I think that overriding render() is better because your post-processing operations should not be limited to the piece of the locked screen memory. 
Another questions for the setFrameLocation() is: *when* will you call it? VideoPlayer quite limited and basically have only one method: play(). You cannot call it from post-process because first frame would be already rendered. Another virtual callback onPlay()? Default 'uninitialized' values for the x/y position? Sounds ugly. :(
> 
> The VideoPlayer class was created to simplify video playing. Videos SHOULD
> be centered by default, as in most cases, games just play a video centered
> at full screen. Different placements are certainly possible if you roll out your
> own video implementation, so if you need more functionality than the one 
> provided by the default video player, it would be better to create your own
> implementation to suit your needs, unless it's a change which doesn't
> complicate the default video player a lot - it's there to simplify things, after
> all :)
It's not the matter of complexity but flexibility. Noone uses postprocessing except sword1/2 and my new secret engine which doesn't exist in trunk yet. ;)
> 
> Do tell, why do you need to play a full screen video at a different screen
> position? (out of curiosity)
As I said before: I have to deinterlace 640x240 video in performpostprocess(), so it should not be vertically centered when VideoPlayer calls performPostProcessing, or I have to deinterlace it with two tricky loops from the Y-center point to the upper and lower positions. (I think it's not good for the CPU caches/prefetching too). Also I sticked with screen width/height/pitch here. 
> 
> Regards
> Filippos




More information about the Scummvm-devel mailing list