xp_comm_proj/cine/imgcache.c
/* routine: CacheSetFrame
 * purpose: Set new frame
 */
CacheSetFrame
purpose: Set new frame
CacheSetFrame purpose : Set new frame
int CacheSetFrame(OMobj_id obj_id, OMevent_mask event_mask, int seq_num)
{
  OMobj_id view_id;
  CacheInfo *cache;
  GDview *view;
  int frame_in;
  if( (cache = GetCacheInfo( obj_id )) == NULL )
    return( 0 );
  view_id = OMfind_subobj(obj_id, OMstr_to_name("view"), OM_OBJ_RD);
  if( OMis_null_obj(view_id) )
    {
      fprintf( stderr, "CacheUpdate: Unable to get object id for view\n" );
      return( 0 );
    }
  view = (GDview *)GDget_local(view_id, (OMpfi)GDview_init);
  frame_in = 0;
  OMget_name_int_val( obj_id, OMstr_to_name("frame_in"), &frame_in );
  cache->frame_in = frame_in;
  if( view )
    {
      if( cache->playback && (cache->mode == 0) )
        {
          if( (frame_in < 0) || (frame_in >= cache->num_frames) )
            {
              fprintf( stderr, "Invalid frame to display, frame_in = %d, num_frames = %d\n",
                       frame_in, cache->num_frames );
              return( 0 );
            }
	  DisplayPixmap( cache, view, frame_in );
          OMset_name_int_val(obj_id, OMstr_to_name("frame_out"), frame_in);
        }
      if( cache->capture && (cache->mode == 1) )
        {
          if( cache->pixmaps[frame_in] )
            {
	      DisplayPixmap( cache, view, frame_in );
            }
          else
            {
              OMset_name_int_val(obj_id, OMstr_to_name("frame_out"), frame_in);
            }
        }
    }
  return( 1 );
}
int CacheSetFrame ( OMobj_id obj_id , OMevent_mask event_mask , int seq_num ) { OMobj_id view_id ; CacheInfo * cache ; GDview * view ; int frame_in ; if ( ( cache = GetCacheInfo ( obj_id ) ) == NULL ) return ( 0 ) ; view_id = OMfind_subobj ( obj_id , OMstr_to_name ( " " ) , OM_OBJ_RD ) ; if ( OMis_null_obj ( view_id ) ) { fprintf ( stderr , " \n " ) ; return ( 0 ) ; } view = ( GDview * ) GDget_local ( view_id , ( OMpfi ) GDview_init ) ; frame_in = 0 ; OMget_name_int_val ( obj_id , OMstr_to_name ( " " ) , & frame_in ) ; cache -> frame_in = frame_in ; if ( view ) { if ( cache -> playback && ( cache -> mode == 0 ) ) { if ( ( frame_in < 0 ) || ( frame_in >= cache -> num_frames ) ) { fprintf ( stderr , " \n " , frame_in , cache -> num_frames ) ; return ( 0 ) ; } DisplayPixmap ( cache , view , frame_in ) ; OMset_name_int_val ( obj_id , OMstr_to_name ( " " ) , frame_in ) ; } if ( cache -> capture && ( cache -> mode == 1 ) ) { if ( cache -> pixmaps [ frame_in ] ) { DisplayPixmap ( cache , view , frame_in ) ; } else { OMset_name_int_val ( obj_id , OMstr_to_name ( " " ) , frame_in ) ; } } } return ( 1 ) ; }
routine: CacheSetFrame
 purpose: Set new frame
routine : CacheSetFrame purpose : Set new frame
/* Get pointer to control structure
   */ /* Get GDview structure
   */ /* Get new value of frame_in
   */ /* Don't do anything without a view connected
   */ /* Process playback for mode 0
       */ /* Update frame_out to reflect current frame
           */ /* Process capture/playback for mode 1
       */