Commit Graph

53 Commits

Author SHA1 Message Date
Martin Storsjö
296d0da8bd avplay: Add an option for not limiting the input buffer size
For reading from normal files on disk, the queue limits for
demuxed data work fine, but for reading data from realtime
streams, they mean we're not reading from the input stream
at all once the queue limit has been reached. For TCP streams,
this means that writing to the socket from the peer side blocks
(potentially leading to the peer dropping data), and for UDP
streams it means that our kernel might drop data.

For some protocols/servers, the server initially sends a
large burst with data to fill client side buffers, but once
filled, we should keep reading to avoid dropping data.

For all realtime streams, it IMO makes sense to just buffer
as much as we get (rather in buffers in avplay.c than in
OS level buffers). With this option set, the input thread
should always be blocking waiting for more input data,
never sleeping waiting for the decoder to consume data.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-04 11:11:08 +03:00
Luca Barbato
906f9dce85 avplay: fix write on freed memory for rawvideo
Do not assume avpacket and the decoded frames are independent.

To be absolutely sure and not sprinkle av_free_packet around the code
the call had been placed before getting the frame and on the error path.
2012-07-03 15:35:51 +02:00
Martin Storsjö
d3ed1c9571 cmdutils: Pass the actual chosen encoder to filter_codec_opts
This allows passing the right options to encoders when there's more
than one encoder for a certain codec id.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-30 15:44:10 +03:00
Mans Rullgard
896bb0d742 Replace usleep() calls with av_usleep()
This reduces the dependency on unistd.h which is not available
on all systems.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-22 17:15:36 +01:00
Diego Biurrun
d246c18ea6 Avoid C99 variable declarations within for statements.
We generally do not declare variables within for statements and
there are compilers that choke on such constructs.
2012-06-14 23:36:04 +02:00
Anton Khirnov
67339f6eb4 avplay: use buffersrc instead of custom input filter.
We do not allow user filters, so avtools shouldn't use them either.

It also allows to reuse buffer management code from avconv, thus
reducing duplication.
2012-06-05 09:36:10 +02:00
Anton Khirnov
ac71230902 lavfi: add video buffer sink, and use it in avtools
Also add the public interface libavfilter/buffersink.h.

Based on a commit by Stefano Sabatini.
2012-05-09 08:59:37 +02:00
Justin Ruggles
85e5b866dc avplay: properly close/reopen AVAudioResampleContext on channel layout change
fixes Bug#280
2012-05-07 12:42:32 -04:00
Justin Ruggles
f1ffb01ee9 avplay: use libavresample for sample format conversion and channel mixing
SDL only supports s16 sample format and a limited number of channel layouts.
Some versions of SDL on some systems support 4-channel and 6-channel output,
but it's safer overall to downmix any layout with more than 2 channels to
stereo.
2012-05-01 13:38:23 -04:00
Mans Rullgard
2bcbd98459 Remove lowres video decoding
This feature is complex, of questionable utility, and slows down
normal decoding.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-04-21 18:56:19 +01:00
Luca Barbato
6943fb47d3 avplay: update get_buffer to be inline with avconv
The buffer must have its dimension, pixel format and aspect ratio
set.
2012-04-16 15:12:03 -07:00
Anton Khirnov
b7327887ea avconv: get output pixel format from lavfi.
This way we don't require a clearly defined corresponding input stream.

The result for the xwd test changes because rgb24 is now chosen instead
of bgra.
2012-04-15 20:22:36 +02:00
Stefano Sabatini
91d3cbe0fd avfiltergraph: make the AVFilterInOut alloc/free API public
This is required for letting applications to create and destroy
AVFilterInOut structs in a convenient way.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-04-14 09:25:46 +02:00
Alex Converse
e1ce756844 avplay: Don't free video filters string until the end of decoding.
av_freep()ing inside configure_video_filters() leaves a dangling
reference in the calling code, and the filter string is needed again when
reconfiguring video filters for a size change.
2012-04-11 10:24:01 -07:00
Martin Storsjö
951e715ceb avplay: Don't try to scale timestamps if the tb isn't set
If get_filtered_video_frame failed above, tb might not be
initialized at all, so don't scale using it.

This fixes cases where avplay could crash if aborting
avformat_find_stream_info with ctrl+c.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-04-06 20:49:23 +03:00
Diego Biurrun
a92be9b856 Replace memset(0) by zero initializations.
Also remove one pointless zero initialization in rangecoder.c.
2012-03-28 09:38:33 +02:00
Anton Khirnov
e0f68413dd avplay: remove an unused variable. 2012-02-29 07:24:34 +01:00
Janne Grunau
e48a70e6da avplay: fix -threads option
The AVOptions based default to threads auto in 2473a45c8
works only if avplay does not use custom option handling
for -threads.

