Skip to content

Commit

Permalink
en50221: use own en50221 code which replaces liben50221 from dvb-apps…
Browse files Browse the repository at this point in the history
…, fixes #4738
  • Loading branch information
perexg committed Dec 14, 2017
1 parent 3b232b6 commit fab0a6c
Show file tree
Hide file tree
Showing 24 changed files with 3,333 additions and 920 deletions.
12 changes: 0 additions & 12 deletions .doozer.json
Expand Up @@ -18,7 +18,6 @@
"liburiparser-dev",
"libpcre3-dev",
"python",
"dvb-apps",
"debhelper",
"ccache",
"libx11-xcb-dev"
Expand All @@ -45,7 +44,6 @@
"liburiparser-dev",
"libpcre3-dev",
"python",
"dvb-apps",
"debhelper",
"ccache"
],
Expand All @@ -71,7 +69,6 @@
"liburiparser-dev",
"libpcre2-dev",
"python",
"dvb-apps",
"debhelper",
"ccache"
],
Expand All @@ -96,7 +93,6 @@
"liburiparser-dev",
"libpcre2-dev",
"python",
"dvb-apps",
"debhelper",
"ccache"
],
Expand All @@ -123,7 +119,6 @@
"liburiparser-dev",
"libpcre3-dev",
"python",
"dvb-apps",
"debhelper",
"ccache"
],
Expand All @@ -150,7 +145,6 @@
"liburiparser-dev",
"libpcre3-dev",
"python",
"dvb-apps",
"debhelper",
"ccache"
],
Expand All @@ -177,7 +171,6 @@
"liburiparser-dev",
"libpcre3-dev",
"python",
"dvb-apps",
"debhelper",
"ccache"
],
Expand All @@ -204,7 +197,6 @@
"liburiparser-dev",
"libpcre3-dev",
"python",
"dvb-apps",
"debhelper",
"ccache"
],
Expand All @@ -230,7 +222,6 @@
"liburiparser-dev",
"libpcre2-dev",
"python",
"dvb-apps",
"debhelper",
"ccache"
],
Expand All @@ -256,7 +247,6 @@
"liburiparser-dev",
"libpcre3-dev",
"python",
"dvb-apps",
"debhelper",
"ccache"
],
Expand All @@ -282,7 +272,6 @@
"liburiparser-dev",
"libpcre2-dev",
"python",
"dvb-apps",
"debhelper",
"ccache"
],
Expand All @@ -308,7 +297,6 @@
"liburiparser-dev",
"libpcre2-dev",
"python",
"dvb-apps",
"debhelper",
"ccache"
],
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Expand Up @@ -572,6 +572,9 @@ I18N-C += $(SRCS-CONSTCW)

