summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroskwon <kos@dev3>2014-06-28 04:47:34 (GMT)
committeroskwon <kos@dev3>2014-06-29 07:09:52 (GMT)
commit6a65bf73299e93bad0258e881e7ddb470fb955a9 (patch)
tree05c55270e8d4da45e9aacaf6acb82b050879dc5a
parentd56e4b8e5766a767ff08131c58b88ae925ff47fe (diff)
Support autoconf and automake on openembedded.
Refactoring source tree.
-rw-r--r--.gitignore4
-rw-r--r--build/Makefile (renamed from script/Makefile)36
-rwxr-xr-xbuild/script.config85
-rwxr-xr-xbuild/script.upload (renamed from script/script.upload)0
-rw-r--r--configure.ac18
-rwxr-xr-xscript/script.config48
-rw-r--r--src/3rdparty/mpegts.cpp (renamed from src/external/mpegts.cpp)2
-rw-r--r--src/3rdparty/mpegts.h (renamed from src/external/mpegts.h)2
-rw-r--r--src/3rdparty/trap.cpp (renamed from src/external/trap.cpp)0
-rw-r--r--src/3rdparty/trap.h (renamed from src/external/trap.h)0
-rw-r--r--src/Demuxer.h2
-rw-r--r--src/Encoder.h2
-rw-r--r--src/Makefile.am22
-rw-r--r--src/Mpeg.cpp2
-rw-r--r--src/Mpeg.h4
-rw-r--r--src/Source.h2
16 files changed, 134 insertions, 95 deletions
diff --git a/.gitignore b/.gitignore
index 0a39cd8..44ddef9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
-streamproxy
filestreamproxy
transtreamproxy
*.ts
@@ -10,10 +9,9 @@ transtreamproxy
.cproject
.project
.deps
+.DS_Store
version.h
up.sh
-Makefile
-Makefile.in
aclocal.m4
autom4te.cache
config.h
diff --git a/script/Makefile b/build/Makefile
index e67f04c..2408020 100644
--- a/script/Makefile
+++ b/build/Makefile
@@ -1,8 +1,8 @@
#============================================================================
# Name : Makefile (transtreamproxy)
-# Author : oskwon(kos@dev3)
+# Author : oskwon(oskwon@dev3)
# Version :
-# Copyright : Copyright(c)2013 Vu+ Team. All right reserved.
+# Copyright : Copyright(c)2014 Vu+ Team. All right reserved.
# Description :
#============================================================================
@@ -19,21 +19,29 @@ PROJECT = transtreamproxy
TOP=$(PWD)/..
OBJ=./obj/
-CROSS=$(OETOP)/$(MODEL)/build/tmp/cross/mipsel/bin/mipsel-oe-linux-
+ifeq ($(CROSS),YES)
SYSROOT=$(OETOP)/$(MODEL)/build/tmp/staging/mipsel-oe-linux
+TOOLCHAIN=$(OETOP)/$(MODEL)/build/tmp/cross/mipsel/bin/mipsel-oe-linux-
+endif
RM=rm -Rf
-CXX=$(CROSS)g++
-LD=$(CROSS)ld
-STRIP=$(CROSS)strip
-UPLOAD=$(TOP)/script/script.upload
+CXX=$(TOOLCHAIN)g++
+LD=$(TOOLCHAIN)ld
+STRIP=$(TOOLCHAIN)strip
+UPLOAD=./script.upload
+
+ifeq ($(MODE),DEBUG)
+CFLAGS += -g
+else
+CFLAGS += -O2
+endif
+CFLAGS += -D_MAJOR=$(MAJOR) -D_MINOR=$(MINOR) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
+CFLAGS += -I$(SYSROOT)/usr/include
+LDFLAGS += -L$(SYSROOT)/usr/lib -lpthread -lrt
SRCS = $(shell find ../src/ -name "*.cpp")
-OBJS=$(SRCS:.cpp=.o)
-
-CFLAGS += -D_MAJOR=$(MAJOR) -D_MINOR=$(MINOR)
-CFLAGS += -O2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -I../src -I../src/external -I$(SYSROOT)/usr/include
-LDFLAGS += -L$(SYSROOT)/usr/lib -lpthread -lrt
+OBJS = $(SRCS:.cpp=.o)
+CFLAGS += $(addprefix -I, $(shell find ../src/ -type d))
.SUFFIXES : .cpp .o
.PHONY : all clean install .showinfo .prepare $(PROJECT)
@@ -48,10 +56,10 @@ $(PROJECT):$(OBJS)
$(STRIP) $@
install:
- @$(UPLOAD) $(IP) . $(PROJECT) $(UPDIR)
+ $(UPLOAD) $(UPIP) . $(PROJECT) $(UPDIR)
clean:
- $(RM) $(PROJECT) obj *.log *.o
+ $(RM) $(PROJECT) obj *.o *.a *.d *.log
.prepare:
@if [ ! -e obj ]; then mkdir obj; fi
diff --git a/build/script.config b/build/script.config
new file mode 100755
index 0000000..4e0cb62
--- /dev/null
+++ b/build/script.config
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+UPIP=192.168.0.1
+MODEL=vusolo2
+OETOP=/openembedded/path/here
+UPDIR=/home/root
+CROSS=YES
+MODE=DEBUG
+
+CONFIG_PATH=$PWD/config.mk
+
+function getValue() {
+ IN=$1
+ set -- "$IN"
+ IFS="="; declare -a Array=($*)
+ echo "${Array[1]}"
+}
+
+# set default config value from old config.
+if [ -e $CONFIG_PATH ]; then
+ MODEL="$(getValue `cat $CONFIG_PATH | grep 'MODEL='`)"
+ OETOP="$(getValue `cat $CONFIG_PATH | grep 'OETOP='`)"
+ UPIP="$(getValue `cat $CONFIG_PATH | grep 'UPIP='`)"
+ UPDIR="$(getValue `cat $CONFIG_PATH | grep 'UPDIR='`)"
+ CROSS="$(getValue `cat $CONFIG_PATH | grep 'CROSS='`)"
+ MODE="$(getValue `cat $CONFIG_PATH | grep 'MODE='`)"
+fi
+
+if [ -z $UPIP ]; then UPIP=192.168.0.1; fi
+if [ -z $MODEL ]; then MODEL=vusolo2; fi
+if [ -z $OETOP ]; then OETOP=/openembedded/path/here; fi
+if [ -z $UPDIR ]; then UPDIR=/home/root; fi
+if [ -z $CROSS ]; then CROSS=YES; fi
+if [ -z $MODE ]; then MODE=DEBUG; fi
+
+# input new config.
+read -p "Please, input model name [$MODEL] : " NEW_MODEL
+read -p "Please, input openembeded root path [$OETOP] : " NEW_OETOP
+read -p "Please, input upload path [$UPDIR] : " NEW_UPDIR
+read -p "Please, input target ip [$UPIP] : " NEW_UPIP
+read -p "Do you want to cross compile (yes : y | no : n) [$CROSS] : " NEW_CROSS
+read -p "Please, select build mode (release : r | debug : d) [$MODE] : " NEW_MODE
+
+# check new config value.
+if [ ! -z $NEW_UPIP ]; then UPIP=$NEW_UPIP; fi
+if [ ! -z $NEW_MODEL ]; then MODEL=$NEW_MODEL; fi
+if [ ! -z $NEW_OETOP ]; then OETOP=$NEW_OETOP; fi
+if [ ! -z $NEW_UPDIR ]; then UPDIR=$NEW_UPDIR; fi
+if [ ! -z $NEW_CROSS ]; then CROSS=$NEW_CROSS; fi
+if [ ! -z $NEW_MODE ]; then MODE=$NEW_MODE; fi
+
+case "$MODE" in
+ d | D | debug | DEBUG )
+ MODE=DEBUG ;;
+ r | R | release | RELEASE)
+ MODE=RELEASE ;;
+ *)
+ MODE=DEBUG ;;
+esac
+
+case "$CROSS" in
+ y | Y | yes | YES)
+ CROSS=YES ;;
+ n | N | no | NO )
+ CROSS=NO ;;
+ *)
+ CROSS=YES ;;
+esac
+
+# backup config file.
+if [ -e $CONFIG_PATH ]; then
+ cp -a $CONFIG_PATH $CONFIG_PATH.bak
+fi
+
+# write config file.
+echo "CROSS=$CROSS" > $CONFIG_PATH
+echo "" >> $CONFIG_PATH
+echo "MODEL=$MODEL" >> $CONFIG_PATH
+echo "OETOP=$OETOP" >> $CONFIG_PATH
+echo "" >> $CONFIG_PATH
+echo "UPDIR=$UPDIR" >> $CONFIG_PATH
+echo "UPIP=$UPIP" >> $CONFIG_PATH
+echo "" >> $CONFIG_PATH
+echo "MODE=$MODE" >> $CONFIG_PATH
+
diff --git a/script/script.upload b/build/script.upload
index 841a5e1..841a5e1 100755
--- a/script/script.upload
+++ b/build/script.upload
diff --git a/configure.ac b/configure.ac
index 246f9cc..dfe149a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,8 +2,8 @@
# Process this file with autoconf to produce a configure script.
#AC_PREREQ([2.69])
-AC_INIT([transtreamproxy], [2.1.0], [kos@dev3])
-AM_INIT_AUTOMAKE([transtreamproxy], [2.1.0])
+AC_INIT([transtreamproxy], [3.0.0], [oskwon@dev3])
+AM_INIT_AUTOMAKE([transtreamproxy], [3.0.0])
#AC_CONFIG_SRCDIR([main.cpp])
AC_CONFIG_HEADERS([config.h])
@@ -11,23 +11,19 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE
+AC_GNU_SOURCE
# Checks for programs.
-AC_PROG_CC
AC_PROG_CXX
AC_CONFIG_MACRO_DIR([m4])
-AC_CHECK_LIB(pthread, pthread_create)
-PTHREAD_LIBS=-lpthread
-AC_SUBST(PTHREAD_LIBS)
+AC_LANG_PUSH([C++])
+AC_CHECK_HEADERS([boost/crc.hpp], [], [AC_MSG_ERROR(No found boost libraries.)])
+AC_LANG_POP([C++])
+AC_CHECK_LIB(pthread, pthread_create)
AC_CHECK_LIB(rt, shm_open)
-RT_LIBS=-lrt
-AC_SUBST(RT_LIBS)
-
-WARN_CFLAGS=-Wno-unused-result
-AC_SUBST(WARN_CFLAGS)
# Checks for libraries.
AC_SUBST(PLATFORM)
diff --git a/script/script.config b/script/script.config
deleted file mode 100755
index 4ef3bc1..0000000
--- a/script/script.config
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/sh
-
-IP=192.168.0.1
-MODEL=vusolo2
-OETOP=/openembedded/path/here
-UPDIR=/home/root
-
-CONFIG_PATH=$PWD/config.mk
-
-function getValue() {
- IN=$1
- set -- "$IN"
- IFS="="; declare -a Array=($*)
- echo "${Array[1]}"
-}
-
-# set default config value from old config.
-if [ -e $CONFIG_PATH ]; then
- IP="$(getValue `cat $CONFIG_PATH | grep 'IP='`)"
- MODEL="$(getValue `cat $CONFIG_PATH | grep 'MODEL='`)"
- OETOP="$(getValue `cat $CONFIG_PATH | grep 'OETOP='`)"
- UPDIR="$(getValue `cat $CONFIG_PATH | grep 'UPDIR='`)"
-fi
-
-# input new config.
-read -p "Please, input model name [$MODEL] : " NEW_MODEL
-read -p "Please, input openembeded root path [$OETOP] : " NEW_OETOP
-read -p "Please, input target ip [$IP] : " NEW_IP
-read -p "Please, input upload path [$UPDIR] : " NEW_UPDIR
-
-# check new config value.
-if [ ! -z $NEW_IP ]; then IP=$NEW_IP; fi
-if [ ! -z $NEW_MODEL ]; then MODEL=$NEW_MODEL; fi
-if [ ! -z $NEW_OETOP ]; then OETOP=$NEW_OETOP; fi
-if [ ! -z $NEW_UPDIR ]; then UPDIR=$NEW_UPDIR; fi
-
-# backup config file.
-if [ -e $CONFIG_PATH ]; then
- cp -a $CONFIG_PATH $CONFIG_PATH.bak
-fi
-
-# write config file.
-echo "MODEL=$MODEL" > $CONFIG_PATH
-echo "OETOP=$OETOP" >> $CONFIG_PATH
-echo "" >> $CONFIG_PATH
-echo "IP=$IP" >> $CONFIG_PATH
-echo "" >> $CONFIG_PATH
-echo "UPDIR=$UPDIR" >> $CONFIG_PATH
diff --git a/src/external/mpegts.cpp b/src/3rdparty/mpegts.cpp
index c70b92f..cc90959 100644
--- a/src/external/mpegts.cpp
+++ b/src/3rdparty/mpegts.cpp
@@ -3,7 +3,7 @@
#include "mpegts.h"
//#include "util.h" // oskwon
-#include "Util.h" // oskwon
+#include "../Util.h" // oskwon
#include <unistd.h>
#include <stddef.h>
diff --git a/src/external/mpegts.h b/src/3rdparty/mpegts.h
index 9eaec7c..6402dca 100644
--- a/src/external/mpegts.h
+++ b/src/3rdparty/mpegts.h
@@ -10,7 +10,7 @@
#include <stdint.h>
#include <sys/types.h>
-#include "Source.h" // oskwon
+#include "../Source.h" // oskwon
class MpegTS : public Source // oskwon : inherit Source class.
{
private:
diff --git a/src/external/trap.cpp b/src/3rdparty/trap.cpp
index b57b23e..b57b23e 100644
--- a/src/external/trap.cpp
+++ b/src/3rdparty/trap.cpp
diff --git a/src/external/trap.h b/src/3rdparty/trap.h
index ed33328..ed33328 100644
--- a/src/external/trap.h
+++ b/src/3rdparty/trap.h
diff --git a/src/Demuxer.h b/src/Demuxer.h
index 5c90dda..4b8732a 100644
--- a/src/Demuxer.h
+++ b/src/Demuxer.h
@@ -11,7 +11,7 @@
#include <vector>
#include <string>
-#include "trap.h"
+#include "3rdparty/trap.h"
#include "Util.h"
#include "Http.h"
diff --git a/src/Encoder.h b/src/Encoder.h
index 0760dbb..e44cfb9 100644
--- a/src/Encoder.h
+++ b/src/Encoder.h
@@ -10,7 +10,7 @@
#include <string>
-#include "trap.h"
+#include "3rdparty/trap.h"
#include "SharedMemory.h"
//----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 8bd34c3..5f6df1a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,15 +3,15 @@
bin_PROGRAMS = transtreamproxy
transtreamproxy_SOURCES = \
main.cpp \
- uThread.cpp \
- eParser.cpp \
- eURIDecoder.cpp \
- eUpstreamSocket.cpp \
- eTransCodingDevice.cpp \
- eFilePumpThread.cpp \
- eNetworkPumpThread.cpp \
- eDemuxPumpThread.cpp \
- eHostInfoMgr.cpp
+ Demuxer.cpp \
+ Encoder.cpp \
+ Http.cpp \
+ Logger.cpp \
+ Mpeg.cpp \
+ UriDecoder.cpp \
+ Util.cpp \
+ 3rdparty/mpegts.cpp \
+ 3rdparty/trap.cpp
-transtreamproxy_CXXFLAGS = $(LIBSDL_CFLAGS) @WARN_CFLAGS@
-transtreamproxy_LDADD = $(LIBLTDL) @PTHREAD_LIBS@ @RT_LIBS@
+transtreamproxy_CXXFLAGS = $(LIBSDL_CFLAGS) -Wno-unused-result -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
+transtreamproxy_LDADD = $(LIBLTDL) -lpthread -lrt
diff --git a/src/Mpeg.cpp b/src/Mpeg.cpp
index 772cb6f..0cac649 100644
--- a/src/Mpeg.cpp
+++ b/src/Mpeg.cpp
@@ -29,7 +29,7 @@ void Mpeg::seek(HttpHeader &header)
}
}
else {
- off_t position_offset;
+ pts_t position_offset;
if (!relative.empty()) {
int dur = calc_length();
DEBUG("duration : %d", dur);
diff --git a/src/Mpeg.h b/src/Mpeg.h
index 5a24f35..88db459 100644
--- a/src/Mpeg.h
+++ b/src/Mpeg.h
@@ -8,8 +8,8 @@
#ifndef MPEG_H_
#define MPEG_H_
-#include "trap.h"
-#include "mpegts.h"
+#include "3rdparty/trap.h"
+#include "3rdparty/mpegts.h"
//----------------------------------------------------------------------
class HttpHeader;
diff --git a/src/Source.h b/src/Source.h
index 003fdeb..399fa54 100644
--- a/src/Source.h
+++ b/src/Source.h
@@ -8,7 +8,7 @@
#ifndef SOURCE_H_
#define SOURCE_H_
-#include "trap.h"
+#include "3rdparty/trap.h"
//----------------------------------------------------------------------
class Source