ofxGStreamer can play movie with alpha.

it doesn’t contain code.  only setting.

need to install gstreamer.

check under site.

https://github.com/arturoc/ofxGStreamer

 

#include "ofApp.h"

#include "ofGstVideoPlayer.h"

//--------------------------------------------------------------
void ofApp::setup(){

    player.setPlayer(ofPtr<ofGstVideoPlayer>(new ofGstVideoPlayer));
    player.setPixelFormat(OF_PIXELS_BGRA);
    player.loadMovie("alpha.mov");
    player.play();
}

//--------------------------------------------------------------
void ofApp::update(){

    player.update();

}

//--------------------------------------------------------------
void ofApp::draw(){

    ofBackground(255,0,0);
	player.draw(0,0);

}

//--------------------------------------------------------------
void ofApp::keyPressed(int key){

    if(key==0x31){
        player.loadMovie("alpha.mov");
        player.play();
    }
    else if(key==0x32){
        player.stop();
        player.close();
    }

}
#pragma once

#include "ofMain.h"

class ofApp : public ofBaseApp{

	public:
		void setup();
		void update();
		void draw();

		void keyPressed(int key);
		void keyReleased(int key);
		void mouseMoved(int x, int y );
		void mouseDragged(int x, int y, int button);
		void mousePressed(int x, int y, int button);
		void mouseReleased(int x, int y, int button);
		void mouseEntered(int x, int y);
		void mouseExited(int x, int y);
		void windowResized(int w, int h);
		void dragEvent(ofDragInfo dragInfo);
		void gotMessage(ofMessage msg);
		
    ofVideoPlayer player;

};

 

 

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です