Revision: 4461
          http://pd-gem.svn.sourceforge.net/pd-gem/?rev=4461&view=rev
Author:   zmoelnig
Date:     2011-08-15 12:33:25 +0000 (Mon, 15 Aug 2011)

Log Message:
-----------
adjust to new API of film-plugins

Modified Paths:
--------------
    trunk/Gem/src/Pixes/pix_film.cpp
    trunk/Gem/src/Pixes/pix_film.h

Modified: trunk/Gem/src/Pixes/pix_film.cpp
===================================================================
--- trunk/Gem/src/Pixes/pix_film.cpp    2011-08-15 12:32:53 UTC (rev 4460)
+++ trunk/Gem/src/Pixes/pix_film.cpp    2011-08-15 12:33:25 UTC (rev 4461)
@@ -22,6 +22,8 @@
 
 #include "Gem/State.h"
 #include "Gem/Cache.h"
+#include "Gem/Properties.h"
+
 #include "plugins/PluginFactory.h"
 
 #include <ctype.h>
@@ -316,6 +318,8 @@
 /////////////////////////////////////////////////////////
 void pix_film :: openMess(t_symbol *filename, int format, int codec)
 {
+  gem::Properties wantProps, gotProps;
+
   //  if (filename==x_filename)return;
   closeMess();
 
@@ -329,9 +333,12 @@
   m_handle=0;
 
   if (format==0)format=m_format;
+  double d=(double)format;
+  wantProps.set("colorspace", format);
+
   if(codec>=0){
     codec=codec%m_handles.size();
-    if (m_handles[codec] && m_handles[codec]->open(buf, format )) {
+    if (m_handles[codec] && m_handles[codec]->open(buf, wantProps )) {
       m_handle = m_handles[codec];
       verbose(1, "%s!: succeeded", m_ids[codec].c_str());
     } else {
@@ -344,7 +351,7 @@
     post("opening %s with format %X", buf, format);
     while(i<m_handles.size()){
       debug("trying handle %d: %x", i, m_handles[i]);
-      if (m_handles[i] && m_handles[i]->open(buf, format ))      {
+      if (m_handles[i] && m_handles[i]->open(buf, wantProps ))      {
        verbose(1, "%s: succeeded", m_ids[i].c_str());
         m_handle = m_handles[i];
         break;
@@ -363,18 +370,34 @@
        return;
   }
 
+  double width=-1;
+  double height=-1;
+  double frames=-1;
+  double fps=-1;
+  gotProps.set("width", 0);
+  gotProps.set("height", 0);
+  gotProps.set("frames", 0);
+  gotProps.set("fps", 0);
+
+  m_handle->getProperties(gotProps);
+
+  gotProps.get("width", width);
+  gotProps.get("height", height);
+  gotProps.get("frames", frames);
+  gotProps.get("fps", fps);
+
   t_atom ap[4];
-  float fps=static_cast<t_float>(m_handle->getFPS());
-  SETFLOAT(ap, m_handle->getFrameNum());
-  SETFLOAT(ap+1, m_handle->getWidth());
-  SETFLOAT(ap+2, m_handle->getHeight());
+  SETFLOAT(ap, frames);
+  SETFLOAT(ap+1, width);
+  SETFLOAT(ap+2, height);
   SETFLOAT(ap+3, fps);
-  m_numFrames=m_handle->getFrameNum();
+  m_numFrames=frames;
   post("loaded file: %s with %d frames (%dx%d) at %f fps", 
        buf, 
-       m_handle->getFrameNum(), 
-       m_handle->getWidth(), 
-       m_handle->getHeight(), fps);
+       (int)frames, 
+       (int)width, 
+       (int)height, 
+       fps);
   outlet_list(m_outNumFrames, 0, 4, ap);
 
 #ifdef HAVE_PTHREADS
@@ -424,9 +447,6 @@
       m_cache->resendImage = 0;
     }
 
-
-  m_handle->setAuto(m_auto);
-
   frame=static_cast<int>(m_reqFrame);
   if (NULL==img){
     outlet_float(m_outEnd,(m_numFrames>0 && 
static_cast<int>(m_reqFrame)<0)?(m_numFrames-1):0);
@@ -524,7 +544,13 @@
   default:
     error("colorspace must be 'RGBA', 'YUV' or 'Gray'");
   }
-  if(immediately && m_handle)m_handle->requestColor(m_format);
+
+  gem::Properties props;
+  double d=(double)m_format;
+  gem::any value=d;
+  props.set("colorspace", value);
+  if(immediately && m_handle)
+    m_handle->setProperties(props);
 }
 /////////////////////////////////////////////////////////
 // threading
@@ -540,7 +566,18 @@
 #endif
 }
 
+void pix_film :: autoMess(double speed)
+{
+  m_auto=speed;
+  gem::Properties props;
+  gem::any value=speed;
+  props.set("auto", value);
+  m_handle->setProperties(props);
+}
 
+
+
+
 /////////////////////////////////////////////////////////
 // static member function
 //
@@ -560,12 +597,14 @@
                  gensym("open"), A_GIMME, A_NULL);
   class_addmethod(classPtr, 
reinterpret_cast<t_method>(&pix_film::changeImageCallback),
                  gensym("img_num"), A_GIMME, A_NULL);
-  class_addmethod(classPtr, 
reinterpret_cast<t_method>(&pix_film::autoCallback),
-                 gensym("auto"), A_DEFFLOAT, A_NULL);
+
+  CPPEXTERN_MSG1(classPtr, "auto", autoMess, double);
+  CPPEXTERN_MSG1(classPtr, "colorspace", csMess, t_symbol*);
+#if 0
   class_addmethod(classPtr, reinterpret_cast<t_method>(&pix_film::csCallback),
                  gensym("colorspace"), A_DEFSYM, A_NULL);
-  class_addmethod(classPtr, 
reinterpret_cast<t_method>(&pix_film::threadCallback),
-                 gensym("thread"), A_FLOAT, A_NULL);
+#endif
+  CPPEXTERN_MSG1(classPtr, "thread", threadMess, bool);
 }
 void pix_film :: openMessCallback(void *data, t_symbol*s,int argc, t_atom*argv)
 {
@@ -601,15 +640,6 @@
     GetMyClass(data)->changeImage((argc<1)?0:atom_getint(argv), 
(argc<2)?0:atom_getint(argv+1));
 }
 
