JitterListener and jit.qt.movie read...bug?


    Jul 05 2007 | 8:17 pm
    I would expect that a JitterListener would catch the "read" message that normally comes out of a jit.qt.movie object, but this doesn't seem to be the case? Here is a simple javascript and patch that I would expect this to post a "read " in the max window...but it does not! It does, however, post a "flatten" message after that is successful.
    /* listens to a jit.qt.movie's output. It doesn't seem to generate a "read" message after I read a file? The savemovie and flatten are in here simple to demonstarte that the listener is working at least for the "flatten" command */
    var mov01 = new JitterObject("jit.qt.movie"); mov01.autostart = 0; var mov01listen = new JitterListener(mov01.getregisteredname(), listenresults); var movpath = ".";
    function listenresults(event) { post("nlistener",event.eventname); }
    function readmov(v){ mov01.read(v); mov01.savemoviecopy(movpath); mov01.flatten(movpath); }
    function savepath(v){ post("npath",v); movpath = v+"junk.mov"; }
    //end simplelistener.js

    • Jul 05 2007 | 8:22 pm
      also, i'd expect the savemoviecopy to generate something that the listener would "hear", but it doesn't seem to either...
      p
    • Jul 09 2007 | 5:13 pm
      if I can't get "read" reportage from the jitter listener, is there another way to find out if a js-instance of jit.qt.movie has sucessfully read a movie? I was hoping to incorporate this with a Task, such that once the listener heard the file was read, it would execute the Task.
    • Jul 09 2007 | 6:10 pm
      all you have to do is read the movie with
      result = mov01.read(v);
      then result[0] will return the name of the file, and result[1] will return a 0 or a 1 depending on whether the read was successful.
    • Jul 09 2007 | 6:22 pm
      right...I guess the sad part is that sequencing this with Tasks is perhaps more of a pain. I did something similar with the Listener for flatten, and eventually got that to work, and I was hoping to pretty much reuse that code but listen for "read", rather than flatten. I expected the "read" to come from the Listener, since the Jitter 1.62 docs, when discussing the Listener in Tutorial 47, state: "...For example, when you read a movie file into jit.qt.movie, the object outputs the message read followed by the movie?s filename and a status number out its status outlet. "
    • Jul 09 2007 | 6:25 pm
      I am pretty sure that asyncread works with the Listener. read, being synchronous, doesn't.
      jb
      Am 09.07.2007 um 18:22 schrieb pnyboer:
      > > right...I guess the sad part is that sequencing this with Tasks is > perhaps more of a pain. I did something similar with the Listener > for flatten, and eventually got that to work, and I was hoping to > pretty much reuse that code but listen for "read", rather than > flatten. I expected the "read" to come from the Listener, since the > Jitter 1.62 docs, when discussing the Listener in Tutorial 47, state: > "...For example, when you read a movie file into jit.qt.movie, the > object outputs the message read followed by the movie?s filename > and a status number out its status outlet. "
    • Jul 09 2007 | 6:34 pm
      AH! Thanks Jeremy. substituting "asyncread" for "read" in the above script does indeed result in a "read" message coming from the listener.
    • Jul 10 2007 | 4:02 am
      Can you stand another one? I hope so, cuz I seem to surfing the edges of Max scheduling, and not understanding it. This simple, but complete, patch and javascript are an attempt to read a folder of movies and output a sample frame from each, using a Task and JitterListener. The big mystery to me is why when I use the mov.matrixcalc() method in function thecallback(), it doesn't actually output a matrix. The simple example of "readit", when called from the outside does what I want to do, so I know I'm using the correct code to output a matrix from a jit.qt.movie in js. I presume it has to do with the asyncread, which the JitterListener seems to say is all finished, but it is apparently not, since the matrixcalc results in nothing!
      Is there a way to get this working??
      Thanks,
      Peter.
      //-----begin draw_tiles_async.js
      /* takes a folder of movies and tries to asynchronously grab "thumbnails" from each. However, even though the JitterListener reports a "read", it doesn't seem to be able to immediately output a matrix.
      */
      autowatch = 1; outlets = 3; mov = new JitterObject("jit.qt.movie"); mov.autostart = 0; mov.adapt = 1; var movlisten = new JitterListener(mov.getregisteredname(), thecallback);
      var movepath; var counter = 0; var total = 0; var TASK_INTERVAL = 1; var DRAWIT = new Task(readtask,this); var clips = new Array(); var tmpmatrix = new JitterObject("jit.matrix");
      function drawtiles(topath){ counter = 0; var g = new Folder(topath); g.typelist = ["MooV","mpg4","dvc!","MPEG","MPGa","MPGv","MPGx","SWFL","SWF","JPEG","GIF","GIFf","PNG","PNGf","8BPS","TIFF","TGA","PICT","SWF","BMPf","BMP","qtif","SGI","TPIC","PNTG","qdgx","PFix","PICS","MP3","MPG3","AIFF","WAVE","Mp3 ","????"]; total=g.count; outlet(1,total); if(g.count){ for (var i=0;i< g.count;i++) { g.next(); var thefile = g.pathname+"/"+g.filename; clips[i] = thefile; post("filling array: ",i,thefile,"n"); } g.close(); }
      movepath = topath; if (!DRAWIT.running){ DRAWIT.execute(); } }
      function readtask(){ mov.asyncread(clips[counter]); } readtask.immediate = 1;
      function thecallback(event) { if (event) post("nlisten",event.eventname); if (event.eventname=="read"){ mov.frame(30); mov.matrixcalc(tmpmatrix,tmpmatrix); outlet(0,"jit_matrix",tmpmatrix.name); outlet(2,counter); counter++;
      if (counter } }
      function bang(){ mov.matrixcalc(tmpmatrix,tmpmatrix); outlet(0,"jit_matrix",tmpmatrix.name); }
      function readit(v){ mov.read(clips[v]); mov.frame(30); mov.matrixcalc(tmpmatrix,tmpmatrix); outlet(0,"jit_matrix",tmpmatrix.name); }
      //end draw_tiles_async.js
    • Jul 24 2007 | 11:02 am
      Hi Peter
      Just got around to taking a look at this. It appears that, yes, there is a "sync" problem with asyncread and the JitterListener. I don't know precisely when this will get fixed, but it will get fixed.
      jb
      Am 10.07.2007 um 06:02 schrieb pnyboer:
      > > Is there a way to get this working??
    • Jul 25 2007 | 3:56 am
      ok, thanks for the confirmation. i thought it was further evidence of not knowing what the hell I'm really doing! Looking forward to a fix!
    • Jul 25 2007 | 6:31 pm
      i'm not so sure it's just a javascript problem, as I encounter a similar difficulty with regular old max patching. This patch, when used with a library of DV clips, demonstrates that the "read" message from an asyncread isn't actually reported after the movie is "readable" by qt.movie. I would expect that, in this patch, asyncread and read would give similar results.