Browse Source

TT#5566 decode RTP streams

Change-Id: I2342d393c01f2119d7f60f7e6b16e17acd3e0a19
changes/32/9632/5
Richard Fuchs 9 years ago
parent
commit
3977e94659
6 changed files with 28 additions and 0 deletions
  1. +3
    -0
      debian/control
  2. +1
    -0
      recording-daemon/.gitignore
  3. +6
    -0
      recording-daemon/Makefile
  4. +5
    -0
      recording-daemon/main.c
  5. +10
    -0
      recording-daemon/stream.c
  6. +3
    -0
      recording-daemon/types.h

+ 3
- 0
debian/control View File

@ -4,6 +4,9 @@ Priority: extra
Maintainer: Sipwise Development Team <support@sipwise.com>
Build-Depends: debhelper (>= 5),
iptables-dev (>= 1.4),
libavformat-dev,
libavcodec-dev,
libavutil-dev,
libcurl4-openssl-dev | libcurl4-gnutls-dev | libcurl3-openssl-dev | libcurl3-gnutls-dev,
libevent-dev (>= 2.0),
libglib2.0-dev (>= 2.30),


+ 1
- 0
recording-daemon/.gitignore View File

@ -3,3 +3,4 @@
core
core.*
.ycm_extra_conf.pyc
rtpengine-recording

+ 6
- 0
recording-daemon/Makefile View File

@ -7,6 +7,9 @@ CFLAGS+= -D_GNU_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE
CFLAGS+= `pkg-config --cflags glib-2.0`
CFLAGS+= `pkg-config --cflags gthread-2.0`
#CFLAGS+= `pcre-config --cflags`
CFLAGS+= `pkg-config --cflags libavcodec`
CFLAGS+= `pkg-config --cflags libavformat`
CFLAGS+= `pkg-config --cflags libavutil`
ifeq ($(DBG),yes)
CFLAGS+= -D__DEBUG=1
@ -18,6 +21,9 @@ LDFLAGS= -lm
LDFLAGS+= `pkg-config --libs glib-2.0`
LDFLAGS+= `pkg-config --libs gthread-2.0`
#LDFLAGS+= `pcre-config --libs`
LDFLAGS+= `pkg-config --libs libavcodec`
LDFLAGS+= `pkg-config --libs libavformat`
LDFLAGS+= `pkg-config --libs libavutil`
ifneq ($(DBG),yes)
DPKG_BLDFLGS= $(shell which dpkg-buildflags 2>/dev/null)


+ 5
- 0
recording-daemon/main.c View File

@ -6,6 +6,8 @@
#include <glib.h>
#include <unistd.h>
#include <signal.h>
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include "log.h"
#include "epoll.h"
#include "inotify.h"
@ -32,6 +34,9 @@ static void signals(void) {
static void setup(void) {
av_register_all();
avcodec_register_all();
avformat_network_init();
signals();
metafile_setup();
epoll_setup();


+ 10
- 0
recording-daemon/stream.c View File

@ -4,6 +4,7 @@
#include <unistd.h>
#include <limits.h>
#include <fcntl.h>
#include <libavformat/avformat.h>
#include "metafile.h"
#include "epoll.h"
#include "log.h"
@ -88,6 +89,15 @@ void stream_open(metafile_t *mf, unsigned long id, char *name) {
return;
}
stream->avinf = av_find_input_format("rtp");
ilog(LOG_DEBUG, "avinf %p", stream->avinf);
stream->avfctx = avformat_alloc_context();
unsigned char *buf = av_malloc(1024); // ?
stream->avfctx->pb = avio_alloc_context(buf, 1024, 1, NULL, NULL, NULL, NULL);
int ret = avformat_open_input(&stream->avfctx, "", stream->avinf, NULL);
ilog(LOG_DEBUG, "ret %i avfctx %p", ret, stream->avfctx);
// add to epoll
stream->handler.ptr = stream;
stream->handler.func = stream_handler;


+ 3
- 0
recording-daemon/types.h View File

@ -6,6 +6,7 @@
#include <sys/types.h>
#include <glib.h>
#include <pcre.h>
#include <libavformat/avformat.h>
typedef struct handler_s handler_t;
@ -22,6 +23,8 @@ struct stream_s {
unsigned long id;
int fd;
handler_t handler;
AVInputFormat *avinf;
AVFormatContext *avfctx;
};
typedef struct stream_s stream_t;


Loading…
Cancel
Save