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
129
130
131
132
133
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================
#ifndef WEBM_VIDEO_H
#define WEBM_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;
//-----------------------------------------------------------------------------
// WebM Header files, anything that seems strange here is to make it so their headers
// can mesh with ours
//-----------------------------------------------------------------------------
#define VPX_CODEC_DISABLE_COMPAT 1
#include "vpx/vpx_codec.h"
#include "vpx/vpx_encoder.h"
#include "vpx/vpx_image.h"
#include "vpx/vp8cx.h"
#ifdef UNUSED
#undef UNUSED
#endif
// libwebm, support for reading/writing webm files
#include "mkvreader.hpp"
#include "mkvparser.hpp"
#include "mkvmuxer.hpp"
#include "mkvwriter.hpp"
#include "mkvmuxerutil.hpp"
#include "vorbis/vorbisenc.h"
#include "vorbis/codec.h"
#include "video/ivideoservices.h"
#include "videosubsystem.h"
#include "utlvector.h"
#include "tier1/KeyValues.h"
#include "tier0/platform.h"
// -----------------------------------------------------------------------------
// CQuickTimeVideoSubSystem - Implementation of IVideoSubSystem
// -----------------------------------------------------------------------------
class CWebMVideoSubSystem : public CTier2AppSystem< IVideoSubSystem >
{
typedef CTier2AppSystem< IVideoSubSystem > BaseClass;
public:
CWebMVideoSubSystem();
~CWebMVideoSubSystem();
// 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 SetupWebM();
bool ShutdownWebM();
VideoResult_t SetResult( VideoResult_t status );
bool m_bWebMInitialized;
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 // WEBM_VIDEO_H
|