- 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
28
Gem/extra/pix2jpg/LICENSE.txt
Normal file
28
Gem/extra/pix2jpg/LICENSE.txt
Normal file
|
@ -0,0 +1,28 @@
|
|||
pix2jpg : Convert pix to jpg
|
||||
http://code.google.com/p/puremediaserver
|
||||
Copyright (c) 2012 Santi Noreña
|
||||
|
||||
based on:
|
||||
GEM - Graphics Environment for Multimedia
|
||||
Copyright (C) 1997-2000 Mark Danks, Günter Geiger,
|
||||
Copyright (c) 2001-2010 IOhannes m zmölnig
|
||||
Copyright (c) 2003-2007 James Tittle II,
|
||||
Copyright (c) 2003-2008 Chris Clepper et al.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
In the official GEM distribution, the GNU General Public License is
|
||||
in the file GnuGPL.LICENSE
|
||||
|
51
Gem/extra/pix2jpg/Makefile.am
Normal file
51
Gem/extra/pix2jpg/Makefile.am
Normal file
|
@ -0,0 +1,51 @@
|
|||
AUTOMAKE_OPTIONS = foreign
|
||||
ACLOCAL_AMFLAGS = -I $(top_srcdir)/src/m4
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/src -I/usr/include/ImageMagick
|
||||
EXTRA_DIST =
|
||||
|
||||
extradir=$(libdir)/pix2jpg
|
||||
|
||||
extra_LTLIBRARIES = pix2jpg.la
|
||||
|
||||
dist_extra_DATA = LICENSE.txt
|
||||
dist_extra_DATA += pix2jpg-help.pd
|
||||
|
||||
## some default flags
|
||||
pix2jpg_la_CXXFLAGS =
|
||||
pix2jpg_la_LDFLAGS = -L/usr/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -L/usr/lib/X11 -module -avoid-version -shared -shrext .@GEM_RTE_EXTENSION@
|
||||
if WINDOWS
|
||||
pix2jpg_la_LDFLAGS += -no-undefined
|
||||
endif
|
||||
pix2jpg_la_LIBADD =
|
||||
|
||||
# RTE flags
|
||||
pix2jpg_la_CXXFLAGS += @GEM_RTE_CFLAGS@ @GEM_ARCH_CXXFLAGS@
|
||||
pix2jpg_la_LIBADD += @GEM_RTE_LIBS@
|
||||
|
||||
pix2jpg_la_LDFLAGS += @GEM_ARCH_LDFLAGS@
|
||||
|
||||
# special flags for building externals
|
||||
pix2jpg_la_CXXFLAGS += -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -pthread .@GEM_EXTERNAL_CFLAGS@
|
||||
pix2jpg_la_LIBADD += -L/usr/lib -lMagick++ -lMagickWand -lMagickCore -llcms -ltiff -lfreetype -ljpeg -llqr-1 -lglib-2.0 -lfontconfig -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lm -lgomp -lpthread -lltdl -L$(top_builddir) @GEM_EXTERNAL_LIBS@
|
||||
|
||||
# convenience symlinks
|
||||
## uha, this is ugly
|
||||
pix2jpg.@GEM_RTE_EXTENSION@: pix2jpg.la
|
||||
rm -f $@
|
||||
test -f .libs/$@ && $(LN_S) .libs/$@ $@ || true
|
||||
|
||||
.PHONY: clean-conviencesymlink
|
||||
|
||||
clean-conviencesymlink:
|
||||
rm -f pix2jpg.@GEM_RTE_EXTENSION@
|
||||
|
||||
all-local:: pix2jpg.@GEM_RTE_EXTENSION@
|
||||
|
||||
clean-local:: clean-conviencesymlink
|
||||
|
||||
|
||||
### SOURCES
|
||||
pix2jpg_la_SOURCES = \
|
||||
pix2jpg.cpp \
|
||||
pix2jpg.h
|
||||
|
24
Gem/extra/pix2jpg/pix2jpg-help.pd
Normal file
24
Gem/extra/pix2jpg/pix2jpg-help.pd
Normal file
|
@ -0,0 +1,24 @@
|
|||
#N canvas 690 208 450 300 10;
|
||||
#X obj 270 167 pix_image;
|
||||
#X msg 299 137 open img.jpg;
|
||||
#X obj 270 103 gemhead;
|
||||
#X obj 94 213 gemwin;
|
||||
#X msg 53 147 create;
|
||||
#X msg 270 64 1;
|
||||
#X msg 121 145 destroy;
|
||||
#X msg 308 63 0;
|
||||
#X obj 270 196 pix_texture;
|
||||
#X obj 270 222 rectangle 4 4;
|
||||
#N canvas 25 162 450 300 gemwin 0;
|
||||
#X restore 85 239 pd gemwin;
|
||||
#X msg 41 181 1;
|
||||
#X obj 191 203 pix2jpg;
|
||||
#X connect 0 0 8 0;
|
||||
#X connect 1 0 0 0;
|
||||
#X connect 2 0 0 0;
|
||||
#X connect 4 0 3 0;
|
||||
#X connect 5 0 2 0;
|
||||
#X connect 6 0 3 0;
|
||||
#X connect 7 0 2 0;
|
||||
#X connect 8 0 9 0;
|
||||
#X connect 11 0 3 0;
|
152
Gem/extra/pix2jpg/pix2jpg.cpp
Normal file
152
Gem/extra/pix2jpg/pix2jpg.cpp
Normal file
|
@ -0,0 +1,152 @@
|
|||
////////////////////////////////////////////////////////
|
||||
// pix2jpg v0.01
|
||||
// External for Gem and Pure Data to convert an image to jpg and send it
|
||||
// via Unix Domain Sockets
|
||||
// Compiled and tested in Ubuntu Precise
|
||||
// (c) 2012 Santi Noreña. puremediaserver@gmail.com
|
||||
//
|
||||
// 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
|
||||
// Copyright (c) 2002 James Tittle & Chris Clepper
|
||||
// For information on usage and redistribution, and for a DISCLAIMER OF ALL
|
||||
// WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
|
||||
//
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
#include "pix2jpg.h"
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include "m_pd.h"
|
||||
//#include "s_stuff.h"
|
||||
#define SOCK_PATH "/tmp/pmspipe"
|
||||
|
||||
CPPEXTERN_NEW_WITH_ONE_ARG(pix2jpg, t_symbol *, A_DEFSYM);
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
//
|
||||
// pix2jpg
|
||||
//
|
||||
/////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
//
|
||||
/////////////////////////////////////////////////////////
|
||||
pix2jpg :: pix2jpg(t_symbol *s)
|
||||
: m_banged(false),
|
||||
m_automatic(false),
|
||||
m_layer(0)
|
||||
{
|
||||
post("pix2jpg v0.01 Convert pix to jpeg and send to Unix Local Socket");
|
||||
post("(c) 2012 Santi Noreña puremediaserver@gmail.com");
|
||||
post("GPL License");
|
||||
outlet1 = outlet_new(this->x_obj, 0); // Saca todos los canales mediante una lista
|
||||
// Init the Unix Socket
|
||||
socket_fd = socket(PF_UNIX, SOCK_STREAM, 0);
|
||||
if(socket_fd < 0)
|
||||
{
|
||||
post("pix2jpg:create socket() failed\n");
|
||||
return;
|
||||
}
|
||||
/* start with a clean address structure */
|
||||
memset(&address, 0, sizeof(struct sockaddr_un));
|
||||
address.sun_family = PF_UNIX;
|
||||
strcpy(address.sun_path,SOCK_PATH);
|
||||
if(connect(socket_fd,(struct sockaddr *) &address,sizeof(struct sockaddr_un)) != 0)
|
||||
{
|
||||
post("pix2jpg:connect() failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////
|
||||
// Destructor
|
||||
//
|
||||
/////////////////////////////////////////////////////////
|
||||
pix2jpg :: ~pix2jpg()
|
||||
{
|
||||
outlet_free(outlet1);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// render
|
||||
//
|
||||
/////////////////////////////////////////////////////////
|
||||
void pix2jpg :: processImage(imageStruct &image)
|
||||
{
|
||||
if (m_automatic || m_banged)
|
||||
{
|
||||
m_banged =false;
|
||||
int counter = 0;
|
||||
Image imagem(image.xsize, image.ysize, "RGBA", CharPixel, image.data);
|
||||
imagem.resize("64x46");
|
||||
// Write to BLOB in png format
|
||||
Blob blob;
|
||||
imagem.magick( "jpg" ); // Set JPEG output format
|
||||
imagem.write( &blob );
|
||||
// Enviamos al GUI x Unix Domain Sockets
|
||||
int size = blob.length() +2;
|
||||
char buffer[size];
|
||||
memcpy(buffer+2, blob.data(), blob.length());
|
||||
memcpy(buffer,&m_layer, 2);
|
||||
write(socket_fd, buffer, size);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// static member functions
|
||||
//
|
||||
/////////////////////////////////////////////////////////
|
||||
void pix2jpg :: obj_setupCallback(t_class *classPtr)
|
||||
{
|
||||
class_addbang(classPtr, reinterpret_cast<t_method>(&pix2jpg::bangMessCallback));
|
||||
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix2jpg::startMessCallback),gensym("start"), A_NULL);
|
||||
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix2jpg::stopMessCallback),gensym("stop"), A_NULL);
|
||||
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix2jpg::layerimageMessCallback),gensym("layerimage"), A_FLOAT,A_NULL);
|
||||
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix2jpg::layernameMessCallback),gensym("layername"), A_GIMME,A_NULL);
|
||||
}
|
||||
void pix2jpg :: startMessCallback(void *data)
|
||||
{
|
||||
GetMyClass(data)->m_automatic=true;
|
||||
}
|
||||
void pix2jpg :: stopMessCallback(void *data)
|
||||
{
|
||||
GetMyClass(data)->m_automatic=false;
|
||||
}
|
||||
void pix2jpg :: bangMessCallback(void *data)
|
||||
{
|
||||
GetMyClass(data)->m_banged=true;
|
||||
}
|
||||
void pix2jpg :: layerimageMessCallback (void *data, t_float f)
|
||||
{
|
||||
GetMyClass(data)->m_layer=f;
|
||||
printf("layer: %d", GetMyClass(data)->m_layer);
|
||||
}
|
||||
void pix2jpg :: layernameMessCallback(void *data, t_symbol *s, int argc, t_atom *argv)
|
||||
{
|
||||
/* int n, length;
|
||||
t_symbol *c;
|
||||
// check for correct number of arguments
|
||||
n = atom_getint(argv++);
|
||||
c = atom_getsymbol(argv++);
|
||||
|
||||
length = 2 + sizeof(c);
|
||||
char *buffer;
|
||||
post
|
||||
memcpy(buffer+2, c, sizeof(c));
|
||||
memcpy(buffer,&n, 2); */
|
||||
t_binbuf *b = binbuf_new();
|
||||
char *buf;
|
||||
int length;
|
||||
// t_atom at;
|
||||
binbuf_add(b, argc, argv);
|
||||
// SETSEMI(&at);
|
||||
// binbuf_add(b, 1, &at);
|
||||
binbuf_gettext(b, &buf, &length);
|
||||
write(socket_fd, buf, length);
|
||||
}
|
||||
|
106
Gem/extra/pix2jpg/pix2jpg.h
Normal file
106
Gem/extra/pix2jpg/pix2jpg.h
Normal file
|
@ -0,0 +1,106 @@
|
|||
/*-----------------------------------------------------------------
|
||||
pix2jpg v0.01
|
||||
External for Gem and Pure Data to convert an image to jpg and send it
|
||||
via Unix Domain Sockets
|
||||
Compiled and tested in Ubuntu Precise
|
||||
(c) 2012 Santi Noreña. puremediaserver@gmail.com
|
||||
|
||||
GEM - Graphics Environment for Multimedia
|
||||
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__GEM_PIXES_pix2jpg_H_
|
||||
#define _INCLUDE__GEM_PIXES_pix2jpg_H_
|
||||
|
||||
#include "Base/GemPixObj.h"
|
||||
#include "Base/GemBase.h"
|
||||
#include "Gem/Manager.h"
|
||||
#include "Gem/ImageIO.h"
|
||||
#include "Gem/Image.h"
|
||||
#include <stdio.h>
|
||||
#include <Magick++.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
using namespace Magick;
|
||||
/*-----------------------------------------------------------------
|
||||
-------------------------------------------------------------------
|
||||
CLASS
|
||||
pix2jpg
|
||||
|
||||
Convert a image to raw RGB and outputs in a list
|
||||
|
||||
KEYWORDS
|
||||
pix
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
"bang" - do write now
|
||||
|
||||
outlet : The list of raw data.
|
||||
-----------------------------------------------------------------*/
|
||||
class GEM_EXPORT pix2jpg : public GemPixObj
|
||||
{
|
||||
CPPEXTERN_HEADER(pix2jpg, GemPixObj);
|
||||
|
||||
public:
|
||||
|
||||
//////////
|
||||
// Constructor
|
||||
pix2jpg(t_symbol *s);
|
||||
|
||||
protected:
|
||||
|
||||
//////////
|
||||
// Destructor
|
||||
virtual ~pix2jpg();
|
||||
|
||||
//////////
|
||||
// Do the rendering
|
||||
virtual void processImage(imageStruct&image);
|
||||
|
||||
//////////
|
||||
// Set the filename and filetype
|
||||
// virtual void fileMess(int argc, t_atom *argv);
|
||||
|
||||
//////////
|
||||
// The original pix_writer
|
||||
imageStruct *m_originalImage;
|
||||
|
||||
//////////
|
||||
// Manual writing
|
||||
bool m_banged;
|
||||
|
||||
//////////
|
||||
// Automatic writing
|
||||
bool m_automatic;
|
||||
|
||||
//////////
|
||||
// Layer to write
|
||||
|
||||
int m_layer;
|
||||
|
||||
t_outlet *outlet1; // outlet pointer
|
||||
|
||||
struct sockaddr_un address;
|
||||
int socket_fd, nbytes;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
//////////
|
||||
// static member functions
|
||||
static void startMessCallback(void *data);
|
||||
static void stopMessCallback(void *data);
|
||||
static void bangMessCallback(void *data);
|
||||
static void layerimageMessCallback(void *data, t_float f);
|
||||
void layernameMessCallback(void *data, t_symbol *s,int argc, t_atom *argv);
|
||||
};
|
||||
#endif // for header file
|
Loading…
Add table
Add a link
Reference in a new issue