- 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/videoV4L2/Makefile.am
Normal file
39
Gem/plugins/videoV4L2/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 =
|
||||
gemhelpdir=$(pkglibdir)
|
||||
dist_gemhelp_DATA =
|
||||
|
||||
if HAVE_V4L2
|
||||
pkglib_LTLIBRARIES+= gem_videoV4L2.la
|
||||
dist_gemhelp_DATA += v4l2-videoplugin.pd
|
||||
endif
|
||||
|
||||
gem_videoV4L2_la_CXXFLAGS =
|
||||
gem_videoV4L2_la_LDFLAGS = -module -avoid-version -shared
|
||||
if WINDOWS
|
||||
gem_videoV4L2_la_LDFLAGS += -no-undefined
|
||||
endif
|
||||
gem_videoV4L2_la_LIBADD =
|
||||
|
||||
# RTE
|
||||
gem_videoV4L2_la_CXXFLAGS += @GEM_RTE_CFLAGS@ @GEM_ARCH_CXXFLAGS@
|
||||
gem_videoV4L2_la_LDFLAGS += @GEM_RTE_LIBS@ @GEM_ARCH_LDFLAGS@
|
||||
# flags for building Gem externals
|
||||
gem_videoV4L2_la_CXXFLAGS += @GEM_EXTERNAL_CFLAGS@
|
||||
gem_videoV4L2_la_LIBADD += -L$(top_builddir) @GEM_EXTERNAL_LIBS@
|
||||
# gem_videoV4L2_la @MOREFLAGS@
|
||||
|
||||
# Dependencies
|
||||
gem_videoV4L2_la_CXXFLAGS += @GEM_LIB_LIBV4L2_CFLAGS@
|
||||
gem_videoV4L2_la_LIBADD += @GEM_LIB_LIBV4L2_LIBS@
|
||||
|
||||
# convenience symlinks
|
||||
include $(srcdir)/../symlink_ltlib.mk
|
||||
|
||||
|
||||
### SOURCES
|
||||
gem_videoV4L2_la_SOURCES= videoV4L2.cpp videoV4L2.h
|
||||
|
75
Gem/plugins/videoV4L2/v4l2-videoplugin.pd
Normal file
75
Gem/plugins/videoV4L2/v4l2-videoplugin.pd
Normal file
|
@ -0,0 +1,75 @@
|
|||
#N canvas 8 49 505 589 10;
|
||||
#X msg 9 219 device usb-0000:00:04.1-4;
|
||||
#X msg 9 239 device usb-0000:00:06.0-2;
|
||||
#X msg 9 259 device usb-0000:00:04.0-1;
|
||||
#X msg -42 366 get driver;
|
||||
#X msg 48 366 get card;
|
||||
#X msg 138 366 get bus_info;
|
||||
#X text -42 304 contrary to /dev/video* files \, this address is not
|
||||
related to the plug order of the devices;
|
||||
#X obj -73 425 cnv 15 150 20 empty \$0-propreadNamev4l2 -- 10 9 0 14
|
||||
-203904 -66577 0;
|
||||
#X obj 86 425 cnv 15 200 20 empty \$0-propreadValuev4l2 -- 10 9 0 14
|
||||
-261234 -66577 0;
|
||||
#X obj -21 282 s \$1-ctl;
|
||||
#X text -38 176 You can also choose a device by its physical location
|
||||
on the bus:;
|
||||
#X obj -21 132 s \$1-ctl;
|
||||
#X msg 9 69 device /dev/video0;
|
||||
#X msg 9 89 device /dev/video4;
|
||||
#X text -44 350 these are some related read-only properties :;
|
||||
#N canvas 762 178 450 537 getDeviceInfo 0;
|
||||
#X obj 54 38 inlet;
|
||||
#X obj 54 66 s \$1-ctl;
|
||||
#X obj 64 104 r \$1-info;
|
||||
#X obj 64 369 s \$0-propreadNamev4l2;
|
||||
#X obj 64 150 route driver card bus_info;
|
||||
#X msg 64 190 driver;
|
||||
#X obj 64 170 t b a;
|
||||
#X obj 64 319 symbol;
|
||||
#X obj 114 170 t b a;
|
||||
#X obj 164 170 t b a;
|
||||
#X msg 114 190 card;
|
||||
#X msg 164 190 bus_info;
|
||||
#X obj 141 272 symbol;
|
||||
#X msg 64 339 label \$1;
|
||||
#X msg 141 299 label \$1;
|
||||
#X obj 141 330 s \$0-propreadValuev4l2;
|
||||
#X obj 64 124 route prop;
|
||||
#X obj 275 194 loadbang;
|
||||
#X msg 275 214 --;
|
||||
#X obj 275 234 t a a;
|
||||
#X connect 0 0 1 0;
|
||||
#X connect 2 0 16 0;
|
||||
#X connect 4 0 6 0;
|
||||
#X connect 4 1 8 0;
|
||||
#X connect 4 2 9 0;
|
||||
#X connect 5 0 7 0;
|
||||
#X connect 6 0 5 0;
|
||||
#X connect 6 1 12 0;
|
||||
#X connect 7 0 13 0;
|
||||
#X connect 8 0 10 0;
|
||||
#X connect 8 1 12 0;
|
||||
#X connect 9 0 11 0;
|
||||
#X connect 9 1 12 0;
|
||||
#X connect 10 0 7 0;
|
||||
#X connect 11 0 7 0;
|
||||
#X connect 12 0 14 0;
|
||||
#X connect 13 0 3 0;
|
||||
#X connect 14 0 15 0;
|
||||
#X connect 16 0 4 0;
|
||||
#X connect 17 0 18 0;
|
||||
#X connect 18 0 19 0;
|
||||
#X connect 19 0 7 0;
|
||||
#X connect 19 1 12 0;
|
||||
#X restore -42 394 pd getDeviceInfo;
|
||||
#X text -38 26 With V4L2 backend you can choose a device via its device-name:
|
||||
;
|
||||
#X connect 0 0 9 0;
|
||||
#X connect 1 0 9 0;
|
||||
#X connect 2 0 9 0;
|
||||
#X connect 3 0 15 0;
|
||||
#X connect 4 0 15 0;
|
||||
#X connect 5 0 15 0;
|
||||
#X connect 12 0 11 0;
|
||||
#X connect 13 0 11 0;
|
1188
Gem/plugins/videoV4L2/videoV4L2.cpp
Normal file
1188
Gem/plugins/videoV4L2/videoV4L2.cpp
Normal file
File diff suppressed because it is too large
Load diff
193
Gem/plugins/videoV4L2/videoV4L2.h
Normal file
193
Gem/plugins/videoV4L2/videoV4L2.h
Normal file
|
@ -0,0 +1,193 @@
|
|||
/*-----------------------------------------------------------------
|
||||
|
||||
GEM - Graphics Environment for Multimedia
|
||||
|
||||
Load an video into a pix block
|
||||
|
||||
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__VIDEOV4L2_VIDEOV4L2_H_
|
||||
#define _INCLUDE_GEMPLUGIN__VIDEOV4L2_VIDEOV4L2_H_
|
||||
|
||||
#include "plugins/videoBase.h"
|
||||
|
||||
#if defined HAVE_LIBV4L2 && !defined HAVE_VIDEO4LINUX2
|
||||
# define HAVE_VIDEO4LINUX2
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_VIDEO4LINUX2
|
||||
# ifdef HAVE_LIBV4L2
|
||||
# include <libv4l2.h>
|
||||
# endif /* HAVE_LIBV4L2 */
|
||||
|
||||
# include <map>
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
//# include <stdarg.h>
|
||||
# include <unistd.h>
|
||||
# include <string.h>
|
||||
//# include <ctype.h>
|
||||
# include <fcntl.h>
|
||||
# include <errno.h>
|
||||
# include <sys/ioctl.h>
|
||||
//# include <sys/types.h>
|
||||
//# include <sys/time.h>
|
||||
# include <asm/types.h>
|
||||
# include <linux/videodev2.h>
|
||||
# include <sys/mman.h>
|
||||
#ifdef HAVE_PTHREADS
|
||||
/* the bad thing is, that we currently don't have any alternative to using PTHREADS
|
||||
* LATER: make threading optional
|
||||
* (or at least disabled capturing when no pthreads are available)
|
||||
*/
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
# define V4L2_DEVICENO 0
|
||||
/* request 4 buffers (but if less are available, it's fine too... */
|
||||
# define V4L2_NBUF 4
|
||||
|
||||
|
||||
struct t_v4l2_buffer {
|
||||
void * start;
|
||||
size_t length;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
/*-----------------------------------------------------------------
|
||||
-------------------------------------------------------------------
|
||||
CLASS
|
||||
pix_video
|
||||
|
||||
Loads in a video
|
||||
|
||||
KEYWORDS
|
||||
pix
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
"dimen" (int, int) - set the x,y dimensions
|
||||
"zoom" (int, int) - the zoom factor (1.0 is nominal) (num / denom)
|
||||
"bright" (int) - the brightnes
|
||||
"contrast" (int) - the contrast
|
||||
"hue" (int) - the hue
|
||||
"sat" (int) - the saturation
|
||||
|
||||
-----------------------------------------------------------------*/
|
||||
namespace gem { namespace plugins {
|
||||
class GEM_EXPORT videoV4L2 : public videoBase {
|
||||
public:
|
||||
//////////
|
||||
// Constructor
|
||||
videoV4L2(void);
|
||||
|
||||
//////////
|
||||
// Destructor
|
||||
virtual ~videoV4L2(void);
|
||||
|
||||
#ifdef HAVE_VIDEO4LINUX2
|
||||
////////
|
||||
// open the video-device
|
||||
virtual bool openDevice(gem::Properties&writeprops);
|
||||
virtual void closeDevice(void);
|
||||
|
||||
//////////
|
||||
// Start up the video device
|
||||
// [out] int - returns 0 if bad
|
||||
virtual bool startTransfer(void);
|
||||
//////////
|
||||
// Stop the video device
|
||||
// [out] int - returns 0 if bad
|
||||
virtual bool stopTransfer(void);
|
||||
|
||||
//////////////////
|
||||
// restart the transfer if it is currently running
|
||||
virtual bool restartTransfer(void);
|
||||
|
||||
//////////
|
||||
// get the next frame
|
||||
virtual pixBlock *getFrame(void);
|
||||
|
||||
|
||||
//////////
|
||||
// Set the video properties
|
||||
virtual bool setColor(int);
|
||||
|
||||
virtual std::vector<std::string>enumerate(void);
|
||||
|
||||
virtual bool enumProperties(gem::Properties&readable,
|
||||
gem::Properties&writeable);
|
||||
virtual void setProperties(gem::Properties&writeprops);
|
||||
virtual void getProperties(gem::Properties&readprops);
|
||||
|
||||
protected:
|
||||
|
||||
//-----------------------------------
|
||||
// GROUP: Linux specific video data
|
||||
//-----------------------------------
|
||||
|
||||
|
||||
int m_gotFormat; // the format returned by the v4l2-device (not an openGL-format!)
|
||||
bool m_colorConvert; // do we have to convert the colour-space manually ?
|
||||
|
||||
|
||||
int m_tvfd;
|
||||
|
||||
struct t_v4l2_buffer*m_buffers;
|
||||
int m_nbuffers;
|
||||
void*m_currentBuffer;
|
||||
|
||||
int m_frame, m_last_frame;
|
||||
|
||||
//////////////////
|
||||
// capabilities of the device
|
||||
int m_maxwidth;
|
||||
int m_minwidth;
|
||||
int m_maxheight;
|
||||
int m_minheight;
|
||||
|
||||
//////////
|
||||
// the capturing thread
|
||||
pthread_t m_thread_id;
|
||||
bool m_continue_thread;
|
||||
bool m_frame_ready;
|
||||
|
||||
/* capture frames (in a separate thread! */
|
||||
void*capturing(void);
|
||||
/* static callback for pthread_create: calls capturing() */
|
||||
static void*capturing_(void*);
|
||||
|
||||
int init_mmap(void);
|
||||
|
||||
// rendering might be needed when we are currently not capturing because we cannot (e.g: couldn't open device)
|
||||
// although we should. when reopening another device, we might be able to render again...
|
||||
// example: we have only 1 video-device /dev/video0;
|
||||
// when we try to open /dev/video1 we fail, and m_capturing is set to 0
|
||||
// now when rendering is turned on and we want to switch back to /dev/video0 we should reconnect to the good device
|
||||
bool m_rendering; // "true" when rendering is on, false otherwise
|
||||
|
||||
/* use this in the capture-thread to cleanup */
|
||||
bool m_stopTransfer;
|
||||
|
||||
/* internal housekeeping of properties */
|
||||
void addProperties(struct v4l2_queryctrl queryctrl,
|
||||
gem::Properties&readable,
|
||||
gem::Properties&writeable);
|
||||
std::map<std::string, struct v4l2_queryctrl>m_readprops, m_writeprops;
|
||||
struct v4l2_capability m_caps;
|
||||
|
||||
__u32 m_frameSize; // the size of a v4l2 frame
|
||||
|
||||
#endif /* HAVE_VIDEO4LINUX2 */
|
||||
};
|
||||
};};
|
||||
|
||||
#endif // for header file
|
Loading…
Add table
Add a link
Reference in a new issue