Skip to content

Add support for CameraControl and VideoProcAmp properties - #37

Merged
jp9000 merged 1 commit into
obsproject:masterfrom
exeldro:video_device_properties
Jun 15, 2022
Merged

jp9000 merged 1 commit into
obsproject:masterfrom
exeldro:video_device_properties

Conversation

@exeldro

@exeldro exeldro commented Nov 2, 2021

Copy link
Copy Markdown
Contributor

Description

Motivation and Context

Allow to load and save camera device properties

How Has This Been Tested?

with an option to save the properties on the video capture device "dshow_input" source

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

Comment thread source/device.cpp Resolved
Comment thread source/device.cpp Resolved
Comment thread source/device.cpp Resolved
Comment thread source/device.cpp Resolved
@jp9000

jp9000 commented Nov 2, 2021

Copy link
Copy Markdown
Member

Minor nitpick, if you're using C++ you want to use nullptr instead of NULL. Also you want to avoid using raw pointers for COM objects. Always try to use ComPtr and/or ComQIPtr.

@exeldro

exeldro commented Nov 3, 2021

Copy link
Copy Markdown
Contributor Author

I used NULL instead of nullptr because that matches other code in the same file, now only replaced it in the code that is added by this PR.
I have no experience with ComPtr and/or ComQIPtr, so I hope I have used it correctly now.

@jp9000

jp9000 commented Nov 25, 2021 •

Copy link
Copy Markdown
Member

One more small suggestion:

You can change these sort of lines

	ComPtr<IAMCameraControl> pCameraControl = nullptr;
	auto hr = videoFilter->QueryInterface(IID_IAMCameraControl,
					      (void **)&pCameraControl);
	if (FAILED(hr) || pCameraControl == nullptr)
		return false;

to this:

	ComQIPtr<IAMCameraControl> pCameraControl = videoFilter;
	if (!pCameraControl)
		return false;

The ComQIPtr helper class will automatically call QueryInterface for you. It's pretty nice and clean. I'd recommend changing all those cases calling QueryInterface to this instead. Should clean up the code a bit more.

@exeldro
exeldro force-pushed the video_device_properties branch from a2fa630 to c504452 Compare November 27, 2021 17:59
@exeldro
exeldro force-pushed the video_device_properties branch from c504452 to 5391c41 Compare January 2, 2022 07:49
@exeldro
exeldro force-pushed the video_device_properties branch from 5391c41 to 85601a2 Compare February 23, 2022 12:39
@exeldro
exeldro force-pushed the video_device_properties branch from 85601a2 to 3dbd693 Compare May 29, 2022 05:49
@jp9000
jp9000 force-pushed the video_device_properties branch from 3dbd693 to f9ab110 Compare June 15, 2022 07:39
@jp9000
jp9000 merged commit 8f2ef91 into obsproject:master Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants