Skip to content

Commit

Permalink
Merge pull request #36 from trcwm/master
Browse files Browse the repository at this point in the history
Fixed Linux test program build.
  • Loading branch information
vonnieda authored May 7, 2020
2 parents 4a9bd22 + ce6e0a0 commit 71239ab
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ OpenPnP Capture is a cross platform video capture library with a focus on machin
* MAKE (osx, linux)
* Visual Studio 2013 + NMake or Ninja Build (windows)
* NASM for building libjpeg-turbo (linux)
* libgtk-3-dev (linux, test program)

### Build instructions (Windows)
Run the batch file 'bootstrap.bat' and choose the desired build system (VisualStudio/nmake or Ninja). Make sure the compiler (Visual Studio) is in the search path.
Expand Down
5 changes: 3 additions & 2 deletions linux/platformcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ bool PlatformContext::enumerateDevices()
frmindex++;
cinfo.fps = findMaxFrameRate(fd, fmtdesc.pixelformat, cinfo.width, cinfo.height);
dinfo->m_formats.push_back(cinfo);
LOG(LOG_INFO, " %d x %d\n", cinfo.width, cinfo.height);
LOG(LOG_VERBOSE, " %d x %d\n", cinfo.width, cinfo.height);
}
}
index++;
Expand Down Expand Up @@ -207,11 +207,12 @@ uint32_t PlatformContext::findMaxFrameRate(int fd, uint32_t pixelformat,
ivals.width = width;
ivals.height = height;
ivals.index = 0;
LOG(LOG_VERBOSE,"Finding max frame rates: \n");
while (ioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, &ivals) != -1)
{
if (ivals.type == V4L2_FRMIVAL_TYPE_DISCRETE)
{
LOG(LOG_INFO," FPS %d/%d", ivals.discrete.denominator, ivals.discrete.numerator);
LOG(LOG_VERBOSE," FPS %d/%d\n", ivals.discrete.denominator, ivals.discrete.numerator);
uint32_t v = ivals.discrete.denominator/ivals.discrete.numerator;
if (fps < v)
{
Expand Down
4 changes: 2 additions & 2 deletions linux/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ include_directories(../include ..)
add_executable(openpnp-capture-test ${SOURCE})

target_link_libraries(openpnp-capture-test openpnp-capture)
target_link_libraries(openpnp-capture-test turbojpeg)
target_link_libraries(openpnp-capture-test turbojpeg-static)

########################################################
### GTK test application
Expand All @@ -41,5 +41,5 @@ set (SOURCE2 gtkmain.cpp ../../common/logging.cpp)
add_executable(oc-gtk ${SOURCE2})

target_link_libraries(oc-gtk openpnp-capture)
target_link_libraries(oc-gtk turbojpeg)
target_link_libraries(oc-gtk turbojpeg-static)
target_link_libraries(oc-gtk ${GTK3_LIBRARIES})
11 changes: 11 additions & 0 deletions linux/tests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,17 @@ int main(int argc, char*argv[])
std::vector<uint8_t> m_buffer;
m_buffer.resize(finfo.width*finfo.height*3);

printf("Use the following keys:\n");
printf(" +/- : change the exposure\n");
printf(" 0 : set exposure to 0\n");
printf(" f/g : change the focus\n");
printf(" z/x : change the zoom\n");
printf(" [/] : change the white balance\n");
printf(" a/s : change the gain\n");
printf(" p : estimate the frame rate\n");
printf(" w : write one frame to a PPM file\n");
printf(" q : quit\n");

char c = 0;
int32_t v = 0;
uint32_t frameWriteCounter=0;
Expand Down

0 comments on commit 71239ab

Please sign in to comment.