diff options
Diffstat (limited to 'mfx_stub/include')
-rw-r--r-- | mfx_stub/include/mfxcommon.h | 46 | ||||
-rw-r--r-- | mfx_stub/include/mfxdefs.h | 49 | ||||
-rw-r--r-- | mfx_stub/include/mfxsession.h | 27 | ||||
-rw-r--r-- | mfx_stub/include/mfxstructures.h | 90 | ||||
-rw-r--r-- | mfx_stub/include/mfxvideo.h | 48 |
5 files changed, 260 insertions, 0 deletions
diff --git a/mfx_stub/include/mfxcommon.h b/mfx_stub/include/mfxcommon.h new file mode 100644 index 0000000..f4b1e26 --- /dev/null +++ b/mfx_stub/include/mfxcommon.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2024 Mikhail Burakov. This file is part of receiver. + * + * receiver is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * receiver is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with receiver. If not, see <https://www.gnu.org/licenses/>. + */ + +#ifndef MFX_STUB_INCLUDE_MFXCOMMON_H_ +#define MFX_STUB_INCLUDE_MFXCOMMON_H_ + +#include "mfxdefs.h" + +#define MFX_MAKEFOURCC(a, b, c, d) \ + (((a) << 24 & 0xff000000) | ((b) << 16 & 0x00ff0000) | \ + ((c) << 8 & 0x0000ff00) | ((d) << 0 & 0x000000ff)) + +typedef mfxI32 mfxIMPL; + +enum { + MFX_IMPL_HARDWARE = 0x0002, +}; + +typedef union mfxVersion mfxVersion; + +typedef struct { + mfxI64 DecodeTimeStamp; + mfxU64 TimeStamp; + mfxU8* Data; + mfxU32 DataLength; + mfxU32 MaxLength; + mfxU16 DataFlag; +} mfxBitstream; + +typedef struct _mfxSyncPoint* mfxSyncPoint; + +#endif // MFX_STUB_INCLUDE_MFXCOMMON_H_ diff --git a/mfx_stub/include/mfxdefs.h b/mfx_stub/include/mfxdefs.h new file mode 100644 index 0000000..4589513 --- /dev/null +++ b/mfx_stub/include/mfxdefs.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 Mikhail Burakov. This file is part of receiver. + * + * receiver is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * receiver is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with receiver. If not, see <https://www.gnu.org/licenses/>. + */ + +#ifndef MFX_STUB_INCLUDE_MFXDEFS_H_ +#define MFX_STUB_INCLUDE_MFXDEFS_H_ + +#include <stdint.h> + +#define MFX_INFINITE 0xffffffff + +typedef uint8_t mfxU8; +typedef int8_t mfxI8; +typedef int16_t mfxI16; +typedef uint16_t mfxU16; +typedef uint32_t mfxU32; +typedef int32_t mfxI32; +typedef uint64_t mfxU64; +typedef int64_t mfxI64; +typedef void* mfxHDL; +typedef mfxHDL mfxMemId; + +typedef enum { + MFX_ERR_NONE = 0, + MFX_ERR_UNSUPPORTED = -3, + MFX_ERR_MEMORY_ALLOC = -4, + MFX_ERR_MORE_DATA = -10, + MFX_ERR_MORE_SURFACE = -11, + MFX_ERR_DEVICE_FAILED = -17, + MFX_ERR_REALLOC_SURFACE = -22, + MFX_WRN_DEVICE_BUSY = 2, + MFX_WRN_VIDEO_PARAM_CHANGED = 3, + MFX_ERR_NONE_PARTIAL_OUTPUT = 12, +} mfxStatus; + +#endif // MFX_STUB_INCLUDE_MFXDEFS_H_ diff --git a/mfx_stub/include/mfxsession.h b/mfx_stub/include/mfxsession.h new file mode 100644 index 0000000..d39a6ac --- /dev/null +++ b/mfx_stub/include/mfxsession.h @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2024 Mikhail Burakov. This file is part of receiver. + * + * receiver is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * receiver is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with receiver. If not, see <https://www.gnu.org/licenses/>. + */ + +#ifndef MFX_STUB_INCLUDE_MFXSESSION_H_ +#define MFX_STUB_INCLUDE_MFXSESSION_H_ + +#include "mfxcommon.h" + +typedef struct _mfxSession* mfxSession; +mfxStatus MFXInit(mfxIMPL impl, mfxVersion* ver, mfxSession* session); +mfxStatus MFXClose(mfxSession session); + +#endif // MFX_STUB_INCLUDE_MFXSESSION_H_ diff --git a/mfx_stub/include/mfxstructures.h b/mfx_stub/include/mfxstructures.h new file mode 100644 index 0000000..64353c4 --- /dev/null +++ b/mfx_stub/include/mfxstructures.h @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2024 Mikhail Burakov. This file is part of receiver. + * + * receiver is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * receiver is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with receiver. If not, see <https://www.gnu.org/licenses/>. + */ + +#ifndef MFX_STUB_INCLUDE_MFXSTRUCTURES_H_ +#define MFX_STUB_INCLUDE_MFXSTRUCTURES_H_ + +#include "mfxcommon.h" + +typedef struct { + mfxU32 FourCC; + mfxU16 Width; + mfxU16 Height; + mfxU16 CropX; + mfxU16 CropY; + mfxU16 CropW; + mfxU16 CropH; + mfxU16 ChromaFormat; +} mfxFrameInfo; + +enum { + MFX_FOURCC_NV12 = MFX_MAKEFOURCC('N', 'V', '1', '2'), +}; + +enum { + MFX_CHROMAFORMAT_YUV420 = 1, +}; + +enum { + MFX_TIMESTAMP_UNKNOWN = -1, +}; + +typedef struct { + mfxFrameInfo Info; + struct { + mfxMemId MemId; + } Data; +} mfxFrameSurface1; + +typedef struct { + mfxU16 AsyncDepth; + struct { + mfxU32 CodecId; + mfxU16 DecodedOrder; + } mfx; + mfxU16 IOPattern; +} mfxVideoParam; + +enum { + MFX_IOPATTERN_OUT_VIDEO_MEMORY = 0x10, +}; + +enum { + MFX_CODEC_HEVC = MFX_MAKEFOURCC('H', 'E', 'V', 'C'), +}; + +enum { + MFX_BITSTREAM_COMPLETE_FRAME = 0x0001, +}; + +typedef struct { + mfxU32 AllocId; + mfxU16 NumFrameSuggested; + mfxFrameInfo Info; +} mfxFrameAllocRequest; + +typedef struct { + mfxU32 AllocId; + mfxMemId* mids; + mfxU16 NumFrameActual; +} mfxFrameAllocResponse; + +typedef enum { + MFX_HANDLE_VA_DISPLAY = 4, +} mfxHandleType; + +#endif // MFX_STUB_INCLUDE_MFXSTRUCTURES_H_ diff --git a/mfx_stub/include/mfxvideo.h b/mfx_stub/include/mfxvideo.h new file mode 100644 index 0000000..dec1789 --- /dev/null +++ b/mfx_stub/include/mfxvideo.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2024 Mikhail Burakov. This file is part of receiver. + * + * receiver is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * receiver is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with receiver. If not, see <https://www.gnu.org/licenses/>. + */ + +#ifndef MFX_STUB_INCLUDE_MFXVIDEO_H_ +#define MFX_STUB_INCLUDE_MFXVIDEO_H_ + +#include "mfxsession.h" +#include "mfxstructures.h" + +typedef struct { + mfxHDL pthis; + mfxStatus (*Alloc)(mfxHDL, mfxFrameAllocRequest*, mfxFrameAllocResponse*); + mfxStatus (*GetHDL)(mfxHDL, mfxMemId, mfxHDL*); + mfxStatus (*Free)(mfxHDL, mfxFrameAllocResponse*); +} mfxFrameAllocator; + +mfxStatus MFXVideoCORE_SetFrameAllocator(mfxSession session, + mfxFrameAllocator* allocator); +mfxStatus MFXVideoCORE_SetHandle(mfxSession session, mfxHandleType type, + mfxHDL hdl); +mfxStatus MFXVideoCORE_SyncOperation(mfxSession session, mfxSyncPoint syncp, + mfxU32 wait); + +mfxStatus MFXVideoDECODE_Query(mfxSession session, mfxVideoParam* in, + mfxVideoParam* out); +mfxStatus MFXVideoDECODE_DecodeHeader(mfxSession session, mfxBitstream* bs, + mfxVideoParam* par); +mfxStatus MFXVideoDECODE_Init(mfxSession session, mfxVideoParam* par); +mfxStatus MFXVideoDECODE_DecodeFrameAsync(mfxSession session, mfxBitstream* bs, + mfxFrameSurface1* surface_work, + mfxFrameSurface1** surface_out, + mfxSyncPoint* syncp); + +#endif // MFX_STUB_INCLUDE_MFXVIDEO_H_ |