| Branch: | Revision:

ffmpeg / libavcodec / utils.c @ 029f966c

History | View | Annotate | Download (37.2 KB)

# Date Author Comment
029f966c 04/11/2011 08:35 AM Martin Storsjö

g722: Return 8 bits per sample for g722 in av_get_bits_per_sample

This fixes a failing assert in ff_raw_read_header (in
fate-g722dec-1), where bits_per_coded_sample is set using this
function and is required to have a positive value.

Signed-off-by: Martin Storsjö <>

ba9ef8d0 04/05/2011 02:53 PM Alexander Strange

Remove unnecessary parameter from ff_thread_init() and fix behavior

thread_count passed to ff_thread_init() is only used to set AVCodecContext.
thread_count, and can be removed. Instead move it to the legacy implementation
of avcodec_thread_init().

This also fixes the problem that calling avcodec_thread_init() with pthreads...

2912e87a 03/19/2011 01:33 PM Mans Rullgard

Replace FFmpeg with Libav in licence headers

Signed-off-by: Mans Rullgard <>

a03be6e1 03/16/2011 08:54 PM Janne Grunau


29ba0911 03/16/2011 08:54 PM Janne Grunau


also update the multiple inclusion guards in config.h|mak

21de9204 03/13/2011 10:45 PM Johan Andersson

Update the url to the site website and change ffmpeg-devel to libav-devel

Signed-off-by: Ronald S. Bultje <>

737eb597 02/15/2011 03:18 PM Reinhard Tartler

Merge libavcore into libavutil

It is pretty hopeless that other considerable projects will adopt
libavutil alone in other projects. Projects that need small footprint
are better off with more specialized libraries such as gnulib or rather
just copy the necessary parts that they need. With this in mind, nobody...

b4668274 02/10/2011 02:17 PM Mans Rullgard

Remove incorrect return statement from avcodec_thread_free()

The function return type is void, so a return statement with an
expression is forbidden (and pointless).

Signed-off-by: Mans Rullgard <>

9a77a92c 02/09/2011 08:52 PM Mans Rullgard

Fix build with threading disabled

The avcodec_thread_free() compatibility wrapper calls ff_thread_free(),
which is not defined when threading is disabled. Make this call

Signed-off-by: Mans Rullgard <>

2cfa2d92 02/09/2011 08:30 PM Reimar Döffinger

check sample_fmt in avcodec_open

check AVCodecContext->sample_fmt against AVCodec->sample_fmts[] to ensure
that the encoder supports the specified sample format. Error out if it doesn't.
Previously, it would continue and output garbage. Fixes issue 2587.

c0b102ca 02/09/2011 02:17 PM Alexander Strange

Deprecate avcodec_thread_init()

As a side effect of the last commit, avcodec_open() now calls it automatically,
so there is no longer any need for clients to call it.
Instead they should set AVCodecContext.thread_count.

avcodec_thread_free() is deprecated, and will be removed from avcodec.h at the...

37b00b47 02/09/2011 02:17 PM Alexander Strange

Frame-based multithreading framework using pthreads

See doc/multithreading.txt for details on use in codecs.

Signed-off-by: Ronald S. Bultje <>

62ecd363 02/03/2011 12:25 AM Nicolas George

Set pkt_pts in avcodec_default_reget_buffer()

This was missed when pkt_pts was first added.

Signed-off-by: Nicolas George <>
Signed-off-by: Mans Rullgard <>

bb875b75 01/24/2011 11:45 PM Diego Elio Pettenò

Make the ff_lockmgr_cb function pointer static to utils.c

Signed-off-by: Mans Rullgard <>

db323491 01/17/2011 09:13 PM Janne Grunau

update av_log_missing_feature() to git

Signed-off-by: Janne Grunau <>

e83c716e 01/12/2011 12:33 AM Aurelien Jacobs

don't complain about codec type/id mismatche for attachment streams

Originally committed as revision 26316 to svn://

2a81f4bd 01/08/2011 09:23 AM Anssi Hannula

Show profile in avcodec_string().

Patch by Anssi Hannula, anssi d hannula a iki d fi

Originally committed as revision 26264 to svn://

1919feaf 01/07/2011 11:07 PM Michael Niedermayer

Add pkt_dts to AVFrame, this will in the future allow multithreading decoders
to not mess up dts

Originally committed as revision 26261 to svn://

393cbb96 01/07/2011 11:07 PM Michael Niedermayer

Add AVFrame.pkt_pts that contains the correctly reordered AVPacket.pts

Originally committed as revision 26260 to svn://

