Commit Graph

544 Commits

Author SHA1 Message Date
Michael Niedermayer e161b079de Merge remote-tracking branch 'qatar/master'
* qatar/master: (22 commits)
  configure: add check for w32threads to enable it automatically
  rtmp: do not hardcode invoke numbers
  cinepack: return non-generic errors
  fate-lavf-ts: use -mpegts_transport_stream_id option.
  Add an APIchanges entry and a minor bump for avio changes.
  avio: Mark the old interrupt callback mechanism as deprecated
  avplay: Set the new interrupt callback
  avconv: Set new interrupt callbacks for all AVFormatContexts, use avio_open2() everywhere
  cinepak: remove redundant coordinate checks
  cinepak: check strip_size
  cinepak, simplify, use AV_RB24()
  cinepak: simplify, use FFMIN()
  cinepak: Fix division by zero, ask for sample if encoded_buf_size is 0
  applehttp: Fix seeking in streams not starting at DTS=0
  http: Don't use the normal http proxy mechanism for https
  tls: Handle connection via a http proxy
  http: Reorder two code blocks
  http: Add a new protocol for opening connections via http proxies
  http: Split out the non-chunked buffer reading part from http_read
  segafilm: add support for raw videos
  ...

Conflicts:
	avconv.c
	configure
	doc/APIchanges
	libavcodec/cinepak.c
	libavformat/applehttp.c
	libavformat/version.h
	tests/lavf-regression.sh
	tests/ref/lavf/ts

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-19 02:00:06 +01:00
Clément Bœsch eafa2b6005 swr: introduce a public function to customize the channel mapping. 2011-11-17 18:30:03 +01:00
Clément Bœsch 645c61fb2b swr: rename swr_alloc2() to swr_alloc_set_opts(). 2011-11-17 10:16:07 +01:00
Michael Niedermayer 109d23e0b4 ffplay: use av_noreturn
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-11 04:25:35 +01:00
Michael Niedermayer 8cd210700b Merge remote-tracking branch 'cus/stable'
* cus/stable:
  ffplay: limit lowres to the maximum supported. Fixes Ticket591

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-09 20:51:49 +01:00
Michael Niedermayer 4354788a89 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  tls: Use ERR_get_error() in do_tls_poll
  indeo3: Fix a fencepost error.
  mxfdec: Fix comparison of unsigned expression < 0.
  mpegts: set stream id on just created stream, not an unrelated variable
  ra288: return error if input buffer is too small
  ra288: utilize DSPContext.vector_fmul()
  ra288: use memcpy() to copy decoded samples to output
  mace: only calculate output buffer size once
  Remove redundant filename self-references inside files.
  indeo3data: add missing config.h #include for HAVE_BIGENDIAN
  x86: drop pointless ARCH_X86 #ifdef from files in x86 subdirectory
  avplay: reset rdft when closing stream.
  doc/git-howto: expand format-patch and send-email notes.
  lavf: expand doxy for some AVFormatContext fields.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-09 02:59:49 +01:00
Michael Niedermayer d8407ee2b1 ffplay: limit lowres to the maximum supported. Fixes Ticket591
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Marton Balint <cus@passwd.hu>
2011-11-08 22:34:39 +01:00
Michael Niedermayer 13b7781ec8 Merge remote-tracking branch 'qatar/master'
* qatar/master: (23 commits)
  x86inc: use sse versions of common macros instead of sse2 when applicable
  doc/APIchanges: add missing dates and hashes
  lavf: don't return from void av_update_cur_dts()
  Changelog: add more entries.
  Changelog: update ffmpeg/avconv incompatibility list.
  avconv: remove some redundant temporary variables.
  avconv: fix broken indentation
  avconv: move copy_initial_nonkeyframes to the options context.
  avconv: use file:stream instead of file.stream in log messages.
  doc/avconv: elaborate on basic functionality.
  doc/avconv: -sample_fmts, not -help sample_fmts prints the sample formats
  openssl: Only use CRYPTO_set_id_callback on OpenSSL < 1.0.0
  Call avformat_network_init/deinit in the programs
  Remove leftover includes of strings.h
  avutil: Don't allow using strcasecmp/strncasecmp
  Replace all usage of strcasecmp/strncasecmp
  avstring: Add locale independent implementations of strcasecmp/strncasecmp
  avstring: Add locale independent implementations of toupper/tolower
  cosmetics: insert some spaces in explicit enum value assignments
  move 8SVX audio codecs to the audio codec list part on the next bump
  ...

Conflicts:
	avprobe.c
	doc/APIchanges
	ffplay.c
	ffserver.c
	libavcodec/avcodec.h
	libavdevice/bktr.c
	libavdevice/v4l.c
	libavdevice/v4l2.c
	libavformat/matroskaenc.c
	libavformat/wtv.c
	libavutil/avstring.c
	libavutil/avstring.h
	libavutil/avutil.h
	libswscale/x86/swscale_template.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-07 03:01:43 +01:00
Michael Niedermayer 304ec08f3b ffplay: Avoid useage of deprecated url_fileno().
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Marton Balint <cus@passwd.hu>
2011-11-05 00:25:07 +01:00
Clément Bœsch f5cd136f2b ffmpeg: add -map_channel option.
Based on an initial work by Baptiste Coudurier.
2011-11-04 19:40:32 +01:00
Michael Niedermayer df98446ba3 Revert "Remove detection of mmsh protocol in ffplay."
This reverts commit 2f64239338.
2011-10-31 18:04:39 +01:00
Marton Balint d54af906a4 ffplay: add frame drop statistics
Signed-off-by: Marton Balint <cus@passwd.hu>
2011-10-24 22:44:47 +02:00
Marton Balint 8f17a8efd6 ffplay: consider estimated time of filter in early frame drop
Signed-off-by: Marton Balint <cus@passwd.hu>
2011-10-24 22:44:47 +02:00
Marton Balint 223cba6e3a ffplay: reimplement early frame drop
This patch reimplements early frame drop, it is now based on the current
difference between the master clock and the video clock, and the pts of the
current and the last displayed (or skipped) frame.  If the frame to be added to
the queue is late after decoding, then we drop it early because later we would
drop it anyway (unless it is the only frame in the picture queue).

The current approach has only one downside that I know of, it does not handle
well when the filters are changing significantly the pts of the frames, because
we compare pts values from filtered and unfiltered frames.

We also start using the pictq_mutex to ensure consistent video_current_pts,
video_current_pts_drift, frame_last_pts, frame_last_dropped_pts and
frame_last_dropped_pos values.

Signed-off-by: Marton Balint <cus@passwd.hu>
2011-10-24 22:44:47 +02:00
Michael Niedermayer f97faf6751 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  id3v2: fix doxy comment - 'machine byte order' makes no sense on char arrays
  VC1: restore mistakenly removed code
  twinvq: check output buffer size before decoding
  twinvq: return an error when the packet size is too small
  lavf: export some forgotten symbols with non-av prefixes.
  swscale: update altivec yuv2planeX asm to new per-plane API.
  swscale: make yuv2yuvX_10_sse2/avx 8/9/16-bits aware.
  yuv2planeX10 SIMD
  swscale: decide whether to use yuv2plane1/X on a per-plane basis.
  swscale: reintroduce full precision in 16-bit output.
  Split up yuv2yuvX functions
  Split out yuv2yuv1 luma and chroma in order to make them generic DSP functions
  lavc: replace references to deprecated AVCodecContext.error_recognition to use AVCodecContext.err_recognition
  lavc: translate non-flag-based er options into flag-based ef options at codec open
  add -err_filter AVOptions to access flag-based error recognition
  h264_weight: initialize "height" function argument properly.
  presets: spelling error in libvpx 1080p50_60
  avplay: fix fullscreen behaviour with SDL 1.2.14 on Mac OS X

Conflicts:
	ffplay.c
	libavformat/libavformat.v
	libswscale/swscale.c
	libswscale/x86/swscale_template.c
	tests/ref/lavfi/pixfmts_scale

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-10-23 05:13:56 +02:00
Marton Balint 8085a5b7cd ffplay: reallocate SDL overlays for OSX when changing full screen
Fixes missing blue channel when switching from/to fullscren on OSX and libsdl
1.2.14. Fixes issue 548. Thanks for Jean First for the original patch and
for testing.

Signed-off-by: Marton Balint <cus@passwd.hu>
2011-10-20 23:12:27 +02:00
Jean First 72776adfb9 ffplay: avoid window resize crash on osx with libsdl 1.2.14
Signed-off-by: Marton Balint <cus@passwd.hu>
2011-10-16 19:28:22 +02:00
Marton Balint abb0e4f637 ffplay: add delay multiple times to frame_timer if it is less than current time
If the picture queue is empty, or when the calculated delay is 0, frame_timer
is not increased but we are still displaying the old frame. When we eventually
get a frame, where the computed delay is positive, so we don't need to drop any
more frames, then it is best to update frame_timer to be as near as the current
time as it can.

