diff options
author | Michael Niedermayer | 2012-10-13 15:42:49 +0200 |
---|---|---|
committer | Michael Niedermayer | 2012-10-13 15:42:49 +0200 |
commit | 18884f159b617208dd69fb35fa127f4fdedf5ba1 (patch) | |
tree | 2eae5d696ef3b8f8f03cb9c58ee88632ff9cc856 | |
parent | c55bebe2cc7bd444f83a678babc1b287aa7a3da1 (diff) | |
parent | 0a7005bebd23ade7bb852bce0401af1a8fdbb723 (diff) |
Merge commit '0a7005bebd23ade7bb852bce0401af1a8fdbb723'
* commit '0a7005bebd23ade7bb852bce0401af1a8fdbb723':
rtpdec_xiph: fix function return type
smjpeg: fix type of 'ret' variable in smjpeg_read_packet()
mpegvideo: remove write-only variable
Use proper return values in case of missing features
fate: add avstring test
rangecoder-test: Set error message log level to error, instead of debug
Conflicts:
libavcodec/aacdec.c
libavcodec/amrnbdec.c
libavcodec/mpegvideo.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/aac_adtstoasc_bsf.c | 4 | ||||
-rw-r--r-- | libavcodec/aacdec.c | 6 | ||||
-rw-r--r-- | libavcodec/ac3dec.c | 2 | ||||
-rw-r--r-- | libavcodec/alsdec.c | 6 | ||||
-rw-r--r-- | libavcodec/amrnbdec.c | 2 | ||||
-rw-r--r-- | libavcodec/amrwbdec.c | 2 | ||||
-rw-r--r-- | libavcodec/eac3dec.c | 2 | ||||
-rw-r--r-- | libavcodec/flacdec.c | 2 | ||||
-rw-r--r-- | libavcodec/mpc8.c | 2 | ||||
-rw-r--r-- | libavcodec/mpegvideo.c | 4 | ||||
-rw-r--r-- | libavcodec/rangecoder.c | 1 | ||||
-rw-r--r-- | libavcodec/tta.c | 2 | ||||
-rw-r--r-- | libavcodec/wmaprodec.c | 2 | ||||
-rw-r--r-- | libavcodec/wmavoice.c | 2 | ||||
-rw-r--r-- | libavformat/rtpdec_qt.c | 6 | ||||
-rw-r--r-- | libavformat/rtpdec_xiph.c | 2 | ||||
-rw-r--r-- | libavformat/smjpegdec.c | 3 | ||||
-rw-r--r-- | tests/fate/libavutil.mak | 4 | ||||
-rw-r--r-- | tests/ref/fate/avstring | 27 |
19 files changed, 57 insertions, 24 deletions
diff --git a/libavcodec/aac_adtstoasc_bsf.c b/libavcodec/aac_adtstoasc_bsf.c index 519641c5c6..e6b32ceda1 100644 --- a/libavcodec/aac_adtstoasc_bsf.c +++ b/libavcodec/aac_adtstoasc_bsf.c @@ -62,7 +62,7 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc, if (!hdr.crc_absent && hdr.num_aac_frames > 1) { av_log_missing_feature(avctx, "Multiple RDBs per frame with CRC", 0); - return -1; + return AVERROR_PATCHWELCOME; } buf += AAC_ADTS_HEADER_SIZE + 2*!hdr.crc_absent; @@ -75,7 +75,7 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc, init_get_bits(&gb, buf, buf_size * 8); if (get_bits(&gb, 3) != 5) { av_log_missing_feature(avctx, "PCE based channel configuration, where the PCE is not the first syntax element", 0); - return -1; + return AVERROR_PATCHWELCOME; } init_put_bits(&pb, pce_data, MAX_PCE_SIZE); pce_size = avpriv_copy_pce_data(&pb, &gb)/8; diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 8ab678768e..295243a573 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -666,7 +666,7 @@ static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx, if (get_bits1(gb)) { // frameLengthFlag av_log_missing_feature(avctx, "960/120 MDCT window", 1); - return -1; + return AVERROR_PATCHWELCOME; } if (get_bits1(gb)) // dependsOnCoreCoder @@ -1670,7 +1670,7 @@ static int decode_ics(AACContext *ac, SingleChannelElement *sce, return -1; if (get_bits1(gb)) { av_log_missing_feature(ac->avctx, "SSR", 1); - return -1; + return AVERROR_PATCHWELCOME; } } @@ -2730,7 +2730,7 @@ static int latm_decode_audio_specific_config(struct LATMContext *latmctx, if (config_start_bit % 8) { av_log_missing_feature(latmctx->aac_ctx.avctx, "Non-byte-aligned audio-specific config", 1); - return AVERROR_INVALIDDATA; + return AVERROR_PATCHWELCOME; } if (asclen <= 0) return AVERROR_INVALIDDATA; diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 674de7a62b..7fb380ca87 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -876,7 +876,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk) if (s->eac3 && get_bits1(gbc)) { /* TODO: parse enhanced coupling strategy info */ av_log_missing_feature(s->avctx, "Enhanced coupling", 1); - return -1; + return AVERROR_PATCHWELCOME; } /* determine which channels are coupled */ diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index 46dd0b45ae..60dd8161e8 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -427,9 +427,9 @@ static int check_specific_config(ALSDecContext *ctx) } \ } - MISSING_ERR(sconf->floating, "Floating point decoding", -1); - MISSING_ERR(sconf->rlslms, "Adaptive RLS-LMS prediction", -1); - MISSING_ERR(sconf->chan_sort, "Channel sorting", 0); + MISSING_ERR(sconf->floating, "Floating point decoding", AVERROR_PATCHWELCOME); + MISSING_ERR(sconf->rlslms, "Adaptive RLS-LMS prediction", AVERROR_PATCHWELCOME); + MISSING_ERR(sconf->chan_sort, "Channel sorting", 0); return error; } diff --git a/libavcodec/amrnbdec.c b/libavcodec/amrnbdec.c index 32b754f7d5..6ba6fbe3ad 100644 --- a/libavcodec/amrnbdec.c +++ b/libavcodec/amrnbdec.c @@ -969,7 +969,7 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data, if (p->cur_frame_mode == MODE_DTX) { av_log_missing_feature(avctx, "dtx mode", 0); av_log(avctx, AV_LOG_INFO, "Note: libopencore_amrnb supports dtx\n"); - return -1; + return AVERROR_PATCHWELCOME; } if (p->cur_frame_mode == MODE_12k2) { diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c index 738dd98576..7e45f42554 100644 --- a/libavcodec/amrwbdec.c +++ b/libavcodec/amrwbdec.c @@ -1130,7 +1130,7 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data, if (ctx->fr_cur_mode == MODE_SID) { /* Comfort noise frame */ av_log_missing_feature(avctx, "SID mode", 1); - return -1; + return AVERROR_PATCHWELCOME; } ff_amr_bit_reorder((uint16_t *) &ctx->frame, sizeof(AMRWBFrame), diff --git a/libavcodec/eac3dec.c b/libavcodec/eac3dec.c index 91e35ad934..2bd0619169 100644 --- a/libavcodec/eac3dec.c +++ b/libavcodec/eac3dec.c @@ -322,7 +322,7 @@ int ff_eac3_parse_header(AC3DecodeContext *s) handled like AC-3 DolbyNet, but we cannot be sure until we have a sample which utilizes this feature. */ av_log_missing_feature(s->avctx, "Reduced sampling rates", 1); - return -1; + return AVERROR_PATCHWELCOME; } skip_bits(gbc, 5); // skip bitstream id diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index 61c30e8c6f..24917ab36a 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -370,7 +370,7 @@ static inline int decode_subframe(FLACContext *s, int channel) } if (bps > 32) { av_log_missing_feature(s->avctx, "decorrelated bit depth > 32", 0); - return -1; + return AVERROR_PATCHWELCOME; } //FIXME use av_log2 for types diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c index 64d19193b0..8b1c9353ba 100644 --- a/libavcodec/mpc8.c +++ b/libavcodec/mpc8.c @@ -134,7 +134,7 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx) channels = get_bits(&gb, 4) + 1; if (channels > 2) { av_log_missing_feature(avctx, "Multichannel MPC SV8", 1); - return -1; + return AVERROR_PATCHWELCOME; } c->MSS = get_bits1(&gb); c->frames = 1 << (get_bits(&gb, 3) * 2); diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index a3881f9a49..cc2bccac22 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -799,7 +799,7 @@ fail: */ av_cold int ff_MPV_common_init(MpegEncContext *s) { - int i, err; + int i; int nb_slices = (HAVE_THREADS && s->avctx->active_thread_type & FF_THREAD_SLICE) ? s->avctx->thread_count : 1; @@ -877,7 +877,7 @@ av_cold int ff_MPV_common_init(MpegEncContext *s) avcodec_get_frame_defaults(&s->picture[i].f); } - if ((err = init_context_frame(s))) + if (init_context_frame(s)) goto fail; s->parse_context.state = -1; diff --git a/libavcodec/rangecoder.c b/libavcodec/rangecoder.c index f0084a9505..986fc4cafa 100644 --- a/libavcodec/rangecoder.c +++ b/libavcodec/rangecoder.c @@ -116,6 +116,7 @@ int ff_rac_terminate(RangeCoder *c) #define SIZE 10240 #include "libavutil/lfg.h" +#include "libavutil/log.h" int main(void) { diff --git a/libavcodec/tta.c b/libavcodec/tta.c index ce41cb310f..f06c54ccd1 100644 --- a/libavcodec/tta.c +++ b/libavcodec/tta.c @@ -200,7 +200,7 @@ static av_cold int tta_decode_init(AVCodecContext * avctx) } if (s->format == FORMAT_ENCRYPTED) { av_log_missing_feature(s->avctx, "Encrypted TTA", 0); - return AVERROR(EINVAL); + return AVERROR_PATCHWELCOME; } avctx->channels = s->channels = get_bits(&s->gb, 16); if (s->channels > 1 && s->channels < 9) diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index b70e1f5380..9de8c3861b 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -314,7 +314,7 @@ static av_cold int decode_init(AVCodecContext *avctx) bits = ff_wma_get_frame_len_bits(avctx->sample_rate, 3, s->decode_flags); if (bits > WMAPRO_BLOCK_MAX_BITS) { av_log_missing_feature(avctx, "14-bits block sizes", 1); - return AVERROR_INVALIDDATA; + return AVERROR_PATCHWELCOME; } s->samples_per_frame = 1 << bits; diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c index 0cf10da8c4..8715d80830 100644 --- a/libavcodec/wmavoice.c +++ b/libavcodec/wmavoice.c @@ -1763,7 +1763,7 @@ static int synth_superframe(AVCodecContext *ctx, int *got_frame_ptr) * the wild yet. */ if (!get_bits1(gb)) { av_log_missing_feature(ctx, "WMAPro-in-WMAVoice support", 1); - return -1; + return AVERROR_PATCHWELCOME; } /* (optional) nr. of samples in superframe; always <= 480 and >= 0 */ diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c index 4decdca19c..f0f01d9b19 100644 --- a/libavformat/rtpdec_qt.c +++ b/libavformat/rtpdec_qt.c @@ -99,7 +99,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, if (!is_start || !is_finish) { av_log_missing_feature(s, "RTP-X-QT with payload description " "split over several packets", 1); - return AVERROR(ENOSYS); + return AVERROR_PATCHWELCOME; } skip_bits(&gb, 12); // reserved data_len = get_bits(&gb, 16); @@ -162,7 +162,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, if (has_packet_info) { av_log_missing_feature(s, "RTP-X-QT with packet specific info", 1); - return AVERROR(ENOSYS); + return AVERROR_PATCHWELCOME; } alen = len - avio_tell(&pb); @@ -225,7 +225,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, default: /* unimplemented */ av_log_missing_feature(NULL, "RTP-X-QT with packing scheme 2", 1); - return AVERROR(ENOSYS); + return AVERROR_PATCHWELCOME; } } diff --git a/libavformat/rtpdec_xiph.c b/libavformat/rtpdec_xiph.c index ae10c78304..773f4aa391 100644 --- a/libavformat/rtpdec_xiph.c +++ b/libavformat/rtpdec_xiph.c @@ -242,7 +242,7 @@ static int get_base128(const uint8_t ** buf, const uint8_t * buf_end) /** * Based off parse_packed_headers in Vorbis RTP */ -static unsigned int +static int parse_packed_headers(const uint8_t * packed_headers, const uint8_t * packed_headers_end, AVCodecContext * codec, PayloadContext * xiph_data) diff --git a/libavformat/smjpegdec.c b/libavformat/smjpegdec.c index d1aad9f45b..9fcefe782e 100644 --- a/libavformat/smjpegdec.c +++ b/libavformat/smjpegdec.c @@ -135,8 +135,9 @@ static int smjpeg_read_header(AVFormatContext *s) static int smjpeg_read_packet(AVFormatContext *s, AVPacket *pkt) { SMJPEGContext *sc = s->priv_data; - uint32_t dtype, ret, size, timestamp; + uint32_t dtype, size, timestamp; int64_t pos; + int ret; if (s->pb->eof_reached) return AVERROR_EOF; diff --git a/tests/fate/libavutil.mak b/tests/fate/libavutil.mak index 488ec6b674..f62e8447aa 100644 --- a/tests/fate/libavutil.mak +++ b/tests/fate/libavutil.mak @@ -8,6 +8,10 @@ fate-aes: libavutil/aes-test$(EXESUF) fate-aes: CMD = run libavutil/aes-test fate-aes: REF = /dev/null +FATE_LIBAVUTIL += fate-avstring +fate-avstring: libavutil/avstring-test$(EXESUF) +fate-avstring: CMD = run libavutil/avstring-test + FATE_LIBAVUTIL += fate-base64 fate-base64: libavutil/base64-test$(EXESUF) fate-base64: CMD = run libavutil/base64-test diff --git a/tests/ref/fate/avstring b/tests/ref/fate/avstring new file mode 100644 index 0000000000..bc231e8148 --- /dev/null +++ b/tests/ref/fate/avstring @@ -0,0 +1,27 @@ +Testing av_get_token() +|''| -> || + || +|| -> || + || +|:| -> || + |:| +|\| -> |\| + || +|'| -> || + || +| '' :| -> || + |:| +| '' '' :| -> | | + |:| +|foo '' :| -> |foo | + |:| +|'foo'| -> |foo| + || +|foo | -> |foo| + || +| ' foo ' | -> | foo | + || +|foo\| -> |foo\| + || +|foo': blah:blah| -> |foo: blah:blah| + || +|foo\: blah:blah| -> |foo: blah| + |:blah| +|foo'| -> |foo| + || +|'foo : ' :blahblah| -> |foo : | + |:blahblah| +|\ :blah| -> | | + |:blah| +| foo| -> |foo| + || +| foo | -> |foo| + || +| foo \ | -> |foo | + || +|foo ':blah| -> |foo :blah| + || +| foo bar : blahblah| -> |foo bar| + |: blahblah| +|\f\o\o| -> |foo| + || +|'foo : \ \ ' : blahblah| -> |foo : \ \ | + |: blahblah| +|'\fo\o:': blahblah| -> |\fo\o:| + |: blahblah| +|\'fo\o\:': foo ' :blahblah| -> |'foo:: foo | + |:blahblah| |