> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XAppCaptureOpenScreenshotStream

> XAppCaptureOpenScreenshotStream

# XAppCaptureOpenScreenshotStream

스크린샷 스트림을 엽니다.

## 구문

```cpp theme={null}
HRESULT XAppCaptureOpenScreenshotStream(  
         const char* localId,  
         XAppCaptureScreenshotFormatFlag screenshotFormat,  
         XAppCaptureScreenshotStreamHandle* handle,  
         uint64_t* totalBytes  
)  
```

### 매개 변수

*localId*   \_In\_\
형식: char\*

[XAppCaptureTakeScreenshot](https://docs.xbox.com/ko/reference/system/xappcapture/functions/xappcapturetakescreenshot.md) 호출 후 [XAppCaptureTakeScreenshotResult](https://docs.xbox.com/ko/reference/system/xappcapture/structs/xappcapturetakescreenshotresult.md)에서 반환된 스크린샷의 로컬 ID입니다.

*screenshotFormat*   \_In\_\
형식: [XAppCaptureScreenshotFormatFlag](https://docs.xbox.com/ko/reference/system/xappcapture/enums/xappcapturescreenshotformatflag.md)

[XAppCaptureTakeScreenshot](https://docs.xbox.com/ko/reference/system/xappcapture/functions/xappcapturetakescreenshot.md) 호출 후 [XAppCaptureTakeScreenshotResult](https://docs.xbox.com/ko/reference/system/xappcapture/structs/xappcapturetakescreenshotresult.md)에서 반환된 스크린샷 형식 플래그입니다.

*handle*   \_Out\_\
형식: XAppCaptureScreenshotStreamHandle\*

스트림을 여는 결과로 반환되는 스크린샷 스트림 핸들입니다.

*totalBytes*   \_Out\_opt\_\
형식: uint64\_t\*

스트림의 총 바이트 수입니다.

### 반환 값

형식: HRESULT

함수 결과입니다.

## 설명

> [!NOTE]
>
> 이 함수는 시간에 민감한 스레드에서 호출하기에 안전하지 않습니다. 자세한 내용은 [시간에 민감한 스레드](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)를 참조하세요.

스크린샷은 게임 파티션에서 접근할 수 없으므로 사용자 또는 [XAppCaptureTakeScreenshot](https://docs.xbox.com/ko/reference/system/xappcapture/functions/xappcapturetakescreenshot.md)으로 촬영한 스크린샷을 검색하려면 스트림을 열어야 합니다. [XAppCaptureTakeScreenshot](https://docs.xbox.com/ko/reference/system/xappcapture/functions/xappcapturetakescreenshot.md)은 결과에서 *localID*를 반환하며, 이 함수에서 해당 스크린샷을 검색하는 데 사용됩니다. *localID*는 스크린샷이 디스크에 유지되는 한 유효합니다. 콘솔에서 스크린샷을 저장하는 공간은 제한되어 있습니다. 할당된 공간이 가득 차면 오래된 스크린샷이 삭제됩니다. 이로 인해 스크린샷 열기 함수가 localID를 찾지 못할 수 있습니다. 스트림을 연 후에는 [XAppCaptureReadScreenShotStream](https://docs.xbox.com/ko/reference/system/xappcapture/functions/xappcapturereadscreenshotstream.md)으로 스크린샷을 읽을 수 있습니다. 마지막으로 메모리 누수를 방지하기 위해 모든 스트림은 [XAppCaptureCloseScreenshotStream](https://docs.xbox.com/ko/reference/system/xappcapture/functions/xappcaptureclosescreenshotstream.md)으로 닫아야 합니다.

```cpp theme={null}
XAppCaptureTakeScreenshotResult takeScreenshotResult = {0};
XAppCaptureScreenshotStreamHandle handle = nullptr;
UINT64 totalBytesToRead = 0;
XAppCaptureScreenshotFormatFlag screenshotFormat = XAppCaptureScreenshotFormatFlag::SDR;
bool hdrAvailable = false;

/* ... obtain takeScreenshotResult with XAppCaptureTakeScreenshot. Refer to corresponding documentation ... */

hdrAvailable = static_cast<bool>(takeScreenshotResult.availableScreenshotFormats & XAppCaptureScreenshotFormatFlag::HDR);

/* Note: It is optional to obtain the HDR screenshot, if HDR is available. You will need to call XAppCaptureOpenScreenshotStream twice to obtain both SDR and HDR screenshots */
if (hdrAvailable)
{
    screenshotFormat = XAppCaptureScreenshotFormatFlag::HDR;
}

if (FAILED_LOG(XAppCaptureOpenScreenshotStream(takeScreenshotResult.localId, screenshotFormat, &handle, &totalBytesToRead)))
{
    return;
}

appLog.AddLog("%I64d bytes returned\n", totalBytesToRead);

/* You must always call XAppCaptureCloseScreenshotStream on an open XAppCaptureScreenshotStreamHandle to avoid a memory leak */
if (handle != nullptr)
{
    XAppCaptureCloseScreenshotStream(handle);
}

```

## 요구 사항

**헤더:** XAppCapture.h

**라이브러리:** xgameruntime.lib

**지원되는 플랫폼:** Windows, XBOX One 제품군 콘솔 및 XBOX Series 콘솔

## 개념 설명서

* [시간에 민감한 스레드](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## 함께 보기

[GameDVR 개요](https://docs.xbox.com/ko/build/console-features/game-dvr/gamedvr-broadcast.md)\
[XAppCapture 멤버](https://docs.xbox.com/ko/reference/system/xappcapture/xappcapture_members.md)\
[XAppCaptureReadScreenShotStream](https://docs.xbox.com/ko/reference/system/xappcapture/functions/xappcapturereadscreenshotstream.md)\
[XAppCaptureTakeScreenshot](https://docs.xbox.com/ko/reference/system/xappcapture/functions/xappcapturetakescreenshot.md)\
[XAppCaptureCloseScreenshotStream](https://docs.xbox.com/ko/reference/system/xappcapture/functions/xappcaptureclosescreenshotstream.md)


## Related topics

- [XAppCaptureReadScreenshotStream](https://docs.xbox.com/ko/reference/system/xappcapture/functions/xappcapturereadscreenshotstream.md)
- [XAppCaptureScreenshotStream](https://docs.xbox.com/ko/reference/system/xappcapture/structs/xappcapturescreenshotstream.md)
- [XAppCapture (API 콘텐츠)](https://docs.xbox.com/ko/reference/system/xappcapture/xappcapture_members.md)
- [Unity 프로젝트에서 GDK API용 C# 래퍼 사용](https://docs.xbox.com/ko/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XAppCaptureCloseScreenshotStream](https://docs.xbox.com/ko/reference/system/xappcapture/functions/xappcaptureclosescreenshotstream.md)
