Commit Graph

588 Commits

Author SHA1 Message Date
Martin Storsjö 3641b0489c Add support for iLBC decoding/encoding via the external library libilbc
The library is 3-clause BSD licensed.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-18 22:00:35 +03:00
Diego Biurrun 0c517644b2 avcodec/utils: cast a function argument to shut up a compiler warning
libavcodec/utils.c:251: note: expected ‘const uint8_t *’ but argument is of type ‘const short int *’
2012-05-20 15:09:07 +02:00
Anton Khirnov c22953b8a3 lavc: check that extended_data is properly set in avcodec_encode_audio2(). 2012-05-09 17:47:11 +02:00
Anton Khirnov a5117a2444 lavc: pad last audio frame with silence when needed. 2012-05-09 17:46:54 +02:00
Justin Ruggles f132248028 avcodec: do not needlessly set packet size to 0 in avcodec_encode_audio2()
It is already set to 0 by av_free_packet()
2012-05-07 12:14:05 -04:00
Justin Ruggles 74e10b6204 avcodec: for audio encoding, reset output packet when it is not valid 2012-05-07 12:14:05 -04:00
Justin Ruggles fa0319b4fd avcodec: refactor avcodec_encode_audio2() to merge common branches 2012-05-07 12:14:05 -04:00
Justin Ruggles b461cd4deb avcodec: remove fallbacks for AVCodec.encode() in avcodec_encode_audio2()
We no longer have any audio encoders using AVCodec.encode().
2012-05-07 12:14:04 -04:00
Anton Khirnov 828bd088f3 lavc: add sample rate and channel layout to AVFrame.
Rationale is the same as for video width/height etc.
2012-05-07 07:08:03 +02: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
Alex Converse df8d5eaa14 avcodec_string: Favor AVCodecContext.codec over the default codec.
This improves output for formats with more than one AVCodec.
2012-04-17 14:51:23 -07:00
Justin Ruggles c58846f3a8 avcodec: use align == 0 for default alignment in avcodec_fill_audio_frame()
Use default alignment in audio_get_buffer()
2012-04-09 10:20:35 -04:00
Justin Ruggles 1337de0c4b avcodec: validate the channel layout vs. channel count for decoders
Set avctx->channel_layout to 0 if the channel count does not match
avctx->channels.
2012-04-08 18:45:58 -04:00
Anton Khirnov 3c6607eb6f avcodec_encode_{audio,video}: only reallocate output packet when it has non-zero size.
Otherwise realloc would free it, which would result in double free
later.
2012-03-28 09:28:47 +02:00
Ronald S. Bultje bc1ef85520 lavc/avconv: support changing frame sizes in codecs with frame mt.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-03-24 21:29:16 +01:00
Justin Ruggles a1977e0103 lavc: shrink encoded audio packet size after encoding. 2012-03-20 14:12:54 -04:00
Ronald S. Bultje c346f6304c adpcm: fix nb_samples rounding for adpcm_ima_dk3, and update reference. 2012-03-18 15:25:25 -07:00
Justin Ruggles 9524cf79df avcodec: add av_get_audio_frame_duration() function.
This is a utility function for the user to get the frame duration based on
the codec id, frame size in bytes, and various AVCodecContext parameters.
2012-03-05 13:08:15 -05:00
Justin Ruggles 6699d07480 avcodec: add av_get_exact_bits_per_sample() function
This only returns bits per sample when it is exactly correct. That is, the
codec contains only raw samples with no frame headers or padding. This applies
to basically all PCM codecs and a small subset of ADPCM codecs.
2012-03-05 13:08:15 -05:00
Anton Khirnov 44fe77b350 lavc: make codec_is_decoder/encoder() public. 2012-03-04 21:08:52 +01:00
Anton Khirnov 7fb6c9225c lavc: free the output packet when encoding failed or produced no output. 2012-03-03 06:31:41 +01:00
Anton Khirnov e42e9b0e4d lavc: preserve avpkt->destruct in ff_alloc_packet().
Also, don't bother with saving/restoring data, av_init_packet doesn't
touch it.
2012-03-03 06:31:41 +01:00
Anton Khirnov eb727387fd lavc: shrink encoded video packet size after encoding.
Based on a patch by Nicolas George <nicolas.george <at> normalesup.org>
2012-03-01 22:21:35 +01:00
Diego Biurrun d10319d87f avcodec_default_reget_buffer(): fix compilation in DEBUG mode 2012-02-27 20:58:43 +01:00
Anton Khirnov 03ca0a5b30 lavc: merge two if()s with the same condition. 2012-02-25 07:48:52 +01:00
Anton Khirnov d55fa6f9cb lavc: factorize setting got_packet_ptr in avcodec_encode_video2() 2012-02-25 07:48:46 +01:00
Anton Khirnov 52953d61ca lavc: signal no output when a NULL frame is passed to audio encoder without delay 2012-02-25 07:48:36 +01:00
Ronald S. Bultje 87840eeb71 avcodec: disallow reget_buffer() if pix_fmt changed. 2012-02-24 14:28:15 -08:00
Anton Khirnov ff311c0918 lavc: drop encode() support for video.
All video encoders have been converted to encode2(), all new encoders
should also use only encode2().
2012-02-23 20:26:26 +01:00
Justin Ruggles 70749c483c avcodec: do not override pts or duration from the audio encoder
This allows encoders to set pts and/or duration even if they do not use
CODEC_CAP_DELAY.
2012-02-21 15:18:51 -05:00
Justin Ruggles 91a28b0e8e avcodec: add ff_samples_to_time_base() convenience function to internal.h 2012-02-20 15:20:17 -05:00
Martin Storsjö 9cf0841ef3 dsputil: Add ff_ prefix to the dsputil*_init* functions
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-15 22:06:34 +02:00
Paul B Mahol dcd2b55e1a Check AVCodec.pix_fmts in avcodec_open2()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-02-10 13:24:37 -05:00
Justin Ruggles b758cf7343 avcodec: set avpkt->size to 0 if encode2() did not output a packet 2012-02-09 21:51:41 -05:00
Justin Ruggles a75bc764ec avcodec: for audio encoding, set packet dts to packet pts.
There are no audio encoders which do frame reordering.
2012-02-09 21:51:29 -05:00
Anton Khirnov 52f82a1148 lavc: add avcodec_encode_video2() that encodes from an AVFrame -> AVPacket
Deprecate avcodec_encode_video().
2012-02-08 20:54:24 +01:00
Ronald S. Bultje 9b027c0d07 dsputil: set STRIDE_ALIGN to 16 for x86 also.
This fixes crashes in e.g. PNG decoding with SSE2 enabled. In fact, many
x86 optimizations for codecs assume that our buffer strides are 16-byte
aligned.
2012-02-07 14:54:46 -08:00
Justin Ruggles 1a670973a7 ff_alloc_packet: modify the size of the packet to match the requested size
This will simplify encoders which use this function to request the exact
packet size rather than the maximum size.
2012-02-01 16:33:27 -05:00
Janne Grunau 316fc7443b avcodec: Add av_fast_padded_malloc().
Wrapper around av_fast_malloc() that keeps FF_INPUT_BUFFER_PADDING_SIZE
zero-padded bytes at the end of the used buffer.

