TT#34050 replace ffmpeg version test macro

fixes #484

Change-Id: Ia7aa9d63e09a90afc2814f0edede480c06ecc53a
changes/88/19588/6
Richard Fuchs 8 years ago
parent 14100b0b8a
commit 5a73f12adb

1
daemon/.gitignore vendored

@ -10,3 +10,4 @@ rtplib.c
codeclib.c
resample.c
str.c
fix_frame_channel_layout.h

@ -113,8 +113,6 @@ ifeq ($(have_bcg729),yes)
LDFLAGS+= $(bcg729_lib)
endif
include ../lib/lib.Makefile
SRCS= main.c kernel.c poller.c aux.c control_tcp.c streambuf.c call.c control_udp.c redis.c \
bencode.c cookie_cache.c udp_listener.c control_ng.c sdp.c stun.c rtcp.c \
crypto.c rtp.c call_interfaces.c dtls.c log.c cli.c graphite.c ice.c socket.c \
@ -126,31 +124,6 @@ LIBSRCS+= codeclib.c resample.c
endif
OBJS= $(SRCS:.c=.o) $(LIBSRCS:.c=.o)
.PHONY: all dep clean debug install
all:
$(MAKE) $(TARGET)
debug:
$(MAKE) DBG=yes all
dep: .depend
clean:
rm -f $(OBJS) $(TARGET) $(LIBSRCS) .depend core core.*
.depend: $(SRCS) $(LIBSRCS) Makefile
$(CC) $(CFLAGS) -M $(SRCS) $(LIBSRCS) | sed -e 's/:/ .depend:/' > .depend
$(TARGET): $(OBJS) .depend Makefile
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS)
$(OBJS): Makefile
$(LIBSRCS):
ln -fs ../lib/$@
install:
include ../lib/common.Makefile
include .depend

@ -0,0 +1,48 @@
include ../lib/lib.Makefile
all:
$(MAKE) $(TARGET)
$(TARGET): $(OBJS) .depend Makefile
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS)
debug:
$(MAKE) DBG=yes all
dep: .depend
clean:
rm -f $(OBJS) $(TARGET) $(LIBSRCS) .depend core core.*
rm -f fix_frame_channel_layout.h fix_frame_channel_layout-test.[co]
.depend: $(SRCS) $(LIBSRCS) Makefile
$(CC) $(CFLAGS) -M $(SRCS) $(LIBSRCS) | sed -e 's/:/ .depend:/' > .depend
install:
$(OBJS): Makefile
$(LIBSRCS):
rm -f "$@"
echo '/******** GENERATED FILE ********/' > "$@"
cat ../lib/"$@" >> "$@"
resample.c: fix_frame_channel_layout.h
fix_frame_channel_layout.h: ../lib/fix_frame_channel_layout-*
echo "Looking for usable alternative for $@"; \
rm -f fix_frame_channel_layout-test.[co]; \
ln -s ../lib/fix_frame_channel_layout-test.c; \
for x in ../lib/fix_frame_channel_layout-*.h; do \
echo "Trying build with $$x"; \
rm -f "$@"; \
echo '/******** GENERATED FILE ********/' > "$@"; \
cat "$$x" >> "$@"; \
$(MAKE) fix_frame_channel_layout-test.o 2> /dev/null && break; \
echo "Failed build with $$x"; \
rm -f "$@"; \
done; \
rm -f fix_frame_channel_layout-test.[co]; \
test -f "$@"
.PHONY: all debug dep clean install install

@ -0,0 +1,9 @@
#include <libavutil/frame.h>
#include <libavutil/channel_layout.h>
#include "compat.h"
INLINE void fix_frame_channel_layout(AVFrame *frame) {
if (frame->channel_layout)
return;
frame->channel_layout = av_get_default_channel_layout(av_frame_get_channels(frame));
}

@ -0,0 +1,9 @@
#include <libavutil/frame.h>
#include <libavutil/channel_layout.h>
#include "compat.h"
INLINE void fix_frame_channel_layout(AVFrame *frame) {
if (frame->channel_layout)
return;
frame->channel_layout = av_get_default_channel_layout(frame->channels);
}

@ -0,0 +1,5 @@
#include "fix_frame_channel_layout.h"
void test() {
AVFrame *f = NULL;
fix_frame_channel_layout(f);
}

@ -11,6 +11,7 @@
#include <libavutil/frame.h>
#include "log.h"
#include "codeclib.h"
#include "fix_frame_channel_layout.h"
@ -20,11 +21,7 @@ AVFrame *resample_frame(resample_t *resample, AVFrame *frame, const format_t *to
int errcode = 0;
uint64_t to_channel_layout = av_get_default_channel_layout(to_format->channels);
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(54, 31, 0)
if (!frame->channel_layout)
frame->channel_layout = av_get_default_channel_layout(
av_frame_get_channels(frame));
#endif
fix_frame_channel_layout(frame);
if (frame->format != to_format->format)
goto resample;

@ -10,3 +10,4 @@ rtplib.c
codeclib.c
resample.c
str.c
fix_frame_channel_layout.h

@ -24,38 +24,11 @@ LDFLAGS+= $(shell pkg-config --libs libavfilter)
LDFLAGS+= $(shell mysql_config --libs)
LDFLAGS+= $(shell pkg-config --libs openssl)
include ../lib/lib.Makefile
SRCS= epoll.c garbage.c inotify.c main.c metafile.c stream.c recaux.c packet.c \
decoder.c output.c mix.c db.c log.c forward.c
LIBSRCS= loglib.c auxlib.c rtplib.c codeclib.c resample.c str.c
OBJS= $(SRCS:.c=.o) $(LIBSRCS:.c=.o)
.PHONY: all dep clean debug install
all:
$(MAKE) $(TARGET)
debug:
$(MAKE) DBG=yes all
dep: .depend
clean:
rm -f $(OBJS) $(TARGET) $(LIBSRCS) .depend core core.*
.depend: $(SRCS) $(LIBSRCS) Makefile
$(CC) $(CFLAGS) -M $(SRCS) $(LIBSRCS) | sed -e 's/:/ .depend:/' > .depend
$(TARGET): $(OBJS) .depend Makefile
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS)
$(OBJS): Makefile
$(LIBSRCS):
ln -fs ../lib/$@
install:
include ../lib/common.Makefile
include .depend

Loading…
Cancel
Save