дык , я его под размер потока и не подгоняю, а только сохраняю соотношение сторон и масштабирую относительно области вывода. Не люблю, когда размер программы скачет от файла к файлу.
- Код: Выделить всё
// =======================================================
// resize video out
// =======================================================
procedure tmainfo.resizevideo(screenwidth, screenheight : integer);
var r : real;
t : integer;
begin
if screenheight = 0 then exit;
ww_videoout.top := 0;
ww_videoout.left := 0;
ww_videoout.height := s_video.height;
ww_videoout.width:=s_video.width;
if ber_1.value = true then r := screenwidth / screenheight;
if ber_2.value = true then r := 4 / 3;
if ber_3.value = true then r := 16 / 9;
ww_videoout.width := round(ww_videoout.height * r);
if ww_videoout.width < s_video.width
then ww_videoout.left := (s_video.width - ww_videoout.width) div 2
else begin
ww_videoout.width := s_video.width;
ww_videoout.height := round(ww_videoout.width / r);
ww_videoout.top := (s_video.height - ww_videoout.height) div 2;
end;
end;
Mplayer Aspecthttp://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2001-September/001431.html
Here's how I've implemented aspect ratio processing.
First off - if you use the -x and -y options to mplayer then the sizes
that you give are used with no further adjustment. This ensures that
you can always get exactly the size that you want.
The -x and -y options are now honoured with -fs too. The image will
set to the size you request and centred on the screen.
Some examples:
mplayer -x 640 -y 480 filename.mpg - 640x480 pixel window used
mplayer -x 640 -y 480 -fs filename.mpg - 640x480 image centred fullscreen
mplayer -x 1 -y 1 filename.mpg - shown pixel-for-pixel same size
If you do not specify the -x or -y options, then aspect ratio
processing is done to determine the correct size.
To do this, the code needs to know the physical aspect ratio of the
source video, together with the physical aspect ratio of your output
display. That is: the width:height ratio represented by the x and y
pixels in the input file or on the output display.
By default both are set to 4:3, except for MPEG input files in "aspect
3" - where 16:9 is used.
The -aspect and -displayaspect parameters can be used to explictly
pass the aspect ratio of the source video and output display. You
might use these if you have a non-MPEG widescreen file, or an unusual
display mode in X.
In full-screen mode, the code will maximize the image size whilst
maintaining the physical aspect ratio. In non-full-screen mode, the x
size will be scaled to correct the aspect ratio.
The -xy option may be used to scale the overall picture size.
Fractional scaling can be used to reduce the picture size.
Some examples:
mplayer file.mpg - assumes source and destination aspect is 4:3,
mplayer -aspect 16:9 file.mpg - assumes source is 16:9, destination 4:3.
mplayer -aspect 16:9 -fs file.mpg - scales x to be full display width, y is worked
out to provide the right 16:9 image size
mplayer -displayaspect 16:9 file.mpg - you've got a widescreen monitor... <jealous>
Теперь вопрос зачем изобретать велосипед в виде собственной процедуры маштабирования и tspacer Еще раз повторюсь из-за tspacer возникают артефакты + дополнительная нагрузка на процессор