Exemple #1
0
gint main(gint argc, gchar **argv)
{
  gint i,r;
  gchar *s;

  g_assert(qm == NULL);
  g_assert(q == NULL);

  memset(&opts, 0, sizeof(struct _opts_s));
  setlocale(LC_ALL, "");

  r = opts_new(argc, argv);
  if (r != EXIT_SUCCESS)
    return (r);

  q = quvi_new();
  examples_exit_if_error();

  if (opts.autoproxy == TRUE)
    examples_enable_autoproxy();

  if (opts.verbose == TRUE)
    examples_enable_verbose();

  quvi_set(q, QUVI_OPTION_CALLBACK_STATUS, (qcs) examples_status);

  for (i=0; opts.url[i] != NULL; ++i)
    {
      qm = quvi_media_new(q, opts.url[i]);
      examples_exit_if_error();

      quvi_media_get(qm, QUVI_MEDIA_PROPERTY_TITLE, &s);
      g_print("[%s]\n  title='%s'\n", __func__, s);

      if (opts.best == TRUE)
        {
          quvi_media_stream_choose_best(qm);
          dump_stream();
        }
      else if (opts.stream != NULL)
        {
          quvi_media_stream_select(qm, opts.stream);
          examples_exit_if_error();
          dump_stream();
        }
      else
        dump_streams();

      quvi_media_free(qm);
      qm = NULL;
    }

  opts_free();
  examples_cleanup();

  g_assert(qm == NULL);
  g_assert(q == NULL);

  return (r);
}
Exemple #2
0
static void dump_track(const gavl_edl_track_t * t)
  {
  int i;
  gavl_diprintf(2, "Track\n");
  gavl_diprintf(4, "Metadata\n");
  gavl_metadata_dump(&t->metadata, 6);
  
  gavl_diprintf(4, "Audio streams: %d\n", t->num_audio_streams);
  for(i = 0; i < t->num_audio_streams; i++)
    {
    gavl_diprintf(6, "Audio stream\n");
    dump_stream(&t->audio_streams[i]);
    }
  
  gavl_diprintf(4, "Video streams: %d\n", t->num_video_streams);
  for(i = 0; i < t->num_video_streams; i++)
    {
    gavl_diprintf(6, "Video stream\n");
    dump_stream(&t->video_streams[i]);
    }

  gavl_diprintf(4, "Text streams: %d\n", t->num_text_streams);
  for(i = 0; i < t->num_text_streams; i++)
    {
    gavl_diprintf(6, "Text stream\n");
    dump_stream(&t->text_streams[i]);
    }
  gavl_diprintf(4, "Overlay streams: %d\n", t->num_overlay_streams);
  for(i = 0; i < t->num_overlay_streams; i++)
    {
    gavl_diprintf(6, "Overlay stream\n");
    dump_stream(&t->overlay_streams[i]);
    }
  }
Exemple #3
0
/* returns the number of attachments saved */
int save_attachments(int pageno, char *targetdir)
{
	pdf_page *page = pdf_load_page(doc, pageno-1);
	pdf_annot *annot;
	int saved_count = 0;

	for (annot = page->annots; annot ; annot = annot->next) {
		pdf_obj *fs_obj = pdf_dict_gets(annot->obj, "FS");
		if (fs_obj) {
			pdf_obj *ef_obj;
			char *name = basename(strdup(pdf_to_str_buf(pdf_dict_gets(fs_obj, "F"))));
			ef_obj = pdf_dict_gets(fs_obj, "EF");
			if (ef_obj) {
				pdf_obj *f_obj = pdf_dict_gets(ef_obj, "F");
				if (f_obj && pdf_is_indirect(f_obj)) {
					static char pathname[PATH_MAX];
					sprintf(pathname, "%s/%s", targetdir, name);
					FILE *fout = fopen(pathname, "w");
					if (!fout) {
						fprintf(stderr, "extr: cannot write to file %s\n", pathname);
						exit(1);
					}
					dump_stream(pdf_to_num(f_obj), fout);
					fclose(fout);
					saved_count++;
				}
			}
		}
	}
	return saved_count;
}
int main(int argc, char **argv)
{
	struct insn insn;
	int insns = 0;
	int errors = 0;
	unsigned long i;
	unsigned char insn_buf[MAX_INSN_SIZE * 2];

	parse_args(argc, argv);

	/*                              */
	memset(insn_buf + MAX_INSN_SIZE, INSN_NOP, MAX_INSN_SIZE);

	for (i = 0; i < iter_end; i++) {
		if (generate_insn(insn_buf) <= 0)
			break;

		if (i < iter_start)	/*                                */
			continue;

		/*                       */
		insn_init(&insn, insn_buf, x86_64);
		insn_get_length(&insn);

		if (insn.next_byte <= insn.kaddr ||
		    insn.kaddr + MAX_INSN_SIZE < insn.next_byte) {
			/*                            */
			dump_stream(stderr, "Error: Found an access violation", i, insn_buf, &insn);
			errors++;
		} else if (verbose && !insn_complete(&insn))
			dump_stream(stdout, "Info: Found an undecodable input", i, insn_buf, &insn);
		else if (verbose >= 2)
			dump_insn(stdout, &insn);
		insns++;
	}

	fprintf(stdout, "%s: decoded and checked %d %s instructions with %d errors (seed:0x%x)\n", (errors) ? "Failure" : "Success", insns, (input_file) ? "given" : "random", errors, seed);

	return errors ? 1 : 0;
}
Exemple #5
0
void result::dump_stream_list(std::ostream &out, const Json::Value &val) const
{
    if (_verbose) {
        for (const auto &x : val["streams"])
            dump_stream_full(out, x);
    } else {
        if (_descriptive)
            dump_stream_header(out);
        
        for (const auto &x : val["streams"])
            dump_stream(out, x);
    }
}
Exemple #6
0
void featured_streams_result::dump(std::ostream &out) const
{
    if (_section)
        out << "[ Featured ]:\n";
    
    auto featured_list = _json_value["featured"];
    
    if (_verbose) {
        for (const auto &x : featured_list)
            dump_stream_full(out, x["stream"]);
        
    } else {
        if (_descriptive)
            dump_stream_header(out);
        
        for (const auto &x : featured_list)
            dump_stream(out, x["stream"]);
    }
}
Exemple #7
0
static void dump_streams()
{
  while (quvi_media_stream_next(qm) == QUVI_TRUE)
    dump_stream();
}