#include <image_xineinput.h>
Inheritance diagram for mimas::image_xineinput< T >:
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 |
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 http://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; }
Definition at line 47 of file image_xineinput.h.
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.
_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. |
virtual mimas::image_xineinput< T >::~image_xineinput | ( | void | ) | [virtual] |
virtual void mimas::image_xineinput< T >::read | ( | image< T > & | img | ) | throw (mimasexception) [virtual] |
Read image from media resource.
img | Object to store image in. |
Implements mimas::image_input< T >.
std::string mimas::image_xineinput< T >::mrl [protected] |
xine_t* mimas::image_xineinput< T >::xine [protected] |
xine_video_port_t* mimas::image_xineinput< T >::vo_port [protected] |
xine_audio_port_t* mimas::image_xineinput< T >::ao_port [protected] |
xine_stream_t* mimas::image_xineinput< T >::stream [protected] |
int mimas::image_xineinput< T >::width [protected] |
Definition at line 77 of file image_xineinput.h.
int mimas::image_xineinput< T >::height [protected] |
Definition at line 79 of file image_xineinput.h.
int mimas::image_xineinput< T >::format [protected] |
Definition at line 81 of file image_xineinput.h.