[vlc-devel] How to resize video when render to custom are in memory

Rémi Denis-Courmont remi at remlab.net
Wed May 23 22:19:45 CEST 2012


Le mercredi 23 mai 2012 22:46:03 Łukasz Korbel, vous avez écrit :
> Im using vlc to render video frames directly to some memory buffer.
> I need to be able to resize video while media is playing. Function
> libvlc_video_set_scale doesn't work for this (i assume its working
> when vlc is connected to os native window).

Setting the scale makes absolutely no sense when using custom buffers. The 
scale is intrinsically fixed to the ratio of the source format resolution to 
the output format resolution.

If you want to preserve the input resolution, or more generally select the 
output resolution based on the input resolution, you need 
libvlc_video_set_format_callbacks() instead of libvlc_video_set_format().

> The only other function I've found that allows resizing is
> libvlc_video_set_format, which is used when initializing decoding. The
> problem is it will take no effect until media is playing so its not
> enough (It "works" when i stop, set format and play but its really
> stupid;))

The video output pipeline must be reset to change the output buffers. Also 
filters will need to be reinitialized, if only the scaling filter.

A crash would be almos certain if changing format on the fly was permitted.

> In the end i want to add that connecting to window of any window
> system is not an option for me.
> Please give me some clues. Maybe there
> is another way or this is limitation of API. If the second then maybe
> it can be improved?

Basically, you need to write your own video output plugin.

-- 
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis



More information about the vlc-devel mailing list