Revision f14985ba input-grapes.c

View differences:

input-grapes.c
35 35
  if (res == NULL) {
36 36
    return NULL;
37 37
  }
38
  sprintf(cfg, "media=av");
38
  if (flags & INPUT_UDP) {
39
    sprintf(cfg, "chunkiser=udp");
40
    sprintf(cfg + strlen(cfg), ",%s", fname);
41
  } else {
42
    sprintf(cfg, "chunkiser=avf,media=av");
43
  }
39 44
  if (flags & INPUT_LOOP) {
40 45
    sprintf(cfg + strlen(cfg), ",loop=1");
41 46
  }
......
92 97
  if (s->first_ts == 0) {
93 98
    s->first_ts = c->timestamp;
94 99
  }
95
  delta = c->timestamp - s->first_ts + s->interframe;
96 100
  gettimeofday(&now, NULL);
97
  delta = delta + s->start_time - now.tv_sec * 1000000ULL - now.tv_usec;
98
  dprintf("Delta: %lld\n", delta);
99
  dprintf("Generate Chunk[%d] (TS: %llu)\n", c->id, c->timestamp);
100

  
101
  if (s->interframe) {
102
    delta = c->timestamp - s->first_ts + s->interframe;
103
    delta = delta + s->start_time - now.tv_sec * 1000000ULL - now.tv_usec;
104
    dprintf("Delta: %lld\n", delta);
105
    dprintf("Generate Chunk[%d] (TS: %llu)\n", c->id, c->timestamp);
106
    if (delta < 0) {
107
      delta = 0;
108
    }
109
  } else {
110
    delta = 999999;		/* FIXME */
111
  }
101 112
  c->timestamp = now.tv_sec * 1000000ULL + now.tv_usec;
102 113

  
103
  return delta > 0 ? delta : 0;
114
  return delta;
104 115
}

Also available in: Unified diff