060ec0a8 01/07/2011 10:27 PM Anssi Hannula

Add av_get_profile_name() to get profile names.

Patch by Anssi Hannula, anssi d hannula a iki d fi

Originally committed as revision 26259 to svn://

f19c58b4 12/31/2010 12:06 AM Aurelien Jacobs

free subtitle_header before overwriting it to avoid memleak

Originally committed as revision 26176 to svn://

ba68d9d3 12/19/2010 12:17 PM Anatoly Nenashev

Fix -lowres with ffplay.

Patch by Anatoly Nenashev, anatoly d nenashev a ovsoft d ru

Originally committed as revision 26057 to svn://

372c3f82 12/04/2010 04:00 AM Michael Niedermayer

Change the argument of memory allocation functions from unsigned int to size_t
with the next major bump in libavcodec.

Originally committed as revision 25872 to svn://

63e8d976 11/21/2010 08:06 PM Stefano Sabatini

Use the new libavcore audio channel API.

This also allows to remove a linking dependency of libavfilter on

Originally committed as revision 25789 to svn://

5d6e4c16 11/12/2010 11:04 AM Stefano Sabatini

Replace deprecated symbols SAMPLE_FMT_* with AV_SAMPLE_FMT_*, and enum
SampleFormat with AVSampleFormat.

Originally committed as revision 25730 to svn://

ed5d30d9 11/09/2010 10:22 PM Stefano Sabatini

Move internal function ff_set_systematic_pal() to libavcore, and
rename it ff_set_systematic_pal2().

Originally committed as revision 25712 to svn://

00d1e96b 11/03/2010 08:52 PM Reimar Döffinger

H.264 decode: support cropping up to 28 pixels in interlaced mode.
Contrary to progressive, just being able to crop up to 14/15 pixels
is not enough to encode all supported resolutions, and the new
behaviour is also consistent with e.g. MPEG-2 etc.

Originally committed as revision 25669 to svn://

ba7d6e79 11/03/2010 08:19 PM Stefano Sabatini

Remove usage of deprecated libavcodec/audioconvert.h functions.

Originally committed as revision 25668 to svn://

6f84cd12 11/02/2010 10:20 PM Stefano Sabatini

Add av_get_bits_per_sample_fmt() to libavcore/samplefmt.h and
deprecate av_get_bits_per_sample_format().

Originally committed as revision 25654 to svn://

448ce925 09/30/2010 08:12 PM Aurelien Jacobs

add FF_API_SUBTITLE_OLD define to disable the deprecated decode_subtitle API

Originally committed as revision 25273 to svn://

164bc38c 09/30/2010 07:51 PM Aurelien Jacobs

add FF_API_VIDEO_OLD define to disable the deprecated decode_video API

Originally committed as revision 25272 to svn://

a377cfa6 09/30/2010 03:37 PM Aurelien Jacobs

add FF_API_AUDIO_OLD define to disable the deprecated decode_audio API

Originally committed as revision 25270 to svn://

dc51a72b 09/29/2010 03:05 PM Michael Niedermayer

Move allocation and init to defaults of the private codec contexts to avcodec_get_context_defaults3().
That way the user app can set codec specific parameters in the private context
before opening it.

Originally committed as revision 25257 to svn://

6ed04040 09/26/2010 02:25 PM Michael Niedermayer

Move AVOptions from libavcodec to libavutil

Originally committed as revision 25210 to svn://

82eac2f3 09/15/2010 04:46 AM Reimar Döffinger

Check avctx width/height more thoroughly (e.g. all values 0 except width would
have been accepted before).
Also do not fail if they are invalid but instead override them to 0.
This allows decoding e.g. MPEG video when only the container values are corrupted....

527c91e3 09/13/2010 10:03 PM Carl Eugen Hoyos

Test lowres before codec init.

Originally committed as revision 25114 to svn://

535cb043 09/10/2010 06:19 AM Martin Storsjö

Allow the lowres option to affect audio codecs, too

Originally committed as revision 25094 to svn://

9d2e0ad8 09/07/2010 09:24 PM Stefano Sabatini

Remove use of deprecated functions av_image_fill_pointers/linesizes in
libavcodec/utils.c, fix warnings.

Originally committed as revision 25069 to svn://

e16f217c 09/07/2010 07:15 PM Stefano Sabatini

Use new imgutils.h API names, fix deprecation warnings.

Originally committed as revision 25058 to svn://

6ce9b431 08/06/2010 09:37 AM Stefano Sabatini

Remove use of the deprecated function avcodec_check_dimensions(), use
av_check_image_size() instead.

