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

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