VLC and IDE

29 April 2009

I receive many questions about using an IDE to build VLC.

Usually, the answer is VIM. But I will try to introduce something else today.

Needs

Yeah, VIM is TEH awesome, but sometimes we would like more. But usually, more is slow, incomplete and boring

Would you want an editor with:

  • VIM syntax and command,
  • Completion that is faster than the one from Eclipse
  • Git inclusion
  • Doesn’t eat all your RAM
  • Debuggueur and step-by-step+breakpoints integration like MSVC?

I guess so!

Believe it or not, there is a solution: QtCreator from Nokia/QtSoftware that I have tested to work with VLC.

Even if you don’t think this will be useful for you, at least read in diagonale the following post.

Installation

  • Take QtCreator 1.1 (don’t take older versions, they won’t fit for VLC, or the VIM part will suck…)
   `apt-get install qtcreator` in Debian/Sid
  • Take Qt4.5.1 (I mean it, Qt 4.5.0 is buggy!)

Setup

General Setup

  • Run QtCreator and launch Tools->options

    • Activate FakeVim and set ShiftWidth to 4
    • Text Editor->Behaviour, set Tab size at 4
    • Text Editor->Display, enable Text Wrapping and display right margin, and if you like Alexis’ vim, Visualize whitespace
    • Text Editor, change the colour schemes to match you old editor ;)
  • Save options.

VLC Setup

For the example, I assume that you build your vlc in a “build” subdir of the source (as xtophe usually gives advice)

 * File->New
   Select 'Import of Makefile-based Project'
   -
   Project Name 'VLC'
   Location '/home/you/vlc' and Choose, Next
   -
   Let it process... It should take around 1minute
   Finish.
  • EXIT QtCreator… I MEAN it.

Setup Indexation

QtCreator will have done VLC.includes VLC.creator, VLC.files and a VLC.config in your vlc/ folder.

Overwrite the VLC.includes and the VLC.files with the one you can find:

Doing this will gain you some time. Those could be auto-generated one day, I guess…

Setup Build

Relaunch QtCreator

  • Select Projects (on the left) and select VLC on the list
  • Build Settings,
    • Change Build directory to /home/you/vlc/build, using browse
  • Run Settings,
    • Add a custom Executable with the blue ‘+’
    • Name it VLC, browse to /home/you/vlc/build/vlc for Executable
    • Put -Iqt in Arguments
  • Click on Edit on the left. You should see VLC with most useful files.

Build VLC and launch it.

  • In the Menu, Build and Build All, you should see the Compilation output on the bottom (or by clicking on the left build progressbar)
  • In the same menu, Build and Run it, and VLC will launch directly, outputting everything in the Application output.

Cool. But that was just a minimum…

Using it like VIM: Good!

Open modules/codec/avcodec/audio.c from the file browser and see… You are using VIM commands to control. You have Visual, Edit and all usual VIM modes!

  • Completion is triggered with Ctrl+Space and will give you a list. If there is no ambiguition, it is filled.

  • . and -> triggers the list of the members of the struct or the class by default.

  • After function completions, it will give the type of the arguments.

  • F2 will give you access to the function definition where your mouse is.

Debugging it: awesome!

  • You can put breakpoints in the margins near the line numbers. (Like in modules/gui/qt4/main_interface.cpp:100 and 108)

  • Now re run it using debug running.

It will stop at your breakpoint and you will have the function call lists (and line numbers) but also pointers values (like p_intf, and this in main_interface.cpp) http://people.videolan.org/~jb/QtCreator/VLC_Qt_Creator.png

You can, of course Step In, Step Into and Step Out, resume or stop the code

More coolness:

Locate

Use the locate search box to find quick declarations: 'm vlc_object_act' will help you to go quickly to the method declaration, etc…

Git

Use the Git menu to checkout from within QtCreator.

Nota Bene

The indexing shouldn’t be too long, but could be a bit longer the first time you launch the project!

Have fun!

Jean-Baptiste Kempf

