Merge pull request #551 from Palakis/fix/mediafixes

Requests/Events: Use sourceKind instead of sourceTypeId
This commit is contained in:
Stéphane Lepin 2020-07-03 16:22:20 +02:00 committed by GitHub
commit 471d44ae11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 12 deletions

View File

@ -434,7 +434,7 @@ OBSDataAutoRelease getMediaSourceData(calldata_t* data) {
OBSSource source = calldata_get_pointer<obs_source_t>(data, "source");
obs_data_set_string(fields, "sourceName", obs_source_get_name(source));
obs_data_set_string(fields, "sourceTypeId", obs_source_get_id(source));
obs_data_set_string(fields, "sourceKind", obs_source_get_id(source));
return fields;
}
@ -1422,7 +1422,7 @@ void WSEvents::OnSourceFilterOrderChanged(void* param, calldata_t* data) {
* Note: This event is only emitted when something actively controls the media/VLC source. In other words, the source will never emit this on its own naturally.
*
* @return {String} `sourceName` Source name
* @return {String} `sourceTypeId` The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
* @return {String} `sourceKind` The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
*
* @api events
* @name MediaPlaying
@ -1443,7 +1443,7 @@ void WSEvents::OnMediaPlaying(void* param, calldata_t* data) {
* Note: This event is only emitted when something actively controls the media/VLC source. In other words, the source will never emit this on its own naturally.
*
* @return {String} `sourceName` Source name
* @return {String} `sourceTypeId` The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
* @return {String} `sourceKind` The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
*
* @api events
* @name MediaPaused
@ -1464,7 +1464,7 @@ void WSEvents::OnMediaPaused(void* param, calldata_t* data) {
* Note: This event is only emitted when something actively controls the media/VLC source. In other words, the source will never emit this on its own naturally.
*
* @return {String} `sourceName` Source name
* @return {String} `sourceTypeId` The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
* @return {String} `sourceKind` The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
*
* @api events
* @name MediaRestarted
@ -1485,7 +1485,7 @@ void WSEvents::OnMediaRestarted(void* param, calldata_t* data) {
* Note: This event is only emitted when something actively controls the media/VLC source. In other words, the source will never emit this on its own naturally.
*
* @return {String} `sourceName` Source name
* @return {String} `sourceTypeId` The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
* @return {String} `sourceKind` The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
*
* @api events
* @name MediaStopped
@ -1506,7 +1506,7 @@ void WSEvents::OnMediaStopped(void* param, calldata_t* data) {
* Note: This event is only emitted when something actively controls the media/VLC source. In other words, the source will never emit this on its own naturally.
*
* @return {String} `sourceName` Source name
* @return {String} `sourceTypeId` The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
* @return {String} `sourceKind` The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
*
* @api events
* @name MediaNext
@ -1527,7 +1527,7 @@ void WSEvents::OnMediaNext(void* param, calldata_t* data) {
* Note: This event is only emitted when something actively controls the media/VLC source. In other words, the source will never emit this on its own naturally.
*
* @return {String} `sourceName` Source name
* @return {String} `sourceTypeId` The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
* @return {String} `sourceKind` The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
*
* @api events
* @name MediaPrevious
@ -1548,7 +1548,7 @@ void WSEvents::OnMediaPrevious(void* param, calldata_t* data) {
* Note: These events are emitted by the OBS sources themselves. For example when the media file starts playing. The behavior depends on the type of media source being used.
*
* @return {String} `sourceName` Source name
* @return {String} `sourceTypeId` The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
* @return {String} `sourceKind` The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
*
* @api events
* @name MediaStarted
@ -1569,7 +1569,7 @@ void WSEvents::OnMediaStarted(void* param, calldata_t* data) {
* Note: These events are emitted by the OBS sources themselves. For example when the media file ends. The behavior depends on the type of media source being used.
*
* @return {String} `sourceName` Source name
* @return {String} `sourceTypeId` The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
* @return {String} `sourceKind` The ID type of the source (Eg. `vlc_source` or `ffmpeg_source`)
*
* @api events
* @name MediaEnded

View File

@ -375,11 +375,11 @@ RpcResponse WSRequestHandler::GetMediaSourcesList(const RpcRequest& request)
auto sourceEnumProc = [](void* privateData, obs_source_t* source) -> bool {
obs_data_array_t* sourcesArray = (obs_data_array_t*)privateData;
QString sourceTypeId = obs_source_get_id(source);
if (isMediaSource(sourceTypeId)) {
QString sourceKind = obs_source_get_id(source);
if (isMediaSource(sourceKind)) {
OBSDataAutoRelease sourceData = obs_data_create();
obs_data_set_string(sourceData, "sourceName", obs_source_get_name(source));
obs_data_set_string(sourceData, "sourceKind", sourceTypeId.toUtf8());
obs_data_set_string(sourceData, "sourceKind", sourceKind.toUtf8());
QString mediaState = getSourceMediaState(source);
obs_data_set_string(sourceData, "mediaState", mediaState.toUtf8());