StreamCard_SCBC.py 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. # -*- coding: UTF-8 -*-
  2. import sys
  3. import os
  4. from os import path, access, R_OK
  5. import subprocess
  6. import thread
  7. from ssat_sdk.device_manage.dektec_manager import *
  8. '''
  9. DTV播放器,汇总各种设备进行DTV信号输出
  10. '''
  11. class StreamCard_SCBC():
  12. def __init__(self):
  13. self.dektecMgr = DektecManager()
  14. self.cmdline = self.dektecMgr.cmdline
  15. def getCmdLine(self):
  16. return self.dektecMgr.cmdline
  17. def playStream(self, streamFile, times, type, channelPoint):
  18. self.dektecMgr.playStream(streamFile, times, type, channelPoint)
  19. def playStreamAtThread(self, streamFile, times, type, channelPoint ):
  20. thread.start_new_thread(self.dektecMgr.playStreamAtThread,(streamFile,times, type, channelPoint))
  21. # self.dektecMgr.playStreamAtThread(streamFile, times, type, channelPoint)
  22. def isPlaying(self):
  23. return self.dektecMgr.isPlaying()
  24. def interrupt(self):
  25. self.dektecMgr.interrupt()
  26. def taskkill(self):
  27. self.dektecMgr.taskkill()
  28. def set_cmd_clear(self):
  29. self.dektecMgr.set_cmd_clear()
  30. def set_playfile(self, playfile):
  31. # 码流文件
  32. self.dektecMgr.set_playfile(playfile)
  33. def set_Device_type(self, type):
  34. # 设备选择
  35. self.dektecMgr.set_Device_type(type)
  36. def set_Modulation_carrier_frequency(self, frequency):
  37. # 频点
  38. self.dektecMgr.set_Modulation_carrier_frequency(frequency)
  39. '''
  40. type:
  41. ATSC ATSC modulation
  42. CMMB CMMB modulation
  43. DAB DAB modulation
  44. DTMB DTMB modulation
  45. DVBS DVB-S QPSK modulation
  46. DVBS2_16APSK DVB-S.2 16APSK modulation
  47. DVBS2_32APSK 32APSK modulation
  48. DVBS2_8PSK DVB-S.2 8PSK modulation
  49. DVBS2_QPSK DVB-S.2 QPSK modulation
  50. DVBS2_L3 DVB-S.2 L3 modulation
  51. DVBT DVB-T/H modulation
  52. ISDBS ISDB-S modulation
  53. ISDBT ISDB-T modulation
  54. IQ IQ direct
  55. QAM4 QAM-4 modulation
  56. QAM16 QAM-16 modulation
  57. QAM32 QAM-32 modulation
  58. QAM64 QAM-64 modulation
  59. QAM128 QAM-128 modulation
  60. QAM256 QAM-256 modulation
  61. T2MI T2MI modulation
  62. '''
  63. def set_Modulation_type(self, Modulation_type):
  64. # 制式选择
  65. self.dektecMgr.set_Modulation_type(Modulation_type)
  66. def set_Modulation_bandwidth(self, Modulation_bandwidth):
  67. # 带宽
  68. self.dektecMgr.set_Modulation_bandwidth(Modulation_bandwidth)
  69. def set_Modulation_transmission_mode(self, transmission_mode):
  70. # 载波数
  71. self.dektecMgr.set_Modulation_transmission_mode(transmission_mode)
  72. def set_Modulation_constellation (self, constellation ):
  73. # 调制方式
  74. self.dektecMgr.set_Modulation_constellation(constellation)
  75. def set_Modulation_guard_interval(self, guard_interval):
  76. # 保护间隔
  77. self.dektecMgr.set_Modulation_guard_interval(guard_interval)
  78. def set_Modulation_Convolutional_rate(self, Convolutional_rate):
  79. # 信号纠错码
  80. self.dektecMgr.set_Modulation_Convolutional_rate(Convolutional_rate)
  81. def set_Modulation_Output_level(self, Output_level):
  82. # 信号强度
  83. self.dektecMgr.set_Modulation_Output_level(Output_level)
  84. def set_loop_times(self, loop_times):
  85. # 播放次数
  86. self.dektecMgr.set_loop_times(loop_times)
  87. def set_rate(self, rate):
  88. # 输出码率
  89. self.dektecMgr.set_rate(rate)
  90. def play_out(self):
  91. thread.start_new_thread(self.dektecMgr.play_out,())
  92. # self.dektecMgr.play_out()
  93. def play_out_wait(self):
  94. self.dektecMgr.play_out_wait()
  95. def DtPlay_exe_CMD(self, str):
  96. self.dektecMgr.DtPlay_exe_CMD(str)
  97. def DtPlay_exe_CMD_wait(self, str):
  98. self.dektecMgr.DtPlay_exe_CMD_wait(str)
  99. def help(self):
  100. self.dektecMgr.help()
  101. def __del__(self):
  102. self.dektecMgr.__del__()
  103. # ------------------------------------------------------------------------------
  104. if __name__ == "__main__":
  105. scscbc = StreamCard_SCBC()
  106. streamFile = r"D:\test\482_1218_105425.ts"
  107. times = 1
  108. type = "DTMB"
  109. channelPoint = "52.5MHz"
  110. # scscbc.playStream( streamFile, times, type, channelPoint)
  111. # scscbc.help()
  112. # scscbc.DtPlay_exe_CMD( streamFile + " -mt DTMB -mf 52.5MHz")
  113. # 按照 SteamXpress 界面的设置
  114. scscbc.set_playfile(streamFile)
  115. scscbc.set_Device_type("215")
  116. scscbc.set_Modulation_carrier_frequency("578MHz")
  117. scscbc.set_Modulation_type("DVBT")
  118. scscbc.set_Modulation_bandwidth("8")
  119. scscbc.set_Modulation_transmission_mode("8k")
  120. # scscbc.set_Modulation_constellation("QAM64")
  121. scscbc.set_Modulation_constellation("QPSK")
  122. scscbc.set_Modulation_guard_interval("1/32")
  123. scscbc.set_Modulation_Convolutional_rate("7/8")
  124. scscbc.set_Modulation_Output_level("-90dBm")#单位可以不写,前面的负号"-"一定要写
  125. scscbc.set_loop_times("0")
  126. scscbc.set_rate("18661765")
  127. print scscbc.dektecMgr.cmdline
  128. # 频繁操作注意延迟3秒,画面才播放出来。
  129. scscbc.play_out()