Add support for CameraControl and VideoProcAmp properties #37

Merged
exeldro merged 1 commit from video_device_properties into master 2022-06-15 02:45:17 -05:00
exeldro commented 2021-11-02 15:41:37 -05:00 (Migrated from github.com)

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.
### 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: - [x] My code has been run through [clang-format](https://github.com/obsproject/obs-studio/blob/master/.clang-format). - [x] I have read the [**contributing** document](https://github.com/obsproject/obs-studio/blob/master/CONTRIBUTING.rst). - [x] My code is not on the master branch. - [x] The code has been tested. - [x] All commit messages are properly formatted and commits squashed where appropriate. - [x] I have included updates to all appropriate documentation.
notr1ch (Migrated from github.com) reviewed 2021-11-02 16:06:26 -05:00
notr1ch (Migrated from github.com) commented 2021-11-02 16:04:51 -05:00

If pCameraControl could be null, the null check should happen earlier since it is dereferenced before the null check.

If `pCameraControl` could be null, the null check should happen earlier since it is dereferenced before the null check.
notr1ch (Migrated from github.com) commented 2021-11-02 16:05:15 -05:00

Same null check after dereference issue.

Same null check after dereference issue.
notr1ch (Migrated from github.com) commented 2021-11-02 16:05:26 -05:00

Same null check after dereference issue.

Same null check after dereference issue.
notr1ch (Migrated from github.com) commented 2021-11-02 16:05:32 -05:00

Same null check after dereference issue.

Same null check after dereference issue.
jp9000 commented 2021-11-02 16:12:16 -05:00 (Migrated from github.com)

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.

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 commented 2021-11-03 01:24:47 -05:00 (Migrated from github.com)

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.

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 commented 2021-11-25 14:09:49 -06:00 (Migrated from github.com)

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.

One more small suggestion: You can change these sort of lines ```cpp ComPtr<IAMCameraControl> pCameraControl = nullptr; auto hr = videoFilter->QueryInterface(IID_IAMCameraControl, (void **)&pCameraControl); if (FAILED(hr) || pCameraControl == nullptr) return false; ``` to this: ```cpp 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.
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-obsproject/libdshowcapture!37
No description provided.