If the video queue is aborted, we have to pop the pending ALLOC event or wait
for the allocation to complete, because the current code assumes that
VideoState->pictq_windex does not change until the allocation is complete.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Altough ffplay is working pretty well without using a lock manager, it is still
a multithreaded application calling libavcodec functions from multiple threads,
so using a lock manager is probably a good idea.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Getting rid of globals are generally a good thing. The patch also makes
toggle_pause and step_to_next_frame use a function parameter instead of
the global cur_stream variable.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This way the content of "vfilters" can be reused.
For example when the frame size changes, the filterchain is
reconfigured reusing again the vfilters value.
Use av_log(AV_LOG_LEVEL...) rather than av_dlog, the log is useful
even for "normal" debugging, and consistent with what is done in
ffmpeg.
Also change the message to achieve better consistency with the
corresponding ffmpeg message.
Use the value specified in the codec context for setting the
filterchain sample aspect ratio, when it is not specified in the
stream context.
Consistent with the ffmpeg behavior.
Fix trac issue #398.
Since SDL has no audio buffer fullness info, one can get a much precise audio
clock based on the last time of the audio callback and the elapsed time since.
To achieve this I introduced the audio_current_pts and audio_current_pts_drift
variables (similar to video_current_pts and video_current_pts_drift) and
calculate them in the end of the audio callback, when VideoState->audio_clock
is already updated. The reference time I use is from the start of the audio
callback, because this way the amount of time used for audio decoding is not
interfereing with calculation.
I also replaced the audio_write_get_buf_size function with a calculated
variable because when the audio frame decoding is in progress audio_buf_size
and audio_buf_index are not stable, so using them from other threads are not a
good idea.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Previously the target clock of the next frame was calculated by using video_clock
which is modified from another thread...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
All option parsing functions now match the function pointer signature through
which they are called (int f(const char *, const char *), thereby working
reliably on all platforms.
Prefix all option processing functions with opt_
The -i INPUT option can be implemented more cleanly by using a
function option, which can easily be done now that the
parse_arg_function passed to parse_options has a standard signature.
On Windows/MinGW the SDL cflags re-define the main() function, which
results in a linking error if the define is not undeffed.
Since the addition of the SDL output device, SDL cflags are used also
for compiling ffmpeg and ffprobe, so we need to move this trick from
ffplay.c to a common header.
Fix trac issue #256.