tsdecrypt reads and decrypts CSA encrypted incoming mpeg transport stream over UDP/RTP using code words obtained from OSCAM or similar CAM server. tsdecrypt communicates with CAM server using cs378x (camd35 over tcp) protocol or newcamd protocol. https://georgi.unixsol.org/programs/tsdecrypt/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. CC = $(CROSS)$(TARGET)cc
  2. STRIP = $(CROSS)$(TARGET)strip
  3. MKDEP = $(CC) -M -o $*.d $<
  4. RM = rm -f
  5. MV = mv -f
  6. BUILD_ID = $(shell date +%F_%R)
  7. VERSION = $(shell cat RELEASE)
  8. GIT_VER = $(shell git describe --tags --dirty --always 2>/dev/null)
  9. ifeq "$(GIT_VER)" ""
  10. GIT_VER = "release"
  11. endif
  12. ifndef V
  13. Q = @
  14. endif
  15. CFLAGS ?= -O2 -ggdb \
  16. -W -Wall -Wextra \
  17. -Wshadow -Wformat-security -Wstrict-prototypes
  18. DEFS = -DBUILD_ID=\"$(BUILD_ID)\" \
  19. -DVERSION=\"$(VERSION)\" -DGIT_VER=\"$(GIT_VER)\"
  20. DEFS += -D_FILE_OFFSET_BITS=64
  21. PREFIX ?= /usr/local
  22. INSTALL_PRG = tsdecrypt
  23. INSTALL_PRG_DIR = $(subst //,/,$(DESTDIR)/$(PREFIX)/bin)
  24. INSTALL_DOC = tsdecrypt.1
  25. INSTALL_DOC_DIR = $(subst //,/,$(DESTDIR)/$(PREFIX)/share/man/man1)
  26. FUNCS_DIR = libfuncs
  27. FUNCS_LIB = $(FUNCS_DIR)/libfuncs.a
  28. TS_DIR = libtsfuncs
  29. TS_LIB = $(TS_DIR)/libtsfuncs.a
  30. tsdecrypt_SRC = data.c \
  31. csa.c \
  32. udp.c \
  33. util.c \
  34. filter.c \
  35. camd.c \
  36. camd-cs378x.c \
  37. camd-newcamd.c \
  38. process.c \
  39. tables.c \
  40. notify.c \
  41. tsdecrypt.c
  42. tsdecrypt_LIBS = -lcrypto -lpthread
  43. # If the file do not exist, libdvbcsa will be used
  44. -include FFdecsa.opts
  45. tsdecrypt_OBJS = $(FFDECSA_OBJ) $(FUNCS_LIB) $(TS_LIB) $(tsdecrypt_SRC:.c=.o)
  46. ifeq "$(shell uname -s)" "Linux"
  47. tsdecrypt_LIBS += -lcrypt -lrt
  48. endif
  49. ifeq "$(DECRYPT_LIB)" "ffdecsa"
  50. DEFS += -DDLIB=\"FFdecsa_$(FFDECSA_MODE)\"
  51. DEFS += -DUSE_FFDECSA=1
  52. else
  53. DEFS += -DDLIB=\"libdvbcsa\"
  54. DEFS += -DUSE_LIBDVBCSA=1
  55. tsdecrypt_LIBS += -ldvbcsa
  56. endif
  57. CLEAN_OBJS = $(FFDECSA_OBJ) tsdecrypt $(tsdecrypt_SRC:.c=.o) $(tsdecrypt_SRC:.c=.d)
  58. PROGS = tsdecrypt
  59. .PHONY: ffdecsa dvbcsa help distclean clean install uninstall
  60. all: $(PROGS)
  61. ffdecsa: clean
  62. $(Q)echo "Switching build to FFdecsa."
  63. @-if test -e FFdecsa.opts.saved; then $(MV) FFdecsa.opts.saved FFdecsa.opts; fi
  64. @-if ! test -e FFdecsa.opts; then ./FFdecsa_init "$(CROSS)$(TARGET)" "$(CC)"; fi
  65. $(Q)$(MAKE) -s tsdecrypt
  66. ffdecsa_force:
  67. $(Q)$(RM) FFdecsa.opts
  68. $(Q)$(MAKE) -s ffdecsa
  69. dvbcsa: clean
  70. $(Q)echo "Switching build to libdvbcsa."
  71. @-if test -f FFdecsa.opts; then $(MV) FFdecsa.opts FFdecsa.opts.saved; fi
  72. $(Q)$(MAKE) -s tsdecrypt
  73. $(FUNCS_LIB): $(FUNCS_DIR)/libfuncs.h
  74. $(Q)echo " MAKE $(FUNCS_LIB)"
  75. $(Q)$(MAKE) -s -C $(FUNCS_DIR)
  76. $(TS_LIB): $(TS_DIR)/tsfuncs.h $(TS_DIR)/tsdata.h
  77. $(Q)echo " MAKE $(TS_LIB)"
  78. $(Q)$(MAKE) -s -C $(TS_DIR)
  79. tsdecrypt: $(tsdecrypt_OBJS)
  80. $(Q)echo " LINK tsdecrypt"
  81. $(Q)$(CC) $(CFLAGS) $(DEFS) $(tsdecrypt_OBJS) $(tsdecrypt_LIBS) -o tsdecrypt
  82. %.o: %.c RELEASE
  83. @$(MKDEP)
  84. $(Q)echo " CC tsdecrypt $<"
  85. $(Q)$(CC) $(CFLAGS) $(DEFS) -c $<
  86. FFdecsa/FFdecsa.o:
  87. $(Q)echo " MAKE FFdecsa"
  88. $(Q)$(MAKE) -s -C FFdecsa FLAGS=$(FFDECSA_FLAGS) PARALLEL_MODE=$(FFDECSA_MODE) COMPILER=$(CROSS)$(CC) FFdecsa.o
  89. -include $(tsdecrypt_SRC:.c=.d)
  90. strip:
  91. $(Q)echo " STRIP $(PROGS)"
  92. $(Q)$(STRIP) $(PROGS)
  93. clean:
  94. $(Q)echo " RM $(CLEAN_OBJS)"
  95. $(Q)$(RM) $(CLEAN_OBJS)
  96. distclean: clean
  97. $(Q)$(MAKE) -s -C $(TS_DIR) clean
  98. $(Q)$(MAKE) -s -C $(FUNCS_DIR) clean
  99. $(Q)$(RM) FFdecsa.opts
  100. install: all
  101. @install -d "$(INSTALL_PRG_DIR)"
  102. @install -d "$(INSTALL_DOC_DIR)"
  103. @echo "INSTALL $(INSTALL_PRG) -> $(INSTALL_PRG_DIR)"
  104. $(Q)-install $(INSTALL_PRG) "$(INSTALL_PRG_DIR)"
  105. @echo "INSTALL $(INSTALL_DOC) -> $(INSTALL_DOC_DIR)"
  106. $(Q)-install --mode 0644 $(INSTALL_DOC) "$(INSTALL_DOC_DIR)"
  107. uninstall:
  108. @-for FILE in $(INSTALL_PRG); do \
  109. echo "RM $(INSTALL_PRG_DIR)/$$FILE"; \
  110. rm "$(INSTALL_PRG_DIR)/$$FILE"; \
  111. done
  112. @-for FILE in $(INSTALL_DOC); do \
  113. echo "RM $(INSTALL_DOC_DIR)/$$FILE"; \
  114. rm "$(INSTALL_DOC_DIR)/$$FILE"; \
  115. done
  116. help:
  117. $(Q)echo -e "\
  118. tsdecrypt $(VERSION) ($(GIT_VER)) build\n\n\
  119. Build targets:\n\
  120. tsdecrypt|all - Build tsdecrypt with whatever decryption library was chosen\n\
  121. \n\
  122. dvbcsa - Build tsdecrypt with libdvbcsa [default]\n\
  123. ffdecsa - Build tsdecrypt with shipped FFdecsa.\n\
  124. \n\
  125. install - Install tsdecrypt in PREFIX ($(PREFIX))\n\
  126. uninstall - Uninstall tsdecrypt from PREFIX\n\
  127. \n\
  128. Cleaning targets:\n\
  129. clean - Remove tsdecrypt generated files but keep the decryption\n\
  130. library config\n\
  131. distclean - Remove all generated files and reset decryption library to\n\
  132. dvbcsa.\n\
  133. \n\
  134. make V=1 Enable verbose build\n\
  135. make PREFIX=dir Set install prefix\n"