Paul B Mahol
5285a7549f
pcmenc: don't allocate unused avctx->coded_frame
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Clément Bœsch
1ec94b0f06
lavc: factorize ff_{thread_,re,}get_buffer error messages.
...
Coccinelle profile used:
@@
expression r, ctx, f, loglevel, str, flags;
@@
-if ((r = ff_get_buffer(ctx, f, flags)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_get_buffer(ctx, f, flags)) < 0)
+ return r;
@@
expression r, ctx, f, loglevel, str;
@@
-if ((r = ff_reget_buffer(ctx, f)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_reget_buffer(ctx, f)) < 0)
+ return r;
@@
expression r, ctx, f, loglevel, str, flags;
@@
-if ((r = ff_thread_get_buffer(ctx, f, flags)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_thread_get_buffer(ctx, f, flags)) < 0)
+ return r;
...along with some manual patches for the remaining ones.
12 years ago
Anton Khirnov
759001c534
lavc decoders: work with refcounted frames.
12 years ago
James Zern
bcaf64b605
normalize calls to ff_alloc_packet2
...
- check ret < 0
- remove excessive error log
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Justin Ruggles
a6bb39add2
pcm: decode directly to the user-provided AVFrame
12 years ago
Anton Khirnov
594d4d5df3
lavc: add a wrapper for AVCodecContext.get_buffer().
...
It will be useful in the upcoming transition to refcounted AVFrames.
12 years ago
Michael Niedermayer
f0695b09dd
pcmdec: check codec_id
...
Fixes out of array accesses
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Paul B Mahol
dd59f0125d
add some planar PCM encoders
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
f17f759544
pcmdec: use memcpy() when possible for planar decoders
...
This is faster (at least with clang).
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Justin Ruggles
00dd9a6d6a
pcm: fix decoding of pcm_s16le_planar on big-endian
...
The sample count is decremented by the DECODE() macro and needs to be reset
in each loop iteration. Also, DECODE() increments the src pointer so that does
not need to be done separately.
12 years ago
Paul B Mahol
00e02366a5
pcmenc: use ENCODE macro for pcm_s8
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Michael Niedermayer
2d232f8b88
pcm: revert from libavs planar code to durandals.
...
The libav code does not work on big endian.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Paul B Mahol
da8242e2d6
8svx: move pcm_s8_planar decoder to pcm.c
...
Removes limitation of max 2 channels for pcm_s8_planar decoder by moving
it to more natural place.
AV_CODEC_ID_8SVX_RAW is not used by anything anymore and is going to be
removed.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Justin Ruggles
c9d0f4506f
pcmdec: use planar sample format for pcm_s16le_planar
12 years ago
Paul B Mahol
0df7d95a5e
pcmenc: remove dead increment
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
6557c46d91
pcm: move i into for loop to avoid { } inside switch statement
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
9ba41ae63e
PCM signed 16-bit big-endian planar decoder
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
467dfd5dfa
PCM signed 24-bit/32-bit little-endian planar decoder
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
eca2eb2dfa
pcm: give more descriptive name to codec
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Michael Niedermayer
7373b3ad04
pcmdec: consistently use codec_id, fixes out of array reads
...
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
b8551f8ea7
pcmdec: check that channels is valid.
...
Prevents a division by 0
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
00aa7fa786
pcm: fix handling of more than 8 channels for planar
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Justin Ruggles
bb6941af2a
lavc: move SANE_NB_CHANNELS to internal.h and use it in the PCM decoders
12 years ago
Mans Rullgard
abdee95224
pcm: define AVCodec instances only for enabled codecs
...
This defines an AVCodec only if the corresponding CONFIG option is
enabled instead of using the broad CONFIG_ENCODERS/DECODERS.
Signed-off-by: Mans Rullgard <mans@mansr.com>
12 years ago
Diego Biurrun
d5c62122a7
Move av_reverse table to libavcodec
...
It is only used in that library.
12 years ago
Justin Ruggles
7e5f045039
pcmdec: use planar sample format for pcm_lxf
12 years ago
Anton Khirnov
36ef5369ee
Replace all CODEC_ID_* with AV_CODEC_ID_*
12 years ago
Stefano Sabatini
201b409da0
lavc/pcm: clarify error message from pcm_decode_frame()
...
Extend/clarify an error message in case of invalid packet size, and
return a proper error message instead of -1.
Improve debuggability.
13 years ago
Mans Rullgard
7d7b40f48a
pcmenc: set correct bitrate value
...
This fixes a bogus bitrate value in the header of WAV files with
alaw/ulaw audio.
Signed-off-by: Mans Rullgard <mans@mansr.com>
13 years ago
Aneesh Dogra
6d21f49879
pcm: K&R formatting cosmetics
...
Signed-off-by: Diego Biurrun <diego@biurrun.de>
13 years ago
Paul B Mahol
ae2c33b0c2
cosmetics: remove superfluous curly brackets
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Michael Niedermayer
11e8f3e7a2
pcm: switch to ff_alloc_packet2().
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Paul B Mahol
32a5775a91
pcm: leave sample format conversion to libswresample
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Justin Ruggles
a8bdf2405c
check for coded_frame allocation failure in several audio encoders
13 years ago
Justin Ruggles
255ad8881d
audio encoders: do not set coded_frame->key_frame.
...
it is already set in avcodec_alloc_frame()
13 years ago
Stefano Sabatini
d21b82fd3a
lavc: provide aliases to the PCM A-law/mu-law codecs
...
They are also known as G.711 codecs.
13 years ago
Justin Ruggles
3c432631e9
pcmenc: Do not set avpkt->size.
...
It is already the correct size as set by ff_alloc_packet().
13 years ago
Paul B Mahol
1fa24d08b2
pcm: remove redundant assignment
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Paul B Mahol
ae8dc203b2
pcm: check return value of avcodec_alloc_frame()
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Justin Ruggles
05f95443ca
pcmenc: use AVCodec.encode2()
13 years ago
Justin Ruggles
b2c75b6e63
avcodec: Add avcodec_encode_audio2() as replacement for avcodec_encode_audio()
...
This allows audio encoders to optionally take an AVFrame as input and write
encoded output to an AVPacket.
This also adds AVCodec.encode2() which will also be usable by video and
subtitle encoders once support is implemented in the public functions.
13 years ago
Justin Ruggles
56f22b7e16
pcmenc: set frame_size to 0.
...
This indicates that the actual frame size is based on the buf_size passed to
avcodec_encode_audio().
13 years ago
Justin Ruggles
0eea212943
Add avcodec_decode_audio4().
...
Deprecate avcodec_decode_audio3().
Implement audio support in avcodec_default_get_buffer().
Implement the new audio decoder API in all audio decoders.
13 years ago
Justin Ruggles
c1848c4b26
pcmdec: remove unneeded resetting of samples pointer
13 years ago
Justin Ruggles
f1901180e0
pcmdec: fix output buffer size check by calculating the actual output size
...
prior to decoding.
13 years ago
Justin Ruggles
154cd253e5
pcmdec: move codec-specific variable declarations to the corresponding codec
...
blocks.
13 years ago
Justin Ruggles
0093f96d34
pcmdec: return buf_size instead of src-buf.
...
The values will always be the same, so this change eliminates an unneeded
variable. It also gets rid of the need to reset src when memcpy() is used.
13 years ago
Justin Ruggles
85579b6381
avcodec: remove the Zork PCM encoder.
...
The Zork PCM decoder does not decode the 1 sample we have correctly, therefore
the encoder based on the decoder is also incorrect. There is no good reason to
keep the encoder.
13 years ago
Justin Ruggles
67a3b67c71
pcm_zork: use AV_SAMPLE_FMT_U8 instead of shifting all samples by 8.
13 years ago
Justin Ruggles
06af335a33
pcmenc: remove unneeded sample_fmt check.
...
It is already checked by avcodec_open2().
13 years ago