태그 보관물: airvideo

Ubuntu 12.04의 airvideo property

Airvideo설정을 위한 property file을 여기에 기록해 둔다.

대부분의 한국어 자막파일은 windows에서 작성되므로 encoding을 euc-kr로 설정하고, 12.04에 기본으로 들어 있는 undotum으로 font를 설정했다.

Airvideo client에서 보여줄 위치를 선언하는 folders 항목은 영화를 올려두는 Movies와 외장 하드를  경로로 넣어준다.

path.ffmpeg = /usr/local/bin/ffmpeg
path.mp4creator = /usr/local/bin/mp4creator
path.faac = /usr/local/bin/faac
password = 1234
subtitles.encoding = euc-kr
subtitles.font = undotum
folders = Movies:/media/data_/Movies,Extern:/media/untitled

 

mpeg4ip-1.5.0.1을 ubuntu 12.04에서 컴파일 하기 2 – 패치 내용 정리

다음은 mpeg4ip가 gcc/g++ 4.4에서 빌드되도록 하기 위해 빌드 오류를 수정한 내역에 대한 설명이다. 작성된 패치 및 적용하는 방법은 “mpeg4ip-1.5.0.1을 ubuntu 12.04에서 컴파일 하기 1“를 참고.

bootstrap script 수정

bootstrap command를 수행하면 configure를 수행해 주는데 다음과 같은 에러가 나온다.

mpeg4ip-1.5.0.1$ ./bootstrap --disable-player
dir: .
SDL appears to be installed
./bootstrap: 77: ./bootstrap: Syntax error: Bad fd number

faac까지 모두 설치되고 ldconfig를 수행한 상태이므로 faac가 잘 동작하는 상태라고 가정하고 다음 부분을 comment-out 한다.

if test $target_system = "Linux"; then
    have_faac=no
    if which faac >/dev/null 2>/dev/null; then
        have_faac=yes
    fi  

#    if test $have_faac = "yes"; then정
#       # we have lame and faac - see if faac is built with mp4 support
#       faac --help >&faac_help
#       sdf=`grep "MP4 support unavailable" faac_help`
#       rm -f faac_help
#       if test -z "$sdf"; then
#           if which mpeg4ip-config >/dev/null 2>/dev/null; then
#               echo "Warning - faac uses libmp4v, but we've detected a version"
#               echo "of mpeg4ip.  If you get errors building mp4live, please"
#               echo "rebuild faac without mp4v2 support"
#           else
#               echo "Error - we have detected a version of faac that has libmp4v2 support"
#               echo "and no copy of mpeg4ip-config.  This means faac was built with"
#               echo "faad2 and the libraries will be incompatible".
#               echo "Please reinstall faac without mp4v2 support"
#               exit 1
#           fi
#       fi
#    fi
fi
set -x

Compile Errors 수정

error: ambiguates old declaration ‘const char* strcasestr(const char*, const char*)’

 : /usr/include/string.h에 정의된 것과 mpeg4ip의 include/mpeg4ip.h에서 정의하고 있는 function signature가 서로 다르게 때문이다. 다음과 같이 mpeg4ip.h의 선언 부분을 막아준다.

#ifdef __cplusplus
extern "C" {
#endif
//char *strcasestr(const char *haystack, const char *needle);
#ifdef __cplusplus
}
#endif

error: invalid conversion from ‘const char*’ to ‘char*’

 : 간단하게 type casting으로 (char*)를 붙여서 막는다. function signature를 고치는게 더 바람직 할것 같다고 생각했으나, 일부 header file들은 c와 c++에서 함께 불리기 때문에 const string으로 변경하면 c compiler에서 오류가 생긴다. signature는 그냥 두고, caller쪽에서 type casting을 해주는 것이 더 편한 방법이 될 것 같다.

error: dereferencing type-punned pointer will break strict-aliasing rules

 : lib/rtp/Makefile의 CFLAGS에 -fno-strict-aliasing를 추가한다. 이 Makefile은 bootstrap을 실행해야 생성되는 것임에 주의.

CC = gcc 
CCDEPMODE = depmode=gcc3
CFLAGS = -g -O2 -Wall -Werror -W  -Wmissing-prototypes -Wmissing-declarations -Wbad-function-cast -Wwrite-strings -Wformat=2 -fno-strict-aliasing
CPP = gcc -E
CPPFLAGS =

fatal error: istream.h: No such file or directory

 : 몇몇 컴파일러에서는 ISO compliant 파일인 iostream을 사용하도록 장려된다고 한다 (참조).  entropy.hpp와 bitstrm.hpp의 해당 부분을 iostream으로 대체하고, using 구문을 추가해 준다.
common/video/iso-mpeg4/include/entropy.hpp

#ifndef __ENTROPY_HPP_
#define __ENTROPY_HPP_
#include <iostream>
//#include <istream.h>
//#include <ostream.h>

using std::istream;
using std::ostream;

