Monday, May 31, 2010

Compiling GTK+ for Windows with MinGW

GTK+ is a set of open-source widget libraries that are mature, functional and portable. GTK+ library is mainly used by many Linux programs. I am building a complete stack of GTK+ 2.x library before beginning my programming projects. This tutorial makes use of the free MinGW compiler to build GTK+.



If you haven't installed MinGW yet, read this tutorial on installing MinGW in Windows. Alternatively, you can also install MinGW Portable on your USB flash drive so you can enjoy compiling anywhere. GTK+ depends on many basic libraries that provide image, localization, font and other functions. These prerequisite libraries have be compiled first. Once you've installed MinGW and MSYS, launch MSYS. The following steps require you to type commands into MSYS console.




  1. Zlib 1.2.7


    Zlib is an essential compression library required by png, tiff and cairo. Get the zlib source and unpack it:

    tar xzvf zlib-1.2.7.tar.gz
    cd zlib-1.2.7/

    Compile zlib like this:


    make -f win32/Makefile.gcc

    Then, manually copy the files as follows:


    cp -iv zlib1.dll /mingw/bin
    cp -iv zconf.h zlib.h /mingw/include
    cp -iv libz.a /mingw/lib
    cp -iv libz.dll.a /mingw/lib


  2. libiconv 1.14


    libiconv is a character-set conversion library, and is needed by gettext. Download the libiconv source and compile libiconv:


    ./configure --prefix=/mingw
    make
    make install


  3. gettext 0.18.1.1


    GNU gettext is a tool for localizing and translating programs. Build gettext like this:


    ./configure --prefix=/mingw --enable-threads=win32 --enable-relocatable
    cd gettext-runtime/
    make
    make install


  4. glib 2.32.4


    glib's configure script requires pkg-config.exe and msgfmt.exe in the PATH. Download the executables and save them in /mingw/bin. Remember to set the system-wide environment variable PKG_CONFIG_PATH:


    export PKG_CONFIG_PATH=/mingw/lib/pkgconfig

    glib 2.30 and later depends on libffi. Compile libffi like this:


    ./configure --prefix=/mingw && make && make install

    Then, get the glib source from ftp.gnome.org and compile glib as follows:


    ./configure --prefix=/mingw --with-threads=win32 --with-pcre=internal --disable-debug
    make
    make install


  5. ATK 2.4.0


    Download ATK from here. Compile it like this:


    ./configure --prefix=/mingw
    make
    make install


  6. libpng 1.5.12


    PNG can be compiled like this:


    ./configure --prefix=/mingw
    make
    make install


  7. Optional libraries


    The following libraries are optional, but many GTK+ packages include them. It's up to you to decide whether to compile them or not.



    As usual, compile any of them like this:


    ./configure --prefix=/mingw && make && make install


  8. Pixman 0.26.2 and Cairo 1.12.2


    Get Pixman and Cairo from cairographics.org. Compile Pixman as follows:


    ./configure --prefix=/mingw

    make

    make install

    Then, compile cairo:


    ./configure --prefix=/mingw --enable-pthread
    make
    make install


  9. Pango Library 1.30.1


    Compile Pango like this:


    ./configure --prefix=/mingw --with-included-modules=yes

    make

    make install


  10. gdk-pixbuf 2.26.2


    Download and compile gdk-pixbuf:


    ./configure --prefix=/mingw --without-libjasper --with-included-loaders=yes --disable-modules --disable-debug
    make
    make install


  11. GTK+ 2.24.11 and GTK+ 3.4.2


    At last, we are ready to compile GTK+ for Windows. I compiled GTK+ like this:


    ./configure --prefix=/mingw --with-included-immodules=ime --disable-modules --disable-debug

    make

    make install


    To test your newly compiled GTK+ library, run gtk-demo.exe or testgtk.exe.



Wednesday, May 19, 2010

My Windows Vista/7 Power Settings

Here are my power settings on Windows Vista or Windows 7. I find the default setting annoying or inadequate, especially the Start menu power button triggering sleep.




  • Lid Close Action
    • On Battery: Sleep
    • Plugged in: Do nothing


  • Power Button Action
    • On Battery: Hibernate
    • Plugged in: Hibernate


  • Sleep Button
    • On Battery: Sleep
    • Plugged in: Hibernate


  • Start menu power button
    • On Battery: Shut down
    • Plugged in: Shut down

Sunday, May 16, 2010

Using Mencoder To Merge AVI Files

Merging 2 AVI files can be easily accomplished with mencoder. But the two AVI files must be encoded with the same video and audio codec. Assuming that you have part1.avi and part2.avi, seamlessly consecutive, the mencoder command to concatenate them is:


mencoder -ovc copy -oac copy -o whole.avi part1.avi part2.avi

Wednesday, May 5, 2010

Using VLC to Dump a DVD title

VLC is a free, powerful media player for Windows, Mac and Linux. I've used VLC mainly for playing Movies. Sometimes, I use VLC to listen to Internet radio. I seldom use VLC to rip DVD's but VLC can come in handy when dealing with tricky DVD titles. For DVD titles with mixed VOB ID's, VLC can be used to dump such DVD titles. Follow the steps below:




  1. From the Media menu of VLC, select Convert/Save...

    VLC Media Convert
  2. Choose the Disc tab. In the Disc Selection area, choose DVD and check No DVD menus. Type in the drive letter (for example, F:\) for your DVD drive. The main title number is typically 1, but may vary. Audio track is usually 0 for the primary language (English) and 1 for secondary lanuage (French or Spanish). Click Convert/Save button.



  3. In the next Convert window, click the Create a new profile button.



  4. Name the new profile as Copy Without Conversion. In the Video codec tab, check both options Video and Keep original video track.


    In the Audio codec tab, check both options Audio and Keep original audio track.



    Leave anything else as is. Click Save.



  5. Back to the Convert window, type in the name for Destination file (E:\output.ts). For the profile, select the newly created profile (Copy Without Conversion) from the dropdown list. Click Start.



  6. VLC starts saving the DVD title to a disk file.




Although VLC has many built-in functions for ripping DVD's and converting movies, I don't have much experience with them. I think VLC's transcoding function is premature.


After VLC finishes conversion, you'll get an output file (output.ts) whose size may be up to several gigabytes. Now, use mencoder to transcode it.



Related Links


About This Blog

KBlog logo This blog seeks to provide a collection of interesting pictures found on the Web. Thanks for visiting the blog and posting your comments.

© Contents by KBlog

© Blogger template by Emporium Digital 2008

Followers

Total Pageviews

Powered By Blogger