#ifndef AMF_PropertyStorageEx_h
#define AMF_PropertyStorageEx_h
#pragma once
#include "PropertyStorage.h"
#if defined(__cplusplus)
namespace amf
{
#endif
typedef enum AMF_PROPERTY_CONTENT_ENUM
{
AMF_PROPERTY_CONTENT_DEFAULT = 0,
AMF_PROPERTY_CONTENT_XML,
AMF_PROPERTY_CONTENT_FILE_OPEN_PATH, AMF_PROPERTY_CONTENT_FILE_SAVE_PATH,
AMF_PROPERTY_CONTENT_INTEGER_ARRAY, AMF_PROPERTY_CONTENT_FLOAT_ARRAY } AMF_PROPERTY_CONTENT_ENUM;
typedef enum AMF_PROPERTY_ACCESS_TYPE
{
AMF_PROPERTY_ACCESS_PRIVATE = 0,
AMF_PROPERTY_ACCESS_READ = 0x1,
AMF_PROPERTY_ACCESS_WRITE = 0x2,
AMF_PROPERTY_ACCESS_READ_WRITE = (AMF_PROPERTY_ACCESS_READ | AMF_PROPERTY_ACCESS_WRITE),
AMF_PROPERTY_ACCESS_WRITE_RUNTIME = 0x4,
AMF_PROPERTY_ACCESS_FULL = 0xFF,
AMF_PROPERTY_ACCESS_NON_PERSISTANT = 0x4000,
AMF_PROPERTY_ACCESS_NON_PERSISTANT_READ = (AMF_PROPERTY_ACCESS_NON_PERSISTANT | AMF_PROPERTY_ACCESS_READ),
AMF_PROPERTY_ACCESS_NON_PERSISTANT_READ_WRITE = (AMF_PROPERTY_ACCESS_NON_PERSISTANT | AMF_PROPERTY_ACCESS_READ_WRITE),
AMF_PROPERTY_ACCESS_NON_PERSISTANT_FULL = (AMF_PROPERTY_ACCESS_NON_PERSISTANT | AMF_PROPERTY_ACCESS_FULL),
AMF_PROPERTY_ACCESS_INVALID = 0x8000
} AMF_PROPERTY_ACCESS_TYPE;
typedef struct AMFEnumDescriptionEntry
{
amf_int value;
const wchar_t* name;
} AMFEnumDescriptionEntry;
typedef amf_uint32 AMF_PROPERTY_CONTENT_TYPE;
typedef struct AMFPropertyInfo
{
#if !defined(AMF_PROPERTYINFO_USE_VIRTUAL_DESTRUCTOR) || !defined(__cplusplus)
void* reserved;
#endif
const wchar_t* name;
const wchar_t* desc;
AMF_VARIANT_TYPE type;
AMF_PROPERTY_CONTENT_TYPE contentType;
AMFVariantStruct defaultValue;
AMFVariantStruct minValue;
AMFVariantStruct maxValue;
AMF_PROPERTY_ACCESS_TYPE accessType;
const AMFEnumDescriptionEntry* pEnumDescription;
#if defined(__cplusplus)
AMFPropertyInfo() :
#if !defined(AMF_PROPERTYINFO_USE_VIRTUAL_DESTRUCTOR)
reserved(nullptr),
#endif
name(nullptr),
desc(nullptr),
type(),
contentType(),
defaultValue(),
minValue(),
maxValue(),
accessType(AMF_PROPERTY_ACCESS_FULL),
pEnumDescription(nullptr)
{}
#if defined(AMF_PROPERTYINFO_USE_VIRTUAL_DESTRUCTOR)
AMFPropertyInfo(const AMFPropertyInfo& property) = default;
AMFPropertyInfo& operator=(const AMFPropertyInfo& property) = default;
virtual ~AMFPropertyInfo(){}
#endif
amf_bool AMF_STD_CALL AllowedRead() const
{
return (accessType & AMF_PROPERTY_ACCESS_READ) != 0;
}
amf_bool AMF_STD_CALL AllowedWrite() const
{
return (accessType & AMF_PROPERTY_ACCESS_WRITE) != 0;
}
amf_bool AMF_STD_CALL AllowedChangeInRuntime() const
{
return (accessType & AMF_PROPERTY_ACCESS_WRITE_RUNTIME) != 0;
}
#endif } AMFPropertyInfo;
#if defined(__cplusplus)
class AMF_NO_VTABLE AMFPropertyStorageEx : public AMFPropertyStorage
{
public:
AMF_DECLARE_IID(0x16b8958d, 0xe943, 0x4a33, 0xa3, 0x5a, 0x88, 0x5a, 0xd8, 0x28, 0xf2, 0x67)
virtual amf_size AMF_STD_CALL GetPropertiesInfoCount() const = 0;
#if defined(_MSC_VER) || !defined(_WIN32)
virtual AMF_RESULT AMF_STD_CALL GetPropertyInfo(amf_size index, const AMFPropertyInfo** ppInfo) const = 0;
virtual AMF_RESULT AMF_STD_CALL GetPropertyInfo(const wchar_t* name, const AMFPropertyInfo** ppInfo) const = 0;
#else
virtual AMF_RESULT AMF_STD_CALL GetPropertyInfo(const wchar_t* name, const AMFPropertyInfo** ppInfo) const = 0;
virtual AMF_RESULT AMF_STD_CALL GetPropertyInfo(amf_size index, const AMFPropertyInfo** ppInfo) const = 0;
#endif
virtual AMF_RESULT AMF_STD_CALL ValidateProperty(const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated) const = 0;
};
typedef AMFInterfacePtr_T<AMFPropertyStorageEx> AMFPropertyStorageExPtr;
#else
AMF_DECLARE_IID(AMFPropertyStorageEx, 0x16b8958d, 0xe943, 0x4a33, 0xa3, 0x5a, 0x88, 0x5a, 0xd8, 0x28, 0xf2, 0x67)
typedef struct AMFPropertyStorageEx AMFPropertyStorageEx;
typedef struct AMFPropertyStorageExVtbl
{
amf_long (AMF_STD_CALL *Acquire)(AMFPropertyStorageEx* pThis);
amf_long (AMF_STD_CALL *Release)(AMFPropertyStorageEx* pThis);
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFPropertyStorageEx* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFPropertyStorageEx* pThis, const wchar_t* name, AMFVariantStruct value);
AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFPropertyStorageEx* pThis, const wchar_t* name, AMFVariantStruct* pValue);
amf_bool (AMF_STD_CALL *HasProperty)(AMFPropertyStorageEx* pThis, const wchar_t* name);
amf_size (AMF_STD_CALL *GetPropertyCount)(AMFPropertyStorageEx* pThis);
AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFPropertyStorageEx* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
AMF_RESULT (AMF_STD_CALL *Clear)(AMFPropertyStorageEx* pThis);
AMF_RESULT (AMF_STD_CALL *AddTo)(AMFPropertyStorageEx* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFPropertyStorageEx* pThis, AMFPropertyStorage* pDest, amf_bool deep);
void (AMF_STD_CALL *AddObserver)(AMFPropertyStorageEx* pThis, AMFPropertyStorageObserver* pObserver);
void (AMF_STD_CALL *RemoveObserver)(AMFPropertyStorageEx* pThis, AMFPropertyStorageObserver* pObserver);
amf_size (AMF_STD_CALL *GetPropertiesInfoCount)(AMFPropertyStorageEx* pThis);
#if defined(_WIN32)
AMF_RESULT (AMF_STD_CALL *GetPropertyInfo)(AMFPropertyStorageEx* pThis, const wchar_t* name, const AMFPropertyInfo** ppInfo);
AMF_RESULT (AMF_STD_CALL *GetPropertyInfoAt)(AMFPropertyStorageEx* pThis, amf_size index, const AMFPropertyInfo** ppInfo);
#else
AMF_RESULT (AMF_STD_CALL *GetPropertyInfoAt)(AMFPropertyStorageEx* pThis, amf_size index, const AMFPropertyInfo** ppInfo);
AMF_RESULT (AMF_STD_CALL *GetPropertyInfo)(AMFPropertyStorageEx* pThis, const wchar_t* name, const AMFPropertyInfo** ppInfo);
#endif
AMF_RESULT (AMF_STD_CALL *ValidateProperty)(AMFPropertyStorageEx* pThis, const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated);
} AMFPropertyStorageExVtbl;
struct AMFPropertyStorageEx
{
const AMFPropertyStorageExVtbl *pVtbl;
};
#endif #if defined(__cplusplus)
} #endif
#endif