-void pix_film :: autoCallback(void *data, t_floatarg state)
-{
-  GetMyClass(data)->m_auto=state;
-}
-void pix_film :: csCallback(void *data, t_symbol*s)
-{
-  GetMyClass(data)->csMess(s);
-}
-
 void pix_film :: threadCallback(void *data, t_floatarg state)
 {
   GetMyClass(data)->threadMess(static_cast<int>(state));

Modified: trunk/Gem/src/Pixes/pix_film.h
===================================================================
--- trunk/Gem/src/Pixes/pix_film.h      2011-08-15 12:32:53 UTC (rev 4460)
+++ trunk/Gem/src/Pixes/pix_film.h      2011-08-15 12:33:25 UTC (rev 4461)
@@ -86,6 +86,10 @@
   // turn on/off threaded reading
   virtual void threadMess(int);
 
+
+  virtual void autoMess(double state);
+
+
   //-----------------------------------
   // GROUP:    Movie data
   //-----------------------------------
@@ -118,7 +122,6 @@
   t_outlet     *m_outNumFrames;
   t_outlet     *m_outEnd;
 
-
  
  protected:
  /* grab-thread */
@@ -141,7 +144,6 @@
   // static member functions
   static void openMessCallback   (void *data, t_symbol*,int,t_atom*);
   static void changeImageCallback(void *data, t_symbol *, int argc, t_atom 
*argv);
-  static void autoCallback       (void *data, t_floatarg state);
   static void csCallback         (void *data, t_symbol*s);
   static void threadCallback     (void *data, t_floatarg state);
 };


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
pd-gem-CVS mailing list
pd-gem-CVS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pd-gem-cvs

Reply via email to