Skip to content

Conversation

@exeldro
Copy link
Contributor

@exeldro exeldro commented May 9, 2023

  • removed OBS_PROPERTIES_DEFER_UPDATE to update the camera as soon as property is changed
  • add check if ndi_name or bandwidth changed to recreate ndi_receiver
  • hide source in audio mixer when no audio is selected
  • add checkable ptz group to properties to control the pan tilt and zoom with sliders
    image

@paulpv paulpv self-requested a review October 30, 2023 15:59
@paulpv paulpv self-assigned this Oct 30, 2023
@paulpv
Copy link
Member

paulpv commented Oct 30, 2023

@exeldro I can't explain how I didn't see this before.
I'll give it a review.
Are there any updates you have since May?
Does this require the NDI Advanced SDK?

@paulpv paulpv requested review from Palakis and tt2468 October 30, 2023 16:07
@exeldro
Copy link
Contributor Author

exeldro commented Oct 30, 2023

@paulpv after this I added hotkeys, see:
master...exeldro:obs-ndi:develop
I am not sure about NDI Advanced SDK, as far as I know I used the default SDK

Copy link
Member

@paulpv paulpv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still looking through the other charges...

{
if (!obs_data_get_bool(settings, PROP_PTZ))
return;
float pan = (float)obs_data_get_double(settings, PROP_PAN);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be any range checks here?
Will NDI ptz accept bad values and not bork?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the min and max are set in the properties, but we can add an extra check here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do

float pan = (float)obs_data_get_double(settings, PROP_PAN);
float tilt = (float)obs_data_get_double(settings, PROP_TILT);
ndiLib->recv_ptz_pan_tilt(s->ndi_receiver, pan, tilt);
float zoom = (float)obs_data_get_double(settings, PROP_ZOOM);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be any range checks here?
Will NDI ptz accept bad values and not bork?


void ndi_source_ptz(struct ndi_source *s, obs_data_t *settings)
{
if (!obs_data_get_bool(settings, PROP_PTZ))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the code also test for recv_ptz_is_supported?

@paulpv
Copy link
Member

paulpv commented Oct 30, 2023

I am not sure about NDI Advanced SDK, as far as I know I used the default SDK

Sorry, acronymnesia: I was confusing Advanced KVM ability with Standard PTZ ability.

Copy link
Member

@paulpv paulpv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great.
I made a few changes in the develop branch obs-ndi-source.cpp, so I'll take care of porting your changes from master to develop after I merge your master based changes to master.

obs_properties_add_bool(props, PROP_AUDIO,
obs_module_text("NDIPlugin.SourceProps.Audio"));

obs_properties_t *group = obs_properties_create();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename this to group_ptz

{
if (!obs_data_get_bool(settings, PROP_PTZ))
return;
float pan = (float)obs_data_get_double(settings, PROP_PAN);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do

hwAccelMetadata.p_data =
hwAccelEnabled
? (char *)"<ndi_hwaccel enabled=\"true\"/>"
: (char *)"<ndi_hwaccel enabled=\"false\"/>";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noice!

ndiLib->recv_destroy(s->ndi_receiver);

NDIlib_recv_create_v3_t recv_desc;
recv_desc.source_to_connect_to.p_ndi_name = ndi_name;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good

@paulpv paulpv merged commit de5dcaa into DistroAV:master Nov 8, 2023
@paulpv
Copy link
Member

paulpv commented Nov 8, 2023

@exeldro Did you see any actual benefit to only reinitiating the ndi_receiver if the name, bandwidth, or hwacceleration changed?

The old code always reinitialized the ndi_receiver, and I am thinking of moving back to that unless you had an obviously good reason in your code.

@exeldro
Copy link
Contributor Author

exeldro commented Nov 8, 2023

@paulpv reinitiating the ndi_receiver is visible in the output, so if the user wants to do live changes viewers will see interruptions

@paulpv
Copy link
Member

paulpv commented Nov 8, 2023

@paulpv reinitiating the ndi_receiver is visible in the output, so if the user wants to do live changes viewers will see interruptions

Shouldn't almost all of these options result in the preview resetting?
image

Do you think that only name, bandwidth, and hwaccel are the only properties that should reset the preview?

@paulpv
Copy link
Member

paulpv commented Nov 8, 2023

OH! I see how that could be a big issue with the PTZ preview!
Gotcha!
Maybe I'll tweak/invert the logic to not re-init the receiver if the change is just PTZ?

@exeldro
Copy link
Contributor Author

exeldro commented Nov 8, 2023

hwaccel does not need to reset because recv_send_metadata can be used to change that live and all options after that only change things local in obs so no need to reset the ndi reciever for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants