123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "FrmMainF.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma link "FFBaseComponent"
- #pragma link "FFBasePlay"
- #pragma link "FFPlay"
- #pragma resource "*.dfm"
- TForm1 *Form1;
- #define LICENSE_KEY "FSXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX"
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- FStrmUrl[0] = "";
- FStrmUrl[1] = "rtsp://118.40.176.110:1935/live/CCAM0140.stream";
- FStrmUrl[2] = "rtsp://118.40.176.110:1935/live/CCAM0150.stream";
- FStrmUrl[3] = "rtsp://118.40.176.110:1935/live/CCAM0160.stream";
- FStrmUrl[4] = "rtsp://118.40.176.110:1935/live/CCAM0170.stream";
- FStrmUrl[5] = "rtsp://118.40.176.110:1935/live/CCAM0010.stream";
- FStrmUrl[6] = "rtsp://118.40.176.110:1935/live/CCAM0020.stream";
- FStrmUrl[7] = "rtsp://118.40.176.110:1935/live/CCAM0030.stream";
- FStrmUrl[8] = "rtsp://118.40.176.110:1935/live/CCAM0040.stream";
- FStrmUrl[9] = "rtsp://118.40.176.110:1935/live/CCAM0050.stream";
- FStrmUrl[10] = "rtsp://118.40.176.110:1935/live/CCAM0060.stream";
- FStrmUrl[11] = "rtsp://118.40.176.110:1935/live/CCAM0070.stream";
- FStrmUrl[12] = "rtsp://118.40.176.110:1935/live/CCAM0080.stream";
- FStrmUrl[13] = "rtsp://118.40.176.110:1935/live/CCAM0090.stream";
- FStrmUrl[14] = "rtsp://118.40.176.110:1935/live/CCAM0100.stream";
- FStrmUrl[15] = "rtsp://118.40.176.110:1935/live/CCAM0110.stream";
- String g_sAppDir = ExtractFilePath(Application->ExeName);
- for (int ii = 0; ii < MAX_STREAM; ii++) {
- FStrmPnl[ii] = (TPanel*)FindComponent("Panel"+IntToStr(ii+1));
- if (FStrmPnl[ii]) {
- FStrmPnl[ii]->Caption = FStrmUrl[ii];
- }
- FFPlayer[ii] = (TFFPlayer*)FindComponent("FFPlayer"+IntToStr(ii+1));
- if (FFPlayer[ii]) {
- FFPlayer[ii]->SetLicenseKey(LICENSE_KEY);
- FFPlayer[ii]->DisableFPUExceptions();
- if (!FFPlayer[ii]->AVLibLoaded())
- {
- String sAVILibDir = g_sAppDir + "LibAV";
- if (!FFPlayer[ii]->LoadAVLib(sAVILibDir))
- {
- Application->MessageBox(L"영상표출 라이브러리를 로드하지 못하였습니다.", L"영상표출 오류", MB_OK|MB_ICONERROR|MB_APPLMODAL);
- return;
- }
- }
- }
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button1Click(TObject *Sender)
- {
- try
- {
- for (int ii = 0; ii < MAX_STREAM; ii++) {
- if (!FFPlayer[ii] || !FStrmPnl[ii]) continue;
- if (FStrmUrl[ii] == "") continue;
- FFPlayer[ii]->OnPosition = NULL;
- FFPlayer[ii]->OnFrameHook = NULL;
- FFPlayer[ii]->OnVideoHook = NULL;
- FFPlayer[ii]->AspectRatio = -1;
- FFPlayer[ii]->TryOpen(FStrmUrl[ii], FStrmPnl[ii]->Handle);
- Application->ProcessMessages();
- }
- }
- catch(Exception &e)
- {
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button2Click(TObject *Sender)
- {
- try
- {
- for (int ii = 0; ii < MAX_STREAM; ii++) {
- if (!FFPlayer[ii] || !FStrmPnl[ii]) continue;
- if (FFPlayer[ii]->ScreenHandle != NULL)
- {
- FFPlayer[ii]->Stop(true);
- PostMessage(FFPlayer[ii]->ScreenHandle, CM_INVALIDATE, 0, 0);
- UpdateWindow(FFPlayer[ii]->ScreenHandle);
- }
- Application->ProcessMessages();
- }
- }
- catch(Exception &e)
- {
- }
- }
- //---------------------------------------------------------------------------
|