Skip to content

Commit 3b8f868

Browse files
committed
Docs Formatting Updates
1 parent bc35cd7 commit 3b8f868

File tree

9 files changed

+85
-115
lines changed

9 files changed

+85
-115
lines changed

TODO

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Development Milestones
22
- Fix Virtual Machine Support
3+
- Build QEMU Statically for All Platforms
34

45
- Add Images and GIF Support into Plugin
56
- Add Interaction Support for Virtual Machine

docs/http-use.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ a simple web server for providing audio. This class is also a `VideoFilter` whic
55
with your pipeline.
66

77
```java
8-
final HttpResult result = HttpResult.port(...);
9-
final Source source = ...''
10-
final AudioPipelineStep audioPipelineStep = AudioPipelineStep.of(result);
11-
final VideoPipelineStep videoPipelineStep = VideoPipelineStep.NO_OP;
12-
result.start();
8+
final HttpResult result = HttpResult.port(...);
9+
final Source source = ...''
10+
final AudioPipelineStep audioPipelineStep = AudioPipelineStep.of(result);
11+
final VideoPipelineStep videoPipelineStep = VideoPipelineStep.NO_OP;
12+
result.start();
1313

14-
final VideoPlayerMultiplexer multiplexer = VideoPlayer.vlc();
15-
multiplexer.start(audioPipelineStep, videoPipelineStep, source);
14+
final VideoPlayerMultiplexer multiplexer = VideoPlayer.vlc();
15+
multiplexer.start(audioPipelineStep, videoPipelineStep, source);
1616
```

docs/image.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ provides methods to manipulate the GIF frames or getting the frame rate.
2828

2929
```java
3030
final UriSource source = UriSource.uri(URI.create("https://example.com/image.gif"));
31-
final DynamicImage image = DynamicImage.uri(source);
32-
final float fps = image.getFrameRate();
33-
// and more operations
34-
image.
35-
36-
close();
31+
final DynamicImage image = DynamicImage.uri(source);
32+
final float fps = image.getFrameRate();
33+
// and more operations
34+
image.close();
3735
```

docs/installer-use.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ To use the installer, it's super simple. You need to make sure that your current
55
`MCAVInstaller` class as so.
66

77
```java
8-
final Path downloaded = Path.of("dependencies");
9-
final Class<InstallationExample> clazz = InstallationExample.class;
10-
final ClassLoader classLoader = requireNonNull(clazz.getClassLoader());
11-
final MCAVInstaller installer = MCAVInstaller.injector(downloaded, classLoader);
12-
installer.
13-
14-
loadMCAVDependencies(Artifact.COMMON);
8+
final Path downloaded = Path.of("dependencies");
9+
final Class<InstallationExample> clazz = InstallationExample.class;
10+
final ClassLoader classLoader = requireNonNull(clazz.getClassLoader());
11+
final MCAVInstaller installer = MCAVInstaller.injector(downloaded, classLoader);
12+
installer.loadMCAVDependencies(Artifact.COMMON);
1513
```
1614

1715
This will install the MCAV dependencies into the specified folder, and you can then use the `loader` to load the MCAV

docs/instance.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ plugin.
1212
```java
1313
final MCAVApi api = MCAVApi.api();
1414
api.install(); // installs and loads the required binaries
15-
1615
// ... use the library ...
17-
1816
api.release(); // releases all native resources and shuts down the library
1917
```
2018

docs/jda-use.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ classes that are provided by JDA. This class is also a `VideoFilter` which is de
66
your pipeline.
77

88
```java
9-
final Guild guild = ...;
10-
final VoiceChannel voiceChannel = ...;
11-
final AudioManager audioManager = guild.getAudioManager();
12-
audioManager.openAudioConnection(voiceChannel);
9+
final Guild guild = ...;
10+
final VoiceChannel voiceChannel = ...;
11+
final AudioManager audioManager = guild.getAudioManager();
12+
audioManager.openAudioConnection(voiceChannel);
1313

14-
final DiscordPlayer player = DiscordPlayer.voice();
15-
final AudioPipelineStep audioPipelineStep = AudioPipelineStep.of(player);
16-
final VideoPipelineStep videoPipelineStep = VideoPipelineStep.NO_OP;
17-
audioManager.setSendingHandler(player);
14+
final DiscordPlayer player = DiscordPlayer.voice();
15+
final AudioPipelineStep audioPipelineStep = AudioPipelineStep.of(player);
16+
final VideoPipelineStep videoPipelineStep = VideoPipelineStep.NO_OP;
17+
audioManager.setSendingHandler(player);
1818

19-
final VideoPlayerMultiplexer multiplexer = VideoPlayer.ffmpeg();
20-
multiplexer.start(...);
19+
final VideoPlayerMultiplexer multiplexer = VideoPlayer.ffmpeg();
20+
multiplexer.start(...);
2121
```

