win-dshow: Add support for devices that relay rotation
Adds support for devices that can relay rotation, such as the Logitech StreamCam.
This commit is contained in:
@@ -191,6 +191,7 @@ struct DShowInput {
|
||||
video_range_type range;
|
||||
obs_source_frame2 frame;
|
||||
obs_source_audio audio;
|
||||
long lastRotation = 0;
|
||||
|
||||
WinHandle semaphore;
|
||||
WinHandle activated_event;
|
||||
@@ -269,7 +270,8 @@ struct DShowInput {
|
||||
size_t size, long long ts);
|
||||
|
||||
void OnVideoData(const VideoConfig &config, unsigned char *data,
|
||||
size_t size, long long startTime, long long endTime);
|
||||
size_t size, long long startTime, long long endTime,
|
||||
long rotation);
|
||||
void OnAudioData(const AudioConfig &config, unsigned char *data,
|
||||
size_t size, long long startTime, long long endTime);
|
||||
|
||||
@@ -518,7 +520,7 @@ void DShowInput::OnEncodedVideoData(enum AVCodecID id, unsigned char *data,
|
||||
|
||||
void DShowInput::OnVideoData(const VideoConfig &config, unsigned char *data,
|
||||
size_t size, long long startTime,
|
||||
long long endTime)
|
||||
long long endTime, long rotation)
|
||||
{
|
||||
if (videoConfig.format == VideoFormat::H264) {
|
||||
OnEncodedVideoData(AV_CODEC_ID_H264, data, size, startTime);
|
||||
@@ -590,6 +592,11 @@ void DShowInput::OnVideoData(const VideoConfig &config, unsigned char *data,
|
||||
return;
|
||||
}
|
||||
|
||||
if (rotation != lastRotation) {
|
||||
lastRotation = rotation;
|
||||
obs_source_set_async_rotation(source, rotation);
|
||||
}
|
||||
|
||||
obs_source_output_video2(source, &frame);
|
||||
|
||||
UNUSED_PARAMETER(endTime); /* it's the enndd tiimmes! */
|
||||
@@ -936,7 +943,7 @@ bool DShowInput::UpdateVideoConfig(obs_data_t *settings)
|
||||
videoConfig.callback = std::bind(&DShowInput::OnVideoData, this,
|
||||
placeholders::_1, placeholders::_2,
|
||||
placeholders::_3, placeholders::_4,
|
||||
placeholders::_5);
|
||||
placeholders::_5, placeholders::_6);
|
||||
|
||||
videoConfig.format = videoConfig.internalFormat;
|
||||
|
||||
|
Reference in New Issue
Block a user