1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can't get the Hyperion Java protobuf client to compile

Discussion in 'Development' started by kaiomatico, 14 April 2018.

  1. kaiomatico

    kaiomatico New Member

    Messages:
    2
    Hardware:
    RPi3, +Arduino
    Hey everyone, I'm trying to compile the the example code from this site: https://hyperion-project.org/wiki/Protobuffer-Java-client-example

    I'm using eclipse and I installed protobuf-dt, but I can't figure out how to properly do the imports and use protoc on the definition file. It can't find:
    import com.google.protobuf.ByteString;
    import proto.*; ...

    As a background story: I want to create a Java Hyperion Screen grabber for use in Windows which relies on screenshots rather than DirectX 9 or DirectX 11 because that way I can skip HDCP/DRM/Copy protection of Netflix 4k and the Xbox One streaming app. Here is my code I want to add to the protobuf client example in a loop:

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
    BufferedImage capture = new Robot().createScreenCapture(screenRect);
    ImageIO.write(capture, "jpg", baos);
    byte[] imageData = baos.toByteArray();
    -> send to hyperion

    Would be great if someone could help me with setting up my eclipse!
     
  2. abrenoch

    abrenoch Member

    Messages:
    66
    Hardware:
    RPi1/Zero, RPi2
    Not sure how much help this will be, but I was able to get the protobuf code working in android studio (which I think is similar to eclipse). You can check out the repository for it here:

    https://github.com/abrenoch/hyperion-android-grabber

    I used the gradle plugin to generate my protobuf classes, but wave also used to command line tool from google as well. The gradle version was a bit of a PITA to set up, but it did work in the end.

    Good luck!

    EDIT: In my experience you may need to do some bit manipulation to produce the byte array in the exact format that hyperion is expecting, but you can find that in there too!