Based on a patch by Reimar Döffinger <Reimar.Doeffinger@gmx.de>.
2012-02-01 19:19:35 +01:00
Anton Khirnov bc90199848 lavc: set AVCodecContext.codec in avcodec_get_context_defaults3().
This way, if the AVCodecContext is allocated for a specific codec, the
caller doesn't need to store this codec separately and then pass it
again to avcodec_open2().

It also allows to set codec private options using av_opt_set_* before
opening the codec.
2012-01-31 16:53:35 +01:00
Anton Khirnov 0e72ad95f9 lavc: make avcodec_close() work properly on unopened codecs.
I.e. free the priv_data and other stuff allocated in
avcodec_alloc_context3() and not segfault.
2012-01-31 07:56:21 +01:00
Anton Khirnov af08d9aeea lavc: add avcodec_is_open().
It allows to check whether an AVCodecContext is open in a documented
way. Right now the undocumented way this check is done in lavf/lavc is
by checking whether AVCodecContext.codec is NULL. However it's desirable
to be able to set AVCodecContext.codec before avcodec_open2().
2012-01-31 07:55:24 +01:00
Anton Khirnov 2d9535ad31 avcodec_align_dimensions2: set only 4 linesizes, not AV_NUM_DATA_POINTERS.
This function is video-only, so there's no point in setting more
linesizes.

Fixes stack corruption in avplay.
2012-01-28 19:44:55 +01:00
Martin Storsjö 9a7dc618c5 libavcodec: Don't crash in avcodec_encode_audio if time_base isn't set
Earlier, calling avcodec_encode_audio worked fine even if time_base
wasn't set. Now it crashes due to trying to scale the output pts to
the codec context time base. This affects e.g. VLC.

If no time_base is set for audio codecs, set it to the sample
rate.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-01-27 20:52:32 +02:00
Anton Khirnov 3211932c51 lavc: remove disabled FF_API_AVCODEC_INIT cruft. 2012-01-27 10:38:34 +01:00
Anton Khirnov 491f443e1f lavc: remove disabled FF_API_ER cruft. 2012-01-27 10:38:34 +01:00
Anton Khirnov d2d931500b lavc: remove disabled FF_API_AVCODEC_OPEN cruft. 2012-01-27 10:38:34 +01:00
Anton Khirnov fbca04e6f6 lavc: remove disabled FF_API_OLD_FF_PICT_TYPES cruft. 2012-01-27 10:38:34 +01:00
Anton Khirnov 9a79bb552a lavc: remove disabled FF_API_THREAD_INIT cruft. 2012-01-27 10:38:34 +01:00
Anton Khirnov 284e65d64e lavc: remove disabled FF_API_OLD_SAMPLE_FMT cruft. 2012-01-27 10:38:33 +01:00