From f7e3f576a7cef57c300c6c5e9be17320e845e2b4 Mon Sep 17 00:00:00 2001 From: Martin Molnar Date: Tue, 28 Apr 2009 23:24:58 +0200 Subject: [PATCH] Omkize streamer --- Makefile | 43 +++++++++---------------------------------- Makefile.omk | 26 ++++++++++++++++++++++++++ README.txt | 29 +++++++++++++++++++++++++++++ codec.c | 8 ++++++-- input.c | 2 +- output.c | 2 +- streamer.c | 4 ++-- 7 files changed, 74 insertions(+), 40 deletions(-) create mode 100644 Makefile.omk create mode 100644 README.txt diff --git a/Makefile b/Makefile index 57ae86b..b22a357 100644 --- a/Makefile +++ b/Makefile @@ -1,39 +1,14 @@ -FFSRC ?= $(FFDIR) -CPPFLAGS= -I $(FFSRC) -CFLAGS = -Wall -CFLAGS += -Wdeclaration-after-statement -CFLAGS += -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -CFLAGS += -Wno-pointer-sign -LDFLAGS= -L $(FFDIR)/libavutil -L $(FFDIR)/libavcodec -L $(FFDIR)/libavformat -L $(FFDIR)/libavdevice -LDLIBS = -lavdevice -lavformat -lavcodec -lavutil +# Generic directory or leaf node makefile for OCERA make framework -LDLIBS += -lm -lz -CFLAGS += -g - -OBJS = input.o codec.o output.o +ifndef MAKERULES_DIR +MAKERULES_DIR := $(shell ( old_pwd="" ; while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" = `pwd` ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) ) +endif -ifdef AQUOSA -CPPFLAGS += -I$(AQUOSA)/include -LDFLAGS += -L$(AQUOSA)/lib -LDLIBS += -lqreslib -lqmgrlib -lrt -OBJS += rt_qosmgr.o +ifeq ($(MAKERULES_DIR),) +all : default +.DEFAULT:: + @echo -e "\nThe Makefile.rules has not been found in this or partent directory\n" else -OBJS += rt.o +include $(MAKERULES_DIR)/Makefile.rules endif - -all: streamer - -streamer: streamer.o $(OBJS) - -clean: - rm -f *.o streamer *.d - -################################### -%.d: %.c - $(CC) $(CPPFLAGS) -MM -MF $@ $< - -%.o: %.d - --include $(OBJS:.o=.d) - diff --git a/Makefile.omk b/Makefile.omk new file mode 100644 index 0000000..35be7ae --- /dev/null +++ b/Makefile.omk @@ -0,0 +1,26 @@ +#FFSRC ?= $(FFDIR) +#CPPFLAGS= -I $(FFSRC) +CFLAGS = -Wall +CFLAGS += -Wdeclaration-after-statement +CFLAGS += -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls +CFLAGS += -Wno-pointer-sign +CFLAGS += -I /usr/include/ffmpeg +#LDFLAGS= -L $(FFDIR)/libavutil -L $(FFDIR)/libavcodec -L $(FFDIR)/libavformat -L $(FFDIR)/libavdevice +#LDLIBS = -lavdevice -lavformat -lavcodec -lavutil + +LDLIBS += -lm -lz +#CFLAGS += -g + +ifdef AQUOSA +CPPFLAGS += -I$(AQUOSA)/include +LDFLAGS += -L$(AQUOSA)/lib +LDLIBS += -lqreslib -lqmgrlib -lrt +OBJS += rt_qosmgr.o +else +OBJS += rt.o +endif + +bin_PROGRAMS=streamer +streamer_SOURCES=streamer.c input.c codec.c output.c + +lib_LOADLIBES+= avformat avcodec avutil m z diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..8bcae56 --- /dev/null +++ b/README.txt @@ -0,0 +1,29 @@ +The video encoder (see the instructions at the end of the email for building it) +grabs video from a video4linux2 device, encodes it (currently, to mpeg4 video; +the video encoder will allow to modify some settings in the future), and streams +it over RTP. +It can be started as + streamer [] +where the options allow to change the video capture device, the video size and +frame rate, the destination address, etc... + +The SDP needed for receiving the video stream is saved in the "sdp.txt" file. + + +HOW TO BUILD: +The encoder and streamer is based on ffmpeg's libraries. So, first you have to download +and compile ffmpeg + tar xvzf RTEncoder-v0.1.tgz + cd RTEncoder-v0.1 + svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg + cd ffmpeg + ./configure; make +OR + +install deb packages libswscale-dev, libavformat-dev + + +Compile the streamer + cd .. + make FFDIR=ffmpeg +It should create a "streamer" executable. diff --git a/codec.c b/codec.c index ed12720..8496562 100644 --- a/codec.c +++ b/codec.c @@ -3,9 +3,13 @@ * * This is free software; see GPL.txt */ -#include "libavformat/avformat.h" +/*#include "libavformat/avformat.h" #include "libavcodec/avcodec.h" -#include "libswscale/swscale.h" +#include "libswscale/swscale.h"*/ + +#include +#include +#include struct resample_data { struct SwsContext *resample_ctx; diff --git a/input.c b/input.c index c7baf91..3198334 100644 --- a/input.c +++ b/input.c @@ -4,7 +4,7 @@ * This is free software; see GPL.txt */ #include -#include "libavformat/avformat.h" +#include #include "input.h" static uint64_t time_convert(uint64_t time, AVStream *st) diff --git a/output.c b/output.c index 738f654..65e0897 100644 --- a/output.c +++ b/output.c @@ -3,7 +3,7 @@ * * This is free software; see GPL.txt */ -#include "libavformat/avformat.h" +#include AVFormatContext *open_output_stream(const char *dst, int port, enum CodecType codec_type) diff --git a/streamer.c b/streamer.c index b8eeff3..84a320f 100644 --- a/streamer.c +++ b/streamer.c @@ -6,8 +6,8 @@ #include #include -#include "libavformat/avformat.h" -#include "libavdevice/avdevice.h" +#include +//#include #include "input.h" #include "output.h" -- 2.39.2