|
@@ -89,6 +89,7 @@ void __fastcall TFrmCameraPlayer::FormShow(TObject *Sender)
|
|
|
void __fastcall TFrmCameraPlayer::FormClose(TObject *Sender, TCloseAction &Action)
|
|
|
{
|
|
|
try {
|
|
|
+ FAutoPlay = false;
|
|
|
Stop();
|
|
|
} catch(...) {}
|
|
|
|
|
@@ -99,6 +100,7 @@ void __fastcall TFrmCameraPlayer::FormClose(TObject *Sender, TCloseAction &Actio
|
|
|
void __fastcall TFrmCameraPlayer::FormDestroy(TObject *Sender)
|
|
|
{
|
|
|
try {
|
|
|
+ FAutoPlay = false;
|
|
|
Stop();
|
|
|
} catch(...) {}
|
|
|
}
|
|
@@ -106,7 +108,7 @@ void __fastcall TFrmCameraPlayer::FormDestroy(TObject *Sender)
|
|
|
|
|
|
void __fastcall TFrmCameraPlayer::MnuConnectClick(TObject *Sender)
|
|
|
{
|
|
|
- FAutoPlay = true;
|
|
|
+ FUserStop = true;
|
|
|
Play();
|
|
|
}
|
|
|
//---------------------------------------------------------------------------
|
|
@@ -133,19 +135,32 @@ void __fastcall TFrmCameraPlayer::CameraLog(String ALogMsg)
|
|
|
{
|
|
|
PnlCamera->Caption = ALogMsg;
|
|
|
PnlCamera->Refresh();
|
|
|
+
|
|
|
+#if 0
|
|
|
+ AnsiString strmAddr = AnsiString(STRM_ADDR);
|
|
|
+ if (strmAddr == "") {
|
|
|
+ strmAddr = "Empty Addr";
|
|
|
+ }
|
|
|
+ AnsiString sAutoPlay = FAutoPlay ? "AutoPlay:True" : "AutoPlay:False";
|
|
|
+ AnsiString sUserStop = FUserStop ? "UserStop:True" : "UserStop:False";
|
|
|
+
|
|
|
+ LOGINFO("%s,%s, %s: %s", sAutoPlay.c_str(), sUserStop.c_str(), strmAddr.c_str(), AnsiString(ALogMsg).c_str());
|
|
|
+#endif
|
|
|
+
|
|
|
Application->ProcessMessages();
|
|
|
}
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
void __fastcall TFrmCameraPlayer::Play()
|
|
|
{
|
|
|
+ if (FPlay) return;
|
|
|
+
|
|
|
if (PasLibVlcPlayer1->Visible) {
|
|
|
PasLibVlcPlayer1->Visible = false;
|
|
|
}
|
|
|
|
|
|
Stop();
|
|
|
|
|
|
-
|
|
|
if (STRM_ADDR == "") {
|
|
|
CameraLog("### 영상정보가 없습니다 ###");
|
|
|
return;
|
|
@@ -155,6 +170,10 @@ void __fastcall TFrmCameraPlayer::Play()
|
|
|
try
|
|
|
{
|
|
|
//PasLibVlcPlayer1->VLC->Path = "plugins";
|
|
|
+ PasLibVlcPlayer1->VLC->AddOption("http-caching=300");
|
|
|
+ PasLibVlcPlayer1->VLC->AddOption("file-caching=300");
|
|
|
+ PasLibVlcPlayer1->VLC->AddOption("network-caching=500");
|
|
|
+ //PasLibVlcPlayer1->VLC->AddOption("avcodec-hw=none");
|
|
|
PasLibVlcPlayer1->Play(STRM_ADDR);
|
|
|
FConHandle = 1;
|
|
|
|
|
@@ -208,7 +227,7 @@ void __fastcall TFrmCameraPlayer::Stop()
|
|
|
void __fastcall TFrmCameraPlayer::AdjustVideoFit()
|
|
|
{
|
|
|
try {
|
|
|
- if (FConHandle > 0) {
|
|
|
+ if (FConHandle > 0 && PasLibVlcPlayer1->IsPlay()) {
|
|
|
String ratioData = IntToStr(PasLibVlcPlayer1->Width) + ":" + IntToStr(PasLibVlcPlayer1->Height);
|
|
|
PasLibVlcPlayer1->SetVideoAspectRatio(ratioData);
|
|
|
}
|
|
@@ -296,20 +315,26 @@ void __fastcall TFrmCameraPlayer::PasLibVlcPlayer1MediaPlayerPlaying(TObject *Se
|
|
|
void __fastcall TFrmCameraPlayer::PasLibVlcPlayer1MediaPlayerMediaChanged(TObject *Sender, UnicodeString mrl)
|
|
|
{
|
|
|
// 스트리밍 변경됨
|
|
|
+ CameraLog("@@@ 영상 연결 중.. @@@");
|
|
|
AdjustVideoFit();
|
|
|
}
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
void __fastcall TFrmCameraPlayer::PasLibVlcPlayer1MediaPlayerStopped(TObject *Sender)
|
|
|
{
|
|
|
+ CameraLog("@@@ 영상 표출이 종료됨 @@@");
|
|
|
if (FAutoPlay && FUserStop) {
|
|
|
if (PasLibVlcPlayer1->Visible) {
|
|
|
PasLibVlcPlayer1->Visible = false;
|
|
|
}
|
|
|
- CameraLog("@@@ 영상 표출 종료 @@@");
|
|
|
+ //CameraLog("@@@ 영상 표출 종료 @@@");
|
|
|
+ }
|
|
|
|
|
|
+ FPlay = false;
|
|
|
+
|
|
|
+ if (FAutoPlay) {
|
|
|
TmrShow->Enabled = false;
|
|
|
- TmrShow->Interval = 500;
|
|
|
+ TmrShow->Interval = 1000;
|
|
|
TmrShow->Enabled = true;
|
|
|
}
|
|
|
}
|
|
@@ -339,6 +364,7 @@ void __fastcall TFrmCameraPlayer::PasLibVlcPlayer1MediaPlayerOpening(TObject *Se
|
|
|
}
|
|
|
AdjustVideoFit();
|
|
|
#endif
|
|
|
+ AdjustVideoFit();
|
|
|
}
|
|
|
//---------------------------------------------------------------------------
|
|
|
|