This way we dont't have to wait several frames to add the necesarry delays to
frame_timer to reach current time, therefore there are no extra frame drops
after reaching a positive delay.

Signed-off-by: Marton Balint <cus@passwd.hu>
2011-10-16 19:21:01 +02:00
Marton Balint d2d8e1e599 ffplay: remove early frame drop functionality
The current impementation of early frame drops (dropping frames before adding
them to the picture queue) has multiple problems:

Even after gettin A-V sync, the frame droping continues until
VideoState->skip_frames reaches 1, which can take a lot of time causing useless
additional frame drops and bad AV-sync. This issue can be easily triggered with
for example changing the audio stream.

Also video_refresh currenly does not handle early skipped frames in every case,
for example if we skip a frame, then the last frame duration calculation will
compute the duration of the sum of the skipped frame and the duration of the
frame before that, and in compute_target_delay we may multiply this unusually
big delay.

Signed-off-by: Marton Balint <cus@passwd.hu>
2011-10-16 19:21:01 +02:00
Marton Balint 4e268aae55 ffplay: calculate target clock dynamically, make code more readable
Since target clock is based on the current A-V delay, it is better calculate it
when we actually need it rather than when we put a picture in the picture
queue.

The patch also makes a code a bit more readable by renaming some delay
variables to duration, and converting compute_target_time to a delay
calculating function which does not modify the state. Factoring out the
iteration of the pictq to standalone function is also done in this patch.

Signed-off-by: Marton Balint <cus@passwd.hu>
2011-10-16 19:21:01 +02:00
Michael Niedermayer f884ef00de Merge remote-tracking branch 'qatar/master'
* qatar/master: (31 commits)
  tiffenc: initialize forgotten avctx.
  avplay: free the active audio packet at exit.
  avplay: free rdft data used for spectrogram analysis.
  log.h: make AVClass a named struct
  fix ac3 encoder documentation
  vc1: more prettyprinting cosmetics
  vc1: prettyprint some tables
  vc1: K&R formatting cosmetics
  AVOptions: bump minor and add APIchanges entry.
  cmdutils/avtools: simplify show_help() by using av_opt_child_class_next()
  AVOptions: rename FF_OPT_TYPE_* => AV_OPT_TYPE_*
  Remove all uses of deprecated AVOptions API.
  AVOptions: add av_opt_next, deprecate av_next_option.
  AVOptions: add functions for evaluating option strings.
  AVOptions: split get_number().
  AVOptions: add av_opt_get*, deprecate av_get*.
  AVOptions: add av_opt_set*().
  AVOptions: add new API for enumerating children.
  rv34: move inverse transform functions to DSP context
  flvenc: Write the right metadata entry count
  ...

Conflicts:
	avconv.c
	cmdutils.c
	doc/APIchanges
	ffplay.c
	ffprobe.c
	libavcodec/ac3dec.c
	libavcodec/h264.c
	libavcodec/libvpxenc.c
	libavcodec/libx264.c
	libavcodec/mpeg12enc.c
	libavcodec/options.c
	libavdevice/libdc1394.c
	libavdevice/v4l2.c
	libavfilter/vf_drawtext.c
	libavformat/flvdec.c
	libavformat/mpegtsenc.c
	libavformat/options.c
	libavutil/avutil.h
	libavutil/opt.c
	libswscale/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-10-13 06:00:03 +02:00
Marton Balint 1dd3c473a2 ffplay: use libswresample instead of av_audio_convert
Previously ffplay expected SDL_AudioOpen to provide the requested sample rate
and channel number. This is no longer a requirement because this patch replaces
the audio convert function with libswresample's swr_convert which is capable of
handling different sample formats, sample rates and different number of
channels and different channel layouts.

The patch also removes the hardcoded 16bit samples assumption and uses
av_get_bytes_per_sample almost everywhere. The only exceptions are
the update_sample_display and video_audio_display functions, it
seemed too much of a headache to make them generic.

