Tanoda
HEVCRecorder.cs
Go to the documentation of this file.
1/*
2* NatCorder
3* Copyright (c) 2020 Yusuf Olokoba.
4*/
5
6using System;
7using System.Threading.Tasks;
9
10namespace NatSuite.Recorders
11{
15 public sealed class HEVCRecorder : IMediaRecorder
16 {
17 #region --Client API--
18
22 public (int width, int height) frameSize => recorder.frameSize;
23
34 public HEVCRecorder(int width, int height, float frameRate, int sampleRate = 0, int channelCount = 0,
35 int bitrate = (int) (960 * 540 * 11.4f), int keyframeInterval = 3)
36 {
37 recorder = new NativeRecorder((callback, context) => Bridge.CreateHEVCRecorder(width, height, frameRate,
38 bitrate, keyframeInterval, sampleRate, channelCount, Internal.Utility.GetPath(@".mp4"), callback,
39 context));
40 }
41
48 public void CommitFrame<T>(T[] pixelBuffer, long timestamp) where T : struct
49 {
50 recorder.CommitFrame(pixelBuffer, timestamp);
51 }
52
59 public void CommitFrame(IntPtr nativeBuffer, long timestamp)
60 {
61 recorder.CommitFrame(nativeBuffer, timestamp);
62 }
63
69 public void CommitSamples(float[] sampleBuffer, long timestamp)
70 {
71 recorder.CommitSamples(sampleBuffer, timestamp);
72 }
73
77 public Task<string> FinishWriting()
78 {
79 return recorder.FinishWriting();
80 }
81
82 #endregion
83
84 private readonly IMediaRecorder recorder;
85 }
86}
Task< string > FinishWriting()
Finish writing and return the path to the recorded media file.
Definition: HEVCRecorder.cs:77
void CommitFrame(IntPtr nativeBuffer, long timestamp)
Commit a video pixel buffer for encoding. The pixel buffer MUST have an RGBA8888 pixel layout.
Definition: HEVCRecorder.cs:59
void CommitSamples(float[] sampleBuffer, long timestamp)
Commit an audio sample buffer for encoding.
Definition: HEVCRecorder.cs:69
void CommitFrame< T >(T[] pixelBuffer, long timestamp)
Commit a video pixel buffer for encoding. The pixel buffer MUST have an RGBA8888 pixel layout.
Definition: HEVCRecorder.cs:48
A recorder capable of recording video frames, and optionally audio frames, to a media output....
Task< string > FinishWriting()
Finish writing and return the path to the recorded media file.
void CommitFrame(IntPtr nativeBuffer, long timestamp)
Commit a video pixel buffer for encoding. The pixel buffer MUST have an RGBA8888 pixel layout.
void CommitSamples(float[] sampleBuffer, long timestamp)
Commit an audio sample buffer for encoding.