/*
- * ffplay : Simple Media Player based on the FFmpeg libraries
* Copyright (c) 2003 Fabrice Bellard
*
* This file is part of FFmpeg.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+/**
+ * @file
+ * simple media player based on the FFmpeg libraries
+ */
+
#include "config.h"
#include <inttypes.h>
#include <math.h>
pic->linesize[i] = ref->linesize[i];
}
pic->opaque = ref;
- pic->age = INT_MAX;
pic->type = FF_BUFFER_TYPE_USER;
pic->reordered_opaque = codec->reordered_opaque;
if(codec->pkt) pic->pkt_pts = codec->pkt->pts;
}
}
-/* since we have only one decoding thread, we can use a global
- variable instead of a thread local variable */
-static VideoState *global_video_state;
-
static int decode_interrupt_cb(void *ctx)
{
- return (global_video_state && global_video_state->abort_request);
+ VideoState *is = ctx;
+ return is->abort_request;
}
/* this thread gets the stream from the disk or the network */
is->audio_stream = -1;
is->subtitle_stream = -1;
- global_video_state = is;
-
ic = avformat_alloc_context();
ic->interrupt_callback.callback = decode_interrupt_cb;
+ ic->interrupt_callback.opaque = is;
err = avformat_open_input(&ic, is->filename, is->iformat, &format_opts);
if (err < 0) {
print_error(is->filename, err);
ret = 0;
fail:
- /* disable interrupting */
- global_video_state = NULL;
-
/* close each stream */
if (is->audio_stream >= 0)
stream_component_close(is, is->audio_stream);
if (is->ic) {
avformat_close_input(&is->ic);
}
- avio_set_interrupt_cb(NULL);
if (ret != 0) {
SDL_Event event;
init_opts();
- show_banner();
+ show_banner(argc, argv, options);
parse_options(NULL, argc, argv, options, opt_input_file);