Originally committed as revision 24711 to svn://

bf176f58 08/06/2010 09:36 AM Stefano Sabatini

Deprecate avcodec_check_dimensions() in favor of the new function
av_check_image_size() declared in libavcore/imgutils.h.

Originally committed as revision 24709 to svn://

05236ed7 07/31/2010 04:46 PM Stefano Sabatini

Use av_fill_image_pointers/linesizes in place of ff_fill_pointer/linesize,
and drop the the ff_ variants at the next major bump.

Originally committed as revision 24620 to svn://

126b638e 07/26/2010 11:12 PM Stefano Sabatini

Deprecate av_parse_video_frame_size() and av_parse_video_frame_rate()
in favor of the newly added corresponding functions
av_parse_video_size() and av_parse_video_rate() defined in

This change also adds a linking-time dependency of libavcodec and of...

8b834ac5 07/11/2010 07:53 AM Reimar Döffinger

100l, change avsubtitle_free to the actually tested and working version.

Originally committed as revision 24188 to svn://

e1d7c883 07/11/2010 07:35 AM Reimar Döffinger

Add avsubtitle_free function.

Originally committed as revision 24185 to svn://

0fd0ef79 07/07/2010 09:23 PM Carl Eugen Hoyos

Add new decoder property max_lowres and do not init decoder if requested value is higher.

Originally committed as revision 24098 to svn://

25cbc8b4 07/06/2010 01:04 PM Måns Rullgård

Move av_tempfile() to libxvidff.c as only the xvid wrapper needs it

Originally committed as revision 24074 to svn://

49bd8e4b 06/30/2010 03:38 PM Måns Rullgård

Fix grammar errors in documentation

Originally committed as revision 23904 to svn://

ab0b5378 06/02/2010 10:54 AM Stefano Sabatini

Make avcodec_string() use av_get_codec_tag_string().

Originally committed as revision 23422 to svn://

7e566bbe 06/02/2010 10:54 AM Stefano Sabatini

Implement av_get_codec_tag_string() and use it in ffprobe.

Originally committed as revision 23421 to svn://

3491a9b2 05/27/2010 04:25 AM Jai Menon

Cosmetics : Fix typo.

Originally committed as revision 23345 to svn://

93ebfeea 05/26/2010 10:38 AM Janne Grunau

Add CODEC_CAP_EXPERIMENTAL and prefer encoders without it.

Patch by Janne Grunau, janne-ffmpeg jannau net

Originally committed as revision 23334 to svn://

603a5f04 05/18/2010 07:16 PM Francesco Lavra

Factorize some code into the new function ff_toupper4().

Patch by Francesco Lavra, francescolavra interfree it

Originally committed as revision 23158 to svn://

b3ab3199 05/12/2010 05:05 PM Reimar Döffinger

Set coded_frame to NULL when closing a codec, since it might
be invalid after the codec is "gone".

Originally committed as revision 23101 to svn://

4cf1ba04 04/25/2010 03:05 PM Stefano Sabatini

Make avcodec_check_dimensions() return AVERROR rather than -1
in case of invalid picture size.

Originally committed as revision 22962 to svn://

ba87f080 04/20/2010 02:45 PM Diego Biurrun

Remove explicit filename from Doxygen @file commands.

Passing an explicit filename to this command is only necessary if the
documentation in the @file block refers to a file different from the
one the block resides in.

Originally committed as revision 22921 to svn://

4563cf24 04/13/2010 11:24 PM Stefano Sabatini

Factorize code in get_bit_rate().

Originally committed as revision 22879 to svn://

77a670e7 04/06/2010 09:52 AM Craig Thomasson

Fix segfault when encoder initialization fails.
Patch by Craig Thomasson $(name) dot $(surname) ripcode com

Originally committed as revision 22811 to svn://

0fb49b59 04/01/2010 06:41 AM Bobby Bingham

Add function to export EDGE_WIDTH from libavcodec.

Originally committed as revision 22753 to svn://

72415b2a 03/30/2010 11:30 PM Stefano Sabatini

Define AVMediaType enum, and use it instead of enum CodecType, which
is deprecated and will be dropped at the next major bump.

Originally committed as revision 22735 to svn://

406aa93f 02/28/2010 07:05 PM Carl Eugen Hoyos

Make av_get_bit_rate() static and remove av_, the function is only used
inside libavcodec/utils.c.

Originally committed as revision 22117 to svn://

88f83607 02/28/2010 07:03 PM Carl Eugen Hoyos

Include libxvid_internal.h: It contains the prototype for av_tempfile().

Originally committed as revision 22116 to svn://

eb285cfe 02/27/2010 09:13 PM Reimar Döffinger

Fix avcodec_align_dimensions to return values suitably aligned for FLV decoding
with SSE and add a avcodec_align_dimensions2 taht returns the stride alignment
requirements independently from doing the width/height padding.

Originally committed as revision 22095 to svn://

c4f267ab 02/20/2010 06:28 PM Vitor Sessak

Free encoder extradata in avcodec_close(). Should fix several small memory
leaks when encoding (at least for asv, wma and aac).

Fix also issue 1577.

Originally committed as revision 21923 to svn://

b7098cc1 02/12/2010 10:01 PM David Conrad

Special case VP5/6 chroma alignment on x86 as well

Originally committed as revision 21782 to svn://

0752cd39 01/13/2010 02:16 AM Zuxy Meng

More av_cold for infrequently called functions.

Originally committed as revision 21179 to svn://

c46eeae2 01/09/2010 06:33 PM Michael Niedermayer

Add a function to match a 2 element vector of uint16_t and use it in h263 and svq1
instead of custom and bloated code to find an index into a w/h array.

Originally committed as revision 21113 to svn://

07f2a575 01/06/2010 11:15 PM Carl Eugen Hoyos

100l: Fix compilation after r21037.

Originally committed as revision 21039 to svn://

9df9b810 01/06/2010 09:51 PM Daniel Verkamp

Handle more ADPCM codecs in av_get_bits_per_sample().

This removes some special-case code from riff.c.
CODEC_ID_ADPCM_G726 is still handled in riff.c as before because it is
not guaranteed to be fixed 4 bits per sample.

Originally committed as revision 21037 to svn://

41600690 01/03/2010 02:31 PM Stefano Sabatini

Prefer "*FUNC_NAME(" over "* FUNC_NAME(" for XXX_configuration() and
XXX_license() functions, consistent with the rest of FFmpeg.

Originally committed as revision 21005 to svn://

b8af4fe9 12/14/2009 11:42 AM Michael Niedermayer

Set reordered_opaque in default_reget_buffer() with internal buffers.
From ffmbc0.3, this one appears to be a bugfix.

Originally committed as revision 20862 to svn://

ce34ff6b 11/21/2009 09:58 AM Robert Krüger

Factorize av_get_bit_rate (for future use outside of libavcodec).

Patch by Robert Krüger, krueger signal7 de

Originally committed as revision 20569 to svn://

98c82d69 11/20/2009 10:14 PM Michael Niedermayer

Allocate pictures with enough padding for jpeg.
Ensure that jpeg does not use mbs that could require larger padding.
This might have been exploitable.

Originally committed as revision 20566 to svn://

c1736936 11/18/2009 05:15 PM Diego Biurrun

Add functions to return library license and library configuration.

Originally committed as revision 20547 to svn://

dccda293 11/10/2009 02:51 AM Michael Niedermayer

Add a NULL pointer check to avcodec_close() this should prevent a segfault
when closing without open.

Originally committed as revision 20495 to svn://

91cc5d37 11/09/2009 09:11 AM Francesco Lavra

Move ff_reverse in libavcodec to av_reverse in libavutil.

Patch by Francesco Lavra, francescolavra interfree it

Originally committed as revision 20484 to svn://

ea09f691 10/13/2009 08:48 PM Reimar Döffinger

Print a warning message when avcodec_default_free_buffers finds unreleased
buffers, this hopefully should help detect codecs that do not release all
buffers e.g. in the decode_end function.

Originally committed as revision 20230 to svn://

8d23a86f 10/12/2009 11:35 AM Reimar Döffinger

Add an execute2 function that is more flexible and allows to use parallel
processing with jobs > threads without wasting too much memory.
It also avoids needing a separate int array when the only additional data
the jobs needs is a single int running from 0 to count-1....

681c180d 10/01/2009 03:54 PM Reimar Döffinger

Make avcodec_open set codec_id and codec_type if they haven't been set.
This fixes the API breakage introduced by the check that avctx codec id and type
match the opened codec and should make (almost?) all applications work again.

Originally committed as revision 20125 to svn://

2a9b5c9b 09/23/2009 03:16 PM Michael Niedermayer

Make sure priv_data is freed and codec is set to NULL in case of failure of avcodec_open().

Originally committed as revision 20002 to svn://

4c0dda2b 09/22/2009 10:44 PM Michael Niedermayer

