📄 vcmapi.h
字号:
BITMAPINFOHEADER * m_pbiSrc;
BITMAPINFOHEADER * m_pbiDst;
long m_xsrc, m_ysrc, m_dxsrc, m_dysrc;
long m_xdst, m_ydst, m_dxdst, m_dydst;
long m_xout, m_yout, m_dxout, m_dyout;
long m_xwnd, m_ywnd, m_dxwnd, m_dywnd;
// Indeo(R) Video Interactive specific structures
R4_DEC_SEQ_DATA m_r4seqCurrent, m_r4seqDefault;
R4_DEC_FRAME_DATA m_r4frameCurrent, m_r4frameDefault;
// bounding rectangles for transparencies
R4_RECT m_r4BR;
R4_RECT m_r4LastBR;
// DIBs for transparency background
DIB* m_pDIB;
DIB* m_pBG;
// DIB Section
HBITMAP m_hDIBSection;
unsigned char * m_pDIBSection;
public:
HPALETTE m_hpalSection;
private:
// Temporary buffer used internally
int m_cbuf;
unsigned char * m_pbuf;
HDC m_hmemDC;
HBITMAP m_hbmOld;
HPALETTE m_hpalOld_DC, m_hpalOld_MemDC;
};
#endif // _AVIVCM_H_
/************************/
/************************/
// aviMovie.h : Interface of the CAviMovie class
//
// This code and information is provided "as is" without warranty of
// any kind, either expressed or implied, including but not limited to
// the implied warranties of merchantability and/or fitness for a
// particular purpose.
// Copyright (C) 1995 Intel Corporation. All rights reserved.
//
#ifndef _AVIMOVIE_H_
#define _AVIMOVIE_H_
#define OLE2ANSI
#include <vfw.h>
#undef OLE2ANSI
// Since we need VCM services
//#include "videoVCM.h"
// and DIBs
//#include "dib.h"
///////////////////////////////////////////////////////////////////////////////
//
// Messages
#define AVIMOV_NOTIFYSIZE (WM_USER+1) // tell parent to resize
// Maximum # streams open at once
#define MAXSTREAMS 16
// Maximum frames of audio skew
#define MAX_AUDIOBUFS 32
// Error codes
#define MOVERR_OK 0L
#define MOVERR_NOVIDEOSTREAM -1L
#define MOVERR_VIDS -2L
#define MOVERR_AUDS -3L
#define MOVERR_PLAYING -4L
#define MOVERR_BADOPTION -5L
#define AUDSERR_OK 0L
#define AUDSERR_NOAUDIO -10L
#define AUDSERR_MAXBUFSEXCEEDED -11L
#define AUDSERR_UNSUPPORTEDFORMAT -12L
#define AUDSERR_OPEN -13L
#define AUDSERR_WAVEOUT -14L
#define VIDSERR_OK 0L
#define VIDSERR_NOVIDEO -20L
#define VIDSERR_VCM -21L
#define VIDSERR_DC -22L
#define VIDSERR_NOTSTARTED -23L
#define VIDSERR_READ -24L
///////////////////////////////////////////////////////////////////////////////
// CAviV Defininition
class CAviMovie
{
public:
CAviMovie ();
~CAviMovie ();
// VCM
// WARNING: should only access VCM during stopped mode (for accesses that will
// change the state).
CVideoVCM * m_pVCM;
DIB* m_pDIB;
// Avi File
// Operations
public:
long FileOpen (LPCTSTR lpszPathName);
long FileClose ();
// Information
PAVIFILE m_pfile;
PAVISTREAM m_paviVideo; // video stream to play
PAVISTREAM m_paviAudio; // audio stream to play
// Movie
// Operations
public:
HWND m_hwnd;
long MovieOpen (HWND hwnd);
long MovieClose ();
long MovieStart (HDC hdc);
long MovieStop ();
long MoviePause ();
long MovieSeek (long lpos); // absolute seek from beginning of file
long MovieSeekCurrent (long ldiff); // relative seek from current pointer
// Set destination options, i.e. resolution and/or bpp
long MovieSetDestOptions (float zoom, int bpp = 0, int altMode = 0, long xres = 0, long yres = 0);
long MovieSetDestPalette (LOGPALETTE* pLogPal);
long MovieSet8BitDither( int dither, int iFirst, int iLast );
long MovieGet8BitDither( void );
long MovieSetBackground (char * lpszBmpName);
// Miscellaneous queries
BOOL MovieIsFileOpen () { return (m_pfile != 0); }
BOOL MovieIsPlaying () { return (m_bPlaying); }
BOOL MovieIsEnd () { return (m_vidsCurrent == m_vidsLast); }
UINT MovieGetTimeslice () { return (UINT) (1.0/m_frate*1000.0); }
float MovieGetFrameRate () { return m_frate; }
// Information
protected:
BOOL m_bPlaying; // F if stopped/paused
BOOL m_bPaused; // T if paused
// These are the same for now, can change the frate for faster/slower playback
float m_fps; // frame rate of file
float m_frate; // frame rate of playback
// Syncronization
public:
long vidsTimeToSample (long lTime);
long vidsSampleToTime (long lSample);
private:
UINT m_resolution; // minimum timing resolution for current machine
// Video
// Operations
public:
long vidsVideoOpen ();
long vidsVideoClose ();
// These functions can change state of m_bPlaying.
long vidsVideoStart (HDC hdc, long fStart = -1L);
long vidsVideoStop ();
long vidsVideoDraw ();
long vidsGetTime () { return ((long) (float(m_vidsCurrent-m_vidsFirst) / m_fps * 1000.0)); }
long vidsGetFrame () { return m_vidsCurrent; }
int vidsGetNumFrames () { return m_vidsLast-m_vidsFirst+1; }
// frame=-1 means frame=m_vidsCurrent
BOOL vidsIsKey (long frame = -1);
// Will always decode current frame
void vidsResetDraw () { m_vidsPrevious = -1; }
// Information
HDRAWDIB m_hdd;
HDC m_hdc;
void vidsResetSkipCount () { m_play_fskipped = 0; }
int vidsFramesSkipped () { return m_play_fskipped; }
protected:
long m_timePlayStart, m_timePlayStartPos;
int m_play_fprev; // to help us calculate ...
int m_play_fskipped;// frames skipped since last play
private:
// Internal functions/vars
BOOL vidsSync ();
void vidsCatchup ();
long m_vidsCurrent; // attempted frame to draw
long m_vidsPrevious; // last successfully decoded frame
long m_vidsPrevKey, m_vidsNextKey;
long m_vidsFirst, m_vidsLast;
unsigned char * m_pvBuf; // for optimization - storage for returning frame bits
int m_cbvBuf; // count bytes of above buffer
RECT m_Rect; // bounding rectangle for transparency
// Audio
// Operation
public:
long audsWaveOpen (HWND hwnd);
long audsWaveClose ();
long audsWavePlay (long fStart, long fEnd, BOOL bFrameSamp);
long audsWaveStop ();
long audsWavePause ();
long audsWaveRestart ();
long audsGetTime (); // postion in ms since audsWavePlay ()
long audsFillBuf (int nLen);
long audsOutBuf ();
long audsDoneBuf ();
// Information
long audsTimeToSample (long lTime);
protected:
HWAVEOUT m_hWaveOut;
long m_timeAudioStart;
long m_audsFirst, m_audsLast; // first and last audio frame
long m_audsSkew; // # frames skew
long m_sampsPerSec;
long m_bytesPerSec;
long m_sampSize; // size (bytes) of one audio sample
long m_sampsPerFrame; // # samples in one frame (1/fps sec)
private:
long m_audsCurrent; // current frame of audio during playback
WAVEHDR * m_audsBuf [MAX_AUDIOBUFS]; // data follows
int m_iaudsFreeBuf; // points to next free buffer
int m_iaudsPlayBuf; // points to next buffer to play
int m_naudsBufsOut; // number to buffers currently out
};
#endif // _AVIMOVIE_H_
/************************/
/************************/
// scale.h
//
// This code and information is provided "as is" without warranty of
// any kind, either expressed or implied, including but not limited to
// the implied warranties of merchantability and/or fitness for a
// particular purpose.
// Copyright (C) 1995 Intel Corporation. All rights reserved.
//
typedef struct tagPROCESSOR
{
char text [128]; // text description
long mhz; // mhz in terms of Pentium(R)
}
PROCESSOR;
BOOL setProcessor (PROCESSOR processor_list [], int nlen);
extern int giActualProcessor;
#define ABS_(x) (x<0 ? (-(x)) : (x))
/************************/
/************************/
// movie.h
//
// This code and information is provided "as is" without warranty of
// any kind, either expressed or implied, including but not limited to
// the implied warranties of merchantability and/or fitness for a
// particular purpose.
// Copyright (C) 1995 Intel Corporation. All rights reserved.
//
// defines
#define ID_FILE_OPEN 40001
#define ID_FILE_CLOSE 40002
#define ID_MOVIE_PLAY 40003
#define ID_MOVIE_STOP 40004
#define ID_MOVIE_REWIND 40006
#define ID_MOVIE_PLAYBAR 40007
#define ID_OPTIONS_BITDEPTH_CLUT8 40008
#define ID_OPTIONS_BITDEPTH_RGB16 40009
#define ID_OPTIONS_BITDEPTH_RGB16_555 40010
#define ID_OPTIONS_BITDEPTH_RGB16_565 40011
#define ID_OPTIONS_BITDEPTH_RGB24 40012
#define ID_OPTIONS_BITDEPTH_RGB32 40013
#define ID_OPTIONS_RESOLUTION_NATIVE 40014
#define ID_OPTIONS_RESOLUTION_ZOOMBY2 40015
#define ID_OPTIONS_RESOLUTION_OTHER 40017
#define ID_OPTIONS_RESOLUTION_ZOOMBY2ALT 40017
#define ID_OPTIONS_INDEOVIDEOR4_COLORCONTROLS 40018
#define ID_OPTIONS_INDEOVIDEOR4_ACCESSKEY 40019
#define ID_OPTIONS_INDEOVIDEOR4_SCALABILITY 40020
#define ID_MOVIE_LOOP 40021
#define ID_MOVIE_STATISTICS 40023
#define ID_MOVIE_PAUSE 40024
#define ID_MOVIE_REDRAW 40025
#define ID_MOVIE_STEPBACK 40026
#define ID_MOVIE_STEPFORWARD 40027
#define ID_MOVIE_PLAYPAUSE 40029
#define ID_MOVIE_INFO 40031
#define ID_MOVIE_PAGEBACK 40032
#define ID_MOVIE_PAGEFORWARD 40033
#define ID_MOVIE_SECBACK 40034
#define ID_MOVIE_SECFORWARD 40035
#define ID_MOVIE_SEEKBAR 40037
#define ID_OPTIONS_PALETTE_NATIVE 40043
#define ID_OPTIONS_PALETTE_CLIPBOARD 40044
#define ID_OPTIONS_PALETTE_GRAY 40045
#define ID_OPTIONS_INDEOVIDEOR4_TRANSPARENCY_SETBACKGROUND 40046
#define ID_OPTIONS_PALETTE_LOAD 40047
#define ID_OPTIONS_PALETTE_FILE 40047
#define ID_OPTIONS_INDEOVIDEOR4_CONTROLS 40048
#define ID_OPTIONS_INDEOVIDEOR4_SETBACKGROUND 40049
#define ID_OPTIONS_INDEOVIDEOR4_CUSTOM 40050
#define ID_OPTIONS_PALETTE_ACTIVE 40051
// Globals
// Movie instance
extern CAviMovie * gpMovie;
// Critical Section gPlayKey and var gbPlay for synchronization
extern CRITICAL_SECTION gPlayKey;
extern BOOL gbPlay;
// Stores information for file properties
typedef struct tagKFILEINFO
{
FOURCC fcc;
// General
char szFileName [128];
char szMediaLen [128];
char szAudioFmt [128];
char szVideoRes [128];
char szVideoNFm [128];
char szVideoFPS [128];
char szVideoFmt [128];
char szDataRate [128];
} KFILEINFO;
// Commands
// Thread Proc
void MovieThreadProc (void * pParm);
// Init/Term
void MovieInitialize (HWND);
void MovieTerminate (HWND);
// File ops
BOOL MovieFileOpen (HWND, LPSTR);
void MovieFileClose (HWND);
// Movie ops
void MoviePlay (HWND);
void MovieStop (HWND);
void MoviePause (HWND);
void MovieSeek (HWND, long);
void MovieSeekCurrent (HWND, long);
void MovieSeekPercent (HWND, int);
void MovieSeekSec (HWND, int);
void MovieToggleLoop (HWND);
void MovieRedraw (HWND); // ID_MOVE_REDRAW
void MovieGetInfo (HWND, char *, KFILEINFO *);
// Options
void MovieSetOptionsBitdepth (HWND, int);
void MovieSetOptionsResolution (HWND hwnd, int id, int xres = 0, int yres = 0);
void MovieSetOptionsPalette (HWND, int);
long MovieSetOptions8BitDither( HWND hwnd, int iDither, int iFirst, int iLast );
long MovieGetOptions8BitDither( void );
// Indeo(R) Video Interactive Options
// Transparency background
void MovieSetBackground(HWND hwnd, char* file = NULL);
long MovieLoadPalette(HWND hwnd, LOGPALETTE* pLogPal);
BOOL MoviePointInImage(int xpos, int ypos );
void MovieSetImagePos(int xpos, int ypos);
// Brightness, Saturation, Contrast
void MovieGetOptionsBSC (HWND, long *, long *, long *, BOOL);
void MovieSetOptionsBSC (HWND, long, long, long, BOOL);
// Scalability
void MovieGetOptionsScalability (HWND, int *, BOOL);
void MovieSetOptionsScalability (HWND, int, BOOL);
void MovieSetOptionsAccessKey (HWND hwnd, DWORD dwKey);
extern DWORD gIdle;
void MovieSetgIdle (int, PROCESSOR []);
long MovieGetMSToProcessor (long, PROCESSOR [], int);
long MovieGetProcessorToMS (int, PROCESSOR [], int);
// Other messages
void MoviePaint (HWND, HDC, PAINTSTRUCT *); // WM_PAINT
void MoviePaletteChanged (HWND, HWND);
void MovieAudioMsg (HWND, UINT); // MM_WOM_ msgs
int MovieGetHandle();
/************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -