Author Topic: BASS_DSHOW: Keeping the aspect ratio when resizing  (Read 7416 times)

00AVD

  • Posts: 5
I'm new to BASS and this forum, so forgive me if this has been answered before. (I did search!)

I'm using Delphi 7, BASS and the BASS_DSHOW extension to preview a video file.  It is drawn on a TPanel.

While it does work, I can't figure out how to maintain the aspect ratio when the video window (panel) is resized.

Is this possible to do without calculating it all manually?  Is there some magic "keep aspect ratio" option?

I have previously used the DSPACK components and that handled it for me.

Ionut Cristea

  • Posts: 1545
Re: BASS_DSHOW: Keeping the aspect ratio when resizing
« Reply #1 on: 23 May '10 - 13:27 »
 Which renderer do you use?

00AVD

  • Posts: 5
Re: BASS_DSHOW: Keeping the aspect ratio when resizing
« Reply #2 on: 24 May '10 - 00:57 »
I'm not explicitly setting the renderer, so not sure what the answer is.

Basically, all I'm doing (so far) is:

Code: [Select]
fStream := BASS_DSHOW_StreamCreateFile(PChar(FileName),0);
...
setting volume, pan, sync
...
BASS_DSHOW_ChannelSetWindow(fStream, VideoPreview.Handle);
BASS_ChannelPlay(fStream, false);

I've seen a couple of C examples, but I code in Delphi.

00AVD

  • Posts: 5
Re: BASS_DSHOW: Keeping the aspect ratio when resizing
« Reply #3 on: 26 May '10 - 09:40 »
Bump.  Anyone able to steer me in the right direction please?

Ionut Cristea

  • Posts: 1545
Re: BASS_DSHOW: Keeping the aspect ratio when resizing
« Reply #4 on: 26 May '10 - 10:05 »
  BASS_DSHOW hasn't for now aspectratio settings...but i will add.

00AVD

  • Posts: 5
Re: BASS_DSHOW: Keeping the aspect ratio when resizing
« Reply #5 on: 26 May '10 - 22:59 »
Thank you.  I'm stumbling around somewhat with BASS & BASS_DSHOW at present, so am likely to ask some dumb questions.  ;D

Ionut Cristea

  • Posts: 1545
Re: BASS_DSHOW: Keeping the aspect ratio when resizing
« Reply #6 on: 27 May '10 - 13:06 »
Now you can set aspectratio:  ;D
Remark...you need to use VMR Renderer or Overlay Renderer to use this.

Quote
BASS_DSHOW_SetConfig(BASS_DSHOW_VideoRenderer,BASS_DSHOW_USEOverlay); //we use overlay renderer
BASS_DSHOW_ChannelSetOption(chan,DSHOW_AspectRatio,DSHOW_4p3,NULL); //4:3
//
BASS_DSHOW_ChannelSetOption(chan,DSHOW_AspectRatio,DSHOW_16p9,NULL); //16:9

You'll need this update: http://filezone.ro/public.php?action=viewfile&file_id=72928

00AVD

  • Posts: 5
Re: BASS_DSHOW: Keeping the aspect ratio when resizing
« Reply #7 on: 28 May '10 - 11:35 »
Thanks Sharkey.  Just had a play, but still confused. (still have a stretched aspect ratio)

I assume the ChannelSetOption must be used after the stream is created.

Should the SetConfig be used before the stream is created?

Does anyone have example code that shows how to size the canvas appropriately?

I'm obviously missing some important step here!
« Last Edit: 28 May '10 - 11:50 by 00AVD »