GithubHelp home page GithubHelp logo

ofxhapplayer's Introduction

ofxHapPlayer

A Hap player for OpenFrameworks on macOS, Windows and Linux.

Hap is a codec for fast video playback. You can learn more about Hap, and find codecs for encoding, at the main Hap project.

Installation

This repo has branches for major OF versions. Use the branch which matches the version of OF you are using. The master branch matches the current OF release.

For example, if you want to use the addon with OpenFrameworks 0.9.x:

$ cd addons/ofxHapPlayer
$ git checkout OpenFrameworks-0.9

Linux Requirements

This step is only necessary on Linux. On macOS and Windows, the required libraries are bundled with the addon.

On Linux, ofxHapPlayer uses system libraries. For Ubuntu, the following packages are required:

libsnappy-dev, libswresample-dev, libavcodec-dev, libavformat-dev, libdispatch-dev

sudo apt-get install libsnappy-dev libswresample-dev libavcodec-dev libavformat-dev libdispatch-dev

Note that the Raspberry Pi does not support the compressed texture formats used by Hap, so you can't use this addon on a Raspberry Pi.

Pull-requests with instructions for other distributions are welcomed.

Usage

Use the OF Project Generator to generate build files for your project, selecting ofxHapPlayer as an addon.

#import "ofxHapPlayer.h"

ofxHapPlayer inherits from ofBaseVideoPlayer

player.loadMovie("movies/MyMovieName.mov");

When you want to draw:

player.draw(20, 20);

Note that there is no direct access to pixels and calls to getPixels() will return NULL.

Advanced Usage

You can access the texture directly:

ofTexture *texture = player.getTexture();

Note that if you access the texture directly for a Hap Q movie, you will need to use a shader when you draw:

ofShader *shader = player.getShader();
// the result of getShader() will be NULL if the movie is not Hap Q
if (shader)
{
    shader->begin();
}
texture.draw(x,y,w,h);
if (shader)
{
    shader->end();
}

Credits and License

ofxHapPlayer was written by Tom Butterworth, initially in April 2013, supported by Igloo Vision and James Sheridan. Since then it has been supported by Vidvox. It is released under a FreeBSD License.

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.