Skip to content
Snippets Groups Projects
ffplay.c 97 KiB
Newer Older
  • Learn to ignore specific revisions
  •            "s                   activate frame-step mode\n"
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
               "left/right          seek backward/forward 10 seconds\n"
               "down/up             seek backward/forward 1 minute\n"
    
               "mouse click         seek to percentage in file corresponding to fraction of width\n"
    
    static int opt_input_file(const char *opt, const char *filename)
    
        if (input_filename) {
            fprintf(stderr, "Argument '%s' provided as input filename, but '%s' was already specified.\n",
                    filename, input_filename);
            exit(1);
        }
    
            filename = "pipe:";
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
        input_filename = filename;
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    }
    
    /* Called from the main */
    int main(int argc, char **argv)
    {
    
        av_log_set_flags(AV_LOG_SKIP_REPEATED);
    
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
        /* register all codecs, demux and protocols */
    
    Luca Abeni's avatar
    Luca Abeni committed
        avcodec_register_all();
    
    Luca Abeni's avatar
    Luca Abeni committed
        avdevice_register_all();
    
    #if CONFIG_AVFILTER
        avfilter_register_all();
    #endif
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
        av_register_all();
    
    
        parse_options(argc, argv, options, opt_input_file);
    
            fprintf(stderr, "An input file must be specified\n");
    
            fprintf(stderr, "Use -h to get full help or, even better, run 'man ffplay'\n");
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    
        if (display_disable) {
            video_disable = 1;
        }
    
        flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
    
    #if !defined(__MINGW32__) && !defined(__APPLE__)
        flags |= SDL_INIT_EVENTTHREAD; /* Not supported on Windows or Mac OS X */
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
        if (SDL_Init (flags)) {
    
            fprintf(stderr, "Could not initialize SDL - %s\n", SDL_GetError());
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
            exit(1);
        }
    
        if (!display_disable) {
    
    #if HAVE_SDL_VIDEO_SIZE
    
            const SDL_VideoInfo *vi = SDL_GetVideoInfo();
            fs_screen_width = vi->current_w;
            fs_screen_height = vi->current_h;
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
        }
    
        SDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE);
        SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE);
        SDL_EventState(SDL_USEREVENT, SDL_IGNORE);
    
    
        av_init_packet(&flush_pkt);
        flush_pkt.data= "FLUSH";
    
    
        cur_stream = stream_open(input_filename, file_iformat);
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    
        event_loop();
    
        /* never returns */
    
        return 0;
    }