線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2473
推到 Plurk!
推到 Facebook!

VCL控件--TVideoCapture--AVI存檔問題..請教各位大大

尚未結案
ken911629
一般會員


發表:7
回覆:4
積分:2
註冊:2005-11-10

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-11-15 14:38:10 IP:210.201.xxx.xxx 未訂閱
在BCB5中 TVideoCapture在儲存AVI文件時只能在Configure中先設定好檔案名稱 如果我想要要主畫面設定成每一次都能修改檔案名稱,程式上要如何設定 如果直接取用下列程式碼 config->CaptureFileName = avitext->Text; 並不能存成想要的檔案名稱 希望有大大能解答我的問題...謝謝
huwk
資深會員


發表:26
回覆:340
積分:323
註冊:2002-04-03

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-11-15 17:51:35 IP:61.222.xxx.xxx 未訂閱
若你中途都沒有再從CONFIG載入任何東西! 應是直接修改TVideoCapture->CaptureFileName = avitext->Text; 即可! 在呼叫StopCapture時.即會存到你指定的檔案!
------
熊的學習 http://huwk.blogspot.com
ken911629
一般會員


發表:7
回覆:4
積分:2
註冊:2005-11-10

發送簡訊給我
#3 引用回覆 回覆 發表時間:2005-11-16 10:12:07 IP:210.201.xxx.xxx 未訂閱
根據上面大大的建議,程式會出現以下的錯誤 [C++ Error] MainForm.cpp(47): E2108 Improper use of typedef 'TVideoCapture'    以下附上我的程式碼    //----------------------------------------------------------------------------- #include  #include #include #include "VCapStrings.hpp" #include "VCap.hpp" #pragma hdrstop // if u don't need to save graph u can delete #include #include #include "MainForm.h" #include "GraphConfig.h" #pragma package(smart_init) #pragma link "VCap" #pragma resource "*.dfm" TFMain *FMain; int A=0; __fastcall TFMain::TFMain(TComponent* Owner) : TForm(Owner) { } void __fastcall TFMain::FormShow(TObject *Sender) { if (!cap->Init()) { ShowMessage("Can't init capture!"); Application->Terminate(); }; } void __fastcall TFMain::capCaptureProgress(TObject *Sender) { StatusBar->SimpleText = "Frames Captured " IntToStr(cap->NotDropped) ". Frames Dropped " IntToStr(cap->FramesDropped) ". Capture time " IntToStr(cap->CapTime / 1000) '.' IntToStr((cap->CapTime / 10) % 100); btStart->Enabled = !cap->Capturing; btStop->Enabled = !btStart->Enabled; } void __fastcall TFMain::btStartClick(TObject *Sender) { TVideoCapture->CaptureFileName = avitext->Text;//---------加入此行會錯誤 cap->StartCapture(true); capCaptureProgress(this); } void __fastcall TFMain::btStopClick(TObject *Sender) { cap->StopCapture(); capCaptureProgress(this); } void __fastcall TFMain::btCaptureFrameClick(TObject *Sender) { A ; if (!cap->CaptureFrame()) ShowMessage("Can't capture frame!"); } void __fastcall TFMain::FormClose(TObject *Sender, TCloseAction &Action) { cap->StopPreview(); cap->StopCapture(); } void __fastcall TFMain::capChangeDevice(TObject *Sender) { } void __fastcall TFMain::cbVModesChange(TObject *Sender) { cap->StartPreview(); } void __fastcall TFMain::cbAModesChange(TObject *Sender) { cap->StartPreview(); } void __fastcall TFMain::lbDialogsClick(TObject *Sender) { } void __fastcall TFMain::capStartPreview(TObject *Sender) { framecount = 0; } void __fastcall TFMain::TimerTimer(TObject *Sender) { // make a delay to show form (let form get a handle) Timer->Enabled = false; cap->RestoreGraph(config); } void __fastcall TFMain::Button1Click(TObject *Sender) { if (cap->CaptureGraph==NULL) return; CComPtr x; if (x.CoCreateInstance(__uuidof(Xml2Dex))==S_OK) x->WriteGrfFile(cap->CaptureGraph, L"graph.grf"); } void __fastcall TFMain::FormCreate(TObject *Sender) { config = new TGraphConfig(); } void __fastcall TFMain::FormDestroy(TObject *Sender) { delete config; } void __fastcall TFMain::Button2Click(TObject *Sender) { cap->SaveGraph(config); if (EditGraphConfig(config)) cap->RestoreGraph(config); } void __fastcall TFMain::capBitmapGrabbed(TCapturedBitmap *CapturedImage) { CapturedImage->SaveToFile("TEMP.bmp"); Image->Picture->Assign(CapturedImage); TJPEGImage *jpg = new TJPEGImage; Graphics::TBitmap *bmp = new Graphics::TBitmap; bmp->LoadFromFile("TEMP.BMP"); jpg->Assign(bmp); jpg->CompressionQuality = 50; jpg->Compress(); jpg->PixelFormat = jf8Bit; jpg->Assign(bmp); jpg->SaveToFile(feBitmap->Text A ".JPG"); delete jpg; delete bmp; delete("TEMP.BMP"); } void __fastcall TFMain::capFrameRendered(TObject *Sender) { } void __fastcall TFMain::capStopPreview(TObject *Sender) { framecount = 0; }
ken911629
一般會員


發表:7
回覆:4
積分:2
註冊:2005-11-10

發送簡訊給我
#4 引用回覆 回覆 發表時間:2005-11-16 10:26:22 IP:210.201.xxx.xxx 未訂閱
謝謝上面大大給我的建議...讓我找到新的方法...已經可以使用只要改成 cap->CaptureFileName = avitext->Text 就可以在主畫面隨時修改檔名
huwk
資深會員


發表:26
回覆:340
積分:323
註冊:2002-04-03

發送簡訊給我
#5 引用回覆 回覆 發表時間:2005-11-16 11:38:34 IP:61.222.xxx.xxx 未訂閱
不好意思.我原來的TVideoCapture即是指你實際的產生的物件 只是用CLASS名稱代表而已!    ^^    
引言: 謝謝上面大大給我的建議...讓我找到新的方法...已經可以使用只要改成 cap->CaptureFileName = avitext->Text 就可以在主畫面隨時修改檔名
------
熊的學習 http://huwk.blogspot.com
系統時間:2024-04-24 10:12:44
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!