예제 #1
0
int main(int argc, char **argv)
{
    int ret;

    av_register_all();
    init_opts();
#if CONFIG_AVDEVICE
    avdevice_register_all();
#endif

    show_banner();
    parse_options(argc, argv, options, opt_input_file);

    if (!input_filename) {
        show_usage();
        fprintf(stderr, "You have to specify one input file.\n");
        fprintf(stderr, "Use -h to get full help or, even better, run 'man ffprobe'.\n");
        exit(1);
    }

    ret = probe_file(input_filename);

    av_free(avformat_opts);

    return ret;
}
예제 #2
0
	//-----------------------------------------------------------------//
	bool copy_file(const std::string& src, const std::string& dst, bool dup)
	{
		if(src.empty() || dst.empty()) return false;

		auto f = probe_file(dst);
		if(!dup && f) {
			return false;
		}
		if(dup && f) {
			remove_file(dst);
		}

		utils::file_io fin;
		if(!fin.open(src, "rb")) {
			return false;
		}
		utils::file_io fout;
		if(!fout.open(dst, "wb")) {
			return false;
		}

		std::vector<uint8_t> buff;
		buff.resize(4096);

		uint32_t sz = 0;
		do {
			sz = fin.read(&buff[0], buff.size());
			if(fout.write(&buff[0], sz) != sz) return false;
		} while(sz >= buff.size()) ;

		return true;
	}
예제 #3
0
파일: avprobe.c 프로젝트: Fatbag/libav
int main(int argc, char **argv)
{
    int ret;

    parse_loglevel(argc, argv, options);
    av_register_all();
    avformat_network_init();
    init_opts();
#if CONFIG_AVDEVICE
    avdevice_register_all();
#endif

    show_banner();
    parse_options(NULL, argc, argv, options, opt_input_file);

    if (!input_filename) {
        show_usage();
        fprintf(stderr, "You have to specify one input file.\n");
        fprintf(stderr,
                "Use -h to get full help or, even better, run 'man %s'.\n",
                program_name);
        exit(1);
    }

    ret = probe_file(input_filename);

    uninit_opts();
    av_dict_free(&fmt_entries_to_show);

    avformat_network_deinit();

    return ret;
}
예제 #4
0
파일: avprobe.c 프로젝트: elnormous/libav
int main(int argc, char **argv)
{
    int ret;
    uint8_t *buffer = av_malloc(AVP_BUFFSIZE);

    if (!buffer)
        exit(1);

    register_exit(avprobe_cleanup);

    options = real_options;
    parse_loglevel(argc, argv, options);
    av_register_all();
    avformat_network_init();
    init_opts();
#if CONFIG_AVDEVICE
    avdevice_register_all();
#endif

    show_banner();

    octx.print_header = ini_print_header;
    octx.print_footer = ini_print_footer;

    octx.print_array_header = ini_print_array_header;
    octx.print_array_footer = ini_print_array_footer;
    octx.print_object_header = ini_print_object_header;

    octx.print_integer = ini_print_integer;
    octx.print_string = ini_print_string;

    parse_options(NULL, argc, argv, options, opt_input_file);

    if (!input_filename) {
        show_usage();
        fprintf(stderr, "You have to specify one input file.\n");
        fprintf(stderr,
                "Use -h to get full help or, even better, run 'man %s'.\n",
                program_name);
        exit_program(1);
    }

    probe_out = avio_alloc_context(buffer, AVP_BUFFSIZE, 1, NULL, NULL,
                                 probe_buf_write, NULL);
    if (!probe_out)
        exit_program(1);

    probe_header();
    ret = probe_file(input_filename);
    probe_footer();
    avio_flush(probe_out);
    av_freep(&probe_out);
    av_freep(&buffer);
    uninit_opts();
    avformat_network_deinit();

    return ret;
}
예제 #5
0
파일: avprobe.c 프로젝트: madotsuki/libav
int main(int argc, char **argv)
{
    int ret;

    parse_loglevel(argc, argv, options);
    av_register_all();
    init_opts();
#if CONFIG_AVDEVICE
    avdevice_register_all();
#endif

	opt_loglevel(NULL, "quiet");
    parse_options(NULL, argc, argv, options, opt_input_file);

    if(!input_filename)
		input_filename = "/dev/stdin";

    ret = probe_file(input_filename);	// FIXME - do proper error handling

    return ret;
}
예제 #6
0
void probe_stream(info_t *ipipe)
{
    static ProbeInfo probe_info;

    verbose = ipipe->verbose;

    ipipe->probe_info = &probe_info;
    ipipe->probe = 1;

    /* data structure will be filled by subroutines */
    memset(&probe_info, 0, sizeof(ProbeInfo));
    probe_info.magic = ipipe->magic;

    /* ------------------------------------------------------------
     * check file type/magic and take action to probe for contents
     * ------------------------------------------------------------*/

    /* not-plain-old-file stuff */
    switch (ipipe->magic) {
      case TC_MAGIC_MPLAYER:
        probe_mplayer(ipipe);
        break;

      case TC_MAGIC_VNC:
        probe_vnc(ipipe);
        break;

      case TC_MAGIC_V4L_VIDEO:
      case TC_MAGIC_V4L_AUDIO:
        probe_v4l(ipipe);
        break;

      case TC_MAGIC_BKTR_VIDEO:
        probe_bktr(ipipe);
        break;

      case TC_MAGIC_SUNAU_AUDIO:
        probe_sunau(ipipe);
        break;

      case TC_MAGIC_BSDAV:
        probe_bsdav(ipipe);
        break;

      case TC_MAGIC_OSS_AUDIO:
        probe_oss(ipipe);
        break;

      case TC_MAGIC_DVD:
      case TC_MAGIC_DVD_PAL:
      case TC_MAGIC_DVD_NTSC:
        probe_dvd(ipipe);
        break;

      case TC_MAGIC_XML:
        probe_xml(ipipe);
        break;

      case TC_MAGIC_X11:
        probe_x11(ipipe);
        break;

      default: /* fallback to P.O.D. file... */
        probe_file(ipipe);
        break; /* for coherency */
    }

    if (ipipe->magic == TC_MAGIC_XML) {
        ipipe->probe_info->magic_xml = TC_MAGIC_XML;
        /*
         * used in transcode to load import_xml and to have
         * the correct type of the video/audio
         */
    } else {
        ipipe->probe_info->magic_xml = ipipe->probe_info->magic;
    }

    return;
}