Skip to content

Commit b793d61

Browse files
committed
Fix vlcj option names (v4l2 instead of v4l)
1 parent 21b1bfd commit b793d61

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

webcam-capture-drivers/driver-vlcj/src/example/java/VlcjDirectTest.java

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -98,33 +98,37 @@ public static void main(String[] args) throws IOException, InterruptedException
9898
@Override
9999
public void display(DirectMediaPlayer player, Memory[] buffers, BufferFormat format) {
100100

101-
BufferedImage bi = convert(buffers, format);
102-
try {
103-
ImageIO.write(bi, "JPG", new File(System.currentTimeMillis() + "-test.jpg"));
104-
} catch (IOException e) {
105-
e.printStackTrace();
106-
}
101+
if (i++ < 10) {
107102

108-
System.out.println("write " + i);
103+
BufferedImage bi = convert(buffers, format);
104+
try {
105+
ImageIO.write(bi, "JPG", new File(System.currentTimeMillis() + "-test.jpg"));
106+
} catch (IOException e) {
107+
e.printStackTrace();
108+
}
109109

110-
if (i++ > 10) {
111-
player.stop();
112-
System.exit(0);
110+
System.out.println("write " + i);
113111
}
114112
}
115113
});
116114

117115
String device = "/dev/video0";
118116
String mrl = "v4l2://" + device;
119117
String[] options = new String[] {
120-
":v4l-vdev=" + device,
121-
":v4l-width=320", // XXX this setting does not have any effect!
122-
":v4l-height=240", // XXX this setting does not have any effect!
123-
":v4l-fps=30",
124-
":v4l-quality=20",
125-
":v4l-adev=none",
118+
":v4l2-vdev=" + device,
119+
":v4l2-width=320",
120+
":v4l2-height=240",
121+
":v4l2-fps=30",
122+
":v4l2-quality=20",
123+
":v4l2-adev=none",
126124
};
127125

128126
player.startMedia(mrl, options);
127+
128+
Thread.sleep(1000);
129+
130+
player.stop();
131+
player.release();
132+
factory.release();
129133
}
130134
}

0 commit comments

Comments
 (0)