- Reestructuración de ficheros y directorios general

- merge v0.01 --> Añadido fileselector
- Añadidas fuentes de Gem y Pure Data
- pix2jpg incluído en Gem. Archivos de construcción de Gem modificados.
- Añadido fichero ompiling.txt con instrucciones de compilación
This commit is contained in:
Santi Noreña 2013-02-04 18:00:17 +01:00
parent c9adfd020b
commit e85d191b46
3100 changed files with 775434 additions and 3073 deletions

View file

@ -0,0 +1,34 @@
ACLOCAL_AMFLAGS = -I $(top_srcdir)/m4
AM_CPPFLAGS = -I$(top_srcdir)/src @GEM_EXTERNAL_CPPFLAGS@
pkglib_LTLIBRARIES=
if HAVE_LIB_AVIFILE
pkglib_LTLIBRARIES+= gem_filmAVIPLAY.la
endif
gem_filmAVIPLAY_la_CXXFLAGS =
gem_filmAVIPLAY_la_LDFLAGS = -module -avoid-version -shared
if WINDOWS
gem_filmAVIPLAY_la_LDFLAGS += -no-undefined
endif
gem_filmAVIPLAY_la_LIBADD =
# RTE
gem_filmAVIPLAY_la_CXXFLAGS += @GEM_RTE_CFLAGS@ @GEM_ARCH_CXXFLAGS@
gem_filmAVIPLAY_la_LDFLAGS += @GEM_RTE_LIBS@ @GEM_ARCH_LDFLAGS@
# flags for building Gem externals
gem_filmAVIPLAY_la_CXXFLAGS += @GEM_EXTERNAL_CFLAGS@
gem_filmAVIPLAY_la_LIBADD += -L$(top_builddir) @GEM_EXTERNAL_LIBS@
# gem_filmAVIPLAY_la @MOREFLAGS@
# Dependencies
gem_filmAVIPLAY_la_CXXFLAGS += @GEM_LIB_AVIFILE_CFLAGS@
gem_filmAVIPLAY_la_LIBADD += @GEM_LIB_AVIFILE_LIBS@
# convenience symlinks
include $(srcdir)/../symlink_ltlib.mk
### SOURCES
gem_filmAVIPLAY_la_SOURCES= filmAVIPLAY.cpp filmAVIPLAY.h

View file

@ -0,0 +1,215 @@
////////////////////////////////////////////////////////
//
// GEM - Graphics Environment for Multimedia
//
// zmoelnig@iem.kug.ac.at
//
// Implementation file
//
// Copyright (c) 1997-1999 Mark Danks.
// Copyright (c) Günther Geiger.
// Copyright (c) 2001-2011 IOhannes m zmölnig. forum::für::umläute. IEM. zmoelnig@iem.at
// For information on usage and redistribution, and for a DISCLAIMER OF ALL
// WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
//
/////////////////////////////////////////////////////////
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_LIBAVIPLAY
#include "filmAVIPLAY.h"
#include "plugins/PluginFactory.h"
#include "Gem/Properties.h"
using namespace gem::plugins;
REGISTER_FILMFACTORY("aviplay", filmAVIPLAY);
#include <unistd.h>
#include <time.h>
/////////////////////////////////////////////////////////
//
// filmAVIPLAY
//
/////////////////////////////////////////////////////////
// Constructor
//
/////////////////////////////////////////////////////////
filmAVIPLAY :: filmAVIPLAY(void) :
m_wantedFormat(GL_RGBA),
m_fps(-1.0),
m_numFrames(-1), m_numTracks(-1),
m_curFrame(-1), m_curTrack(-1),
m_readNext(false), m_newfilm(false),
m_avifile(NULL),
m_avistream(NULL),
m_aviimage(NULL),
m_rawdata(NULL),
m_rawlength(0)
{
}
/////////////////////////////////////////////////////////
// Destructor
//
/////////////////////////////////////////////////////////
filmAVIPLAY :: ~filmAVIPLAY(void)
{
close();
if(m_rawdata)delete[]m_rawdata;
}
void filmAVIPLAY :: close(void)
{
if (m_avistream)(*m_avistream).StopStreaming();
}
/////////////////////////////////////////////////////////
// open the file
//
/////////////////////////////////////////////////////////
bool filmAVIPLAY :: open(const std::string filename, const gem::Properties&wantProps)
{
double d;
if(wantProps.get("colorspace", d) && d>0) {
m_wantedFormat=d;
}
// how do we close the avifile ??? automagically ?
if (!(m_avifile = CreateIAviReadFile(filename.c_str())))goto unsupported;
while(!(*m_avifile).IsOpened()){
struct timeval sleep;
sleep.tv_sec=0;
sleep.tv_usec=500;/*500us*/
select(0,0,0,0,&sleep);
}
if (!(*m_avifile).IsValid())goto unsupported;
m_numTracks = (*m_avifile).VideoStreamCount();
if (m_numTracks<1)return false;
if (m_curTrack>=m_numTracks)m_curTrack = 0;
try {
m_avistream=(*m_avifile).GetStream(m_curTrack, avm::IStream::StreamType(1));
} catch (const char* string) {
m_avistream = 0;
}
if (!m_avistream)goto unsupported;
if ((*m_avistream).StartStreaming()==-1)goto unsupported;
m_numFrames = (*m_avistream).GetLength();
m_curFrame = -1;
if (1){
avm::StreamInfo *l_info = (*m_avistream).GetStreamInfo();
m_image.image.xsize = (*l_info).GetVideoWidth();
m_image.image.ysize = (*l_info).GetVideoHeight();
m_fps= (*l_info).GetFps();
}
m_image.image.setCsizeByFormat(m_wantedFormat);
if (!(m_image.image.xsize*m_image.image.ysize*m_image.image.csize))goto unsupported;
m_readNext=true;
m_newfilm = true;
return true;
goto unsupported;
unsupported:
close();
return false;
}
/////////////////////////////////////////////////////////
// render
//
/////////////////////////////////////////////////////////
pixBlock* filmAVIPLAY :: getFrame(){
if (!m_avistream)return 0;
if (!m_readNext)return &m_image;
if(m_aviimage)(*m_aviimage).Release();
/* for MPEGs ReadFrame() will return 0 only when errors occur
* other formats return 0 all the time (and -1 on file end)
*/
m_aviimage = (*m_avistream).GetFrame(true); // this might crash sometimes...
if (m_aviimage){
int format = (*m_aviimage).Format();
m_rawdata=(*m_aviimage).Data();
m_image.image.setCsizeByFormat(m_wantedFormat);
switch(format){
case IMG_FMT_RGB24: m_image.image.fromRGB (m_rawdata); break;
case IMG_FMT_RGB32: m_image.image.fromRGBA(m_rawdata); break;
case IMG_FMT_BGR24: m_image.image.fromBGR (m_rawdata); break;
case IMG_FMT_BGR32: m_image.image.fromBGRA(m_rawdata); break;
case IMG_FMT_Y800 :
case IMG_FMT_Y8 : m_image.image.fromGray(m_rawdata); break;
case IMG_FMT_UYVY : m_image.image.fromUYVY(m_rawdata); break;
case IMG_FMT_YUY2 : m_image.image.fromYUY2(m_rawdata); break;
case IMG_FMT_YVYU : m_image.image.fromYVYU(m_rawdata); break;
case IMG_FMT_YV12 : m_image.image.fromYV12(m_rawdata); break;
case IMG_FMT_BGR16: // it seems like this was RGB16
default:
m_image.image.fromRGB16(m_rawdata); break;
}
m_image.newimage=1;
if (m_newfilm)m_image.newfilm=1; m_newfilm=false;
m_image.image.upsidedown=true;
m_readNext=false;
return &m_image;
}
return 0;
}
film::errCode filmAVIPLAY :: changeImage(int imgNum, int trackNum){
if (!m_avistream)return film::FAILURE;
m_avistream->Seek(imgNum);
m_readNext=true;
return film::SUCCESS;
}
///////////////////////////////
// Properties
bool filmAVIPLAY::enumProperties(gem::Properties&readable,
gem::Properties&writeable) {
readable.clear();
writeable.clear();
gem::any value;
value=0.;
readable.set("fps", value);
readable.set("frames", value);
readable.set("width", value);
readable.set("height", value);
return false;
}
void filmAVIPLAY::setProperties(gem::Properties&props) {
}
void filmAVIPLAY::getProperties(gem::Properties&props) {
std::vector<std::string> keys=props.keys();
gem::any value;
double d;
unsigned int i=0;
for(i=0; i<keys.size(); i++) {
std::string key=keys[i];
props.erase(key);
if("fps"==key) {
d=m_fps;
value=d; props.set(key, value);
}
if("frames"==key && m_numFrames>=0) {
d=m_numFrames;
value=d; props.set(key, value);
}
if("tracks"==key && m_numTracks>=0) {
d=m_numTracks;
value=d; props.set(key, value);
}
if("width"==key) {
d=m_image.image.xsize;
value=d; props.set(key, value);
}
if("height"==key) {
d=m_image.image.ysize;
value=d; props.set(key, value);
}
}
}
#endif // AVIPLAY

View file

@ -0,0 +1,120 @@
/* -----------------------------------------------------------------
GEM - Graphics Environment for Multimedia
Load an digital video (like AVI, Mpeg, Quicktime) into a pix block
(OS independant parent-class)
Copyright (c) 1997-1999 Mark Danks. mark@danks.org
Copyright (c) Günther Geiger. geiger@epy.co.at
Copyright (c) 2001-2011 IOhannes m zmölnig. forum::für::umläute. IEM. zmoelnig@iem.at
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
-----------------------------------------------------------------*/
#ifndef _INCLUDE_GEMPLUGIN__FILMAVIPLAY_FILMAVIPLAY_H_
#define _INCLUDE_GEMPLUGIN__FILMAVIPLAY_FILMAVIPLAY_H_
#include "plugins/film.h"
#include "Gem/Image.h"
#if defined (_WIN32) & defined (HAVE_LIBAVIPLAY)
// un windows there are other ways...
#undef HAVE_LIBAVIPLAY
#endif
#ifdef HAVE_LIBAVIPLAY
/* this used to be <avifile/avifile.h>
* but on my system it changed to <avifile-0.7/avifile.h>
* so we now find the correct path via "configure"
*/
// ugly hack, since avifile.h does weird things if HAVE_CONFIG_H is defined
# undef HAVE_CONFIG_H
# include "avifile.h"
# include "infotypes.h"
# include "image.h"
// some version checking...
# ifndef IMG_FMT_RGB24
# undef HAVE_LIBAVIPLAY
# endif // IMG_FMT_RGB24
#endif
/*-----------------------------------------------------------------
-------------------------------------------------------------------
CLASS
filmAVIPLAY
film-loader class for AVIPLAY(linux)
KEYWORDS
pix film movie
DESCRIPTION
-----------------------------------------------------------------*/
namespace gem { namespace plugins {
class GEM_EXPORT filmAVIPLAY : public film {
public:
//////////
// Constructor
filmAVIPLAY(void);
//////////
// Destructor
~filmAVIPLAY(void);
#ifdef HAVE_LIBAVIPLAY
//////////
// open a movie up
virtual bool open(const std::string filename, const gem::Properties&);
//////////
// close the movie file
virtual void close(void);
//////////
// get the next frame
virtual pixBlock* getFrame(void);
//////////
// set the next frame to read;
virtual errCode changeImage(int imgNum, int trackNum=-1);
// can be used within a threaded context
virtual bool isThreadable(void) { return true; }
// Property handling
virtual bool enumProperties(gem::Properties&readable,gem::Properties&writeable);
virtual void setProperties(gem::Properties&props);
virtual void getProperties(gem::Properties&props);
protected:
GLenum m_wantedFormat; // format requested by the user
double m_fps; // the frame-rate
int m_numFrames, m_numTracks; // number of frames in video
int m_curFrame, m_curTrack;
pixBlock m_image; // output image
bool m_readNext; // indicates whether we should perform a seek/read
bool m_newfilm;
IAviReadFile *m_avifile;
IAviReadStream *m_avistream;
# ifdef AVM_BEGIN_NAMESPACE
avm::CImage *m_aviimage;
# else
CImage *m_aviimage;
# endif
#endif //AVIPLAY
unsigned char *m_rawdata;
long m_rawlength;
};};};
#endif // for header file