We also fix a tiny bug in sdl_audio_callback, we ensure that the number of
bytes when we put silence in the buffer is a multiple of the frame size.
2011-10-02 22:23:11 +02:00
Marton Balint 2446a8cc0a ffplay: use avctx->channels and avctx->freq before avcodec_open2 consistently 2011-10-02 21:21:46 +02:00
Marton Balint 1e7f7dc2d1 ffplay: remove now unnecessary request_channels, we set it now with options 2011-10-02 21:21:46 +02:00
Michael Niedermayer 92dac3a9dd ffplay: set request_channels to 2
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-10-02 21:21:46 +02:00
Michael Niedermayer 0aa793a1be ffplay: fix forgotten codec_name checks
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-09-28 03:19:22 +02:00
Michael Niedermayer 5eda0967a5 ffplay: support -codec:avs to force a specific decoder implementation
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-09-27 21:56:20 +02:00
Michael Niedermayer 7c1aba4f01 Merge remote-tracking branch 'qatar/master'
* qatar/master: (21 commits)
  fate: allow testing with libavfilter disabled
  x86: XOP/FMA4 CPU detection support
  ws_snd: misc cosmetic clean-ups
  ws_snd: remove the 2-bit ADPCM table and just subtract 2 instead.
  ws_snd: use memcpy() and memset() instead of loops
  ws_snd: use samples pointer for loop termination instead of a separate iterator variable.
  ws_snd: make sure number of channels is 1
  ws_snd: add some checks to prevent buffer overread or overwrite.
  ws_snd: decode to AV_SAMPLE_FMT_U8 instead of S16.
  flacdec: fix buffer size checking in get_metadata_size()
  rtp: Simplify ff_rtp_get_payload_type
  rtpenc: Add a payload type private option
  rtp: Correct ff_rtp_get_payload_type documentation
  avconv: replace all fprintf() by av_log().
  avconv: change av_log verbosity from ERROR to FATAL for fatal errors.
  cmdutils: replace fprintf() by av_log()
  avtools: parse loglevel before all the other options.
  oggdec: add support for Xiph's CELT codec
  sol: return error if av_get_packet() fails.
  cosmetics: reindent and pretty-print
  ...

Conflicts:
	avconv.c
	cmdutils.c
	libavcodec/avcodec.h
	libavcodec/version.h
	libavformat/oggparsecelt.c
	libavformat/utils.c
	libavutil/avutil.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-09-27 02:14:37 +02:00
Michael Niedermayer 3715e67591 ffplay: fix order of operations for sdl audio open.
Fixes Ticket149

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-09-24 03:09:54 +02:00
Michael Niedermayer 28d3738428 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  Add LATM demuxer
  avplay: flush audio decoder with empty packets at EOF if the decoder has CODEC_CAP_DELAY set.
  8svx/iff: fix decoding of compressed stereo 8svx files.
  8svx: log an error message if output buffer is too small
  8svx: check packet size before reading the initial sample value.
  8svx: output 8-bit samples instead of 16-bit.
  8svx: split delta decoding into a separate function.
  mp4: Don't read an empty Decoder Config Descriptor
  fate.sh: Ignore errors from rm command during cleanup.
  fate.sh: Run git-pull in quiet mode to avoid console spam.
  Apple ProRes decoder
  rtmp: Make the input FLV parser handle data cut at any point
  rv34: Check for invalid slices offsets
  eval: test isnan(sqrt(-1)) instead of just sqrt(-1)

Conflicts:
	Changelog
	libavcodec/8svx.c
	libavcodec/proresdec.c
	libavcodec/version.h
	libavformat/iff.c
	libavformat/version.h
	tests/ref/fate/eval

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-09-23 00:35:31 +02:00
Michael Niedermayer a30ef63354 ffplay: dont drop all frames if realtime decoding is impossible
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-09-14 14:56:59 +02:00
Michael Niedermayer fbbe092568 ffplay: remove thread command line option code, it is unneeded for -threads X to work.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-09-13 15:05:42 +02:00
Michael Niedermayer 838e36635a avcodec: move "thread emulation" warning to common code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-09-13 15:05:42 +02:00
Stefano Sabatini 4f7dfe12ea lavfi: rename vsink_buffer.c to sink_buffer.c, and vsink_buffer.h to buffersink.h
This is done in order to clarify the non-video-specific nature of the
buffersink code, as the result of the video/audio API unification of
the previous commit, and for improving overall consistency.
2011-09-06 18:51:09 +02:00
Stefano Sabatini c4415f6ec9 lavfi: unify asink_buffer and vsink_buffer API
The new API is more generic (no distinction between audio/video for
pulling frames), and avoids code duplication.

