DlgAudioVideo.h
上传用户:gnaf34
上传日期:2022-04-22
资源大小:1657k
文件大小:10k
- /*
- * DlgAudioVideo.h
- *
- * Header file
- *
- * Copyright (c) ITEC-Ohio, 2002.
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is Open H323 Library available at http://www.openh323.org
- * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
- *
- */
- #if !defined(AFX_DLGAUDIOVIDEO_H__86E3FB36_44BF_45A4_A254_5B6431D05842__INCLUDED_)
- #define AFX_DLGAUDIOVIDEO_H__86E3FB36_44BF_45A4_A254_5B6431D05842__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #include "videoio.h"
- #include "pwlib.h"
- /*
- #include <atlbase.h>
- #include <windows.h>
- #include <dshow.h>
- #include <stdio.h>
- #include "playcap.h"
- */
- ///////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////
- // CDlgAudioVideo dialog
- class CDlgAudioVideo : public CDialog
- {
- // Construction
- public:
- PVideoChannel *OpenVideoChannel(H323Connection & connection,BOOL isEncoding,H323VideoCodec & codec);
- CDlgAudioVideo(CWnd* pParent = NULL); // standard constructor
- // Dialog Data
- //{{AFX_DATA(CDlgAudioVideo)
- enum { IDD = IDD_DIALOG_AUDIO_VIDEO };
- CStatic m_audioVideo;
- //CDialog m_audioVideo;
- //}}AFX_DATA
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CDlgAudioVideo)
- protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
- //}}AFX_VIRTUAL
- // Implementation
- protected:
- // Generated message map functions
- //{{AFX_MSG(CDlgAudioVideo)
- afx_msg void OnButtonPlay();
- afx_msg void OnPaint();
- afx_msg void OnButtonStop();
- afx_msg void OnButtonRecord();
- afx_msg void OnTimer(UINT nIDEvent);
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
-
-
- //friend class VideoDevice;
- };
- class CDeviceVideoAudio : public H323VideoDevice
- {
- public:
-
- CDeviceVideoAudio();
- ~CDeviceVideoAudio();
- static void PlayButton(PVideoChannel * channelTmp);
- static void StopButton();
- static void AttachVideoReader(PVideoChannel * channel, H323VideoDevice * displayDevice);
- CDlgAudioVideo *mainWindow;
- //static BOOL OpenVideoChannel(H323Connection & connection,BOOL isEncoding,H323VideoCodec & codec);
- };
- ///////////////////////////////////////////////////////
- /*
- class MainWindow;
- class VideoDevice;
- class VideoWindow : public PFloatingDialog
- {
- PCLASSINFO(VideoWindow, PFloatingDialog);
-
- public:
- VideoWindow(PInteractor * parent, VideoDevice * device, BOOL local);
- ~VideoWindow();
- void SetVideoSize(int _width, int _height);
- BOOL WriteLineSegment(int x, int y, unsigned len, const BYTE * data);
- virtual void OnCancel();
- protected:
- virtual void OnClose();
- virtual void OnRedraw(PCanvas &);
- void Shutdown();
- VideoDevice * device;
- BOOL localVideo;
- PDrawCanvas * canvas;
- PPixelImage image;
- PPixelImage raster;
- PMutex mutex;
- };
- ///////////////////////////////////////////////////////
- class VideoDevice : public H323VideoDevice
- {
- PCLASSINFO(VideoDevice, H323VideoDevice);
-
- public:
- VideoDevice(MainWindow * mainWindow, BOOL local, const PString & title, BOOL flip);
- ~VideoDevice();
- virtual BOOL SetFrameSize(unsigned width, unsigned height);
- protected:
- BOOL WriteLineSegment(int x, int y, unsigned len, const BYTE * data);
- VideoWindow * window;
- BOOL windowOpen;
- BOOL flip;
- friend class VideoWindow;
- };
- ///////////////////////////////////////////////////////
- class MainWindow : public PTopLevelWindow
- {
- PCLASSINFO(MainWindow, PTopLevelWindow)
-
- public:
- MainWindow(PArgList & args);
- ~MainWindow();
- /*
- PDECLARE_COMMAND_ENABLE("MakeCall", MainWindow, CallCmd, CanMakeCall);
- PDECLARE_COMMAND_ENABLE("HangupCall", MainWindow, HangupCmd, CanHangupCall);
- PDECLARE_COMMAND_ENABLE("AcceptCall", MainWindow, AcceptCallCmd, CanAcceptCall);
- PDECLARE_COMMAND_ENABLE("RefuseCall", MainWindow, RefuseCallCmd, CanRefuseCall);
- PDECLARE_COMMAND_ENABLE("TransferCall",MainWindow, TransferCmd, CanTransferCall);
- PDECLARE_COMMAND_ENABLE("HoldCall", MainWindow, HoldCmd, CanHoldCall);
- PDECLARE_COMMAND_ENABLE("IntrudeCall", MainWindow, IntrudeCmd, CanIntrudeCall);
- PDECLARE_NOTIFIER(PMenuItem, MainWindow, UserInputCmd);
- PDECLARE_COMMAND_ENABLE("ShowStats", MainWindow, ShowStatsCmd, CanShowStats);
- PDECLARE_COMMAND_ENABLE("MuteMicrophone", MainWindow, MuteMicrophoneCmd, CanMuteMicrophone);
- PDECLARE_COMMAND_ENABLE("MuteSpeaker", MainWindow, MuteSpeakerCmd, CanMuteSpeaker);
- PDECLARE_COMMAND_ENABLE("RecordMedia", MainWindow, RecordMediaCmd, CanRecordMedia);
- PDECLARE_COMMAND_ENABLE("StopRecording", MainWindow, StopRecordingCmd, CanStopRecording);
- PDECLARE_COMMAND("ExitCmd", MainWindow, ExitCmd);
- PDECLARE_COMMAND("SpeedDialOptions", MainWindow, SpeedDialOptionsCmd);
- PDECLARE_COMMAND("GeneralOptions", MainWindow, GeneralOptionsCmd);
- PDECLARE_COMMAND("NetworkingOptions", MainWindow, NetworkingOptionsCmd);
- PDECLARE_COMMAND("ForwardingOptions", MainWindow, ForwardingOptionsCmd);
- PDECLARE_COMMAND_ENABLE("GatekeeperOptions", MainWindow, GatekeeperOptionsCmd, CanSetGatekeeper);
- PDECLARE_COMMAND("AudioDeviceOptions",MainWindow, AudioDeviceOptionsCmd);
- PDECLARE_COMMAND("AudioCodecOptions", MainWindow, AudioCodecOptionsCmd);
- PDECLARE_COMMAND("VideoOptions", MainWindow, VideoOptionsCmd);
- #if PTRACING
- PDECLARE_COMMAND("TraceOptions", MainWindow, TraceOptionsCmd);
- #endif
- PDECLARE_NOTIFIER(PTextButton, MainWindow, OnCallButton);
- PDECLARE_NOTIFIER(PTextButton, MainWindow, OnIntrudeButton);
- PDECLARE_NOTIFIER(PTextButton, MainWindow, OnAnswerButton);
- PDECLARE_NOTIFIER(PTextButton, MainWindow, OnRefuseButton);
- PDECLARE_NOTIFIER(PTextButton, MainWindow, OnHangUpButton);
- PDECLARE_NOTIFIER(PTextButton, MainWindow, OnSpeakerButton);
- PDECLARE_NOTIFIER(PTextButton, MainWindow, OnTransferButton);
- PDECLARE_NOTIFIER(PTextButton, MainWindow, OnHoldButton);
- PDECLARE_NOTIFIER(PTextButton, MainWindow, OnSpeedDialButton);
- PDECLARE_NOTIFIER(PCheckBox, MainWindow, OnSpeakerEnable);
- PDECLARE_NOTIFIER(PCheckBox, MainWindow, OnMicrophoneEnable);
- PDECLARE_NOTIFIER(PHorizontalScrollBar, MainWindow, OnSpeakerVolume);
- PDECLARE_NOTIFIER(PHorizontalScrollBar, MainWindow, OnMicrophoneVolume);
- void OutputStatus(PRESOURCE_ID strId, ...);
- virtual BOOL AllowClose(BOOL closingAll);
- virtual void OnClose();
- virtual void OnResize(const PDim & newSize, ResizeType type);
- BOOL OnAnswerCall(const H323Connection & connection);
- BOOL OnConnectionForwarded(const PString &);
- void OnConnectionEstablished(const PString & token, const PString & party);
- void OnConnectionCleared(const H323Connection & connection);
- void OnLogicalChannel(const H323Channel & channel, unsigned txStrID, unsigned rxStrID);
- void OnHandsetLifted(OpalLineInterfaceDevice & lid);
- void OnHandsetReturned(OpalLineInterfaceDevice & lid);
- void SendUserInput(char tone);
- enum CallMode {
- IdleCallMode,
- MakingCallMode,
- HangingUpMode,
- IncomingCallWait,
- IncomingLineCall,
- Active323CallMode,
- ActiveLineCallMode,
- NoGatekeeperMode,
- ApplicationShuttingDown,
- IncomingCallIntrusion
- };
- CallMode GetCallMode() const { return currentCallMode; }
- void SetCallMode(CallMode mode);
- StatisticsDlg * statisticsDialog;
- private:
- void AddSpeedDialButtons();
- BOOL SpeedDial(const PString & key);
- BOOL MakeCall(const PString & address, const PString & gateway);
- BOOL IntrudeCall(const PString & address, const PString & gateway, unsigned capabilityLevel);
- void AnswerCall(BOOL accept);
- OpenPhoneEndPoint endpoint;
- // User interface variables
- MainMenu * myMainMenu;
- PStringListBox * statusWindow;
- PTextButton * makeCallButton;
- PTextButton * answerButton;
- PTextButton * refuseButton;
- PTextButton * hangUpButton;
- PTextButton * transferButton;
- PTextButton * holdButton;
- PTextButton * intrudeCallButton;
- PTextButton * speakerButton;
- PCheckBox * speakerEnable;
- PHorizontalScrollBar * speakerVolume;
- VUMeter * speakerVU;
- PCheckBox * microphoneEnable;
- PHorizontalScrollBar * microphoneVolume;
- VUMeter * microphoneVU;
- PInteractorList speedDialButtons;
- PTimer ringSoundTimer;
- PDECLARE_NOTIFIER(PTimer, MainWindow, OnRingSoundAgain);
- PString noAnswerForwardParty;
- PTimeInterval noAnswerTime;
- PTimer noAnswerTimer;
- PDECLARE_NOTIFIER(PTimer, MainWindow, OnNoAnswerTimeout);
- PTimer vuTimer;
- PDECLARE_NOTIFIER(PTimer, MainWindow, OnUpdateVU);
- // Configuration variables
- BOOL autoAnswer;
- PINDEX maxRecentCalls;
- PString ringSoundFile;
- // State variables
- CallMode currentCallMode;
- PMutex callModeMutex;
- PString currentCallToken;
- BOOL speakerphoneSwitch;
- OpalRtpToWavFile * recorder;
- #if PTRACING
- BOOL OpenTraceFile(PConfig & config);
- PTextFile * myTraceFile;
- #endif
-
- };
- */
- //{{AFX_INSERT_LOCATION}}
- // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
- #endif // !defined(AFX_BEACONCLIENTDLG_H__6386ECCD_8A62_45C0_AAD9_3C47136CF73A__INCLUDED_)