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

將AVI存成BMP時遇到的一些問題

尚未結案
finalevil
一般會員


發表:20
回覆:17
積分:7
註冊:2004-04-13

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-07-04 01:13:07 IP:218.168.xxx.xxx 未訂閱
麻煩各位大大幫幫忙囉,謝謝啦 各位大大,我在使用下面這個連結 大大所提供的將AVI存成BMP的Code http://delphi.ktop.com.tw/topic.php?topic_id=26175 發生了一些問題 我一開始將大大的code用在單一視窗中,宣告如下    class TForm1 : public TForm { __published:        // IDE-managed Components   TBitBtn *BitBtn1;   TImage *Image1;   TImage *Image2;   TButton *Button1;   TStatusBar *StatusBar1;   TButton *Button2;   TRadioGroup *RadioGroup1;   TImage *Image3;   TImage *Image4;   TTimer *Timer1;   TImage *Image5;   TImage *Image6;   void __fastcall BitBtn1Click(TObject *Sender);   void __fastcall Timer1Timer(TObject *Sender);   void __fastcall Button1Click(TObject *Sender);   void __fastcall Button2Click(TObject *Sender);   void __fastcall Image1MouseMove(TObject *Sender, TShiftState Shift,           int X, int Y);   void __fastcall Image2MouseMove(TObject *Sender, TShiftState Shift,           int X, int Y); private:        // User declarations public:                // User declarations   __fastcall TForm1(TComponent* Owner);    }; //--------------------------------------------------------------------------- struct RGBA {   BYTE B, G, R, A; }; struct HSI {   float H,S,I; }; RGBA **RGBdata1,**RGBfirst,**RGBsecond; HSI **HSIdata1,**HSIfirst,**HSIsecond; bool HBITMAP2TImage(HBITMAP hBitmap,TImage *Image1); // 從影像串流中取出相對應時間的Frame, 並秀在指定TImage的Canvas 上 bool Frame2TImage(PAVISTREAM *gapavi,AVISTREAMINFO *avis,long miniSecond,TImage *Image1); //由 AVI 檔中取出影像串流 bool GetVideoStream(char *szFile,PAVISTREAM *gapavi,AVISTREAMINFO *avis); 紅色的那兩行並不會有問題 可是後來我想改寫成多視窗介面.宣告如下 class TMDIChild : public TForm { __published: TImage *Image; void __fastcall FormClose(TObject *Sender, TCloseAction &Action); void __fastcall ImageMouseMove(TObject *Sender, TShiftState Shift, int X, int Y); private: struct RGBA { BYTE B, G, R, A; }; public: virtual __fastcall TMDIChild(TComponent *Owner,String Name); RGBA **colorData; }; bool HBITMAP2TImage(HBITMAP hBitmap,TImage *Image1); // 從影像串流中取出相對應時間的Frame, 並秀在指定TImage的Canvas 上 bool Frame2TImage(PAVISTREAM *gapavi,AVISTREAMINFO *avis,long miniSecond,TImage *Image1); //由 AVI 檔中取出影像串流 bool GetVideoStream(char *szFile,PAVISTREAM *gapavi,AVISTREAMINFO *avis); 結果,紅色的那兩行就有問題啦.... 好像是PAVISTREAM,AVISTREAMINFO這兩個型態造成的 以下是error message [C Error] ChildWin.h(39): E2147 'PAVISTREAM' cannot start a parameter declaration [C Error] ChildWin.h(39): E2303 Type name expected [C Error] ChildWin.h(41): E2303 Type name expected 另外,如果想將這兩行加到class TMDIChild 中要怎麼做阿 bool Frame2TImage(PAVISTREAM *gapavi,AVISTREAMINFO *avis,long miniSecond,TImage *Image1); //由 AVI 檔中取出影像串流 bool GetVideoStream(char *szFile,PAVISTREAM *gapavi,AVISTREAMINFO *avis);
anpino
版主


發表:31
回覆:477
積分:231
註冊:2003-01-02

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-07-06 09:28:18 IP:211.23.xxx.xxx 未訂閱
finalevil 您好:     
引言: class TMDIChild : public TForm { __published: TImage *Image; void __fastcall FormClose(TObject *Sender, TCloseAction &Action); void __fastcall ImageMouseMove(TObject *Sender, TShiftState Shift, int X, int Y); private: struct RGBA { BYTE B, G, R, A; }; public: virtual __fastcall TMDIChild(TComponent *Owner,String Name); RGBA **colorData; };
您把RGBA宣告成private, 又把RGBA指標放到public, compiler哪知道你是要private還是public, 就給你亂錯一通咩!! structure宣告不要寫在class裡!!
struct RGBA
{
    BYTE B, G, R, A;
};
class TMDIChild : public TForm
{
__published:
    TImage *Image;
        void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
    void __fastcall ImageMouseMove(TObject *Sender, TShiftState Shift,
          int X, int Y);
public:
        virtual __fastcall TMDIChild(TComponent *Owner,String Name);
    RGBA **colorData;
};    
------------------------------- 數學系是內功很強(邏輯/分析) 資工系是招式很多(程式技巧) 就像令狐沖VS東方不敗:D Anpinos Middle Earth http://anpino.hp.infoseek.co.jp/ -------------------------------
finalevil
一般會員