A backward compatibility layer is kept for avoiding tools ABI breaks
(only for the video binary interface, audio interface was never used
in the tools).
2011-09-06 18:47:04 +02:00
Michael Niedermayer d2084402e6 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  lavc: fix type for thread_type option
  avconv: move format to options context
  avconv: move limit_filesize to options context
  avconv: move start_time, recording_time and input_ts_offset to options context
  avconv: add a context for options.
  cmdutils: allow storing per-stream/chapter/.... options in a generic way
  cmdutils: split per-option code out of parse_options().
  cmdutils: add support for caller-provided option context.
  cmdutils: declare only one pointer type in OptionDef
  cmdutils: move grow_array() from avconv to cmdutils.
  cmdutils: move exit_program() declaration to cmdutils from avconv
  http: Consider the stream as seekable if the reply contains Accept-Ranges: bytes
  nutenc: add namespace to the api facing functions

Conflicts:
	avconv.c
	cmdutils.c
	cmdutils.h
	ffmpeg.c
	ffplay.c
	ffprobe.c
	ffserver.c
	libavformat/http.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-09-05 03:10:45 +02:00
Michael Niedermayer 1889c6724a Merge remote-tracking branch 'qatar/master'
* qatar/master:
  AVOptions: fix av_set_string3() doxy to match reality.
  cmdutils: get rid of dummy contexts for examining AVOptions.
  lavf,lavc,sws: add {avcodec,avformat,sws}_get_class() functions.
  AVOptions: add AV_OPT_SEARCH_FAKE_OBJ flag for av_opt_find().
  cpu detection: avoid a signed overflow

Conflicts:
	avconv.c
	cmdutils.c
	doc/APIchanges
	ffmpeg.c
	libavcodec/options.c
	libavcodec/version.h
	libavformat/version.h
	libavutil/avutil.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-09-04 04:11:53 +02:00
Diego Biurrun aebb56e184 Replace some commented-out debug printf() / av_log() messages with av_dlog().
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-09-01 01:31:03 +02:00
Marton Balint 0a1cf66210 ffplay: fix a crash caused by aborting the video queue
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>
2011-08-26 17:08:46 +02:00
Marton Balint ee0ff051f2 ffplay: use lock manager callback to make libavcodec thread-safe
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>
2011-08-25 04:06:09 +02:00
Marton Balint ba571f6b4d ffplay: remove unnecessary if (cur_stream) checks
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-08-21 20:33:02 +02:00
Marton Balint 84506ebd48 ffplay: get rid of the global cur_stream variable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-08-21 20:33:02 +02:00
Marton Balint 5db1f94b8d ffplay: make step variable a member of the VideoState struct
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>
2011-08-21 20:33:02 +02:00
Stefano Sabatini 15802e78e7 ffplay: do not erase the content of vfilters
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.
2011-08-17 10:29:34 +02:00
Stefano Sabatini 031ba46633 ffplay: increase log level of the message issued when the stream frame size changes
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.
2011-08-17 10:29:34 +02:00
Stefano Sabatini c6ef3f4481 ffplay: in input_config_props(), prefer "s" over unnecessary "c" temporary variable
Sligthly improve readability, reduce redundancy.
2011-08-17 10:29:34 +02:00
Stefano Sabatini f8eaa006b6 ffplay: in input_config_props(), honour the SAR specified in the codec context
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.
2011-08-17 10:29:34 +02:00
Carl Eugen Hoyos 67a8251690 Fix compilation with --disable-avfilter. 2011-08-16 23:31:09 +02:00
Michael Niedermayer 1a34478b71 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  Fix NASM include directive
  dsputil_mmx: Honor HAVE_AMD3DNOW
  lavf,lavd: remove all usage of AVFormatParameters from demuxers.
  jack: add 'channels' private option.
  VC-1: fix reading of custom PAR.
  Remove redundant and dubious video codec detection by its extradata
  mpeg12: remove repeat-field code disabled since May 2002
  patch checklist: suggest fate instead of regression tests
  Turn on resampling on sudden size change instead of bailing out during recode.
  avtools: reinitialise filter chain when input video stream changes dimensions

Conflicts:
	Makefile
	avconv.c
	doc/developer.texi
	ffplay.c
	libavcodec/x86/dsputil_mmx.c
	libavdevice/libdc1394.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-08-15 23:35:53 +02:00
Marton Balint 10b7b4a6a1 ffplay: more precise audio clock based on current time
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>
2011-08-15 03:49:07 +02:00