Logo Search packages:      
Sourcecode: djvulibre version File versions

void DataPool::add_trigger ( int  start,
int  length,
void(*)(void *)  callback,
void *  cl_data 
)

Associates the specified {trigger callback} with the given data range.

{ Note:} The callback may be called immediately if all data for the given range is already available or EOF# is TRUE#.

Parameters:
start The beginning of the range for which all data should be available
length If the {length} is not negative then the callback will be called when there is data available for every offset from {start} to {start+length-1}. If {thresh} is negative, the callback is called after EOF# condition has been set.
callback Function to call
cl_data Argument to pass to the callback when it's called.

Definition at line 1519 of file DataPool.cpp.

References GURL::is_local_file_url().

Referenced by add_trigger(), and create().

{
   DEBUG_MSG("DataPool::add_trigger(): start=" << tstart <<
           ", length=" << tlength << ", func=" << (void *) callback << "\n");
   DEBUG_MAKE_INDENT(3);
   
   if (callback)
   {
      if (is_eof())
      {
        call_callback(callback, cl_data);
      }else
      {
       if (pool)
       {
             // We're connected to a DataPool
             // Just pass the triggers down remembering it in the list
          if (tlength<0 && length>0) tlength=length-tstart;
          GP<Trigger> trigger=new Trigger(tstart, tlength, callback, cl_data);
          pool->add_trigger(start+tstart, tlength, callback, cl_data);
          GCriticalSectionLock lock(&triggers_lock);
          triggers_list.append(trigger);
       } else if (!furl.is_local_file_url())
       {
             // We're not connected to anything and maintain our own data
          if (tlength>=0 && block_list->get_bytes(tstart, tlength)==tlength)
             call_callback(callback, cl_data);
          else
          {
             GCriticalSectionLock lock(&triggers_lock);
             triggers_list.append(new Trigger(tstart, tlength, callback, cl_data));
          }
       }
      }
   }
}


Generated by  Doxygen 1.6.0   Back to index