FrmFullScreenF.cpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSLangTransF.h"
  4. #pragma hdrstop
  5. #include "FrmFullScreenF.h"
  6. //---------------------------------------------------------------------------
  7. #pragma package(smart_init)
  8. #pragma link "FFBaseComponent"
  9. #pragma link "FFBasePlay"
  10. #pragma link "FFPlay"
  11. #pragma resource "*.dfm"
  12. TFrmFullScreen *FrmFullScreen = NULL;
  13. //---------------------------------------------------------------------------
  14. __fastcall TFrmFullScreen::TFrmFullScreen(TComponent* Owner)
  15. : TForm(Owner)
  16. {
  17. //LangTrans->Translate(this, ITSDb_GetConnection());
  18. this->Color = clBlack;
  19. PnlStream->ParentColor = false;
  20. PnlStream->Color = clBlack;
  21. }
  22. //---------------------------------------------------------------------------
  23. void __fastcall TFrmFullScreen::PnlStreamDblClick(TObject *Sender)
  24. {
  25. Close();
  26. }
  27. //---------------------------------------------------------------------------
  28. void __fastcall TFrmFullScreen::FormClose(TObject *Sender, TCloseAction &Action)
  29. {
  30. Disconnect();
  31. FrmFullScreen = NULL;
  32. }
  33. //---------------------------------------------------------------------------
  34. void __fastcall TFrmFullScreen::FormDblClick(TObject *Sender)
  35. {
  36. Close();
  37. }
  38. //---------------------------------------------------------------------------
  39. void __fastcall TFrmFullScreen::FormShow(TObject *Sender)
  40. {
  41. this->Color = clBlack;
  42. PnlStream->ParentColor = false;
  43. PnlStream->Color = clBlack;
  44. Connect();
  45. }
  46. //---------------------------------------------------------------------------
  47. void __fastcall TFrmFullScreen::Connect()
  48. {
  49. Disconnect();
  50. PnlStream->Caption = "Connecting...";//¿¬°áÁß...";
  51. try
  52. {
  53. FFPlayer1->TryOpen(RTSP_ADDR, PnlStream->Handle);
  54. FConHandle = (long)FFPlayer1->ScreenHandle;
  55. Application->ProcessMessages();
  56. }
  57. catch(Exception &e)
  58. {
  59. }
  60. FPlay = true;
  61. }
  62. //---------------------------------------------------------------------------
  63. void __fastcall TFrmFullScreen::Disconnect()
  64. {
  65. if (!FPlay) return;
  66. FPlay = false;
  67. PnlStream->Caption = "Disconnect";
  68. try
  69. {
  70. if (FFPlayer1->ScreenHandle != NULL)
  71. {
  72. FFPlayer1->Stop(true);
  73. PostMessage(FFPlayer1->ScreenHandle, CM_INVALIDATE, 0, 0);
  74. UpdateWindow(FFPlayer1->ScreenHandle);
  75. }
  76. Application->ProcessMessages();
  77. FConHandle = 0;
  78. }
  79. catch(Exception &e)
  80. {
  81. }
  82. PnlStream->Caption = "Disconnected";
  83. FConHandle = 0;
  84. FPlay = false;
  85. }
  86. //---------------------------------------------------------------------------
  87. void __fastcall TFrmFullScreen::TmrCloseTimer(TObject *Sender)
  88. {
  89. TmrClose->Enabled = false;
  90. Close();
  91. }
  92. //---------------------------------------------------------------------------