File: test.cpp

package info (click to toggle)
libvpl 1%3A2.15.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,584 kB
  • sloc: cpp: 92,593; ansic: 6,143; python: 4,312; sh: 323; makefile: 7
file content (106 lines) | stat: -rw-r--r-- 2,927 bytes parent folder | download | duplicates (2)
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
/*############################################################################
  # Copyright (C) 2020 Intel Corporation
  #
  # SPDX-License-Identifier: MIT
  ############################################################################*/

#if defined(_WIN32) || defined(_WIN64)
#include <windows.h>
#endif

#include <stddef.h>

// force packing to 1 byte, which is never used by any real struct in our
// headers the definition of each structure should include setting the desired
// pack value (push) then immediately restoring the original value (pop)
#if defined(_WIN32) || defined(_WIN64)
__pragma(pack(push, 1))
#else
_Pragma("pack(push, 1)")
#endif

typedef struct {
    char a;
    int b;
} PackStart;

static_assert(offsetof(PackStart, a) == 0, "Error - offset of PackStart.a should be 0");
static_assert(offsetof(PackStart, b) == 1, "Error - offset of PackStart.b should be 1");

#include "./removed_api.h"

#include "./mfxvideo++.h"

#include "sdk_headers.inc"

// if every pack(push) was paired with exactly one pack(pop), then
//   packing should again be 1 byte at this point
typedef struct {
    char a;
    int b;
} PackEnd;

// if this test fails at build time, check that every struct definition is wrapped
//   with both MFX_PACK_BEGIN_XXX() and MFX_PACK_END()
static_assert(offsetof(PackEnd, a) == 0, "Error - offset of PackEnd.a should be 0");
static_assert(offsetof(PackEnd, b) == 1, "Error - offset of PackEnd.b should be 1");

#if defined(_WIN32) || defined(_WIN64)
__pragma(pack(pop))
#else
_Pragma("pack(pop)")
#endif

/* Stubs */

#define UNUSED_PARAM(x) (void)(x)

mfxLoader MFX_CDECL MFXLoad()
{
    return (mfxLoader)1;
}

mfxConfig MFX_CDECL MFXCreateConfig(mfxLoader loader)
{
    UNUSED_PARAM(loader);
    return (mfxConfig)2;
}

mfxStatus MFX_CDECL MFXSetConfigFilterProperty(mfxConfig config, const mfxU8* name, mfxVariant value)
{
    UNUSED_PARAM(config);
    UNUSED_PARAM(name);
    UNUSED_PARAM(value);
    return MFX_ERR_NONE;
}

int main()
{
    /* Checkout dispatcher's macroses*/
    mfxLoader loader = nullptr;

    MFX_ADD_PROPERTY_U32(loader, "mfxImplDescription.mfxVPPDescription.filter.FilterFourCC", 1)
    MFX_ADD_PROPERTY_PTR(loader, "mfxImplDescription.mfxVPPDescription.filter.FilterFourCC", "something_amazing")
    MFX_ADD_PROPERTY_U16(loader, "mfxImplDescription.Impl", MFX_IMPL_TYPE_SOFTWARE)

    {
      mfxConfig cfg = nullptr;

      MFX_UPDATE_PROPERTY_U16(loader, cfg, "mfxImplDescription.Impl", MFX_IMPL_TYPE_SOFTWARE)
      MFX_UPDATE_PROPERTY_U32(loader, cfg, "mfxImplDescription.Impl", MFX_IMPL_TYPE_SOFTWARE)
      MFX_UPDATE_PROPERTY_PTR(loader, cfg, "mfxImplDescription.Impl", "just a string")
    }

#ifdef ONEVPL_EXPERIMENTAL
  {
    mfxExtendedDeviceId *devinfo = nullptr;
    mfxU8* uuid = nullptr;
    mfxU8 sub_device_id = 0;
    MFX_UUID_COMPUTE_DEVICE_ID(devinfo, sub_device_id, uuid)
  }
#endif

    return 0;
}

#pragma message ("end of CPP test")