Posts

Showing posts from June, 2011

FFMPEG - Linux Build

This guild give you steps by step explanation on how to build ffmpeg from source for Linux. I am using CentOS 5.6 as platform
1. Additional repository. Get Epel so that you can yasm, git, etc... libraries
wget http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm rpm -Uvh epel-release-5*.rpm
2. Download FFMPEG source from http://www.ffmpeg.org/download.html
3. Download the following libraries from CentOS command line with wget
wget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2 wget http://downloads.xvid.org/downloads/xvidcore-1.2.2.tar.gz wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz wget http://downloads.sourceforge.net/faac/faad2-2.7.tar.gz wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gz wget http://downloads.sourceforge.net/project/libraw1394/libraw1394/libraw1394-2.0.5.tar.gz wget http://downlo…

LInux - Recover from ldconfig error

If you accidentally ldconfig a library folder with libraries that are not suitable for your current Linux kernel and you restart your system, you may get yourself into a situation whereby you cannot log into the system anymore.
This is possible if you ldconfig a folder with libraries that requires glibc 2.5 during runtime. However, you system is using only glibc 2.3. At your next system startup, your system will try to load the shared object, but, it will fail and denied your log in.
To recover from this, you could do the following (assuming that you are using CentOS)
1. Boot up your system with your Linux installation disc 2. Go into Rescue mode. Simply following the on screen instruction given to load rescue mode. 3. When you are in Rescue mode, you are able to access your system. Usually, your original drive will be mounted in /mnt/sysimage/ 4. Create a ld.so.conf file at / 5. Then, cd /mnt/sysimage/ 6. Then, find your corrupted ld linkage. Using libtermcap.so as example, you can perform f…

Critical Section - Windows vs Linux in C++

Just to provide a simple equivalent critical section code between Windows and Linux
For Windows, critical section code are located at WinBase.h. Normally, you do not need to include this header as it is pre-loading in VS compiler
For Linux, mutex code are located in pthread.h. You will have to include this header file in order to use mutex in Linux

Creating critical section variable
This variable will be the object to be acquired when you want to use any critical resource
On Windows
CRITICAL_SECTION cs;
On Linux
pthread_mutex_t m;

Initializing critical section
You have to initialize the critical section resource before using
On Windows
InitializeCriticalSection(&cs);
On Linux
//create mutex attribute variable pthread_mutexattr_t mAttr;
// setup recursive mutex for mutex attribute pthread_mutexattr_settype(&mAttr, PTHREAD_MUTEX_RECURSIVE_NP);
// Use the mutex attribute to create the mutex pthread_mutex_init(&m, &mAttr);
// Mutex attribute can be destroy after initializing the mutex var…