1 /*! ========================================================================
4 ** $Id: mptr_mplayer.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $
6 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
8 ** This software and associated documentation
9 ** are CONFIDENTIAL and PROPRIETARY property of
10 ** the above-mentioned copyright holder.
12 ** You may not copy, print, publish, or in any
13 ** other way distribute this software without
14 ** a prior written agreement with
15 ** the copyright holder.
17 ** === N O T E S ===========================================================
19 ** ========================================================================= */
21 /* === H E A D E R S ======================================================= */
30 #include <sinfg/sinfg.h>
31 #include <ETL/stringf>
32 #include "mptr_mplayer.h"
37 #include <ETL/stringf>
40 /* === M A C R O S ========================================================= */
42 using namespace sinfg;
46 /* === G L O B A L S ======================================================= */
48 const char mplayer_mptr::Name[]="avi";
49 const char mplayer_mptr::Ext[]="avi";
51 /* === M E T H O D S ======================================================= */
54 mplayer_mptr::New(const char *file)
56 return new mplayer_mptr(file);
59 mplayer_mptr::mplayer_mptr(const char *file)
64 mplayer_mptr::~mplayer_mptr()
69 mplayer_mptr::GetFrame(Time time, sinfg::Surface &surface, sinfg::ProgressCallback *)
73 strprintf("/usr/local/bin/mencoder \"%s\" -ovc rawrgb -ss %f -endpos 0 -nosound -o /tmp/tmp.sinfg.rgbdata | grep \"VIDEO\" > /tmp/tmp.sinfg.size",
81 cerr<<"mencoder execution failed."<<endl;
85 FILE *sizefile=fopen("/tmp/tmp.sinfg.size","rt");
86 FILE *rgbfile=fopen("/tmp/tmp.sinfg.rgbdata","rb");
89 cerr<<"unable to open /tmp/tmp.sinfg.rgbdata"<<endl;
94 cerr<<"unable to open /tmp/tmp.sinfg.size"<<endl;
101 fscanf(sizefile,"%s %s %dx%d",bleh,bleh,&w,&h);
103 cerr<<strprintf("w:%d, h:%d, time:%f",w,h,time)<<endl;
104 fseek(rgbfile,2047+3*8,SEEK_CUR);
110 b=(unsigned char)fgetc(rgbfile),
111 g=(unsigned char)fgetc(rgbfile),
112 r=(unsigned char)fgetc(rgbfile);
114 surface[h-y-1][x]=Color(