Difference between revisions of "GRC services"

From Nintendo Switch Brew
Jump to navigation Jump to search
(16 intermediate revisions by 3 users not shown)
Line 8: Line 8:
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Cmd || Name
+
! Cmd || Name || Notes
 +
|-
 +
| 1 || OpenContinuousRecorder || Takes a total of 0x28-bytes of input and a handle, returns an [[#IContinuousRecorder]].
 +
|-
 +
| 2 || OpenGameMovieTrimmer || Takes a total of 0x8-bytes of input and a handle, returns an [[#IGameMovieTrimmer]].
 +
|-
 +
| 3 || [5.0.0+] || Takes a total of 0x8-bytes of input and a handle, returns an [[#IOffscreenRecorder]].
 
|-
 
|-
| 1 || OpenContinuousRecorder
+
| 101 || [5.0.0+] || Takes a total of 0x10-bytes of input, returns an [[#IMovieMaker]].
 
|-
 
|-
| 2 || OpenGameMovieTrimmer
+
| 9903 || [5.0.0+] || Takes 8-bytes of input, no output.
 
|}
 
|}
 +
 +
[5.0.0+] OpenContinuousRecorder now takes an additional 0x20-bytes of input.
  
 
== IContinuousRecorder ==
 
== IContinuousRecorder ==
Line 33: Line 41:
 
|-
 
|-
 
| 13 ||
 
| 13 ||
 +
|-
 +
| 14 || [5.0.0+]
 
|}
 
|}
 +
 +
[5.0.0+] Cmd11 now takes a total of 0x40-bytes of input.
 +
 +
[8.0.0+] Cmd11/cmd14 no longer take any rawdata input, these now take a type-0x15 input buffer.
  
 
== IGameMovieTrimmer ==
 
== IGameMovieTrimmer ==
Line 53: Line 67:
 
= grc:d =
 
= grc:d =
 
This is "nn::grcsrv::IRemoteVideoTransfer".
 
This is "nn::grcsrv::IRemoteVideoTransfer".
 +
 +
Added with [[6.0.0]].
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
! Cmd || Name || Notes
 +
|-
 +
| 1 || || No input/output.
 +
|-
 +
| 2 || || Takes an input u32 (must be value 0-1) and a type-0x6 output buffer, returns a total of 0x10-bytes of output.
 +
|}
 +
 +
== Cmd1 ==
 +
Begins video stream. Can only be called once.
 +
 +
== Cmd2 ==
 +
Retrieves video data. Takes u32 "stream" (0: video, 1: audio), returns u32 (num_frames?), u32 data_size, u64 (start_timestamp?). Video stream writes H.264 NAL units to the output buffer (try <code>ffplay -f h264</code>). Official code uses buffer size 0x32000 for video, 0x1000 for audio, and multiple threads to read out both streams at the same time.
 +
 +
= IOffscreenRecorder =
 +
This is "nn::grcsrv::IOffscreenRecorder".
 +
 +
This was added with [5.0.0+].
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Cmd || Name
+
! Cmd || Name || Notes
 
|-
 
|-
| 1 ||  
+
| 201 || || Takes a total of 0x8-bytes of input, returns a total of 0x8-bytes of output.
 
|-
 
|-
| 2 ||  
+
| 202 || || Takes a total of 0x8-bytes of input, no output.
 
|}
 
|}
  
 
= IMovieMaker =
 
= IMovieMaker =
 
This is "nn::grcsrv::IMovieMaker".
 
This is "nn::grcsrv::IMovieMaker".
 +
 +
This was added with [5.0.0+].
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 71: Line 109:
 
|-
 
|-
 
| 2 || [[#CreateVideoProxy]]
 
| 2 || [[#CreateVideoProxy]]
 +
|-
 +
| 9 || [7.0.0+] [[#SetAlbumShimLibraryVersion]]
 
|-
 
|-
 
| 10 || [[#OpenOffscreenLayer]]
 
| 10 || [[#OpenOffscreenLayer]]
Line 87: Line 127:
 
|-
 
|-
 
| 25 || [[#CompleteOffscreenRecordingFinishEx0]]
 
| 25 || [[#CompleteOffscreenRecordingFinishEx0]]
 +
|-
 +
| 26 || [7.0.0+] [[#CompleteOffscreenRecordingFinishEx1]]
 
|-
 
|-
 
| 30 || [[#GetOffscreenLayerError]]
 
| 30 || [[#GetOffscreenLayerError]]
Line 98: Line 140:
  
 
== CreateVideoProxy ==
 
== CreateVideoProxy ==
No input, returns an [[Nvnflinger_services#dispdrv|IHOSBinderDriver]].
+
No input, returns an [[#IHOSBinderDriver]].
 +
 
 +
== SetAlbumShimLibraryVersion ==
 +
Takes a total of 8-bytes of input, no output.
  
 
== OpenOffscreenLayer ==
 
== OpenOffscreenLayer ==
Line 108: Line 153:
 
== StartOffscreenRecording ==
 
== StartOffscreenRecording ==
 
Takes an input u64, no output.
 
Takes an input u64, no output.
 +
 +
Seems to be unused by official user processes, [[#StartOffscreenRecordingEx]] is used instead.
  
 
== AbortOffscreenRecording ==
 
== AbortOffscreenRecording ==
Takes an input u64, no output.
+
Takes an input u64 '''LayerHandle''', no output.
  
 
== RequestOffscreenRecordingFinishReady ==
 
== RequestOffscreenRecordingFinishReady ==
Takes an input u64, no output.
+
Takes an input u64 '''LayerHandle''', no output.
  
 
== StartOffscreenRecordingEx ==
 
== StartOffscreenRecordingEx ==
Takes an input u64 and an [[#OffscreenRecordingParameter]], no output.
+
Takes an input u64 '''LayerHandle''' and an [[#OffscreenRecordingParameter]], no output.
  
 
== CompleteOffscreenRecordingFinish ==
 
== CompleteOffscreenRecordingFinish ==
Takes an input u64 and a type-0x5 input buffer, no output.
+
Takes an input u64 '''LayerHandle''' and a type-0x5 input buffer, no output.
 +
 
 +
Seems to be unused by official user processes, [[#CompleteOffscreenRecordingFinishEx0]] is used instead.
  
 
== CompleteOffscreenRecordingFinishEx0 ==
 
== CompleteOffscreenRecordingFinishEx0 ==
Takes an input u64 and 2 type-0x5 input buffers, no output.
+
Takes two input u32s '''width'''/'''height''', an input u64 '''LayerHandle''' and 2 type-0x5 input buffers, no output.
 +
 
 +
The input buffers are optional, addr=NULL and size=0 can be used for these.
 +
 
 +
'''width'''/'''height''' must be 1280x720, these fields are unused afterwards.
 +
 
 +
Besides '''width'''/'''height''', this is the same as [[#CompleteOffscreenRecordingFinish]] except the second buffer is user-specified instead of addr=NULL/size=0.
 +
 
 +
== CompleteOffscreenRecordingFinishEx1 ==
 +
Takes two input u32s '''width'''/'''height''', an input u64 '''LayerHandle''' and two type-0x5 input buffers, returns a 0x20-byte output struct.
 +
 
 +
Same as [[#CompleteOffscreenRecordingFinishEx0]] except the output struct is returned in the cmdreply.
  
 
== EncodeOffscreenLayerAudioSample ==
 
== EncodeOffscreenLayerAudioSample ==
Takes an input u64 and a type-0x5 input buffer, returns an output u64.
+
Takes an input u64 '''LayerHandle''' and a type-0x5 input buffer, returns an output u64.
  
 
== GetOffscreenLayerError ==
 
== GetOffscreenLayerError ==
Takes an input u64, no output.
+
Takes an input u64 '''LayerHandle''', no output.
  
 
== GetOffscreenLayerRecordingFinishReadyEvent ==
 
== GetOffscreenLayerRecordingFinishReadyEvent ==
Takes an input u64, returns an output handle.
+
Takes an input u64 '''LayerHandle''', returns an output event handle with autoclear disabled.
  
 
== GetOffscreenLayerAudioEncodeReadyEvent ==
 
== GetOffscreenLayerAudioEncodeReadyEvent ==
Takes an input u64, returns an output handle.
+
Takes an input u64 '''LayerHandle''', returns an output event handle with autoclear disabled.
  
 
= OffscreenRecordingParameter =
 
= OffscreenRecordingParameter =
 
This is a 0x80-byte struct.
 
This is a 0x80-byte struct.
 +
 +
= IHOSBinderDriver =
 +
This is the same interface as NV [[Nvnflinger_services#dispdrv|IHOSBinderDriver]].
  
 
[[Category:Services]]
 
[[Category:Services]]

Revision as of 04:50, 15 May 2019

GRC (Game Recording) uses libstagefright and the NvMMLite TVMR library for writing recorded video to MP4s.

Error reporting is done using the new /dev/nverpt-ctrl ioctls.

grc:c

This is "nn::grcsrv::IGrcService".

Cmd Name Notes
1 OpenContinuousRecorder Takes a total of 0x28-bytes of input and a handle, returns an #IContinuousRecorder.
2 OpenGameMovieTrimmer Takes a total of 0x8-bytes of input and a handle, returns an #IGameMovieTrimmer.
3 [5.0.0+] Takes a total of 0x8-bytes of input and a handle, returns an #IOffscreenRecorder.
101 [5.0.0+] Takes a total of 0x10-bytes of input, returns an #IMovieMaker.
9903 [5.0.0+] Takes 8-bytes of input, no output.

[5.0.0+] OpenContinuousRecorder now takes an additional 0x20-bytes of input.

IContinuousRecorder

This is "nn::grcsrv::IContinuousRecorder".

Cmd Name
1
2
10
11
12
13
14 [5.0.0+]

[5.0.0+] Cmd11 now takes a total of 0x40-bytes of input.

[8.0.0+] Cmd11/cmd14 no longer take any rawdata input, these now take a type-0x15 input buffer.

IGameMovieTrimmer

This is "nn::grcsrv::IGameMovieTrimmer".

Cmd Name
1 BeginTrim
2 EndTrim
10 GetNotTrimmingEvent
20 SetThumbnailRgba

grc:d

This is "nn::grcsrv::IRemoteVideoTransfer".

Added with 6.0.0.

Cmd Name Notes
1 No input/output.
2 Takes an input u32 (must be value 0-1) and a type-0x6 output buffer, returns a total of 0x10-bytes of output.

Cmd1

Begins video stream. Can only be called once.

Cmd2

Retrieves video data. Takes u32 "stream" (0: video, 1: audio), returns u32 (num_frames?), u32 data_size, u64 (start_timestamp?). Video stream writes H.264 NAL units to the output buffer (try ffplay -f h264). Official code uses buffer size 0x32000 for video, 0x1000 for audio, and multiple threads to read out both streams at the same time.

IOffscreenRecorder

This is "nn::grcsrv::IOffscreenRecorder".

This was added with [5.0.0+].

Cmd Name Notes
201 Takes a total of 0x8-bytes of input, returns a total of 0x8-bytes of output.
202 Takes a total of 0x8-bytes of input, no output.

IMovieMaker

This is "nn::grcsrv::IMovieMaker".

This was added with [5.0.0+].

Cmd Name
2 #CreateVideoProxy
9 [7.0.0+] #SetAlbumShimLibraryVersion
10 #OpenOffscreenLayer
11 #CloseOffscreenLayer
20 #StartOffscreenRecording
21 #AbortOffscreenRecording
22 #RequestOffscreenRecordingFinishReady
23 #CompleteOffscreenRecordingFinish
24 #StartOffscreenRecordingEx
25 #CompleteOffscreenRecordingFinishEx0
26 [7.0.0+] #CompleteOffscreenRecordingFinishEx1
30 #GetOffscreenLayerError
41 #EncodeOffscreenLayerAudioSample
50 #GetOffscreenLayerRecordingFinishReadyEvent
52 #GetOffscreenLayerAudioEncodeReadyEvent

CreateVideoProxy

No input, returns an #IHOSBinderDriver.

SetAlbumShimLibraryVersion

Takes a total of 8-bytes of input, no output.

OpenOffscreenLayer

Takes an input u64 LayerHandle, returns an output u32.

CloseOffscreenLayer

Takes an input u64 LayerHandle, no output.

StartOffscreenRecording

Takes an input u64, no output.

Seems to be unused by official user processes, #StartOffscreenRecordingEx is used instead.

AbortOffscreenRecording

Takes an input u64 LayerHandle, no output.

RequestOffscreenRecordingFinishReady

Takes an input u64 LayerHandle, no output.

StartOffscreenRecordingEx

Takes an input u64 LayerHandle and an #OffscreenRecordingParameter, no output.

CompleteOffscreenRecordingFinish

Takes an input u64 LayerHandle and a type-0x5 input buffer, no output.

Seems to be unused by official user processes, #CompleteOffscreenRecordingFinishEx0 is used instead.

CompleteOffscreenRecordingFinishEx0

Takes two input u32s width/height, an input u64 LayerHandle and 2 type-0x5 input buffers, no output.

The input buffers are optional, addr=NULL and size=0 can be used for these.

width/height must be 1280x720, these fields are unused afterwards.

Besides width/height, this is the same as #CompleteOffscreenRecordingFinish except the second buffer is user-specified instead of addr=NULL/size=0.

CompleteOffscreenRecordingFinishEx1

Takes two input u32s width/height, an input u64 LayerHandle and two type-0x5 input buffers, returns a 0x20-byte output struct.

Same as #CompleteOffscreenRecordingFinishEx0 except the output struct is returned in the cmdreply.

EncodeOffscreenLayerAudioSample

Takes an input u64 LayerHandle and a type-0x5 input buffer, returns an output u64.

GetOffscreenLayerError

Takes an input u64 LayerHandle, no output.

GetOffscreenLayerRecordingFinishReadyEvent

Takes an input u64 LayerHandle, returns an output event handle with autoclear disabled.

GetOffscreenLayerAudioEncodeReadyEvent

Takes an input u64 LayerHandle, returns an output event handle with autoclear disabled.

OffscreenRecordingParameter

This is a 0x80-byte struct.

IHOSBinderDriver

This is the same interface as NV IHOSBinderDriver.