common/video/iso-mpeg4/include/bitstrm.hpp

#include <iostream>
#include "inbits.h"
//#include <istream.h>
//#include <ostream.h>

error: suggest parentheses around ‘&&’ within ‘||’

 : 오류가 난 라인을 찾아가서 조건문에 괄호를 붙여 준다.

error: suggest explicit braces to avoid ambiguous ‘else’

 : 표시된 라인을 찾아가서 중괄호를 붙여 준다.

error: iostream.h: No such file or directory

 : iostream.h로 #include한 구문을 찾지 못하는 문제. 어느 c++ 책에서 읽은 기억이 있는데, include되는 것을 file별로 구분하는 것은 컴파일러의 구현에 따라 달라질 수 있는 사항이어서 실제로 파일별로 존재할 수도 있고 그렇지 않을 수도 있다. 따라서 .h를 명시하지 않는 것이 추천되는 방법이라고 했던 기억이 난다. 오류난 곳을 찾아 #include <iostream>으로 변경해 준다. fstream.h에 대해서도 동일하게 #include <fstream>으로 변경해 준다.

error: ‘vctCandMV2’ may be used uninitialized in this function

 : Class가 초기화 되지 않고 사용되었다는 오류이다. 실제로는 생성자를 불러줘야 하지만, 사용법을 모르니 그냥 common/video/iso-mpeg4/src/Makefile의 BILLS_CPPWARNINGS와 BILL_CWARNINGS에서 -Wall option을 삭제 한다.

//BILLS_CPPWARNINGS = -Wall -Wno-char-subscripts -Woverloaded-virtual -Wno-unknown-pragmas -Wno-deprecated -Wformat=2
BILLS_CPPWARNINGS = -Wno-char-subscripts -Woverloaded-virtual -Wno-unknown-pragmas -Wno-deprecated -Wformat=2
//BILLS_CWARNINGS = -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-char-subscripts -Wno-unknown-pragmas -Wformat=2
BILLS_CWARNINGS = -Wmissing-prototypes -Wmissing-declarations -Wno-char-subscripts -Wno-unknown-pragmas -Wformat=2

error: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result

 : -Werror가 선언되어 있으면, 이것을 오류로 보고 한다. common/video/iso-mpeg4/src/Makefile의 AM_CXXFLAGS에서 -Wall과 -Werror를 삭제한다.

//AM_CXXFLAGS = -D__TRACE_AND_STATS_ -D__DOUBLE_PRECISION_ -D_REENTRANT -DNOCONTROLS -fexceptions -Wall -Werror -D_OBSS_ -Wall -Wno-char-subscripts -Woverloaded-virtual -Wno-unknown-pragmas -Wno-deprecated -Wformat=2
AM_CXXFLAGS = -D__TRACE_AND_STATS_ -D__DOUBLE_PRECISION_ -D_REENTRANT -DNOCONTROLS -fexceptions -D_OBSS_ -Wno-char-subscripts -Woverloaded-virtual -Wno-unknown-pragmas -Wno-deprecated -Wformat=2

* 만들어진 패치와 그것을 적용하는 방법에 대해서는 “mpeg4ip-1.5.0.1을 ubuntu 12.04에서 컴파일 하기 1“을 참조.

mpeg4ip-1.5.0.1을 ubuntu 12.04에서 컴파일 하기 1

Linux에서 AirVideo를 설정하기 위한 방법이 적힌 블로그를 보면서 따라고 하고 있었는데, mpeg4ip가 의도대로 컴파일 되지 않는 곳에서 막혀 버리고 말았다. 여기저기 찾아 보니 예전 버전의 gcc/g++에서는 잘 됐던것 같은데 최신 버전으로 판올림이 되면서 컴파일 되지 않게 된것 같다. hardy를 소스트리에 넣고 gcc-4.1 설치를 시도 했더니 오류가 뜨면서 동작하지 않았다. 결국, 4.4버전에서 mpeg4ip-1.5.0.1을 빌드되도록 고치기로 했다.

*주의: 이 포스트이 내용은 단순히 mpeg4ip-1.5.0.1을 gcc/g++ 4.4버전에서 빌드 되도록 수정하는 것에 관한것 이다.

다음의 패치 파일들을 다운로드한다.

# bootstrap을 패치하고 bootstrap을 실행시킨다.
$ cd mpeg4ip-1.5.0.1
$ patch -p1 < mpeg4ip-1.5.0.1-bootstrap.patch
$ ./bootstrap --disable-player # gcc/g++ 4.4 build 오류를 수정한 패치를 적용하고 빌드 한다.

$ patch -p1 < mpeg4ip-1.5.0.1-gcc4.4.patch
$ make
$ sudo make install

패치 내용에 대한 보다 자세한 설명은 “mpeg4ip-1.5.0.1을 ubuntu 12.04에서 컴파일 하기 2“를 참조.

Enjoy!

20120617-100128.jpg