summaryrefslogtreecommitdiff
path: root/video/quicktime_video.h
blob: 6d6f87a3b56dbc09846db255664edbc6a81cc310 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================


#ifndef QUICKTIME_VIDEO_H
#define QUICKTIME_VIDEO_H

#ifdef _WIN32
#pragma once
#endif


//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class IFileSystem;
class IMaterialSystem;
class CQuickTimeMaterial;

//-----------------------------------------------------------------------------
// Global interfaces - you already did the needed includes, right?
//-----------------------------------------------------------------------------
extern IFileSystem		*g_pFileSystem;
extern IMaterialSystem	*materials;

//-----------------------------------------------------------------------------
// Quicktime includes - conditional compilation on #define QUICKTIME in VPC
//   The intent is to have a default functionality fallback if not defined
//   which provides a dynamically generated texture (moving line on background)
//-----------------------------------------------------------------------------
#if defined ( OSX )
	#include <quicktime/QTML.h>
	#include <quicktime/Movies.h>
#elif defined ( WIN32 )
	#include <QTML.h>
	#include <Movies.h>
	#include <windows.h>
#elif
    #error "Quicktime not supported on this target platform"	
#endif


#include "video/ivideoservices.h"
#include "videosubsystem.h"

#include "utlvector.h"





// -----------------------------------------------------------------------------
// CQuickTimeVideoSubSystem - Implementation of IVideoSubSystem
// -----------------------------------------------------------------------------
class CQuickTimeVideoSubSystem : public CTier2AppSystem< IVideoSubSystem >
{
	typedef CTier2AppSystem< IVideoSubSystem > BaseClass;

	public:
		CQuickTimeVideoSubSystem();
		~CQuickTimeVideoSubSystem();

		// Inherited from IAppSystem 
		virtual bool					Connect( CreateInterfaceFn factory );
		virtual void					Disconnect();
		virtual void				   *QueryInterface( const char *pInterfaceName );
		virtual InitReturnVal_t			Init();
		virtual void					Shutdown();

		// Inherited from IVideoSubSystem
		 
		// SubSystem Identification functions
		virtual VideoSystem_t			GetSystemID();
		virtual VideoSystemStatus_t		GetSystemStatus();
		virtual VideoSystemFeature_t	GetSupportedFeatures();
		virtual const char			   *GetVideoSystemName();
		
		// Setup & Shutdown Services
		virtual bool					InitializeVideoSystem( IVideoCommonServices *pCommonServices );
		virtual bool					ShutdownVideoSystem();
		
		virtual VideoResult_t			VideoSoundDeviceCMD( VideoSoundDeviceOperation_t operation, void *pDevice = nullptr, void *pData = nullptr );
		
		// get list of file extensions and features we support
		virtual int						GetSupportedFileExtensionCount();
		virtual const char			   *GetSupportedFileExtension( int num );
		virtual VideoSystemFeature_t	GetSupportedFileExtensionFeatures( int num );

		// Video Playback and Recording Services
		virtual VideoResult_t			PlayVideoFileFullScreen( const char *filename, void *mainWindow, int windowWidth, int windowHeight, int desktopWidth, int desktopHeight, bool windowed, float forcedMinTime, VideoPlaybackFlags_t playbackFlags );

		// Create/destroy a video material
		virtual IVideoMaterial		   *CreateVideoMaterial( const char *pMaterialName, const char *pVideoFileName, VideoPlaybackFlags_t flags );
		virtual VideoResult_t			DestroyVideoMaterial( IVideoMaterial *pVideoMaterial );

		// Create/destroy a video encoder		
		virtual IVideoRecorder		   *CreateVideoRecorder();
		virtual VideoResult_t			DestroyVideoRecorder( IVideoRecorder *pRecorder );
		
		virtual VideoResult_t			CheckCodecAvailability( VideoEncodeCodec_t codec );
		
		virtual VideoResult_t			GetLastResult();

	private:
	
		bool							SetupQuickTime();
		bool							ShutdownQuickTime();

		VideoResult_t					SetResult( VideoResult_t status );

		bool							m_bQuickTimeInitialized;
		VideoResult_t					m_LastResult;
		
		VideoSystemStatus_t				m_CurrentStatus;
		VideoSystemFeature_t			m_AvailableFeatures;

		IVideoCommonServices		   *m_pCommonServices;
		
		CUtlVector< IVideoMaterial* >	m_MaterialList;
		CUtlVector< IVideoRecorder* >	m_RecorderList;
		
		static const VideoSystemFeature_t	DEFAULT_FEATURE_SET;
};

#endif // QUICKTIME_VIDEO_H