Skip to content

Commit

Permalink
v4l2: ignore devices with no channels
Browse files Browse the repository at this point in the history
Change-Id: I3eed29011806d8807d581c572baae8bfdc24e0eb
Tuleap: #486
  • Loading branch information
aberaud authored and Guillaume Roguez committed Mar 18, 2016
1 parent e0fbbb0 commit 88efa70
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/media/video/v4l2/video_device_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,8 @@ VideoDeviceImpl::VideoDeviceImpl(const string& path)
if (input.type & V4L2_INPUT_TYPE_CAMERA) {
VideoV4l2Channel channel(idx, (const char*) input.name);
channel.readFormats(fd);
channels_.push_back(channel);
if (not channel.getSizeList().empty())
channels_.push_back(channel);
}

input.index = ++idx;
Expand Down
2 changes: 1 addition & 1 deletion src/media/video/video_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ class VideoDevice {
* Returns the parameters needed for actual use of the device
*/
DeviceParams getDeviceParams() const;
std::vector<std::string> getChannelList() const;

private:

std::vector<std::string> getChannelList() const;
std::vector<VideoSize> getSizeList(const std::string& channel) const;
std::vector<FrameRate> getRateList(const std::string& channel, VideoSize size) const;

Expand Down
3 changes: 3 additions & 0 deletions src/media/video/video_device_monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ VideoDeviceMonitor::addDevice(const string& node)
// instantiate a new unique device
try {
VideoDevice dev {node};
if (dev.getChannelList().empty())
return;

giveUniqueName(dev, devices_);

// restore its preferences if any, or store the defaults
Expand Down

0 comments on commit 88efa70

Please sign in to comment.