發表:20
回覆:17
積分:7
註冊:2004-04-13

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-07-08 00:59:33 IP:218.168.xxx.xxx 未訂閱
首先...謝謝發言的大大喔 可是程式還是有問題ㄝ Error message: Taye name expected 可以在幫忙看看嗎...謝謝喔
anpino
版主


發表:31
回覆:477
積分:231
註冊:2003-01-02

發送簡訊給我
#4 引用回覆 回覆 發表時間:2004-07-08 08:32:36 IP:211.23.xxx.xxx 未訂閱
引言: Error message: Taye name expected 可以在幫忙看看嗎...謝謝喔
finalevil : 麻煩把整個宣告(修改之後的)po出來, 不然誰知道你哪裡出錯阿!! (被打敗....) ------------------------------- 數學系是內功很強(邏輯/分析) 資工系是招式很多(程式技巧) 就像令狐沖VS東方不敗:D Anpinos Middle Earth http://anpino.hp.infoseek.co.jp/ -------------------------------
anpino
版主


發表:31
回覆:477
積分:231
註冊:2003-01-02

發送簡訊給我
#5 引用回覆 回覆 發表時間:2004-07-08 08:43:04 IP:211.23.xxx.xxx 未訂閱
引言: 另外,如果想將這兩行加到class TMDIChild 中要怎麼做阿 bool Frame2TImage(PAVISTREAM *gapavi,AVISTREAMINFO *avis,long miniSecond,TImage *Image1); //由 AVI 檔中取出影像串流 bool GetVideoStream(char *szFile,PAVISTREAM *gapavi,AVISTREAMINFO *avis);
class TMDIChild: public TForm
{    public:                // User declarations
  __fastcall TForm1(TComponent* Owner);
  bool Frame2TImage(PAVISTREAM *gapavi,AVISTREAMINFO *avis,long miniSecond,TImage *Image1);
//由 AVI 檔中取出影像串流
  bool GetVideoStream(char *szFile,PAVISTREAM *gapavi,AVISTREAMINFO *avis);
};
然後原來定義這2個function的地方: bool Frame2TImage(PAVISTREAM *gapavi,AVISTREAMINFO *avis,long miniSecond,TImage *Image1) { ... } 改成 bool TMDIChild::Frame2TImage(PAVISTREAM *gapavi,AVISTREAMINFO *avis,long miniSecond,TImage *Image1) { ... } 同理, GetVideoStream 也是一樣的改法。 ------------------------------- 數學系是內功很強(邏輯/分析) 資工系是招式很多(程式技巧) 就像令狐沖
finalevil
一般會員


發表:20
回覆:17
積分:7
註冊:2004-04-13

發送簡訊給我
#6 引用回覆 回覆 發表時間:2004-07-18 23:35:05 IP:218.168.xxx.xxx 未訂閱
anpino大大抱歉喔,因為前幾天跑回家了, 所以現在才回,以下是我重新宣告的code    
 
//----------------------------------------------------------------------------
#ifndef ChildWinH
#define ChildWinH
//----------------------------------------------------------------------------
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
//----------------------------------------------------------------------------
struct RGBA
{
  BYTE B, G, R, A;
};
struct HSI
{
  float H,S,I;
};
class TMDIChild : public TForm
{
__published:
    TImage *Image;
    TMainMenu *MainMenu1;
    TMenuItem *Process1;
    TMenuItem *ColorFiliter1;
        void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
    void __fastcall ImageMouseMove(TObject *Sender, TShiftState Shift,
          int X, int Y);
    void __fastcall ColorFiliter1Click(TObject *Sender);    private:    public:
        virtual __fastcall TMDIChild(TComponent *Owner,String Name=NULL);
    RGBA **RGBdata,**tempdata;
    HSI **HSIdata;
    void RGBtoHSV( float r, float g, float b, float *h, float *s, float *i );
    bool CvtToHSI(Graphics::TBitmap *bitmap=NULL);
    void ColorFiliter();
    bool HBITMAP2TImage(HBITMAP hBitmap,TImage *Image1);
    // 從影像串流中取出相對應時間的Frame, 並秀在指定TImage的Canvas 上
    // 從影像串流中取出相對應時間的Frame, 並秀在指定TImage的Canvas 上
    bool Frame2TImage(PAVISTREAM *gapavi,AVISTREAMINFO *avis,long miniSecond,TImage *Image1);
    //由 AVI 檔中取出影像串流
    bool GetVideoStream(char *szFile,PAVISTREAM *gapavi,AVISTREAMINFO *avis);
};    //----------------------------------------------------------------------------
#endif
以下是error message [C Error] ChildWin.h(47): E2293 ) expected [C Error] ChildWin.h(49): E2303 Type name expected 麻煩大大喔!!
anpino
版主


