mimas::image_xineinput< T > Class Template Reference
[Image Input]

Class for reading images from a media resource location. More...

#include <image_xineinput.h>

Inheritance diagram for mimas::image_xineinput< T >:

Inheritance graph
[legend]
Collaboration diagram for mimas::image_xineinput< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 image_xineinput (const std::string &_mrl, const char *vo_driver="auto", const char *ao_driver=NULL) throw (mimasexception)
 Constructor.
virtual ~image_xineinput (void)
virtual void read (image< T > &img) throw (mimasexception)
 Read image from media resource.

Protected Attributes

std::string mrl
 Media resource location.
xine_t * xine
 Instance of xine-player.
xine_video_port_t * vo_port
 Video output driver instance.
xine_audio_port_t * ao_port
 Audio output driver instance.
xine_stream_t * stream
 Video stream instance.
int width
int height
int format

Detailed Description

template<typename T>
class mimas::image_xineinput< T >

Class for reading images from a media resource location.

The specified media resource location is opened with libxine. This class is using xine to capture frames from a video source.

Note, that this is not an efficient way to do it, if you just want to display movies. The images are converted to RGB and for displaying, they need to undergo another colorspace conversion.

At the moment, mimas does not support output to a video file. You can use mencoder for this.

    mencoder tv:// -tv driver=v4l:device=/dev/video0:width=640:height=480:norm=PAL:channel=1:input=1 -ovc lavc -nosound -lavcopts vcodec=msmpeg4:vbitrate=4000
    

Grabbing frames from a running video is done like this:

#include <fstream>
#include <GL/glut.h>
#include "image_xineinput.h"
#include "image_mesaoutput.h"

using namespace std;
using namespace mimas;

// Minimal program for accessing video data using libxine.
int main( int argc, char *argv[] )
{
  int retVal = 0;

  try {

    // Note, that this is a very inefficient way to do it, if you just want
    // to display a movie. If you just want to implement a video player, you
    // should allow libxine do write directly to X11 memory!
    // See https://xinehq.de/index.php/hackersguide#AEN80 for more information.

    // Initialise GLUT.
    glutInit( &argc, argv );

    MMERROR( argc == 2, mimasexception, ,
             "Syntax: " << argv[0] << " <media resource location>" );

    // Open X11 display.
    x11_display display;

    // Open video source.
    image_xineinput< rgba< unsigned char > > input( argv[1], "auto", "auto" );

    // Open window.
    image_mesaoutput< rgba< unsigned char > > window( &display );

    // Allocate image.
    image< rgba< unsigned char > > img;

    // Loop for images.
    do {
      
      // Grab image.
      input >> img;

      // Display image.
      window << img << mimas::delay( 100 );
      
    } while ( input );

  } catch ( exception &e ) {

    cerr << e.what() << endl;
    retVal = 1;

  };
  
  return retVal;
}

Author:
Jan Wedekind (jan at wedesoft.de)
Date:
Fri Jan 06 21:22:51 UTC 2006

Definition at line 47 of file image_xineinput.h.


Constructor & Destructor Documentation

template<typename T>
mimas::image_xineinput< T >::image_xineinput ( const std::string &  _mrl,
const char *  vo_driver = "auto",
const char *  ao_driver = NULL 
) throw (mimasexception) [explicit]

Constructor.

The constructor takes a media resource location as argument.

Parameters:
_mrl Media resource location.
vo_driver Video output driver. You can specify \"auto\" here.
ao_driver Audio output driver. You can specify \"auto", if you want audio output.

template<typename T>
virtual mimas::image_xineinput< T >::~image_xineinput ( void   )  [virtual]


Member Function Documentation

template<typename T>
virtual void mimas::image_xineinput< T >::read ( image< T > &  img  )  throw (mimasexception) [virtual]

Read image from media resource.

Parameters:
img Object to store image in.

Implements mimas::image_input< T >.


Member Data Documentation

template<typename T>
std::string mimas::image_xineinput< T >::mrl [protected]

Media resource location.

Definition at line 67 of file image_xineinput.h.

template<typename T>
xine_t* mimas::image_xineinput< T >::xine [protected]

Instance of xine-player.

Definition at line 69 of file image_xineinput.h.

template<typename T>
xine_video_port_t* mimas::image_xineinput< T >::vo_port [protected]

Video output driver instance.

Definition at line 71 of file image_xineinput.h.

template<typename T>
xine_audio_port_t* mimas::image_xineinput< T >::ao_port [protected]

Audio output driver instance.

Definition at line 73 of file image_xineinput.h.

template<typename T>
xine_stream_t* mimas::image_xineinput< T >::stream [protected]

Video stream instance.

Definition at line 75 of file image_xineinput.h.

template<typename T>
int mimas::image_xineinput< T >::width [protected]

Definition at line 77 of file image_xineinput.h.

template<typename T>
int mimas::image_xineinput< T >::height [protected]

Definition at line 79 of file image_xineinput.h.

template<typename T>
int mimas::image_xineinput< T >::format [protected]

Definition at line 81 of file image_xineinput.h.


The documentation for this class was generated from the following file:
[GNU/Linux] [Qt] [Mesa] [STL] [Lapack] [Boost] [Magick++] [Xalan-C and Xerces-C] [doxygen] [graphviz] [FFTW] [popt] [xine] [Gnuplot] [gnu-arch] [gcc] [gstreamer] [autoconf/automake/make] [freshmeat.net] [opensource.org] [sourceforge.net] [MMVL]
mimas 2.1 - Copyright Mon Oct 30 11:31:35 2006, Bala Amavasai, Stuart Meikle, Arul Selvan, Fabio Caparrelli, Jan Wedekind, Manuel Boissenin, ...