Skip to content

Create an endpoint to view basic video info eg canvas size#319

Merged
Palakis merged 6 commits into
obsproject:4.x-currentfrom
Rosuav:video-info
May 10, 2019
Merged

Create an endpoint to view basic video info eg canvas size#319
Palakis merged 6 commits into
obsproject:4.x-currentfrom
Rosuav:video-info

Conversation

@Rosuav
Copy link
Copy Markdown
Contributor

@Rosuav Rosuav commented May 8, 2019

I'm not sure that this is the best way to do it, nor if it's the best place to put this code. But it's a start.

Implements #296.

Copy link
Copy Markdown
Contributor

@Palakis Palakis left a comment

Choose a reason for hiding this comment

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

Thanks for this! Needs some changes before it's good to merge.

Comment thread src/WSRequestHandler_General.cpp Outdated
Comment thread src/WSRequestHandler_General.cpp Outdated
Comment thread src/WSRequestHandler_General.cpp
Comment thread src/WSRequestHandler_General.cpp Outdated
Comment thread src/WSRequestHandler_General.cpp
Rosuav added 2 commits May 10, 2019 04:08
* Switch to camelCase for output properties
* Remove done TODO
* Properly document all of the information returned
@Rosuav
Copy link
Copy Markdown
Contributor Author

Rosuav commented May 9, 2019

Adjusted per comments/recommendations.

I'm not sure what the difference is between "Number" and "double" in the documentation. It appears that integers use "Number" but doubles use "double"? But sometimes integers use "int". The JSON data type is the same for all of them anyway.

Couldn't find a good example of rendering an enumerated value, so I went with a simple switch statement (with a fallback to integer in case new options get added to OBS).

@Palakis
Copy link
Copy Markdown
Contributor

Palakis commented May 10, 2019

@Rosuav Thanks, gonna review this.

Couldn't find a good example of rendering an enumerated value, so I went with a simple switch statement

I do this as well in several places of the source code so it's good as-is.

@Palakis
Copy link
Copy Markdown
Contributor

Palakis commented May 10, 2019

@Rosuav

I'm not sure what the difference is between "Number" and "double" in the documentation. It appears that integers use "Number" but doubles use "double"? But sometimes integers use "int". The JSON data type is the same for all of them anyway.

Integers should use int and floats/doubles use double in the docs, because it's the two number types supported by obs_data_t. Gonna remove uses of Number everywhere else because they're too ambiguous.

@Rosuav
Copy link
Copy Markdown
Contributor Author

Rosuav commented May 10, 2019

Perfect, that answers that question. Going with int then.

Copy link
Copy Markdown
Contributor

@Palakis Palakis left a comment

Choose a reason for hiding this comment

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

Works perfectly and is almost good to merge. Just some minor code structure changes to make.

Comment thread src/WSRequestHandler_General.cpp Outdated
Comment thread src/WSRequestHandler_General.cpp Outdated
obs_data_set_double(response, "fps", (double)ovi.fps_num / ovi.fps_den);

switch (ovi.output_format) {
#define CASE(x) case x: obs_data_set_string(response, "videoFormat", #x); break;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good idea!

@Palakis Palakis added this to the 4.6 milestone May 10, 2019
@Palakis Palakis merged commit f815228 into obsproject:4.x-current May 10, 2019
@Rosuav
Copy link
Copy Markdown
Contributor Author

Rosuav commented May 10, 2019

Awesome! Thank you!

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