Thursday, April 07, 2011

GMTK Media Player Zoom Feature

One feature I'm commonly asked for in Gnome MPlayer is a way to zoom in on the video, perhaps there is something needs closer examination or the viewer just wants to get rid of the black bars on the sides. So I began looking into how I could solve this problem. GMTK draws the video into a GTKSocket object, which is contained by a GTKFixed container. This allows me to properly center the video. I was under the assumption that using negative coordinates in the GTKFixed would not be allowed. Anyway I decided to try it to see if it would work just in case. And it actually did work with no problem. So my first attempt at this was to put the change into Gnome MPlayer. Gnome MPlayer uses a GTKDrawingArea instead of a GTKSocket so when I tried this technique I ended up with video overlaying other portions of the window, not good. But I figured I should try it in GMTK to see if it would work there anyway. It does actually work pretty well. So when Gnome MPlayer is converted to use GMTK (planned for 1.0.4) the zoom feature should come along with the code. Below are some screen shots showing it working.

GMTK at 100% zoom (I've made the window wider on purpose)

GMTK at 120% zoom

GMTK at 80% zoom
I may change the step size in the future to allow for more precise zooming, right now the steps are 10%.


Update: Looks like this feature will probably be dropped for gnome-mplayer 1.0.4, I had to make a change to the layout code to make GTK3 work correctly, and that change took away this feature.

No comments: