Advertisement
Guest User

arturo

a guest
Aug 21st, 2009
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.14 KB | None | 0 0
  1. //testApp.h
  2. class testApp : public ofBaseApp{
  3.  
  4.    public:
  5.  
  6.       void setup();
  7.       void update();
  8.       void draw();
  9.  
  10.       void keyPressed  (int key);
  11.       void mouseMoved(int x, int y );
  12.       void mouseDragged(int x, int y, int button);
  13.       void mousePressed(int x, int y, int button);
  14.       void mouseReleased(int x, int y, int button);
  15.       void windowResized(int w, int h);
  16.  
  17.  
  18.       ofGstUtils gst;
  19.       ofTexture tex;
  20.  
  21. };
  22.  
  23.  
  24. //testApp.cpp
  25.  
  26. //--------------------------------------------------------------
  27. void testApp::setup(){
  28.  
  29.     ofSetLogLevel(OF_LOG_VERBOSE);
  30.  
  31.    bool allocated = gst.setPipeline("udpsrc port=5000 ! video/mpeg, width=320, height=240, framerate=5/1 ! ffdec_mpeg4 ! ffmpegcolorspace ");
  32.    cout << (allocated?"allocated":"not allocated") << endl;
  33.    tex.allocate(320,240,GL_RGB);
  34.    gst.play();
  35.  
  36. }
  37.  
  38. //--------------------------------------------------------------
  39. void testApp::update(){
  40.     gst.update();
  41.     if(gst.isFrameNew()){
  42.         tex.loadData(gst.getPixels(),320,240,GL_RGB);
  43.     }
  44. }
  45.  
  46. //--------------------------------------------------------------
  47. void testApp::draw(){
  48.  
  49.  tex.draw(20,20);
  50. }
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement