Commit Graph

523 Commits

Author SHA1 Message Date
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
Michael Niedermayer
0cb233cf46 Merge commit 'b2c087871dafc7d030b2d48457ddff597dfd4925'
* commit 'b2c087871dafc7d030b2d48457ddff597dfd4925':
  Move x86util.asm from libavcodec/ to libavutil/.
  Move x86inc.asm to libavutil/.
  APIchanges: note error_recognition in lavf
  lavf: add support for error_recognition, use it in avidec, and bump minor API version
  avconv: change semantics of -map
  avconv: get rid of new* options.
  cmdutils: allow precisely specifying a stream for AVOptions.
  configure: add missing CFLAGS to fix building on the HURD
  libx264: Include hint for possible values for configuring libx264
  cmdutils: allow ':'-separated modifiers in option names.
  avconv: make -map_metadata work consistently with the other options
  avconv: remove deprecated options.
  avconv: make -map_chapters accept only the input file index.
  Make a copy of ffmpeg under a new name -- avconv.
  ffmpeg: add a warning stating that the program is deprecated.
  Add weighted motion compensation for RV40 B-frames
  RV3/4: calculate B-frame motion weights once per frame
  Move RV3/4-specific DSP functions into their own context
  mjpeg: propagate decode errors from ff_mjpeg_decode_sos and ff_mjpeg_decode_dqt
  h264: notice memory allocation failure

Conflicts:
	.gitignore
	Makefile
	cmdutils.c
	configure
	doc/ffplay.texi
	doc/ffprobe.texi
	doc/ffserver.texi
	libavcodec/libx264.c
	libavformat/avformat.h
	libavformat/avidec.c
	libavformat/version.h
	tests/lavf-regression.sh
	tests/lavfi-regression.sh

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-08-13 02:56:08 +02:00
Michael Niedermayer
e2cc331124 NoMerge commit '4d58e4cb4ca8e04317fecea432ea3272a445877c'
* commit '4d58e4cb4ca8e04317fecea432ea3272a445877c':
  Rename ffserver to avserver.
  Rename ffprobe to avprobe.
  Rename ffplay to avplay.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-08-10 16:29:20 +02:00
Marton Balint
c369ddb720 ffplay: pass frame durations clearly to video video_refresh
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>
2011-08-09 21:53:15 +02:00
Anton Khirnov
266463daff Rename ffplay to avplay. 2011-08-09 19:56:21 +02:00
Carl Eugen Hoyos
940a116b1f Unbreak ffplay -s and ffplay -pix_fmt. 2011-08-01 00:58:49 +02:00
Stefano Sabatini
9959a76782 ffplay: set input link sample aspect ratio in input_config_props()
Allow sample_aspect_ratio information to be correctly propagated in
the filterchain.
2011-07-30 18:31:10 +02:00
Michael Niedermayer
2dd2abe391 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  h263dec: Propagate AV_LOG_ERRORs from slice decoding through frame decoding with sufficient error recognition
  x86: cabac: don't load/store context values in asm
  H.264: optimize CABAC x86 asm for Atom
  vp3/theora: flush after seek.
  doc/fftools-common-opts: wording fixes missing from the previous commit.
  doc: document using AVOptions in fftools.
  cmdutils: add codec_opts parameter to setup_find_stream_info_opts()
  cmdutils: clarify documentation for filter_codec_opts()
  cmdutils: clarify documentation for setup_find_stream_info_opts()
  lavf: add forgotten attribute_deprecated to av_find_stream_info()

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-07-29 01:50:53 +02:00
Stefano Sabatini
8ec19f84e1 cmdutils: add codec_opts parameter to setup_find_stream_info_opts()
Avoid brittle and obfuscating reference to a global.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-07-28 17:13:14 +02:00
Michael Niedermayer
78accb876c Merge remote-tracking branch 'qatar/master'
* qatar/master:
  ffmpeg: fix some indentation
  ffmpeg: fix operation with --disable-avfilter
  simple_idct: remove disabled code
  motion_est: remove disabled code
  vc1: remove disabled code
  fate: separate lavf-mxf_d10 test from lavf-mxf
  cabac: Move code only used in the cabac test program to cabac.c.
  ffplay: warn that -pix_fmt is no longer working, suggest alternative
  ffplay: warn that -s is no longer working, suggest alternative
  lavf: rename enc variable in utils.c:has_codec_parameters()
  lavf: use designated initialisers for all (de)muxers.
  wav: remove a use of deprecated AV_METADATA_ macro
  rmdec: remove useless ap parameter from rm_read_header_old()
  dct-test: remove write-only variable
  des: fix #if conditional around P_shuffle
  Use LOCAL_ALIGNED in ff_check_alignment()

Conflicts:
	ffmpeg.c
	libavformat/avidec.c
	libavformat/matroskaenc.c
	libavformat/mp3enc.c
	libavformat/oggenc.c
	libavformat/utils.c
	tests/ref/lavf/mxf

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-07-17 20:12:02 +02:00
Stefano Sabatini
0a858048af ffplay: warn that -pix_fmt is no longer working, suggest alternative
Also remove now unused variable.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-07-17 07:00:53 +02:00
Stefano Sabatini
a4e540c4f5 ffplay: warn that -s is no longer working, suggest alternative
Also remove now unused variables.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-07-17 07:00:37 +02:00
Michael Niedermayer
5dc6bd86f0 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  APIchanges: fill in missing hashes and dates.
  Add an APIChanges entry and bump minor versions for recent changes.
  ffmpeg: print the low bitrate warning after the codec is openend.
  doxygen: Move function documentation into the macro generating the function.
  doxygen: Make sure parameter names match between .c and .h files.
  h264: move fill_decode_neighbors()/fill_decode_caches() to h264_mvpred.h
  H.264: Add more x86 assembly for 10-bit H.264 predict functions
  lavf: fix invalid reads in avformat_find_stream_info()
  cmdutils: replace opt_default with opt_default2() and remove set_context_opts
  ffmpeg: use new avcodec_open2 and avformat_find_stream_info API.
  ffplay: use new avcodec_open2 and avformat_find_stream_info API.
  cmdutils: store all codec options in one dict instead of video/audio/sub
  ffmpeg: check experimental flag after codec is opened.
  ffmpeg: do not set GLOBAL_HEADER flag in the options context