Check codec_id and codec_type in avcodec_open(), based on 43_codec_type_mismatch.patch from chrome
This is said to be able to lead to a stack based buffer overflow.

Originally committed as revision 19973 to svn://

40461e54 09/20/2009 06:29 PM Diego Biurrun

Add parentheses to logical expression to avoid the warning:
libavcodec/utils.c:476: warning: suggest parentheses around && within ||

Originally committed as revision 19933 to svn://

fa77dd63 09/16/2009 11:29 AM Peter Ross

perform sanity check on number of audio channels in avcodec_open()

Originally committed as revision 19877 to svn://

ce863d7f 06/29/2009 07:07 PM Ronald S. Bultje

Rename ff_log_missing_feature() to av_log_missing_feature().

Originally committed as revision 19294 to svn://

10f9ff9b 06/03/2009 11:23 AM Reimar Döffinger

Set AV_PKT_FLAG_KEY in avcodec_decode_video.
This fixes decoding of MPNG, which currently is incorrectly decoded as
CorePNG delta frames.
CorePNG can not be correctly decoded via this old API either way.

Originally committed as revision 19079 to svn://

f988ce6c 05/31/2009 06:51 AM Andreas Öman

Add a lock manager API to libavcodec.

Allows an application to register a callback that manages mutexes
on behalf of FFmpeg.
With this callback registered FFmpeg is fully thread safe.

Originally committed as revision 19025 to svn://

ef516f73 05/22/2009 09:32 PM David Conrad

Move ALIGN macro to libavutil/common.h and use it in various places

Originally committed as revision 18898 to svn://

2e418f5e 04/23/2009 11:14 PM Stefano Sabatini

Make avcodec_thread_init() set the thread count, even in the case when
threads support is not enabled. This should avoid the need for
thread_count explicit setting in applications.

Originally committed as revision 18670 to svn://

445f0a8b 04/22/2009 01:54 AM Michael Niedermayer

Update safety check as the maximum pixel size is no longer 4.
New max size is 16bit * 4 samples (RGBA).

Originally committed as revision 18655 to svn://

238ef6da 04/12/2009 01:17 PM Reimar Döffinger

Add a av_fast_malloc function and replace several uses of av_fast_realloc,
thus avoiding potential memleaks and pointless memcpys.

Originally committed as revision 18470 to svn://

c81185a1 04/10/2009 12:09 AM Michael Niedermayer

Make sure mpeg2 has its height rounded up to 32 as that is needed
for interlaced stuff.
This might have been exploitable when emu edge was not set though
note this bug has been introduced just a few days ago.

Originally committed as revision 18405 to svn://

7a00bbad 04/07/2009 03:59 PM Thilo Borgmann

Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
AVPacket argument rather than a const uint8_t *buf + int buf_size. This allows
passing of packet-specific flags from demuxer to decoder, such as the keyframe
flag, which appears necessary to playback corePNG P-frames....

41913a35 04/01/2009 08:55 AM Gwenole Beauchesne

Add 16cif video frame size abbreviation. i.e. -s alias for 1408x1152.

Originally committed as revision 18301 to svn://

45bae968 03/19/2009 09:36 PM Reimar Döffinger

Fix indentation after r18047.

Originally committed as revision 18048 to svn://

c9d6e847 03/19/2009 09:34 PM Reimar Döffinger

Change linesize alignment method to ensure that linesize0 == 2*linesize1
for YUV420P and YUV422P always.
Fixes MPEG-2 4:2:2 encoding on PPC and ARM, and should fix mxf_d10 regression.

Originally committed as revision 18047 to svn://

6059f13c 02/24/2009 06:51 PM Michael Niedermayer


Originally committed as revision 17568 to svn://

414d9d7f 02/24/2009 06:47 PM Michael Niedermayer

av_hwaccel_next() by Gwenole Beauchesne.

Originally committed as revision 17567 to svn://

c895618b 02/24/2009 06:46 PM Michael Niedermayer

av_register_hwaccel() from Gwenole Beauchesne.

Originally committed as revision 17566 to svn://

f8c96d01 02/23/2009 03:18 PM Reimar Döffinger

Check return value of ff_fill_pointer in avcodec_default_get_buffer,
if it returns -1 we do not know how to allocate an AVFrame for that format
and must return -1 instead of returning nonsense.

Originally committed as revision 17542 to svn://

c269cf68 02/23/2009 01:35 PM Michael Niedermayer

Approved hunks for VAAPI / our new shiny hwaccel API
by Gwenole Beauchesne gbeauchesne splitted desktop com

Originally committed as revision 17539 to svn://