docs/map.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ on. For example, for an error diffusion dither, you would use the following code
6363

6464
```java
6565
final ErrorDiffusionDither dither = DitherAlgorithm.errorDiffusion()
66-
.withAlgorithm(ErrorDiffusionDitherBuilder.Algorithm.FILTER_LITE)
67-
.withPalette(new DefaultPalette()).build();
66+
.withAlgorithm(ErrorDiffusionDitherBuilder.Algorithm.FILTER_LITE)
67+
.withPalette(new DefaultPalette()).build();
6868
```
6969

7070
## Using Maps to Display Frames
@@ -75,13 +75,13 @@ block widths and heights, and map IDs. You should use the builder to create the
7575

7676
```java
7777
final Collection<UUID> viewers = ...;
78-
final DitherAlgorithm algorithm = ...;
79-
final MapConfiguration configuration = MapConfiguration.builder()
80-
.map(0)
81-
.mapBlockWidth(5).mapBlockHeight(5)
82-
.mapHeightResolution(640).mapWidthResolution(640)
83-
.viewers(viewers)
84-
.build();
78+
final DitherAlgorithm algorithm = ...;
79+
final MapConfiguration configuration = MapConfiguration.builder()
80+
.map(0)
81+
.mapBlockWidth(5).mapBlockHeight(5)
82+
.mapHeightResolution(640).mapWidthResolution(640)
83+
.viewers(viewers)
84+
.build();
8585
```
8686

8787
Now that MCAV knows the map metadata and the dithering algorithm, you can use the `DitherFilter` to apply the dithering

docs/player.md

Lines changed: 45 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,15 @@ padding. The audio samples are always encoded in **Signed PCM 16-bit Little-Endi
2525
```
2626

2727
```java
28-
final AudioPipelineStep audioPipelineStep = ...;
29-
final VideoPipelineStep videoPipelineStep = ...;
30-
final FileSource videoSource = ...;
31-
final FileSource audioSource = ...;
32-
final VideoPlayerMultiplexer multiplexer = VideoPlayer.vlc();
33-
// audioPipelineStep and videoPipelineStep from above
34-
multiplexer.
35-
36-
start(audioPipelineStep, videoPipelineStep, videoSource, audioSource);
37-
// ... do something with the player
38-
multiplexer.
39-
40-
release();
28+
final AudioPipelineStep audioPipelineStep = ...;
29+
final VideoPipelineStep videoPipelineStep = ...;
30+
final FileSource videoSource = ...;
31+
final FileSource audioSource = ...;
32+
final VideoPlayerMultiplexer multiplexer = VideoPlayer.vlc();
33+
// audioPipelineStep and videoPipelineStep from above
34+
multiplexer.start(audioPipelineStep, videoPipelineStep, videoSource, audioSource);
35+
// ... do something with the player
36+
multiplexer.release();
4137
```
4238

4339
```{warning}
@@ -49,18 +45,14 @@ All multiplexer players support single input video and audio sources. For exampl
4945
so.
5046

5147
```java
52-
final AudioPipelineStep audioPipelineStep = ...;
53-
final VideoPipelineStep videoPipelineStep = ...;
54-
final FileSource source = ...;
55-
final VideoPlayerMultiplexer player = VideoPlayer.vlc();
56-
// audioPipelineStep and videoPipelineStep from above
57-
player.
58-
59-
start(audioPipelineStep, videoPipelineStep, source);
60-
// ... do something with the player
61-
player.
62-
63-
release();
48+
final AudioPipelineStep audioPipelineStep = ...;
49+
final VideoPipelineStep videoPipelineStep = ...;
50+
final FileSource source = ...;
51+
final VideoPlayerMultiplexer player = VideoPlayer.vlc();
52+
// audioPipelineStep and videoPipelineStep from above
53+
player.start(audioPipelineStep, videoPipelineStep, source);
54+
// ... do something with the player
55+
player.release();
6456
```
6557

6658
The `VLCPlayer`, `FFmpegPlayer`, `VideoInputPlayer`, and `OpenCVPlayer` are all multiplexer video players.
@@ -79,16 +71,12 @@ To use the `ChromeDriverPlayer`, you must have a `BrowserSource` that specifies
7971

