summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mk/modules.mk14
-rw-r--r--modules/avcodec/decode.c10
-rw-r--r--modules/avcodec/encode.c2
-rw-r--r--modules/daala/daala.c3
-rw-r--r--modules/daala/decode.c2
-rw-r--r--modules/daala/encode.c17
-rw-r--r--modules/mpa/decode.c11
-rw-r--r--modules/v4l2_codec/v4l2_codec.c12
-rw-r--r--modules/zrtp/module.mk2
-rw-r--r--src/audio.c4
-rw-r--r--src/config.c1
11 files changed, 54 insertions, 24 deletions
diff --git a/mk/modules.mk b/mk/modules.mk
index e0faccd..b674a92 100644
--- a/mk/modules.mk
+++ b/mk/modules.mk
@@ -110,6 +110,8 @@ USE_GST_VIDEO := \
&& echo "yes")
USE_GST_VIDEO1 := $(shell pkg-config --exists gstreamer-1.0 gstreamer-app-1.0 \
&& echo "yes")
+USE_GTK := $(shell pkg-config 'gtk+-2.0 >= 2.22' && \
+ pkg-config 'glib-2.0 >= 2.32' && echo "yes")
ifneq ($(USE_AVCODEC),)
USE_H265 := $(shell [ -f $(SYSROOT)/include/x265.h ] || \
[ -f $(SYSROOT)/local/include/x265.h ] || \
@@ -200,9 +202,6 @@ USE_VPX := $(shell [ -f $(SYSROOT)/include/vpx/vp8.h ] \
|| [ -f $(SYSROOT)/local/include/vpx/vp8.h ] \
|| [ -f $(SYSROOT_ALT)/include/vpx/vp8.h ] \
&& echo "yes")
-USE_GTK := $(shell [ -f $(SYSROOT)/include/gtk-2.0/gtk/gtk.h ] || \
- [ -f $(SYSROOT)/local/include/gtk-2.0/gtk/gtk.h ] || \
- [ -f $(SYSROOT_ALT)/include/gtk-2.0/gtk/gtk.h ] && echo "yes")
else
# Windows.
# Accounts for mingw with Windows SDK (formerly known as Platform SDK)
@@ -342,6 +341,9 @@ endif
ifneq ($(USE_GST_VIDEO1),)
MODULES += gst_video1
endif
+ifneq ($(USE_GTK),)
+MODULES += gtk
+endif
ifneq ($(USE_H265),)
MODULES += h265
endif
@@ -409,7 +411,7 @@ ifneq ($(USE_V4L),)
MODULES += v4l
endif
ifneq ($(USE_V4L2),)
-MODULES += v4l2
+MODULES += v4l2 v4l2_codec
endif
ifneq ($(USE_VPX),)
MODULES += vpx
@@ -423,10 +425,6 @@ endif
ifneq ($(USE_ZRTP),)
MODULES += zrtp
endif
-ifneq ($(USE_GTK),)
-MODULES += gtk
-endif
-
ifneq ($(USE_DSHOW),)
MODULES += dshow
endif
diff --git a/modules/avcodec/decode.c b/modules/avcodec/decode.c
index affb855..c686a63 100644
--- a/modules/avcodec/decode.c
+++ b/modules/avcodec/decode.c
@@ -7,14 +7,18 @@
#include <rem.h>
#include <baresip.h>
#include <libavcodec/avcodec.h>
+#include <libavutil/avutil.h>
#include <libavutil/mem.h>
+#if LIBAVCODEC_VERSION_INT >= ((53<<16)+(5<<8)+0)
#include <libavutil/pixdesc.h>
+#endif
#include "h26x.h"
#include "avcodec.h"
#if LIBAVUTIL_VERSION_MAJOR < 52
#define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P
+#define AV_PIX_FMT_YUVJ420P PIX_FMT_YUVJ420P
#define AV_PIX_FMT_NV12 PIX_FMT_NV12
#endif
@@ -175,9 +179,11 @@ static int ffdecode(struct viddec_state *st, struct vidframe *frame,
if (got_picture) {
+#if LIBAVCODEC_VERSION_INT >= ((53<<16)+(5<<8)+0)
switch (st->pict->format) {
case AV_PIX_FMT_YUV420P:
+ case AV_PIX_FMT_YUVJ420P:
frame->fmt = VID_FMT_YUV420P;
break;
@@ -188,7 +194,9 @@ static int ffdecode(struct viddec_state *st, struct vidframe *frame,
av_get_pix_fmt_name(st->pict->format));
goto out;
}
-
+#else
+ frame->fmt = VID_FMT_YUV420P;
+#endif
for (i=0; i<4; i++) {
frame->data[i] = st->pict->data[i];
diff --git a/modules/avcodec/encode.c b/modules/avcodec/encode.c
index 0ca635c..620b561 100644
--- a/modules/avcodec/encode.c
+++ b/modules/avcodec/encode.c
@@ -202,9 +202,11 @@ static int open_encoder(struct videnc_state *st,
}
#endif
+#if LIBAVCODEC_VERSION_INT >= ((53<<16)+(5<<8)+0)
st->pict->format = pix_fmt;
st->pict->width = size->w;
st->pict->height = size->h;
+#endif
out:
if (err) {
diff --git a/modules/daala/daala.c b/modules/daala/daala.c
index 130ca59..b5790fa 100644
--- a/modules/daala/daala.c
+++ b/modules/daala/daala.c
@@ -20,6 +20,9 @@
* - Define and implement fragmentation of large packets
* - Define an IETF RTP Payload type
*
+ * External libraries:
+ *
+ * daala version 0.0-1564-g79787c7 (or later)
*
* References:
*
diff --git a/modules/daala/decode.c b/modules/daala/decode.c
index e2217c8..cacd8b5 100644
--- a/modules/daala/decode.c
+++ b/modules/daala/decode.c
@@ -143,7 +143,7 @@ int daala_decode(struct viddec_state *vds, struct vidframe *frame,
}
}
else {
- od_img img;
+ daala_image img;
if (!vds->got_headers) {
warning("daala: decode: still waiting for headers\n");
diff --git a/modules/daala/encode.c b/modules/daala/encode.c
index 7770bd6..d8abe4d 100644
--- a/modules/daala/encode.c
+++ b/modules/daala/encode.c
@@ -130,10 +130,12 @@ static int open_encoder(struct videnc_state *ves, const struct vidsz *size)
daala_comment dc;
daala_packet dp;
int err = 0;
- int complexity = 0;
- int video_q = 10;
+ int complexity = 7;
+ int video_q = 30;
+ int bitrate = ves->bitrate;
- info("daala: open encoder (%d x %d)\n", size->w, size->h);
+ info("daala: open encoder (%d x %d, %d bps)\n",
+ size->w, size->h, bitrate);
if (ves->enc) {
debug("daala: re-opening encoder\n");
@@ -175,6 +177,9 @@ static int open_encoder(struct videnc_state *ves, const struct vidsz *size)
daala_encode_ctl(ves->enc, OD_SET_COMPLEXITY,
&complexity, sizeof(complexity));
+ daala_encode_ctl(ves->enc, OD_SET_BITRATE,
+ &bitrate, sizeof(bitrate));
+
for (;;) {
int r;
@@ -215,7 +220,8 @@ int daala_encode(struct videnc_state *ves, bool update,
const struct vidframe *frame)
{
int r, err = 0;
- od_img img;
+ daala_image img;
+ unsigned i;
(void)update; /* XXX: how to force a KEY-frame? */
if (!ves || !frame || frame->fmt != VID_FMT_YUV420P)
@@ -250,6 +256,9 @@ int daala_encode(struct videnc_state *ves, bool update,
img.planes[2].xstride = 1;
img.planes[2].ystride = frame->linesize[2];
+ for (i=0; i<3; i++)
+ img.planes[i].bitdepth = 8;
+
img.nplanes = 3;
img.width = frame->size.w;
diff --git a/modules/mpa/decode.c b/modules/mpa/decode.c
index b71a335..7dfaccb 100644
--- a/modules/mpa/decode.c
+++ b/modules/mpa/decode.c
@@ -125,9 +125,9 @@ int mpa_decode_frm(struct audec_state *ads, int16_t *sampv, size_t *sampc,
if (!ads || !sampv || !sampc || !buf || len<=4)
return EINVAL;
- if (*(uint32_t*)buf != 0) {
+ if (*(uint32_t*)(void *)buf != 0) {
error("MPA dec header is not zero %08X, not supported yet\n",
- *(uint32_t*)buf);
+ *(uint32_t*)(void *)buf);
return EPROTO;
}
@@ -151,7 +151,8 @@ int mpa_decode_frm(struct audec_state *ads, int16_t *sampv, size_t *sampc,
speex_resampler_destroy(ads->resampler);
if (samplerate != MPA_IORATE) {
ads->resampler = speex_resampler_init(channels,
- (uint32_t)samplerate, MPA_IORATE, 3, &result);
+ (uint32_t)samplerate, MPA_IORATE,
+ 3, &result);
if (result!=RESAMPLER_ERR_SUCCESS
|| ads->resampler==NULL) {
error("MPA dec upsampler failed %d\n",result);
@@ -170,9 +171,9 @@ int mpa_decode_frm(struct audec_state *ads, int16_t *sampv, size_t *sampc,
}
if (ads->resampler) {
- intermediate_len = n / 2 / ads->channels;
+ intermediate_len = (uint32_t)(n / 2 / ads->channels);
/* intermediate_len counts samples per channel */
- out_len = *sampc / 2;
+ out_len = (uint32_t)(*sampc / 2);
result=speex_resampler_process_interleaved_int(
ads->resampler, ads->intermediate_buffer,
diff --git a/modules/v4l2_codec/v4l2_codec.c b/modules/v4l2_codec/v4l2_codec.c
index 08ec746..c32955b 100644
--- a/modules/v4l2_codec/v4l2_codec.c
+++ b/modules/v4l2_codec/v4l2_codec.c
@@ -119,12 +119,16 @@ static int print_caps(int fd, unsigned width, unsigned height)
info(" Formats:\n");
while (0 == xioctl(fd, VIDIOC_ENUM_FMT, &fmtdesc)) {
- bool selected = fmtdesc.pixelformat == V4L2_PIX_FMT_H264;
+ bool selected = false;
strncpy(fourcc, (char *)&fmtdesc.pixelformat, 4);
- if (fmtdesc.pixelformat == V4L2_PIX_FMT_H264)
- support_h264 = true;
+#ifdef V4L2_PIX_FMT_H264
+ if (fmtdesc.pixelformat == V4L2_PIX_FMT_H264) {
+ support_h264 = true;
+ selected = true;
+ }
+#endif
c = fmtdesc.flags & V4L2_FMT_FLAG_COMPRESSED ? 'C' : ' ';
@@ -145,7 +149,9 @@ static int print_caps(int fd, unsigned width, unsigned height)
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
fmt.fmt.pix.width = width;
fmt.fmt.pix.height = height;
+#ifdef V4L2_PIX_FMT_H264
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_H264;
+#endif
fmt.fmt.pix.field = V4L2_FIELD_NONE;
if (-1 == xioctl(fd, VIDIOC_S_FMT, &fmt)) {
diff --git a/modules/zrtp/module.mk b/modules/zrtp/module.mk
index 6590571..5670b98 100644
--- a/modules/zrtp/module.mk
+++ b/modules/zrtp/module.mk
@@ -7,7 +7,7 @@
MOD := zrtp
$(MOD)_SRCS += zrtp.c
$(MOD)_LFLAGS += -lzrtp -lbn
-$(MOD)_CFLAGS += -I/usr/local/include/libzrtp
+$(MOD)_CFLAGS += -isystem /usr/local/include/libzrtp
$(MOD)_CFLAGS += -Wno-strict-prototypes
include mk/mod.mk
diff --git a/src/audio.c b/src/audio.c
index f317bdf..c98e35c 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -53,7 +53,7 @@
*/
enum {
- AUDIO_SAMPSZ = 6*1152,
+ AUDIO_SAMPSZ = 3*1920 /* Max samples, 48000Hz 2ch at 60ms */
};
@@ -564,6 +564,8 @@ static int aurx_stream_decode(struct aurx *rx, struct mbuf *mb)
mbuf_buf(mb), mbuf_get_left(mb));
}
else if (rx->ac->plch) {
+ sampc = rx->ac->srate * rx->ac->ch * rx->ptime / 1000;
+
err = rx->ac->plch(rx->dec, rx->sampv, &sampc);
}
else {
diff --git a/src/config.c b/src/config.c
index 6fb2a99..344a7bd 100644
--- a/src/config.c
+++ b/src/config.c
@@ -567,6 +567,7 @@ int config_write_template(const char *file, const struct config *cfg)
(void)re_fprintf(f, "#module\t\t\t" MOD_PRE "l16" MOD_EXT "\n");
(void)re_fprintf(f, "#module\t\t\t" MOD_PRE "speex" MOD_EXT "\n");
(void)re_fprintf(f, "#module\t\t\t" MOD_PRE "bv32" MOD_EXT "\n");
+ (void)re_fprintf(f, "#module\t\t\t" MOD_PRE "mpa" MOD_EXT "\n");
(void)re_fprintf(f, "\n# Audio filter Modules (in encoding order)\n");
(void)re_fprintf(f, "module\t\t\t" MOD_PRE "vumeter" MOD_EXT "\n");