static GstPadProbeReturn
handle_output (GstPad * pad, GstPadProbeInfo * info, StreamInfo * si)
{
  GstClockTime start, end;
  GstBuffer *buf;

  GST_LOG_OBJECT (pad, "Fired probe type 0x%x", info->type);

  if (info->type & GST_PAD_PROBE_TYPE_BUFFER_LIST) {
    g_warning ("Buffer list handling not implemented");
    return GST_PAD_PROBE_DROP;
  }

  if (info->type & GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM) {
    GstEvent *event = gst_pad_probe_info_get_event (info);
    switch (GST_EVENT_TYPE (event)) {
      case GST_EVENT_SEGMENT:
        gst_event_copy_segment (event, &si->seg);
        break;
      case GST_EVENT_EOS:
        dump_times (si);
        break;
      default:
        break;
    }
    return GST_PAD_PROBE_PASS;
  }

  buf = gst_pad_probe_info_get_buffer (info);
  if (!GST_BUFFER_PTS_IS_VALID (buf))
    goto done;
  end = start = GST_BUFFER_PTS (buf);

  if (GST_BUFFER_DURATION_IS_VALID (buf))
    end += GST_BUFFER_DURATION (buf);

  gst_segment_clip (&si->seg, GST_FORMAT_TIME, start, end, &start, &end);
  start = gst_segment_to_stream_time (&si->seg, GST_FORMAT_TIME, start);
  end = gst_segment_to_stream_time (&si->seg, GST_FORMAT_TIME, end);

  GST_DEBUG_OBJECT (pad, "new buffer %" GST_TIME_FORMAT
      " to %" GST_TIME_FORMAT, GST_TIME_ARGS (start), GST_TIME_ARGS (end));

  /* Now extend measured time range to include new times */
  extend_times (si, start, end);

done:
  return GST_PAD_PROBE_PASS;
}
示例#2
0
int main(int argc, char *argv[]){
  
  ij_net_t G1, G2;
  
  int N, m, m0, k_max;
  coupling_t matr;
  double gamma;
  distr_t delay_distr;

  char str[256];
  
  if (argc < 10){
    printf("Usage: %s <N> <m> <m0> <outfile> <a> <b> <c> <d> <gamma>\n", argv[0]);
    exit(1);
  }

  srand(time(NULL));
  
  /* Diagonal coupling */
  matr.a = atof(argv[5]);
  matr.b = atof(argv[6]);
  matr.c = atof(argv[7]);
  matr.d = atof(argv[8]);
  gamma = atof(argv[9]);

  N = atoi(argv[1]);
  m = atoi(argv[2]);
  m0 = atoi(argv[3]);

  G1.size = (N+m0) * m;
  G2.size = (N+m0) * m;

  init_structure(&G1, N);
  init_structure(&G2, N);
  
  
  G1.K = init_network(&G1, m0);
  G2.K = init_network(&G2, m0);

  delay_distr.N = N;
  delay_distr.gamma = gamma;
  delay_distr.x_min = 1;
  delay_distr.distr = malloc(N * sizeof(double));

  create_distr(delay_distr.distr, delay_distr.gamma, delay_distr.x_min, N);

  init_times_delay(&G2, &delay_distr, m0, N);

  dump_times(&G2, N);
  
  fprintf(stderr, "Init finished!\n");
  
  grow_multi_net_delay(&G1, &G2, N, m, m0, &matr);
  
  //printf("### G1\n");
  sprintf(str, "%s_layer1.txt", argv[4]);
  dump_network_to_file(&G1, str);
  
  //printf("### G2\n");
  sprintf(str, "%s_layer2.txt", argv[4]);
  dump_network_to_file(&G2, str);
  
  /* dump_network_to_file(S, S_num, argv[4]); */
  /* printf("Network dumped!\n"); */
  /* k_max = degree_distr(S, S_num, &distr); */
  /* printf("k_max is: %d\n", k_max); */
  /* dump_distr_to_file(distr, k_max, argv[5]); */
  
}