pp.h

#include <primo/pp/pp.h>

Includes

  • primo/platform/config.h

  • primo/platform/reference.h

Classes

Name

Description

primo::codecs::Hardware

Enumerates available hardware codecs.

primo::codecs::HwCodec

Describes a hardware encoder, decoder or filter.

primo::codecs::HwCodecList

An immutable list of hardware codecs.

primo::codecs::HwDevice

Describes a device that can be used for hardware accelerated encoding, decoding or processing.

primo::codecs::HwDeviceList

An immutable list of devices.

Namespaces

  • primo

  • primo::codecs

  • primo::codecs::HwApi

  • primo::codecs::HwCodecType

  • primo::codecs::HwEngine

  • primo::codecs::HwVendor

Source

  1#ifndef ___PRIMO_PP_H___
  2#define ___PRIMO_PP_H___
  3
  4#include <primo/platform/config.h>
  5#include <primo/platform/reference.h>
  6
  7namespace primo {
  8namespace codecs {
  9
 10#pragma pack(push, 1)
 11
 12/**
 13Hardware engine for encoding/decoding/processing
 14*/
 15namespace HwEngine
 16{
 17    /**
 18    HwEngine
 19    */
 20    enum Enum
 21    {
 22        /**
 23        HwEngine not specified
 24        */
 25        None = 0,
 26
 27        /**
 28        Intel Quick Sync Video
 29        */
 30        QuickSyncVideo = 1,
 31
 32         /**
 33        Nvidia NVENC
 34        */
 35        Nvenc = 2,
 36
 37        /**
 38        AMD Video Coding Engine (VCE)  
 39        */
 40        VideoCodingEngine = 3,
 41    };
 42};
 43
 44/**
 45API for using hardware engines
 46*/
 47namespace HwApi
 48{
 49    /**
 50    HwApi
 51    */
 52    enum Enum
 53    {
 54        /**
 55        HwApi not specified
 56        */
 57        None = 0,
 58
 59        /**
 60        Intel Media SDK
 61        */
 62        IntelMedia = 1,
 63        
 64        /**
 65        NVENC SDK
 66        */
 67        Nvenc = 2,
 68
 69        /**
 70        AMD OpenVideo
 71        */
 72        AmdOpenVideo = 3,
 73
 74        /**
 75        AMF (AMD Advanced Media Framework)
 76
 77        @note
 78        Not implemented.
 79        */
 80        AmdMedia = 4,
 81
 82        /**
 83        Windows Media Foundation
 84
 85        @note
 86        Only AMD VCE is supported.
 87        */
 88        MediaFoundation = 5
 89    };
 90};
 91
 92/**
 93Hardware Vendor
 94*/
 95namespace HwVendor
 96{
 97    /**
 98    HwVendor
 99    */
100    enum Enum
101    {
102        /**
103        HwVendor not specified
104        */
105        None = 0,
106
107        /**
108        Intel Corporation 
109        */
110        Intel = 1,
111
112        /**
113        Nvidia Corporation 
114        */
115        Nvidia = 2,
116
117        /**
118        Advanced Micro Devices, Inc.
119        */
120        Amd = 3,
121    };
122}
123
124/**
125Hardware encoder, decoder or filter for a specific stream type
126*/
127namespace HwCodecType
128{
129    /**
130    Hardware Codec type
131    */
132    enum Enum
133    {
134        /**
135        Hardware Codec type not specified
136        */
137        None = 0,
138
139        /**
140        AVC/H.264 Encoder
141        */
142        H264Encoder = 1,
143
144        /**
145        HEVC/H.265 Encoder
146        */
147        H265Encoder = 2,
148    };
149}
150
151/**
152Describes a hardware encoder, decoder or filter
153*/
154class HwCodec
155{
156public:
157    /**
158    Returns hardware codec name
159
160    @return A pointer to zero terminated ANSI string.
161    The returned pointer cannot be <b>NULL</b>.
162    */
163    virtual const char_t* name() const = 0;
164
165    /**
166    Returns hardware codec type
167
168    @return HwCodecType constant.
169
170    @see HwCodecType::Enum
171    */
172    virtual HwCodecType::Enum type() const = 0;
173
174    /**
175    Returns hardware engine
176
177    @return HwEngine constant.
178
179    @see HwEngine::Enum
180    */
181    virtual HwEngine::Enum  engine() const = 0;
182
183    /**
184    Returns hardware API
185
186    @return HwApi constant.
187
188    @see HwApi::Enum
189    */
190    virtual HwApi::Enum  api() const = 0;
191
192protected:
193    /**
194    This object can be destroyed only by the library.
195    */
196    virtual ~HwCodec() {}
197};
198
199/**
200An immutable list of hardware codecs
201*/
202class HwCodecList
203{
204public:
205    /**
206    Returns the number of hardware codecs in the list.
207
208	@return number of codecs in the list.
209    */
210    virtual int32_t count() const = 0;
211
212    /**
213    Returns a hardware codec by index.
214
215    @param index [in] A zero-based index.
216
217	@return A pointer to the HwCodec object specified by <i>index</i>.
218
219    The caller is not required to release the returned object.
220    */
221    virtual HwCodec* at(int32_t index) const = 0;
222
223protected:
224    /**
225    This object can be destroyed only by the library.
226    */
227    virtual ~HwCodecList() {}
228};
229
230/**
231Describes a device that can be used for 
232hardware accelerated encoding, decoding or processing
233*/
234class HwDevice
235{
236public:
237
238    /**
239    Returns device name
240
241    @return A pointer to zero terminated ANSI string.
242    The returned pointer cannot be <b>NULL</b>.
243    */
244    virtual const char_t* name() const = 0;
245
246    /**
247    Returns device vendor
248
249    @return HwVendor constant.
250
251    @see HwVendor::Enum
252    */
253    virtual HwVendor::Enum vendor() const = 0;
254
255    /**
256    The device id uniquely identifies a concrete device among all devices from the same vendor.
257    It is not unique across vendors. It can be any value except -1.
258
259    @return device id
260    */
261    virtual int64_t ID() const = 0;
262
263    /**
264    Returns an immutable list of hardware codecs.
265
266    @return A list of HwCodec objects. 
267
268    The returned list exists only in the context of Device.
269    */
270    virtual HwCodecList* codecs() = 0;
271
272protected:
273    /**
274    This object can be destroyed only by the library.
275    */
276    virtual ~HwDevice() {}
277};
278
279/**
280An immutable list of devices
281*/
282class HwDeviceList
283{
284public:
285
286    /**
287    Returns the number of devices in the list.
288
289	@return number of devices in the list.
290    */
291    virtual int32_t count() const = 0;
292
293    /**
294    Returns a device by index.
295
296    @param index [in] A zero-based index.
297
298	@return A pointer to the Device object specified by <i>index</i>.
299
300    The caller is not required to release the returned object.
301    */
302    virtual HwDevice* at(int32_t index) const = 0;
303
304protected:
305    /**
306    This object can be destroyed only by the library.
307    */
308    virtual ~HwDeviceList() {}
309};
310
311/**
312Enumerates available hardware codecs.
313*/
314class Hardware: public primo::Reference
315{
316public:
317
318    /**
319    Scans the system for available hardware codecs and populates the device list.
320
321    @param vendor [in] Vendor filter. Only devices that match the specified vendor are queried.
322    By default <i>vendor</i> is HwVendor::None which queries all known devices on the system.
323    */
324    virtual void refresh(HwVendor::Enum vendor = HwVendor::None) = 0;
325
326    
327    /**
328    Returns an immutable list of devices that support 
329    hardware-accelerated encoding, decoding or processing.
330
331    @return A list of Device objects. 
332    The device list canont be <b>NULL</b>.
333    It is initially empty when the Hardware object is created.
334    It is populated after a call to the refresh() method.
335
336    The returned list exists only in the context of Hardware.
337    */
338    virtual HwDeviceList* devices() = 0;
339
340protected:
341
342    /**
343    This object can be destroyed only by the library. The caller must use Reference::release.
344
345    @see \ref object_management "Object Management"
346    */
347	virtual ~Hardware() {}
348};
349
350#pragma pack(pop)
351}} // primo::codecs
352
353
354// Legend:
355// FR:	- future release
356// TBR:	- to be reviewed
357// .NET: - update .NET version
358// Java: - update Java version
359
360#endif // ___PRIMO_PP_H___