ffplay: use framedrop by default when sync is not done to video

When using external sync, framedrop is perfectly fine.

Signed-off-by: Marton Balint <cus@passwd.hu>
ffplay: fix nosync threshold check in synchronize_audio

Signed-off-by: Marton Balint <cus@passwd.hu>
ffplay: initialize audio and video pts drift

This makes sensible audio and video clock values even before displaying the
first frame.

Signed-off-by: Marton Balint <cus@passwd.hu>
ffplay: fix external time sync mode

We now initalize the external clock to 0 and, we use the system clock to
regulate the timings of audio and video in external clock sync mode.  We
recover from external clock sync loss, when the delay to external clock is
bigger than AV_NOSYNC_THRESHOLD.

Signed-off-by: Marton Balint <cus@passwd.hu>
ffplay: add serial field to PacketQueue entry and populate it

The purpose of the serial field is to accompany the decoded data during the
decoding process to know if the decoded data belongs to the data stream after
the latest packet queue flush.

Signed-off-by: Marton Balint <cus@passwd.hu>
ffplay: only check external clock if current frame serial matches the displayed frame serial

This way we avoid updating the external clocks with timestamps beloging to
frames before seek.

Signed-off-by: Marton Balint <cus@passwd.hu>
ffplay: add get_master_sync_type function

The real av_sync_type may be different to VideoState->av_sync_type, because the
required audio or video stream for audio or video clock may not be available.
We will use a function to query the real av_sync_type which is used for
determining the master clock.

Signed-off-by: Marton Balint <cus@passwd.hu>
ffplay: use get_master_sync_type where necessary

We should make decisions based on the real sync type. This also simplifies
the code.

Signed-off-by: Marton Balint <cus@passwd.hu>
ffplay: if there is no audio stream, use external clock by default

Otherwise playing the video could be much slower than realtime if the system
can't decode or display the frames fast enough.

Signed-off-by: Marton Balint <cus@passwd.hu>
h264: add support for AFD detection

Signed-off-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Kieran Kunhya <kierank@ob-encoder.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Merge remote-tracking branch 'cus/stable'

* cus/stable:
  ffplay: if there is no audio stream, use external clock by default
  ffplay: use get_master_sync_type where necessary
  ffplay: add get_master_sync_type function
  ffplay: only check external clock if current frame serial matches the displayed frame serial
  ffplay: add serial field to PacketQueue entry and populate it
  ffplay: fix external time sync mode
  ffplay: initialize audio and video pts drift
  ffplay: fix nosync threshold check in synchronize_audio
  ffplay: use framedrop by default when sync is not done to video

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Improve MPEG-PS-in-MOV detection.

Fixes issue 1520.
fate: fix filter metadata dependency to ffprobe.
doc/muxers: document mov faststart option.
mpegaudiodec: Fix buffer handling on random access

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
lavc/utils: provide more feedback in case of experimental codec
lavfi/graphparser: fix parsing error in case of NULL sws_opts addition

If sws_opts was NULL it was resulting in the args being set to
"W:H:(null)", which with the new parsing code was generating a syntax
failure.
lavfi/avfiltergraph: avoid to print "(null)" in the scale args

Fix parsing.
avcodec: prefer decoders without CODEC_CAP_EXPERIMENTAL

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
avutil: Add AVERROR_EXPERIMENTAL

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>