Create a generic frame and a frame queue struct to handle video picture queues
and subtitle picture queues with common code. Also add the possibility to queue
AVFrames, however at the moment we only use SDL_Overlay buffers for video and
AVSubtitles for subtitles.
Signed-off-by: Marton Balint <cus@passwd.hu>
Since audio clock calculations are more accurate now, it is safe to decrease
the sync treshold to compensate the larger buffers caused by less frequent
audio callbacks.
Signed-off-by: Marton Balint <cus@passwd.hu>
Too many audio callbacks per second can cause buffer underruns especially under
load. As now we take into accound the elapsed time after an audio callback when
determining current audio clock, it is not that important to use small buffer
sizes and frequent audio callbacks, so lets remove the comment.
Signed-off-by: Marton Balint <cus@passwd.hu>
Instead of directly rolling back the frame queue, keep the last displayed
picture in the queue and use a boolean variable to keep track if it is
displayed or not. This makes the code cleaner because it removes the
complicated logic in pictq_prev_picture.
There should be no change in functionality.
Signed-off-by: Marton Balint <cus@passwd.hu>
with -f lavfi -i testsrc=s=hd1080 as source:
rotate=90*PI/180 vs transpose=clock: 42fps -> 64fps
rotate=180*PI/180 vs vflip,hflip: 75fps -> 77fps
rotate=270*PI/180 vs transpose=cclock: 43fps -> 63fps
Whenever av_gettime() is used to measure relative period of time,
av_gettime_relative() is prefered as it guarantee monotonic time
on supported platforms.
Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Less than 0.04 sec delays should not be noticable, and it helps us with 50fps
content where some timing errors can cause a frame dup where it is not really
necessary.
Signed-off-by: Marton Balint <cus@passwd.hu>
After this commit applications needs to call av_format_inject_global_side_data()
or handle AVStream side data by some other means if they want it not to be lost.
This fixes a API incompatibility with libav.
libav API does not allow the data to be passed through AVPackets
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'b36bc81ccaa2fc85dc4bae7dc546c71e8833573d':
avplay: add support for seeking to chapter marks
Conflicts:
doc/ffplay.texi
ffplay.c
ffplay uses pageup/down for seeking by +-10min
thus this use of the keys conflicts.
The merge thus uses them to seek to chapters when there are some or
+-10min when there are not
Merged-by: Michael Niedermayer <michaelni@gmx.at>
When SDL could not allocate a YUV overlay or open a window, the video thread
got locked up because it waited for the allocation to finish forever.
Reported-by: Carl Eugen Hoyos <cehoyos@ag.or.at>
Signed-off-by: Marton Balint <cus@passwd.hu>
* commit '84f131921ffb43d8070d5680e91f6a24d66ccac4':
avplay: do not call avcodec_get_frame_defaults().
Conflicts:
ffplay.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
It was introduced in c2e8691c07, but since we no
longer no longer provide a custom get_buffer callback, the original cause of
the issue is gone.
Signed-off-by: Marton Balint <cus@passwd.hu>
It is no longer necessary. Also do frame timer and video current pos reset in
the main thread because with the wait removed, the timing would not be optimal
in the read thread.
Signed-off-by: Marton Balint <cus@passwd.hu>
Also do not update current pts on dropped frames, it is no longer necessary.
Fixes regression part of ticket #2507.
Signed-off-by: Marton Balint <cus@passwd.hu>
- consider it an invalid PTS when the next PTS value is the same as the current one
- in case of invalid or unknown PTS, return vp->duration
This fixes ffplay part of ticket #3005.
Signed-off-by: Marton Balint <cus@passwd.hu>
When changing the audio, video or subtitle stream, from now on, ffplay will
cycle through the streams of the current program.
Signed-off-by: Marton Balint <cus@passwd.hu>
This avoids future ABI issues when the field is moved to the end of the
struct.
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Also make sure that we only exit or restart the video if it is not paused and
if the picture queue is empty.
There is still room for improvement (filters may also buffer some frames), but
the patch fixes the most common use cases and ticket #2783 as well.
Signed-off-by: Marton Balint <cus@passwd.hu>
Theoretically using start_time should also work if seeking is available and we
could determine that the next packet after a flush packet is the first packet
of a stream, but I could not think of an easy and clean way to do that, that is
why I sticked to the no seeking available condition for now.
Fixes ticket #2647.
Signed-off-by: Marton Balint <cus@passwd.hu>
Previously we estimated the audio packet pts instead of the frame pts,
therefore it only worked within a single packet (containing multiple frames).
The new method works accross seperate audio packets as well and also handles
better the case if a decoder buffers several packets before outputting a
decoded frame.
Signed-off-by: Marton Balint <cus@passwd.hu>
Also use negative stream_index for signaling obsolete audio packets. Using the
size alone is not enough, because size is 0 for null packets as well.
Signed-off-by: Marton Balint <cus@passwd.hu>
Add function avfilter_graph_parse_ptr() and favor it in place of
avfilter_graph_parse(), which will be restored with the old/Libav
signature at the next bump.
If HAVE_INCOMPATIBLE_LIBAV_API is enabled it will use the
Libav-compatible signature for avfilter_graph_parse().
At the next major bump the current implementation of
avfilter_graph_parse() should be dropped in favor of the Libav/old
implementation.
Should address trac ticket #2672.
SDL surface pitch is 16bit, to avoid possible overflows, we limit the window
width to 16383. Fixes ticket #2428.
Signed-off-by: Marton Balint <cus@passwd.hu>
Showing A-V diff has no use if there is no audio and video stream, but showing
the audio or video clock difference to the master clock can be useful.
Signed-off-by: Marton Balint <cus@passwd.hu>
It was raised to 4 because of a theoretical issue, if we ensure that we do not
return from the display function without popping one picture from the queue,
then its OK to use the old size.
Signed-off-by: Marton Balint <cus@passwd.hu>
* commit 'fa2a34cd40d124161c748bb0f430dc63c94dd0da':
lavfi: change the filter registering system to match the other libraries
Conflicts:
cmdutils.c
ffplay.c
libavfilter/avfilter.c
libavfilter/avfilter.h
This removes the ability to put AVFilters in read only memory and having
them shareable.
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Requeue them after seeking and also after opening a video stream. Also don't
fill the video queue in case of an attached picture video stream since there
will be no more than one packet from that stream.
Signed-off-by: Marton Balint <cus@passwd.hu>
The corresponding codec options (skip_loop, skip_idct, skip_frame) can be
set in a more flexible way.
This technically causes a user interface break, but since the options
were not even documented and we just released a major version that should
not be a serious issue.
* commit '2eaa3663fda750dac66d41fe8541a8744d5563a4':
avplay: enable only when SDL 1.2 is found
Conflicts:
configure
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '354468fc12dcf93e7fb4af552e18906771913273':
avplay: switch to new refcounted frames API
avconv: convert to new refcounted AVFrame API
Conflicts:
cmdutils.c
ffmpeg.c
ffmpeg.h
ffplay.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This helps us not to make bad decision (frame dropping, audio compensation)
right after seeking when we do not know yet the recent audio or video clock.
Signed-off-by: Marton Balint <cus@passwd.hu>
We are now using a pts based approach, libavutil/libavcodec should provide the
correct pts-es anyway. This also fixes an issue when seeking to a frame with a
pts set to zero.
Signed-off-by: Marton Balint <cus@passwd.hu>
We use a refresh loop which displays the frames and also does the polling for
pending events in a non-blocking way. If we know the required delay until the
next frame, then exactly that amount of sleeping will be done. After each
handled event we check if we have to display a frame which kind of makes
displaying the frame a high priority event.
This improves greatly the smoothness of the video output especially with 50fps
content.
Signed-off-by: Marton Balint <cus@passwd.hu>
* commit 'db0a943266be29ff0596872ebb418dfed75d00de':
avplay: apply the stream sample_aspect_ratio to decoded video frames
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* cus/stable:
ffplay: step to next frame if paused when seeking
ffplay: move up pause functions
ffplay: remember last window dimensions
ffplay: fix order of setting show_mode
ffplay: dynamically allocate audio buffer
Merged-by: Michael Niedermayer <michaelni@gmx.at>
After this change the dimensions of single image videos will be remembered when
coming back from full screen. The issue was mentioned in ticket #2174.
Signed-off-by: Marton Balint <cus@passwd.hu>
We simply remove the fixed length VideoState->audio_buf2 and use
the previously unused VideoState->audio_buf1.
Fixes ticket #2191.
Signed-off-by: Marton Balint <cus@passwd.hu>
Actually we just re-create the filters, since there is no way to flush them.
Fixes hangup with yadif filter on seeking forward caused by a filtered frame
with a pts before the seek.
Signed-off-by: Marton Balint <cus@passwd.hu>