VideoJNI.java 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  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 = 700;
  245. Log.d(TAG, "[decoderStopOperation] BOARDTYPE [" + BOARDTYPE + "], bDecoderStarted [" + bDecoderStarted + "], SWDecoderStarted [" + SWDecoderStarted + "]");
  246. if (BOARDTYPE == BOARD_TYPE.V40_IGW300) {
  247. if (bDecoderStarted) {
  248. bDecoderStarted = false;
  249. new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
  250. @Override
  251. public void run() {
  252. mV40IFCCD.decoderStopOperation();
  253. }
  254. }, nTime);
  255. }
  256. }
  257. else if (BOARDTYPE == BOARD_TYPE.V40) {
  258. if (bDecoderStarted) {
  259. bDecoderStarted = false;
  260. new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
  261. @Override
  262. public void run() {
  263. mV40IFCCD.decoderStopOperation();
  264. }
  265. }, nTime);
  266. }
  267. }
  268. else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  269. if (bDecoderStarted) {
  270. bDecoderStarted = false;
  271. new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
  272. @Override
  273. public void run() {
  274. mV40IFCCD.decoderStopOperation();
  275. }
  276. }, nTime);
  277. }
  278. }
  279. else if (BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  280. if (bDecoderStarted) {
  281. bDecoderStarted = false;
  282. if (bFFMPEGEnable) {
  283. if (SWDecoderStarted) {
  284. SWDecoderStarted = false;
  285. Log.e(TAG, "[decoderStopOperation] ========== JEFF 1 ========== SWDecoderStarted [" + SWDecoderStarted + "]");
  286. SWDecoderClose(1);
  287. Log.e(TAG, "[decoderStopOperation] ========== JEFF 2 ========== SWDecoderStarted [" + SWDecoderStarted + "]");
  288. }
  289. new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
  290. @Override
  291. public void run() {
  292. mV40IFCCD.decoderStopOperation();
  293. }
  294. }, nTime);
  295. }
  296. else {
  297. new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
  298. @Override
  299. public void run() {
  300. mV40IFCCD.decoderStopOperation();
  301. }
  302. }, nTime);
  303. }
  304. }
  305. }
  306. else {
  307. Log.w(TAG, "[decoderStopOperation] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  308. }
  309. } catch (RuntimeException re) {
  310. LogUtil.errorLogInfo("", TAG, re);
  311. } catch (Exception e) {
  312. Log.e(TAG, "[Exception] decoderStopOperation()");
  313. //e.printStackTrace();
  314. LogUtil.errorLogInfo("", TAG, e);
  315. }
  316. }
  317. public void sendDataToDecoder(byte[] hData, int nHeaderLen, int nFrameLen, int nTimeStamp) {
  318. try {
  319. // Log.e(TAG, "[sendDataToDecoder] hData.length [" + hData.length + "], nHeaderLen [" + nHeaderLen + "], nFrameLen [" + nFrameLen + "], nTimeStamp [" + nTimeStamp + "]");
  320. if (BOARDTYPE == BOARD_TYPE.V40_IGW300) {
  321. if (bFFMPEGEnable) {
  322. SWSendDataToDecoder(hData, nFrameLen);
  323. }
  324. else {
  325. mV40IFCCD.sendDataToDecoder(hData, nHeaderLen, nFrameLen, nTimeStamp);
  326. }
  327. }
  328. else if (BOARDTYPE == BOARD_TYPE.V40) {
  329. if (bFFMPEGEnable) {
  330. SWSendDataToDecoder(hData, nFrameLen);
  331. }
  332. else {
  333. mV40IFCCD.sendDataToDecoder(hData, nHeaderLen, nFrameLen, nTimeStamp);
  334. }
  335. }
  336. else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT) {
  337. if (bFFMPEGEnable) {
  338. SWSendDataToDecoder(hData, nFrameLen);
  339. mV40IFCCD.sendDataToDecoder(hData, nHeaderLen, nFrameLen, nTimeStamp);
  340. }
  341. else {
  342. mV40IFCCD.sendDataToDecoder(hData, nHeaderLen, nFrameLen, nTimeStamp);
  343. }
  344. }
  345. else if (BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  346. if (bFFMPEGEnable) {
  347. SWSendDataToDecoder(hData, nFrameLen);
  348. if (bDecoderStarted) mV40IFCCD.sendDataToDecoder(hData, nHeaderLen, nFrameLen, nTimeStamp);
  349. }
  350. else {
  351. if (bDecoderStarted) mV40IFCCD.sendDataToDecoder(hData, nHeaderLen, nFrameLen, nTimeStamp);
  352. }
  353. }
  354. else {
  355. Log.w(TAG, "[sendDataToDecoder] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  356. }
  357. } catch (RuntimeException re) {
  358. LogUtil.errorLogInfo("", TAG, re);
  359. } catch (Exception e) {
  360. Log.e(TAG, "[Exception] sendDataToDecoder(byte[] hData, int nHeaderLen, int nFrameLen, int nTimeStamp)");
  361. //e.printStackTrace();
  362. LogUtil.errorLogInfo("", TAG, e);
  363. }
  364. }
  365. public void deallocate() {
  366. try {
  367. if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  368. mV40IFCCD.deallocate();
  369. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  370. mV40IFCCD.deallocate();
  371. } else {
  372. Log.w(TAG, "[deallocate] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  373. }
  374. } catch (RuntimeException re) {
  375. LogUtil.errorLogInfo("", TAG, re);
  376. } catch (Exception e) {
  377. Log.e(TAG, "[Exception] deallocate()");
  378. //e.printStackTrace();
  379. LogUtil.errorLogInfo("", TAG, e);
  380. }
  381. }
  382. public void stopAllOperation() {
  383. try {
  384. if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  385. mV40IFCCD.stopAllOperation();
  386. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  387. mV40IFCCD.stopAllOperation();
  388. } else {
  389. Log.w(TAG, "[stopAllOperation] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  390. }
  391. } catch (RuntimeException re) {
  392. LogUtil.errorLogInfo("", TAG, re);
  393. } catch (Exception e) {
  394. Log.e(TAG, "[Exception] stopAllOperation()");
  395. //e.printStackTrace();
  396. LogUtil.errorLogInfo("", TAG, e);
  397. }
  398. }
  399. boolean bComposite = false; // true: 로비, false: 현관
  400. public void setComposite(boolean bEnable) {
  401. try {
  402. bEnable = true; //VIP 경우 현관 아날로그 통화가 없음. 그래서 false 로 들어오더라도 true 로 강제 변환
  403. Log.d(TAG, "[setComposite] bEnable [" + bEnable + "]");
  404. if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  405. mV40IFCCD.composite(1);
  406. //if (bEnable) mV40IFCCD.composite(1);
  407. //else mV40IFCCD.composite(0); //VIP 경우 현관 아날로그 통화가 없음.
  408. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  409. // true : 로비통화, false : 현관통화
  410. bComposite = bEnable;
  411. mV40IFCCD.composite(1);
  412. //if (bEnable) mV40IFCCD.composite(1); // 로비통화
  413. //else mV40IFCCD.composite(0); //VIP 경우 현관 아날로그 통화가 없음.
  414. } else {
  415. Log.w(TAG, "[setComposite] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  416. }
  417. } catch (RuntimeException re) {
  418. LogUtil.errorLogInfo("", TAG, re);
  419. } catch (Exception e) {
  420. Log.e(TAG, "[Exception] setComposite(boolean bEnable)");
  421. //e.printStackTrace();
  422. LogUtil.errorLogInfo("", TAG, e);
  423. }
  424. }
  425. public Bitmap getMoIPPicture(CallManager.CALLTYPE eCallType) {
  426. try {
  427. Log.d(TAG, "[getMoIPPicture] eCallType [" + eCallType + "]");
  428. if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  429. if (mV40IFCCD != null) return mV40IFCCD.getDecodedPicture(eCallType);
  430. else {
  431. Log.d(TAG, "[getMoIPPicture] mV40IFCCD is null!!");
  432. return null;
  433. }
  434. } else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  435. if (mV40IFCCD != null) return mV40IFCCD.getDecodedPicture(eCallType);
  436. else {
  437. Log.d(TAG, "[getMoIPPicture] mV40IFCCD is null!!");
  438. return null;
  439. }
  440. } else {
  441. Log.w(TAG, "[getMoIPPicture] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  442. }
  443. } catch (RuntimeException re) {
  444. LogUtil.errorLogInfo("", TAG, re);
  445. } catch (Exception e) {
  446. Log.e(TAG, "[Exception] getMoIPPicture()");
  447. //e.printStackTrace();
  448. LogUtil.errorLogInfo("", TAG, e);
  449. }
  450. return null;
  451. }
  452. /* ================================================================================================
  453. * SW Codec 함수
  454. ================================================================================================ */
  455. boolean bSWDecoderRun = false;
  456. public void SWDecoderInit(Surface surface, int width, int height) {
  457. try {
  458. Log.i(TAG, "[SWDecoderInit] bSWDecoderRun [" + bSWDecoderRun + "]");
  459. if (!bSWDecoderRun) {
  460. bSWDecoderRun = true;
  461. mV40IFCCD.SWDecoderInit(surface, width, height);
  462. }
  463. else {
  464. Log.w(TAG, "[SWDecoderInit] SW decoder already run!!");
  465. }
  466. } catch (RuntimeException re) {
  467. LogUtil.errorLogInfo("", TAG, re);
  468. } catch (Exception e) {
  469. Log.e(TAG, "[Exception] SWDecoderInit(Surface surface, int width, int height)");
  470. //e.printStackTrace();
  471. LogUtil.errorLogInfo("", TAG, e);
  472. }
  473. }
  474. public void SWDecoderClose(int nTraceNo) {
  475. try {
  476. Log.i(TAG, "[SWDecoderClose] bSWDecoderRun [" + bSWDecoderRun + "], nTraceNo [" + nTraceNo + "]");
  477. if (bSWDecoderRun) {
  478. bSWDecoderRun = false;
  479. mV40IFCCD.SWDecoderClose();
  480. }
  481. else {
  482. Log.w(TAG, "[SWDecoderClose] SW decoder already stop!!");
  483. }
  484. } catch (RuntimeException re) {
  485. LogUtil.errorLogInfo("", TAG, re);
  486. } catch (Exception e) {
  487. Log.e(TAG, "[Exception] SWDecoderClose(int nTraceNo)");
  488. //e.printStackTrace();
  489. LogUtil.errorLogInfo("", TAG, e);
  490. }
  491. }
  492. public void SWSendDataToDecoder(byte[] hData, int nFrameLen) {
  493. try {
  494. Log.v(TAG, "[SWSendDataToDecoder] SWDecoderStarted [" + SWDecoderStarted + "], hData.length [" + hData.length + "], nFrameLen [" + nFrameLen + "]");
  495. if (SWDecoderStarted) {
  496. if (BOARDTYPE == BOARD_TYPE.V40_IGW300 || BOARDTYPE == BOARD_TYPE.V40) {
  497. //Log.d(TAG, "[SWSendDataToDecoder] START nFrameLen:" + nFrameLen);
  498. mV40IFCCD.SWSendDataToDecoder(hData, nFrameLen);
  499. }
  500. else if (BOARDTYPE == BOARD_TYPE.V40_IGW300_NOUGAT || BOARDTYPE == BOARD_TYPE.V40_NOUGAT) {
  501. //Log.d(TAG, "[SWSendDataToDecoder] START nFrameLen:" + nFrameLen);
  502. mV40IFCCD.SWSendDataToDecoder(hData, nFrameLen);
  503. }
  504. else {
  505. Log.w(TAG, "[SWSendDataToDecoder] Not supported BOARDTYPE!! [" + BOARDTYPE + "]");
  506. }
  507. }
  508. } catch (RuntimeException re) {
  509. LogUtil.errorLogInfo("", TAG, re);
  510. } catch (Exception e) {
  511. Log.e(TAG, "[Exception] SWSendDataToDecoder(byte[] hData, int nFrameLen)");
  512. //e.printStackTrace();
  513. LogUtil.errorLogInfo("", TAG, e);
  514. }
  515. }
  516. }