8072
```java
8173
final VideoPipelineStep videoPipelineStep = ...;
82-
final VideoMetadata metadata = VideoMetadata.of(1920, 1080); // specify browser resolution
83-
final BrowserSource browserSource = BrowserSource.of(URI.create("https://example.com"), metadata);
84-
final BrowserPlayer player = BrowserPlayer.defaultChrome(); // starts Chrome WebDriver with default arguments
85-
player.
86-
87-
start(videoPipelineStep, browserSource);
88-
// ... do something with the player
89-
player.
90-
91-
release();
74+
final VideoMetadata metadata = VideoMetadata.of(1920, 1080); // specify browser resolution
75+
final BrowserSource browserSource = BrowserSource.of(URI.create("https://example.com"), metadata);
76+
final BrowserPlayer player = BrowserPlayer.defaultChrome(); // starts Chrome WebDriver with default arguments
77+
player.start(videoPipelineStep, browserSource);
78+
// ... do something with the player
79+
player.release();
9280
```
9381

9482
## Image Players
@@ -99,32 +87,24 @@ JFreeChart chart and displaying it.
9987

10088
```java
10189
final VideoPipelineStep videoPipelineStep = ...;
102-
final FrameSource frameSource = FrameSource.image(...); // provide your frames in a supplier
103-
final ImagePlayer player = ImagePlayer.player();
104-
player.
105-
106-
start(videoPipelineStep, frameSource);
107-
// ... do something with the player
108-
player.
109-
110-
release();
90+
final FrameSource frameSource = FrameSource.image(...); // provide your frames in a supplier
91+
final ImagePlayer player = ImagePlayer.player();
92+
player.start(videoPipelineStep, frameSource);
93+
// ... do something with the player
94+
player.release();
11195
```
11296

11397
If you want to play a GIF image, you can use the `RepeatingFrameSource` which accepts any `DynamicImage`. You can pass
11498
this into `ImagePlayer` directly.
11599

116100
```java
117101
final VideoPipelineStep videoPipelineStep = ...;
118-
final DynamicImage gif = DynamicImage.path(FileSource.path(Path.of("example.gif"))); // provide your gif image
119-
final RepeatingFrameSource frameSource = RepeatingFrameSource.repeating(gif); // provide your gif frames in a supplier
120-
final ImagePlayer player = ImagePlayer.player();
121-
player.
122-
123-
start(videoPipelineStep, frameSource);
124-
// ... do something with the player
125-
player.
126-
127-
release();
102+
final DynamicImage gif = DynamicImage.path(FileSource.path(Path.of("example.gif"))); // provide your gif image
103+
final RepeatingFrameSource frameSource = RepeatingFrameSource.repeating(gif); // provide your gif frames in a supplier
104+
final ImagePlayer player = ImagePlayer.player();
105+
player.start(videoPipelineStep, frameSource);
106+
// ... do something with the player
107+
player.release();
128108
```
129109

130110
This will play the GIF indefinitely until you stop the player. You're also welcome to play the GIF in the
@@ -139,21 +119,17 @@ a `VNCSource`, and pass it to the player.
139119

140120
```java
141121
final VideoPipelineStep pipeline = ...;
142-
final VNCSource source = VNCSource.vnc()
143-
.host("localhost")
144-
.port(5900)
145-
.password("passwd")
146-
.videoMetadata(videoMetadata)
147-
.name("VNC Connection")
148-
.build();
149-
final VNCPlayer player = VNCPlayer.vm();
150-
player.
151-
152-
start(pipeline, source);
153-
// ... do some play back
154-
player.
155-
156-
release();
122+
final VNCSource source = VNCSource.vnc()
123+
.host("localhost")
124+
.port(5900)
125+
.password("passwd")
126+
.videoMetadata(videoMetadata)
127+
.name("VNC Connection")
128+
.build();
129+
final VNCPlayer player = VNCPlayer.vm();
130+
player.start(pipeline, source);
131+
// ... do some play back
132+
player.release();
157133
```
158134

159135
That way, you're able to connect to virtual machines or any VNC server and interact with it as if it were a local

docs/result.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ The following example constructs a `ChatResult` filter that sends the video fram
1010
```java
1111
final Collection<UUID> viewers = ...;
1212
final ChatConfiguration configuration = ChatConfiguration.builder()
13-
.character(Characters.BLACK_SQUARE)
14-
.chatWidth(16).chatHeight(16)
15-
.viewers(viewers)
16-
.build();
13+
.character(Characters.BLACK_SQUARE)
14+
.chatWidth(16).chatHeight(16)
15+
.viewers(viewers)
16+
.build();
1717
final VideoFilter chatResult = new ChatResult(configuration);
1818
```
1919

@@ -35,5 +35,4 @@ For certain players that fall under the `FunctionalPlayer`, like the `EntityPlay
3535
// do some play back
3636
chatResult.release();
3737
```
38-
3938
```

0 commit comments

Comments
 (0)