开发者

Dynamic resize with MPlayer and PyGTK

I've wrote a piece of code in python and pygtk for an embeded mplayer in a gui. I assume I use GtkSocket and the slave mode of mplayer with the -wid option.

But I've got an issue, when the size of my GTK window is smaller than my stream, the stream appears to be cropped. And when the size o开发者_StackOverflow中文版f my window is bigger than my stream, the stream appear centred inside the widget which embed MPlayer. (a gtk.Frame but I've also try with a gtk.DrawingArea) I would like to know how I can get my stream resize dynamically depending on the window's size. I don't want to use Glade or any GUI builder. Thanks in advance for any help, and please excuse my poor english.


You'll want to connect to the 'size-allocate' signal of whatever widget you embedded MPlayer in. Once you know the new size of the widget, say 200x300, send the commands

set_property width 300
set_property height 200

to MPlayer in slave mode.

(See http://www.mplayerhq.hu/DOCS/tech/slave.txt for a list of slave mode commands.)


You need to tell mplayer to zoom video according to window size. This can be done either in command line (-zoom) or in the configuration file (zoom = 1).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