home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 October
/
Chip_1997-10_cd.bin
/
tema
/
sybase
/
powerj
/
hpp.z
/
WMEDIA.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1997-01-27
|
11KB
|
392 lines
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright (C) 1994, by WATCOM International Inc. All rights %
% reserved. No part of this software may be reproduced or %
% used in any form or by any means - graphic, electronic or %
% mechanical, including photocopying, recording, taping or %
% information storage and retrieval systems - except with the %
% written permission of WATCOM International Inc. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
/*************************************************************************
*
* WMediaPlayer -- Wrapper for the Windows 95 Media Player control.
*
*
* Events:
*
* MediaNotifyError --
*
* MediaNotifyMedia --
*
* MediaNotifyMode --
*
* MediaNotifyPos --
*
* MediaNotifySize --
*
*************************************************************************/
#ifndef _WMEDIA_HPP_INCLUDED
#define _WMEDIA_HPP_INCLUDED
#ifndef _WNO_PRAGMA_PUSH
#pragma pack(push,8);
#pragma enum int;
#endif
#ifndef _WCONTROL_HPP_INCLUDED
# include "wcontrol.hpp"
#endif
#ifndef _WFILPATH_HPP_INCLUDED
# include "wfilpath.hpp"
#endif
#ifdef _UNICODE
#define WMPNotifyMedia WMPNotifyMediaUnicode
#else
#define WMPNotifyMedia WMPNotifyMediaAnsi
#endif
//
// MediaPlayer styles
//
#define WMPNoAutoSizeWindow ((WStyle)0x00000001) // MCIWNDF_NOAUTOSIZEWINDOW
#define WMPNoPlayBar ((WStyle)0x00000002) // MCIWNDF_NOPLAYBAR
#define WMPNoAutoSizeMovie ((WStyle)0x00000004) // MCIWNDF_NOAUTOSIZEMOVIE
#define WMPNoMenu ((WStyle)0x00000008) // MCIWNDF_NOMENU
#define WMPShowName ((WStyle)0x00000010) // MCIWNDF_SHOWNAME
#define WMPShowPos ((WStyle)0x00000020) // MCIWNDF_SHOWPOS
#define WMPShowMode ((WStyle)0x00000040) // MCIWNDF_SHOWMODE
#define WMPShowAll ((WStyle)0x00000070) // MCIWNDF_SHOWALL
#define WMPNotifyAnsi ((WStyle)0x00000080) // MCIWNDF_NOTIFYANSI
#define WMPNotifyMode ((WStyle)0x00000100) // MCIWNDF_NOTIFYMODE
#define WMPNotifyPos ((WStyle)0x00000200) // MCIWNDF_NOTIFYPOS
#define WMPNotifySize ((WStyle)0x00000400) // MCIWNDF_NOTIFYSIZE
#define WMPNotifyError ((WStyle)0x00001000) // MCIWNDF_NOTIFYERROR
#define WMPNotifyAll ((WStyle)0x00001F00) // MCIWNDF_NOTIFYALL
#define WMPNotifyMediaAnsi ((WStyle)0x00000880) // MCIWNDF_NOTIFYMEDIAA
#define WMPNotifyMediaUnicode ((WStyle)0x00000800) // MCIWNDF_NOTIFYMEDIAW
#define WMPRecord ((WStyle)0x00002000) // MCIWNDF_RECORD
#define WMPNoErrorDlg ((WStyle)0x00004000) // MCIWNDF_NOERRORDLG
#define WMPNoOpen ((WStyle)0x00008000) // MCIWNDF_NOOPEN
#ifdef _UNICODE
#define WMPDefault ((WStyle)0x50001F51L) // WS_VISIBLE|WS_CHILD|MCIWNDF_SHOWALL|MCIWNDF_NOAUTOSIZEWINDOW|MCIWNDF_NOTIFYALL|MCIWNDF_NOTIFYMEDIAW
#else
#define WMPDefault ((WStyle)0x50001FF1L) // WS_VISIBLE|WS_CHILD|MCIWNDF_SHOWALL|MCIWNDF_NOAUTOSIZEWINDOW|MCIWNDF_NOTIFYALL|MCIWNDF_NOTIFYMEDIAA
#endif
#define WMPDefaultOld (((WStyle)0x50001F71L)|WMPNotifyMedia) // WS_VISIBLE|WS_CHILD|MCIWNDF_SHOWALL|MCIWNDF_NOAUTOSIZEWINDOW|MCIWNDF_NOTIFYALL|MCIWNDF_NOTIFYMEDIA
struct WMediaNotifyEventData : WEventData {
WChar* fileName;
WLong lData;
};
class WCMCLASS WMediaPlayer : public WControl {
WDeclareSubclass( WMediaPlayer, WControl );
public:
WMediaPlayer();
~WMediaPlayer();
/*******************************************************************
* Properties
*******************************************************************/
// CanEject
WBool GetCanEject();
// CanPlay
WBool GetCanPlay();
// CanRecord
WBool GetCanRecord();
// CanSave
WBool GetCanSave();
// Position
#define WMEDIAPLAYER_SEEK_HOME -1
#define WMEDIAPLAYER_SEEK_START -1
#define WMEDIAPLAYER_SEEK_END -2
WBool SetPosition( WLong position );
WLong GetPosition();
// Repeat
WBool GetRepeat();
WBool SetRepeat( WBool repeat );
// Speed
WUInt GetSpeed();
WBool SetSpeed( WUInt speed=1000 );
// Volume
WUInt GetVolume();
WBool SetVolume( WUInt volume=1000 );
// Zoom
WUInt GetZoom();
WBool SetZoom( WUInt zoom=100 );
/*******************************************************************
* Methods
*******************************************************************/
// Close
WBool Close();
// Eject
WBool Eject();
// New
WBool New( const WFilePath & fileName );
// Open
//
// The parameterless version invokes an open dialog
WBool Open();
WBool Open( const WFilePath & fileName, WBool createIfDoesntExist=FALSE );
// Pause
WBool Pause();
// Play
WBool Play( WLong from=WMEDIAPLAYER_SEEK_START,
WLong to=WMEDIAPLAYER_SEEK_END );
// Record
WBool Record();
// Resume
WBool Resume();
// Save
//
// The parameterless version invokes a save dialog
WBool Save();
WBool Save( const WFilePath & fileName );
// Step
WBool Step( WLong increment );
// Stop
WBool Stop();
/*******************************************************************
* Overrides
*******************************************************************/
virtual WBool Destroy();
virtual WBool ProcessMessage( const WMessage & msg,
WLong & returns );
virtual const WChar * InitializeClass();
virtual WStyle GetDefaultStyle() const;
virtual WStyle GetDefaultExtendedStyle() const;
virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
void * data=NULL );
};
#ifndef _INC_MMSYSTEM
#ifndef _MCIDEVICEID_ /* Same with MCIDEVICEID */
#define _MCIDEVICEID_
typedef WUInt MCIDEVICEID; /* MCI device ID type */
#endif
#define MCI_STRING_OFFSET 512
#endif
typedef MCIDEVICEID WMediaDeviceID;
enum WMediaDeviceOpenFlags {
WMediaDeviceOpenShareable = 0x00000100L,
WMediaDeviceOpenElement = 0x00000200L,
WMediaDeviceOpenAlias = 0x00000400L,
WMediaDeviceOpenElementID = 0x00000800L,
WMediaDeviceOpenTypeID = 0x00001000L,
WMediaDeviceOpenType = 0x00002000L,
};
enum WMediaDevicePlayFlags {
WMediaDevicePlayFrom = 0x00000004L,
WMediaDevicePlayTo = 0x00000008L,
};
enum WMediaDeviceSeekFlags {
WMediaDeviceSeekTo = 0x00000008L,
WMediaDeviceSeekToStart = 0x00000100L,
WMediaDeviceSeekToEnd = 0x00000200L,
};
enum WMediaDeviceTimeFormat {
WMediaDeviceTimeFormatMilliseconds = 0,
WMediaDeviceTimeFormatHMS = 1,
WMediaDeviceTimeFormatMSF = 2,
WMediaDeviceTimeFormatFrames = 3,
WMediaDeviceTimeFormatSMPTE_24 = 4,
WMediaDeviceTimeFormatSMPTE_25 = 5,
WMediaDeviceTimeFormatSMPTE_30 = 6,
WMediaDeviceTimeFormatSMPTE_30DROP = 7,
WMediaDeviceTimeFormatBytes = 8,
WMediaDeviceTimeFormatSamples = 9,
WMediaDeviceTimeFormatTMSF = 10,
};
enum WMediaDeviceMode {
WMediaDeviceModeNotReady = (MCI_STRING_OFFSET + 12),
WMediaDeviceModeStop = (MCI_STRING_OFFSET + 13),
WMediaDeviceModePlay = (MCI_STRING_OFFSET + 14),
WMediaDeviceModeRecord = (MCI_STRING_OFFSET + 15),
WMediaDeviceModeSeek = (MCI_STRING_OFFSET + 16),
WMediaDeviceModePause = (MCI_STRING_OFFSET + 17),
WMediaDeviceModeOpen = (MCI_STRING_OFFSET + 18),
};
class WCMCLASS WMediaDevice : public WObject {
WDeclareSubclass( WMediaDevice, WObject );
public:
/*******************************************************************
* Constructors and Destructors
*******************************************************************/
WMediaDevice();
~WMediaDevice();
/*******************************************************************
* Properties
*******************************************************************/
// CurrentTrack
WULong GetCurrentTrack() const;
// DoorOpened
WBool SetDoorOpened( WBool doorOpened );
// ID
WMediaDeviceID GetID() const;
// Length
WULong GetLength() const;
// Mode
WMediaDeviceMode GetMode() const;
// Position
WULong GetPosition() const;
// Ready
WBool GetReady() const;
// TimeFormat
WMediaDeviceTimeFormat GetTimeFormat() const;
WBool SetTimeFormat( WMediaDeviceTimeFormat format );
// TrackCount
WULong GetTrackCount() const;
/*******************************************************************
* Methods
*******************************************************************/
// Close
WBool Close( WBool wait=FALSE );
// Open
WBool Open( const WChar * deviceType,
WMediaDeviceOpenFlags flags=WMediaDeviceOpenType,
const WChar * elementName=NULL,
const WChar * deviceAlias=NULL, WBool wait=FALSE );
// Pause
WBool Pause( WBool wait=FALSE );
// Play
WBool Play( WULong flags=0, WULong from=0, WULong to=0,
WBool wait=FALSE );
// Seek
WBool Seek( WMediaDeviceSeekFlags flags, WULong seekTo,
WBool wait=FALSE );
// SendCommand
WBool SendCommand( WUInt message, WDWord flags, void * info );
// Stop
WBool Stop( WBool wait=FALSE );
/*******************************************************************
* Item Properties
*******************************************************************/
// Length
WULong GetLength( WULong track ) const;
// Position
WULong GetPosition( WULong track ) const;
/*******************************************************************
* Data Members
*******************************************************************/
private:
WMediaDeviceID _id;
};
#ifndef _WNO_PRAGMA_PUSH
#pragma enum pop;
#pragma pack(pop);
#endif
#endif // _WMEDIA_HPP_INCLUDED