VideoJNI.java 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. package kr.co.icontrols.callengine.engine;
  2. import kr.co.icontrols.V40IFCCD.V40IFCCD;
  3. import kr.co.icontrols.wallpadcall.MainActivity;
  4. import kr.co.icontrols.wallpadcall.declare.Global.BOARD_TYPE;
  5. import kr.co.icontrols.wallpadcall.declare.Global.ConfigValues;
  6. import android.graphics.Bitmap;
  7. import android.os.Handler;
  8. import android.os.Looper;
  9. import android.util.Log;
  10. import android.view.Surface;
  11. import android.view.SurfaceView;
  12. import com.util.LogUtil;
  13. import static kr.co.icontrols.wallpadcall.MainActivity.bFFMPEGEnable;
  14. public class VideoJNI {
  15. String TAG = "VideoJNI";
  16. V40IFCCD mV40IFCCD;
  17. int BOARDTYPE = 0;
  18. boolean SWDecoderStarted = false;
  19. public VideoJNI() {
  20. BOARDTYPE = ConfigValues.DEVICE_BOARDTYPE;
  21. if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  22. mV40IFCCD = new V40IFCCD();
  23. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  24. mV40IFCCD = new V40IFCCD();
  25. } else {
  26. Log.w(TAG, "[VideoJNI] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  27. }
  28. }
  29. public void setCheckIFrame(boolean bSet) {
  30. try {
  31. Log.i(TAG, "[setCheckIFrame] bSet [" + bSet + "]");
  32. if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  33. mV40IFCCD.setCheckIFrame(bSet);
  34. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  35. mV40IFCCD.setCheckIFrame(bSet);
  36. } else {
  37. Log.w(TAG, "[setCheckIFrame] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  38. }
  39. } catch (RuntimeException re) {
  40. LogUtil.errorLogInfo("", TAG, re);
  41. } catch (Exception e) {
  42. Log.e(TAG, "[Exception] setCheckIFrame(boolean bSet)");
  43. //e.printStackTrace();
  44. LogUtil.errorLogInfo("", TAG, e);
  45. }
  46. }
  47. public void setCameraSelect() {
  48. try {
  49. Log.d(TAG, "[setCameraSelect]");
  50. if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  51. mV40IFCCD.setCameraSelect();
  52. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  53. mV40IFCCD.setCameraSelect();
  54. } else {
  55. Log.w(TAG, "[setCameraSelect] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  56. }
  57. } catch (RuntimeException re) {
  58. LogUtil.errorLogInfo("", TAG, re);
  59. } catch (Exception e) {
  60. Log.e(TAG, "[Exception] setCameraSelect()");
  61. //e.printStackTrace();
  62. LogUtil.errorLogInfo("", TAG, e);
  63. }
  64. }
  65. public void setCameraSurface(Surface CameraSurface, int nWidth, int nHeight, int nBitRate, int nFrameRate) {
  66. try {
  67. Log.i(TAG, "[setCameraSurface] nWidth [" + nWidth + "], nHeight [" + nHeight + "], nBitRate [" + nBitRate + "], nFrameRate [" + nFrameRate + "]");
  68. if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  69. mV40IFCCD.setCameraSurface(CameraSurface, nWidth, nHeight, nBitRate, nFrameRate);
  70. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  71. mV40IFCCD.setCameraSurface(CameraSurface, nWidth, nHeight, nBitRate, nFrameRate);
  72. } else {
  73. Log.w(TAG, "[setCameraSurface] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  74. }
  75. } catch (RuntimeException re) {
  76. LogUtil.errorLogInfo("", TAG, re);
  77. } catch (Exception e) {
  78. Log.e(TAG, "[Exception] setCameraSurface(Surface CameraSurface, int nWidth, int nHeight, int nBitRate, int nFrameRate)");
  79. //e.printStackTrace();
  80. LogUtil.errorLogInfo("", TAG, e);
  81. }
  82. }
  83. public void setDecoderInfo_V40(int X, int Y, int W, int H) {
  84. try {
  85. if (bFFMPEGEnable) return;
  86. Log.e(TAG, "[setDecoderInfo_V40] X [" + X + "], Y [" + Y + "], W [" + W + "], H [" + H + "]");
  87. if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  88. mV40IFCCD.setDecoderInfo(X, Y, W, H);
  89. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  90. mV40IFCCD.setDecoderInfo(X, Y, W, H);
  91. } else {
  92. Log.w(TAG, "[setDecoderInfo_V40] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  93. }
  94. } catch (RuntimeException re) {
  95. LogUtil.errorLogInfo("", TAG, re);
  96. } catch (Exception e) {
  97. Log.e(TAG, "[Exception] setDecoderInfo_V40(int X, int Y, int W, int H)");
  98. //e.printStackTrace();
  99. LogUtil.errorLogInfo("", TAG, e);
  100. }
  101. }
  102. public void setPreviewInfo_V40(int X, int Y, int W, int H) {
  103. try {
  104. if (bFFMPEGEnable) return;
  105. Log.i(TAG, "[setPreviewInfo_V40] X [" + X + "], Y [" + Y + "], W [" + W + "], H [" + H + "]");
  106. if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  107. mV40IFCCD.setPreviewInfo(X, Y, W, H);
  108. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  109. mV40IFCCD.setPreviewInfo(X, Y, W, H);
  110. } else {
  111. Log.w(TAG, "[setPreviewInfo_V40] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  112. }
  113. } catch (RuntimeException re) {
  114. LogUtil.errorLogInfo("", TAG, re);
  115. } catch (Exception e) {
  116. Log.e(TAG, "[Exception] setPreviewInfo_V40(int X, int Y, int W, int H)");
  117. //e.printStackTrace();
  118. LogUtil.errorLogInfo("", TAG, e);
  119. }
  120. }
  121. public void encoderStartOperation() {
  122. try {
  123. Log.d(TAG, "[encoderStartOperation] BOARDTYPE [" + BOARDTYPE + "]");
  124. if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  125. mV40IFCCD.encoderStartOperation();
  126. }
  127. else if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  128. mV40IFCCD.encoderStartOperation();
  129. }
  130. else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  131. mV40IFCCD.encoderStartOperation();
  132. }
  133. else {
  134. Log.w(TAG, "[encoderStartOperation] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  135. }
  136. } catch (RuntimeException re) {
  137. LogUtil.errorLogInfo("", TAG, re);
  138. } catch (Exception e) {
  139. Log.e(TAG, "[Exception] encoderStartOperation()");
  140. //e.printStackTrace();
  141. LogUtil.errorLogInfo("", TAG, e);
  142. }
  143. }
  144. public void encoderStopOperation() {
  145. try {
  146. Log.d(TAG, "[encoderStopOperation] BOARDTYPE [" + BOARDTYPE + "]");
  147. if (BOARDTYPE == BOARD_TYPE.V40_IGW300) {
  148. mV40IFCCD.encoderStopOperation();
  149. }
  150. else if (BOARDTYPE == BOARD_TYPE.V40) {
  151. mV40IFCCD.encoderStopOperation();
  152. }
  153. else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  154. mV40IFCCD.encoderStopOperation();
  155. }
  156. else if (BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  157. mV40IFCCD.encoderStopOperation();
  158. }
  159. else {
  160. Log.w(TAG, "[encoderStopOperation] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  161. }
  162. } catch (RuntimeException re) {
  163. LogUtil.errorLogInfo("", TAG, re);
  164. } catch (Exception e) {
  165. Log.e(TAG, "[Exception] encoderStopOperation()");
  166. //e.printStackTrace();
  167. LogUtil.errorLogInfo("", TAG, e);
  168. }
  169. }
  170. Surface mSurface;
  171. int nSurfaceWidth = 0;
  172. int nSurfaceHeight = 0;
  173. public void setRemoteSurfaceview(Surface surface, int width, int height) {
  174. try {
  175. Log.d(TAG, "[setRemoteSurfaceview] surface [" + surface + "], width [" + width + "], height [" + height + "]");
  176. mSurface = surface;
  177. nSurfaceWidth = width;
  178. nSurfaceHeight = height;
  179. } catch (RuntimeException re) {
  180. LogUtil.errorLogInfo("", TAG, re);
  181. } catch (Exception e) {
  182. Log.e(TAG, "[Exception] setRemoteSurfaceview(Surface surface, int width, int height)");
  183. //e.printStackTrace();
  184. LogUtil.errorLogInfo("", TAG, e);
  185. }
  186. }
  187. boolean bDecoderStarted = false;
  188. public void decoderStartOperation() {
  189. try {
  190. Log.d(TAG, "[decoderStartOperation] BOARDTYPE [" + BOARDTYPE + "], bDecoderStarted [" + bDecoderStarted + "], SWDecoderStarted [" + SWDecoderStarted + "]");
  191. if (BOARDTYPE == BOARD_TYPE.V40_IGW300) {
  192. if (!bDecoderStarted) {
  193. bDecoderStarted = true;
  194. mV40IFCCD.decoderStartOperation();
  195. }
  196. }
  197. else if (BOARDTYPE == BOARD_TYPE.V40) {
  198. if (!bDecoderStarted) {
  199. bDecoderStarted = true;
  200. mV40IFCCD.decoderStartOperation();
  201. }
  202. }
  203. else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  204. if (!bDecoderStarted) {
  205. bDecoderStarted = true;
  206. mV40IFCCD.decoderStartOperation();
  207. }
  208. }
  209. else if (BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  210. if (!bDecoderStarted) {
  211. if (bFFMPEGEnable) {
  212. if (bComposite) {
  213. // MoIP 영상
  214. if (!SWDecoderStarted) {
  215. SWDecoderInit(mSurface, nSurfaceWidth, nSurfaceHeight);
  216. SWDecoderStarted = true;
  217. }
  218. mV40IFCCD.decoderStartOperation();
  219. }
  220. else {
  221. // 현관
  222. mV40IFCCD.decoderStartOperation();
  223. }
  224. }
  225. else {
  226. mV40IFCCD.decoderStartOperation();
  227. }
  228. bDecoderStarted = true;
  229. }
  230. }
  231. else {
  232. Log.w(TAG, "[decoderStartOperation] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  233. }
  234. } catch (RuntimeException re) {
  235. LogUtil.errorLogInfo("", TAG, re);
  236. } catch (Exception e) {
  237. Log.e(TAG, "[Exception] decoderStartOperation()");
  238. //e.printStackTrace();
  239. LogUtil.errorLogInfo("", TAG, e);
  240. }
  241. }
  242. public void decoderStopOperation() {
  243. try {
  244. int nTime = 100;
  245. Log.d(TAG, "[decoderStopOperation] BOARDTYPE [" + BOARDTYPE + "], bDecoderStarted [" + bDecoderStarted + "], SWDecoderStarted [" + SWDecoderStarted + "]");
  246. if (BOARDTYPE == BOARD_TYPE.V40_IGW300) {
  247. if (bDecoderStarted) {
  248. mV40IFCCD.decoderStopOperation();
  249. bDecoderStarted = false;
  250. // new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
  251. // @Override
  252. // public void run() {
  253. //
  254. // }
  255. // }, nTime);
  256. }
  257. }
  258. else if (BOARDTYPE == BOARD_TYPE.V40) {
  259. if (bDecoderStarted) {
  260. mV40IFCCD.decoderStopOperation();
  261. bDecoderStarted = false;
  262. }
  263. }
  264. else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  265. if (bDecoderStarted) {
  266. mV40IFCCD.decoderStopOperation();
  267. bDecoderStarted = false;
  268. }
  269. }
  270. else if (BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  271. if (bDecoderStarted) {
  272. //bDecoderStarted = false;
  273. if (bFFMPEGEnable) {
  274. if (SWDecoderStarted) {
  275. SWDecoderStarted = false;
  276. Log.e(TAG, "[decoderStopOperation] ========== JEFF 1 ========== SWDecoderStarted [" + SWDecoderStarted + "]");
  277. SWDecoderClose(1);
  278. Log.e(TAG, "[decoderStopOperation] ========== JEFF 2 ========== SWDecoderStarted [" + SWDecoderStarted + "]");
  279. }
  280. mV40IFCCD.decoderStopOperation();
  281. bDecoderStarted = false;
  282. }
  283. else {
  284. mV40IFCCD.decoderStopOperation();
  285. bDecoderStarted = false;
  286. }
  287. }
  288. }
  289. else {
  290. Log.w(TAG, "[decoderStopOperation] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  291. }
  292. } catch (RuntimeException re) {
  293. LogUtil.errorLogInfo("", TAG, re);
  294. } catch (Exception e) {
  295. Log.e(TAG, "[Exception] decoderStopOperation()");
  296. //e.printStackTrace();
  297. LogUtil.errorLogInfo("", TAG, e);
  298. }
  299. }
  300. public void sendDataToDecoder(byte[] hData, int nHeaderLen, int nFrameLen, int nTimeStamp) {
  301. try {
  302. // Log.e(TAG, "[sendDataToDecoder] hData.length [" + hData.length + "], nHeaderLen [" + nHeaderLen + "], nFrameLen [" + nFrameLen + "], nTimeStamp [" + nTimeStamp + "]");
  303. if (BOARDTYPE == BOARD_TYPE.V40_IGW300) {
  304. if (bFFMPEGEnable) {
  305. SWSendDataToDecoder(hData, nFrameLen);
  306. }
  307. else {
  308. if (bDecoderStarted) mV40IFCCD.sendDataToDecoder(hData, nHeaderLen, nFrameLen, nTimeStamp);
  309. }
  310. }
  311. else if (BOARDTYPE == BOARD_TYPE.V40) {
  312. if (bFFMPEGEnable) {
  313. SWSendDataToDecoder(hData, nFrameLen);
  314. }
  315. else {
  316. if (bDecoderStarted) mV40IFCCD.sendDataToDecoder(hData, nHeaderLen, nFrameLen, nTimeStamp);
  317. }
  318. }
  319. else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  320. if (bFFMPEGEnable) {
  321. SWSendDataToDecoder(hData, nFrameLen);
  322. if (bDecoderStarted) mV40IFCCD.sendDataToDecoder(hData, nHeaderLen, nFrameLen, nTimeStamp);
  323. }
  324. else {
  325. if (bDecoderStarted) mV40IFCCD.sendDataToDecoder(hData, nHeaderLen, nFrameLen, nTimeStamp);
  326. }
  327. }
  328. else if (BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  329. if (bFFMPEGEnable) {
  330. SWSendDataToDecoder(hData, nFrameLen);
  331. if (bDecoderStarted) mV40IFCCD.sendDataToDecoder(hData, nHeaderLen, nFrameLen, nTimeStamp);
  332. }
  333. else {
  334. if (bDecoderStarted) mV40IFCCD.sendDataToDecoder(hData, nHeaderLen, nFrameLen, nTimeStamp);
  335. }
  336. }
  337. else {
  338. Log.w(TAG, "[sendDataToDecoder] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  339. }
  340. } catch (RuntimeException re) {
  341. LogUtil.errorLogInfo("", TAG, re);
  342. } catch (Exception e) {
  343. Log.e(TAG, "[Exception] sendDataToDecoder(byte[] hData, int nHeaderLen, int nFrameLen, int nTimeStamp)");
  344. //e.printStackTrace();
  345. LogUtil.errorLogInfo("", TAG, e);
  346. }
  347. }
  348. public void deallocate() {
  349. try {
  350. if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  351. mV40IFCCD.deallocate();
  352. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  353. mV40IFCCD.deallocate();
  354. } else {
  355. Log.w(TAG, "[deallocate] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  356. }
  357. } catch (RuntimeException re) {
  358. LogUtil.errorLogInfo("", TAG, re);
  359. } catch (Exception e) {
  360. Log.e(TAG, "[Exception] deallocate()");
  361. //e.printStackTrace();
  362. LogUtil.errorLogInfo("", TAG, e);
  363. }
  364. }
  365. public void stopAllOperation() {
  366. try {
  367. if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  368. mV40IFCCD.stopAllOperation();
  369. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  370. mV40IFCCD.stopAllOperation();
  371. } else {
  372. Log.w(TAG, "[stopAllOperation] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  373. }
  374. } catch (RuntimeException re) {
  375. LogUtil.errorLogInfo("", TAG, re);
  376. } catch (Exception e) {
  377. Log.e(TAG, "[Exception] stopAllOperation()");
  378. //e.printStackTrace();
  379. LogUtil.errorLogInfo("", TAG, e);
  380. }
  381. }
  382. boolean bComposite = false; // true: 로비, false: 현관
  383. public void setComposite(boolean bEnable) {
  384. try {
  385. bEnable = true; //VIP 경우 현관 아날로그 통화가 없음. 그래서 false 로 들어오더라도 true 로 강제 변환
  386. Log.d(TAG, "[setComposite] bEnable [" + bEnable + "]");
  387. if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  388. mV40IFCCD.composite(1);
  389. //if (bEnable) mV40IFCCD.composite(1);
  390. //else mV40IFCCD.composite(0); //VIP 경우 현관 아날로그 통화가 없음.
  391. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  392. // true : 로비통화, false : 현관통화
  393. bComposite = bEnable;
  394. mV40IFCCD.composite(1);
  395. //if (bEnable) mV40IFCCD.composite(1); // 로비통화
  396. //else mV40IFCCD.composite(0); //VIP 경우 현관 아날로그 통화가 없음.
  397. } else {
  398. Log.w(TAG, "[setComposite] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  399. }
  400. } catch (RuntimeException re) {
  401. LogUtil.errorLogInfo("", TAG, re);
  402. } catch (Exception e) {
  403. Log.e(TAG, "[Exception] setComposite(boolean bEnable)");
  404. //e.printStackTrace();
  405. LogUtil.errorLogInfo("", TAG, e);
  406. }
  407. }
  408. public Bitmap getMoIPPicture(CallManager.CALLTYPE eCallType) {
  409. try {
  410. Log.d(TAG, "[getMoIPPicture] eCallType [" + eCallType + "]");
  411. if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  412. if (mV40IFCCD != null) return mV40IFCCD.getDecodedPicture(eCallType);
  413. else {
  414. Log.d(TAG, "[getMoIPPicture] mV40IFCCD is null!!");
  415. return null;
  416. }
  417. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  418. if (mV40IFCCD != null) return mV40IFCCD.getDecodedPicture(eCallType);
  419. else {
  420. Log.d(TAG, "[getMoIPPicture] mV40IFCCD is null!!");
  421. return null;
  422. }
  423. } else {
  424. Log.w(TAG, "[getMoIPPicture] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  425. }
  426. } catch (RuntimeException re) {
  427. LogUtil.errorLogInfo("", TAG, re);
  428. } catch (Exception e) {
  429. Log.e(TAG, "[Exception] getMoIPPicture()");
  430. //e.printStackTrace();
  431. LogUtil.errorLogInfo("", TAG, e);
  432. }
  433. return null;
  434. }
  435. /* ================================================================================================
  436. * SW Codec 함수
  437. ================================================================================================ */
  438. boolean bSWDecoderRun = false;
  439. public void SWDecoderInit(Surface surface, int width, int height) {
  440. try {
  441. Log.i(TAG, "[SWDecoderInit] bSWDecoderRun [" + bSWDecoderRun + "]");
  442. if (!bSWDecoderRun) {
  443. bSWDecoderRun = true;
  444. mV40IFCCD.SWDecoderInit(surface, width, height);
  445. }
  446. else {
  447. Log.w(TAG, "[SWDecoderInit] SW decoder already run!!");
  448. }
  449. } catch (RuntimeException re) {
  450. LogUtil.errorLogInfo("", TAG, re);
  451. } catch (Exception e) {
  452. Log.e(TAG, "[Exception] SWDecoderInit(Surface surface, int width, int height)");
  453. //e.printStackTrace();
  454. LogUtil.errorLogInfo("", TAG, e);
  455. }
  456. }
  457. public void SWDecoderClose(int nTraceNo) {
  458. try {
  459. Log.i(TAG, "[SWDecoderClose] bSWDecoderRun [" + bSWDecoderRun + "], nTraceNo [" + nTraceNo + "]");
  460. if (bSWDecoderRun) {
  461. bSWDecoderRun = false;
  462. mV40IFCCD.SWDecoderClose();
  463. }
  464. else {
  465. Log.w(TAG, "[SWDecoderClose] SW decoder already stop!!");
  466. }
  467. } catch (RuntimeException re) {
  468. LogUtil.errorLogInfo("", TAG, re);
  469. } catch (Exception e) {
  470. Log.e(TAG, "[Exception] SWDecoderClose(int nTraceNo)");
  471. //e.printStackTrace();
  472. LogUtil.errorLogInfo("", TAG, e);
  473. }
  474. }
  475. public void SWSendDataToDecoder(byte[] hData, int nFrameLen) {
  476. try {
  477. Log.v(TAG, "[SWSendDataToDecoder] SWDecoderStarted [" + SWDecoderStarted + "], hData.length [" + hData.length + "], nFrameLen [" + nFrameLen + "]");
  478. if (SWDecoderStarted) {
  479. if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  480. //Log.d(TAG, "[SWSendDataToDecoder] START nFrameLen:" + nFrameLen);
  481. mV40IFCCD.SWSendDataToDecoder(hData, nFrameLen);
  482. }
  483. else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  484. //Log.d(TAG, "[SWSendDataToDecoder] START nFrameLen:" + nFrameLen);
  485. mV40IFCCD.SWSendDataToDecoder(hData, nFrameLen);
  486. }
  487. else {
  488. Log.w(TAG, "[SWSendDataToDecoder] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  489. }
  490. }
  491. } catch (RuntimeException re) {
  492. LogUtil.errorLogInfo("", TAG, re);
  493. } catch (Exception e) {
  494. Log.e(TAG, "[Exception] SWSendDataToDecoder(byte[] hData, int nFrameLen)");
  495. //e.printStackTrace();
  496. LogUtil.errorLogInfo("", TAG, e);
  497. }
  498. }
  499. }