Thursday, February 28, 2013

CAMP - Console Ansi Mpeg3 Player


PLEASE NOTE: An official update of CAMP as of April 20 2013 is available here.



CAMP 1.5.3489 Console ANSI Mpeg3 Player (Rawlock skin).

Years ago I came across a really nice front end for mpg123 called CAMP by Sector7's inm. I fell in love with it at first sight. Why, well because I love ANSI art! So recently when I started drifting towards creating a console only GNU/Linux system I had this little gem in the back of my head.


CAMP File selector (Rawlock skin).

CAMP Description editor (Rawlock skin).

CAMP Forked to background.


 I had to think hard (google) to actually remember the name of the app but luckily enough the website was (and is) still alive. Sadly the last update was in 2002. But hey! Maybe it didn't need more coding?

Or did it? Compilation gave me heaps of errors. Errors I first regarded as something way above my level of competence. Here's a few lines:

fork.c:120: error: too few arguments to function ‘exit’

fork.c: In function ‘stealback’:
fork.c:137: warning: incompatible implicit declaration of built-in function ‘exit’
fork.c:137: error: too few arguments to function ‘exit’
fork.c:146: warning: incompatible implicit declaration of built-in function ‘exit’
fork.c:150: warning: incompatible implicit declaration of built-in function ‘exit’
fork.c:188: warning: incompatible implicit declaration of built-in function ‘exit’
fork.c:188: error: too few arguments to function ‘exit’


I started out by mailing the author but as of now I've still haven't heard from him or her. Then again I'm not really expecting someone to jump at troubleshooting their eleven year old code as soon as random idiot from the internet e-mails them about it. So I turned my questions to the mighty google instead.

I quickly learned that the errors were quite easily remedied:
error: too few arguments to function ‘exit’
All the instances of exit() in fork.c needed to be replaced with exit(0).

warning: incompatible implicit declaration of built-in function ‘exit’
Add #include <stdlib.h> to the top of fork.c

After this the code will compile but still generates heaps of warnings. I've compiled a list of errors and remedies if you want a warning free compile, or you could just download my pre-fixed package further down.

How to download, make and install CAMP:

0 Install the dependencies
$ sudo apt-get install zlib1g-dev mpg123
Note: First time I tried to compile CAMP on my Debian box I never had any issues with dependencies. Well except mpg123 since that is what CAMP is a front end for. If you do find any missing deps please comment and I'll add them to the list above. 

1a. Get the latest code :
$ wget -c http://sector7.nu/camp/camp-1.5.3589.tar.gz

PLEASE NOTE:  An official update of CAMP as of April 20 2013 is now available. 
$ wget -c http://www.sector7.nu/camp/camp-1.6.3744.tgz

1b. Alternatively download my updated code that works for me.
$ wget -c https://www.dropbox.com/s/510hdr4g3mutb5p/camp-1.5.3589_makkan.tar.gz

2. Unpack the downloaded file.
$ tar xvzf camp-1.5.3589.tar.gz

3. Configure CAMP
$ ./configure

4. Compile and install CAMP
$ ./make && sudo make install

5. Install the skins
$ ./make install-skins 
Note: This installs the skins in ~/.camp/skins but for some reason the individual skin dirs are not executable i.e not possible to cd into. But it can easily be fixed by issuing:
$ chmod ug+x *  
in HOME/.camp/skins/

6. Configure CAMP, start by copying camp.ini from the source code directory to your home .camp/ dir
$ cp camp.ini ~/.camp/camprc
Then edit the camprc according to your preferences e.g location of mpg123, audio output etc.

7. run CAMP!
$ camp

Hey! Why does everything look like crap in Virtual console?


CAMP in console with $TERM Linux and locale sv_SE.ISO-8859-15
CAMP in console with $TERM Linux and locale sv_SE.ISO-8859-15

CAMP in console with $TERM Linux and locale sv_SE.UTF-8
CAMP in console with $TERM Linux and locale sv_SE.UTF-8

Well I've found a way to temporarily remedy this. Although I'm still researching better solutions. The one I have right now is to use one of the following settings: 
$ charset G0 cp437
$ charset G1 cp437

If for some reason your console turns out unreadable you can always go back with. Se more in the charset manpages.
$ charset G0 iso01
$ charset G1 iso01



CAMP in console with $TERM Linux, locale sv_SE.UTF-8 and charset cp437
CAMP in console with $TERM Linux, locale sv_SE.UTF-8
and charset cp437

Hey! Why does everything look like crap in PuTTY?


This one's easy. Just set the remote character set to the ISO-8859-X that suits you or type in CP850. It's under Window>Translation

Hey! Why does everything look like crap in PuTTY when I use GNU screen?


This one's easy. Just set the remote character set to the ISO-8859-X that suits you or type in CP850. It's under Window>Translation
And do the following:

set $LANG to C
$ export LANG=C

In screen set c1 to off: 
Press crtl+a+: and type c1 off 

and set UTF8 to off: 
Press crtl+a+: and type utf8 off off

Found these GNU Screen tricks in the amnesia/epic documentation here


Hey! Why does everything look like crap in xterm?


Don't know haven't had this problem yet. Hint might be to try something of the above.


Short description of warnings and remedies when trying to compile CAMP: 

warning: incompatible implicit declaration of built-in function ‘strcpy’

warning: incompatible implicit declaration of built-in function ‘strlen’

warning: incompatible implicit declaration of built-in function ‘strncat’

warning: incompatible implicit declaration of built-in function ‘strchr’
Add #include <string.h> to the top of the offending file.


warning: incompatible implicit declaration of built-in function ‘exit’
Add #include <stdlib.h> to the top of the offending file.

warning: incompatible implicit declaration of built-in function ‘printf’
Add #include <stdio.h> to the top of the offending file.


4 comments:

  1. Any suggestions if camp spits out errors at the skin version? So far I only get ...

    Loading skin "rawlock" ... skin version is 0, must be etween 100-109 to work with this camp version!

    The skins all show versions between 100 and 109. Using Arch, by the way.

    ReplyDelete
    Replies
    1. I have the exact same problem on my Crunchbang Waldorf system. Unfortunately I've yet to find the cause of the problem. Since the same source code compiles and works on my Debian Squeeze I have to assume that there is a software difference of some sort. I've tried to browse the code to see if it calls something but I can't find anything suspicious.

      I haven't given up yet so I'll keep you posted if there's any progress.

      Delete
    2. I tried downgrading mpg123 (I saw your other message about mpg123) but I get the same results. I'll have to check what other software changed recently but you might have a better standpoint than me. Things change a lot in Arch. :|

      Delete
    3. I think we need the help of a coder. From what CAMP's page on Freecode.net says there's no other dependencies other than mpg123, and it does start with other players like mpg321 aswell so it can't really be that.

      Maybe you could use your influence as a blogger to get some coders aboard ;)

      Delete