Comments

  1. On 27 May 27270, 10:25 by linux guy

    Kdevelop is makefile based too.It works perfectly un my ubuntu ;)

  2. On 16 May 16160, 6:20 by new mexico map google

    Resources like the one you mentioned here will be very useful to me! I will post a link to this page on my blog. I am sure my visitors will find that very useful.

  3. On 6 May 6060, 10:16 by grants for teachers

    Great share. I am thinking to also modify my VLC player or maybe create a new player and then add a multi playlist option

  4. On 12 May 12120, 8:43 by Fbml Kodlari

    thanks

  5. On 3 May 3030, 5:40 by fbmlkodları

    thanksss

  6. On 9 May 9090, 9:44 by ghd straighteners

    It only works with some 1.1.0 builds. My 1.1.0 rpm doesn’t provide any Makefile project import.
    If you want to be sure, just get the whole package directly from QT.

  7. On 9 May 9090, 5:10 by gemtsone supplier

    Read your article, I feel your words are very good, very good! Thank you for sharing.
    winbowgems com gemstone suppliers from China, We business scope: ODM and OEM

  8. On 4 May 4040, 3:56 by camcorder battery

    I am with a bunch of guys who are completely used to dragging and dropping widgets and right clicking and coding them, or better still, using inbuilt tools to do the coding while they select options.

  9. On 4 May 4040, 4:22 by bp-511a battery

    i am with a bunch of guys who are completely used to dragging and dropping widgets and right clicking and coding them, or better still, using inbuilt tools to do the coding while they select options

  10. On 2 May 2020, 3:25 by p90x

    Generally I do not post on blogs, but I would like to say that this post really forced me to do so,Excellent post!

  11. On 1 May 1010, 10:14 by miuni

    I am with a bunch of guys who are completely used to dragging and dropping widgets and right clicking and coding them, or better still, using inbuilt tools to do the coding while they select options.

  12. On 30 May 30300, 5:39 by PowerShot SD1100 IS battery

    that makes the trick ! (though wouldn’t work without the starting “/” for /admin/)
    However, I digged a little further for the issue and found a cleaner way…
    That is getting edited in the post

  13. On 26 May 26260, 4:23 by click here

    Resources like the one you mentioned here will be very useful to me. I will post a link to this page on my blog. I am sure my visitors will find that very useful.

  14. On 20 May 20200, 11:00 by key programmer

    Nice and useful tips as for me! Thanks for sharing! Yo seem to be a really professional!

  15. On 19 May 19190, 1:19 by Buy now

    Resources like the one you mentioned here will be very useful to me. I will post a link to this page on my blog. I am sure my visitors will find that very useful.

  16. On 17 May 17170, 12:55 by faxless payday loans

    This is a superb post {%H1%}.
    But I was wondering how do I suscribe to the RSS feed?

  17. On 16 May 16160, 6:40 by darkfall gold

    Generally I do not post on blogs, but I would like to say that this post really forced me to do so,Excellent post!

  18. On 24 May 24240, 6:51 by Santhosh

    Hi,
    Super… This was very useful, I am able to use it as debugger[Start and debug external application].

    But, I too got same error as 5th comment, i have already compiled VLC before, using mingw tool and got exe built, But it gives error when i do it QT, Please help for building with QT.

    Thanks and Regards
    Santhosh

  19. On 23 May 23230, 11:55 by Anp

    the post is informative.
    But can you please describe me about how to start coding for VLC.
    I cant understand the insides in my first second and third looks.
    pls let me know how to beginners code for VLC

    thanks in advance.
    Anoop

  20. On 6 May 6060, 8:14 by JBK

    Sorry, guys, but on windows, you have to compile a VLC first, before running make, and this is far from trivial.

  21. On 6 May 6060, 11:12 by Jeremiah

    hi~
    i got the same error as the 5th comment.

    my os is xp sp2.
    build vlc in cygwin.

  22. On 25 May 25250, 8:12 by Roman

    I did exactly and got this error “Could not start process make
    Error while building project VLC
    When executing build step ‘Make’ "
    Can you please help me with this.
    I’m using win xp pro and my dir for vlc src is c:\vlv\vlc

    Thank you,
    Roman

  23. On 24 May 24240, 6:53 by FCartegnie

    It only works with some 1.1.0 builds. My 1.1.0 rpm doesn’t provide any Makefile project import.
    If you want to be sure, just get the whole package directly from QT.

  24. On 9 May 9090, 10:22 by MetalheadGautham

    What I meant was, is this the kind of software which allows point and click kind of programming, atleast on Linux, similar to Visual Basic or Visual C++ on windows ?

    I am with a bunch of guys who are completely used to dragging and dropping widgets and right clicking and coding them, or better still, using inbuilt tools to do the coding while they select options.

  25. On 4 May 4040, 2:37 by JBK

    You might need to wait for 1 or 2 releases of QtCreator to tell them to switch.

  26. On 3 May 3030, 2:52 by MetalheadGautham

    EXCELLENT! Thanks. Exactly the software I was looking for.

    Is this good enough for convincing a few friends of mine to switch to Qt who are used to MS Visual Basic ?