| 51 | /// w.close(); |
| 52 | /// ``` |
| 53 | public abstract class VideoWriter { |
| 54 | /// Writes a single video frame at the given presentation timestamp. The frame may be |
| 55 | /// any `Image`; its pixels are read via `Image#getRGB()`. Frames should be supplied |
| 56 | /// in non decreasing timestamp order. |
| 57 | /// |
| 58 | /// #### Parameters |
| 59 | /// |
| 60 | /// - `frame`: the frame to encode, expected to match the configured width and height |
| 61 | /// |
| 62 | /// - `presentationTimeMillis`: the timestamp of this frame in milliseconds |
| 63 | /// |
| 64 | /// #### Throws |
| 65 | /// |
| 66 | /// - `IOException`: if encoding fails |
| 67 | public void writeFrame(Image frame, long presentationTimeMillis) throws IOException { |
| 68 | writeFrame(frame.getRGB(), frame.getWidth(), frame.getHeight(), presentationTimeMillis); |
| 69 | } |
| 70 | |
| 71 | /// Writes a single video frame supplied as a raw ARGB pixel array. This is the method |
| 72 | /// platform implementations provide; `#writeFrame(Image, long)` funnels into it. |
| 73 | /// |
| 74 | /// #### Parameters |
| 75 | /// |
| 76 | /// - `argb`: the frame pixels in ARGB order, length `width * height` |
| 77 | /// |
| 78 | /// - `width`: the frame width in pixels |
| 79 | /// |
| 80 | /// - `height`: the frame height in pixels |
| 81 | /// |
| 82 | /// - `presentationTimeMillis`: the timestamp of this frame in milliseconds |
| 83 | /// |
| 84 | /// #### Throws |
| 85 | /// |
| 86 | /// - `IOException`: if encoding fails |
| 87 | public abstract void writeFrame(int[] argb, int width, int height, long presentationTimeMillis) throws IOException; |
| 88 | |
| 89 | /// Writes a block of interleaved PCM audio samples at the given timestamp. Samples |
| 90 | /// are signed 16 bit, interleaved by channel. The audio track must have been enabled |
| 91 | /// with `VideoWriterBuilder#hasAudio(boolean)`. |
| 92 | /// |
| 93 | /// #### Parameters |
| 94 | /// |
| 95 | /// - `interleavedPcm`: signed 16 bit interleaved samples |
| 96 | /// |
| 97 | /// - `sampleRate`: the sample rate of the supplied data in Hz |
| 98 | /// |
| 99 | /// - `channels`: the number of interleaved channels |
| 100 | /// |
| 101 | /// - `presentationTimeMillis`: the timestamp of the first sample in milliseconds |
| 102 | /// |
| 103 | /// #### Throws |
| 104 | /// |
| 105 | /// - `IOException`: if encoding fails |
| 106 | public abstract void writeAudio(short[] interleavedPcm, int sampleRate, int channels, long presentationTimeMillis) throws IOException; |
| 107 | |
| 108 | /// Convenience method that writes the current contents of an `AudioBuffer` (which |
| 109 | /// stores floating point samples) as 16 bit PCM. The buffer's own sample rate and |
| 110 | /// channel count are used. |
nothing calls this directly
no outgoing calls
no test coverage detected