Enumerate more cameras in same dshowvideosrc device-name=""
krt
krthome at gmail.com
Wed Dec 3 08:11:21 PST 2014
Hi guys,
weird situation, I have 4 cameras plugged-in and all of them are on the same
device-name="Basler GenICam Source".
If I create 4 pipelines and start them working it allways gets one of the
cams randomly without any order.
Question: How could I specify which one I want to access?
Plugged cameras (screenshot from AMCap):
http://img15.rajce.idnes.cz/d1503/2/2220/2220095_4e4fe55b806f789b92479d16939c1a09/images/kamery.jpg?ver=2
Source code:
static {
Gst.init("VideoTest", new String[]{});
}
private ZoomPanelModel[] model;
private static Pipeline[] pipe;
public void start() {
JFrame frame = new JFrame("4Cams");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new GridLayout(2, 2, 10, 10));
pipe = new Pipeline[count];
JComponent[] vids = new JComponent[count];
for (int i = 0; i < count; i++) {
vids[i] = start0(i);
frame.add(vids[i]);
}
frame.pack();
frame.setVisible(true);
}
public JComponent start0(int pos) {
pipe[pos] = new Pipeline("VideoTest" + pos);
final Element videosrc0 = ElementFactory.make("dshowvideosrc", "source");
videosrc0.setCaps(Caps.fromString("video/x-raw-yuv, width=200,
height=200"));
final Element resize0 = ElementFactory.make("videoscale", "scaler");
final Element filter0 = ElementFactory.make("capsfilter", "filter");
filter0.setCaps(Caps.fromString("video/x-raw-yuv, width=200, height=200"));
// First one
VideoComponent videoComponent0 = new VideoComponent();
videoComponent0.setPreferredSize(new Dimension(200, 200));
Element videosink = videoComponent0.getElement();
pipe[pos].addMany(videosrc0, resize0, filter0, videosink);
Element.linkMany(videosrc0, resize0, filter0, videosink);
// Start the pipeline processing
pipe[pos].setState(State.PLAYING);
return videoComponent0;
}
Quick launch via command line:
- I experimented if name="" means something, but it seems it doesn't.
Randomly picked up anyway...
gst-launch dshowvideosrc device-name="Basler GenICam Source" name=source0 !
dshowvideosink
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Enumerate-more-cameras-in-same-dshowvideosrc-device-name-tp4669790.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list