Conflicts:
	cmdutils.c
	doc/APIchanges
	ffmpeg.c
	ffplay.c
	libavcodec/version.h
	libavformat/version.h
	libswscale/swscale_unscaled.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-07-14 20:44:58 +02:00
Michael Niedermayer
80e4fe4063 Merge commit 'b5849f77095439e994b11c25e6063d443b36c228'
* commit 'b5849f77095439e994b11c25e6063d443b36c228': (21 commits)
  ac3enc: merge AC3MDCTContext with AC3EncodeContext.
  ac3enc: prefer passing AC3EncodeContext rather than AVCodecContext
  ac3enc: fix memleak
  mpeg1video: add CODEC_CAP_SLICE_THREADS.
  lavf: fix segfault in av_open_input_stream()
  mpegtsenc: set Random Access indicator on keyframe start packets
  lavf: Cleanup try_decode_frame() logic.
  Replace some gotos that lead to single return statements by direct return.
  build: move tests/seek_test.c to libavformat and reuse generic build rules
  mxfenc: include needed header for ff_iso8601_to_unix_time() prototype
  Add a check for strptime().
  lavf: factor out conversion of ISO8601 string to unix time
  wav: parse 'bext' metadata
  wav: keep parsing until EOF if the input is seekable and we know the size of the data tag
  wav: Refactor the tag checking into a switch statement
  wav: make sure neither data_size nor sample_count is negative.
  wav: refactor the 'fmt ' tag search and parsing.
  wav: add an option for writing BEXT chunk
  ffmpeg: get rid of a pointless limit on number of streams.
  ffmpeg: remove an unused define.
  ...

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-07-14 02:24:10 +02:00
Anton Khirnov
3009f521f3 ffplay: use new avcodec_open2 and avformat_find_stream_info API. 2011-07-13 23:17:42 +02:00
Diego Biurrun
71a1d1116f Replace some gotos that lead to single return statements by direct return. 2011-07-13 17:53:49 +02:00
Michael Niedermayer
bb258fb995 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  doc: Improve references to external URLs.
  h264: move decode_mb_skip() from h264.h to h.264_mvpred.h
  ffplay: skip return value of avcodec_decode_video2 / avcodec_decode_subtitle2
  dnxhdenc: Replace a forward declaration by the proper #include.
  h264: move h264_mvpred.h include.
  pix_fmt: Fix number of bits per component in yuv444p9be
  lavf: deprecate AVFormatContext.timestamp
  ffmpeg: merge input_files_ts_scale into InputStream.
  ffmpeg: don't abuse a global for passing sample format from input to output
  ffmpeg: don't abuse a global for passing channel layout from input to output
  ffmpeg: factor common code from new_a/v/s/d_stream to new_output_stream()
  matroskaenc: make SSA default subtitle codec.
  oggdec: prevent heap corruption.

Conflicts:
	doc/developer.texi
	doc/faq.texi
	doc/general.texi
	ffmpeg.c
	ffplay.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-07-13 00:42:11 +02:00
Diego Biurrun
987041318f ffplay: skip return value of avcodec_decode_video2 / avcodec_decode_subtitle2
This fixes some warnings about unused-but-set variables.
2011-07-12 20:24:11 +02:00
Carl Eugen Hoyos
3743ea1fe3 Hint why SDL_Init() may have failed. 2011-07-10 21:11:37 +02:00
Michael Niedermayer
976a8b2179 Merge remote-tracking branch 'qatar/master'
* qatar/master: (40 commits)
  H.264: template left MB handling
  H.264: faster fill_decode_caches
  H.264: faster write_back_*
  H.264: faster fill_filter_caches
  H.264: make filter_mb_fast support the case of unavailable top mb
  Do not include log.h in avutil.h
  Do not include pixfmt.h in avutil.h
  Do not include rational.h in avutil.h
  Do not include mathematics.h in avutil.h
  Do not include intfloat_readwrite.h in avutil.h
  Remove return statements following infinite loops without break
  RTSP: Doxygen comment cleanup
  doxygen: Escape '\' in Doxygen documentation.
  md5: cosmetics
  md5: use AV_WL32 to write result
  md5: add fate test
  md5: include correct headers
  md5: fix test program
  doxygen: Drop array size declarations from Doxygen parameter names.
  doxygen: Fix parameter names to match the function prototypes.
  ...

Conflicts:
	libavcodec/x86/dsputil_mmx.c
	libavformat/flvenc.c
	libavformat/oggenc.c
	libavformat/wtv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-07-04 00:45:21 +02:00
Mans Rullgard
0ebcdf5cda Do not include mathematics.h in avutil.h
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-07-03 21:42:06 +01:00
Jeff Downs
a09918335f Make all option parsing functions match the function pointer type through which they are called.
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_
2011-06-30 11:49:48 -04:00