# DVB CAM
SRCS-DVBCAM = \
src/input/mpegts/en50221/en50221.c \
src/input/mpegts/en50221/en50221_apps.c \
src/input/mpegts/en50221/en50221_capmt.c \
src/input/mpegts/linuxdvb/linuxdvb_ca.c \
src/descrambler/dvbcam.c
SRCS-${CONFIG_LINUXDVB_CA} += $(SRCS-DVBCAM)
Expand Down
42 changes: 7 additions & 35 deletions configure
Expand Up @@ -66,7 +66,6 @@ OPTIONS=(
"bundle:no"
"pngquant:no"
"dvbcsa:no"
"dvben50221:auto"
"kqueue:no"
"dbus_1:auto"
"android:no"
Expand Down Expand Up @@ -178,6 +177,12 @@ uint64_t test(time_t *ptr){
return __sync_fetch_and_add(ptr, 1);
}'

check_cc_snippet atomic_ptr '#include <stdint.h>
#include <time.h>
void *test(void * volatile *ptr){
return __sync_fetch_and_add(ptr, (void *)1);
}'

check_cc_snippet bitops64 '#include <stdint.h>
int test(void){
int l = sizeof(long);
Expand Down Expand Up @@ -282,23 +287,6 @@ else
printf " ^ using build-in glibc iconv routines\n"
fi

if enabled_or_auto dvben50221; then
check_cc_snippet libdvben50221 '
#include <libdvben50221/en50221_session.h>
#define TEST test
int test(void)
{
struct en50221_transport_layer *tl = en50221_tl_create(5, 32);
return 0;
}
' '-ldvben50221 -ldvbapi -lucsi'
if enabled libdvben50221; then
enable dvben50221
else
disable dvben50221
fi
fi

check_cc_snippet ifnames '
#include <net/if.h>
int test(void)
Expand Down Expand Up @@ -354,6 +342,7 @@ check_cc_header 'linux/dvb/version' linuxdvbapi
if enabled_or_auto linuxdvb; then
if enabled linuxdvbapi; then
enable linuxdvb
enable linuxdvb_ca
elif enabled linuxdvb; then
die "Linux DVB API not found (use --disable-linuxdvb)"
fi
Expand Down Expand Up @@ -642,23 +631,6 @@ if enabled cwc || enabled cccam || enabled capmt || enabled constcw; then
fi
fi

#
# libdvben50221
#
if enabled linuxdvb; then
if enabled libdvben50221; then
LDFLAGS="$LDFLAGS -ldvben50221 -ldvbapi -lucsi"
enable linuxdvb_ca
fi
fi

# DD CI support
if enabled ddci; then
if disabled linuxdvb_ca; then
die "DD CI requires linuxdvb_ca (linuxdvb libdvben50221) (use --disable-ddci)"
fi
fi

#
# Icon caching
#
Expand Down
4 changes: 2 additions & 2 deletions debian/control
Expand Up @@ -2,12 +2,12 @@ Source: tvheadend
Section: video
Priority: extra
Maintainer: Adam Sutton <aps@tvheadend.org>
Build-Depends: debhelper (>= 7.0.50), pkg-config, gettext, libavahi-client-dev, libssl-dev, zlib1g-dev, wget, bzip2, git-core, liburiparser-dev, python, ca-certificates, cmake, dvb-apps, libpcre2-dev | libpcre3-dev
Build-Depends: debhelper (>= 7.0.50), pkg-config, gettext, libavahi-client-dev, libssl-dev, zlib1g-dev, wget, bzip2, git-core, liburiparser-dev, python, ca-certificates, cmake, libpcre2-dev | libpcre3-dev
Standards-Version: 3.7.3

Package: tvheadend
Architecture: any
Depends: ${shlibs:Depends}, libavahi-client3, zlib1g, liburiparser1, dvb-apps, bzip2
Depends: ${shlibs:Depends}, libavahi-client3, zlib1g, liburiparser1, bzip2
Recommends: xmltv-util
Enhances: showtime
Replaces: hts-tvheadend
Expand Down
23 changes: 23 additions & 0 deletions src/atomic.h
Expand Up @@ -21,6 +21,8 @@
#include <stdint.h>
#include <time.h>

typedef void * volatile * atomic_refptr_t;

extern pthread_mutex_t atomic_lock;

/*
Expand Down Expand Up @@ -259,6 +261,21 @@ atomic_exchange_time_t(volatile time_t *ptr, time_t val)
#endif
}

static inline void *
atomic_exchange_ptr(atomic_refptr_t ptr, void *val)
{
#if ENABLE_ATOMIC_PTR
return __sync_lock_test_and_set(ptr, val);
#else
void *ret;
pthread_mutex_lock(&atomic_lock);
ret = *ptr;
*ptr = val;
pthread_mutex_unlock(&atomic_lock);
return ret;
#endif
}

/*
* Atomic get operation
*/
Expand Down Expand Up @@ -315,6 +332,12 @@ atomic_set_time_t(volatile time_t *ptr, time_t val)
return atomic_exchange_time_t(ptr, val);
}

static inline void *
atomic_set_ptr(atomic_refptr_t ptr, void *val)
{
return atomic_exchange_ptr(ptr, val);
}

/*
* Atomic set operation + peak (MAX)
*/
Expand Down
12 changes: 6 additions & 6 deletions src/descrambler/capmt.c
Expand Up @@ -69,12 +69,12 @@ typedef struct dmx_filter {

#define DVBAPI_PROTOCOL_VERSION 2

#define CA_SET_DESCR 0x40106f86
#define CA_SET_DESCR_ 0x40106f86
#define CA_SET_DESCR_X 0x866f1040
#define CA_SET_DESCR_AES 0x40106f87
#define CA_SET_DESCR_AES_X 0x876f1040
#define CA_SET_DESCR_MODE 0x400c6f88
#define CA_SET_PID 0x40086f87
#define CA_SET_PID_ 0x40086f87
#define CA_SET_PID_X 0x876f0840
#define DMX_STOP 0x00006f2a
#define DMX_STOP_X 0x2a6f0000
Expand Down Expand Up @@ -1240,9 +1240,9 @@ capmt_msg_size(capmt_t *capmt, sbuf_t *sb, int offset)
}
}
sb->sb_err = 1; /* "first seen" flag for the moment */
if (cmd == CA_SET_PID)
if (cmd == CA_SET_PID_)
return 4 + 8 + adapter_byte;
else if (cmd == CA_SET_DESCR)
else if (cmd == CA_SET_DESCR_)
return 4 + 16 + adapter_byte;
else if (cmd == CA_SET_DESCR_AES)
return 4 + 32 + adapter_byte;
Expand Down Expand Up @@ -1291,7 +1291,7 @@ capmt_peek_str(sbuf_t *sb, int *offset)
static void
capmt_analyze_cmd(capmt_t *capmt, uint32_t cmd, int adapter, sbuf_t *sb, int offset)
{
if (cmd == CA_SET_PID) {
if (cmd == CA_SET_PID_) {

uint32_t pid = sbuf_peek_u32(sb, offset + 0);
int32_t index = sbuf_peek_s32(sb, offset + 4);
Expand Down Expand Up @@ -1330,7 +1330,7 @@ capmt_analyze_cmd(capmt_t *capmt, uint32_t cmd, int adapter, sbuf_t *sb, int off
tvherror(LS_CAPMT, "%s: Invalid index %d in CA_SET_PID (%d) for adapter %d", capmt_name(capmt), index, MAX_INDEX, adapter);
}

} else if (cmd == CA_SET_DESCR) {
} else if (cmd == CA_SET_DESCR_) {

int32_t index = sbuf_peek_s32(sb, offset + 0);
int32_t parity = sbuf_peek_s32(sb, offset + 4);
Expand Down

0 comments on commit fab0a6c

Please sign in to comment.