Skip to content

Commit f651d9c

Browse files
committed
fix formatting
1 parent 6a1ebca commit f651d9c

File tree

8 files changed

+55
-61
lines changed

8 files changed

+55
-61
lines changed

packages/camera/camera_windows/windows/capture_controller.cpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,8 @@ uint32_t CaptureControllerImpl::GetMaxPreviewHeight() const {
402402
enum class PlatformStreamCategory { video, photo, audio };
403403

404404
HRESULT 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() {
509510
HRESULT 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.

packages/camera/camera_windows/windows/capture_controller.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ class CaptureControllerImpl : public CaptureController,
214214

215215
uint32_t preview_frame_width_ = 0;
216216
uint32_t preview_frame_height_ = 0;
217-
DWORD video_source_stream_index_ = (DWORD) MF_CAPTURE_ENGINE_MEDIASOURCE;
218-
DWORD photo_source_stream_index_ = (DWORD) MF_CAPTURE_ENGINE_MEDIASOURCE;
219-
DWORD audio_source_stream_index_ = (DWORD) MF_CAPTURE_ENGINE_MEDIASOURCE;
217+
DWORD video_source_stream_index_ = (DWORD)MF_CAPTURE_ENGINE_MEDIASOURCE;
218+
DWORD photo_source_stream_index_ = (DWORD)MF_CAPTURE_ENGINE_MEDIASOURCE;
219+
DWORD audio_source_stream_index_ = (DWORD)MF_CAPTURE_ENGINE_MEDIASOURCE;
220220
UINT dx_device_reset_token_ = 0;
221221
std::unique_ptr<RecordHandler> record_handler_;
222222
std::unique_ptr<PreviewHandler> preview_handler_;

packages/camera/camera_windows/windows/photo_handler.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,8 @@ HRESULT PhotoHandler::InitPhotoSink(IMFCaptureEngine* capture_engine,
100100
}
101101

102102
DWORD photo_sink_stream_index;
103-
hr = photo_sink_->AddStream(
104-
source_stream_index,
105-
photo_media_type.Get(), nullptr, &photo_sink_stream_index);
103+
hr = photo_sink_->AddStream(source_stream_index, photo_media_type.Get(),
104+
nullptr, &photo_sink_stream_index);
106105
if (FAILED(hr)) {
107106
photo_sink_ = nullptr;
108107
return hr;
@@ -127,9 +126,8 @@ HRESULT PhotoHandler::TakePhoto(const std::string& file_path,
127126

128127
file_path_ = file_path;
129128

130-
HRESULT hr = InitPhotoSink(capture_engine,
131-
base_media_type,
132-
source_stream_index);
129+
HRESULT hr =
130+
InitPhotoSink(capture_engine, base_media_type, source_stream_index);
133131
if (FAILED(hr)) {
134132
return hr;
135133
}

packages/camera/camera_windows/windows/photo_handler.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ class PhotoHandler {
5050
// source_stream_index: Integer index of the source stream in MediaFoundation.
5151
HRESULT TakePhoto(const std::string& file_path,
5252
IMFCaptureEngine* capture_engine,
53-
IMFMediaType* base_media_type,
54-
DWORD source_stream_index);
53+
IMFMediaType* base_media_type, DWORD source_stream_index);
5554

5655
// Set the photo handler recording state to: kIdle.
5756
void OnPhotoTaken();

packages/camera/camera_windows/windows/preview_handler.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ HRESULT BuildMediaTypeForVideoPreview(IMFMediaType* src_media_type,
5151

5252
HRESULT PreviewHandler::InitPreviewSink(
5353
IMFCaptureEngine* capture_engine, IMFMediaType* base_media_type,
54-
DWORD source_stream_index,
55-
CaptureEngineListener* sample_callback) {
54+
DWORD source_stream_index, CaptureEngineListener* sample_callback) {
5655
assert(capture_engine);
5756
assert(base_media_type);
5857
assert(sample_callback);
@@ -95,9 +94,8 @@ HRESULT PreviewHandler::InitPreviewSink(
9594
}
9695

9796
DWORD preview_sink_stream_index;
98-
hr = preview_sink_->AddStream(
99-
source_stream_index,
100-
preview_media_type.Get(), nullptr, &preview_sink_stream_index);
97+
hr = preview_sink_->AddStream(source_stream_index, preview_media_type.Get(),
98+
nullptr, &preview_sink_stream_index);
10199

102100
if (FAILED(hr)) {
103101
return hr;
@@ -121,8 +119,8 @@ HRESULT PreviewHandler::StartPreview(IMFCaptureEngine* capture_engine,
121119
assert(capture_engine);
122120
assert(base_media_type);
123121

124-
HRESULT hr =
125-
InitPreviewSink(capture_engine, base_media_type, source_stream_index, sample_callback);
122+
HRESULT hr = InitPreviewSink(capture_engine, base_media_type,
123+
source_stream_index, sample_callback);
126124

127125
if (FAILED(hr)) {
128126
return hr;

packages/camera/camera_windows/windows/preview_handler.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ class PreviewHandler {
5252
// for the actual video capture media type.
5353
// sample_callback: A pointer to capture engine listener.
5454
// This is set as sample callback for preview sink.
55-
// source_stream_index: Integer index of the preview source stream in MediaFoundation.
55+
// source_stream_index: Integer index of the preview source stream in
56+
// MediaFoundation.
5657
HRESULT StartPreview(IMFCaptureEngine* capture_engine,
57-
IMFMediaType* base_media_type,
58-
DWORD source_stream_index,
58+
IMFMediaType* base_media_type, DWORD source_stream_index,
5959
CaptureEngineListener* sample_callback);
6060

6161
// Stops existing recording.

packages/camera/camera_windows/windows/record_handler.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ HRESULT RecordHandler::InitRecordSink(IMFCaptureEngine* capture_engine,
191191
}
192192

193193
DWORD video_record_sink_stream_index;
194-
hr = record_sink_->AddStream(
195-
video_source_stream_index,
196-
video_record_media_type.Get(), nullptr, &video_record_sink_stream_index);
194+
hr = record_sink_->AddStream(video_source_stream_index,
195+
video_record_media_type.Get(), nullptr,
196+
&video_record_sink_stream_index);
197197
if (FAILED(hr)) {
198198
return hr;
199199
}
@@ -212,10 +212,9 @@ HRESULT RecordHandler::InitRecordSink(IMFCaptureEngine* capture_engine,
212212
}
213213

214214
DWORD audio_record_sink_stream_index;
215-
hr = record_sink_->AddStream(
216-
audio_source_stream_index,
217-
audio_record_media_type.Get(), nullptr,
218-
&audio_record_sink_stream_index);
215+
hr = record_sink_->AddStream(audio_source_stream_index,
216+
audio_record_media_type.Get(), nullptr,
217+
&audio_record_sink_stream_index);
219218
}
220219

221220
if (FAILED(hr)) {
@@ -241,10 +240,9 @@ HRESULT RecordHandler::StartRecord(const std::string& file_path,
241240
recording_start_timestamp_us_ = -1;
242241
recording_duration_us_ = 0;
243242

244-
HRESULT hr = InitRecordSink(capture_engine,
245-
base_media_type,
246-
video_source_stream_index,
247-
audio_source_stream_index);
243+
HRESULT hr =
244+
InitRecordSink(capture_engine, base_media_type, video_source_stream_index,
245+
audio_source_stream_index);
248246
if (FAILED(hr)) {
249247
return hr;
250248
}

packages/camera/camera_windows/windows/record_handler.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ class RecordHandler {
4848
// the actual recording.
4949
// base_media_type: A pointer to base media type used as a base
5050
// for the actual video capture media type.
51-
// video_source_stream_index: Integer index of the video source stream in MediaFoundation.
52-
// audio_source_stream_index: Integer index of the audio source stream in MediaFoundation.
51+
// video_source_stream_index: Integer index of the video source stream in
52+
// MediaFoundation. audio_source_stream_index: Integer index of the audio
53+
// source stream in MediaFoundation.
5354
HRESULT StartRecord(const std::string& file_path,
5455
IMFCaptureEngine* capture_engine,
5556
IMFMediaType* base_media_type,

0 commit comments

Comments
 (0)