GithubHelp home page GithubHelp logo

zchee / go-mmal Goto Github PK

View Code? Open in Web Editor NEW
16.0 4.0 1.0 144 KB

Raspberry Pi's libmmal bindings for Go

Home Page: https://godoc.org/github.com/zchee/go-mmal

License: Other

Go 98.51% Makefile 0.92% C 0.57%
go mmal raspberry-pi

go-mmal's People

Contributors

zchee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

theapemachine

go-mmal's Issues

Render on top of QT?

Hi,

I've been banging my head against the wall for about 3 days now, and I cannot seem to figure this one out.
I have a QT application and using vcgencmd dispmanx_list I see that this is rendering on layer 1, while the camera preview example for your package is rendering on layer 0.

I really need to get this on top of the QT layer.

I have tried setting the mmal.DisplaySetLayer option and changing some code in the constructor of a DisplayRegion to try and set the layer to 2 (and various other values), but it always remains at 0 with vcgencmd dispmanx_list

Get camera stream or still as a buffer

Hi @zchee,

I've been looking for some go bindings to mmal for a while and I'm happy to have found this.

I'm just wondering how would one go about getting the camera video stream into a buffer (as a raw image or encoded as jpeg) that I can use somewhere else in an application (e.g. get the stream and serve it using mjpeg over http). Or do a simple thing such as taking a still and saving as jpeg/png.

I've been looking at the cmd/preview, but as far as I can tell, this stream the camera output to a window on the screen, or am I wrong?

I've also been looking at RaspiStill.c, but it only confused me further ๐Ÿ˜†

To be honest, I have little to no experience using mmal, so it's a little difficult to understand how to use it.

I'd appreciate a little guidance or some links to some docs as these seem to be scarce.

Cheers,
Roland.

Docs on how to cross-compile

Hi @zchee ,

Just wondering if you have any docs on how to cross-compile a package that uses this lib.

I'm using a Go docker image with gcc-arm-linux-gnueabihf + g++-arm-linux-gnueabihf cross compilers to build my package:

FROM golang:1.13

RUN apt-get update \
  && apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libssl-dev

RUN wget https://github.com/Kitware/CMake/releases/download/v3.16.4/cmake-3.16.4.tar.gz \
  && tar -xzvf cmake-3.16.4.tar.gz \
  && cd cmake-3.16.4 \
  && ./bootstrap \
  && make -j$(nproc) \
  && make install \
  && cmake --version

RUN git clone https://github.com/raspberrypi/userland.git /rpi-sc \
  && cd /rpi-sc \
  && git checkout 06bc6da \
  && ./buildme \
  && cd ./build/arm-linux/release \
  && make install # Because I cannot set the cmake prefix when building, I install everything and use pkg-config from /opt/vc/lib
docker run --rm -v $CWD/tmp/go/pkg/mod:/go/pkg/mod -v "$CWD":/code -w /code \
    -e PKG_CONFIG_PATH=/opt/vc/lib/pkgconfig \
    -e CC=arm-linux-gnueabihf-gcc \
    -e CGO_ENABLED=1 \
    -e GOOS=linux \
    -e GOARCH=arm \
    go-arm go build -o ./bin/cam ./cmd/cam/main.go

But this fails with:

# github.com/zchee/go-mmal
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: warning: libmmal_components.so, needed by /opt/vc/lib/libmmal.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: warning: libvchiq_arm.so, needed by /opt/vc/lib/libmmal.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: warning: libcontainers.so, needed by /opt/vc/lib/libmmal.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libbcm_host.so: undefined reference to `single_get_func_table'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libbcm_host.so: undefined reference to `vchi_service_release'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libmmal_vc_client.so: undefined reference to `vchiq_connect'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libmmal_vc_client.so: undefined reference to `vchiq_initialise_fd'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libbcm_host.so: undefined reference to `vchiq_initialise'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libmmal_vc_client.so: undefined reference to `vchiq_release_service'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libmmal_vc_client.so: undefined reference to `vchiq_release_message'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libbcm_host.so: undefined reference to `vchi_service_open'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libmmal_vc_client.so: undefined reference to `vchiq_use_service'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libbcm_host.so: undefined reference to `vchi_msg_dequeue'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libmmal_vc_client.so: undefined reference to `vchiq_queue_message'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libbcm_host.so: undefined reference to `vchi_service_close'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libbcm_host.so: undefined reference to `vchi_msg_queue'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libbcm_host.so: undefined reference to `vchi_mphi_message_driver_func_table'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libbcm_host.so: undefined reference to `vchi_initialise'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libbcm_host.so: undefined reference to `vchi_bulk_queue_receive'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libbcm_host.so: undefined reference to `vchi_msg_queuev'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libmmal_vc_client.so: undefined reference to `vchiq_shutdown'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libbcm_host.so: undefined reference to `vchi_service_use'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libmmal_vc_client.so: undefined reference to `vchiq_queue_bulk_receive'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libmmal_vc_client.so: undefined reference to `vchiq_queue_bulk_transmit'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libbcm_host.so: undefined reference to `vchi_bulk_queue_transmit'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libmmal_vc_client.so: undefined reference to `vchiq_open_service'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libmmal_vc_client.so: undefined reference to `vchiq_close_service'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libbcm_host.so: undefined reference to `vchi_connect'
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /opt/vc/lib/libbcm_host.so: undefined reference to `vchi_create_connection'
collect2: error: ld returned 1 exit status

Even though I can see that the files it's complaining about are there.

Do you have any clue how to fix that? How are you building your package?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.