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.1KB

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