Changeset - 734207e4d1f8
[Not reviewed]
default
0 3 0
LordOfWar - 16 years ago 2009-10-07 12:50:19

added width and height variables to the distrenjob structure, then integrated that into the new xml writer function, and added the new variables to the makeshift user interface in main()
3 files changed with 20 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -221,7 +221,7 @@ int restoreJobState(struct distrenjob *j
 
}
 

	
 
/** creates a structure from starting data, then calls another function to actually add that struct to the queue */
 
void prepare_distrenjob(struct distrenjob *head, int type, char *name, char *submitter, char *email, int priority, int start_frame, int end_frame)
 
void prepare_distrenjob(struct distrenjob *head, int type, char *name, char *submitter, char *email, int priority, int start_frame, int end_frame, int width, int height)
 
{
 
  int counter2;
 
  int counter;
 
@@ -234,6 +234,8 @@ void prepare_distrenjob(struct distrenjo
 
  distrenjob->submitter = submitter;
 
  distrenjob->email = email;
 
  distrenjob->priority = priority;
 
  distrenjob->width = width;
 
  distrenjob->height = height;
 
  distrenjob->total_frames = (end_frame - start_frame + 1); // sets the total number of frames in animation for status purposes
 

	
 
  /* prepares all the frames by setting that status to "unassigned" */
 
@@ -469,10 +471,12 @@ int distrend_config_free(struct distrend
 
  return 0;
 
}
 
/* ************************** XML Functions ************************* */
 
int makeSlaveDataXML(struct distrenjob *job, char *height, char *width)
 

	
 
// returns 1 on successful completion of xml file
 
int makeSlaveDataXML(struct distrenjob *job)
 
{
 
  xmlTextWriterPtr writer;
 
  char *tmp;
 
  char *tmp; // temporarily holds strings to be given to the xml writer
 

	
 
  _distren_asprintf(&tmp, "stor/job%d/job_info.xml", job->jobnum);
 

	
 
@@ -489,8 +493,10 @@ int makeSlaveDataXML(struct distrenjob *
 

	
 
  // write resolution element and add its attributes
 
  xmlTextWriterStartElement(writer, (xmlChar*)"resolution");
 
  xmlTextWriterWriteAttribute(writer, (xmlChar*)"width", (xmlChar*)height);
 
  xmlTextWriterWriteAttribute(writer, (xmlChar*)"height", (xmlChar*)width);
 
  _distren_asprintf(&tmp, "%d", job->width);
 
  xmlTextWriterWriteAttribute(writer, (xmlChar*)"width", (xmlChar*)tmp);
 
  _distren_asprintf(&tmp, "%d", job->height);
 
  xmlTextWriterWriteAttribute(writer, (xmlChar*)"height", (xmlChar*)tmp);
 
  xmlTextWriterEndElement(writer);
 

	
 
  // end document
 
@@ -618,6 +624,8 @@ int main(int argc, char *argv[])
 
  char *submitter = "";
 
  char *email = "";
 
  int priority;
 
  int width;
 
  int height;
 
  int start_frame;
 
  int end_frame;
 

	
 
@@ -659,7 +667,9 @@ int main(int argc, char *argv[])
 
      fprintf(stderr, "\nPriority: ");                 scanf("%d", &priority);
 
      fprintf(stderr, "\nStart frame: ");              scanf("%d", &start_frame);
 
      fprintf(stderr, "\nEnd frame: ");                scanf("%d", &end_frame);
 
      prepare_distrenjob(&head, type, name, submitter, email, priority, start_frame, end_frame);
 
      fprintf(stderr, "\nWidth: ");                    scanf("%d", &width);
 
      fprintf(stderr, "\nHeight: ");                   scanf("%d", &height);
 
      prepare_distrenjob(&head, type, name, submitter, email, priority, start_frame, end_frame, width, height);
 
      break;
 
    case 5:
 
      fprintf(stderr, "\nJob number: ");
src/server/distrenjob.c
Show inline comments
 
@@ -58,6 +58,8 @@ int distrenjob_new(struct distrenjob **d
 
  dj->email = (char *)NULL;
 
  dj->jobnum = 0; /*< @todo there should be a central jobnum allocator and a way to save the maximum jobnumber allocated */
 
  dj->priority = 0;
 
  dj->width = 0;
 
  dj->height = 0;
 
  dj->completed_frames = 0;
 
  dj->assigned_frames = 0;
 
  dj->total_render_time = 0;
src/server/distrenjob.h
Show inline comments
 
@@ -39,6 +39,8 @@ struct distrenjob {
 
  char *submitter;
 
  char *email; /*< This should be looked up based on the value of submitter, not stored in this struct */
 
  jobnum_t jobnum;
 
  int width; // width in pixels of the frames to be rendered
 
  int height; //height in pixels of the frames to be rendered
 
  int priority;  // 1 is lowest, 10 is highest, 0 means the job is done
 
  int completed_frames; // number of completed frames for stats/etc
 
  int assigned_frames; // number of assigned frames (that are not yet completed) for stats/etc
0 comments (0 inline, 0 general)