CC: <libav-stable@libav.org>
2012-02-21 16:45:34 +01:00
Justin Ruggles
ec1f3cab20 avplay: reset decoder flush state when seeking
Fixes seeking after decoder has already been flushed for codecs using
CODEC_CAP_DELAY.
2012-02-06 13:22:01 -05:00
Anton Khirnov
91b3bfba88 avplay: use the correct array size for stride.
AV_NUM_DATA_POINTERS instead of 4.
2012-01-28 19:45:45 +01:00
Diego Biurrun
abe655a472 Drop unnecessary prefix from *sink* variable and struct names. 2012-01-25 12:28:36 +01:00
Anton Khirnov
75e2025f57 avplay: remove the -er option.
Error recognition flags can and should be set directly with AVOptions.
2012-01-24 18:04:19 +01:00
Janne Grunau
2473a45c85 threads: change the default for threads back to 1
Using threaded decoding by default breaks backward compatibility if
AVHWAccel is used or if an appliction sets threadunsafe callbacks.
Avconv and avplay still use -threads auto if not specified.
2012-01-21 13:26:44 +01:00
Diego Biurrun
45f2908d02 cosmetics: Rename ffsink to avsink. 2012-01-19 00:19:43 +01:00
Diego Biurrun
5ea20630b4 Fix a bunch of platform name and other typos. 2012-01-11 13:48:30 +01:00
Martin Storsjö
0749720b6c avplay: Don't call avio_set_interrupt_cb(NULL)
Since we don't use avio_set_interrupt_cb for interrupt callbacks,
we don't need to call it to reset the interrupt cb either.

This avoids a warning about use of deprecated functions.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-01-04 11:03:45 +02:00
Aneesh Dogra
da7c65f0ce avplay: K&R cleanup
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-01-01 19:53:37 +01:00
Diego Biurrun
d4b63054d9 cosmetics: Drop unnecessary parentheses around return values. 2011-12-30 22:18:07 +01:00
Stefano Sabatini
1c9e340d35 lavfi: add avfilter_copy_frame_props()
avfilter_copy_frame_props() avoids code duplication and increases
robustness.
2011-12-25 16:18:57 +01:00
Stefano Sabatini
b58dbb5b03 lavc: add a sample_aspect_ratio field to AVFrame
The sample aspect ratio is a per-frame property, so it makes sense to
define it in AVFrame rather than in the codec/stream context.
Simplify application-level sample aspect ratio information extraction,
and allow further simplifications.
2011-12-25 16:18:57 +01:00
Michael Niedermayer
c9aa4cfdb1 avplay: clear pkt_temp when pkt is freed.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2011-12-19 12:22:14 -05:00
Mans Rullgard
8400b126ac avcodec: deprecate AVFrame.age
This was intended as an optimisation for skipped blocks in MPEG2
P-frames and never used elsewhere.  Removing this "optimisation"
speeds up MPEG2 decoding by 1-2% (ARM Cortex-A9).

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-12-18 22:14:33 +00:00
Anton Khirnov
cd3716b9aa Replace all uses of av_close_input_file() with avformat_close_input(). 2011-12-12 20:34:38 +01:00
Justin Ruggles
b11ce85664 avplay: don't request a stereo downmix
Multi-channel output works just fine for me with SDL 1.2.14.
2011-12-11 14:01:27 -05:00
Justin Ruggles
f199f38573 avplay: use avcodec_decode_audio4() 2011-12-04 18:29:51 -05:00
Justin Ruggles
e2a2c49fcd avplay: use a separate buffer for playing silence 2011-12-04 18:29:51 -05:00
Martin Storsjö
40972f7c54 avplay: Set the new interrupt callback
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-11-18 11:01:16 +01:00
Justin Ruggles
f9324d5add avplay: reset rdft when closing stream.
this fixes a crash when cycling audio streams if the spectrograph is
displayed.
2011-11-08 10:43:57 -05:00
Martin Storsjö
776f2bb91a Call avformat_network_init/deinit in the programs
Calling the init function will become mandatory at some later
point. By calling it, more heavy network init (such as SSL/TLS
library init) can be done once at startup, instead of implicitly
when used (which could lead to it being done a number of times).

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-06 18:31:39 +02:00
Diego Biurrun
20566eb0f0 Replace outdated references to ffmpeg tool with avconv. 2011-11-02 10:42:54 +01:00
Marton Balint
fec5777ed7 avplay: fix fullscreen behaviour with SDL 1.2.14 on Mac OS X
The blue channel went missing when toggling fullscreen on Mac OS X.
2011-10-22 00:28:55 +02:00
Luca Barbato
ec5e521298 macosx: use the default surface on newer sdl
SDL 1.2.14 works fine with default colorspace on macosx and seems
to have some issues with 24bit surfaces and resize in addition.
2011-10-17 22:27:12 -07:00
Justin Ruggles
c74f1f47b2 avplay: free the active audio packet at exit.
fixes a memleak
2011-10-12 17:48:33 -04:00
Justin Ruggles
cb2c4de3a1 avplay: free rdft data used for spectrogram analysis.
fixes a memleak
2011-10-12 17:48:33 -04:00
Anton Khirnov
7a6cd9957d cmdutils/avtools: simplify show_help() by using av_opt_child_class_next() 2011-10-12 16:51:17 +02:00
Anton Khirnov
182cbe433a avtools: parse loglevel before all the other options.
This way it can be applied to cmdutils too -- e.g. showing the banner
and printing startup messages.
2011-09-26 20:33:50 +02:00
Justin Ruggles
59df4b82a5 avplay: flush audio decoder with empty packets at EOF if the decoder has
CODEC_CAP_DELAY set.
2011-09-22 14:11:35 -04:00
Anton Khirnov
7cc8d6385a cmdutils: add support for caller-provided option context.
This is the first step to removing the globals plague from avtools.
2011-09-04 13:12:00 +02:00
Anton Khirnov
dad09ff93f cmdutils: move exit_program() declaration to cmdutils from avconv
Allows cmdutils to call each tool's own cleanup function.
2011-09-04 13:12:00 +02:00
Anton Khirnov
20c21f8b75 cmdutils: get rid of dummy contexts for examining AVOptions.
Replace it with newly introduced libavutil API.
2011-09-03 20:58:15 +02:00