@@ -402,10 +402,8 @@ uint32_t CaptureControllerImpl::GetMaxPreviewHeight() const {
402402enum class PlatformStreamCategory { video, photo, audio };
403403
404404HRESULT GetMediaSourceStreamIndex (
405- IMFCaptureSource* source,
406- DWORD* source_stream_index,
407- PlatformStreamCategory target_stream_category
408- ) {
405+ IMFCaptureSource* source, DWORD* source_stream_index,
406+ PlatformStreamCategory target_stream_category) {
409407 DWORD stream_count = 0 ;
410408 HRESULT hr = source->GetDeviceStreamCount (&stream_count);
411409 if (FAILED (hr)) {
@@ -421,10 +419,13 @@ HRESULT GetMediaSourceStreamIndex(
421419
422420 if ((target_stream_category == PlatformStreamCategory::video &&
423421 (stream_category == MF_CAPTURE_ENGINE_STREAM_CATEGORY_VIDEO_PREVIEW ||
424- stream_category == MF_CAPTURE_ENGINE_STREAM_CATEGORY_VIDEO_CAPTURE)) ||
422+ stream_category ==
423+ MF_CAPTURE_ENGINE_STREAM_CATEGORY_VIDEO_CAPTURE)) ||
425424 (target_stream_category == PlatformStreamCategory::photo &&
426- (stream_category == MF_CAPTURE_ENGINE_STREAM_CATEGORY_PHOTO_DEPENDENT ||
427- stream_category == MF_CAPTURE_ENGINE_STREAM_CATEGORY_PHOTO_INDEPENDENT)) ||
425+ (stream_category ==
426+ MF_CAPTURE_ENGINE_STREAM_CATEGORY_PHOTO_DEPENDENT ||
427+ stream_category ==
428+ MF_CAPTURE_ENGINE_STREAM_CATEGORY_PHOTO_INDEPENDENT)) ||
428429 (target_stream_category == PlatformStreamCategory::audio &&
429430 stream_category == MF_CAPTURE_ENGINE_STREAM_CATEGORY_AUDIO)) {
430431 *source_stream_index = stream_index;
@@ -509,30 +510,32 @@ HRESULT CaptureControllerImpl::FindBaseMediaTypes() {
509510HRESULT CaptureControllerImpl::FindBaseMediaTypesForSource (
510511 IMFCaptureSource* source) {
511512 HRESULT hr;
512- hr = GetMediaSourceStreamIndex (source, &video_source_stream_index_, PlatformStreamCategory::video);
513+ hr = GetMediaSourceStreamIndex (source, &video_source_stream_index_,
514+ PlatformStreamCategory::video);
513515 if (FAILED (hr)) {
514516 return E_FAIL;
515517 }
516518
517- hr = GetMediaSourceStreamIndex (source, &photo_source_stream_index_, PlatformStreamCategory::photo);
519+ hr = GetMediaSourceStreamIndex (source, &photo_source_stream_index_,
520+ PlatformStreamCategory::photo);
518521 if (FAILED (hr)) {
519522 // Use the same source stream for photo as video on fail
520523 photo_source_stream_index_ = video_source_stream_index_;
521524 }
522525
523526 if (media_settings_.enable_audio ()) {
524- hr = GetMediaSourceStreamIndex (source, &audio_source_stream_index_, PlatformStreamCategory::audio);
527+ hr = GetMediaSourceStreamIndex (source, &audio_source_stream_index_,
528+ PlatformStreamCategory::audio);
525529 if (FAILED (hr)) {
526530 return E_FAIL;
527531 }
528532 }
529533
530534 // Find base media type for previewing.
531- if (!FindBestMediaType (
532- video_source_stream_index_,
533- source, base_preview_media_type_.GetAddressOf (),
534- GetMaxPreviewHeight (), &preview_frame_width_,
535- &preview_frame_height_)) {
535+ if (!FindBestMediaType (video_source_stream_index_, source,
536+ base_preview_media_type_.GetAddressOf (),
537+ GetMaxPreviewHeight (), &preview_frame_width_,
538+ &preview_frame_height_)) {
536539 return E_FAIL;
537540 }
538541
@@ -543,10 +546,9 @@ HRESULT CaptureControllerImpl::FindBaseMediaTypesForSource(
543546 }
544547
545548 // Find base media type for record and photo capture.
546- if (!FindBestMediaType (
547- video_source_stream_index_,
548- source, base_capture_media_type_.GetAddressOf (), 0xffffffff , nullptr ,
549- nullptr )) {
549+ if (!FindBestMediaType (video_source_stream_index_, source,
550+ base_capture_media_type_.GetAddressOf (), 0xffffffff ,
551+ nullptr , nullptr )) {
550552 return E_FAIL;
551553 }
552554 return S_OK;
@@ -583,10 +585,9 @@ void CaptureControllerImpl::StartRecord(const std::string& file_path) {
583585
584586 // Check MF_CAPTURE_ENGINE_RECORD_STARTED event handling for response
585587 // process.
586- hr = record_handler_->StartRecord (file_path, capture_engine_.Get (),
587- base_capture_media_type_.Get (),
588- video_source_stream_index_,
589- audio_source_stream_index_);
588+ hr = record_handler_->StartRecord (
589+ file_path, capture_engine_.Get (), base_capture_media_type_.Get (),
590+ video_source_stream_index_, audio_source_stream_index_);
590591 if (FAILED (hr)) {
591592 // Destroy record handler on error cases to make sure state is resetted.
592593 record_handler_ = nullptr ;
@@ -672,10 +673,9 @@ void CaptureControllerImpl::StartPreview() {
672673
673674 // Check MF_CAPTURE_ENGINE_PREVIEW_STARTED event handling for response
674675 // process.
675- hr = preview_handler_->StartPreview (capture_engine_.Get (),
676- base_preview_media_type_.Get (),
677- video_source_stream_index_,
678- capture_engine_callback_handler_.Get ());
676+ hr = preview_handler_->StartPreview (
677+ capture_engine_.Get (), base_preview_media_type_.Get (),
678+ video_source_stream_index_, capture_engine_callback_handler_.Get ());
679679
680680 if (FAILED (hr)) {
681681 // Destroy preview handler on error cases to make sure state is resetted.
0 commit comments