0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 13:08:50 +02:00
obs-studio/plugins/obs-qsv11/common_directx9.h
Aidan Delaney 134ffe924f obs-qsv11: Remove Intel NDA from qsv11 plugin
Intel committed an NDA disclaimer on each source file.  The stated
intention was that the NDA "added to OBS doesn't apply to open source
code once it's been accepted by the community. You can remove it for
your modifications".  This quote is from an email chain involving
Intel's legal team and developers.  The NDA in the source files
mistakenly triggers source code scanners that look for license
violations.  I have removed the comments that contain the NDA.
2021-10-24 00:39:09 -07:00

59 lines
1.5 KiB
C++

#pragma once
#include "common_utils.h"
#include <initguid.h>
#include <d3d9.h>
#include <dxva2api.h>
#include <dxva.h>
#include <windows.h>
#define VIDEO_MAIN_FORMAT D3DFMT_YUY2
class IGFXS3DControl;
/** Direct3D 9 device implementation.
@note Can be initialized for only 1 or two 2 views. Handle to
MFX_HANDLE_GFXS3DCONTROL must be set prior if initializing for 2 views.
@note Device always set D3DPRESENT_PARAMETERS::Windowed to TRUE.
*/
template<class T> class safe_array {
public:
safe_array(T *ptr = 0)
: m_ptr(ptr){
// construct from object pointer
};
~safe_array() { reset(0); }
T *get()
{ // return wrapped pointer
return m_ptr;
}
T *release()
{ // return wrapped pointer and give up ownership
T *ptr = m_ptr;
m_ptr = 0;
return ptr;
}
void reset(T *ptr)
{ // destroy designated object and store new pointer
if (m_ptr) {
delete[] m_ptr;
}
m_ptr = ptr;
}
protected:
T *m_ptr; // the wrapped object pointer
};
mfxStatus dx9_simple_alloc(mfxHDL pthis, mfxFrameAllocRequest *request,
mfxFrameAllocResponse *response);
mfxStatus dx9_simple_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr);
mfxStatus dx9_simple_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr);
mfxStatus dx9_simple_gethdl(mfxHDL pthis, mfxMemId mid, mfxHDL *handle);
mfxStatus dx9_simple_free(mfxHDL pthis, mfxFrameAllocResponse *response);
mfxStatus DX9_CreateHWDevice(mfxSession session, mfxHDL *deviceHandle,
HWND hWnd, bool bCreateSharedHandles);
void DX9_CleanupHWDevice();