Commit Graph

656 Commits

Author SHA1 Message Date
Anton Khirnov e6c4ac7b5f pixdesc: rename PIX_FMT_* flags to AV_PIX_FMT_FLAG_* 2013-05-15 07:46:51 +02:00
Matt Wolenetz 252c0bfdc0 lavc: Fix msvc compilation of utils.c with -WX (warnings treated as errors)
This fixes https://bugzilla.libav.org/show_bug.cgi?id=514.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-05-14 10:04:43 +03:00
Luca Barbato e55e8b2c36 lavc: do not leak frames in avcodec_decode_audio4
Notwithstanding the return value the frame should be freed if
is not going to be used.

Reported-by: Matthew Wolenetz <wolenetz@chromium.org>
2013-05-07 14:37:32 +02:00
Diego Biurrun 6fee1b90ce avcodec: Add av_cold attributes to init functions missing them 2013-05-04 21:09:45 +02:00
Diego Biurrun 088f38a4f9 avcodec: Drop unnecessary ff_ name prefixes from static functions 2013-04-30 16:02:02 +02:00
Anton Khirnov e036bb7899 lavc: clear AVBuffers on decoded frames if refcounted_frames is not set
Otherwise some code might mistakenly think it is allowed to unref those
buffers, which would lead to double unref.
2013-04-30 11:15:32 +02:00
Anton Khirnov a7f46586bf ff_get_buffer(): allocate the frame for max(coded,display) dimensions
Needed e.g. for h264 cropping to work properly.
2013-04-19 09:26:53 +02:00
Anton Khirnov 9de9b828ef lavc: don't overwrite display dimensions with coded dimensions. 2013-04-10 20:54:27 +02:00
Ronald S. Bultje b93b27edb0 dsputil: Make dsputil selectable
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-04-10 11:04:05 +03:00
Janne Grunau c24469e812 utils: add workaround for AVHWAccel in ff_get_buffer compat code
Since c977039e58 plane count for
PIX_FMT_HWACCEL pixel formats is 0 instead of 1. The created dummy
AVBuffers are still bogus since AVFrame does not hold frame data when
AVHWAccels are used.
2013-03-26 19:44:50 +01:00
Martin Storsjö f1e9398621 lavc: Rename avpriv_mpv_find_start_code after moving out from mpegvideo
Also move the declaration to internal.h, and add restrict qualifiers
to the declaration (as in the implementation).

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-26 09:50:02 +02:00
Martin Storsjö 75644335b9 lavc: Move start code finding to utils.c
This allows dropping the mpegvideo dependency from a number of
components.

This also fixes standalone building of the h264 parser, which
was broken in 64e438697.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-26 09:48:12 +02:00
Anton Khirnov c977039e58 lavc, lavfi: fix counting number of planes in AVBufferRef wrappers
Number of planes is not always equal to the number of components even
for formats marked with PIX_FMT_PLANAR -- e.g. NV12 has three components
in two planes.
2013-03-19 11:12:17 +01:00
Anton Khirnov 6552808014 lavc,lavfi: fix calculating the plane size in the AVBufferRef wrappers
It is supposed to be height * linesize, not width * linesize.
Thanks to Hendrik Leppkes for pointing out the bug.
2013-03-17 09:10:04 +01:00
Diego Biurrun f099d3d1d5 Add av_log_{ask_for_sample|missing_feature} replacements to libavutil
This allows reporting missing features and requesting samples from
all libraries in a standard way; with a simplified API.
2013-03-13 20:42:06 +01:00
Janne Grunau a2816230c5 avframe: call release_buffer only if it is set
AVCodecContext release_buffer() shall be NULL for audio codecs using
get_buffer. The backward compatibility code hence have to check before
calling it.
2013-03-11 18:58:47 +01:00
Anton Khirnov 669cc0f364 lavc: fix get_buffer() compatibility layer for audio.
planes - FF_ARRAY_ELEMS would be evaluated as unsigned and underflow
instead of being negative as was intended.
2013-03-10 22:19:52 +01:00
Anton Khirnov 0f24a3ca99 lavc: remove disabled FF_API_OLD_ENCODE_VIDEO cruft 2013-03-09 08:36:40 +01:00
Anton Khirnov f073b1500e lavc: remove disabled FF_API_OLD_ENCODE_AUDIO cruft 2013-03-09 08:36:40 +01:00
Anton Khirnov 5d606863c3 lavc: remove disabled FF_API_OLD_DECODE_AUDIO cruft 2013-03-09 08:36:40 +01:00
Anton Khirnov 7c45087b84 lavc: update the fallback versions of ff_thread_*
Fixes build without threads after
759001c534.
2013-03-08 10:22:10 +01:00
Anton Khirnov 2eba9087f3 lavc: make up a fake frame channel layout when there is no real one.
This should ensure that a valid channel layout is always set on a frame,
until a better solution is implemented.
2013-03-08 07:40:06 +01:00
Anton Khirnov 15ec0450b4 lavc: allow decoders to override frame parameters. 2013-03-08 07:39:44 +01:00
Anton Khirnov 759001c534 lavc decoders: work with refcounted frames. 2013-03-08 07:38:30 +01:00
Anton Khirnov 1afddbe59e avpacket: use AVBuffer to allow refcounting the packets.
This will allow us to avoid copying the packets in many cases.