發表:31
回覆:477
積分:231
註冊:2003-01-02

發送簡訊給我
#7 引用回覆 回覆 發表時間:2004-07-19 08:29:35 IP:211.23.xxx.xxx 未訂閱
原因出在 PAVISTREAM ,AVISTREAMINFO 這2個型態未宣告,請查詢原程式, http://delphi.ktop.com.tw/topic.php?topic_id=26175 看它們宣告在哪, 把該宣告的header include進來就可以了。 ------------------------------- 數學系是內功很強(邏輯/分析) 資工系是招式很多(程式技巧) 就像令狐沖VS東方不敗:D Anpinos Middle Earth http://anpino.hp.infoseek.co.jp/ -------------------------------
finalevil
一般會員


發表:20
回覆:17
積分:7
註冊:2004-04-13

發送簡訊給我
#8 引用回覆 回覆 發表時間:2004-07-19 15:59:34 IP:218.168.xxx.xxx 未訂閱
謝謝大大喔...我發現問提出在哪裡了 我原本就有將header include進去, 嘿嘿....不過位置好像有放錯ㄝ 一開始我放在 class="code"> #ifndef ChildWinH #define ChildWinH //---------------------------------------------------------------------------- #include #include #include #include #include #include #include #include #include #include "vfw.h" 可是我又遇到一個怪問題ㄝ 一開始create一個新的application時 BCB會先幫忙把這兩行建出來
#include 
#pragma hdrstop  
可是我把 include "vfw.h"放在childwin.h時,如上 出現這個 [C Warning] ChildWin.cpp(3): W8058 Cannot create pre-compiled header: write failed 所以後來我把這兩行交換 從
#include 
#pragma hdrstop  
變成
#pragma hdrstop  
#include 
結果就ok了ㄝ....不知道是什麼原因 還有那個這行不知道是什麼ㄝ #pragma hdrstop 大大可以教一下嗎....謝謝囉
anpino
版主


發表:31
回覆:477
積分:231
註冊:2003-01-02

發送簡訊給我
#9 引用回覆 回覆 發表時間:2004-07-20 09:13:02 IP:211.23.xxx.xxx 未訂閱
1. 因為你的childwin.h有用到PAVISTREAM 與 AVISTREAMINFO, 所以必須將它們的宣告header include進來。 2. pragma 的說明在bcb的help已經有了。 ------------------------------- 數學系是內功很強(邏輯/分析) 資工系是招式很多(程式技巧) 就像令狐沖VS東方不敗:D Anpinos Middle Earth http://anpino.hp.infoseek.co.jp/ ------------------------------- 發表人 - anpino 於 2004/07/20 09:13:38
finalevil
一般會員


發表:20
回覆:17
積分:7
註冊:2004-04-13

發送簡訊給我
#10 引用回覆 回覆 發表時間:2004-07-20 18:11:26 IP:218.168.xxx.xxx 未訂閱
1.大大你誤會我的意思了ㄝ,   我是說   為什麼我把vfw.h include到childwin.h之後會發生要把這兩行交換
  #include 
  #pragma hdrstop  
變成
  #pragma hdrstop  
  #include 
compiler才不會有這個出現 [C Warning] ChildWin.cpp(3): W8058 Cannot create pre-compiled header: write failed 2.恩恩我會去看看的...謝謝
anpino
版主


發表:31
回覆:477
積分:231
註冊:2003-01-02

發送簡訊給我
#11 引用回覆 回覆 發表時間:2004-07-21 08:41:34 IP:211.23.xxx.xxx 未訂閱
您好,
#pragma hdrstop
這個問題,在bcb的help也有呀~~ 引述如下:
引言: Syntax #pragma hdrstop Description This directive terminates the list of header files eligible for precompilation. You can use it to reduce the amount of disk space used by precompiled headers. Precompiled header files can be shared between the source files of your project only if the #include directives before #pragma hdrstop are identical. Therefore, you get the best compiler performance if you include common header files of your project before the #pragma hdrstop, and specific ones after it. Make sure the #include directives before the #pragma hdrstop are identical in all the source files, or that there are only very few variations. The integrated development environment generates code to enhance precompiled header performance. For example, after a New Application, source file "Unit1.cpp" will look like this (comments added):
#include        // common header file    #pragma hdrstop      // terminate list here    #include "Unit1.h"    // specific header file
// ....
Use this pragma directive only in source files. The pragma has no effect when it is used in a header file.
------------------------------- 數學系是內功很強(邏輯/分析) 資工系是招式很多(程式技巧) 就像令狐沖VS東方不敗:D Anpinos Middle Earth http://anpino.hp.infoseek.co.jp/ -------------------------------
系統時間:2024-05-21 0:50:31
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!