Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
FrameViewerDlg.cpp
Package: VC++视频传输.rar [view]
Upload User: hxb_1234
Upload Date: 2010-03-30
Package Size: 8328k
Code Size: 3k
Category:
Visual C++ Books
Development Platform:
Visual C++
- // FrameViewerDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "XvidQuantsParser.h"
- #include "FrameViewerDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CFrameViewerDlg dialog
- CFrameViewerDlg::CFrameViewerDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CFrameViewerDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CFrameViewerDlg)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
- void CFrameViewerDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CFrameViewerDlg)
- // NOTE: the ClassWizard will add DDX and DDV calls here
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CFrameViewerDlg, CDialog)
- //{{AFX_MSG_MAP(CFrameViewerDlg)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CFrameViewerDlg message handlers
- //-------------------------------------------------------------------------------------------
- void CFrameViewerDlg::Init(int num, CString path)
- {
- frame = num;
- avipath = path;
- }
- //-------------------------------------------------------------------------------------------
- BOOL CFrameViewerDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- DrawFrame();
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- //-------------------------------------------------------------------------------------------
- void CFrameViewerDlg::DrawFrame(void)
- {
- LPBITMAPINFOHEADER bmihdr;
- LPBITMAPINFOHEADER bmihdrd;
- LONG lActualBytes;
- LPVOID b;
- LPVOID bdec = NULL;
- HDRAWDIB hddib;
- CDC* cdc;
- HDC hdc;
- HIC hic;
- cdc = GetDC();
- hdc = cdc->m_hDC;
- InputFileAVI *inputAVI = new InputFileAVI(false);
- inputAVI->Init((char*)(LPCTSTR)avipath);
- VideoSourceAVI *inputVideoAVI;
- inputVideoAVI = (VideoSourceAVI*) inputAVI->videoSrc;
- //Get Frame size/data...
- inputVideoAVI->read(frame, 1, NULL, 0, &lActualBytes, NULL);
- b = new char[lActualBytes];
- inputVideoAVI->read(frame, 1, b, lActualBytes, &lActualBytes, NULL);
- //b = inputVideoAVI->getFrameBuffer();
- //b = inputVideoAVI->getFrame(frame);
- bmihdr = inputVideoAVI->getImageFormat();
- inputVideoAVI->setDecompressedFormat(24);
- bmihdrd = inputVideoAVI->getDecompressedFormat();
- width = bmihdr->biWidth;
- height = bmihdr->biHeight;
- hic = inputVideoAVI->getDecompressorHandle();
- //bdec = inputVideoAVI->getFrameBuffer();
- bdec = new char[bmihdrd->biSizeImage];
- if (ICDecompressBegin(hic, bmihdr, bmihdrd) == ICERR_OK)
- {
- ICDecompress(hic, 0, bmihdr, b, bmihdrd, bdec);
- ICDecompressEnd(hic);
- }
- SizeToFrame();
- hddib = DrawDibOpen();
- //DrawDibDraw(hddib, hdc, 0, 0, width, height, bmihdrd, bdec, 0, 0, width, height, DDF_JUSTDRAWIT);
- DrawDibClose(hddib);
- //All good
- delete inputAVI;
- delete[] b;
- delete[] bdec;
- }
- //-------------------------------------------------------------------------------------------
- void CFrameViewerDlg::SizeToFrame(void)
- {
- CRect rect;
- GetWindowRect(&rect);
- SetWindowPos(&wndTopMost , rect.left, rect.top, width, height, SWP_DRAWFRAME);
- UpdateData(FALSE);
- }