This breaks ABI.
2013-03-08 07:33:45 +01:00
Reimar Döffinger efa7f42020 Use the avstring.h locale-independent character type functions
Make sure the behavior does not change with the locale.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-07 15:16:36 +02:00
Stefano Sabatini 70762508ec lavc: Prettify printing of codec tags containing non alphanumeric characters
Make av_get_codec_tag_string() show codec tag string characters in a more
intelligible ways. For example the ascii char "@" is used as a number, so
should be displayed like "[64]" rather than as a printable character.

Apart alphanumeric chars, only the characters ' ' and '.' are used
literally in codec tags, all the other characters represent numbers.

This also avoids relying on locale-dependent character class functions.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-07 08:50:29 +02:00
Anton Khirnov d2a25c4032 get_buffer(): do not initialize the data.
There may be more decoders that rely on this. Those should be found and
fixed.
2013-02-15 16:08:44 +01:00
Diego Biurrun c6507946d4 dsputil: Move STRIDE_ALIGN macro to the only place it is used 2013-02-13 20:23:39 +01:00
Luca Barbato bff3607547 lavc: set the default rc_initial_buffer_occupancy
rc_buffer_size is not set before.

Solve the initial the rate control underflow issue reported in
bug 222.

CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-01-15 08:58:51 +01:00
Diego Biurrun 015da965a6 libavcodec/utils: Add braces to shut up gcc warnings
libavcodec/utils.c:1050:5: warning: missing braces around initializer [-Wmissing-braces]
libavcodec/utils.c:1314:5: warning: missing braces around initializer [-Wmissing-braces]
2012-12-30 01:52:04 +01:00
Janne Grunau bd255f9feb lavc: set frame parameters after decoding only if necessary
Direct rendering capable decoders call get_buffer() which will set the
frame parameters.

Prevents frames with wrong parameters when a decoder outputs delayed
frames after a resolution or pixel format change.
2012-12-13 21:02:42 +01:00
Anton Khirnov 387bef95d2 lavc: factorise setting buffer type in avcodec_default_get_buffer(). 2012-12-04 21:45:23 +01:00
Anton Khirnov e57c4706e9 lavc: don't reuse audio buffers
Any performance gain from this is negligible and not worth the extra
code.
2012-12-04 21:43:53 +01:00
Anton Khirnov ff953fecff lavc: set frame properties in ff_get_buffer().
There is no point in duplicating this code in every get_buffer()
implementation.
2012-12-04 21:42:44 +01:00
Anton Khirnov 594d4d5df3 lavc: add a wrapper for AVCodecContext.get_buffer().
It will be useful in the upcoming transition to refcounted AVFrames.
2012-12-04 21:41:59 +01:00
Luca Barbato cc085993f4 avcodec: remove ff_is_hwaccel_pix_fmt
It is used only in one place and is unlikely it would be needed
elsewhere.
2012-11-13 16:21:47 +01:00
Luca Barbato c1a02e884a pixdesc: add av_pix_fmt_get_chroma_sub_sample
Deprecate avcodec_get_chroma_sub_sample.
2012-11-13 16:14:55 +01:00
Justin Ruggles a903f8f087 Include libavutil/channel_layout.h instead of libavutil/audioconvert.h
Also reorder some other #include when applicable.
2012-11-11 13:35:12 -05:00
Ilkka Ollakka 6d1270a0f9 decode_audio3: initialize AVFrame
Same fix and issue as in a25d912dca

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-11-01 19:43:05 +01:00
Justin Ruggles 0366664ef9 lavc: check channel count after decoder init
Ensures the decoder did not set channel count to an insanely high value
during initialization, which could cause large memory usage when it tries to
get a buffer during decoding.
2012-11-01 11:29:13 -04:00
Justin Ruggles bb6941af2a lavc: move SANE_NB_CHANNELS to internal.h and use it in the PCM decoders 2012-11-01 11:29:13 -04:00
Anton Khirnov 1bc64c2814 lavc: initialize output AVFrame before decoding.
Avoids memleaks with audio when extended_data is nontrivial and the user
doesn't reset the frame.
Shouldn't have any effect for video for now, but might be useful in the
future.
2012-10-24 08:46:45 +02:00
Justin Ruggles a5ef830b12 lavc: use the correct API version guard macro for avcodec_encode_audio() 2012-10-23 14:35:27 -04:00
Nathan Caldwell c854102da7 avcodec: handle AVERROR_EXPERIMENTAL
Error out on init if a codec with CODEC_CAP_EXPERIMENTAL is requested
and strict_std_compliance is not FF_COMPLIANCE_EXPERIMENTAL.

Move the check from avconv to avcodec_open2() and return
AVERROR_EXPERIMENTAL accordingly.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-10-21 23:03:26 +02:00
Nathan Caldwell a4aa20fbdb avcodec: prefer decoders without CODEC_CAP_EXPERIMENTAL
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-10-21 22:27:58 +02:00
Rafaël Carré a25d912dca avcodec_encode_audio(): fix invalid free
Since 2bc0de385, AVFrame needs to be initialized
before calling avcodec_get_frame_defaults().

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-16 18:49:31 +02:00
Diego Biurrun 52d113ee06 avutil: Rename ff_set_systematic_pal2() ---> avpriv_set_systematic_pal2()
Functions used across libraries should have avpriv_ and not ff_ prefixes.
2012-10-13 19:59:20 +02:00
Luca Barbato 6d5600e855 avutil: add yuva422p and yuva444p formats 2012-10-12 15:09:51 +02:00
Anton Khirnov 50ba57e0ce lavc: do not use av_pix_fmt_descriptors directly. 2012-10-12 12:45:39 +02:00