Skip to content
This repository was archived by the owner on Oct 7, 2024. It is now read-only.
This repository was archived by the owner on Oct 7, 2024. It is now read-only.

How to create and initialize a Direct3D Device #11

@1170300710

Description

@1170300710

Sorry my english is not good.
My python version is 3.7.3, system is windows10.
I am try to record the screen.
I have already get the item by using "pick_single_item_async", and then I want to create a frame pool by "Direct3D11CaptureFramePool.create_free_threaded", but I don't know how to get the first argument whose type is IDirect3DDevice.

I find a way to get a D3D device by MediaCapture, and I can create a frame pool:

        media_capture = MediaCapture()

        async def coroutine():
            async_action = media_capture.initialize_async()
            if async_action:
                await async_action
        asyncio.run(coroutine())

        if not media_capture.media_capture_settings:
            raise OSError("Unable to initialize a Direct3D Device.")
        self.frame_pool = Direct3D11CaptureFramePool.create_free_threaded(
            media_capture.media_capture_settings.direct3_d11_device,
            DirectXPixelFormat.B8_G8_R8_A8_UINT_NORMALIZED,
            1,
            self.item.size
        )

but I got an error in line "await async_action":

OSError: [WinError -1072845856] No capture devices are available.

what should I do to create a frame pool.
Thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions