- 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:
parent
c9adfd020b
commit
e85d191b46
3100 changed files with 775434 additions and 3073 deletions
39
Gem/plugins/filmQT4L/Makefile.am
Normal file
39
Gem/plugins/filmQT4L/Makefile.am
Normal file
|
@ -0,0 +1,39 @@
|
|||
|
||||
ACLOCAL_AMFLAGS = -I $(top_srcdir)/m4
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/src @GEM_EXTERNAL_CPPFLAGS@
|
||||
|
||||
pkglib_LTLIBRARIES=
|
||||
|
||||
if HAVE_LIB_LIBQUICKTIME
|
||||
pkglib_LTLIBRARIES+= gem_filmQT4L.la
|
||||
endif
|
||||
if HAVE_LIB_LQT
|
||||
pkglib_LTLIBRARIES+= gem_filmQT4L.la
|
||||
endif
|
||||
|
||||
gem_filmQT4L_la_CXXFLAGS =
|
||||
gem_filmQT4L_la_LDFLAGS = -module -avoid-version -shared
|
||||
if WINDOWS
|
||||
gem_filmQT4L_la_LDFLAGS += -no-undefined
|
||||
endif
|
||||
gem_filmQT4L_la_LIBADD =
|
||||
|
||||
# RTE
|
||||
gem_filmQT4L_la_CXXFLAGS += @GEM_RTE_CFLAGS@ @GEM_ARCH_CXXFLAGS@
|
||||
gem_filmQT4L_la_LDFLAGS += @GEM_RTE_LIBS@ @GEM_ARCH_LDFLAGS@
|
||||
# flags for building Gem externals
|
||||
gem_filmQT4L_la_CXXFLAGS += @GEM_EXTERNAL_CFLAGS@
|
||||
gem_filmQT4L_la_LIBADD += -L$(top_builddir) @GEM_EXTERNAL_LIBS@
|
||||
# gem_filmQT4L_la @MOREFLAGS@
|
||||
|
||||
# Dependencies
|
||||
gem_filmQT4L_la_CXXFLAGS += @GEM_LIB_LIBQUICKTIME_CFLAGS@ @GEM_LIB_LQT_CFLAGS@
|
||||
gem_filmQT4L_la_LIBADD += @GEM_LIB_LIBQUICKTIME_LIBS@ @GEM_LIB_LQT_LIBS@
|
||||
|
||||
# convenience symlinks
|
||||
include $(srcdir)/../symlink_ltlib.mk
|
||||
|
||||
|
||||
### SOURCES
|
||||
gem_filmQT4L_la_SOURCES= filmQT4L.cpp filmQT4L.h
|
||||
|
246
Gem/plugins/filmQT4L/filmQT4L.cpp
Normal file
246
Gem/plugins/filmQT4L/filmQT4L.cpp
Normal file
|
@ -0,0 +1,246 @@
|
|||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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_LIBQUICKTIME
|
||||
|
||||
#include "filmQT4L.h"
|
||||
#include "plugins/PluginFactory.h"
|
||||
#include "Gem/Properties.h"
|
||||
#include "Gem/RTE.h"
|
||||
|
||||
using namespace gem::plugins;
|
||||
|
||||
#include <colormodels.h>
|
||||
|
||||
REGISTER_FILMFACTORY("quicktime4linux", filmQT4L);
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
//
|
||||
// filmQT4L
|
||||
//
|
||||
/////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
//
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
filmQT4L :: filmQT4L(void) :
|
||||
m_wantedFormat(GL_RGBA),
|
||||
m_fps(-1.0),
|
||||
m_numFrames(-1), m_numTracks(-1),
|
||||
m_curFrame(-1), m_curTrack(0),
|
||||
m_newfilm(false),
|
||||
m_quickfile(NULL),
|
||||
m_qtformat(0),
|
||||
m_lastFrame(0)
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// Destructor
|
||||
//
|
||||
/////////////////////////////////////////////////////////
|
||||
filmQT4L :: ~filmQT4L()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
void filmQT4L :: close(void)
|
||||
{
|
||||
if(m_quickfile)quicktime_close(m_quickfile);
|
||||
m_quickfile=0;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// really open the file ! (OS dependent)
|
||||
//
|
||||
/////////////////////////////////////////////////////////
|
||||
bool filmQT4L :: open(const std::string filename, const gem::Properties&wantProps)
|
||||
{
|
||||
int wantedFormat=GL_RGBA;
|
||||
double d;
|
||||
unsigned int format=0;
|
||||
if(wantProps.get("format", d)) {
|
||||
format=d;
|
||||
}
|
||||
switch(format){
|
||||
default:
|
||||
break;
|
||||
case GL_RGBA:
|
||||
case GL_YCBCR_422_GEM:
|
||||
case GL_LUMINANCE:
|
||||
m_wantedFormat=format;
|
||||
break;
|
||||
}
|
||||
|
||||
char*cfilename=const_cast<char*>(filename.c_str());
|
||||
if (quicktime_check_sig(cfilename)){ /* ok, this is quicktime */
|
||||
if (!(m_quickfile = quicktime_open(filename.c_str(), 1, 0))){
|
||||
// post("filmQT4L: Unable to open file: %s", filename.c_str());
|
||||
return false;
|
||||
}
|
||||
m_curFrame = -1;
|
||||
|
||||
// Get the number of tracks
|
||||
m_numTracks = quicktime_video_tracks(m_quickfile);
|
||||
// Get the length of the movie (on track current track)
|
||||
m_numFrames = quicktime_video_length(m_quickfile, m_curTrack) - 1;
|
||||
// Get the frame-rate
|
||||
m_fps = quicktime_frame_rate(m_quickfile, m_curTrack);
|
||||
// Get the video dimensions
|
||||
m_image.image.xsize = quicktime_video_width (m_quickfile, m_curTrack);
|
||||
m_image.image.ysize = quicktime_video_height(m_quickfile, m_curTrack);
|
||||
if (!quicktime_supported_video(m_quickfile, m_curTrack)){
|
||||
// char *codec = quicktime_video_compressor(m_quickfile, m_curTrack);
|
||||
// post("filmQT4L: unsupported CODEC '%s'!", codec);
|
||||
quicktime_close(m_quickfile);
|
||||
m_quickfile=0;
|
||||
return false;
|
||||
}
|
||||
m_image.image.setCsizeByFormat(wantedFormat);
|
||||
m_image.image.reallocate();
|
||||
|
||||
m_qtimage.xsize=m_image.image.xsize;
|
||||
m_qtimage.ysize=m_image.image.ysize;
|
||||
#ifdef __APPLE__
|
||||
m_qtimage.setCsizeByFormat(GL_BGR);
|
||||
#else
|
||||
m_qtimage.setCsizeByFormat(GL_RGB);
|
||||
#endif
|
||||
m_qtimage.reallocate();
|
||||
|
||||
m_newfilm = true;
|
||||
return true;
|
||||
}
|
||||
goto unsupported;
|
||||
unsupported:
|
||||
close();
|
||||
return false;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// render
|
||||
//
|
||||
/////////////////////////////////////////////////////////
|
||||
pixBlock* filmQT4L :: getFrame(){
|
||||
int i=m_image.image.ysize;
|
||||
if (m_lastFrame==m_curFrame &&
|
||||
m_image.image.format==m_wantedFormat)
|
||||
{
|
||||
m_image.newimage=0;
|
||||
return &m_image;
|
||||
}
|
||||
|
||||
m_image.image.setCsizeByFormat(m_wantedFormat);
|
||||
m_image.image.reallocate();
|
||||
|
||||
pixBlock* pimage = 0;
|
||||
unsigned char **rows = new unsigned char*[m_image.image.ysize];
|
||||
while(i--)rows[i]=m_qtimage.data+m_qtimage.xsize*m_qtimage.csize*(m_qtimage.ysize-i-1);
|
||||
|
||||
m_lastFrame=m_curFrame;
|
||||
|
||||
if (quicktime_decode_video(m_quickfile, rows, m_curTrack)) {
|
||||
post("filmQT4L:: couldn't decode video !");
|
||||
}else {
|
||||
m_image.image.convertFrom(&m_qtimage);
|
||||
m_image.newimage=1; m_image.image.upsidedown=false;
|
||||
pimage = &m_image;
|
||||
if(m_newfilm)m_image.newfilm=1;
|
||||
m_newfilm=false;
|
||||
}
|
||||
delete[] rows;
|
||||
return pimage;
|
||||
}
|
||||
|
||||
film::errCode filmQT4L :: changeImage(int imgNum, int trackNum){
|
||||
if(imgNum>m_numFrames || imgNum<0)return film::FAILURE;
|
||||
if (imgNum>0)m_curFrame=imgNum;
|
||||
if(trackNum>0)m_curTrack=trackNum;
|
||||
|
||||
int i=-1;
|
||||
#ifdef HAVE_QUICKTIME_SEEK_VIDEO
|
||||
lqt_seek_video (m_quickfile, m_curTrack, m_curFrame, m_curTrack);
|
||||
#else
|
||||
if ((i=quicktime_set_video_position(m_quickfile, m_curFrame, m_curTrack))){ }
|
||||
#endif
|
||||
return film::SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////////
|
||||
// Properties
|
||||
bool filmQT4L::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("tracks", value);
|
||||
readable.set("width", value);
|
||||
readable.set("height", value);
|
||||
|
||||
writeable.set("colorspace", value);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void filmQT4L::setProperties(gem::Properties&props) {
|
||||
double d;
|
||||
if(props.get("colorspace", d)) {
|
||||
m_wantedFormat=d;
|
||||
}
|
||||
}
|
||||
|
||||
void filmQT4L::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) {
|
||||
d=m_numFrames;
|
||||
value=d; props.set(key, value);
|
||||
}
|
||||
if("tracks"==key) {
|
||||
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 // QT4L
|
92
Gem/plugins/filmQT4L/filmQT4L.h
Normal file
92
Gem/plugins/filmQT4L/filmQT4L.h
Normal file
|
@ -0,0 +1,92 @@
|
|||
/*-----------------------------------------------------------------
|
||||
|
||||
GEM - Graphics Environment for Multimedia
|
||||
|
||||
Load a digital video (quicktime4linux) for linux
|
||||
|
||||
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__FILMQT4L_FILMQT4L_H_
|
||||
#define _INCLUDE_GEMPLUGIN__FILMQT4L_FILMQT4L_H_
|
||||
#include "plugins/film.h"
|
||||
#include "Gem/Image.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include <quicktime.h>
|
||||
#include <colormodels.h>
|
||||
|
||||
/*-----------------------------------------------------------------
|
||||
-------------------------------------------------------------------
|
||||
CLASS
|
||||
filmQT4L1
|
||||
|
||||
Loads in a film
|
||||
|
||||
KEYWORDS
|
||||
pix
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
-----------------------------------------------------------------*/
|
||||
namespace gem { namespace plugins {
|
||||
class GEM_EXPORT filmQT4L : public film {
|
||||
public:
|
||||
|
||||
//////////
|
||||
// Constructor
|
||||
filmQT4L(void);
|
||||
|
||||
//////////
|
||||
// Destructor
|
||||
virtual ~filmQT4L(void);
|
||||
|
||||
//////////
|
||||
// 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);
|
||||
|
||||
//-----------------------------------
|
||||
// GROUP: Movie data
|
||||
//-----------------------------------
|
||||
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_newfilm;
|
||||
|
||||
quicktime_t *m_quickfile;
|
||||
int m_qtformat;
|
||||
|
||||
imageStruct m_qtimage;
|
||||
int m_lastFrame;
|
||||
|
||||
};};};
|
||||
|
||||
#endif // for header file
|
Loading…
Add table
Add a link
Reference in a new issue